#[non_exhaustive]pub struct RfcTimestamp(/* private fields */);Expand description
RFC 3339 timestamp, parsed at deserialization time.
Use this for any public field that needs to carry an RFC 3339 timestamp from
TOML/JSON config or builder APIs. Construction is fallible (parse); once
constructed the value is guaranteed to be a real RFC 3339 timestamp with a
known offset, so downstream code does not need to handle parse errors.
Wraps chrono::DateTime<chrono::FixedOffset>; the underlying value is
available via Self::as_datetime or Self::into_inner. Serialize
emits the canonical RFC 3339 form via chrono::DateTime::to_rfc3339, so
the on-the-wire format for ApiKeySummary (admin endpoints) is unchanged.
Implementations§
Source§impl RfcTimestamp
impl RfcTimestamp
Sourcepub fn parse(s: &str) -> Result<Self, ParseError>
pub fn parse(s: &str) -> Result<Self, ParseError>
Parse an RFC 3339 timestamp.
§Errors
Returns the underlying chrono::ParseError when s is not a valid
RFC 3339 timestamp (e.g. missing the T separator, missing the offset
suffix, or out-of-range fields).
Sourcepub fn as_datetime(&self) -> &DateTime<FixedOffset>
pub fn as_datetime(&self) -> &DateTime<FixedOffset>
Borrow the underlying chrono::DateTime.
Sourcepub fn into_inner(self) -> DateTime<FixedOffset>
pub fn into_inner(self) -> DateTime<FixedOffset>
Consume the wrapper and return the underlying chrono::DateTime.
Trait Implementations§
Source§impl Clone for RfcTimestamp
impl Clone for RfcTimestamp
Source§fn clone(&self) -> RfcTimestamp
fn clone(&self) -> RfcTimestamp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more