pub trait CodecP: Debug {
// Required methods
fn encode(&self, bytes: &mut Vec<u8>);
fn read(&mut self, _: &mut Reader<'_>) -> Result<(), Error>;
// Provided methods
fn get_encoding(&self) -> Vec<u8> ⓘ { ... }
fn read_bytes(&mut self, bytes: &[u8]) -> Result<(), Error> { ... }
}
Expand description
Things we can encode and read from a Reader.
Used by puffin as it does not require to be Sized
(we rely on <dyn T>
for T:CodecP
.
Required Methods§
Provided Methods§
sourcefn get_encoding(&self) -> Vec<u8> ⓘ
fn get_encoding(&self) -> Vec<u8> ⓘ
Convenience function to get the results of encode()
.