pub struct EnumValue {
pub name: Ident,
pub index: usize,
pub discriminant: Option<i64>,
pub origin: Origin<Variant>,
}Expand description
One named value of an Enum.
Fields§
§name: Ident§index: usizePosition within its enum, 0..N-1. Not the identity — see
Self::discriminant — but the same “where it sits” fact every node in
an ordered list carries, and what a consumer falls back to when a
discriminant cannot be evaluated.
discriminant: Option<i64>The value Rust assigns — an explicit = N sets it, an implicit value
takes the previous plus one, starting at 0. This shape’s identity.
None once a spelling the frontend cannot evaluate (a const, a cfg,
arithmetic) has broken the chain, or once the chain has run out of i64.
That is not a failure: only a consumer that needs the number is
affected, and one that re-emits the spelling reads
Self::origin.syntax.discriminant instead.
origin: Origin<Variant>The value as written: = 0x07, attributes, doc comments — and its
delimiters, since B and B() are both fieldless and still spelled
differently.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Send for EnumValue
impl !Sync for EnumValue
impl Freeze for EnumValue
impl RefUnwindSafe for EnumValue
impl Unpin for EnumValue
impl UnsafeUnpin for EnumValue
impl UnwindSafe for EnumValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more