pub trait Codec64:
Sized
+ Clone
+ 'static {
// Required methods
fn codec_name() -> String;
fn encode(&self) -> [u8; 8];
fn decode(buf: [u8; 8]) -> Self;
}
Expand description
Encoding and decoding operations for a type usable as a persisted timestamp or diff.
Required Methods§
Sourcefn codec_name() -> String
fn codec_name() -> String
Name of the codec.
This name is stored for the timestamp and diff when a stream is first created and the same timestamp and diff codec must be used for that stream afterward.
Sourcefn encode(&self) -> [u8; 8]
fn encode(&self) -> [u8; 8]
Encode a timestamp or diff for permanent storage.
This must perfectly round-trip Self through Codec64::decode. If the encode function for this codec ever changes, decode must be able to handle bytes output by all previous versions of encode.
Sourcefn decode(buf: [u8; 8]) -> Self
fn decode(buf: [u8; 8]) -> Self
Decode a timestamp or diff previous encoded with this codec’s Codec64::encode.
This must perfectly round-trip Self through Codec64::encode. If the encode function for this codec ever changes, decode must be able to handle bytes output by all previous versions of encode.
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.