| 1 | // Copyright (c) 2022 Harry [Majored] [[email protected]] |
| 2 | // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE) |
| 3 | |
| 4 | pub mod builderrust-analyzer cargo async_zip 0.0.18 entry/builder/; |
| 5 | |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#; |
| 7 | |
| 8 | use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::{AsyncReadrust-analyzer cargo futures-io 0.3.25 if_std/AsyncRead#, AsyncReadExtrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#, AsyncSeekrust-analyzer cargo futures-io 0.3.25 if_std/AsyncSeek#, AsyncSeekExtrust-analyzer cargo futures-lite 2.1.0 io/AsyncSeekExt#, SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#}; |
| 9 | |
| 10 | use craterust-analyzer cargo async_zip 0.0.18 crate/::entryrust-analyzer cargo async_zip 0.0.18 entry/::builderrust-analyzer cargo async_zip 0.0.18 entry/builder/::ZipEntryBuilderrust-analyzer cargo async_zip 0.0.18 entry/builder/ZipEntryBuilder#; |
| 11 | use craterust-analyzer cargo async_zip 0.0.18 crate/::errorrust-analyzer cargo async_zip 0.0.18 error/::{Resultrust-analyzer cargo async_zip 0.0.18 error/Result#, ZipErrorrust-analyzer cargo async_zip 0.0.18 error/ZipError#}; |
| 12 | use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::{ |
| 13 | attributerust-analyzer cargo async_zip 0.0.18 spec/attribute/::AttributeCompatibilityrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility#, |
| 14 | constsrust-analyzer cargo async_zip 0.0.18 spec/consts/::LFH_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/LFH_SIGNATURE., |
| 15 | headerrust-analyzer cargo async_zip 0.0.18 spec/header/::{ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#, LocalFileHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/LocalFileHeader#}, |
| 16 | Compressionrust-analyzer cargo async_zip 0.0.18 spec/compression/Compression#, |
| 17 | }; |
| 18 | use craterust-analyzer cargo async_zip 0.0.18 crate/::{stringrust-analyzer cargo async_zip 0.0.18 string/::ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString#, ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#}; |
| 19 | |
| 20 | /// An immutable store of data about a ZIP entry. |
| 21 | /// |
| 22 | /// This type cannot be directly constructed so instead, the [`ZipEntryBuilder`] must be used. Internally this builder |
| 23 | /// stores a [`ZipEntry`] so conversions between these two types via the [`From`] implementations will be |
| 24 | /// non-allocating. |
| 25 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 26 | pub struct ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry# { |
| 27 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) filenamerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#filename.: ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString#, |
| 28 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) compressionrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression.: Compressionrust-analyzer cargo async_zip 0.0.18 spec/compression/Compression#, |
| 29 | #[cfg(any( |
| 30 | feature = "deflate", |
| 31 | feature = "bzip2", |
| 32 | feature = "zstd", |
| 33 | feature = "lzma", |
| 34 | feature = "xz", |
| 35 | feature = "deflate64" |
| 36 | ))] |
| 37 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) compression_levelrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression_level.: async_compressionrust-analyzer cargo async-compression 0.4.27 crate/::Levelrust-analyzer cargo async-compression 0.4.27 Level#, |
| 38 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) crc32rust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#crc32.: u32, |
| 39 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) uncompressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#uncompressed_size.: u64, |
| 40 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) compressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compressed_size.: u64, |
| 41 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) attribute_compatibilityrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#attribute_compatibility.: AttributeCompatibilityrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility#, |
| 42 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) last_modification_daterust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#last_modification_date.: ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#, |
| 43 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) internal_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#internal_file_attribute.: u16, |
| 44 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) external_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#external_file_attribute.: u32, |
| 45 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) extra_fieldsrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#extra_fields.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#>, |
| 46 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) commentrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#comment.: ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString#, |
| 47 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) data_descriptorrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#data_descriptor.: bool, |
| 48 | } |
| 49 | |
| 50 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<ZipEntryBuilderrust-analyzer cargo async_zip 0.0.18 entry/builder/ZipEntryBuilder#> for ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry# { |
| 51 | fn fromrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry][`From<ZipEntryBuilder>`]from().(builder: ZipEntryBuilderrust-analyzer cargo async_zip 0.0.18 entry/builder/ZipEntryBuilder#) -> Selfrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry][`From<ZipEntryBuilder>`] { |
| 52 | builder.0rust-analyzer cargo async_zip 0.0.18 entry/builder/ZipEntryBuilder#0. |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | impl ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry# { |
| 57 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) fn newrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]new().(filename: ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString#, compression: Compressionrust-analyzer cargo async_zip 0.0.18 spec/compression/Compression#) -> Selfrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry] { |
| 58 | ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry# { |
| 59 | filenamerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#filename., |
| 60 | compressionrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression., |
| 61 | #[cfg(any( |
| 62 | feature = "deflate", |
| 63 | feature = "bzip2", |
| 64 | feature = "zstd", |
| 65 | feature = "lzma", |
| 66 | feature = "xz", |
| 67 | feature = "deflate64" |
| 68 | ))] |
| 69 | compression_levelrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression_level.: async_compressionrust-analyzer cargo async-compression 0.4.27 crate/::Levelrust-analyzer cargo async-compression 0.4.27 Level#::Defaultrust-analyzer cargo async-compression 0.4.27 Level#Default#, |
| 70 | crc32rust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#crc32.: 0, |
| 71 | uncompressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#uncompressed_size.: 0, |
| 72 | compressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compressed_size.: 0, |
| 73 | attribute_compatibilityrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#attribute_compatibility.: AttributeCompatibilityrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility#::Unixrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility#Unix#, |
| 74 | last_modification_daterust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#last_modification_date.: ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#::defaultrust-analyzer cargo async_zip 0.0.18 date/impl#[ZipDateTime][Default]default().(), |
| 75 | internal_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#internal_file_attribute.: 0, |
| 76 | external_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#external_file_attribute.: 0, |
| 77 | extra_fieldsrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#extra_fields.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 78 | commentrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#comment.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 79 | data_descriptorrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#data_descriptor.: false, |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /// Returns the entry's filename. |
| 84 | /// |
| 85 | /// ## Note |
| 86 | /// This will return the raw filename stored during ZIP creation. If calling this method on entries retrieved from |
| 87 | /// untrusted ZIP files, the filename should be sanitised before being used as a path to prevent [directory |
| 88 | /// traversal attacks](https://en.wikipedia.org/wiki/Directory_traversal_attack). |
| 89 | pub fn filenamerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]filename().(&self) -> &ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString# { |
| 90 | &self.filenamerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#filename. |
| 91 | } |
| 92 | |
| 93 | /// Returns the entry's compression method. |
| 94 | pub fn compressionrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]compression().(&self) -> Compressionrust-analyzer cargo async_zip 0.0.18 spec/compression/Compression# { |
| 95 | self.compressionrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression. |
| 96 | } |
| 97 | |
| 98 | /// Returns the entry's CRC32 value. |
| 99 | pub fn crc32rust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]crc32().(&self) -> u32 { |
| 100 | self.crc32rust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#crc32. |
| 101 | } |
| 102 | |
| 103 | /// Returns the entry's uncompressed size. |
| 104 | pub fn uncompressed_sizerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]uncompressed_size().(&self) -> u64 { |
| 105 | self.uncompressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#uncompressed_size. |
| 106 | } |
| 107 | |
| 108 | /// Returns the entry's compressed size. |
| 109 | pub fn compressed_sizerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]compressed_size().(&self) -> u64 { |
| 110 | self.compressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compressed_size. |
| 111 | } |
| 112 | |
| 113 | /// Returns the entry's attribute's host compatibility. |
| 114 | pub fn attribute_compatibilityrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]attribute_compatibility().(&self) -> AttributeCompatibilityrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility# { |
| 115 | self.attribute_compatibilityrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#attribute_compatibility. |
| 116 | } |
| 117 | |
| 118 | /// Returns the entry's last modification time & date. |
| 119 | pub fn last_modification_daterust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]last_modification_date().(&self) -> &ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime# { |
| 120 | &self.last_modification_daterust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#last_modification_date. |
| 121 | } |
| 122 | |
| 123 | /// Returns the entry's internal file attribute. |
| 124 | pub fn internal_file_attributerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]internal_file_attribute().(&self) -> u16 { |
| 125 | self.internal_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#internal_file_attribute. |
| 126 | } |
| 127 | |
| 128 | /// Returns the entry's external file attribute |
| 129 | pub fn external_file_attributerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]external_file_attribute().(&self) -> u32 { |
| 130 | self.external_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#external_file_attribute. |
| 131 | } |
| 132 | |
| 133 | /// Returns the entry's extra field data. |
| 134 | pub fn extra_fieldsrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]extra_fields().(&self) -> &[ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#] { |
| 135 | &self.extra_fieldsrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#extra_fields. |
| 136 | } |
| 137 | |
| 138 | /// Returns the entry's file comment. |
| 139 | pub fn commentrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]comment().(&self) -> &ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString# { |
| 140 | &self.commentrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#comment. |
| 141 | } |
| 142 | |
| 143 | /// Returns the entry's integer-based UNIX permissions. |
| 144 | /// |
| 145 | /// # Note |
| 146 | /// This will return None if the attribute host compatibility is not listed as Unix. |
| 147 | pub fn unix_permissionsrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]unix_permissions().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16> { |
| 148 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.attribute_compatibilityrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#attribute_compatibility., AttributeCompatibilityrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility#::Unixrust-analyzer cargo async_zip 0.0.18 spec/attribute/AttributeCompatibility#Unix#) { |
| 149 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 150 | } |
| 151 | |
| 152 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(((self.external_file_attributerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#external_file_attribute.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().16) as u16) |
| 153 | } |
| 154 | |
| 155 | /// Returns whether or not the entry represents a directory. |
| 156 | pub fn dirrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]dir().(&self) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<bool> { |
| 157 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.filenamerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#filename..as_strrust-analyzer cargo async_zip 0.0.18 string/impl#[ZipString]as_str().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().('/')) |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /// An immutable store of data about how a ZIP entry is stored within a specific archive. |
| 162 | /// |
| 163 | /// Besides storing archive independent information like the size and timestamp it can also be used to query |
| 164 | /// information about how the entry is stored in an archive. |
| 165 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 166 | pub struct StoredZipEntryrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry# { |
| 167 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) entryrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#entry.: ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#, |
| 168 | // pub(crate) general_purpose_flag: GeneralPurposeFlag, |
| 169 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) file_offsetrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#file_offset.: u64, |
| 170 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) header_sizerust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#header_size.: u64, |
| 171 | } |
| 172 | |
| 173 | impl StoredZipEntryrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry# { |
| 174 | /// Returns the offset in bytes to where the header of the entry starts. |
| 175 | pub fn header_offsetrust-analyzer cargo async_zip 0.0.18 entry/impl#[StoredZipEntry]header_offset().(&self) -> u64 { |
| 176 | self.file_offsetrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#file_offset. |
| 177 | } |
| 178 | |
| 179 | /// Returns the combined size in bytes of the header, the filename, and any extra fields. |
| 180 | /// |
| 181 | /// Note: This uses the extra field length stored in the central directory, which may differ from that stored in |
| 182 | /// the local file header. See specification: <https://github.com/Majored/rs-async-zip/blob/main/SPECIFICATION.md#732> |
| 183 | pub fn header_sizerust-analyzer cargo async_zip 0.0.18 entry/impl#[StoredZipEntry]header_size().(&self) -> u64 { |
| 184 | self.header_sizerust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#header_size. |
| 185 | } |
| 186 | |
| 187 | /// Seek to the offset in bytes where the data of the entry starts. |
| 188 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) async fn seek_to_data_offsetrust-analyzer cargo async_zip 0.0.18 entry/impl#[StoredZipEntry]seek_to_data_offset().<R: AsyncReadrust-analyzer cargo futures-io 0.3.25 if_std/AsyncRead# + AsyncSeekrust-analyzer cargo futures-io 0.3.25 if_std/AsyncSeek# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#>(&self, mut reader: &mut R) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<()> { |
| 189 | // Seek to the header |
| 190 | reader.seekrust-analyzer cargo futures-lite 2.1.0 io/AsyncSeekExt#seek().(SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Startrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#Start#(self.file_offsetrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#file_offset.)).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`SeekFuture<'_, S>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`SeekFuture<'_, S>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 191 | |
| 192 | // Check the signature |
| 193 | let signature = { |
| 194 | let mut buffer = [0; 4]; |
| 195 | reader.read_exactrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#read_exact().(&mut buffer).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`ReadExactFuture<'_, R>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`ReadExactFuture<'_, R>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 196 | u32::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_le_bytes().(buffer) |
| 197 | }; |
| 198 | |
| 199 | match signature { |
| 200 | LFH_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/LFH_SIGNATURE. => (), |
| 201 | actual => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ZipErrorrust-analyzer cargo async_zip 0.0.18 error/ZipError#::UnexpectedHeaderErrorrust-analyzer cargo async_zip 0.0.18 error/ZipError#UnexpectedHeaderError#(actual, LFH_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/LFH_SIGNATURE.)), |
| 202 | }; |
| 203 | |
| 204 | // Skip the local file header and trailing data |
| 205 | let header = LocalFileHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/LocalFileHeader#::from_readerrust-analyzer cargo async_zip 0.0.18 spec/parse/impl#[LocalFileHeader]from_reader().(&mut reader).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 206 | let trailing_size = (header.file_name_lengthrust-analyzer cargo async_zip 0.0.18 spec/header/LocalFileHeader#file_name_length. as i64) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().(header.extra_field_lengthrust-analyzer cargo async_zip 0.0.18 spec/header/LocalFileHeader#extra_field_length. as i64); |
| 207 | reader.seekrust-analyzer cargo futures-lite 2.1.0 io/AsyncSeekExt#seek().(SeekFromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#::Currentrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/SeekFrom#Current#(trailing_size)).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`SeekFuture<'_, S>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`SeekFuture<'_, S>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 208 | |
| 209 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | impl Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for StoredZipEntryrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry# { |
| 214 | type Targetrust-analyzer cargo async_zip 0.0.18 entry/impl#[StoredZipEntry][Deref]Target# = ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#; |
| 215 | |
| 216 | fn derefrust-analyzer cargo async_zip 0.0.18 entry/impl#[StoredZipEntry][Deref]deref().(&self) -> &Selfrust-analyzer cargo async_zip 0.0.18 entry/impl#[StoredZipEntry][Deref]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# { |
| 217 | &self.entryrust-analyzer cargo async_zip 0.0.18 entry/StoredZipEntry#entry. |
| 218 | } |
| 219 | } |