pub enum Variants {
Single {
index: VariantIdx,
},
Tagged {
tag: Scalar,
variants: IndexVec<VariantIdx, LayoutDetails>,
},
NicheFilling {
dataful_variant: VariantIdx,
niche_variants: RangeInclusive<VariantIdx>,
niche: Scalar,
niche_start: u128,
variants: IndexVec<VariantIdx, LayoutDetails>,
},
}
Single enum variants, structs/tuples, unions, and all non-ADTs.
Fields of Single
General-case enums: for each case there is a struct, and they all have
all space reserved for the tag, and their first field starts
at a non-0 offset, after where the tag would go.
Fields of Tagged
Multiple cases distinguished by a niche (values invalid for a type):
the variant dataful_variant
contains a niche at an arbitrary
offset (field 0 of the enum), which for a variant with discriminant
d
is set to (d - niche_variants.start).wrapping_add(niche_start)
.
For example, Option<(usize, &T)>
is represented such that
None
has a null pointer for the second tuple field, and
Some
is the identity function (with a non-null reference).
Fields of NicheFilling
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