pub struct Variant { /* private fields */ }Expand description
Defines an enum variant.
Implementations§
Source§impl Variant
impl Variant
Sourcepub fn push_named(&mut self, field: Field) -> &mut Self
pub fn push_named(&mut self, field: Field) -> &mut Self
Add a named field to the variant.
An enum variant can either set named fields with this function or tuple fields
with tuple, but not both.
Sourcepub fn named<T>(&mut self, name: impl ToString, ty: T) -> &mut Self
pub fn named<T>(&mut self, name: impl ToString, ty: T) -> &mut Self
Add a named field to the variant.
An enum variant can either set named fields with this function or tuple fields
with tuple, but not both.
Sourcepub fn new_named<T>(&mut self, name: impl ToString, ty: T) -> &mut Field
pub fn new_named<T>(&mut self, name: impl ToString, ty: T) -> &mut Field
Create a named field for the enum.
An enum variant can either set named fields with this function or tuple fields
with tuple, but not both.
Sourcepub fn tuple(&mut self, ty: impl ToString) -> &mut Self
pub fn tuple(&mut self, ty: impl ToString) -> &mut Self
Add a tuple field to the variant.
An enum variant can either be a tuple with this function or have named fields
with named, but not both.
Sourcepub fn doc(&mut self, documentation: impl ToString) -> &mut Self
pub fn doc(&mut self, documentation: impl ToString) -> &mut Self
Set the variant documentation.
Sourcepub fn annotation(&mut self, annotation: impl Into<String>) -> &mut Self
pub fn annotation(&mut self, annotation: impl Into<String>) -> &mut Self
Add an anotation to the variant.
Sourcepub fn discriminant(&mut self, discriminant: impl ToString) -> &mut Self
pub fn discriminant(&mut self, discriminant: impl ToString) -> &mut Self
Set the discriminant value for the variant.
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