1//! Various modifiers for components.
23use core::num::NonZero;
45/// Day of the month.
6#[non_exhaustive]
7#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Day {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Day",
"padding", &&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Day {
#[inline]
fn clone(&self) -> Day {
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Day { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Day {
#[inline]
fn eq(&self, other: &Day) -> bool { self.padding == other.padding }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Day {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
8pub struct Day {
9/// The padding to obtain the minimum width.
10pub padding: Padding,
11}
1213/// The representation of a month.
14#[non_exhaustive]
15#[derive(#[automatically_derived]
impl ::core::fmt::Debug for MonthRepr {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
MonthRepr::Numerical => "Numerical",
MonthRepr::Long => "Long",
MonthRepr::Short => "Short",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MonthRepr {
#[inline]
fn clone(&self) -> MonthRepr { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MonthRepr { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for MonthRepr {
#[inline]
fn eq(&self, other: &MonthRepr) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MonthRepr {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
16pub enum MonthRepr {
17/// The number of the month (January is 1, December is 12).
18Numerical,
19/// The long form of the month name (e.g. "January").
20Long,
21/// The short form of the month name (e.g. "Jan").
22Short,
23}
2425/// Month of the year.
26#[non_exhaustive]
27#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Month {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Month",
"padding", &self.padding, "repr", &self.repr, "case_sensitive",
&&self.case_sensitive)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Month {
#[inline]
fn clone(&self) -> Month {
let _: ::core::clone::AssertParamIsClone<Padding>;
let _: ::core::clone::AssertParamIsClone<MonthRepr>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Month { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Month {
#[inline]
fn eq(&self, other: &Month) -> bool {
self.case_sensitive == other.case_sensitive &&
self.padding == other.padding && self.repr == other.repr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Month {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
let _: ::core::cmp::AssertParamIsEq<MonthRepr>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
28pub struct Month {
29/// The padding to obtain the minimum width.
30pub padding: Padding,
31/// What form of representation should be used?
32pub repr: MonthRepr,
33/// Is the value case sensitive when parsing?
34pub case_sensitive: bool,
35}
3637/// Ordinal day of the year.
38#[non_exhaustive]
39#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Ordinal {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Ordinal",
"padding", &&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Ordinal {
#[inline]
fn clone(&self) -> Ordinal {
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Ordinal { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Ordinal {
#[inline]
fn eq(&self, other: &Ordinal) -> bool { self.padding == other.padding }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Ordinal {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
40pub struct Ordinal {
41/// The padding to obtain the minimum width.
42pub padding: Padding,
43}
4445/// The representation used for the day of the week.
46#[non_exhaustive]
47#[derive(#[automatically_derived]
impl ::core::fmt::Debug for WeekdayRepr {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
WeekdayRepr::Short => "Short",
WeekdayRepr::Long => "Long",
WeekdayRepr::Sunday => "Sunday",
WeekdayRepr::Monday => "Monday",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for WeekdayRepr {
#[inline]
fn clone(&self) -> WeekdayRepr { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for WeekdayRepr { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for WeekdayRepr {
#[inline]
fn eq(&self, other: &WeekdayRepr) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for WeekdayRepr {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
48pub enum WeekdayRepr {
49/// The short form of the weekday (e.g. "Mon").
50Short,
51/// The long form of the weekday (e.g. "Monday").
52Long,
53/// A numerical representation using Sunday as the first day of the week.
54 ///
55 /// Sunday is either 0 or 1, depending on the other modifier's value.
56Sunday,
57/// A numerical representation using Monday as the first day of the week.
58 ///
59 /// Monday is either 0 or 1, depending on the other modifier's value.
60Monday,
61}
6263/// Day of the week.
64#[non_exhaustive]
65#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Weekday {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Weekday",
"repr", &self.repr, "one_indexed", &self.one_indexed,
"case_sensitive", &&self.case_sensitive)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Weekday {
#[inline]
fn clone(&self) -> Weekday {
let _: ::core::clone::AssertParamIsClone<WeekdayRepr>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Weekday { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Weekday {
#[inline]
fn eq(&self, other: &Weekday) -> bool {
self.one_indexed == other.one_indexed &&
self.case_sensitive == other.case_sensitive &&
self.repr == other.repr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Weekday {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<WeekdayRepr>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
66pub struct Weekday {
67/// What form of representation should be used?
68pub repr: WeekdayRepr,
69/// When using a numerical representation, should it be zero or one-indexed?
70pub one_indexed: bool,
71/// Is the value case sensitive when parsing?
72pub case_sensitive: bool,
73}
7475/// The representation used for the week number.
76#[non_exhaustive]
77#[derive(#[automatically_derived]
impl ::core::fmt::Debug for WeekNumberRepr {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
WeekNumberRepr::Iso => "Iso",
WeekNumberRepr::Sunday => "Sunday",
WeekNumberRepr::Monday => "Monday",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for WeekNumberRepr {
#[inline]
fn clone(&self) -> WeekNumberRepr { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for WeekNumberRepr { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for WeekNumberRepr {
#[inline]
fn eq(&self, other: &WeekNumberRepr) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for WeekNumberRepr {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
78pub enum WeekNumberRepr {
79/// Week 1 is the week that contains January 4.
80Iso,
81/// Week 1 begins on the first Sunday of the calendar year.
82Sunday,
83/// Week 1 begins on the first Monday of the calendar year.
84Monday,
85}
8687/// Week within the year.
88#[non_exhaustive]
89#[derive(#[automatically_derived]
impl ::core::fmt::Debug for WeekNumber {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "WeekNumber",
"padding", &self.padding, "repr", &&self.repr)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for WeekNumber {
#[inline]
fn clone(&self) -> WeekNumber {
let _: ::core::clone::AssertParamIsClone<Padding>;
let _: ::core::clone::AssertParamIsClone<WeekNumberRepr>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for WeekNumber { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for WeekNumber {
#[inline]
fn eq(&self, other: &WeekNumber) -> bool {
self.padding == other.padding && self.repr == other.repr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for WeekNumber {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
let _: ::core::cmp::AssertParamIsEq<WeekNumberRepr>;
}
}Eq)]
90pub struct WeekNumber {
91/// The padding to obtain the minimum width.
92pub padding: Padding,
93/// What kind of representation should be used?
94pub repr: WeekNumberRepr,
95}
9697/// The representation used for a year value.
98#[non_exhaustive]
99#[derive(#[automatically_derived]
impl ::core::fmt::Debug for YearRepr {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
YearRepr::Full => "Full",
YearRepr::Century => "Century",
YearRepr::LastTwo => "LastTwo",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for YearRepr {
#[inline]
fn clone(&self) -> YearRepr { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for YearRepr { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for YearRepr {
#[inline]
fn eq(&self, other: &YearRepr) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for YearRepr {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
100pub enum YearRepr {
101/// The full value of the year.
102Full,
103/// All digits except the last two. Includes the sign, if any.
104Century,
105/// Only the last two digits of the year.
106LastTwo,
107}
108109/// The range of years that are supported.
110///
111/// This modifier has no effect when the year repr is [`LastTwo`](YearRepr::LastTwo).
112#[non_exhaustive]
113#[derive(#[automatically_derived]
impl ::core::fmt::Debug for YearRange {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
YearRange::Standard => "Standard",
YearRange::Extended => "Extended",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for YearRange {
#[inline]
fn clone(&self) -> YearRange { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for YearRange { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for YearRange {
#[inline]
fn eq(&self, other: &YearRange) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for YearRange {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
114pub enum YearRange {
115/// Years between -9999 and 9999 are supported.
116Standard,
117/// Years between -999_999 and 999_999 are supported, with the sign being required if the year
118 /// contains more than four digits.
119 ///
120 /// If the `large-dates` feature is not enabled, this variant is equivalent to `Standard`.
121Extended,
122}
123124/// Year of the date.
125#[non_exhaustive]
126#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Year {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field5_finish(f, "Year",
"padding", &self.padding, "repr", &self.repr, "range",
&self.range, "iso_week_based", &self.iso_week_based,
"sign_is_mandatory", &&self.sign_is_mandatory)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Year {
#[inline]
fn clone(&self) -> Year {
let _: ::core::clone::AssertParamIsClone<Padding>;
let _: ::core::clone::AssertParamIsClone<YearRepr>;
let _: ::core::clone::AssertParamIsClone<YearRange>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Year { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Year {
#[inline]
fn eq(&self, other: &Year) -> bool {
self.iso_week_based == other.iso_week_based &&
self.sign_is_mandatory == other.sign_is_mandatory &&
self.padding == other.padding && self.repr == other.repr &&
self.range == other.range
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Year {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
let _: ::core::cmp::AssertParamIsEq<YearRepr>;
let _: ::core::cmp::AssertParamIsEq<YearRange>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
127pub struct Year {
128/// The padding to obtain the minimum width.
129pub padding: Padding,
130/// What kind of representation should be used?
131pub repr: YearRepr,
132/// What range of years is supported?
133pub range: YearRange,
134/// Whether the value is based on the ISO week number or the Gregorian calendar.
135pub iso_week_based: bool,
136/// Whether the `+` sign is present when a positive year contains fewer than five digits.
137pub sign_is_mandatory: bool,
138}
139140/// Hour of the day.
141#[non_exhaustive]
142#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Hour {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Hour",
"padding", &self.padding, "is_12_hour_clock",
&&self.is_12_hour_clock)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Hour {
#[inline]
fn clone(&self) -> Hour {
let _: ::core::clone::AssertParamIsClone<Padding>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Hour { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Hour {
#[inline]
fn eq(&self, other: &Hour) -> bool {
self.is_12_hour_clock == other.is_12_hour_clock &&
self.padding == other.padding
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Hour {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
143pub struct Hour {
144/// The padding to obtain the minimum width.
145pub padding: Padding,
146/// Is the hour displayed using a 12 or 24-hour clock?
147pub is_12_hour_clock: bool,
148}
149150/// Minute within the hour.
151#[non_exhaustive]
152#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Minute {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Minute",
"padding", &&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Minute {
#[inline]
fn clone(&self) -> Minute {
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Minute { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Minute {
#[inline]
fn eq(&self, other: &Minute) -> bool { self.padding == other.padding }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Minute {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
153pub struct Minute {
154/// The padding to obtain the minimum width.
155pub padding: Padding,
156}
157158/// AM/PM part of the time.
159#[non_exhaustive]
160#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Period {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Period",
"is_uppercase", &self.is_uppercase, "case_sensitive",
&&self.case_sensitive)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Period {
#[inline]
fn clone(&self) -> Period {
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Period { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Period {
#[inline]
fn eq(&self, other: &Period) -> bool {
self.is_uppercase == other.is_uppercase &&
self.case_sensitive == other.case_sensitive
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Period {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
161pub struct Period {
162/// Is the period uppercase or lowercase?
163pub is_uppercase: bool,
164/// Is the value case sensitive when parsing?
165 ///
166 /// Note that when `false`, the `is_uppercase` field has no effect on parsing behavior.
167pub case_sensitive: bool,
168}
169170/// Second within the minute.
171#[non_exhaustive]
172#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Second {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Second",
"padding", &&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Second {
#[inline]
fn clone(&self) -> Second {
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Second { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Second {
#[inline]
fn eq(&self, other: &Second) -> bool { self.padding == other.padding }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Second {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
173pub struct Second {
174/// The padding to obtain the minimum width.
175pub padding: Padding,
176}
177178/// The number of digits present in a subsecond representation.
179#[non_exhaustive]
180#[derive(#[automatically_derived]
impl ::core::fmt::Debug for SubsecondDigits {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
SubsecondDigits::One => "One",
SubsecondDigits::Two => "Two",
SubsecondDigits::Three => "Three",
SubsecondDigits::Four => "Four",
SubsecondDigits::Five => "Five",
SubsecondDigits::Six => "Six",
SubsecondDigits::Seven => "Seven",
SubsecondDigits::Eight => "Eight",
SubsecondDigits::Nine => "Nine",
SubsecondDigits::OneOrMore => "OneOrMore",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for SubsecondDigits {
#[inline]
fn clone(&self) -> SubsecondDigits { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for SubsecondDigits { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for SubsecondDigits {
#[inline]
fn eq(&self, other: &SubsecondDigits) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for SubsecondDigits {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
181pub enum SubsecondDigits {
182/// Exactly one digit.
183One,
184/// Exactly two digits.
185Two,
186/// Exactly three digits.
187Three,
188/// Exactly four digits.
189Four,
190/// Exactly five digits.
191Five,
192/// Exactly six digits.
193Six,
194/// Exactly seven digits.
195Seven,
196/// Exactly eight digits.
197Eight,
198/// Exactly nine digits.
199Nine,
200/// Any number of digits (up to nine) that is at least one. When formatting, the minimum digits
201 /// necessary will be used.
202OneOrMore,
203}
204205/// Subsecond within the second.
206#[non_exhaustive]
207#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Subsecond {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Subsecond",
"digits", &&self.digits)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Subsecond {
#[inline]
fn clone(&self) -> Subsecond {
let _: ::core::clone::AssertParamIsClone<SubsecondDigits>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Subsecond { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Subsecond {
#[inline]
fn eq(&self, other: &Subsecond) -> bool { self.digits == other.digits }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Subsecond {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<SubsecondDigits>;
}
}Eq)]
208pub struct Subsecond {
209/// How many digits are present in the component?
210pub digits: SubsecondDigits,
211}
212213/// Hour of the UTC offset.
214#[non_exhaustive]
215#[derive(#[automatically_derived]
impl ::core::fmt::Debug for OffsetHour {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "OffsetHour",
"sign_is_mandatory", &self.sign_is_mandatory, "padding",
&&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for OffsetHour {
#[inline]
fn clone(&self) -> OffsetHour {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for OffsetHour { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for OffsetHour {
#[inline]
fn eq(&self, other: &OffsetHour) -> bool {
self.sign_is_mandatory == other.sign_is_mandatory &&
self.padding == other.padding
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for OffsetHour {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
216pub struct OffsetHour {
217/// Whether the `+` sign is present on positive values.
218pub sign_is_mandatory: bool,
219/// The padding to obtain the minimum width.
220pub padding: Padding,
221}
222223/// Minute within the hour of the UTC offset.
224#[non_exhaustive]
225#[derive(#[automatically_derived]
impl ::core::fmt::Debug for OffsetMinute {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "OffsetMinute",
"padding", &&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for OffsetMinute {
#[inline]
fn clone(&self) -> OffsetMinute {
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for OffsetMinute { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for OffsetMinute {
#[inline]
fn eq(&self, other: &OffsetMinute) -> bool {
self.padding == other.padding
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for OffsetMinute {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
226pub struct OffsetMinute {
227/// The padding to obtain the minimum width.
228pub padding: Padding,
229}
230231/// Second within the minute of the UTC offset.
232#[non_exhaustive]
233#[derive(#[automatically_derived]
impl ::core::fmt::Debug for OffsetSecond {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "OffsetSecond",
"padding", &&self.padding)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for OffsetSecond {
#[inline]
fn clone(&self) -> OffsetSecond {
let _: ::core::clone::AssertParamIsClone<Padding>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for OffsetSecond { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for OffsetSecond {
#[inline]
fn eq(&self, other: &OffsetSecond) -> bool {
self.padding == other.padding
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for OffsetSecond {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<Padding>;
}
}Eq)]
234pub struct OffsetSecond {
235/// The padding to obtain the minimum width.
236pub padding: Padding,
237}
238239/// Type of padding to ensure a minimum width.
240#[non_exhaustive]
241#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Padding {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
Padding::Space => "Space",
Padding::Zero => "Zero",
Padding::None => "None",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Padding {
#[inline]
fn clone(&self) -> Padding { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Padding { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Padding {
#[inline]
fn eq(&self, other: &Padding) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Padding {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
242pub enum Padding {
243/// A space character (` `) should be used as padding.
244Space,
245/// A zero character (`0`) should be used as padding.
246Zero,
247/// There is no padding. This can result in a width below the otherwise minimum number of
248 /// characters.
249None,
250}
251252/// Ignore some number of bytes.
253///
254/// This has no effect when formatting.
255#[non_exhaustive]
256#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Ignore {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f, "Ignore",
"count", &&self.count)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Ignore {
#[inline]
fn clone(&self) -> Ignore {
let _: ::core::clone::AssertParamIsClone<NonZero<u16>>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Ignore { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for Ignore {
#[inline]
fn eq(&self, other: &Ignore) -> bool { self.count == other.count }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Ignore {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<NonZero<u16>>;
}
}Eq)]
257pub struct Ignore {
258/// The number of bytes to ignore.
259pub count: NonZero<u16>,
260}
261262// Needed as `Default` is deliberately not implemented for `Ignore`. The number of bytes to ignore
263// must be explicitly provided.
264impl Ignore {
265/// Create an instance of `Ignore` with the provided number of bytes to ignore.
266#[inline]
267pub const fn count(count: NonZero<u16>) -> Self {
268Self { count }
269 }
270}
271272/// The precision of a Unix timestamp.
273#[non_exhaustive]
274#[derive(#[automatically_derived]
impl ::core::fmt::Debug for UnixTimestampPrecision {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
UnixTimestampPrecision::Second => "Second",
UnixTimestampPrecision::Millisecond => "Millisecond",
UnixTimestampPrecision::Microsecond => "Microsecond",
UnixTimestampPrecision::Nanosecond => "Nanosecond",
})
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for UnixTimestampPrecision {
#[inline]
fn clone(&self) -> UnixTimestampPrecision { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for UnixTimestampPrecision { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for UnixTimestampPrecision {
#[inline]
fn eq(&self, other: &UnixTimestampPrecision) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for UnixTimestampPrecision {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
275pub enum UnixTimestampPrecision {
276/// Seconds since the Unix epoch.
277Second,
278/// Milliseconds since the Unix epoch.
279Millisecond,
280/// Microseconds since the Unix epoch.
281Microsecond,
282/// Nanoseconds since the Unix epoch.
283Nanosecond,
284}
285286/// A Unix timestamp.
287#[non_exhaustive]
288#[derive(#[automatically_derived]
impl ::core::fmt::Debug for UnixTimestamp {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "UnixTimestamp",
"precision", &self.precision, "sign_is_mandatory",
&&self.sign_is_mandatory)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for UnixTimestamp {
#[inline]
fn clone(&self) -> UnixTimestamp {
let _: ::core::clone::AssertParamIsClone<UnixTimestampPrecision>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for UnixTimestamp { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for UnixTimestamp {
#[inline]
fn eq(&self, other: &UnixTimestamp) -> bool {
self.sign_is_mandatory == other.sign_is_mandatory &&
self.precision == other.precision
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for UnixTimestamp {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<UnixTimestampPrecision>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
289pub struct UnixTimestamp {
290/// The precision of the timestamp.
291pub precision: UnixTimestampPrecision,
292/// Whether the `+` sign must be present for a non-negative timestamp.
293pub sign_is_mandatory: bool,
294}
295296/// The end of input.
297///
298/// There is currently not customization for this modifier.
299#[non_exhaustive]
300#[derive(#[automatically_derived]
impl ::core::fmt::Debug for End {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "End")
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for End {
#[inline]
fn clone(&self) -> End { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for End { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for End {
#[inline]
fn eq(&self, other: &End) -> bool { true }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for End {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq)]
301pub struct End;
302303/// Generate the provided code if and only if `pub` is present.
304macro_rules! if_pub {
305 (pub $(#[$attr:meta])*; $($x:tt)*) => {
306 $(#[$attr])*
307///
308 /// This function exists since [`Default::default()`] cannot be used in a `const` context.
309 /// It may be removed once that becomes possible. As the [`Default`] trait is in the
310 /// prelude, removing this function in the future will not cause any resolution failures for
311 /// the overwhelming majority of users; only users who use `#![no_implicit_prelude]` will be
312 /// affected. As such it will not be considered a breaking change.
313$($x)*
314 };
315 ($($_:tt)*) => {};
316}
317318/// Implement `Default` for the given type. This also generates an inherent implementation of a
319/// `default` method that is `const fn`, permitting the default value to be used in const contexts.
320// Every modifier should use this macro rather than a derived `Default`.
321macro_rules! impl_const_default {
322 ($($(#[$doc:meta])* $(@$pub:ident)? $type:ty => $default:expr;)*) => {$(
323impl $type {
324if_pub! {
325 $($pub)?
326$(#[$doc])*;
327#[inline]
328pub const fn default() -> Self {
329$default
330}
331 }
332 }
333334 $(#[$doc])*
335impl Default for $type {
336#[inline]
337fn default() -> Self {
338$default
339}
340 }
341 )*};
342}
343344impl End {
#[doc = r" Creates a modifier used to represent the end of input."]
///
/// This function exists since [`Default::default()`] cannot be used in a `const` context.
/// It may be removed once that becomes possible. As the [`Default`] trait is in the
/// prelude, removing this function in the future will not cause any resolution failures for
/// the overwhelming majority of users; only users who use `#![no_implicit_prelude]` will be
/// affected. As such it will not be considered a breaking change.
#[inline]
pub const fn default() -> Self { End }
}
#[doc = r" Creates a modifier used to represent the end of input."]
impl Default for End {
#[inline]
fn default() -> Self { End }
}impl_const_default! {
345/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero).
346@pub Day => Self { padding: Padding::Zero };
347/// Creates a modifier that indicates the value uses the
348 /// [`Numerical`](Self::Numerical) representation.
349MonthRepr => Self::Numerical;
350/// Creates an instance of this type that indicates the value uses the
351 /// [`Numerical`](MonthRepr::Numerical) representation, is [padded with zeroes](Padding::Zero),
352 /// and is case-sensitive when parsing.
353@pub Month => Self {
354 padding: Padding::Zero,
355 repr: MonthRepr::Numerical,
356 case_sensitive: true,
357 };
358/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero).
359@pub Ordinal => Self { padding: Padding::Zero };
360/// Creates a modifier that indicates the value uses the [`Long`](Self::Long) representation.
361WeekdayRepr => Self::Long;
362/// Creates a modifier that indicates the value uses the [`Long`](WeekdayRepr::Long)
363 /// representation and is case-sensitive when parsing. If the representation is changed to a
364 /// numerical one, the instance defaults to one-based indexing.
365@pub Weekday => Self {
366 repr: WeekdayRepr::Long,
367 one_indexed: true,
368 case_sensitive: true,
369 };
370/// Creates a modifier that indicates that the value uses the [`Iso`](Self::Iso) representation.
371WeekNumberRepr => Self::Iso;
372/// Creates a modifier that indicates that the value is [padded with zeroes](Padding::Zero)
373 /// and uses the [`Iso`](WeekNumberRepr::Iso) representation.
374@pub WeekNumber => Self {
375 padding: Padding::Zero,
376 repr: WeekNumberRepr::Iso,
377 };
378/// Creates a modifier that indicates the value uses the [`Full`](Self::Full) representation.
379YearRepr => Self::Full;
380/// Creates a modifier that indicates the value uses the [`Extended`](Self::Extended) range.
381YearRange => Self::Extended;
382/// Creates a modifier that indicates the value uses the [`Full`](YearRepr::Full)
383 /// representation, is [padded with zeroes](Padding::Zero), uses the Gregorian calendar as its
384 /// base, and only includes the year's sign if necessary.
385@pub Year => Self {
386 padding: Padding::Zero,
387 repr: YearRepr::Full,
388 range: YearRange::Extended,
389 iso_week_based: false,
390 sign_is_mandatory: false,
391 };
392/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero) and
393 /// has the 24-hour representation.
394@pub Hour => Self {
395 padding: Padding::Zero,
396 is_12_hour_clock: false,
397 };
398/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero).
399@pub Minute => Self { padding: Padding::Zero };
400/// Creates a modifier that indicates the value uses the upper-case representation and is
401 /// case-sensitive when parsing.
402@pub Period => Self {
403 is_uppercase: true,
404 case_sensitive: true,
405 };
406/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero).
407@pub Second => Self { padding: Padding::Zero };
408/// Creates a modifier that indicates the stringified value contains [one or more
409 /// digits](Self::OneOrMore).
410SubsecondDigits => Self::OneOrMore;
411/// Creates a modifier that indicates the stringified value contains [one or more
412 /// digits](SubsecondDigits::OneOrMore).
413@pub Subsecond => Self { digits: SubsecondDigits::OneOrMore };
414/// Creates a modifier that indicates the value only uses a sign for negative values and is
415 /// [padded with zeroes](Padding::Zero).
416@pub OffsetHour => Self {
417 sign_is_mandatory: false,
418 padding: Padding::Zero,
419 };
420/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero).
421@pub OffsetMinute => Self { padding: Padding::Zero };
422/// Creates a modifier that indicates the value is [padded with zeroes](Padding::Zero).
423@pub OffsetSecond => Self { padding: Padding::Zero };
424/// Creates a modifier that indicates the value is [padded with zeroes](Self::Zero).
425Padding => Self::Zero;
426/// Creates a modifier that indicates the value represents the [number of seconds](Self::Second)
427 /// since the Unix epoch.
428UnixTimestampPrecision => Self::Second;
429/// Creates a modifier that indicates the value represents the [number of
430 /// seconds](UnixTimestampPrecision::Second) since the Unix epoch. The sign is not mandatory.
431@pub UnixTimestamp => Self {
432 precision: UnixTimestampPrecision::Second,
433 sign_is_mandatory: false,
434 };
435/// Creates a modifier used to represent the end of input.
436@pub End => End;
437}