[][src]Struct scale_info::Variant

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

A struct enum variant with either named (struct) or unnamed (tuple struct) fields.

Example

enum Operation {
    Zero,
//  ^^^^ this is a unit struct enum variant
    Add(i32, i32),
//  ^^^^^^^^^^^^^ this is a tuple-struct enum variant
    Minus { source: i32 }
//  ^^^^^^^^^^^^^^^^^^^^^ this is a struct enum variant
}

Implementations

impl Variant[src]

pub fn with_fields<F>(name: &'static str, fields: FieldsBuilder<F>) -> Self[src]

Creates a new variant with the given fields.

pub fn with_discriminant(name: &'static str, discriminant: u64) -> Self[src]

Creates a new variant with the given discriminant.

Trait Implementations

impl<F: Clone + Form> Clone for Variant<F>[src]

impl<F: Debug + Form> Debug for Variant<F>[src]

impl<F: Eq + Form> Eq for Variant<F>[src]

impl IntoCompact for Variant[src]

type Output = Variant<CompactForm>

The compact version of Self.

impl<F: Ord + Form> Ord for Variant<F>[src]

impl<F: PartialEq + Form> PartialEq<Variant<F>> for Variant<F>[src]

impl<F: PartialOrd + Form> PartialOrd<Variant<F>> for Variant<F>[src]

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

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

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

Auto Trait Implementations

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

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

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

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

impl<F> UnwindSafe for Variant<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.