Trait TryFromPrimitive

pub trait TryFromPrimitive: Sized {
    type Primitive: Copy + Eq + Debug;
    type Error;

    const NAME: &'static str;

    // Required method
    fn try_from_primitive(number: Self::Primitive) -> Result<Self, Self::Error>;
}

Required Associated Constants§

const NAME: &'static str

Required Associated Types§

type Primitive: Copy + Eq + Debug

type Error

Required Methods§

fn try_from_primitive(number: Self::Primitive) -> Result<Self, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl TryFromPrimitive for NamedChain

§

const NAME: &'static str = "NamedChain"

§

type Primitive = u64

§

type Error = TryFromPrimitiveError<NamedChain>

§

fn try_from_primitive( number: <NamedChain as TryFromPrimitive>::Primitive, ) -> Result<NamedChain, TryFromPrimitiveError<NamedChain>>

Implementors§

§

impl TryFromPrimitive for SpecId

§

const NAME: &'static str = "SpecId"

§

type Primitive = u8

§

type Error = TryFromPrimitiveError<SpecId>