pub struct Variant<'input> { /* private fields */ }
Expand description
A variant.
A variant consists of a discriminant value that selects the variant, and a list of members that are valid when the variant is selected.
Implementations§
Source§impl<'input> Variant<'input>
impl<'input> Variant<'input>
Sourcepub fn discriminant_value(&self) -> Option<u64>
pub fn discriminant_value(&self) -> Option<u64>
The discriminant value which selects this variant.
The sign of this value depends on the type of the discriminant member.
Sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
The name of the variant.
Currently this is only set for Rust enums.
Sourcepub fn bit_offset(&self) -> u64
pub fn bit_offset(&self) -> u64
The smallest offset in bits for a member of this variant.
Sourcepub fn bit_size(&self, hash: &FileHash<'_>) -> Option<u64>
pub fn bit_size(&self, hash: &FileHash<'_>) -> Option<u64>
The size in bits for the members of this variant, excluding leading and trailing padding.
Sourcepub fn layout<'me>(
&'me self,
bit_offset: u64,
bit_size: Option<u64>,
hash: &FileHash<'input>,
) -> Vec<Layout<'input, 'me>>
pub fn layout<'me>( &'me self, bit_offset: u64, bit_size: Option<u64>, hash: &FileHash<'input>, ) -> Vec<Layout<'input, 'me>>
The layout of members of this variant within a variant part.
The given bit_offset and bit_size should be for the variant part.
Sourcepub fn cmp_id(
_hash_a: &FileHash<'_>,
a: &Variant<'_>,
_hash_b: &FileHash<'_>,
b: &Variant<'_>,
) -> Ordering
pub fn cmp_id( _hash_a: &FileHash<'_>, a: &Variant<'_>, _hash_b: &FileHash<'_>, b: &Variant<'_>, ) -> Ordering
Compare the identifying information of two types.
Variants are considered equal if the discriminant values are equal.
This can be used to sort, and to determine if two types refer to the same definition (even if there are differences in the definitions).