pub trait Mode {
// Required methods
fn length(decompressed_size: usize) -> usize;
fn read<R: Read + Seek>(reader: &mut R) -> RefPackResult<Header>;
fn write<W: Write + Seek>(
header: Header,
writer: &mut W,
) -> RefPackResult<()>;
}Expand description
Represents a read and write format for a Header
This trait is entirely statically resolved and should only ever be implemented on structs which cannot be constructed. It has only associated functions, no methods, and only ever is referenced via generic arguments.
To implement your own commands, implement Mode on to a unit struct or
unconstructable struct with one private member and no new method. read and
write should be symmetrical, and a value fed in to read and then back out
of write should yield the same result.
Required Methods§
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.