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