Skip to main content

DirectoryWriter

Struct DirectoryWriter 

Source
pub struct DirectoryWriter<'a, W: AsyncWrite + Unpin> { /* private fields */ }
Expand description

A handle for finalizing a directory entry in a ZIP archive.

Obtained from ZipWriter::append_directory. Use set_mtime and/or set_permissions to attach metadata, then call close to finalize the entry.

Dropping without calling close leaves the archive in an inconsistent state and poisons the parent ZipWriter.

Implementations§

Source§

impl<W: AsyncWrite + Unpin> DirectoryWriter<'_, W>

Source

pub fn set_mtime(&mut self, mtime: SystemTime) -> &mut Self

Set the modification time for this directory entry.

Source

pub fn set_permissions(&mut self, mode: u32) -> &mut Self

Set Unix file permissions for this directory entry.

Provide permission bits including setuid/setgid/sticky (e.g., 0o755). The crate automatically adds the S_IFDIR file type bit.

Source

pub async fn close(self) -> Result<(), ZipError>

Finalize the directory entry by writing the Data Descriptor.

This consumes the DirectoryWriter, writes the trailing Data Descriptor (CRC-32 and zero sizes), and returns the inner writer to the parent ZipWriter.

§Errors

Returns ZipError if close is called more than once.

Trait Implementations§

Source§

impl<W: AsyncWrite + Unpin> Drop for DirectoryWriter<'_, W>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, W> Freeze for DirectoryWriter<'a, W>
where W: Freeze,

§

impl<'a, W> RefUnwindSafe for DirectoryWriter<'a, W>
where W: RefUnwindSafe,

§

impl<'a, W> Send for DirectoryWriter<'a, W>
where W: Send,

§

impl<'a, W> Sync for DirectoryWriter<'a, W>
where W: Sync,

§

impl<'a, W> Unpin for DirectoryWriter<'a, W>

§

impl<'a, W> UnsafeUnpin for DirectoryWriter<'a, W>
where W: UnsafeUnpin,

§

impl<'a, W> !UnwindSafe for DirectoryWriter<'a, W>

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> 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, 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.