pub trait LexicographicEncoding: Ord + FullCodec {
type Encoding: AsMut<[u8]> + Ord + FullCodec;
// Required methods
fn lexicographic_encode(&self) -> Self::Encoding;
fn lexicographic_decode(encoding: Self::Encoding) -> Self;
}Expand description
A trait to obtain an encoding whose lexicographic order corresponds to the value’s.
Required Associated Types§
Required Methods§
Sourcefn lexicographic_encode(&self) -> Self::Encoding
fn lexicographic_encode(&self) -> Self::Encoding
Encode such that cmp(e(A), e(B)) == cmp(A, B).
Sourcefn lexicographic_decode(encoding: Self::Encoding) -> Self
fn lexicographic_decode(encoding: Self::Encoding) -> Self
Decode such that d(e(A)) == A.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.