pub struct XmpDateTime {
    pub date: Option<XmpDate>,
    pub time: Option<XmpTime>,
}
Expand description

The XmpDateTime struct allows easy conversion between ISO8601 format (the “native” representation of dates and times in XMP) and other formats.

All of the fields are signed 32 bit integers, even though most could be 8 bit. (The same is true in the underlying C++ XMP Toolkit.) This avoids overflow when doing carries for arithmetic or normalization.

XmpDateTime values are occasionally used with only a date or only a time component. These possibilities are expressed using Options.

Note that the DateTime struct in the chrono crate is similar to this struct. We chose not to use that in the Rust XMP Toolkit in order to provide a more precise mapping to the API provided by the underlying C++ XMP Toolkit.

Fields

date: Option<XmpDate>

The date, if known.

time: Option<XmpTime>

The time, if known.

Implementations

Creates a new date-time struct reflecting the current time.

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
Returns the “default value” for a type. Read more

Formats a date according to the ISO 8601 profile in https://www.w3.org/TR/NOTE-datetime.

The format will be one of the following:

  • YYYY
  • YYYY-MM-DD
  • YYYY-MM-DDThh:mmTZD
  • YYYY-MM-DDThh:mm:ssTZD
  • YYYY-MM-DDThh:mm:ss.sTZD

Where:

  • YYYY = four-digit year
  • MM = two-digit month (01=January)
  • DD = two-digit day of month (01 through 31)
  • hh = two digits of hour (00 through 23)
  • mm = two digits of minute (00 through 59)
  • ss = two digits of second (00 through 59)
  • s = one or more digits representing a decimal fraction of a second
  • TZD = time zone designator (Z or +hh:mm or -hh:mm)

XMP allows time-only values (date = None). In this case, the date portion of the output will be 0000-01-01.

NOTE: ISO 8601 does not allow years less than 1000 or greater than 9999. XmpDateTime allows any year, even negative ones. The W3C profile also requires a time zone designator if a time is present; since XmpDateTime has an explicit notion of zone-less time, the TZD will not appear in that case.

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.

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
Converts the given value to a String. 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.