Debian Codegraph @

src/date/builder.rs

raw symbols SCIP
1 // Copyright (c) 2024 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/::ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#;
5
6 /// A builder for [`ZipDateTime`].
7 pub struct ZipDateTimeBuilderrust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#(pub(craterust-analyzer cargo async_zip 0.0.18 crate/) ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#);
8
9 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#> for ZipDateTimeBuilderrust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder# {
10 fn fromrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder][`From<ZipDateTime>`]from().(date: ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder][`From<ZipDateTime>`] {
11 Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder][`From<ZipDateTime>`](date)
12 }
13 }
14
15 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for ZipDateTimeBuilderrust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder# {
16 fn defaultrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder][Default]default().() -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder][Default] {
17 Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder][Default]::newrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]new().()
18 }
19 }
20
21 impl ZipDateTimeBuilderrust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder# {
22 /// Constructs a new builder which defines the raw underlying data of a ZIP entry.
23 pub fn newrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]new().() -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
24 Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder](ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime# { daterust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#date.: 0, timerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#time.: 0 })
25 }
26
27 /// Sets the date and time's year.
28 pub fn yearrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]year().(mut self, year: i32) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
29 let year: u16 = (((year rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1980) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl().9) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`BitAnd<Self>`]bitand().0xFE00).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
30 self.0rust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#0..daterust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#date. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().year;
31 self
32 }
33
34 /// Sets the date and time's month.
35 pub fn monthrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]month().(mut self, month: u32) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
36 let month: u16 = ((month rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().5) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x1E0).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
37 self.0rust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#0..daterust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#date. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().month;
38 self
39 }
40
41 /// Sets the date and time's day.
42 pub fn dayrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]day().(mut self, day: u32) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
43 let day: u16 = (day rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x1F).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
44 self.0rust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#0..daterust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#date. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().day;
45 self
46 }
47
48 /// Sets the date and time's hour.
49 pub fn hourrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]hour().(mut self, hour: u32) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
50 let hour: u16 = ((hour rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().11) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0xF800).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
51 self.0rust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#0..timerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#time. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().hour;
52 self
53 }
54
55 /// Sets the date and time's minute.
56 pub fn minuterust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]minute().(mut self, minute: u32) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
57 let minute: u16 = ((minute rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().5) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x7E0).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
58 self.0rust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#0..timerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#time. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().minute;
59 self
60 }
61
62 /// Sets the date and time's second.
63 ///
64 /// Note that MS-DOS has a maximum granularity of two seconds.
65 pub fn secondrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]second().(mut self, second: u32) -> Selfrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder] {
66 let second: u16 = ((second 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().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x1F).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
67 self.0rust-analyzer cargo async_zip 0.0.18 date/builder/ZipDateTimeBuilder#0..timerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime#time. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().second;
68 self
69 }
70
71 /// Consumes this builder and returns a final [`ZipDateTime`].
72 ///
73 /// This is equivalent to:
74 /// ```
75 /// # use async_zip::{ZipDateTime, ZipDateTimeBuilder, Compression};
76 /// #
77 /// # let builder = ZipDateTimeBuilder::new().year(2024).month(3).day(2);
78 /// let date: ZipDateTime = builder.into();
79 /// ```
80 pub fn buildrust-analyzer cargo async_zip 0.0.18 date/builder/impl#[ZipDateTimeBuilder]build().(self) -> ZipDateTimerust-analyzer cargo async_zip 0.0.18 date/ZipDateTime# {
81 self.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
82 }
83 }