#[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 moreimpl Copy for RfcTimestamp
Source§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
impl Eq 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§impl PartialOrd for RfcTimestamp
impl PartialOrd for RfcTimestamp
Source§impl Serialize for RfcTimestamp
impl Serialize for RfcTimestamp
impl StructuralPartialEq for RfcTimestamp
Auto Trait Implementations§
impl Freeze for RfcTimestamp
impl RefUnwindSafe for RfcTimestamp
impl Send for RfcTimestamp
impl Sync for RfcTimestamp
impl Unpin for RfcTimestamp
impl UnsafeUnpin for RfcTimestamp
impl UnwindSafe for RfcTimestamp
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.