Trait bilrost::Enumeration

source ·
pub trait Enumeration: Eq + Sized {
    // Required methods
    fn to_number(&self) -> u32;
    fn try_from_number(n: u32) -> Result<Self, u32>;
    fn is_valid(n: u32) -> bool;
}
Expand description

Proxy trait for enumeration types conversions to and from u32

Required Methods§

source

fn to_number(&self) -> u32

Gets the numeric value of the enumeration.

source

fn try_from_number(n: u32) -> Result<Self, u32>

Tries to convert from the given number to the enumeration type.

source

fn is_valid(n: u32) -> bool

Returns true if the given number represents a variant of the enumeration.

Object Safety§

This trait is not object safe.

Implementors§