style: cargo fmt --all, fix bzip2 error
This commit is contained in:
parent
3140276a33
commit
9af296d080
5 changed files with 8 additions and 9 deletions
|
@ -17,7 +17,7 @@ pub struct ExtendedTimestamp {
|
||||||
impl ExtendedTimestamp {
|
impl ExtendedTimestamp {
|
||||||
/// creates an extended timestamp struct by reading the required bytes from the reader.
|
/// creates an extended timestamp struct by reading the required bytes from the reader.
|
||||||
///
|
///
|
||||||
/// This method assumes that the length has already been read, therefore
|
/// This method assumes that the length has already been read, therefore
|
||||||
/// it must be passed as an argument
|
/// it must be passed as an argument
|
||||||
pub fn try_from_reader<R>(reader: &mut R, len: u16) -> ZipResult<Self>
|
pub fn try_from_reader<R>(reader: &mut R, len: u16) -> ZipResult<Self>
|
||||||
where
|
where
|
||||||
|
|
|
@ -23,7 +23,6 @@ pub use extended_timestamp::*;
|
||||||
/// contains one extra field
|
/// contains one extra field
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ExtraField {
|
pub enum ExtraField {
|
||||||
|
|
||||||
/// extended timestamp, as described in <https://libzip.org/specifications/extrafld.txt>
|
/// extended timestamp, as described in <https://libzip.org/specifications/extrafld.txt>
|
||||||
ExtendedTimestamp(ExtendedTimestamp)
|
ExtendedTimestamp(ExtendedTimestamp),
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,13 @@ mod aes_ctr;
|
||||||
mod compression;
|
mod compression;
|
||||||
mod cp437;
|
mod cp437;
|
||||||
mod crc32;
|
mod crc32;
|
||||||
|
pub mod extra_fields;
|
||||||
pub mod read;
|
pub mod read;
|
||||||
pub mod result;
|
pub mod result;
|
||||||
mod spec;
|
mod spec;
|
||||||
mod types;
|
mod types;
|
||||||
pub mod write;
|
pub mod write;
|
||||||
mod zipcrypto;
|
mod zipcrypto;
|
||||||
pub mod extra_fields;
|
|
||||||
pub use extra_fields::ExtraField;
|
pub use extra_fields::ExtraField;
|
||||||
|
|
||||||
#[doc = "Unstable APIs\n\
|
#[doc = "Unstable APIs\n\
|
||||||
|
|
|
@ -30,7 +30,7 @@ use flate2::read::DeflateDecoder;
|
||||||
use deflate64::Deflate64Decoder;
|
use deflate64::Deflate64Decoder;
|
||||||
|
|
||||||
#[cfg(feature = "bzip2")]
|
#[cfg(feature = "bzip2")]
|
||||||
use bzip2::read::BzDecoder;
|
use bzip2_rs::decoder::DecoderReader;
|
||||||
|
|
||||||
#[cfg(feature = "zstd")]
|
#[cfg(feature = "zstd")]
|
||||||
use zstd::stream::read::Decoder as ZstdDecoder;
|
use zstd::stream::read::Decoder as ZstdDecoder;
|
||||||
|
@ -146,7 +146,7 @@ pub(crate) enum ZipFileReader<'a> {
|
||||||
#[cfg(feature = "deflate64")]
|
#[cfg(feature = "deflate64")]
|
||||||
Deflate64(Crc32Reader<Deflate64Decoder<io::BufReader<CryptoReader<'a>>>>),
|
Deflate64(Crc32Reader<Deflate64Decoder<io::BufReader<CryptoReader<'a>>>>),
|
||||||
#[cfg(feature = "bzip2")]
|
#[cfg(feature = "bzip2")]
|
||||||
Bzip2(Crc32Reader<BzDecoder<CryptoReader<'a>>>),
|
Bzip2(Crc32Reader<DecoderReader<CryptoReader<'a>>>),
|
||||||
#[cfg(feature = "zstd")]
|
#[cfg(feature = "zstd")]
|
||||||
Zstd(Crc32Reader<ZstdDecoder<'a, io::BufReader<CryptoReader<'a>>>>),
|
Zstd(Crc32Reader<ZstdDecoder<'a, io::BufReader<CryptoReader<'a>>>>),
|
||||||
#[cfg(feature = "lzma")]
|
#[cfg(feature = "lzma")]
|
||||||
|
@ -307,7 +307,7 @@ pub(crate) fn make_reader(
|
||||||
}
|
}
|
||||||
#[cfg(feature = "bzip2")]
|
#[cfg(feature = "bzip2")]
|
||||||
CompressionMethod::Bzip2 => {
|
CompressionMethod::Bzip2 => {
|
||||||
let bzip2_reader = BzDecoder::new(reader);
|
let bzip2_reader = DecoderReader::new(reader);
|
||||||
ZipFileReader::Bzip2(Crc32Reader::new(bzip2_reader, crc32, ae2_encrypted))
|
ZipFileReader::Bzip2(Crc32Reader::new(bzip2_reader, crc32, ae2_encrypted))
|
||||||
}
|
}
|
||||||
#[cfg(feature = "zstd")]
|
#[cfg(feature = "zstd")]
|
||||||
|
@ -1102,7 +1102,7 @@ impl<'a> ZipFile<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// iterate through all extra fields
|
/// iterate through all extra fields
|
||||||
pub fn extra_data_fields(&self) -> impl Iterator<Item=&ExtraField> {
|
pub fn extra_data_fields(&self) -> impl Iterator<Item = &ExtraField> {
|
||||||
self.data.extra_fields.iter()
|
self.data.extra_fields.iter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ fn test_extended_timestamp() {
|
||||||
assert!(ts.ac_time().is_none());
|
assert!(ts.ac_time().is_none());
|
||||||
assert!(ts.cr_time().is_none());
|
assert!(ts.cr_time().is_none());
|
||||||
assert_eq!(*ts.mod_time().unwrap(), 1714635025);
|
assert_eq!(*ts.mod_time().unwrap(), 1714635025);
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue