Trait adder_codec_rs::Codec

source ·
pub trait Codec {
Show 21 methods fn new() -> Self; fn get_source_type(&self) -> SourceType; fn write_eof(&mut self) -> Result<(), StreamError>; fn flush_writer(&mut self) -> Result<()>; fn close_writer(&mut self) -> Result<(), Box<dyn Error>>; fn close_reader(&mut self); fn set_output_stream(&mut self, stream: Option<BufWriter<File>>); fn has_output_stream(&self) -> bool; fn set_input_stream(&mut self, stream: Option<BufReader<File>>); fn set_input_stream_position(&mut self, pos: u64) -> Result<(), StreamError>; fn set_input_stream_position_from_end(
        &mut self,
        pos: i64
    ) -> Result<(), StreamError>; fn get_input_stream_position(&mut self) -> Result<u64, Box<dyn Error>>; fn get_eof_position(&mut self) -> Result<u64, Box<dyn Error>>; fn encode_header(
        &mut self,
        plane_size: PlaneSize,
        tps: u32,
        ref_interval: u32,
        delta_t_max: u32,
        codec_version: u8,
        source_camera: SourceCamera
    ) -> Result<(), Box<dyn Error>>; fn decode_header(&mut self) -> Result<usize, Box<dyn Error>>; fn encode_event(&mut self, event: &Event) -> Result<(), StreamError>; fn encode_events(&mut self, events: &[Event]) -> Result<(), StreamError>; fn encode_events_events(
        &mut self,
        events: &[Vec<Event>]
    ) -> Result<(), StreamError>; fn decode_event(&mut self) -> Result<Event, StreamError>; fn open_writer<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> { ... } fn open_reader<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> { ... }
}

Required Methods§

Write the EOF event signifier to the output stream

Errors
  • If the EOF event cannot be written

Flush the stream so that program can be exited safely

Errors
  • If the stream cannot be flushed

Close the stream writer safely

Errors
  • If the stream cannot be closed

Close the stream reader safely

Go to this position (as a byte address) in the input stream.

Errors
  • If the stream cannot be seeked to the given position
  • If the stream is not seekable
  • If the stream is not open
  • If the given pos is not aligned to an Event

Go to this position (as a byte address) in the input stream, relative to the end of the stream

Errors
  • If the stream cannot be seeked to the given position
  • If the stream is not seekable
  • If the stream is not open

Get the current position (as a byte address) in the input stream.

Errors
  • If the stream is not open

Provided Methods§

Create a file writer at the given path

Arguments
  • path - The path to the file to write to
Errors
  • If the file cannot be created

Set the input stream to read from

Errors
  • If the input stream cannot be opened

Implementors§