pub struct EntrySeekableWriter<'b, W: AsyncWrite + AsyncSeek + Unpin> { /* private fields */ }Expand description
An entry writer which streams data to a seekable ZIP output.
Unlike EntryStreamWriter, this writer doesn’t use
data descriptors. Instead, it writes a placeholder local file header, streams the entry data,
then seeks back and patches the header with the final CRC and sizes.
If the final compressed or uncompressed size requires Zip64 but no Zip64 size fields were
reserved up front, closing this writer will fail. Use ZipEntryBuilder::size to reserve those
fields when the size is known to exceed the non-Zip64 limit, or use
ZipFileWriter::write_entry_stream for fully unknown Zip64-sized entries.
Implementations§
Source§impl<'b, W: AsyncWrite + AsyncSeek + Unpin> EntrySeekableWriter<'b, W>
impl<'b, W: AsyncWrite + AsyncSeek + Unpin> EntrySeekableWriter<'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.
- Seeking back to patch the local file header.
- 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 + AsyncSeek + Unpin> AsyncWrite for EntrySeekableWriter<'a, W>
impl<'a, W: AsyncWrite + AsyncSeek + Unpin> AsyncWrite for EntrySeekableWriter<'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>>
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>>
Auto Trait Implementations§
impl<'b, W> Freeze for EntrySeekableWriter<'b, W>
impl<'b, W> RefUnwindSafe for EntrySeekableWriter<'b, W>where
W: RefUnwindSafe,
impl<'b, W> Send for EntrySeekableWriter<'b, W>where
W: Send,
impl<'b, W> Sync for EntrySeekableWriter<'b, W>where
W: Sync,
impl<'b, W> Unpin for EntrySeekableWriter<'b, W>
impl<'b, W> UnsafeUnpin for EntrySeekableWriter<'b, W>
impl<'b, W> !UnwindSafe for EntrySeekableWriter<'b, W>
Blanket Implementations§
Source§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
Source§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
Source§fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where
Self: Unpin,
fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where
Self: Unpin,
Source§fn flush(&mut self) -> FlushFuture<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self>where
Self: Unpin,
Source§fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a>>
fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a>>
alloc only.dyn AsyncWrite + Send + 'a. 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
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,
self with a compatibility layer that implements
tokio::io::AsyncWrite.