Enum rustc_ap_rustc_target::abi::TagEncoding[][src]

pub enum TagEncoding {
    Direct,
    Niche {
        dataful_variant: VariantIdx,
        niche_variants: RangeInclusive<VariantIdx>,
        niche_start: u128,
    },
}

Variants

Direct

The tag directly stores the discriminant, but possibly with a smaller layout (so converting the tag to the discriminant can require sign extension).

Niche

Niche (values invalid for a type) encoding the discriminant: Discriminant and variant index coincide. The variant dataful_variant contains a niche at an arbitrary offset (field tag_field 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).

Show fields

Fields of Niche

dataful_variant: VariantIdxniche_variants: RangeInclusive<VariantIdx>niche_start: u128

Trait Implementations

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 method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.