pub struct Datetime { /* private fields */ }Expand description
AT Protocol datetime (ISO 8601 with specific requirements)
Lexicon datetimes use ISO 8601 format with these requirements:
- Must include timezone (strongly prefer UTC with ‘Z’)
- Requires whole seconds precision minimum
- Supports millisecond and microsecond precision
- Uses uppercase ‘T’ to separate date and time
Examples: "1985-04-12T23:20:50.123Z", "2023-01-01T00:00:00+00:00"
The serialized form is preserved during parsing to ensure exact round-trip serialization.
Implementations§
Source§impl Datetime
impl Datetime
Sourcepub fn now() -> Self
pub fn now() -> Self
Returns a Datetime which corresponds to the current date and time in UTC.
The timestamp uses microsecond precision.
Sourcepub fn new(dt: DateTime<FixedOffset>) -> Self
pub fn new(dt: DateTime<FixedOffset>) -> Self
Constructs a new Lexicon timestamp.
The timestamp is rounded to microsecond precision.
Trait Implementations§
Source§impl AsRef<DateTime<FixedOffset>> for Datetime
impl AsRef<DateTime<FixedOffset>> for Datetime
Source§fn as_ref(&self) -> &DateTime<FixedOffset>
fn as_ref(&self) -> &DateTime<FixedOffset>
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'de> Deserialize<'de> for Datetime
impl<'de> Deserialize<'de> for Datetime
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<DateTime<FixedOffset>> for Datetime
impl From<DateTime<FixedOffset>> for Datetime
Source§fn from(dt: DateTime<FixedOffset>) -> Self
fn from(dt: DateTime<FixedOffset>) -> Self
Converts to this type from the input type.
Source§impl IntoStatic for Datetime
impl IntoStatic for Datetime
Source§impl Ord for Datetime
impl Ord for Datetime
Source§impl PartialOrd for Datetime
impl PartialOrd for Datetime
impl Eq for Datetime
Auto Trait Implementations§
impl Freeze for Datetime
impl RefUnwindSafe for Datetime
impl Send for Datetime
impl Sync for Datetime
impl Unpin for Datetime
impl UnwindSafe for Datetime
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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
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
Compare self to
key and return true if they are equal.