pub struct IggyTimestamp(/* private fields */);Expand description
A struct that represents a timestamp.
This struct uses SystemTime from std::time crate.
§Example
use iggy_common::IggyTimestamp;
let timestamp = IggyTimestamp::from(1694968446131680);
assert_eq!(timestamp.to_utc_string("%Y-%m-%d %H:%M:%S"), "2023-09-17 16:34:06");
assert_eq!(timestamp.as_micros(), 1694968446131680);Implementations§
Source§impl IggyTimestamp
impl IggyTimestamp
pub fn now() -> Self
pub fn zero() -> Self
pub fn to_secs(&self) -> u64
pub fn as_micros(&self) -> u64
pub fn as_millis(&self) -> u64
pub fn as_nanos(&self) -> u128
pub fn to_rfc3339_string(&self) -> String
pub fn to_utc_string(&self, format: &str) -> String
pub fn to_local_string(&self, format: &str) -> String
Trait Implementations§
Source§impl Add<IggyDuration> for IggyTimestamp
impl Add<IggyDuration> for IggyTimestamp
Source§type Output = IggyTimestamp
type Output = IggyTimestamp
The resulting type after applying the
+ operator.Source§impl Add<SystemTime> for IggyTimestamp
impl Add<SystemTime> for IggyTimestamp
Source§type Output = IggyTimestamp
type Output = IggyTimestamp
The resulting type after applying the
+ operator.Source§fn add(self, other: SystemTime) -> IggyTimestamp
fn add(self, other: SystemTime) -> IggyTimestamp
Performs the
+ operation. Read moreSource§impl Clone for IggyTimestamp
impl Clone for IggyTimestamp
Source§fn clone(&self) -> IggyTimestamp
fn clone(&self) -> IggyTimestamp
Returns a duplicate 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 IggyTimestamp
impl Debug for IggyTimestamp
Source§impl Default for IggyTimestamp
impl Default for IggyTimestamp
Source§impl<'de> Deserialize<'de> for IggyTimestamp
impl<'de> Deserialize<'de> for IggyTimestamp
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 Display for IggyTimestamp
impl Display for IggyTimestamp
Source§impl From<IggyTimestamp> for u64
impl From<IggyTimestamp> for u64
Source§fn from(timestamp: IggyTimestamp) -> u64
fn from(timestamp: IggyTimestamp) -> u64
Converts to this type from the input type.
Source§impl From<SystemTime> for IggyTimestamp
impl From<SystemTime> for IggyTimestamp
Source§fn from(timestamp: SystemTime) -> Self
fn from(timestamp: SystemTime) -> Self
Converts to this type from the input type.
Source§impl From<u64> for IggyTimestamp
impl From<u64> for IggyTimestamp
Source§impl PartialEq for IggyTimestamp
impl PartialEq for IggyTimestamp
Source§impl Serialize for IggyTimestamp
impl Serialize for IggyTimestamp
Source§impl Sub<SystemTime> for IggyTimestamp
impl Sub<SystemTime> for IggyTimestamp
Source§type Output = IggyTimestamp
type Output = IggyTimestamp
The resulting type after applying the
- operator.Source§impl Sub for IggyTimestamp
impl Sub for IggyTimestamp
impl Copy for IggyTimestamp
impl Eq for IggyTimestamp
impl StructuralPartialEq for IggyTimestamp
Auto Trait Implementations§
impl Freeze for IggyTimestamp
impl RefUnwindSafe for IggyTimestamp
impl Send for IggyTimestamp
impl Sync for IggyTimestamp
impl Unpin for IggyTimestamp
impl UnsafeUnpin for IggyTimestamp
impl UnwindSafe for IggyTimestamp
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<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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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