Skip to main content

Archive

Struct Archive 

Source
pub struct Archive<'a> {
    zip: &'a [u8],
    entries: BTreeMap<String, Entry>,
}
Expand description

A package whose central directory has been read once. Finding each file by walking the directory again cost an install of n files n² entry parses: 8.5 s of a 12 s install at 3 000 files.

Fields§

§zip: &'a [u8]§entries: BTreeMap<String, Entry>

Files only, by folded path, because a ledger may hold a path folded.

Implementations§

Source§

impl<'a> Archive<'a>

Source

pub fn open(zip: &'a [u8]) -> Result<Archive<'a>, ZipError>

Source

pub fn read(&self, path: &str) -> Result<Vec<u8>, ZipError>

One file’s bytes, by a path entries reported, matched case-insensitively.

Auto Trait Implementations§

§

impl<'a> Freeze for Archive<'a>

§

impl<'a> RefUnwindSafe for Archive<'a>

§

impl<'a> Send for Archive<'a>

§

impl<'a> Sync for Archive<'a>

§

impl<'a> Unpin for Archive<'a>

§

impl<'a> UnsafeUnpin for Archive<'a>

§

impl<'a> UnwindSafe for Archive<'a>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

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.