pub struct PeekEnum<'mem> { /* private fields */ }Expand description
Lets you read from an enum (implements read-only enum operations)
Implementations§
Source§impl<'mem> PeekEnum<'mem>
impl<'mem> PeekEnum<'mem>
Sourcepub fn variant_count(self) -> usize
pub fn variant_count(self) -> usize
Returns the number of variants in this enum
Sourcepub fn variant_name(self, index: usize) -> Option<&'static str>
pub fn variant_name(self, index: usize) -> Option<&'static str>
Returns the variant name at the given index
Sourcepub fn discriminant(self) -> i64
pub fn discriminant(self) -> i64
Returns the discriminant value for the current enum value
Sourcepub fn variant_index(self) -> usize
pub fn variant_index(self) -> usize
Returns the variant index for this enum value
Sourcepub fn active_variant(self) -> &'static Variant
pub fn active_variant(self) -> &'static Variant
Returns the active variant
Sourcepub fn variant_name_active(self) -> &'static str
pub fn variant_name_active(self) -> &'static str
Returns the name of the active variant for this enum value
Sourcepub fn field(self, index: usize) -> Option<Peek<'mem>>
pub fn field(self, index: usize) -> Option<Peek<'mem>>
Returns a PeekValue handle to a field of a tuple or struct variant by index
Sourcepub fn field_index(self, field_name: &str) -> Option<usize>
pub fn field_index(self, field_name: &str) -> Option<usize>
Returns the index of a field in the active variant by name
Sourcepub fn field_by_name(self, field_name: &str) -> Option<Peek<'mem>>
pub fn field_by_name(self, field_name: &str) -> Option<Peek<'mem>>
Returns a PeekValue handle to a field of a tuple or struct variant by name
Methods from Deref<Target = Peek<'mem>>§
Sourcepub fn id(&self) -> ValueId
pub fn id(&self) -> ValueId
Returns a unique identifier for this value, usable for cycle detection
Sourcepub fn ptr_eq(&self, other: &Peek<'_>) -> bool
pub fn ptr_eq(&self, other: &Peek<'_>) -> bool
Returns true if the two values are pointer-equal
Sourcepub fn eq(&self, other: &Peek<'_>) -> Option<bool>
pub fn eq(&self, other: &Peek<'_>) -> Option<bool>
Returns true if this scalar is equal to the other scalar
§Returns
false if equality comparison is not supported for this scalar type
Sourcepub fn partial_cmp(&self, other: &Peek<'_>) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Peek<'_>) -> Option<Ordering>
Compares this scalar with another and returns their ordering
§Returns
None if comparison is not supported for this scalar type
Sourcepub fn type_name(&self, f: &mut Formatter<'_>, opts: TypeNameOpts) -> Result
pub fn type_name(&self, f: &mut Formatter<'_>, opts: TypeNameOpts) -> Result
Sourcepub fn scalar_type(&self) -> Option<ScalarType>
pub fn scalar_type(&self) -> Option<ScalarType>
Get the scalar type if set.