Skip to main content

AuthTimestamp

Trait AuthTimestamp 

Source
pub trait AuthTimestamp: Sized {
    type UtcValue;

    // Required methods
    fn from_utc(value: Self::UtcValue) -> Self;
    fn into_utc(self) -> Self::UtcValue;
}
Expand description

Conversion between an application timestamp field and the auth UTC clock.

NaiveDateTime fields represent UTC wall-clock values, never local time. The optional implementation preserves typed absence in model mutations.

Required Associated Types§

Source

type UtcValue

The core timestamp shape (DateTime<Utc> or its optional form).

Required Methods§

Source

fn from_utc(value: Self::UtcValue) -> Self

Convert a core UTC timestamp into the model representation.

Source

fn into_utc(self) -> Self::UtcValue

Interpret the model timestamp on the core UTC clock.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AuthTimestamp for NaiveDateTime

Source§

type UtcValue = DateTime<Utc>

Source§

fn from_utc(value: Self::UtcValue) -> Self

Source§

fn into_utc(self) -> Self::UtcValue

Source§

impl<T: AuthTimestamp> AuthTimestamp for Option<T>

Source§

type UtcValue = Option<<T as AuthTimestamp>::UtcValue>

Source§

fn from_utc(value: Self::UtcValue) -> Self

Source§

fn into_utc(self) -> Self::UtcValue

Source§

impl<Tz: TimeZone> AuthTimestamp for DateTime<Tz>
where Self: From<DateTime<Utc>>,

Source§

type UtcValue = DateTime<Utc>

Source§

fn from_utc(value: Self::UtcValue) -> Self

Source§

fn into_utc(self) -> Self::UtcValue

Implementors§