22
22
//! [s5]: https://graphql-scalars.dev/docs/scalars/utc-offset
23
23
24
24
use time:: {
25
- format_description:: { well_known:: Rfc3339 , FormatItem } ,
25
+ format_description:: { well_known:: Rfc3339 , BorrowedFormatItem } ,
26
26
macros:: format_description,
27
27
} ;
28
28
@@ -52,12 +52,12 @@ mod date {
52
52
/// Format of a [`Date` scalar][1].
53
53
///
54
54
/// [1]: https://graphql-scalars.dev/docs/scalars/date
55
- const FORMAT : & [ FormatItem < ' _ > ] = format_description ! ( "[year]-[month]-[day]" ) ;
55
+ const FORMAT : & [ BorrowedFormatItem < ' _ > ] = format_description ! ( "[year]-[month]-[day]" ) ;
56
56
57
57
pub ( super ) fn to_output < S : ScalarValue > ( v : & Date ) -> Value < S > {
58
58
Value :: scalar (
59
59
v. format ( FORMAT )
60
- . unwrap_or_else ( |e| panic ! ( "Failed to format `Date`: {e}" ) ) ,
60
+ . unwrap_or_else ( |e| panic ! ( "failed to format `Date`: {e}" ) ) ,
61
61
)
62
62
}
63
63
@@ -89,18 +89,19 @@ mod local_time {
89
89
/// Full format of a [`LocalTime` scalar][1].
90
90
///
91
91
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
92
- const FORMAT : & [ FormatItem < ' _ > ] =
92
+ const FORMAT : & [ BorrowedFormatItem < ' _ > ] =
93
93
format_description ! ( "[hour]:[minute]:[second].[subsecond digits:3]" ) ;
94
94
95
95
/// Format of a [`LocalTime` scalar][1] without milliseconds.
96
96
///
97
97
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
98
- const FORMAT_NO_MILLIS : & [ FormatItem < ' _ > ] = format_description ! ( "[hour]:[minute]:[second]" ) ;
98
+ const FORMAT_NO_MILLIS : & [ BorrowedFormatItem < ' _ > ] =
99
+ format_description ! ( "[hour]:[minute]:[second]" ) ;
99
100
100
101
/// Format of a [`LocalTime` scalar][1] without seconds.
101
102
///
102
103
/// [1]: https://graphql-scalars.dev/docs/scalars/local-time
103
- const FORMAT_NO_SECS : & [ FormatItem < ' _ > ] = format_description ! ( "[hour]:[minute]" ) ;
104
+ const FORMAT_NO_SECS : & [ BorrowedFormatItem < ' _ > ] = format_description ! ( "[hour]:[minute]" ) ;
104
105
105
106
pub ( super ) fn to_output < S : ScalarValue > ( v : & LocalTime ) -> Value < S > {
106
107
Value :: scalar (
@@ -109,7 +110,7 @@ mod local_time {
109
110
} else {
110
111
v. format ( FORMAT )
111
112
}
112
- . unwrap_or_else ( |e| panic ! ( "Failed to format `LocalTime`: {e}" ) ) ,
113
+ . unwrap_or_else ( |e| panic ! ( "failed to format `LocalTime`: {e}" ) ) ,
113
114
)
114
115
}
115
116
@@ -140,13 +141,13 @@ mod local_date_time {
140
141
use super :: * ;
141
142
142
143
/// Format of a [`LocalDateTime`] scalar.
143
- const FORMAT : & [ FormatItem < ' _ > ] =
144
+ const FORMAT : & [ BorrowedFormatItem < ' _ > ] =
144
145
format_description ! ( "[year]-[month]-[day] [hour]:[minute]:[second]" ) ;
145
146
146
147
pub ( super ) fn to_output < S : ScalarValue > ( v : & LocalDateTime ) -> Value < S > {
147
148
Value :: scalar (
148
149
v. format ( FORMAT )
149
- . unwrap_or_else ( |e| panic ! ( "Failed to format `LocalDateTime`: {e}" ) ) ,
150
+ . unwrap_or_else ( |e| panic ! ( "failed to format `LocalDateTime`: {e}" ) ) ,
150
151
)
151
152
}
152
153
@@ -185,7 +186,7 @@ mod date_time {
185
186
Value :: scalar (
186
187
v. to_offset ( UtcOffset :: UTC )
187
188
. format ( & Rfc3339 )
188
- . unwrap_or_else ( |e| panic ! ( "Failed to format `DateTime`: {e}" ) ) ,
189
+ . unwrap_or_else ( |e| panic ! ( "failed to format `DateTime`: {e}" ) ) ,
189
190
)
190
191
}
191
192
@@ -202,7 +203,7 @@ mod date_time {
202
203
/// Format of a [`UtcOffset` scalar][1].
203
204
///
204
205
/// [1]: https://graphql-scalars.dev/docs/scalars/utc-offset
205
- const UTC_OFFSET_FORMAT : & [ FormatItem < ' _ > ] =
206
+ const UTC_OFFSET_FORMAT : & [ BorrowedFormatItem < ' _ > ] =
206
207
format_description ! ( "[offset_hour sign:mandatory]:[offset_minute]" ) ;
207
208
208
209
/// Offset from UTC in `±hh:mm` format. See [list of database time zones][0].
@@ -227,7 +228,7 @@ mod utc_offset {
227
228
pub ( super ) fn to_output < S : ScalarValue > ( v : & UtcOffset ) -> Value < S > {
228
229
Value :: scalar (
229
230
v. format ( UTC_OFFSET_FORMAT )
230
- . unwrap_or_else ( |e| panic ! ( "Failed to format `UtcOffset`: {e}" ) ) ,
231
+ . unwrap_or_else ( |e| panic ! ( "failed to format `UtcOffset`: {e}" ) ) ,
231
232
)
232
233
}
233
234
0 commit comments