pub struct PreparedZipFile { /* private fields */ }Expand description
A file entry whose contents have already been compressed by a ZipFileBuilder, ready to be
appended to an archive with ZipWriter::add_prepared_file.
Implementations§
Source§impl PreparedZipFile
impl PreparedZipFile
Sourcepub fn from_data<N: AsRef<str>, T: FileOptionExtension>(
name: N,
options: FileOptions<'_, '_, T>,
data: &[u8],
) -> ZipResult<Self>
pub fn from_data<N: AsRef<str>, T: FileOptionExtension>( name: N, options: FileOptions<'_, '_, T>, data: &[u8], ) -> ZipResult<Self>
Compresses data in memory and prepares it as a PreparedZipFile.
§Errors
Returns an error if compression fails or options are invalid.
Sourcepub fn from_path<N: AsRef<str>, P: AsRef<Path>, T: FileOptionExtension>(
archive_name: N,
disk_path: P,
options: FileOptions<'_, '_, T>,
) -> ZipResult<Self>
pub fn from_path<N: AsRef<str>, P: AsRef<Path>, T: FileOptionExtension>( archive_name: N, disk_path: P, options: FileOptions<'_, '_, T>, ) -> ZipResult<Self>
Compresses a file from path on disk and prepares it as a PreparedZipFile.
§Errors
Returns an error if opening disk_path fails, if reading fails, or if compression fails.
Sourcepub fn file_name_raw(&self) -> &[u8] ⓘ
pub fn file_name_raw(&self) -> &[u8] ⓘ
Returns the file name of this prepared file as a byte slice.
Sourcepub const fn uncompressed_size(&self) -> u64
pub const fn uncompressed_size(&self) -> u64
Returns the uncompressed size in bytes.
Sourcepub const fn compressed_size(&self) -> u64
pub const fn compressed_size(&self) -> u64
Returns the compressed size in bytes.
Trait Implementations§
Source§impl Debug for PreparedZipFile
impl Debug for PreparedZipFile
Source§impl TryFrom<ZipFileBuilder> for PreparedZipFile
impl TryFrom<ZipFileBuilder> for PreparedZipFile
Source§fn try_from(builder: ZipFileBuilder) -> Result<Self, Self::Error>
fn try_from(builder: ZipFileBuilder) -> Result<Self, Self::Error>
Converts a ZipFileBuilder into a PreparedZipFile by finishing compression.
This is equivalent to calling ZipFileBuilder::finish.
Auto Trait Implementations§
impl Forget for PreparedZipFile
impl Freeze for PreparedZipFile
impl Move for PreparedZipFile
impl RefUnwindSafe for PreparedZipFile
impl Send for PreparedZipFile
impl Sync for PreparedZipFile
impl Unpin for PreparedZipFile
impl UnsafeUnpin for PreparedZipFile
impl UnwindSafe for PreparedZipFile
Blanket Implementations§
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more