| 1 | // Copyright (c) 2022 Harry [Majored] [[email protected]] |
| 2 | // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE) |
| 3 | |
| 4 | use craterust-analyzer cargo async_zip 0.0.18 crate/::{filerust-analyzer cargo async_zip 0.0.18 file/::ZipFilerust-analyzer cargo async_zip 0.0.18 file/ZipFile#, stringrust-analyzer cargo async_zip 0.0.18 string/::ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString#}; |
| 5 | |
| 6 | /// A builder for [`ZipFile`]. |
| 7 | pub struct ZipFileBuilderrust-analyzer cargo async_zip 0.0.18 file/builder/ZipFileBuilder#(pub(craterust-analyzer cargo async_zip 0.0.18 crate/) ZipFilerust-analyzer cargo async_zip 0.0.18 file/ZipFile#); |
| 8 | |
| 9 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<ZipFilerust-analyzer cargo async_zip 0.0.18 file/ZipFile#> for ZipFileBuilderrust-analyzer cargo async_zip 0.0.18 file/builder/ZipFileBuilder# { |
| 10 | fn fromrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder][`From<ZipFile>`]from().(file: ZipFilerust-analyzer cargo async_zip 0.0.18 file/ZipFile#) -> Selfrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder][`From<ZipFile>`] { |
| 11 | Selfrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder][`From<ZipFile>`](file) |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for ZipFileBuilderrust-analyzer cargo async_zip 0.0.18 file/builder/ZipFileBuilder# { |
| 16 | fn defaultrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder][Default]default().() -> Selfrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder][Default] { |
| 17 | ZipFileBuilderrust-analyzer cargo async_zip 0.0.18 file/builder/ZipFileBuilder#(ZipFilerust-analyzer cargo async_zip 0.0.18 file/ZipFile# { entriesrust-analyzer cargo async_zip 0.0.18 file/ZipFile#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().(), zip64rust-analyzer cargo async_zip 0.0.18 file/ZipFile#zip64.: false, commentrust-analyzer cargo async_zip 0.0.18 file/ZipFile#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().() }) |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | impl ZipFileBuilderrust-analyzer cargo async_zip 0.0.18 file/builder/ZipFileBuilder# { |
| 22 | pub fn newrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder]new().() -> Selfrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder] { |
| 23 | Selfrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder]::defaultrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder][Default]default().() |
| 24 | } |
| 25 | |
| 26 | /// Sets the file's comment. |
| 27 | pub fn commentrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder]comment().(mut self, comment: ZipStringrust-analyzer cargo async_zip 0.0.18 string/ZipString#) -> Selfrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder] { |
| 28 | self.0rust-analyzer cargo async_zip 0.0.18 file/builder/ZipFileBuilder#0..commentrust-analyzer cargo async_zip 0.0.18 file/ZipFile#comment. = comment; |
| 29 | self |
| 30 | } |
| 31 | |
| 32 | /// Consumes this builder and returns a final [`ZipFile`]. |
| 33 | /// |
| 34 | /// This is equivalent to: |
| 35 | /// ``` |
| 36 | /// # use async_zip::{ZipFile, ZipFileBuilder}; |
| 37 | /// # |
| 38 | /// # let builder = ZipFileBuilder::new(); |
| 39 | /// let file: ZipFile = builder.into(); |
| 40 | /// ``` |
| 41 | pub fn buildrust-analyzer cargo async_zip 0.0.18 file/builder/impl#[ZipFileBuilder]build().(self) -> ZipFilerust-analyzer cargo async_zip 0.0.18 file/ZipFile# { |
| 42 | self.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 43 | } |
| 44 | } |