pub struct EntryWriter<'a, W>where
W: AsyncWrite + Unpin,{ /* private fields */ }Expand description
A streaming writer for a single file entry in a ZIP archive.
Obtained from ZipWriter::append_file. Data written through this
writer is compressed with DEFLATE and streamed to the underlying output.
§Important
The close method must be called after all
data is written to finalize the deflate frame and write the Data
Descriptor. Dropping without closing will lose the entry.
Implementations§
Source§impl<W: AsyncWrite + Unpin> EntryWriter<'_, W>
impl<W: AsyncWrite + Unpin> EntryWriter<'_, W>
Sourcepub fn set_mtime(&mut self, mtime: SystemTime) -> &mut Self
pub fn set_mtime(&mut self, mtime: SystemTime) -> &mut Self
Set the modification time for this entry.
The timestamp is stored in the Central Directory using MS-DOS format and as an extended timestamp extra field (0x5455).
Sourcepub fn set_permissions(&mut self, mode: u32) -> &mut Self
pub fn set_permissions(&mut self, mode: u32) -> &mut Self
Set Unix file permissions for this entry.
Provide permission bits including setuid/setgid/sticky (e.g., 0o4755, 0o2755).
The crate automatically adds the file type bit (S_IFREG for files,
S_IFDIR for directories).
Sourcepub async fn close(self) -> Result<(), ZipError>
pub async fn close(self) -> Result<(), ZipError>
Finalize the deflate frame, compute the CRC-32 checksum, and write the Data Descriptor.
This consumes the EntryWriter, flushes the deflate encoder, extracts
the compressed size, computes the CRC-32 of the uncompressed data, and
writes the trailing CRC-32 and sizes (Data Descriptor) after the compressed
data. The inner writer is returned to the parent ZipWriter.
§Errors
Returns ZipError if close is called more than once, if the deflate
encoder fails to shut down (I/O error), or if writing the Data
Descriptor fails (I/O error).
Trait Implementations§
Source§impl<W: AsyncWrite + Unpin> AsyncWrite for EntryWriter<'_, W>
impl<W: AsyncWrite + Unpin> AsyncWrite for EntryWriter<'_, W>
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read more