Trait hdi::prelude::UnitEnum

source ·
pub trait UnitEnum {
    type Unit: Debug + Clone + Copy + PartialEq<Self::Unit> + Eq + PartialOrd<Self::Unit> + Ord + Hash;

    // Required methods
    fn to_unit(&self) -> Self::Unit;
    fn unit_iter() -> Box<dyn Iterator<Item = Self::Unit> + 'static, Global>;
}
Expand description

A utility trait for associating a data enum with a unit enum that has the same variants.

Required Associated Types§

source

type Unit: Debug + Clone + Copy + PartialEq<Self::Unit> + Eq + PartialOrd<Self::Unit> + Ord + Hash

An enum with the same variants as the implementor but without any data.

Required Methods§

source

fn to_unit(&self) -> Self::Unit

Turn this type into it’s unit enum.

source

fn unit_iter() -> Box<dyn Iterator<Item = Self::Unit> + 'static, Global>

Iterate over the unit variants.

Implementations on Foreign Types§

source§

impl UnitEnum for ()

Needed as a base case for ignoring types.

§

type Unit = ()

source§

fn to_unit(&self) -> <() as UnitEnum>::Unit

source§

fn unit_iter( ) -> Box<dyn Iterator<Item = <() as UnitEnum>::Unit> + 'static, Global>

Implementors§