#[repr(C)]pub struct Variant {
pub name: &'static str,
pub discriminant: Option<i64>,
pub attributes: &'static [VariantAttribute],
pub data: StructType,
pub doc: &'static [&'static str],
}Expand description
Describes a variant of an enum
Fields§
§name: &'static strName of the variant, e.g. Foo for enum FooBar { Foo, Bar }
discriminant: Option<i64>Discriminant value (if available). Might fit in a u8, etc.
attributes: &'static [VariantAttribute]Attributes set for this variant via the derive macro
data: StructTypeFields for this variant (empty if unit, number-named if tuple). IMPORTANT: the offset for the fields already takes into account the size & alignment of the discriminant.
doc: &'static [&'static str]Doc comment for the variant
Implementations§
Source§impl Variant
impl Variant
Sourcepub const fn builder() -> VariantBuilder
pub const fn builder() -> VariantBuilder
Returns a builder for Variant
Sourcepub fn has_arbitrary_attr(&self, content: &'static str) -> bool
pub fn has_arbitrary_attr(&self, content: &'static str) -> bool
Checks whether the Variant has an attribute of form VariantAttribute::Arbitrary with the
given content.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Variant
impl RefUnwindSafe for Variant
impl Send for Variant
impl Sync for Variant
impl Unpin for Variant
impl UnwindSafe for Variant
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