concision_core/traits/
codex.rs

1/// [Decode] defines a standard interface for decoding data.
2pub trait Decode<Rhs> {
3    type Output;
4
5    fn decode(&self, values: Rhs) -> Self::Output;
6}
7
8/// [Encode] defines a standard interface for encoding data.
9pub trait Encode<Rhs> {
10    type Output;
11
12    fn encode(&self, values: Rhs) -> Self::Output;
13}
14
15pub trait Codex<A, B> {
16    type Encoder: Encode<A, Output = B>;
17    type Decoder: Decode<B, Output = A>;
18
19    fn encode(&self, values: A) -> B;
20
21    fn decode(&self, values: B) -> A;
22}