Crates.io | strawberry_fields |
lib.rs | strawberry_fields |
version | 0.1.0 |
source | src |
created_at | 2024-06-09 10:59:04.199676 |
updated_at | 2024-06-09 10:59:04.199676 |
description | Consume, read, and mutate struct fields with an iterator-like api. |
homepage | |
repository | https://github.com/Jeremiah-Griffin/strawberry_fields |
max_upload_size | |
id | 1266309 |
size | 11,076 |
Strawberry Fields allows for the "iteration" of struct fields without allocation or manipulating the memory layout of the type.
This crate's api mirrors the Iterator
trait from the standard library, with the primary distinction being that
there are seperate methods for owned, shared and unique reference types.
Q: Why not collect all fields in an array?
A: For very simple structs this may work, but for types which may contain a mix of concrete types and generics, developers would be required to introduce dynamic dispatch or enumeration: this incurs a runtime penalty.