Trait plain_enum::TPlainEnum [] [src]

pub trait TPlainEnum: Sized {
    const SIZE: usize;

    fn valid_usize(u: usize) -> bool;
fn from_usize(u: usize) -> Self;
fn checked_from_usize(u: usize) -> Option<Self>;
fn wrapped_from_usize(u: usize) -> Self;
fn wrapped_difference(self, e_other: Self) -> usize;
fn to_usize(self) -> usize;
fn wrapping_add(self, n_offset: usize) -> Self; fn values() -> Map<Range<usize>, fn(_: usize) -> Self> { ... } }

This trait is implemented by enums declared via the plain_enum_mod macro. Do not implement it yourself, but use this macro.

Associated Constants

Arity, i.e. the smallest usize not representable by the enum.

Required Methods

Checks whether u is the numerical representation of a valid enum value.

Converts u to the associated enum value. asserts that u is a valid value for the enum.

Converts u to the associated enum value. if u is a valid value for the enum.

Converts u to the associated enum value, but wraps u it before conversion (i.e. it applies the modulo operation with a modulus equal to the arity of the enum before converting).

Computes the difference between two enum values, wrapping around if necessary.

Converts the enum to its numerical representation.

Adds a number to the enum, wrapping.

Provided Methods

Returns an iterator over the enum's values.

Implementors