Type Alias Variants

Source
pub type Variants = Variants<RustcFieldIdx, RustcEnumVariantIdx>;

Aliased Type§

enum Variants {
    Empty,
    Single {
        index: RustcEnumVariantIdx,
    },
    Multiple {
        tag: Scalar,
        tag_encoding: TagEncoding<RustcEnumVariantIdx>,
        tag_field: usize,
        variants: IndexVec<RustcEnumVariantIdx, LayoutData<RustcFieldIdx, RustcEnumVariantIdx>>,
    },
}

Variants§

§

Empty

A type with no valid variants. Must be uninhabited.

§

Single

Single enum variants, structs/tuples, unions, and all non-ADTs.

Fields

§index: RustcEnumVariantIdx

Always 0 for types that cannot have multiple variants.

§

Multiple

Enum-likes with more than one variant: each variant comes with a discriminant (usually the same as the variant index but the user can assign explicit discriminant values). That discriminant is encoded as a tag on the machine. The layout of each variant is a struct, and they all have space reserved for the tag. For enums, the tag is the sole field of the layout.

Fields

§tag: Scalar
§tag_encoding: TagEncoding<RustcEnumVariantIdx>
§tag_field: usize
§variants: IndexVec<RustcEnumVariantIdx, LayoutData<RustcFieldIdx, RustcEnumVariantIdx>>

Trait Implementations

§

impl<FieldIdx, VariantIdx> Clone for Variants<FieldIdx, VariantIdx>
where FieldIdx: Clone + Idx, VariantIdx: Clone + Idx,

§

fn clone(&self) -> Variants<FieldIdx, VariantIdx>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<FieldIdx, VariantIdx> Debug for Variants<FieldIdx, VariantIdx>
where FieldIdx: Debug + Idx, VariantIdx: Debug + Idx,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<FieldIdx, VariantIdx> Hash for Variants<FieldIdx, VariantIdx>
where FieldIdx: Hash + Idx, VariantIdx: Hash + Idx,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<FieldIdx, VariantIdx> PartialEq for Variants<FieldIdx, VariantIdx>
where FieldIdx: PartialEq + Idx, VariantIdx: PartialEq + Idx,

§

fn eq(&self, other: &Variants<FieldIdx, VariantIdx>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<FieldIdx, VariantIdx> Eq for Variants<FieldIdx, VariantIdx>
where FieldIdx: Eq + Idx, VariantIdx: Eq + Idx,

§

impl<FieldIdx, VariantIdx> StructuralPartialEq for Variants<FieldIdx, VariantIdx>
where FieldIdx: Idx, VariantIdx: Idx,