Enum rustc::ty::layout::Variants
[−]
[src]
pub enum Variants { Single { index: usize, }, Tagged { discr: Scalar, variants: Vec<LayoutDetails>, }, NicheFilling { dataful_variant: usize, niche_variants: RangeInclusive<usize>, niche: Scalar, niche_start: u128, variants: Vec<LayoutDetails>, }, }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Variants
Single
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Single enum variants, structs/tuples, unions, and all non-ADTs.
Fields of Single
index: usize | 🔬 This is a nightly-only experimental API. ( |
Tagged
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
General-case enums: for each case there is a struct, and they all have all space reserved for the discriminant, and their first field starts at a non-0 offset, after where the discriminant would go.
Fields of Tagged
discr: Scalar | 🔬 This is a nightly-only experimental API. ( |
variants: Vec<LayoutDetails> | 🔬 This is a nightly-only experimental API. ( |
NicheFilling
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
dataful_variant: usize | 🔬 This is a nightly-only experimental API. ( |
niche_variants: RangeInclusive<usize> | 🔬 This is a nightly-only experimental API. ( |
niche: Scalar | 🔬 This is a nightly-only experimental API. ( |
niche_start: u128 | 🔬 This is a nightly-only experimental API. ( |
variants: Vec<LayoutDetails> | 🔬 This is a nightly-only experimental API. ( |
Trait Implementations
impl PartialEq for Variants
[src]
fn eq(&self, __arg_0: &Variants) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Variants) -> bool
[src]
This method tests for !=
.
impl Eq for Variants
[src]
impl Hash for Variants
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Variants
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'gcx> HashStable<StableHashingContext<'gcx>> for Variants
[src]
fn hash_stable<W: StableHasherResult>(
&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>
)
[src]
&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?