pub trait ReadCompression<R: Read> {
// Required methods
fn magic(&self) -> [u8; 5];
fn meta(&self) -> &CodecMetadata;
fn meta_mut(&mut self) -> &mut CodecMetadata;
fn read_bytes(
&mut self,
bytes: &mut [u8],
reader: &mut BitReader<R, BigEndian>,
) -> Result<()>;
fn digest_event(
&mut self,
reader: &mut BitReader<R, BigEndian>,
) -> Result<Event, CodecError>;
fn set_input_stream_position(
&mut self,
reader: &mut BitReader<R, BigEndian>,
position: u64,
) -> Result<(), CodecError>;
}
Expand description
A trait for reading ADΔER data from a stream.
A struct implementing ReadCompression
does not take ownership of the read handle.
Subsequent calls to the compressor will pass the read handle each time. The caller is
responsible for maintaining the reader.
Required Methods§
Sourcefn meta(&self) -> &CodecMetadata
fn meta(&self) -> &CodecMetadata
Returns a reference to the metadata
Sourcefn meta_mut(&mut self) -> &mut CodecMetadata
fn meta_mut(&mut self) -> &mut CodecMetadata
Returns a mutable reference to the metadata
Sourcefn read_bytes(
&mut self,
bytes: &mut [u8],
reader: &mut BitReader<R, BigEndian>,
) -> Result<()>
fn read_bytes( &mut self, bytes: &mut [u8], reader: &mut BitReader<R, BigEndian>, ) -> Result<()>
Read a certain number of bytes from the stream, indicated by the size of the buffer passed.
Sourcefn digest_event(
&mut self,
reader: &mut BitReader<R, BigEndian>,
) -> Result<Event, CodecError>
fn digest_event( &mut self, reader: &mut BitReader<R, BigEndian>, ) -> Result<Event, CodecError>
Read the next event from the stream. Returns None
if the stream is exhausted.
Sourcefn set_input_stream_position(
&mut self,
reader: &mut BitReader<R, BigEndian>,
position: u64,
) -> Result<(), CodecError>
fn set_input_stream_position( &mut self, reader: &mut BitReader<R, BigEndian>, position: u64, ) -> Result<(), CodecError>
Set the input stream position to the given byte offset.