pub struct DateTime(/* private fields */);Expand description
Helper for validated date/time string construction.
Wraps an RFC 3339 (an ISO 8601 profile) UTC string suitable
for CBOR tag 0. The string is validated on creation: the date
must be within 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z,
and follow RFC 3339 section 5.6 layout.
Whole-second timestamps omit the fractional part. Sub-second timestamps include only the necessary digits (1-9, no trailing zeros).
CBOR::Core references section 5.6 of RFC3339, which allows leap seconds (second == 60). So we accept leap seconds and validate, if the date is one of the currently known 27 leap second dates.
However, trying to convert a date/time value containing a
leap second to SystemTime will fail with Err(InvalidEncoding).
Implements TryFrom<SystemTime> and TryFrom<&str>, so that
Value::date_time can accept both through a single
TryInto<DateTime> bound.