utility_macros_internals/required.rs
1use crate::error::Result;
2
3/// A trait for types that have a required representation.
4pub trait HasRequired {
5 /// The required representation of the type.
6 type Required;
7
8 /// Converts the type to its required representation.
9 fn required(&self) -> Result<Self::Required>;
10}
11
12/// A trait for required representations of types.
13pub trait Required {
14 /// The type that the required representation is for.
15 type Type;
16
17 /// Converts the required representation to the original type.
18 fn type_(&self) -> Self::Type;
19}