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 crc32<N: Into<u32>>(self, crc: N) -> Self

Source

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

Source

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

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 current(&self) -> &ZipEntry

Returns a reference to the currently built entry.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more