[][src]Struct scale_info::TypeDefVariant

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

A Enum type (consisting of variants).

Examples

A Rust enum, aka tagged union.

enum MyEnum {
    RustAllowsForClikeVariants,
    AndAlsoForTupleStructs(i32, bool),
    OrStructs {
        with: i32,
        named: bool,
        fields: [u8; 32],
    },
    ItIsntPossibleToSetADiscriminantThough,
}

A C-like enum type.

enum Days {
    Monday,
    Tuesday,
    Wednesday,
    Thursday = 42, // Also allows to manually set the discriminant!
    Friday,
    Saturday,
    Sunday,
}

An empty enum (for marker purposes)

enum JustAMarker {}

Implementations

impl TypeDefVariant[src]

pub fn new<I>(variants: I) -> Self where
    I: IntoIterator<Item = Variant>, 
[src]

Create a new TypeDefVariant with the given variants

Trait Implementations

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

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

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

impl<F: Form> From<TypeDefVariant<F>> for TypeDef<F>[src]

impl<F: Form> From<Vec<Variant<F>>> for TypeDefVariant<F>[src]

impl IntoCompact for TypeDefVariant[src]

type Output = TypeDefVariant<CompactForm>

The compact version of Self.

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

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

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

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

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

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

Auto Trait Implementations

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

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

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

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

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