Skip to main content

ZipFileReader

Struct ZipFileReader 

Source
pub struct ZipFileReader<R> { /* private fields */ }
Expand description

A ZIP reader which acts over a seekable source.

Implementations§

Source§

impl<R> ZipFileReader<R>

Source

pub async fn new(reader: R) -> Result<ZipFileReader<R>>

Constructs a new ZIP reader from a seekable source.

The source must be finite or bounded to a single archive. At most 4 KiB of NUL padding is permitted after the end record’s declared comment. Local headers are not walked during construction. Archive and entry comments containing bytes 0x01 through 0x08 are conservatively rejected to exclude embedded ZIP records; this does not prohibit ZIP files stored as entries.

Source

pub fn from_raw_parts(reader: R, file: ZipFile) -> ZipFileReader<R>

Constructs a ZIP reader from a seekable source and ZIP file information derived from that source.

Providing a ZipFile that wasn’t derived from that source may lead to inaccurate parsing.

Source

pub fn file(&self) -> &ZipFile

Returns this ZIP file’s information.

Source

pub fn inner_mut(&mut self) -> &mut R

Returns a mutable reference to the inner seekable source.

Swapping the source (eg. via std::mem operations) may lead to inaccurate parsing.

Source

pub fn into_inner(self) -> R

Returns the inner seekable source by consuming self.

Source

pub async fn reader_without_entry( &mut self, index: usize, ) -> Result<ZipEntryReader<'_, R, WithoutEntry>>

Returns a new entry reader if the provided index is valid.

Source

pub async fn reader_with_entry( &mut self, index: usize, ) -> Result<ZipEntryReader<'_, R, WithEntry<'_>>>

Returns a new entry reader if the provided index is valid.

Source

pub async fn into_entry<'a>( self, index: usize, ) -> Result<ZipEntryReader<'a, R, WithoutEntry>>
where R: 'a,

Returns a new entry reader if the provided index is valid. Consumes self

Source§

impl<R> ZipFileReader<Compat<R>>

Source

pub async fn with_tokio(reader: R) -> Result<TokioZipFileReader<R>>

Available on crate feature tokio only.

Constructs a new tokio-specific ZIP reader from a seekable source.

Trait Implementations§

Source§

impl<R: Clone> Clone for ZipFileReader<R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<R> UnsafeUnpin for ZipFileReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for ZipFileReader<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.