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