pub struct Iso8601<const CONFIG: EncodedConfig = { Config::DEFAULT.encode() }>;
formatting
or parsing
only.Expand description
The format described in ISO 8601.
This implementation is of ISO 8601-1:2019. It may not be compatible with other versions.
The const parameter CONFIG
must be a value that was returned by Config::encode
.
Passing any other value is unspecified behavior.
Example: 1997-11-21T09:55:06.000000000-06:00
§Examples
Implementations§
Source§impl<const CONFIG: EncodedConfig> Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> Iso8601<CONFIG>
Sourceconst CONFIG: Config = _
Available on crate feature formatting
only.
const CONFIG: Config = _
formatting
only.The user-provided configuration for the ISO 8601 format.
Sourcepub(crate) const FORMAT_DATE: bool = _
Available on crate feature formatting
only.
pub(crate) const FORMAT_DATE: bool = _
formatting
only.Whether the date should be formatted.
Sourcepub(crate) const FORMAT_TIME: bool = _
Available on crate feature formatting
only.
pub(crate) const FORMAT_TIME: bool = _
formatting
only.Whether the time should be formatted.
Sourcepub(crate) const FORMAT_OFFSET: bool = _
Available on crate feature formatting
only.
pub(crate) const FORMAT_OFFSET: bool = _
formatting
only.Whether the UTC offset should be formatted.
Sourcepub(crate) const YEAR_IS_SIX_DIGITS: bool = _
Available on crate feature formatting
only.
pub(crate) const YEAR_IS_SIX_DIGITS: bool = _
formatting
only.Whether the year is six digits.
Sourcepub(crate) const USE_SEPARATORS: bool = _
Available on crate feature formatting
only.
pub(crate) const USE_SEPARATORS: bool = _
formatting
only.Whether the format contains separators (such as -
or :
).
Sourcepub(crate) const DATE_KIND: DateKind = _
Available on crate feature formatting
only.
pub(crate) const DATE_KIND: DateKind = _
formatting
only.Which format to use for the date.
Sourcepub(crate) const TIME_PRECISION: TimePrecision = _
Available on crate feature formatting
only.
pub(crate) const TIME_PRECISION: TimePrecision = _
formatting
only.The precision and number of decimal digits to use for the time.
Sourcepub(crate) const OFFSET_PRECISION: OffsetPrecision = _
Available on crate feature formatting
only.
pub(crate) const OFFSET_PRECISION: OffsetPrecision = _
formatting
only.The precision for the UTC offset.
Source§impl Iso8601<DEFAULT>
impl Iso8601<DEFAULT>
Sourcepub const DEFAULT: Self = Self
pub const DEFAULT: Self = Self
An Iso8601
with the default configuration.
The following is the default behavior:
- The configuration can be used for both formatting and parsing.
- The date, time, and UTC offset are all formatted.
- Separators (such as
-
and:
) are included. - The year contains four digits, such that the year must be between 0 and 9999.
- The date uses the calendar format.
- The time has precision to the second and nine decimal digits.
- The UTC offset has precision to the minute.
If you need different behavior, use another associated constant. For full customization, use
Config::DEFAULT
and Config
’s methods to create a custom configuration.
Source§impl Iso8601<DATE>
impl Iso8601<DATE>
Sourcepub const DATE: Self = Self
pub const DATE: Self = Self
An Iso8601
that handles only the date, but is otherwise the same as Config::DEFAULT
.
Source§impl Iso8601<TIME>
impl Iso8601<TIME>
Sourcepub const TIME: Self = Self
pub const TIME: Self = Self
An Iso8601
that handles only the time, but is otherwise the same as Config::DEFAULT
.
Source§impl Iso8601<OFFSET>
impl Iso8601<OFFSET>
Sourcepub const OFFSET: Self = Self
pub const OFFSET: Self = Self
An Iso8601
that handles only the UTC offset, but is otherwise the same as
Config::DEFAULT
.
Source§impl Iso8601<DATE_TIME>
impl Iso8601<DATE_TIME>
Sourcepub const DATE_TIME: Self = Self
pub const DATE_TIME: Self = Self
An Iso8601
that handles the date and time, but is otherwise the same as
Config::DEFAULT
.
Source§impl Iso8601<DATE_TIME_OFFSET>
impl Iso8601<DATE_TIME_OFFSET>
Sourcepub const DATE_TIME_OFFSET: Self = Self
pub const DATE_TIME_OFFSET: Self = Self
An Iso8601
that handles the date, time, and UTC offset. This is the same as
Config::DEFAULT
.
Source§impl Iso8601<TIME_OFFSET>
impl Iso8601<TIME_OFFSET>
Sourcepub const TIME_OFFSET: Self = Self
pub const TIME_OFFSET: Self = Self
An Iso8601
that handles the time and UTC offset, but is otherwise the same as
Config::DEFAULT
.
Source§impl<const CONFIG: EncodedConfig> Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> Iso8601<CONFIG>
Sourcepub(crate) fn parse_date<'a>(
parsed: &'a mut Parsed,
extended_kind: &'a mut ExtendedKind,
) -> impl FnMut(&[u8]) -> Result<&[u8], Parse> + 'a
Available on crate feature parsing
only.
pub(crate) fn parse_date<'a>( parsed: &'a mut Parsed, extended_kind: &'a mut ExtendedKind, ) -> impl FnMut(&[u8]) -> Result<&[u8], Parse> + 'a
parsing
only.Parse a date in the basic or extended format. Reduced precision is permitted.
Sourcepub(crate) fn parse_time<'a>(
parsed: &'a mut Parsed,
extended_kind: &'a mut ExtendedKind,
date_is_present: bool,
) -> impl FnMut(&[u8]) -> Result<&[u8], Parse> + 'a
Available on crate feature parsing
only.
pub(crate) fn parse_time<'a>( parsed: &'a mut Parsed, extended_kind: &'a mut ExtendedKind, date_is_present: bool, ) -> impl FnMut(&[u8]) -> Result<&[u8], Parse> + 'a
parsing
only.Parse a time in the basic or extended format. Reduced precision is permitted.
Sourcepub(crate) fn parse_offset<'a>(
parsed: &'a mut Parsed,
extended_kind: &'a mut ExtendedKind,
) -> impl FnMut(&[u8]) -> Result<&[u8], Parse> + 'a
Available on crate feature parsing
only.
pub(crate) fn parse_offset<'a>( parsed: &'a mut Parsed, extended_kind: &'a mut ExtendedKind, ) -> impl FnMut(&[u8]) -> Result<&[u8], Parse> + 'a
parsing
only.Parse a UTC offset in the basic or extended format. Reduced precision is supported.
Trait Implementations§
Source§impl<const CONFIG: EncodedConfig> Clone for Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> Clone for Iso8601<CONFIG>
Source§impl<const CONFIG: EncodedConfig> Debug for Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> Debug for Iso8601<CONFIG>
Source§impl<const CONFIG: EncodedConfig> Eq for Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> Eq for Iso8601<CONFIG>
#[doc(hidden)] fn assert_receiver_is_total_eq(&self)
Source§impl<const CONFIG: EncodedConfig> PartialEq for Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> PartialEq for Iso8601<CONFIG>
Source§impl<const CONFIG: EncodedConfig> Sealed for Iso8601<CONFIG>
Available on crate feature formatting
only.
impl<const CONFIG: EncodedConfig> Sealed for Iso8601<CONFIG>
formatting
only.Source§impl<const CONFIG: EncodedConfig> Sealed for Iso8601<CONFIG>
Available on crate feature parsing
only.
impl<const CONFIG: EncodedConfig> Sealed for Iso8601<CONFIG>
parsing
only.Source§fn parse_date(&self, input: &[u8]) -> Result<Date, Parse>
fn parse_date(&self, input: &[u8]) -> Result<Date, Parse>
Date
from the format description.Source§fn parse_time(&self, input: &[u8]) -> Result<Time, Parse>
fn parse_time(&self, input: &[u8]) -> Result<Time, Parse>
Time
from the format description.Source§fn parse_offset(&self, input: &[u8]) -> Result<UtcOffset, Parse>
fn parse_offset(&self, input: &[u8]) -> Result<UtcOffset, Parse>
UtcOffset
from the format description.Source§fn parse_primitive_date_time(
&self,
input: &[u8],
) -> Result<PrimitiveDateTime, Parse>
fn parse_primitive_date_time( &self, input: &[u8], ) -> Result<PrimitiveDateTime, Parse>
PrimitiveDateTime
from the format description.Source§fn parse_utc_date_time(&self, input: &[u8]) -> Result<UtcDateTime, Parse>
fn parse_utc_date_time(&self, input: &[u8]) -> Result<UtcDateTime, Parse>
UtcDateTime
from the format description.Source§fn parse_offset_date_time(&self, input: &[u8]) -> Result<OffsetDateTime, Parse>
fn parse_offset_date_time(&self, input: &[u8]) -> Result<OffsetDateTime, Parse>
OffsetDateTime
from the format description.impl<const CONFIG: EncodedConfig> Copy for Iso8601<CONFIG>
impl<const CONFIG: EncodedConfig> Formattable for Iso8601<CONFIG>
formatting
only.impl<const CONFIG: EncodedConfig> Parsable for Iso8601<CONFIG>
parsing
only.