kinded 0.5.0

Generate enums with same variants, but without data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ::core::fmt::Debug;

/// A trait that can be implemented by a main enum type.
/// Typically should be derived with `#[derive(kinded::Kinded)]`.
pub trait Kinded {
    type Kind: PartialEq + Eq + Debug + Clone + Copy + Kind;

    /// Get a kind variant without data.
    fn kind(&self) -> Self::Kind;
}

pub trait Kind: PartialEq + Eq + Debug + Clone + Copy {
    /// Return a slice with all possible kind variants.
    fn all() -> &'static [Self];
}