Struct bitar::Archive

source ·
pub struct Archive<R> { /* private fields */ }
Expand description

A readable archive.

Implementations§

source§

impl<R> Archive<R>

source

pub async fn try_init(reader: R) -> Result<Self, ArchiveError<R::Error>>
where R: ArchiveReader,

Try to initialize an archive from a reader.

source

pub fn total_chunks(&self) -> usize

Total number of chunks in archive (including duplicates).

source

pub fn unique_chunks(&self) -> usize

Total number of unique chunks in archive (no duplicates).

source

pub fn compressed_size(&self) -> u64

Total size of chunks in archive when compressed.

source

pub fn chunk_data_offset(&self) -> u64

On which offset in the archive the chunk data starts at.

source

pub fn chunk_descriptors(&self) -> &[ChunkDescriptor]

Get archive chunk descriptors.

source

pub fn total_source_size(&self) -> u64

Total size of the original source file.

source

pub fn source_checksum(&self) -> &HashSum

Checksum of the original source file (Blake2).

source

pub fn chunker_config(&self) -> &Config

Get the chunker configuration used when building the archive.

source

pub fn header_checksum(&self) -> &HashSum

Get the checksum of the archive header.

source

pub fn header_size(&self) -> usize

Get the size of the archive header.

source

pub fn chunk_hash_length(&self) -> usize

Get the hash length used for identifying chunks when building the archive.

source

pub fn chunk_compression(&self) -> Option<Compression>

Get the compression used for chunks in the archive.

source

pub fn built_with_version(&self) -> &str

Get the version of crate used when building the archive.

source

pub fn iter_source_chunks( &self ) -> impl Iterator<Item = (u64, &ChunkDescriptor)>

Iterate chunks as ordered in source.

source

pub fn build_source_index(&self) -> ChunkIndex

Build a ChunkIndex representing the source file.

source

pub fn chunk_stream<'a>( &'a mut self, chunks: &ChunkIndex ) -> impl Stream<Item = Result<CompressedArchiveChunk, R::Error>> + Unpin + Sized + 'a
where R: ArchiveReader + 'a,

Get a stream of chunks from the archive.

Auto Trait Implementations§

§

impl<R> Freeze for Archive<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Archive<R>
where R: RefUnwindSafe,

§

impl<R> Send for Archive<R>
where R: Send,

§

impl<R> Sync for Archive<R>
where R: Sync,

§

impl<R> Unpin for Archive<R>
where R: Unpin,

§

impl<R> UnwindSafe for Archive<R>
where R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more