pub struct Iso8601<const CONFIG: u128 = _>;
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

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 Config::DEFAULT and Config’s methods to create a custom configuration.

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.