pub struct Timestamp(/* private fields */);Expand description
A timestamp
Implementations§
Source§impl Timestamp
impl Timestamp
pub const fn new(inner: OffsetDateTime) -> Self
pub const fn to_inner(self) -> OffsetDateTime
pub const fn to_utc(self) -> Self
Sourcepub fn now() -> Self
pub fn now() -> Self
Current system time with offset
Tries to obtain the current system time with the local time zone offset. Returns an UTC timestamp as a fallback if the local time zone is unknown or could not be determined.
Prefer to use Self::now_utc() if the local time zone offset doesn’t
matter.
pub fn parse_rfc3339(input: &str) -> Result<Self, Parse>
pub fn format_rfc3339(&self) -> Result<String, Format>
pub fn format_rfc3339_into<W: Write>( &self, output: &mut W, ) -> Result<usize, Format>
Methods from Deref<Target = OffsetDateTime>§
pub const UNIX_EPOCH: OffsetDateTime
Trait Implementations§
Source§impl AddAssign<Interval> for Timestamp
impl AddAssign<Interval> for Timestamp
Source§fn add_assign(&mut self, interval: Interval)
fn add_assign(&mut self, interval: Interval)
Performs the
+= operation. Read moreSource§impl AsRef<OffsetDateTime> for Timestamp
impl AsRef<OffsetDateTime> for Timestamp
Source§fn as_ref(&self) -> &OffsetDateTime
fn as_ref(&self) -> &OffsetDateTime
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Deref for Timestamp
impl Deref for Timestamp
Source§type Target = OffsetDateTime
type Target = OffsetDateTime
The resulting type after dereferencing.
Source§fn deref(&self) -> &OffsetDateTime
fn deref(&self) -> &OffsetDateTime
Dereferences the value.
Source§impl From<OffsetDateTime> for Timestamp
impl From<OffsetDateTime> for Timestamp
Source§fn from(inner: OffsetDateTime) -> Self
fn from(inner: OffsetDateTime) -> Self
Converts to this type from the input type.
Source§impl From<SystemTime> for Timestamp
impl From<SystemTime> for Timestamp
Source§fn from(system_time: SystemTime) -> Self
fn from(system_time: SystemTime) -> Self
Converts to this type from the input type.
Source§impl From<Timestamp> for OffsetDateTime
impl From<Timestamp> for OffsetDateTime
Source§impl From<Timestamp> for SystemTime
impl From<Timestamp> for SystemTime
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
Source§impl SubAssign<Interval> for Timestamp
impl SubAssign<Interval> for Timestamp
Source§fn sub_assign(&mut self, interval: Interval)
fn sub_assign(&mut self, interval: Interval)
Performs the
-= operation. Read moreimpl 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