Debian Codegraph @

src/chrono_04.rs

raw symbols SCIP
1 use bytesrust-analyzer cargo bytes 1.11.1 crate/::BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#;
2 use chrono_04rust-analyzer cargo chrono 0.4.45 crate/::{
3 DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#, Durationrust-analyzer cargo chrono 0.4.45 Duration#, FixedOffsetrust-analyzer cargo chrono 0.4.45 offset/fixed/FixedOffset#, Localrust-analyzer cargo chrono 0.4.45 offset/local/Local#, NaiveDaterust-analyzer cargo chrono 0.4.45 naive/date/NaiveDate#, NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime#, NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime#, TimeZonerust-analyzer cargo chrono 0.4.45 offset/TimeZone#, Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#,
4 };
5 use postgres_protocolrust-analyzer cargo postgres-protocol 0.6.12 crate/::typesrust-analyzer cargo postgres-protocol 0.6.12 types/;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
7
8 use craterust-analyzer cargo postgres-types 0.2.14 crate/::{FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#, IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql#, Typerust-analyzer cargo postgres-types 0.2.14 Type#};
9
10 fn baserust-analyzer cargo postgres-types 0.2.14 chrono_04/base().() -> NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime# {
11 NaiveDaterust-analyzer cargo chrono 0.4.45 naive/date/NaiveDate#::from_ymd_optrust-analyzer cargo chrono 0.4.45 naive/date/impl#[NaiveDate]from_ymd_opt().(2000, 1, 1)
12 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
13 .and_hms_optrust-analyzer cargo chrono 0.4.45 naive/date/impl#[NaiveDate]and_hms_opt().(0, 0, 0)
14 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
15 }
16
17 impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime# {
18 fn from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveDateTime][`FromSql<'a>`]from_sql().(_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
19 let t = typesrust-analyzer cargo postgres-protocol 0.6.12 types/::timestamp_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/timestamp_from_sql().(raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
20 baserust-analyzer cargo postgres-types 0.2.14 chrono_04/base().()
21 .checked_add_signedrust-analyzer cargo chrono 0.4.45 naive/datetime/impl#[NaiveDateTime]checked_add_signed().(Durationrust-analyzer cargo chrono 0.4.45 Duration#::microsecondsrust-analyzer cargo chrono 0.4.45 time_delta/impl#[TimeDelta]microseconds().(t))
22 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| "value too large to decode".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
23 }
24
25 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMP.);
26 }
27
28 impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime# {
29 fn to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveDateTime][ToSql]to_sql().(&self, _: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, w: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
30 let time = match self.signed_duration_sincerust-analyzer cargo chrono 0.4.45 naive/datetime/impl#[NaiveDateTime]signed_duration_since().(baserust-analyzer cargo postgres-types 0.2.14 chrono_04/base().()).num_microsecondsrust-analyzer cargo chrono 0.4.45 time_delta/impl#[TimeDelta]num_microseconds().() {
31 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(time) => time,
32 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#("value too large to transmit".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
33 };
34 typesrust-analyzer cargo postgres-protocol 0.6.12 types/::timestamp_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/timestamp_to_sql().(time, w);
35 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#::Norust-analyzer cargo postgres-types 0.2.14 IsNull#No#)
36 }
37
38 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMP.);
39 to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!();
40 }
41
42 impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#> {
43 fn from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Utc>`][`FromSql<'a>`]from_sql().(type_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#>, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
44 let naive = NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime#::from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveDateTime][`FromSql<'a>`]from_sql().(type_, raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
45 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#.from_utc_datetimerust-analyzer cargo chrono 0.4.45 offset/TimeZone#from_utc_datetime().(&naive))
46 }
47
48 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPTZrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMPTZ.);
49 }
50
51 impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#> {
52 fn to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Utc>`][ToSql]to_sql().(
53 &self,
54 type_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#,
55 w: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#,
56 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
57 self.naive_utcrust-analyzer cargo chrono 0.4.45 datetime/impl#[`DateTime<Tz>`]naive_utc().().to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveDateTime][ToSql]to_sql().(type_, w)
58 }
59
60 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPTZrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMPTZ.);
61 to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!();
62 }
63
64 impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Localrust-analyzer cargo chrono 0.4.45 offset/local/Local#> {
65 fn from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Local>`][`FromSql<'a>`]from_sql().(type_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Localrust-analyzer cargo chrono 0.4.45 offset/local/Local#>, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
66 let utc = DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#::<Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#>::from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Utc>`][`FromSql<'a>`]from_sql().(type_, raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
67 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(utc.with_timezonerust-analyzer cargo chrono 0.4.45 datetime/impl#[`DateTime<Tz>`]with_timezone().(&Localrust-analyzer cargo chrono 0.4.45 offset/local/Local#))
68 }
69
70 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPTZrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMPTZ.);
71 }
72
73 impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Localrust-analyzer cargo chrono 0.4.45 offset/local/Local#> {
74 fn to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Local>`][ToSql]to_sql().(
75 &self,
76 type_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#,
77 w: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#,
78 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
79 self.with_timezonerust-analyzer cargo chrono 0.4.45 datetime/impl#[`DateTime<Tz>`]with_timezone().(&Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#).to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Utc>`][ToSql]to_sql().(type_, w)
80 }
81
82 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPTZrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMPTZ.);
83 to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!();
84 }
85
86 impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<FixedOffsetrust-analyzer cargo chrono 0.4.45 offset/fixed/FixedOffset#> {
87 fn from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<FixedOffset>`][`FromSql<'a>`]from_sql().(
88 type_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#,
89 raw: &[u8],
90 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<FixedOffsetrust-analyzer cargo chrono 0.4.45 offset/fixed/FixedOffset#>, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
91 let utc = DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#::<Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#>::from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Utc>`][`FromSql<'a>`]from_sql().(type_, raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
92 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(utc.with_timezonerust-analyzer cargo chrono 0.4.45 datetime/impl#[`DateTime<Tz>`]with_timezone().(&FixedOffsetrust-analyzer cargo chrono 0.4.45 offset/fixed/FixedOffset#::east_optrust-analyzer cargo chrono 0.4.45 offset/fixed/impl#[FixedOffset]east_opt().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()))
93 }
94
95 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPTZrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMPTZ.);
96 }
97
98 impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<FixedOffsetrust-analyzer cargo chrono 0.4.45 offset/fixed/FixedOffset#> {
99 fn to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<FixedOffset>`][ToSql]to_sql().(
100 &self,
101 type_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#,
102 w: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#,
103 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
104 self.with_timezonerust-analyzer cargo chrono 0.4.45 datetime/impl#[`DateTime<Tz>`]with_timezone().(&Utcrust-analyzer cargo chrono 0.4.45 offset/utc/Utc#).to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[`DateTime<Utc>`][ToSql]to_sql().(type_, w)
105 }
106
107 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMESTAMPTZrust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIMESTAMPTZ.);
108 to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!();
109 }
110
111 impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for NaiveDaterust-analyzer cargo chrono 0.4.45 naive/date/NaiveDate# {
112 fn from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveDate][`FromSql<'a>`]from_sql().(_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<NaiveDaterust-analyzer cargo chrono 0.4.45 naive/date/NaiveDate#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
113 let jd = typesrust-analyzer cargo postgres-protocol 0.6.12 types/::date_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/date_from_sql().(raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
114 baserust-analyzer cargo postgres-types 0.2.14 chrono_04/base().()
115 .daterust-analyzer cargo chrono 0.4.45 naive/datetime/impl#[NaiveDateTime]date().()
116 .checked_add_signedrust-analyzer cargo chrono 0.4.45 naive/date/impl#[NaiveDate]checked_add_signed().(Durationrust-analyzer cargo chrono 0.4.45 Duration#::daysrust-analyzer cargo chrono 0.4.45 time_delta/impl#[TimeDelta]days().(i64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`From<i32>`]from().(jd)))
117 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| "value too large to decode".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
118 }
119
120 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(DATErust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]DATE.);
121 }
122
123 impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for NaiveDaterust-analyzer cargo chrono 0.4.45 naive/date/NaiveDate# {
124 fn to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveDate][ToSql]to_sql().(&self, _: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, w: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
125 let jd = self.signed_duration_sincerust-analyzer cargo chrono 0.4.45 naive/date/impl#[NaiveDate]signed_duration_since().(baserust-analyzer cargo postgres-types 0.2.14 chrono_04/base().().daterust-analyzer cargo chrono 0.4.45 naive/datetime/impl#[NaiveDateTime]date().()).num_daysrust-analyzer cargo chrono 0.4.45 time_delta/impl#[TimeDelta]num_days().();
126 let jd = i32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`TryFrom<i64>`]try_from().(jd).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| "value too large to transmit")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
127
128 typesrust-analyzer cargo postgres-protocol 0.6.12 types/::date_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/date_to_sql().(jd, w);
129 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#::Norust-analyzer cargo postgres-types 0.2.14 IsNull#No#)
130 }
131
132 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(DATErust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]DATE.);
133 to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!();
134 }
135
136 impl<'a> FromSqlrust-analyzer cargo postgres-types 0.2.14 FromSql#<'a> for NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime# {
137 fn from_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveTime][`FromSql<'a>`]from_sql().(_: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, raw: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
138 let usec = typesrust-analyzer cargo postgres-protocol 0.6.12 types/::time_from_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/time_from_sql().(raw)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
139 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime#::from_hms_optrust-analyzer cargo chrono 0.4.45 naive/time/impl#[NaiveTime]from_hms_opt().(0, 0, 0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() rust-analyzer cargo chrono 0.4.45 naive/time/impl#[NaiveTime][`Add<TimeDelta>`]add().+rust-analyzer cargo chrono 0.4.45 naive/time/impl#[NaiveTime][`Add<TimeDelta>`]add(). rust-analyzer cargo chrono 0.4.45 naive/time/impl#[NaiveTime][`Add<TimeDelta>`]add().Durationrust-analyzer cargo chrono 0.4.45 Duration#::microsecondsrust-analyzer cargo chrono 0.4.45 time_delta/impl#[TimeDelta]microseconds().(usec))
140 }
141
142 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMErust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIME.);
143 }
144
145 impl ToSqlrust-analyzer cargo postgres-types 0.2.14 ToSql# for NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime# {
146 fn to_sqlrust-analyzer cargo postgres-types 0.2.14 chrono_04/impl#[NaiveTime][ToSql]to_sql().(&self, _: &Typerust-analyzer cargo postgres-types 0.2.14 Type#, w: &mut BytesMutrust-analyzer cargo bytes 1.11.1 bytes_mut/BytesMut#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>> {
147 let delta = self.signed_duration_sincerust-analyzer cargo chrono 0.4.45 naive/time/impl#[NaiveTime]signed_duration_since().(NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime#::from_hms_optrust-analyzer cargo chrono 0.4.45 naive/time/impl#[NaiveTime]from_hms_opt().(0, 0, 0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
148 let time = match delta.num_microsecondsrust-analyzer cargo chrono 0.4.45 time_delta/impl#[TimeDelta]num_microseconds().() {
149 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(time) => time,
150 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#("value too large to transmit".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
151 };
152 typesrust-analyzer cargo postgres-protocol 0.6.12 types/::time_to_sqlrust-analyzer cargo postgres-protocol 0.6.12 types/time_to_sql().(time, w);
153 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo postgres-types 0.2.14 IsNull#::Norust-analyzer cargo postgres-types 0.2.14 IsNull#No#)
154 }
155
156 acceptsrust-analyzer cargo postgres-types 0.2.14 accepts!!(TIMErust-analyzer cargo postgres-types 0.2.14 type_gen/impl#[Type]TIME.);
157 to_sql_checkedrust-analyzer cargo postgres-types 0.2.14 to_sql_checked!!();
158 }