Debian Codegraph @

src/base/read/stream.rs

raw symbols SCIP
1 // Copyright (c) 2023 Harry [Majored] [[email protected]]
2 // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE)
3
4 //! A ZIP reader which acts over a non-seekable source.
5 //!
6 //! # API Design
7 //! As opposed to other readers provided by this crate, it's important that the data of an entry is fully read before
8 //! the proceeding entry is read. This is as a result of not being able to seek forwards or backwards, so we must end
9 //! up at the start of the next entry.
10 //!
11 //! **We encode this invariant within Rust's type system so that it can be enforced at compile time.**
12 //!
13 //! This requires that any transition methods between these encoded types consume the reader and provide a new owned
14 //! reader back. This is certainly something to keep in mind when working with this reader, but idiomatic code can
15 //! still be produced nevertheless.
16 //!
17 //! # Considerations
18 //! As the central directory of a ZIP archive is stored at the end of it, a non-seekable reader doesn't have access
19 //! to it. We have to rely on information provided within the local file header which may not be accurate or complete.
20 //! This results in:
21 //! - The inability to read ZIP entries using the combination of a data descriptor and the Stored compression method.
22 //! - No file comment being available (defaults to an empty string).
23 //! - No internal or external file attributes being available (defaults to 0).
24 //! - The extra field data potentially being inconsistent with what's stored in the central directory.
25 //! - None of the following being available when the entry was written with a data descriptor (defaults to 0):
26 //! - CRC
27 //! - compressed size
28 //! - uncompressed size
29 //!
30 //! # Example
31 //! ```no_run
32 //! # use futures_lite::io::Cursor;
33 //! # use async_zip::error::Result;
34 //! # use async_zip::base::read::stream::ZipFileReader;
35 //! #
36 //! # async fn run() -> Result<()> {
37 //! let mut zip = ZipFileReader::new(Cursor::new([0; 0]));
38 //!
39 //! // Print the name of every file in a ZIP archive.
40 //! while let Some(entry) = zip.next_with_entry().await? {
41 //! println!("File: {}", entry.reader().entry().filename().as_str().unwrap());
42 //! zip = entry.skip().await?;
43 //! }
44 //! #
45 //! # Ok(())
46 //! # }
47 //! ```
48
49 use craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::entryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/::ZipEntryReaderrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/ZipEntryReader#;
50 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#;
51 use craterust-analyzer cargo async_zip 0.0.18 crate/::errorrust-analyzer cargo async_zip 0.0.18 error/::ZipErrorrust-analyzer cargo async_zip 0.0.18 error/ZipError#;
52
53 use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::constsrust-analyzer cargo async_zip 0.0.18 spec/consts/::DATA_DESCRIPTOR_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/DATA_DESCRIPTOR_LENGTH.;
54 use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::constsrust-analyzer cargo async_zip 0.0.18 spec/consts/::DATA_DESCRIPTOR_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/DATA_DESCRIPTOR_SIGNATURE.;
55 use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::constsrust-analyzer cargo async_zip 0.0.18 spec/consts/::SIGNATURE_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/SIGNATURE_LENGTH.;
56 #[cfg(feature = "tokio")]
57 use craterust-analyzer cargo async_zip 0.0.18 crate/::tokiorust-analyzer cargo async_zip 0.0.18 tokio/::readrust-analyzer cargo async_zip 0.0.18 tokio/read/::streamrust-analyzer cargo async_zip 0.0.18 tokio/read/stream/::Readyrust-analyzer cargo async_zip 0.0.18 tokio/read/stream/Ready# as TokioReadyrust-analyzer cargo async_zip 0.0.18 tokio/read/stream/Ready#;
58
59 use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::AsyncBufReadrust-analyzer cargo futures-io 0.3.25 if_std/AsyncBufRead#;
60 use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::AsyncReadExtrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#;
61
62 #[cfg(feature = "tokio")]
63 use tokio_utilrust-analyzer cargo tokio-util 0.7.4 crate/::compatrust-analyzer cargo tokio-util 0.7.4 compat/::TokioAsyncReadCompatExtrust-analyzer cargo tokio-util 0.7.4 compat/TokioAsyncReadCompatExt#;
64
65 use superrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::entryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/::WithEntryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/WithEntry#;
66 use superrust-analyzer cargo async_zip 0.0.18 base/read/::iorust-analyzer cargo async_zip 0.0.18 base/read/io/::entryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/::WithoutEntryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/WithoutEntry#;
67
68 /// A type which encodes that [`ZipFileReader`] is ready to open a new entry.
69 pub struct Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#<R>(R);
70
71 /// A type which encodes that [`ZipFileReader`] is currently reading an entry.
72 pub struct Readingrust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#<'a, R, E>(ZipEntryReaderrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/ZipEntryReader#<'a, R, E>, bool);
73
74 /// A ZIP reader which acts over a non-seekable source.
75 ///
76 /// See the [module-level docs](.) for more information.
77 #[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:)]
78 pub struct ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<S>(S);
79
80 impl<'a, R> ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#<R>>
81 where
82 R: AsyncBufReadrust-analyzer cargo futures-io 0.3.25 if_std/AsyncBufRead# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin# + 'a,
83 {
84 /// Constructs a new ZIP reader from a non-seekable source.
85 pub fn newrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<R>>`]new().(reader: R) -> Selfrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<R>>`] {
86 Selfrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<R>>`](Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#(reader))
87 }
88
89 /// Opens the next entry for reading if the central directory hasn’t yet been reached.
90 pub async fn next_without_entryrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<R>>`]next_without_entry().(mut self) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<Readingrust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#<'a, R, WithoutEntryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/WithoutEntry#>>>> {
91 let entry = match craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::lfhrust-analyzer cargo async_zip 0.0.18 base/read/lfh().(&mut self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#0.).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(). {
92 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry) => entry,
93 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
94 };
95
96 let length = if entry.data_descriptorrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#data_descriptor. { u64::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]MAX. } else { entry.compressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compressed_size. };
97 let reader = ZipEntryReaderrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/ZipEntryReader#::new_with_ownedrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/impl#[`ZipEntryReader<'a, R, WithoutEntry>`]new_with_owned().(self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#0., entry.compressionrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression., length);
98
99 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#(Readingrust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#(reader, entry.data_descriptorrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#data_descriptor.))))
100 }
101
102 /// Opens the next entry for reading if the central directory hasn’t yet been reached.
103 pub async fn next_with_entryrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<R>>`]next_with_entry().(mut self) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<Readingrust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#<'a, R, WithEntryrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/WithEntry#<'a>>>>> {
104 let entry = match craterust-analyzer cargo async_zip 0.0.18 crate/::baserust-analyzer cargo async_zip 0.0.18 base/::readrust-analyzer cargo async_zip 0.0.18 base/read/::lfhrust-analyzer cargo async_zip 0.0.18 base/read/lfh().(&mut self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#0.).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(). {
105 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry) => entry,
106 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
107 };
108
109 let length = if entry.data_descriptorrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#data_descriptor. { u64::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]MAX. } else { entry.compressed_sizerust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compressed_size. };
110 let reader = ZipEntryReaderrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/ZipEntryReader#::new_with_ownedrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/impl#[`ZipEntryReader<'a, R, WithoutEntry>`]new_with_owned().(self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#0., entry.compressionrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#compression., length);
111 let data_descriptor = entry.data_descriptorrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#data_descriptor.;
112
113 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#(Readingrust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#(reader.into_with_entry_ownedrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/impl#[`ZipEntryReader<'a, R, WithoutEntry>`]into_with_entry_owned().(entry), data_descriptor))))
114 }
115
116 /// Consumes the `ZipFileReader` returning the original `reader`
117 pub async fn into_innerrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<R>>`]into_inner().(self) -> R {
118 self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#0.
119 }
120 }
121
122 #[cfg(feature = "tokio")]
123 impl<R> ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<TokioReadyrust-analyzer cargo async_zip 0.0.18 tokio/read/stream/Ready#<R>>
124 where
125 R: tokiorust-analyzer cargo tokio 1.25.0 crate/::iorust-analyzer cargo tokio 1.25.0 io/::AsyncBufReadrust-analyzer cargo tokio 1.25.0 io/async_buf_read/AsyncBufRead# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#,
126 {
127 /// Constructs a new tokio-specific ZIP reader from a non-seekable source.
128 pub fn with_tokiorust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<tokio_util::compat::Compat<R>>>`]with_tokio().(reader: R) -> ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<TokioReadyrust-analyzer cargo async_zip 0.0.18 tokio/read/stream/Ready#<R>> {
129 Selfrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Ready<tokio_util::compat::Compat<R>>>`](Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#(reader.compatrust-analyzer cargo tokio-util 0.7.4 compat/TokioAsyncReadCompatExt#compat().()))
130 }
131 }
132
133 impl<'a, R, E> ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<Readingrust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#<'a, R, E>>
134 where
135 R: AsyncBufReadrust-analyzer cargo futures-io 0.3.25 if_std/AsyncBufRead# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#,
136 {
137 /// Returns an immutable reference to the inner entry reader.
138 pub fn readerrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Reading<'a, R, E>>`]reader().(&self) -> &ZipEntryReaderrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/ZipEntryReader#<'a, R, E> {
139 &self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#0.
140 }
141
142 /// Returns a mutable reference to the inner entry reader.
143 pub fn reader_mutrust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Reading<'a, R, E>>`]reader_mut().(&mut self) -> &mut ZipEntryReaderrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/ZipEntryReader#<'a, R, E> {
144 &mut self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#0.
145 }
146
147 /// Converts the reader back into the Ready state if EOF has been reached.
148 pub async fn donerust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Reading<'a, R, E>>`]done().(mut self) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#<R>>> {
149 if self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#0..readrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#read().(&mut [0; 1]).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`ReadFuture<'_, R>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`ReadFuture<'_, R>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 {
150 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#::EOFNotReachedrust-analyzer cargo async_zip 0.0.18 error/ZipError#EOFNotReached#);
151 }
152
153 let mut inner = self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#0..into_innerrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/impl#[`ZipEntryReader<'a, R, E>`]into_inner().();
154
155 // Has data descriptor.
156 if self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .1rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#1. {
157 consume_data_descriptorrust-analyzer cargo async_zip 0.0.18 base/read/stream/consume_data_descriptor().(&mut inner).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().;
158 }
159
160 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#(Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#(inner)))
161 }
162
163 /// Reads until EOF and converts the reader back into the Ready state.
164 pub async fn skiprust-analyzer cargo async_zip 0.0.18 base/read/stream/impl#[`ZipFileReader<Reading<'a, R, E>>`]skip().(mut self) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#<Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#<R>>> {
165 while self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#0..readrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#read().(&mut [0; 2048]).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`ReadFuture<'_, R>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`ReadFuture<'_, R>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 {}
166 let mut inner = self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .0rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#0..into_innerrust-analyzer cargo async_zip 0.0.18 base/read/io/entry/impl#[`ZipEntryReader<'a, R, E>`]into_inner().();
167
168 // Has data descriptor.
169 if self.0rust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#0. .1rust-analyzer cargo async_zip 0.0.18 base/read/stream/Reading#1. {
170 consume_data_descriptorrust-analyzer cargo async_zip 0.0.18 base/read/stream/consume_data_descriptor().(&mut inner).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().;
171 }
172
173 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ZipFileReaderrust-analyzer cargo async_zip 0.0.18 base/read/stream/ZipFileReader#(Readyrust-analyzer cargo async_zip 0.0.18 base/read/stream/Ready#(inner)))
174 }
175 }
176
177 async fn consume_data_descriptorrust-analyzer cargo async_zip 0.0.18 base/read/stream/consume_data_descriptor().<R: AsyncBufReadrust-analyzer cargo futures-io 0.3.25 if_std/AsyncBufRead# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#>(reader: &mut R) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<()> {
178 let mut descriptor: [u8; DATA_DESCRIPTOR_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/DATA_DESCRIPTOR_LENGTH.] = [0; DATA_DESCRIPTOR_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/DATA_DESCRIPTOR_LENGTH.];
179 reader.read_exactrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#read_exact().(&mut descriptor).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().;
180
181 if descriptor[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#SIGNATURE_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/SIGNATURE_LENGTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().DATA_DESCRIPTOR_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/DATA_DESCRIPTOR_SIGNATURE..to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().() {
182 let mut tail: [u8; SIGNATURE_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/SIGNATURE_LENGTH.] = [0; SIGNATURE_LENGTHrust-analyzer cargo async_zip 0.0.18 spec/consts/SIGNATURE_LENGTH.];
183 reader.read_exactrust-analyzer cargo futures-lite 2.1.0 io/AsyncReadExt#read_exact().(&mut tail).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().;
184 }
185
186 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
187 }