Skip to main content

ByteSink

Trait ByteSink 

Source
pub trait ByteSink: Send {
    // Required methods
    fn path(&self) -> &str;
    fn append(&mut self, data: &[u8]) -> Result<u64>;
    fn write_all_at(&mut self, offset: u64, data: &[u8]) -> Result<()>;
    fn position(&self) -> u64;
    fn flush(&mut self) -> Result<()>;
    fn close(&mut self) -> Result<()>;
}

Required Methods§

Source

fn path(&self) -> &str

Source

fn append(&mut self, data: &[u8]) -> Result<u64>

Append, returning the offset the data landed at.

Source

fn write_all_at(&mut self, offset: u64, data: &[u8]) -> Result<()>

Overwrite bytes already written — a reserved header field, an item count.

Source

fn position(&self) -> u64

Bytes written so far, which is also the offset the next append lands at.

Source

fn flush(&mut self) -> Result<()>

Source

fn close(&mut self) -> Result<()>

Finish. Idempotent, and also called from Drop — but a Drop that fails cannot report, so the writer’s own close() is what callers use and what returns the error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§