Skip to main content

ZipEntryBuilder

Struct ZipEntryBuilder 

Source
pub struct ZipEntryBuilder(/* private fields */);
Expand description

A builder for ZipEntry.

Implementations§

Source§

impl ZipEntryBuilder

Source

pub fn new(filename: ZipString, compression: Compression) -> Self

Constructs a new builder which defines the raw underlying data of a ZIP entry.

A filename and compression method are needed to construct the builder as minimal parameters.

Source

pub fn filename(self, filename: ZipString) -> Self

Sets the entry’s filename.

Source

pub fn compression(self, compression: Compression) -> Self

Sets the entry’s compression method.

Source

pub fn size<N: Into<u64>, M: Into<u64>>( self, compressed_size: N, uncompressed_size: M, ) -> Self

Set a size hint for the file, to be written into the local file header. Unlikely to be useful except for the case of streaming files to be Store’d. This size hint does not affect the central directory, nor does it affect whole files.

Source

pub fn deflate_option(self, option: DeflateOption) -> Self

Available on crate features bzip2 or deflate or lzma or xz or zstd only.

Set the deflate compression option.

If the compression type isn’t deflate, this option has no effect.

Source

pub fn attribute_compatibility( self, compatibility: AttributeCompatibility, ) -> Self

Sets the entry’s attribute host compatibility.

Source

pub fn last_modification_date(self, date: ZipDateTime) -> Self

Sets the entry’s last modification date.

Source

pub fn internal_file_attribute(self, attribute: u16) -> Self

Sets the entry’s internal file attribute.

Source

pub fn external_file_attribute(self, attribute: u32) -> Self

Sets the entry’s external file attribute.

Source

pub fn extra_fields(self, field: Vec<ExtraField>) -> Self

Sets the entry’s extra field data.

Source

pub fn comment(self, comment: ZipString) -> Self

Sets the entry’s file comment.

Source

pub fn unix_permissions(self, mode: u16) -> Self

Sets the entry’s Unix permissions mode.

If the attribute host compatibility isn’t set to Unix, this will have no effect.

Source

pub fn build(self) -> ZipEntry

Consumes this builder and returns a final ZipEntry.

This is equivalent to:

let entry: ZipEntry = builder.into();

Trait Implementations§

Source§

impl From<ZipEntry> for ZipEntryBuilder

Source§

fn from(entry: ZipEntry) -> Self

Converts to this type from the input type.
Source§

impl From<ZipEntryBuilder> for ZipEntry

Source§

fn from(builder: ZipEntryBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.