pub struct Timestamp(/* private fields */);
Expand description
Timestamp measured in seconds past the epoch.
Clients should only accept round multiples of 86400 to avoid fingerprinting by the server. For expirations, the timestamp should be within a couple of days into the future; for redemption times, it should be within a day of the current date.
Implementations§
Source§impl Timestamp
impl Timestamp
pub const fn from_epoch_seconds(seconds: u64) -> Self
pub const fn epoch_seconds(&self) -> u64
pub const fn add_seconds(&self, seconds: u64) -> Self
pub const fn sub_seconds(&self, seconds: u64) -> Self
pub fn checked_add_seconds(&self, seconds: u64) -> Option<Self>
pub fn checked_sub_seconds(&self, seconds: u64) -> Option<Self>
pub const fn is_day_aligned(&self) -> bool
pub fn to_be_bytes(self) -> [u8; 8]
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
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 Distribution<Timestamp> for Standard
impl Distribution<Timestamp> for Standard
Source§impl From<Timestamp> for SystemTime
impl From<Timestamp> for SystemTime
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialDefault for Timestamp
impl PartialDefault for Timestamp
Source§fn partial_default() -> Self
fn partial_default() -> Self
Returns a value that can be safely dropped or assigned over.
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