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: ChunkIndexImplementations§
Source§impl Reader
impl Reader
Sourcepub fn open(path: &Path, password: Option<&str>) -> Result<Reader>
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).
Sourcepub fn open_with_refs(
path: &Path,
password: Option<&str>,
references: &[PathBuf],
) -> Result<Reader>
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.
Sourcepub fn open_with(
path: &Path,
creds: &Credentials,
references: &[PathBuf],
) -> Result<Reader>
pub fn open_with( path: &Path, creds: &Credentials, references: &[PathBuf], ) -> Result<Reader>
Open with full credentials (passphrase and/or hybrid identities) and reference archives.
Sourcepub fn unresolved_external(&self) -> usize
pub fn unresolved_external(&self) -> usize
Number of external chunks that cannot be resolved with the references given so far.
pub fn from_bytes(data: Vec<u8>, password: Option<&str>) -> Result<Reader>
pub fn is_encrypted(&self) -> bool
pub fn signature(&self) -> Option<&SignatureBlock>
Sourcepub fn verify_signature(&self, pubkey: &[u8; 32]) -> Result<bool>
pub fn verify_signature(&self, pubkey: &[u8; 32]) -> Result<bool>
Verify the embedded signature against a public key (hex or raw 32 bytes).
Sourcepub fn stream_entry(&mut self, ei: usize, sink: &mut dyn Write) -> Result<u64>
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.
Sourcepub fn chunk(&mut self, ci: u32) -> Result<Vec<u8>>
pub fn chunk(&mut self, ci: u32) -> Result<Vec<u8>>
Plaintext of one chunk (verified); external chunks are fetched from the reference archives.
Sourcepub fn entry_bytes(&mut self, ei: usize) -> Result<Vec<u8>>
pub fn entry_bytes(&mut self, ei: usize) -> Result<Vec<u8>>
Full bytes of an entry, verified against its BLAKE3 hash.
Sourcepub fn read_range(
&mut self,
ei: usize,
start: u64,
len: usize,
) -> Result<Vec<u8>>
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).
pub fn find_entry(&self, path: &str) -> Option<usize>
pub fn entries(&self) -> &[Entry]
Sourcepub fn extract(
&mut self,
dir: &Path,
selected: Option<&[usize]>,
overwrite: bool,
) -> Result<Vec<PathBuf>>
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.
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnsafeUnpin for Reader
impl UnwindSafe for Reader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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