ZipEntryReader

Struct ZipEntryReader 

Source
pub struct ZipEntryReader<'a, R, E> { /* private fields */ }
Expand description

A ZIP entry reader which may implement decompression.

Implementations§

Source§

impl<'a, R, E> ZipEntryReader<'a, R, E>
where R: AsyncBufRead + Unpin,

Source

pub fn compute_hash(&mut self) -> u32

Computes and returns the CRC32 hash of bytes read by this reader so far.

This hash should only be computed once EOF has been reached.

Source

pub fn bytes_read(&self) -> u64

Return the number of bytes read so far by this reader.

Source§

impl<R> ZipEntryReader<'_, R, WithEntry<'_>>
where R: AsyncBufRead + Unpin,

Source

pub fn entry(&self) -> &ZipEntry

Returns an immutable reference to the associated entry data.

Source

pub async fn read_to_end_checked(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Reads all bytes until EOF has been reached, appending them to buf, and verifies the CRC32 values.

This is a helper function synonymous to AsyncReadExt::read_to_end().

Source

pub async fn read_to_string_checked( &mut self, buf: &mut String, ) -> Result<usize>

Reads all bytes until EOF has been reached, placing them into buf, and verifies the CRC32 values.

This is a helper function synonymous to AsyncReadExt::read_to_string().

Trait Implementations§

Source§

impl<'a, R, E> AsyncRead for ZipEntryReader<'a, R, E>
where R: AsyncBufRead + Unpin,

Source§

fn poll_read( self: Pin<&mut Self>, c: &mut Context<'_>, b: &mut [u8], ) -> Poll<Result<usize>>

Attempt to read from the AsyncRead into buf. Read more
Source§

fn poll_read_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>], ) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more
Source§

impl<'pin, 'a, R, E> Unpin for ZipEntryReader<'a, R, E>
where PinnedFieldsOf<__ZipEntryReader<'pin, 'a, R, E>>: Unpin,

Auto Trait Implementations§

§

impl<'a, R, E> Freeze for ZipEntryReader<'a, R, E>
where E: Freeze, R: Freeze,

§

impl<'a, R, E> RefUnwindSafe for ZipEntryReader<'a, R, E>

§

impl<'a, R, E> Send for ZipEntryReader<'a, R, E>
where E: Send, R: Send,

§

impl<'a, R, E> Sync for ZipEntryReader<'a, R, E>
where E: Sync, R: Sync,

§

impl<'a, R, E> !UnwindSafe for ZipEntryReader<'a, R, E>

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<R> AsyncReadExt for R
where R: AsyncRead + ?Sized,

Source§

fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>
where Self: Unpin,

Reads some bytes from the byte stream. Read more
Source§

fn read_vectored<'a>( &'a mut self, bufs: &'a mut [IoSliceMut<'a>], ) -> ReadVectoredFuture<'a, Self>
where Self: Unpin,

Like read(), except it reads into a slice of buffers. Read more
Source§

fn read_to_end<'a>( &'a mut self, buf: &'a mut Vec<u8>, ) -> ReadToEndFuture<'a, Self>
where Self: Unpin,

Reads the entire contents and appends them to a Vec. Read more
Source§

fn read_to_string<'a>( &'a mut self, buf: &'a mut String, ) -> ReadToStringFuture<'a, Self>
where Self: Unpin,

Reads the entire contents and appends them to a String. Read more
Source§

fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>
where Self: Unpin,

Reads the exact number of bytes required to fill buf. Read more
Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Converts this AsyncRead into a Stream of bytes. Read more
Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: AsyncRead, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
Source§

fn boxed_reader<'a>(self) -> Pin<Box<dyn AsyncRead + Send + 'a>>
where Self: Sized + Send + 'a,

Available on crate feature alloc only.
Boxes the reader and changes its type to dyn AsyncRead + Send + 'a. 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> FuturesAsyncReadCompatExt for T
where T: AsyncRead,

Source§

fn compat(self) -> Compat<Self>
where Self: Sized,

Wraps self with a compatibility layer that implements tokio_io::AsyncRead.
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.