Skip to main content

ArchiveWrite

Trait ArchiveWrite 

Source
pub trait ArchiveWrite {
    // Required methods
    fn add(&mut self, meta: &EntryMeta, data: &mut dyn Read) -> Result<()>;
    fn finish(self: Box<Self>) -> Result<Box<dyn Sink>>;
}

Required Methods§

Source

fn add(&mut self, meta: &EntryMeta, data: &mut dyn Read) -> Result<()>

Source

fn finish(self: Box<Self>) -> Result<Box<dyn Sink>>

Writes the container’s trailer and returns the destination.

Returning it is what makes container-over-codec possible: the caller still holds a Sink afterwards and can finish the codec layer, which writes ITS trailer. Dropping the destination here — what this used to do — silently truncated every composed archive.

Implementors must NOT call finish on the returned sink. Finishing is the caller’s, once, at the outermost layer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§