Struct scale_info::build::VariantBuilder
source · [−]pub struct VariantBuilder<S = IndexNotAssigned> { /* private fields */ }
Expand description
Build a Variant
.
Implementations
sourceimpl VariantBuilder<IndexNotAssigned>
impl VariantBuilder<IndexNotAssigned>
sourcepub fn new(name: &'static str) -> Self
pub fn new(name: &'static str) -> Self
Create a new VariantBuilder
.
sourcepub fn index(self, index: u8) -> VariantBuilder<IndexAssigned>
pub fn index(self, index: u8) -> VariantBuilder<IndexAssigned>
Set the variant’s codec index.
sourceimpl<S> VariantBuilder<S>
impl<S> VariantBuilder<S>
sourcepub fn discriminant(self, discriminant: u64) -> Self
pub fn discriminant(self, discriminant: u64) -> Self
Set the variant’s discriminant.
sourcepub fn fields<F>(self, fields_builder: FieldsBuilder<F>) -> Self
pub fn fields<F>(self, fields_builder: FieldsBuilder<F>) -> Self
Initialize the variant’s fields.
sourcepub fn docs(self, _docs: &[&'static str]) -> Self
pub fn docs(self, _docs: &[&'static str]) -> Self
Doc capture is not enabled via the “docs” feature so this is a no-op.
sourcepub fn docs_always(self, docs: &[&'static str]) -> Self
pub fn docs_always(self, docs: &[&'static str]) -> Self
Initialize the variant’s documentation, always captured even if the “docs” feature is not enabled.
Auto Trait Implementations
impl<S> RefUnwindSafe for VariantBuilder<S>where
S: RefUnwindSafe,
impl<S> Send for VariantBuilder<S>where
S: Send,
impl<S> Sync for VariantBuilder<S>where
S: Sync,
impl<S> Unpin for VariantBuilder<S>where
S: Unpin,
impl<S> UnwindSafe for VariantBuilder<S>where
S: UnwindSafe,
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