Function enum_iterator::cardinality

source ·
pub const fn cardinality<T: Sequence>() -> usize
Expand description

Returns the cardinality (number of values) of T

Example

use enum_iterator::{cardinality, Sequence};

#[derive(Debug, PartialEq, Sequence)]
enum Color { Red, Green, Blue }

assert_eq!(cardinality::<Color>(), 3);