pub struct EntryStreamWriter<'b, W: AsyncWrite + Unpin> { /* private fields */ }Expand description
An entry writer which supports the streaming of data (ie. the writing of unknown size or data at runtime).
§Note
- This writer cannot be manually constructed; instead, use
ZipFileWriter::write_entry_stream(). EntryStreamWriter::close()must be called before a stream writer goes out of scope.- Utilities for working with
AsyncWritevalues are provided byAsyncWriteExt.
Implementations§
Source§impl<'b, W: AsyncWrite + Unpin> EntryStreamWriter<'b, W>
impl<'b, W: AsyncWrite + Unpin> EntryStreamWriter<'b, W>
Sourcepub async fn close(self) -> Result<()>
pub async fn close(self) -> Result<()>
Consumes this entry writer and completes all closing tasks.
This includes:
- Finalising the CRC32 hash value for the written data.
- Calculating the compressed and uncompressed byte sizes.
- Constructing a central directory header.
- Pushing that central directory header to the
ZipFileWriter’s store.
Failure to call this function before going out of scope would result in a corrupted ZIP file.
Trait Implementations§
Source§impl<'a, W: AsyncWrite + Unpin> AsyncWrite for EntryStreamWriter<'a, W>
impl<'a, W: AsyncWrite + Unpin> AsyncWrite for EntryStreamWriter<'a, W>
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize, Error>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Error>>
Attempt to write bytes from
buf into the object. Read moreSource§fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>
fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Error>>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Auto Trait Implementations§
impl<'b, W> Freeze for EntryStreamWriter<'b, W>
impl<'b, W> RefUnwindSafe for EntryStreamWriter<'b, W>where
W: RefUnwindSafe,
impl<'b, W> Send for EntryStreamWriter<'b, W>where
W: Send,
impl<'b, W> Sync for EntryStreamWriter<'b, W>where
W: Sync,
impl<'b, W> Unpin for EntryStreamWriter<'b, W>
impl<'b, W> !UnwindSafe for EntryStreamWriter<'b, W>
Blanket Implementations§
Source§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
Source§fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
Creates a future which will entirely flush this
AsyncWrite. Read moreSource§fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
Creates a future which will entirely close this
AsyncWrite.Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
Creates a future which will write bytes from
buf into the object. Read moreSource§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
Creates a future which will write bytes from
bufs into the object using vectored
IO operations. Read moreSource§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
Mutably borrows from an owned value. Read more
Source§impl<T> FuturesAsyncWriteCompatExt for Twhere
T: AsyncWrite,
impl<T> FuturesAsyncWriteCompatExt for Twhere
T: AsyncWrite,
Source§fn compat_write(self) -> Compat<Self>where
Self: Sized,
fn compat_write(self) -> Compat<Self>where
Self: Sized,
Wraps
self with a compatibility layer that implements
tokio::io::AsyncWrite.