Skip to main content

Reader

Struct Reader 

Source
pub struct Reader {
    pub header: Header,
    pub sections: Vec<SectionEntry>,
    pub manifest: Manifest,
    pub index: ChunkIndex,
    /* private fields */
}

Fields§

§header: Header§sections: Vec<SectionEntry>§manifest: Manifest§index: ChunkIndex

Implementations§

Source§

impl Reader

Source

pub fn open(path: &Path, password: Option<&str>) -> Result<Reader>

Open an archive file (memory-mapped; nothing is decoded before the framing and every section hash have been verified).

Source

pub fn open_with_refs( path: &Path, password: Option<&str>, references: &[PathBuf], ) -> Result<Reader>

Open an archive together with the reference archives that hold its external chunks.

Source

pub fn open_with( path: &Path, creds: &Credentials, references: &[PathBuf], ) -> Result<Reader>

Open with full credentials (passphrase and/or hybrid identities) and reference archives.

Source

pub fn unresolved_external(&self) -> usize

Number of external chunks that cannot be resolved with the references given so far.

Source

pub fn from_bytes(data: Vec<u8>, password: Option<&str>) -> Result<Reader>

Source

pub fn is_encrypted(&self) -> bool

Source

pub fn signature(&self) -> Option<&SignatureBlock>

Source

pub fn verify_signature(&self, pubkey: &[u8; 32]) -> Result<bool>

Verify the embedded signature against a public key (hex or raw 32 bytes).

Source

pub fn stream_entry(&mut self, ei: usize, sink: &mut dyn Write) -> Result<u64>

Stream the bytes of an entry to sink (raw entries chunk by chunk; container entries rebuilt) and verify the entry hash; returns the number of bytes written.

Source

pub fn chunk(&mut self, ci: u32) -> Result<Vec<u8>>

Plaintext of one chunk (verified); external chunks are fetched from the reference archives.

Source

pub fn entry_bytes(&mut self, ei: usize) -> Result<Vec<u8>>

Full bytes of an entry, verified against its BLAKE3 hash.

Source

pub fn read_range( &mut self, ei: usize, start: u64, len: usize, ) -> Result<Vec<u8>>

Byte range of a raw entry without materialising the whole file (zip entries are rebuilt).

Source

pub fn find_entry(&self, path: &str) -> Option<usize>

Source

pub fn entries(&self) -> &[Entry]

Source

pub fn extract( &mut self, dir: &Path, selected: Option<&[usize]>, overwrite: bool, ) -> Result<Vec<PathBuf>>

Extract everything (or the selected entry indices) under dir, with sanitised paths. Raw entries stream chunk by chunk to a temporary file that is renamed into place only after the hash verified; container entries are rebuilt in memory. Existing files are replaced only with overwrite; every destination is checked before the first byte is written, so a refusal leaves the directory as it was.

Source

pub fn verify(&mut self, pubkey: Option<&[u8; 32]>) -> Result<VerifyReport>

Decompress and hash-check every entry; verify the signature if a public key is given.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.