Struct mitrid_core::utils::timestamp::timestamp::Timestamp [−][src]
pub struct Timestamp(_);
Type representing a numerical timestamp. The 0 is set to the Unix Epoch Time, 01-01-1970.
Methods
impl Timestamp
[src]
impl Timestamp
pub fn new(tmstmp: u64) -> Timestamp
[src]
pub fn new(tmstmp: u64) -> Timestamp
Creates a new timestamp.
pub fn from_u64(tmsmp: u64) -> Timestamp
[src]
pub fn from_u64(tmsmp: u64) -> Timestamp
Creates a new timestamp from an u64
.
pub fn from_unix_epoch_duration(dur: Duration) -> Timestamp
[src]
pub fn from_unix_epoch_duration(dur: Duration) -> Timestamp
Creates a new timestamp from a Duration
starting at the Unix Epoch Time (01-01-1970).
pub fn from_millis(millis: u64) -> Timestamp
[src]
pub fn from_millis(millis: u64) -> Timestamp
Creates a new timestamp from milliseconds.
pub fn from_secs(secs: u64) -> Timestamp
[src]
pub fn from_secs(secs: u64) -> Timestamp
Creates a new timestamp from seconds.
pub fn as_duration(&self) -> Duration
[src]
pub fn as_duration(&self) -> Duration
Converts the Timestamp
to a Duration
.
pub fn as_diff(&self) -> TimestampDiff
[src]
pub fn as_diff(&self) -> TimestampDiff
Converts the Timestamp
to a TimestampDiff
.
pub fn as_u64(&self) -> u64
[src]
pub fn as_u64(&self) -> u64
Converts the Timestamp
to u64
.
pub fn as_millis(&self) -> u64
[src]
pub fn as_millis(&self) -> u64
Converts the Timestamp
to milliseconds.
pub fn as_secs(&self) -> u64
[src]
pub fn as_secs(&self) -> u64
Converts the Timestamp
to seconds.
pub fn now() -> Result<Timestamp>
[src]
pub fn now() -> Result<Timestamp>
Returns the current time timestamp.
Trait Implementations
impl Copy for Timestamp
[src]
impl Copy for Timestamp
impl Clone for Timestamp
[src]
impl Clone for Timestamp
fn clone(&self) -> Timestamp
[src]
fn clone(&self) -> Timestamp
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for Timestamp
[src]
impl Eq for Timestamp
impl PartialEq for Timestamp
[src]
impl PartialEq for Timestamp
fn eq(&self, other: &Timestamp) -> bool
[src]
fn eq(&self, other: &Timestamp) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Timestamp) -> bool
[src]
fn ne(&self, other: &Timestamp) -> bool
This method tests for !=
.
impl Ord for Timestamp
[src]
impl Ord for Timestamp
fn cmp(&self, other: &Timestamp) -> Ordering
[src]
fn cmp(&self, other: &Timestamp) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for Timestamp
[src]
impl PartialOrd for Timestamp
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Timestamp) -> bool
[src]
fn lt(&self, other: &Timestamp) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Timestamp) -> bool
[src]
fn le(&self, other: &Timestamp) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Timestamp) -> bool
[src]
fn gt(&self, other: &Timestamp) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Timestamp) -> bool
[src]
fn ge(&self, other: &Timestamp) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Timestamp
[src]
impl Debug for Timestamp
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Hash for Timestamp
[src]
impl Hash for Timestamp
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for Timestamp
[src]
impl Default for Timestamp
impl Add<TimestampDiff> for Timestamp
[src]
impl Add<TimestampDiff> for Timestamp
type Output = Timestamp
The resulting type after applying the +
operator.
fn add(self, other: TimestampDiff) -> Timestamp
[src]
fn add(self, other: TimestampDiff) -> Timestamp
Performs the +
operation.
impl<'a> Add<TimestampDiff> for &'a Timestamp
[src]
impl<'a> Add<TimestampDiff> for &'a Timestamp
type Output = Timestamp
The resulting type after applying the +
operator.
fn add(self, other: TimestampDiff) -> Timestamp
[src]
fn add(self, other: TimestampDiff) -> Timestamp
Performs the +
operation.
impl<'a> Add<&'a TimestampDiff> for Timestamp
[src]
impl<'a> Add<&'a TimestampDiff> for Timestamp
type Output = Timestamp
The resulting type after applying the +
operator.
fn add(self, other: &'a TimestampDiff) -> Timestamp
[src]
fn add(self, other: &'a TimestampDiff) -> Timestamp
Performs the +
operation.
impl AddAssign<TimestampDiff> for Timestamp
[src]
impl AddAssign<TimestampDiff> for Timestamp
fn add_assign(&mut self, other: TimestampDiff)
[src]
fn add_assign(&mut self, other: TimestampDiff)
Performs the +=
operation.
impl<'a> AddAssign<&'a TimestampDiff> for Timestamp
[src]
impl<'a> AddAssign<&'a TimestampDiff> for Timestamp
fn add_assign(&mut self, other: &'a TimestampDiff)
[src]
fn add_assign(&mut self, other: &'a TimestampDiff)
Performs the +=
operation.
impl<'a, 'b> AddAssign<&'b TimestampDiff> for &'a mut Timestamp
[src]
impl<'a, 'b> AddAssign<&'b TimestampDiff> for &'a mut Timestamp
fn add_assign(&mut self, other: &'b TimestampDiff)
[src]
fn add_assign(&mut self, other: &'b TimestampDiff)
Performs the +=
operation.
impl Sub<Timestamp> for Timestamp
[src]
impl Sub<Timestamp> for Timestamp
type Output = TimestampDiff
The resulting type after applying the -
operator.
fn sub(self, other: Timestamp) -> TimestampDiff
[src]
fn sub(self, other: Timestamp) -> TimestampDiff
Performs the -
operation.
impl<'a> Sub<Timestamp> for &'a Timestamp
[src]
impl<'a> Sub<Timestamp> for &'a Timestamp
type Output = TimestampDiff
The resulting type after applying the -
operator.
fn sub(self, other: Timestamp) -> TimestampDiff
[src]
fn sub(self, other: Timestamp) -> TimestampDiff
Performs the -
operation.
impl<'a> Sub<&'a Timestamp> for Timestamp
[src]
impl<'a> Sub<&'a Timestamp> for Timestamp
type Output = TimestampDiff
The resulting type after applying the -
operator.
fn sub(self, other: &'a Timestamp) -> TimestampDiff
[src]
fn sub(self, other: &'a Timestamp) -> TimestampDiff
Performs the -
operation.
impl Mul<u64> for Timestamp
[src]
impl Mul<u64> for Timestamp
type Output = Timestamp
The resulting type after applying the *
operator.
fn mul(self, multiplier: u64) -> Timestamp
[src]
fn mul(self, multiplier: u64) -> Timestamp
Performs the *
operation.
impl<'a> Mul<u64> for &'a Timestamp
[src]
impl<'a> Mul<u64> for &'a Timestamp
type Output = Timestamp
The resulting type after applying the *
operator.
fn mul(self, multiplier: u64) -> Timestamp
[src]
fn mul(self, multiplier: u64) -> Timestamp
Performs the *
operation.
impl<'a> Mul<&'a u64> for Timestamp
[src]
impl<'a> Mul<&'a u64> for Timestamp
type Output = Timestamp
The resulting type after applying the *
operator.
fn mul(self, multiplier: &'a u64) -> Timestamp
[src]
fn mul(self, multiplier: &'a u64) -> Timestamp
Performs the *
operation.
impl MulAssign<u64> for Timestamp
[src]
impl MulAssign<u64> for Timestamp
fn mul_assign(&mut self, multiplier: u64)
[src]
fn mul_assign(&mut self, multiplier: u64)
Performs the *=
operation.
impl<'a> MulAssign<&'a u64> for Timestamp
[src]
impl<'a> MulAssign<&'a u64> for Timestamp
fn mul_assign(&mut self, multiplier: &'a u64)
[src]
fn mul_assign(&mut self, multiplier: &'a u64)
Performs the *=
operation.
impl<'a, 'b> MulAssign<&'b u64> for &'a mut Timestamp
[src]
impl<'a, 'b> MulAssign<&'b u64> for &'a mut Timestamp
fn mul_assign(&mut self, multiplier: &'b u64)
[src]
fn mul_assign(&mut self, multiplier: &'b u64)
Performs the *=
operation.
impl Div for Timestamp
[src]
impl Div for Timestamp
type Output = u64
The resulting type after applying the /
operator.
fn div(self, other: Timestamp) -> u64
[src]
fn div(self, other: Timestamp) -> u64
Performs the /
operation.
impl<'a> Div for &'a Timestamp
[src]
impl<'a> Div for &'a Timestamp
type Output = u64
The resulting type after applying the /
operator.
fn div(self, other: &'a Timestamp) -> u64
[src]
fn div(self, other: &'a Timestamp) -> u64
Performs the /
operation.
impl<'a> Div<&'a Timestamp> for Timestamp
[src]
impl<'a> Div<&'a Timestamp> for Timestamp
type Output = u64
The resulting type after applying the /
operator.
fn div(self, other: &'a Timestamp) -> u64
[src]
fn div(self, other: &'a Timestamp) -> u64
Performs the /
operation.
impl Rem for Timestamp
[src]
impl Rem for Timestamp
type Output = u64
The resulting type after applying the %
operator.
fn rem(self, other: Timestamp) -> u64
[src]
fn rem(self, other: Timestamp) -> u64
Performs the %
operation.
impl<'a> Rem for &'a Timestamp
[src]
impl<'a> Rem for &'a Timestamp
type Output = u64
The resulting type after applying the %
operator.
fn rem(self, other: &'a Timestamp) -> u64
[src]
fn rem(self, other: &'a Timestamp) -> u64
Performs the %
operation.
impl<'a> Rem<&'a Timestamp> for Timestamp
[src]
impl<'a> Rem<&'a Timestamp> for Timestamp
type Output = u64
The resulting type after applying the %
operator.
fn rem(self, other: &'a Timestamp) -> u64
[src]
fn rem(self, other: &'a Timestamp) -> u64
Performs the %
operation.
impl Sizable for Timestamp
[src]
impl Sizable for Timestamp
impl Checkable for Timestamp
[src]
impl Checkable for Timestamp
fn check(&self) -> Result<()>
[src]
fn check(&self) -> Result<()>
Checks the implementor.
fn check_async(&self) -> Future<()>
[src]
fn check_async(&self) -> Future<()>
Check asynchronously the implementor.
impl Datable for Timestamp
[src]
impl Datable for Timestamp
impl Serializable for Timestamp
[src]
impl Serializable for Timestamp
fn to_json(&self) -> Result<String>
[src]
fn to_json(&self) -> Result<String>
Serializes the implementor into a json string.
fn from_json(s: &str) -> Result<Self>
[src]
fn from_json(s: &str) -> Result<Self>
Deserializes a json string into the implementor type.
fn to_bytes(&self) -> Result<Vec<u8>>
[src]
fn to_bytes(&self) -> Result<Vec<u8>>
Serializes the implementor into a byte vector.
fn from_bytes(b: &[u8]) -> Result<Self>
[src]
fn from_bytes(b: &[u8]) -> Result<Self>
Deserializes a byte vector into the implementor type.
fn to_hex(&self) -> Result<String>
[src]
fn to_hex(&self) -> Result<String>
Serializes the implementor into a hex string.
fn from_hex(s: &str) -> Result<Self>
[src]
fn from_hex(s: &str) -> Result<Self>
Deserializes an hex string into the implementor type.