bin_proto/
discriminable.rs

1/// A trait for types with discriminants. Automatically derived for `enum`s.
2pub trait Discriminable {
3    /// The type of the discriminant.
4    type Discriminant;
5
6    /// Returns a value uniquely identifying the variant.
7    ///
8    /// Returns [`None`] if the variant cannot be encoded.
9    fn discriminant(&self) -> Option<Self::Discriminant>;
10}