pub struct Variant { /* private fields */ }
Expand description
The variant of a type.
Implementations§
source§impl Variant
impl Variant
sourcepub fn unit(rtti: Arc<VariantRtti>) -> Self
pub fn unit(rtti: Arc<VariantRtti>) -> Self
Construct a unit variant.
sourcepub fn tuple(rtti: Arc<VariantRtti>, tuple: OwnedTuple) -> Self
pub fn tuple(rtti: Arc<VariantRtti>, tuple: OwnedTuple) -> Self
Construct a tuple variant.
sourcepub fn struct_(rtti: Arc<VariantRtti>, data: Object) -> Self
pub fn struct_(rtti: Arc<VariantRtti>, data: Object) -> Self
Construct a struct variant.
sourcepub fn rtti(&self) -> &VariantRtti
pub fn rtti(&self) -> &VariantRtti
Access the rtti of the variant.
sourcepub fn data(&self) -> &VariantData
pub fn data(&self) -> &VariantData
Access the underlying variant data.
sourcepub fn data_mut(&mut self) -> &mut VariantData
pub fn data_mut(&mut self) -> &mut VariantData
Access the underlying variant data mutably.
Trait Implementations§
Auto Trait Implementations§
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