pub trait EncodeDecode {
// Required methods
fn length_in_words<'a, A>(bytes: &A) -> usize
where A: AsBytes<'a>;
fn encode<'a, A>(store: &mut Vec<u64>, bytes: &A)
where A: AsBytes<'a>;
fn write<'a, A, W: Write>(writer: W, bytes: &A) -> Result<()>
where A: AsBytes<'a>;
fn decode<'a>(store: &'a [u64]) -> impl Iterator<Item = &'a [u8]>;
// Provided method
fn length_in_bytes<'a, A>(bytes: &A) -> usize
where A: AsBytes<'a> { ... }
}
Expand description
A coupled encode/decode pair for byte sequences.
Required Methods§
Sourcefn length_in_words<'a, A>(bytes: &A) -> usizewhere
A: AsBytes<'a>,
fn length_in_words<'a, A>(bytes: &A) -> usizewhere
A: AsBytes<'a>,
Encoded length in number of u64
words required.
Sourcefn encode<'a, A>(store: &mut Vec<u64>, bytes: &A)where
A: AsBytes<'a>,
fn encode<'a, A>(store: &mut Vec<u64>, bytes: &A)where
A: AsBytes<'a>,
Encodes bytes
into a sequence of u64
.
Provided Methods§
Sourcefn length_in_bytes<'a, A>(bytes: &A) -> usizewhere
A: AsBytes<'a>,
fn length_in_bytes<'a, A>(bytes: &A) -> usizewhere
A: AsBytes<'a>,
Encoded length in number of u8
bytes required.
This method should always be eight times Self::length_in_words
, and is provided for convenience and clarity.
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.