use crate::Index;
use std::fmt::Debug;
use std::hash::Hash;
pub trait Label
where
Self: Sized + Copy + Eq + Hash + Debug,
{
type Index: Eq + Copy + Hash + Debug + Index + 'static;
fn variants() -> &'static [Self];
fn indexes(&self) -> &'static [Self::Index];
fn ordinal(&self) -> usize;
fn name(&self) -> &'static str;
}
impl Label for () {
type Index = ();
fn variants() -> &'static [Self] {
&[()]
}
fn indexes(&self) -> &'static [Self::Index] {
&[]
}
fn ordinal(&self) -> usize {
0
}
fn name(&self) -> &'static str {
"<anonymous>"
}
}