[][src]Struct scale_info::Field

pub struct Field<F: Form = MetaForm> { /* fields omitted */ }

A field of a struct like data type.

Name is optional so it can represent both named and unnamed fields.

This can be a named field of a struct type or a struct variant.

Implementations

impl Field[src]

pub fn new(name: Option<&'static str>, ty: MetaType) -> Self[src]

Creates a new field.

Use this constructor if you want to instantiate from a given meta type.

pub fn named(name: &'static str, ty: MetaType) -> Self[src]

Creates a new named field

pub fn named_of<T: ?Sized>(name: &'static str) -> Self where
    T: TypeInfo + 'static, 
[src]

Creates a new named field.

Use this constructor if you want to instantiate from a given compile-time type.

pub fn unnamed(meta_type: MetaType) -> Self[src]

Creates a new unnamed field.

Use this constructor if you want to instantiate an unnamed field from a given meta type.

pub fn unnamed_of<T: ?Sized>() -> Self where
    T: TypeInfo + 'static, 
[src]

Creates a new unnamed field.

Use this constructor if you want to instantiate an unnamed field from a given compile-time type.

Trait Implementations

impl<F: Clone + Form> Clone for Field<F> where
    F::TypeId: Clone
[src]

impl<F: Debug + Form> Debug for Field<F> where
    F::TypeId: Debug
[src]

impl<F: Eq + Form> Eq for Field<F> where
    F::TypeId: Eq
[src]

impl IntoCompact for Field[src]

type Output = Field<CompactForm>

The compact version of Self.

impl<F: Ord + Form> Ord for Field<F> where
    F::TypeId: Ord
[src]

impl<F: PartialEq + Form> PartialEq<Field<F>> for Field<F> where
    F::TypeId: PartialEq
[src]

impl<F: PartialOrd + Form> PartialOrd<Field<F>> for Field<F> where
    F::TypeId: PartialOrd
[src]

impl<F: Form> Serialize for Field<F> where
    F::TypeId: Serialize
[src]

impl<F: Form> StructuralEq for Field<F>[src]

impl<F: Form> StructuralPartialEq for Field<F>[src]

Auto Trait Implementations

impl<F> RefUnwindSafe for Field<F> where
    <F as Form>::TypeId: RefUnwindSafe

impl<F> Send for Field<F> where
    <F as Form>::TypeId: Send

impl<F> Sync for Field<F> where
    <F as Form>::TypeId: Sync

impl<F> Unpin for Field<F> where
    <F as Form>::TypeId: Unpin

impl<F> UnwindSafe for Field<F> where
    <F as Form>::TypeId: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.