scale_info::build

Struct VariantBuilder

source
pub struct VariantBuilder<F: Form, S = IndexNotAssigned> { /* private fields */ }
Expand description

Build a Variant.

Implementations§

source§

impl<F: Form> VariantBuilder<F, IndexNotAssigned>

source

pub fn new(name: F::String) -> Self

Create a new VariantBuilder.

source

pub fn index(self, index: u8) -> VariantBuilder<F, IndexAssigned>

Set the variant’s codec index.

source§

impl<F: Form, S> VariantBuilder<F, S>

source

pub fn discriminant(self, discriminant: u64) -> Self

Set the variant’s discriminant.

source

pub fn fields<T>(self, fields_builder: FieldsBuilder<F, T>) -> Self

Initialize the variant’s fields.

source§

impl<S> VariantBuilder<MetaForm, S>

source

pub fn docs(self, _docs: &[&'static str]) -> Self

Doc capture is not enabled via the “docs” feature so this is a no-op.

source

pub fn docs_always(self, docs: &[&'static str]) -> Self

Initialize the variant’s documentation, always captured even if the “docs” feature is not enabled.

source§

impl<F: Form> VariantBuilder<F, IndexAssigned>

source

pub fn finalize(self) -> Variant<F>

Complete building and create final Variant instance.

Auto Trait Implementations§

§

impl<F, S> Freeze for VariantBuilder<F, S>
where <F as Form>::String: Freeze,

§

impl<F, S> RefUnwindSafe for VariantBuilder<F, S>

§

impl<F, S> Send for VariantBuilder<F, S>
where <F as Form>::String: Send, S: Send, <F as Form>::Type: Send,

§

impl<F, S> Sync for VariantBuilder<F, S>
where <F as Form>::String: Sync, S: Sync, <F as Form>::Type: Sync,

§

impl<F, S> Unpin for VariantBuilder<F, S>
where <F as Form>::String: Unpin, S: Unpin, <F as Form>::Type: Unpin,

§

impl<F, S> UnwindSafe for VariantBuilder<F, S>
where <F as Form>::String: UnwindSafe, S: UnwindSafe, <F as Form>::Type: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> JsonSchemaMaybe for T