pub struct Enum {
pub description: String,
pub name: Spanned<Identifier<Type>>,
pub variants: Vec<EnumVariant>,
pub base_type: Spanned<BaseType>,
pub size_bits: Option<u32>,
pub generation_style: Option<EnumGenerationStyle>,
pub short_properties_span: Span,
pub properties_span: Option<Span>,
pub span: Span,
}Fields§
§description: String§name: Spanned<Identifier<Type>>§variants: Vec<EnumVariant>§base_type: Spanned<BaseType>§size_bits: Option<u32>§generation_style: Option<EnumGenerationStyle>§short_properties_span: Span§properties_span: Option<Span>§span: SpanSpan of the whole object
Implementations§
Source§impl Enum
impl Enum
Sourcepub fn iter_variants_with_discriminant(
&self,
) -> impl Iterator<Item = (i128, &EnumVariant)>
pub fn iter_variants_with_discriminant( &self, ) -> impl Iterator<Item = (i128, &EnumVariant)>
Get an iterator over the variants, but with an extra counter to get the specified discriminant for each.
Note: The validity of this is checked in the [passes::enum_values_checked] pass. If this function is run
before that pass, there might be weird results.
Sourcepub fn iter_variants_with_discriminant_mut(
&mut self,
) -> impl Iterator<Item = (i128, &mut EnumVariant)>
pub fn iter_variants_with_discriminant_mut( &mut self, ) -> impl Iterator<Item = (i128, &mut EnumVariant)>
Get an iterator over the variants, but with an extra counter to get the specified discriminant for each.
Note: The validity of this is checked in the [passes::enum_values_checked] pass. If this function is run
before that pass, there might be weird results.
Trait Implementations§
impl StructuralPartialEq for Enum
Auto Trait Implementations§
impl Freeze for Enum
impl RefUnwindSafe for Enum
impl Send for Enum
impl Sync for Enum
impl Unpin for Enum
impl UnsafeUnpin for Enum
impl UnwindSafe for Enum
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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 moreimpl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T> SpanExt for T
impl<T> SpanExt for T
fn with_span(self, span: impl Into<Span>) -> Spanned<Self>where
Self: Sized,
Source§fn spanned(self, span: impl Into<Span>) -> Spanned<Self>where
Self: Sized,
fn spanned(self, span: impl Into<Span>) -> Spanned<Self>where
Self: Sized,
Same as
Self::with_span, but can avoid name collisionsfn with_dummy_span(self) -> Spanned<Self>where
Self: Sized,
fn into_with_dummy_span<T>(self) -> Spanned<T>where
Self: Into<T>,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.