Struct catenis_api_client::UtcDateTime
source · pub struct UtcDateTime { /* private fields */ }
Expand description
Represents a date and time in reference to the UTC timezone.
This should be used for manipulating date and time data received from/sent to the Catenis API.
Examples
Converting from and to string.
use catenis_api_client::{
UtcDateTime,
};
let date_time: UtcDateTime = "2020-12-29T10:49:25Z".into();
assert_eq!(date_time.to_string(), "2020-12-29T10:49:25.000Z");
Converting from and to time
crate’s data structures.
use time::OffsetDateTime;
use catenis_api_client::{
UtcDateTime,
};
// Date
let date = time::date!(2020-12-29);
let date_time: UtcDateTime = date.into();
assert_eq!(date_time.to_string(), "2020-12-29T00:00:00.000Z");
// PrimitiveDateTime
let primitive_date_time = time::date!(2020-12-29).with_time(time::time!(10:49:25));
let date_time: UtcDateTime = primitive_date_time.into();
assert_eq!(date_time.to_string(), "2020-12-29T10:49:25.000Z");
// OffsetDateTime
let offset_date_time = time::date!(2020-12-29).with_time(time::time!(10:49:25)).assume_utc();
let date_time: UtcDateTime = offset_date_time.into();
assert_eq!(date_time.to_string(), "2020-12-29T10:49:25.000Z");
let offset_date_time_2: OffsetDateTime = date_time.into();
assert_eq!(offset_date_time_2, offset_date_time);
Implementations
sourceimpl UtcDateTime
impl UtcDateTime
Trait Implementations
sourceimpl AsRef<OffsetDateTime> for UtcDateTime
impl AsRef<OffsetDateTime> for UtcDateTime
sourcefn as_ref(&self) -> &OffsetDateTime
fn as_ref(&self) -> &OffsetDateTime
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for UtcDateTime
impl Clone for UtcDateTime
sourcefn clone(&self) -> UtcDateTime
fn clone(&self) -> UtcDateTime
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for UtcDateTime
impl Debug for UtcDateTime
sourceimpl<'de> Deserialize<'de> for UtcDateTime
impl<'de> Deserialize<'de> for UtcDateTime
sourcefn deserialize<D>(deserializer: D) -> Result<UtcDateTime, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<UtcDateTime, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for UtcDateTime
impl Display for UtcDateTime
sourceimpl Into<OffsetDateTime> for UtcDateTime
impl Into<OffsetDateTime> for UtcDateTime
sourcefn into(self) -> OffsetDateTime
fn into(self) -> OffsetDateTime
Converts this type into the (usually inferred) input type.
sourceimpl Into<UtcDateTime> for &str
impl Into<UtcDateTime> for &str
sourcefn into(self) -> UtcDateTime
fn into(self) -> UtcDateTime
Converts this type into the (usually inferred) input type.
sourceimpl Into<UtcDateTime> for Date
impl Into<UtcDateTime> for Date
sourcefn into(self) -> UtcDateTime
fn into(self) -> UtcDateTime
Converts this type into the (usually inferred) input type.
sourceimpl Into<UtcDateTime> for OffsetDateTime
impl Into<UtcDateTime> for OffsetDateTime
sourcefn into(self) -> UtcDateTime
fn into(self) -> UtcDateTime
Converts this type into the (usually inferred) input type.
sourceimpl Into<UtcDateTime> for PrimitiveDateTime
impl Into<UtcDateTime> for PrimitiveDateTime
sourcefn into(self) -> UtcDateTime
fn into(self) -> UtcDateTime
Converts this type into the (usually inferred) input type.
sourceimpl PartialEq<UtcDateTime> for UtcDateTime
impl PartialEq<UtcDateTime> for UtcDateTime
sourcefn eq(&self, other: &UtcDateTime) -> bool
fn eq(&self, other: &UtcDateTime) -> bool
sourceimpl Serialize for UtcDateTime
impl Serialize for UtcDateTime
impl Copy for UtcDateTime
impl Eq for UtcDateTime
impl StructuralEq for UtcDateTime
impl StructuralPartialEq for UtcDateTime
Auto Trait Implementations
impl RefUnwindSafe for UtcDateTime
impl Send for UtcDateTime
impl Sync for UtcDateTime
impl Unpin for UtcDateTime
impl UnwindSafe for UtcDateTime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.