pub enum FieldPlacement {
Union(usize),
Array {
stride: Size,
count: u64,
},
Arbitrary {
offsets: Vec<Size>,
memory_index: Vec<u32>,
},
}
Describes how the fields of a type are located in memory.
All fields start at no offset. The usize
is the field count.
In the case of primitives the number of fields is 0
.
Array/vector-like placement, with all fields of identical types.
Fields of Array
Struct-like placement, with precomputed offsets.
Fields are guaranteed to not overlap, but note that gaps
before, between and after all the fields are NOT always
padding, and as such their contents may not be discarded.
For example, enum variants leave a gap at the start,
where the discriminant field in the enum layout goes.
Fields of Arbitrary
Offsets for the first byte of each field,
ordered to match the source definition order.
This vector does not go in increasing order.
Maps source order field indices to memory order indices,
depending how fields were permuted.
Get source indices of the fields by increasing offsets.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more