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