variant_map/
common.rs

1/// Implement this trait on your enum to bind a [Map][MapValue::Map] and [Key][MapValue::Key] type to it
2pub trait MapValue: Sized {
3
4    /// Associated Key type (most likely an enum of unit variants)
5    type Key;
6
7    /// Map allowing 1-to-1 mapping between [Keys][MapValue::Key] and [Value][Self] (Self)
8    type Map;
9
10    /// Match each enum variant to a [Key][MapValue::Key]
11    fn to_key(&self) -> Self::Key;
12
13    /// Initialize an empty [Map][MapValue::Map]
14    fn make_map() -> Self::Map;
15}