Skip to main content

Container

Trait Container 

Source
pub trait Container: Send + Sync {
    // Required methods
    fn id(&self) -> FormatId;
    fn caps(&self) -> ContainerCaps;
    fn open(
        &self,
        resolved: Resolved,
        o: &OpenOpts,
    ) -> Result<Box<dyn ArchiveRead>>;
    fn create(
        &self,
        dst: Box<dyn Sink>,
        o: &CreateOpts,
    ) -> Result<Box<dyn ArchiveWrite>>;
}
Expand description

A structure of entries. May invoke codecs internally.

Required Methods§

Source

fn id(&self) -> FormatId

Source

fn caps(&self) -> ContainerCaps

Source

fn open(&self, resolved: Resolved, o: &OpenOpts) -> Result<Box<dyn ArchiveRead>>

Opens an archive from a ladder-resolved source.

Takes the whole crate::Resolved rather than just its source so the container knows which rung it was given — which is what makes Rung::Degraded implementable — and so it can seed its fidelity report from the ladder’s rather than re-deriving the same facts.

Source

fn create( &self, dst: Box<dyn Sink>, o: &CreateOpts, ) -> Result<Box<dyn ArchiveWrite>>

Creates an archive writing into dst.

Takes a Sink rather than a bare Write so a container over a codec composes: the codec’s own Sink is handed straight in, and ArchiveWrite::finish gives it back so the caller can finish it. Passing a bare file means wrapping it in PlainSink.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§