pub struct ServerTimestamp(pub i64);
Expand description
Typesafe way to manage server timestamps without accidentally mixing them up with local ones.
Tuple Fields§
§0: i64
Implementations§
source§impl ServerTimestamp
impl ServerTimestamp
pub fn from_float_seconds(ts: f64) -> Self
pub fn from_millis(ts: i64) -> Self
source§impl ServerTimestamp
impl ServerTimestamp
pub const EPOCH: ServerTimestamp = _
sourcepub fn duration_since(self, other: ServerTimestamp) -> Option<Duration>
pub fn duration_since(self, other: ServerTimestamp) -> Option<Duration>
Returns None if other
is later than self
(Duration may not represent
negative timespans in rust).
Trait Implementations§
source§impl Clone for ServerTimestamp
impl Clone for ServerTimestamp
source§fn clone(&self) -> ServerTimestamp
fn clone(&self) -> ServerTimestamp
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ServerTimestamp
impl Debug for ServerTimestamp
source§impl Default for ServerTimestamp
impl Default for ServerTimestamp
source§fn default() -> ServerTimestamp
fn default() -> ServerTimestamp
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ServerTimestamp
impl<'de> Deserialize<'de> for ServerTimestamp
source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for ServerTimestamp
impl Display for ServerTimestamp
source§impl FromStr for ServerTimestamp
impl FromStr for ServerTimestamp
source§impl PartialEq for ServerTimestamp
impl PartialEq for ServerTimestamp
source§impl PartialOrd for ServerTimestamp
impl PartialOrd for ServerTimestamp
source§impl Serialize for ServerTimestamp
impl Serialize for ServerTimestamp
source§impl TryFrom<SystemTime> for ServerTimestamp
impl TryFrom<SystemTime> for ServerTimestamp
Exposed only for tests that need to create a server timestamp from the system time Please be cautious when constructing the timestamp directly, as constructing the server timestamp from system time is almost certainly not what you’d want to do for non-test code
source§type Error = SystemTimeError
type Error = SystemTimeError
The type returned in the event of a conversion error.
impl Copy for ServerTimestamp
impl Eq for ServerTimestamp
impl StructuralPartialEq for ServerTimestamp
Auto Trait Implementations§
impl Freeze for ServerTimestamp
impl RefUnwindSafe for ServerTimestamp
impl Send for ServerTimestamp
impl Sync for ServerTimestamp
impl Unpin for ServerTimestamp
impl UnwindSafe for ServerTimestamp
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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.§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<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more