| 1 | // Copyright (c) 2021-2022 Harry [Majored] [[email protected]] |
| 2 | // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE) |
| 3 | |
| 4 | //! A module which supports writing ZIP files. |
| 5 | //! |
| 6 | //! # Example |
| 7 | //! ### Whole data (u8 slice) |
| 8 | //! ```no_run |
| 9 | //! # #[cfg(feature = "deflate")] |
| 10 | //! # { |
| 11 | //! # use async_zip::{Compression, ZipEntryBuilder, base::write::ZipFileWriter}; |
| 12 | //! # use async_zip::error::ZipError; |
| 13 | //! # |
| 14 | //! # async fn run() -> Result<(), ZipError> { |
| 15 | //! let mut writer = ZipFileWriter::new(Vec::<u8>::new()); |
| 16 | //! |
| 17 | //! let data = b"This is an example file."; |
| 18 | //! let opts = ZipEntryBuilder::new(String::from("foo.txt").into(), Compression::Deflate); |
| 19 | //! |
| 20 | //! writer.write_entry_whole(opts, data).await?; |
| 21 | //! writer.close().await?; |
| 22 | //! # Ok(()) |
| 23 | //! # } |
| 24 | //! # } |
| 25 | //! ``` |
| 26 | //! ### Stream data (unknown size & data) |
| 27 | //! ```no_run |
| 28 | //! # #[cfg(feature = "deflate")] |
| 29 | //! # { |
| 30 | //! # use async_zip::{Compression, ZipEntryBuilder, base::write::ZipFileWriter}; |
| 31 | //! # use std::io::Cursor; |
| 32 | //! # use async_zip::error::ZipError; |
| 33 | //! # use futures_lite::io::AsyncWriteExt; |
| 34 | //! # use tokio_util::compat::TokioAsyncWriteCompatExt; |
| 35 | //! # |
| 36 | //! # async fn run() -> Result<(), ZipError> { |
| 37 | //! let mut writer = ZipFileWriter::new(Vec::<u8>::new()); |
| 38 | //! |
| 39 | //! let data = b"This is an example file."; |
| 40 | //! let opts = ZipEntryBuilder::new(String::from("bar.txt").into(), Compression::Deflate); |
| 41 | //! |
| 42 | //! let mut entry_writer = writer.write_entry_stream(opts).await?; |
| 43 | //! entry_writer.write_all(data).await.unwrap(); |
| 44 | //! |
| 45 | //! entry_writer.close().await?; |
| 46 | //! writer.close().await?; |
| 47 | //! # Ok(()) |
| 48 | //! # } |
| 49 | //! # } |
| 50 | //! ``` |
| 51 | |
| 52 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) mod compressed_writerrust-analyzer cargo async_zip 0.0.18 base/write/compressed_writer/; |
| 53 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) mod entry_streamrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/; |
| 54 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) mod entry_wholerust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/; |
| 55 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) mod iorust-analyzer cargo async_zip 0.0.18 base/write/io/; |
| 56 | |
| 57 | #[cfg(any( |
| 58 | feature = "deflate", |
| 59 | feature = "bzip2", |
| 60 | feature = "zstd", |
| 61 | feature = "lzma", |
| 62 | feature = "xz", |
| 63 | feature = "deflate64" |
| 64 | ))] |
| 65 | pub use entry_wholerust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/::compressrust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/compress().; |
| 66 | |
| 67 | pub use entry_streamrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/::EntryStreamWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/EntryStreamWriter#; |
| 68 | pub use entry_wholerust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/::crc32rust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/crc32().; |
| 69 | |
| 70 | #[cfg(feature = "tokio")] |
| 71 | use tokio_utilrust-analyzer cargo tokio-util 0.7.4 crate/::compatrust-analyzer cargo tokio-util 0.7.4 compat/::{Compatrust-analyzer cargo tokio-util 0.7.4 compat/Compat#, TokioAsyncWriteCompatExtrust-analyzer cargo tokio-util 0.7.4 compat/TokioAsyncWriteCompatExt#}; |
| 72 | |
| 73 | use craterust-analyzer cargo async_zip 0.0.18 crate/::entryrust-analyzer cargo async_zip 0.0.18 entry/::ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#; |
| 74 | 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#; |
| 75 | use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::extra_fieldrust-analyzer cargo async_zip 0.0.18 spec/extra_field/::ExtraFieldAsBytesrust-analyzer cargo async_zip 0.0.18 spec/extra_field/ExtraFieldAsBytes#; |
| 76 | use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::headerrust-analyzer cargo async_zip 0.0.18 spec/header/::{ |
| 77 | CentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 spec/header/CentralDirectoryRecord#, EndOfCentralDirectoryHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#, ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#, InfoZipUnicodeCommentExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodeCommentExtraField#, |
| 78 | InfoZipUnicodePathExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodePathExtraField#, Zip64EndOfCentralDirectoryLocatorrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryLocator#, Zip64EndOfCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#, |
| 79 | }; |
| 80 | |
| 81 | #[cfg(feature = "tokio")] |
| 82 | use craterust-analyzer cargo async_zip 0.0.18 crate/::tokiorust-analyzer cargo async_zip 0.0.18 tokio/::writerust-analyzer cargo async_zip 0.0.18 tokio/write/::ZipFileWriterrust-analyzer cargo async_zip 0.0.18 tokio/write/ZipFileWriter# as TokioZipFileWriterrust-analyzer cargo async_zip 0.0.18 tokio/write/ZipFileWriter#; |
| 83 | |
| 84 | use entry_wholerust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/::EntryWholeWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/EntryWholeWriter#; |
| 85 | use iorust-analyzer cargo async_zip 0.0.18 base/write/io/::offsetrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/::AsyncOffsetWriterrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/AsyncOffsetWriter#; |
| 86 | |
| 87 | 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/::{NON_ZIP64_MAX_NUM_FILESrust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_NUM_FILES., NON_ZIP64_MAX_SIZErust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_SIZE.}; |
| 88 | use futures_literust-analyzer cargo futures-lite 2.1.0 crate/::iorust-analyzer cargo futures-lite 2.1.0 io/::{AsyncWriterust-analyzer cargo futures-io 0.3.25 if_std/AsyncWrite#, AsyncWriteExtrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#}; |
| 89 | |
| 90 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) struct CentralDirectoryEntryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry# { |
| 91 | pub headerrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#header.: CentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 spec/header/CentralDirectoryRecord#, |
| 92 | pub entryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#entry.: ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#, |
| 93 | } |
| 94 | |
| 95 | /// A ZIP file writer which acts over AsyncWrite implementers. |
| 96 | /// |
| 97 | /// # Note |
| 98 | /// - [`ZipFileWriter::close()`] must be called before a stream writer goes out of scope. |
| 99 | pub struct ZipFileWriterrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#<W> { |
| 100 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer.: AsyncOffsetWriterrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/AsyncOffsetWriter#<W>, |
| 101 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) cd_entriesrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#cd_entries.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<CentralDirectoryEntryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#>, |
| 102 | /// If true, will error if a Zip64 struct must be written. |
| 103 | force_no_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#force_no_zip64.: bool, |
| 104 | /// Whether to write Zip64 end of directory structs. |
| 105 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) is_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#is_zip64.: bool, |
| 106 | comment_optrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#comment_opt.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 107 | } |
| 108 | |
| 109 | impl<W: AsyncWriterust-analyzer cargo futures-io 0.3.25 if_std/AsyncWrite# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#> ZipFileWriterrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#<W> { |
| 110 | /// Construct a new ZIP file writer from a mutable reference to a writer. |
| 111 | pub fn newrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]new().(writer: W) -> Selfrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`] { |
| 112 | Selfrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`] { |
| 113 | writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer.: AsyncOffsetWriterrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/AsyncOffsetWriter#::newrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]new().(writer), |
| 114 | cd_entriesrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#cd_entries.: 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().(), |
| 115 | comment_optrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#comment_opt.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 116 | is_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#is_zip64.: false, |
| 117 | force_no_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#force_no_zip64.: false, |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /// Force the ZIP writer to operate in non-ZIP64 mode. |
| 122 | /// If any files would need ZIP64, an error will be raised. |
| 123 | pub fn force_no_zip64rust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]force_no_zip64().(mut self) -> Selfrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`] { |
| 124 | self.force_no_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#force_no_zip64. = true; |
| 125 | self |
| 126 | } |
| 127 | |
| 128 | /// Force the ZIP writer to emit Zip64 structs at the end of the archive. |
| 129 | /// Zip64 extended fields will only be written if needed. |
| 130 | pub fn force_zip64rust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]force_zip64().(mut self) -> Selfrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`] { |
| 131 | self.is_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#is_zip64. = true; |
| 132 | self |
| 133 | } |
| 134 | |
| 135 | /// Write a new ZIP entry of known size and data. |
| 136 | pub async fn write_entry_wholerust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]write_entry_whole().<E: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#>>(&mut self, entry: E, data: &[u8]) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<()> { |
| 137 | EntryWholeWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/EntryWholeWriter#::from_rawrust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/impl#[`EntryWholeWriter<'b, 'c, W>`]from_raw().(self, entry.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), data).writerust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/impl#[`EntryWholeWriter<'b, 'c, W>`]write().().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(). |
| 138 | } |
| 139 | |
| 140 | /// Write a new ZIP entry of known size and data, with the data already being compressed. |
| 141 | /// |
| 142 | /// The provided entry's compression method, CRC, and uncompressed size must be set. Use with `base::write::compress` |
| 143 | /// and `base::write::crc32` to precompress. |
| 144 | pub async fn write_entry_whole_precompressedrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]write_entry_whole_precompressed().<E: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#>>(&mut self, entry: E, data: &[u8]) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<()> { |
| 145 | EntryWholeWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/EntryWholeWriter#::from_precompressedrust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/impl#[`EntryWholeWriter<'b, 'c, W>`]from_precompressed().(self, entry.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), data).writerust-analyzer cargo async_zip 0.0.18 base/write/entry_whole/impl#[`EntryWholeWriter<'b, 'c, W>`]write().().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(). |
| 146 | } |
| 147 | |
| 148 | /// Write an entry of unknown size and data via streaming (ie. using a data descriptor). |
| 149 | /// The generated Local File Header will be invalid, with no compressed size, uncompressed size, |
| 150 | /// and a null CRC. This might cause problems with the destination reader. |
| 151 | pub async fn write_entry_streamrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]write_entry_stream().<E: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#>>(&mut self, entry: E) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<EntryStreamWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/EntryStreamWriter#<'_, W>> { |
| 152 | EntryStreamWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/EntryStreamWriter#::from_rawrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/impl#[`EntryStreamWriter<'b, W>`]from_raw().(self, entry.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()).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(). |
| 153 | } |
| 154 | |
| 155 | /// Write an entry of unknown size and data via streaming (ie. using a data descriptor), with the data already being compressed. |
| 156 | /// |
| 157 | /// The provided entry's compression method, CRC, and uncompressed size must be set. Use with `base::write::compress` |
| 158 | /// and `base::write::crc32` to precompress. |
| 159 | /// |
| 160 | /// The generated Local File Header will be invalid, with no compressed size, uncompressed size, |
| 161 | /// and a null CRC. This might cause problems with the destination reader. |
| 162 | pub async fn write_entry_stream_precompressedrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]write_entry_stream_precompressed().<E: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ZipEntryrust-analyzer cargo async_zip 0.0.18 entry/ZipEntry#>>( |
| 163 | &mut self, |
| 164 | entry: E, |
| 165 | ) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<EntryStreamWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/EntryStreamWriter#<'_, W>> { |
| 166 | EntryStreamWriterrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/EntryStreamWriter#::from_raw_precompressedrust-analyzer cargo async_zip 0.0.18 base/write/entry_stream/impl#[`EntryStreamWriter<'b, W>`]from_raw_precompressed().(self, entry.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()).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(). |
| 167 | } |
| 168 | |
| 169 | /// Set the ZIP file comment. |
| 170 | pub fn commentrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]comment().(&mut self, comment: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 171 | self.comment_optrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#comment_opt. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(comment); |
| 172 | } |
| 173 | |
| 174 | /// Returns a mutable reference to the inner writer. |
| 175 | /// |
| 176 | /// Care should be taken when using this inner writer as doing so may invalidate internal state of this writer. |
| 177 | pub fn inner_mutrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]inner_mut().(&mut self) -> &mut W { |
| 178 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..inner_mutrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]inner_mut().() |
| 179 | } |
| 180 | |
| 181 | /// Consumes this ZIP writer and completes all closing tasks. |
| 182 | /// |
| 183 | /// This includes: |
| 184 | /// - Writing all central directory headers. |
| 185 | /// - Writing the end of central directory header. |
| 186 | /// - Writing the file comment. |
| 187 | /// |
| 188 | /// Failure to call this function before going out of scope would result in a corrupted ZIP file. |
| 189 | pub async fn closerust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<W>`]close().(mut self) -> Resultrust-analyzer cargo async_zip 0.0.18 error/Result#<W> { |
| 190 | let cd_offset = self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..offsetrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]offset().(); |
| 191 | |
| 192 | for entry in &self.cd_entriesrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#cd_entries. { |
| 193 | let filename_basic = |
| 194 | entry.entryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#entry..filenamerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]filename().().alternativerust-analyzer cargo async_zip 0.0.18 string/impl#[ZipString]alternative().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| entry.entryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#entry..filenamerust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]filename().().as_bytesrust-analyzer cargo async_zip 0.0.18 string/impl#[ZipString]as_bytes().()); |
| 195 | let comment_basic = entry.entryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#entry..commentrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]comment().().alternativerust-analyzer cargo async_zip 0.0.18 string/impl#[ZipString]alternative().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| entry.entryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#entry..commentrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]comment().().as_bytesrust-analyzer cargo async_zip 0.0.18 string/impl#[ZipString]as_bytes().()); |
| 196 | |
| 197 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&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/::CDH_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/CDH_SIGNATURE..to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 198 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&entry.headerrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#header..as_slicerust-analyzer cargo async_zip 0.0.18 spec/parse/impl#[CentralDirectoryRecord]as_slice().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 199 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(filename_basic).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 200 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&entry.entryrust-analyzer cargo async_zip 0.0.18 base/write/CentralDirectoryEntry#entry..extra_fieldsrust-analyzer cargo async_zip 0.0.18 entry/impl#[ZipEntry]extra_fields().().as_bytesrust-analyzer cargo async_zip 0.0.18 spec/extra_field/impl#[`&[ExtraField]`][ExtraFieldAsBytes]as_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 201 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(comment_basic).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 202 | } |
| 203 | |
| 204 | let central_directory_size = self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..offsetrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]offset().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().cd_offset; |
| 205 | let central_directory_size_u32 = if central_directory_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().NON_ZIP64_MAX_SIZErust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_SIZE. as u64 { |
| 206 | NON_ZIP64_MAX_SIZErust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_SIZE. |
| 207 | } else { |
| 208 | central_directory_size as u32 |
| 209 | }; |
| 210 | let num_entries_in_directory = self.cd_entriesrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#cd_entries..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as u64; |
| 211 | let num_entries_in_directory_u16 = if num_entries_in_directory rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().NON_ZIP64_MAX_NUM_FILESrust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_NUM_FILES. as u64 { |
| 212 | NON_ZIP64_MAX_NUM_FILESrust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_NUM_FILES. |
| 213 | } else { |
| 214 | num_entries_in_directory as u16 |
| 215 | }; |
| 216 | let cd_offset_u32 = if cd_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().NON_ZIP64_MAX_SIZErust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_SIZE. as u64 { |
| 217 | if self.force_no_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#force_no_zip64. { |
| 218 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(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#::Zip64Neededrust-analyzer cargo async_zip 0.0.18 error/ZipError#Zip64Needed#(craterust-analyzer cargo async_zip 0.0.18 crate/::errorrust-analyzer cargo async_zip 0.0.18 error/::Zip64ErrorCaserust-analyzer cargo async_zip 0.0.18 error/Zip64ErrorCase#::LargeFilerust-analyzer cargo async_zip 0.0.18 error/Zip64ErrorCase#LargeFile#)); |
| 219 | } else { |
| 220 | self.is_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#is_zip64. = true; |
| 221 | } |
| 222 | NON_ZIP64_MAX_SIZErust-analyzer cargo async_zip 0.0.18 spec/consts/NON_ZIP64_MAX_SIZE. |
| 223 | } else { |
| 224 | cd_offset as u32 |
| 225 | }; |
| 226 | |
| 227 | // Add the zip64 EOCDR and EOCDL if we are in zip64 mode. |
| 228 | if self.is_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#is_zip64. { |
| 229 | let eocdr_offset = self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..offsetrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]offset().(); |
| 230 | |
| 231 | let eocdr = Zip64EndOfCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord# { |
| 232 | size_of_zip64_end_of_cd_recordrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#size_of_zip64_end_of_cd_record.: 44, |
| 233 | version_made_byrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#version_made_by.: craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::versionrust-analyzer cargo async_zip 0.0.18 spec/version/::as_made_byrust-analyzer cargo async_zip 0.0.18 spec/version/as_made_by().(), |
| 234 | version_needed_to_extractrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#version_needed_to_extract.: 46, |
| 235 | disk_numberrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#disk_number.: 0, |
| 236 | disk_number_start_of_cdrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#disk_number_start_of_cd.: 0, |
| 237 | num_entries_in_directory_on_diskrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#num_entries_in_directory_on_disk.: num_entries_in_directory, |
| 238 | num_entries_in_directoryrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#num_entries_in_directory., |
| 239 | directory_sizerust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#directory_size.: central_directory_size, |
| 240 | offset_of_start_of_directoryrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#offset_of_start_of_directory.: cd_offset, |
| 241 | }; |
| 242 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&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/::ZIP64_EOCDR_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/ZIP64_EOCDR_SIGNATURE..to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 243 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&eocdr.as_bytesrust-analyzer cargo async_zip 0.0.18 spec/parse/impl#[Zip64EndOfCentralDirectoryRecord]as_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 244 | |
| 245 | let eocdl = Zip64EndOfCentralDirectoryLocatorrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryLocator# { |
| 246 | number_of_disk_with_start_of_zip64_end_of_central_directoryrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryLocator#number_of_disk_with_start_of_zip64_end_of_central_directory.: 0, |
| 247 | relative_offsetrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryLocator#relative_offset.: eocdr_offset, |
| 248 | total_number_of_disksrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryLocator#total_number_of_disks.: 1, |
| 249 | }; |
| 250 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&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/::ZIP64_EOCDL_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/ZIP64_EOCDL_SIGNATURE..to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 251 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&eocdl.as_bytesrust-analyzer cargo async_zip 0.0.18 spec/parse/impl#[Zip64EndOfCentralDirectoryLocator]as_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 252 | } |
| 253 | |
| 254 | let header = EndOfCentralDirectoryHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader# { |
| 255 | disk_numrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#disk_num.: 0, |
| 256 | start_cent_dir_diskrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#start_cent_dir_disk.: 0, |
| 257 | num_of_entries_diskrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#num_of_entries_disk.: num_entries_in_directory_u16, |
| 258 | num_of_entriesrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#num_of_entries.: num_entries_in_directory_u16, |
| 259 | size_cent_dirrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#size_cent_dir.: central_directory_size_u32, |
| 260 | cent_dir_offsetrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#cent_dir_offset.: cd_offset_u32, |
| 261 | file_comm_lengthrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#file_comm_length.: self.comment_optrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#comment_opt..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|v| v.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() as u16).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(), |
| 262 | }; |
| 263 | |
| 264 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&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/::EOCDR_SIGNATURErust-analyzer cargo async_zip 0.0.18 spec/consts/EOCDR_SIGNATURE..to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 265 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(&header.as_slicerust-analyzer cargo async_zip 0.0.18 spec/parse/impl#[EndOfCentralDirectoryHeader]as_slice().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 266 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(comment) = self.comment_optrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#comment_opt. { |
| 267 | self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..write_allrust-analyzer cargo futures-lite 2.1.0 io/AsyncWriteExt#write_all().(comment.as_bytesrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_bytes().()).rust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().awaitrust-analyzer cargo futures-lite 2.1.0 io/impl#[`WriteAllFuture<'_, W>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 268 | } |
| 269 | |
| 270 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer..into_innerrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]into_inner().()) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | #[cfg(feature = "tokio")] |
| 275 | impl<W> ZipFileWriterrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#<Compatrust-analyzer cargo tokio-util 0.7.4 compat/Compat#<W>> |
| 276 | where |
| 277 | W: tokiorust-analyzer cargo tokio 1.25.0 crate/::iorust-analyzer cargo tokio 1.25.0 io/::AsyncWriterust-analyzer cargo tokio 1.25.0 io/async_write/AsyncWrite# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#, |
| 278 | { |
| 279 | /// Construct a new ZIP file writer from a mutable reference to a writer. |
| 280 | pub fn with_tokiorust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<Compat<W>>`]with_tokio().(writer: W) -> TokioZipFileWriterrust-analyzer cargo async_zip 0.0.18 tokio/write/ZipFileWriter#<W> { |
| 281 | Selfrust-analyzer cargo async_zip 0.0.18 base/write/impl#[`ZipFileWriter<Compat<W>>`] { |
| 282 | writerrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#writer.: AsyncOffsetWriterrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/AsyncOffsetWriter#::newrust-analyzer cargo async_zip 0.0.18 base/write/io/offset/impl#[`AsyncOffsetWriter<W>`]new().(writer.compat_writerust-analyzer cargo tokio-util 0.7.4 compat/TokioAsyncWriteCompatExt#compat_write().()), |
| 283 | cd_entriesrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#cd_entries.: 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().(), |
| 284 | comment_optrust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#comment_opt.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 285 | is_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#is_zip64.: false, |
| 286 | force_no_zip64rust-analyzer cargo async_zip 0.0.18 base/write/ZipFileWriter#force_no_zip64.: false, |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) fn get_or_put_info_zip_unicode_path_extra_field_mutrust-analyzer cargo async_zip 0.0.18 base/write/get_or_put_info_zip_unicode_path_extra_field_mut().( |
| 292 | extra_fields: &mut 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#>, |
| 293 | ) -> &mut InfoZipUnicodePathExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodePathExtraField# { |
| 294 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().extra_fields.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|field| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(field, ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#::InfoZipUnicodePathrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#InfoZipUnicodePath#(_))) { |
| 295 | extra_fields |
| 296 | .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#::InfoZipUnicodePathrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#InfoZipUnicodePath#(InfoZipUnicodePathExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodePathExtraField#::V1rust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodePathExtraField#V1# { crc32rust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodePathExtraField#V1#crc32.: 0, unicoderust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodePathExtraField#V1#unicode.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![] })); |
| 297 | } |
| 298 | |
| 299 | for field in extra_fields.iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().() { |
| 300 | if let ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#::InfoZipUnicodePathrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#InfoZipUnicodePath#(extra_field) = field { |
| 301 | return extra_field; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("InfoZipUnicodePathExtraField not found after insertion") |
| 306 | } |
| 307 | |
| 308 | pub(craterust-analyzer cargo async_zip 0.0.18 crate/) fn get_or_put_info_zip_unicode_comment_extra_field_mutrust-analyzer cargo async_zip 0.0.18 base/write/get_or_put_info_zip_unicode_comment_extra_field_mut().( |
| 309 | extra_fields: &mut 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#>, |
| 310 | ) -> &mut InfoZipUnicodeCommentExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodeCommentExtraField# { |
| 311 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().extra_fields.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|field| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(field, ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#::InfoZipUnicodeCommentrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#InfoZipUnicodeComment#(_))) { |
| 312 | extra_fields |
| 313 | .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#::InfoZipUnicodeCommentrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#InfoZipUnicodeComment#(InfoZipUnicodeCommentExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodeCommentExtraField#::V1rust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodeCommentExtraField#V1# { crc32rust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodeCommentExtraField#V1#crc32.: 0, unicoderust-analyzer cargo async_zip 0.0.18 spec/header/InfoZipUnicodeCommentExtraField#V1#unicode.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![] })); |
| 314 | } |
| 315 | |
| 316 | for field in extra_fields.iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().() { |
| 317 | if let ExtraFieldrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#::InfoZipUnicodeCommentrust-analyzer cargo async_zip 0.0.18 spec/header/ExtraField#InfoZipUnicodeComment#(extra_field) = field { |
| 318 | return extra_field; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("InfoZipUnicodeCommentExtraField not found after insertion") |
| 323 | } |