pub enum Variants {
Single {
index: usize,
},
Tagged {
tag: Scalar,
variants: Vec<LayoutDetails>,
},
NicheFilling {
dataful_variant: usize,
niche_variants: RangeInclusive<usize>,
niche: Scalar,
niche_start: u128,
variants: Vec<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 !=
.
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
Formats the value using the given formatter. Read more