Skip to main content

ByteSource

Trait ByteSource 

Source
pub trait ByteSource {
    // Required methods
    fn objects(&self) -> Vec<ObjectInfo>;
    fn read(&self, span: &DataSpan, output: &mut dyn Write) -> Result<(), Error>;

    // Provided method
    fn map(&self, _span: &DataSpan) -> Result<Option<MappedBytes>, Error> { ... }
}
Expand description

Object IDs belong to one source; they are neither paths nor content hashes. A copy/import operation must rebind them to its destination’s identities.

Required Methods§

Source

fn objects(&self) -> Vec<ObjectInfo>

List the objects addressable through this source.

Source

fn read(&self, span: &DataSpan, output: &mut dyn Write) -> Result<(), Error>

Write the requested byte range to output, or return an error.

Provided Methods§

Source

fn map(&self, _span: &DataSpan) -> Result<Option<MappedBytes>, Error>

Return a retained view, or None if this source cannot map bytes. Invalid ranges on a mappable source return an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§