scale_info::build

Struct FieldBuilder

source
pub struct FieldBuilder<F: Form = MetaForm, N = NameNotAssigned, T = TypeNotAssigned> { /* private fields */ }
Expand description

Construct a valid Field.

Implementations§

source§

impl<F: Form> FieldBuilder<F>

source

pub fn new() -> Self

Create a new FieldBuilder.

source§

impl<F: Form, T> FieldBuilder<F, NameNotAssigned, T>

source

pub fn name(self, name: F::String) -> FieldBuilder<F, NameAssigned, T>

Initialize the field name.

source§

impl<N> FieldBuilder<MetaForm, N, TypeNotAssigned>

source

pub fn ty<TY>(self) -> FieldBuilder<MetaForm, N, TypeAssigned>
where TY: TypeInfo + 'static + ?Sized,

Initialize the type of the field.

source

pub fn compact<TY>(self) -> FieldBuilder<MetaForm, N, TypeAssigned>
where TY: HasCompact + TypeInfo + 'static,

Initializes the type of the field as a compact type.

source§

impl<N> FieldBuilder<PortableForm, N, TypeNotAssigned>

source

pub fn ty<T>(self, ty: T) -> FieldBuilder<PortableForm, N, TypeAssigned>
where T: Into<<PortableForm as Form>::Type>,

Initialize the type of the field.

source§

impl<F: Form, N, T> FieldBuilder<F, N, T>

source

pub fn type_name(self, type_name: F::String) -> FieldBuilder<F, N, T>

Initialize the type name of a field (optional).

source§

impl<N, T> FieldBuilder<MetaForm, N, T>

source

pub fn docs(self, _docs: &'static [&'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 [&'static str]) -> Self

Initialize the documentation of a field, always captured even if the “docs” feature is not enabled.

source§

impl<F: Form, N> FieldBuilder<F, N, TypeAssigned>

source

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

Complete building and return a new Field.

Trait Implementations§

source§

impl<F: Form, N, T> Default for FieldBuilder<F, N, T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<F, N, T> Freeze for FieldBuilder<F, N, T>
where <F as Form>::String: Freeze, <F as Form>::Type: Freeze,

§

impl<F, N, T> RefUnwindSafe for FieldBuilder<F, N, T>
where <F as Form>::String: RefUnwindSafe, <F as Form>::Type: RefUnwindSafe,

§

impl<F, N, T> Send for FieldBuilder<F, N, T>
where <F as Form>::String: Send, <F as Form>::Type: Send,

§

impl<F, N, T> Sync for FieldBuilder<F, N, T>
where <F as Form>::String: Sync, <F as Form>::Type: Sync,

§

impl<F, N, T> Unpin for FieldBuilder<F, N, T>
where <F as Form>::String: Unpin, <F as Form>::Type: Unpin,

§

impl<F, N, T> UnwindSafe for FieldBuilder<F, N, T>
where <F as Form>::String: 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