Struct scale_info::build::Variants
source · pub struct Variants<F: Form = MetaForm> { /* private fields */ }
Expand description
Builds a definition of a variant type i.e an enum
Implementations§
source§impl<F: Form> Variants<F>
impl<F: Form> Variants<F>
sourcepub fn variant<B>(self, name: F::String, builder: B) -> Selfwhere
B: Fn(VariantBuilder<F>) -> VariantBuilder<F, IndexAssigned>,
pub fn variant<B>(self, name: F::String, builder: B) -> Selfwhere B: Fn(VariantBuilder<F>) -> VariantBuilder<F, IndexAssigned>,
Add a variant
sourcepub fn variant_unit(self, name: F::String, index: u8) -> Self
pub fn variant_unit(self, name: F::String, index: u8) -> Self
Add a unit variant (without fields).
sourcepub fn finalize(self) -> TypeDefVariant<F>
pub fn finalize(self) -> TypeDefVariant<F>
Construct a new TypeDefVariant
from the initialized builder variants.
Trait Implementations§
Auto Trait Implementations§
impl<F> RefUnwindSafe for Variants<F>where <F as Form>::String: RefUnwindSafe, <F as Form>::Type: RefUnwindSafe,
impl<F> Send for Variants<F>where <F as Form>::String: Send, <F as Form>::Type: Send,
impl<F> Sync for Variants<F>where <F as Form>::String: Sync, <F as Form>::Type: Sync,
impl<F> Unpin for Variants<F>where <F as Form>::String: Unpin, <F as Form>::Type: Unpin,
impl<F> UnwindSafe for Variants<F>where <F as Form>::String: UnwindSafe, <F as Form>::Type: UnwindSafe,
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