Struct eva_common::time::Time
source · pub struct Time { /* private fields */ }Expand description
Time
Serialized as f64 Deserialized from unsigned integers (seconds), floats, [sec, nsec] seqs
With “db” feature provides sqlx interfaces for Sqlite (stored as nanoseconds integer) and Postgres (stored as TIMESTAMP/TIMESTAMPTZ)
Implementations§
source§impl Time
impl Time
pub fn try_into_naivedatetime(self) -> EResult<NaiveDateTime>
pub fn try_into_datetime_local(self) -> EResult<DateTime<Local>>
pub fn try_into_datetime_utc(self) -> EResult<DateTime<Utc>>
source§impl Time
impl Time
pub fn new(sec: u64, nsec: u64) -> Self
sourcepub fn now_monotonic() -> Self
pub fn now_monotonic() -> Self
§Panics
Will panic if the system monotonic clock is not available
pub fn from_timestamp_ns(timestamp_ns: u64) -> Self
pub fn from_timestamp_us(timestamp_us: u64) -> Self
pub fn from_timestamp_ms(timestamp_ms: u64) -> Self
pub fn from_timestamp(timestamp: f64) -> Self
pub fn timestamp(&self) -> f64
pub fn timestamp_sec(&self) -> u64
pub fn timestamp_ns(&self) -> u64
pub fn timestamp_us(&self) -> u64
pub fn timestamp_ms(&self) -> u64
Trait Implementations§
source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
source§fn deserialize<D>(deserializer: D) -> Result<Time, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Time, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Encode<'_, Postgres> for Time
impl Encode<'_, Postgres> for Time
source§fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
fn size_hint(&self) -> usize
§fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
Writes the value of
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
source§impl<'q> Encode<'q, Sqlite> for Time
impl<'q> Encode<'q, Sqlite> for Time
source§fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull
fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull
§fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere
Self: Sized,
Writes the value of
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
source§impl From<NaiveDateTime> for Time
impl From<NaiveDateTime> for Time
source§fn from(datetime: NaiveDateTime) -> Self
fn from(datetime: NaiveDateTime) -> Self
Converts to this type from the input type.
source§impl PartialEq for Time
impl PartialEq for Time
source§impl TryFrom<SystemTime> for Time
impl TryFrom<SystemTime> for Time
source§impl TryFrom<Time> for NaiveDateTime
impl TryFrom<Time> for NaiveDateTime
impl Copy for Time
impl Eq for Time
impl StructuralEq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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.