scsys_core/state/traits/
kind.rs

1/*
2    appellation: kinds <module>
3    authors: @FL03
4*/
5/// a private, base represenation of a state kind
6pub trait RawStateKind: 'static + Send + Sync + core::fmt::Debug + core::fmt::Display {
7    private!();
8}
9///
10///
11/// **note:** this trait is auto implemented for types that implement [`AsRef<str>`].
12pub trait StateKind: RawStateKind {
13    fn kind(&self) -> &str;
14}
15/// a particular kind of state that is defined by some _rank_
16pub trait NStateKind: StateKind {
17    /// the "rank" of the state speaks to the total number of dimensions (or states) allowed
18    const RANK: usize;
19}
20
21/*
22 ************* Implementations *************
23*/
24
25impl<T> StateKind for T
26where
27    T: RawStateKind + AsRef<str>,
28{
29    fn kind(&self) -> &str {
30        self.as_ref()
31    }
32}