time::format_description::well_known

Struct Iso8601

Source
pub struct Iso8601<const CONFIG: EncodedConfig = { Config::DEFAULT.encode() }>;
Available on crate features 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

assert_eq!(
    datetime!(1997-11-12 9:55:06 -6:00).format(&Iso8601::DEFAULT)?,
    "1997-11-12T09:55:06.000000000-06:00"
);

Implementations§

Source§

impl Iso8601<DEFAULT>

Source

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<PARSING>

Source

pub const PARSING: Self = Self

An Iso8601 that can only be used for parsing. Using this to format a value is unspecified behavior.

Source§

impl Iso8601<DATE>

Source

pub const DATE: Self = Self

An Iso8601 that handles only the date, but is otherwise the same as Config::DEFAULT.

Source§

impl Iso8601<TIME>

Source

pub const TIME: Self = Self

An Iso8601 that handles only the time, but is otherwise the same as Config::DEFAULT.

Source§

impl Iso8601<OFFSET>

Source

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>

Source

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>

Source

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>

Source

pub const TIME_OFFSET: Self = Self

An Iso8601 that handles the time and UTC offset, but is otherwise the same as Config::DEFAULT.

Trait Implementations§

Source§

impl<const CONFIG: EncodedConfig> Clone for Iso8601<CONFIG>

Source§

fn clone(&self) -> Iso8601<CONFIG>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const CONFIG: EncodedConfig> Debug for Iso8601<CONFIG>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const CONFIG: EncodedConfig> PartialEq for Iso8601<CONFIG>

Source§

fn eq(&self, other: &Iso8601<CONFIG>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const CONFIG: EncodedConfig> Copy for Iso8601<CONFIG>

Source§

impl<const CONFIG: EncodedConfig> Eq for Iso8601<CONFIG>

Source§

impl<const CONFIG: EncodedConfig> Formattable for Iso8601<CONFIG>

Available on crate feature formatting only.
Source§

impl<const CONFIG: EncodedConfig> Parsable for Iso8601<CONFIG>

Available on crate feature parsing only.
Source§

impl<const CONFIG: EncodedConfig> StructuralPartialEq for Iso8601<CONFIG>

Auto Trait Implementations§

§

impl<const CONFIG: u128> Freeze for Iso8601<CONFIG>

§

impl<const CONFIG: u128> RefUnwindSafe for Iso8601<CONFIG>

§

impl<const CONFIG: u128> Send for Iso8601<CONFIG>

§

impl<const CONFIG: u128> Sync for Iso8601<CONFIG>

§

impl<const CONFIG: u128> Unpin for Iso8601<CONFIG>

§

impl<const CONFIG: u128> UnwindSafe for Iso8601<CONFIG>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.