pub struct Timestamp(/* private fields */);
Expand description
A primitive unix timestamp without time zone.
We assume that all timestamps must be specified in the UTC time zone.
Implementations§
Source§impl Timestamp
impl Timestamp
pub fn now() -> Self
pub fn try_from_secs(seconds: i64) -> Result<Self, OutOfRangeError>
pub fn from_secs(seconds: i64) -> Self
👎Deprecated
pub fn try_from_millis(milliseconds: i64) -> Result<Self, OutOfRangeError>
pub fn from_millis(milliseconds: i64) -> Self
👎Deprecated
pub fn as_secs(self) -> i64
pub fn as_millis(self) -> i64
pub fn format(&self, fmt: &[FormatItem<'_>]) -> String
pub fn checked_sub(self, duration: Duration) -> Option<Self>
Trait Implementations§
Source§impl From<PrimitiveDateTime> for Timestamp
impl From<PrimitiveDateTime> for Timestamp
Source§fn from(ts: PrimitiveDateTime) -> Self
fn from(ts: PrimitiveDateTime) -> Self
Converts to this type from the input type.
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl Copy for Timestamp
impl Eq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more