Struct scale_info::build::Variants
source · [−]pub struct Variants { /* private fields */ }
Expand description
Builds a definition of a variant type i.e an enum
Implementations
sourceimpl Variants
impl Variants
sourcepub fn variant<F>(self, name: &'static str, builder: F) -> Selfwhere
F: Fn(VariantBuilder) -> VariantBuilder<IndexAssigned>,
pub fn variant<F>(self, name: &'static str, builder: F) -> Selfwhere
F: Fn(VariantBuilder) -> VariantBuilder<IndexAssigned>,
Add a variant
sourcepub fn variant_unit(self, name: &'static str, index: u8) -> Self
pub fn variant_unit(self, name: &'static str, index: u8) -> Self
Add a unit variant (without fields).
sourcepub fn finalize(self) -> TypeDefVariant
pub fn finalize(self) -> TypeDefVariant
Construct a new TypeDefVariant
from the initialized builder variants.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Variants
impl Send for Variants
impl Sync for Variants
impl Unpin for Variants
impl UnwindSafe for Variants
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more