1//! Description of how types should be formatted and parsed.
2//!
3//! The formatted value will be output to the provided writer. Format descriptions can be
4//! [well-known](crate::format_description::well_known) or obtained by using the
5//! [`format_description!`](crate::macros::format_description) macro or a function listed below.
6//!
7//! For examples, see the implementors of [Formattable](crate::formatting::Formattable),
8//! e.g. [`well_known::Rfc3339`].
910mod borrowed_format_item;
11mod component;
12pub(crate) mod format_description_v3;
13pub mod modifier;
14#[cfg(feature = "alloc")]
15mod owned_format_item;
16#[cfg(feature = "alloc")]
17mod parse;
1819/// Well-known formats, typically standards.
20pub mod well_known {
21pub mod iso8601;
22mod rfc2822;
23mod rfc3339;
2425#[doc(inline)]
26pub use iso8601::Iso8601;
27pub use rfc2822::Rfc2822;
28pub use rfc3339::Rfc3339;
29}
3031/// Re-exports of internal types for use in macros.
32///
33/// Do not rely on the existence of this module for any reason. It, in its entirety, is not
34/// considered public API, is not subject to semantic versioning, and may be changed or removed at
35/// any point.
36#[doc(hidden)]
37pub mod __private {
38pub use super::format_description_v3::{Component, FormatDescriptionV3Inner};
39}
4041pub use borrowed_format_item::BorrowedFormatItem;
42#[doc(hidden)]
43#[deprecated(since = "0.3.37", note = "use `BorrowedFormatItem` for clarity")]
44pub use borrowed_format_item::BorrowedFormatItemas FormatItem;
45#[cfg(feature = "alloc")]
46pub use owned_format_item::OwnedFormatItem;
4748pub use self::component::Component;
49pub use self::format_description_v3::FormatDescriptionV3;
50#[cfg(feature = "alloc")]
51#[expect(deprecated, reason = "backwards compatibility")]
52pub use self::parse::parse;
53#[cfg(feature = "alloc")]
54pub use self::parse::{parse_borrowed, parse_owned, parse_strftime_borrowed, parse_strftime_owned};
5556/// The type output by the [`format_description!`](crate::macros::format_description) macro.
57pub type StaticFormatDescription = &'static [BorrowedFormatItem<'static>];
5859/// Indicate whether the hour is "am" or "pm".
60#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Period {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self { Period::Am => "Am", Period::Pm => "Pm", })
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Period {
#[inline]
fn clone(&self) -> Period { *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 {
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 Period {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq)]
61pub(crate) enum Period {
62#[allow(clippy::missing_docs_in_private_items)]
63Am,
64#[allow(clippy::missing_docs_in_private_items)]
65Pm,
66}