#[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 moreSource§impl Debug for RfcTimestamp
impl Debug for RfcTimestamp
Source§impl<'de> Deserialize<'de> for RfcTimestamp
impl<'de> Deserialize<'de> for RfcTimestamp
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for RfcTimestamp
impl Display for RfcTimestamp
Source§impl From<DateTime<FixedOffset>> for RfcTimestamp
impl From<DateTime<FixedOffset>> for RfcTimestamp
Source§fn from(value: DateTime<FixedOffset>) -> Self
fn from(value: DateTime<FixedOffset>) -> Self
Source§impl Hash for RfcTimestamp
impl Hash for RfcTimestamp
Source§impl Ord for RfcTimestamp
impl Ord for RfcTimestamp
Source§fn cmp(&self, other: &RfcTimestamp) -> Ordering
fn cmp(&self, other: &RfcTimestamp) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for RfcTimestamp
impl PartialEq for RfcTimestamp
Source§fn eq(&self, other: &RfcTimestamp) -> bool
fn eq(&self, other: &RfcTimestamp) -> bool
self and other values to be equal, and is used by ==.