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> RefUnwindSafe for VariantBuilder<F, S>where S: RefUnwindSafe, <F as Form>::String: RefUnwindSafe, <F as Form>::Type: RefUnwindSafe,

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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