pub struct TimeDuration { /* private fields */ }Expand description
A span or delta in time, measured in microseconds.
Analogous to std::time::Duration, and to C#’s TimeSpan.
Name chosen to avoid ambiguity with either of those types.
Unlike Duration, but like C#’s TimeSpan,
TimeDuration can represent negative values.
It also offers less range than Duration, so conversions in both directions may fail.
Implementations§
Source§impl TimeDuration
impl TimeDuration
pub const ZERO: TimeDuration
Sourcepub fn from_micros(micros: i64) -> TimeDuration
pub fn from_micros(micros: i64) -> TimeDuration
Construct a TimeDuration which is micros microseconds.
A positive value means a time after the Unix epoch, and a negative value means a time before.
Sourcepub fn to_duration(self) -> Result<Duration, Duration>
pub fn to_duration(self) -> Result<Duration, Duration>
Returns Err(abs(self) as Duration) if self is negative.
Sourcepub fn to_duration_abs(self) -> Duration
pub fn to_duration_abs(self) -> Duration
Returns a Duration representing the absolute magnitude of self.
Regardless of whether self is positive or negative, the returned Duration is positive.
Sourcepub fn from_duration(duration: Duration) -> TimeDuration
pub fn from_duration(duration: Duration) -> TimeDuration
Return a TimeDuration which represents the same span as duration.
Panics if duration.as_micros overflows an i64
Trait Implementations§
Source§impl Add<TimeDuration> for Timestamp
impl Add<TimeDuration> for Timestamp
Source§impl Clone for TimeDuration
impl Clone for TimeDuration
Source§fn clone(&self) -> TimeDuration
fn clone(&self) -> TimeDuration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimeDuration
impl Debug for TimeDuration
Source§impl<'de> Deserialize<'de> for TimeDuration
impl<'de> Deserialize<'de> for TimeDuration
Source§fn deserialize<D>(
deserializer: D,
) -> Result<TimeDuration, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<TimeDuration, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
deserializer.Source§impl Display for TimeDuration
impl Display for TimeDuration
Source§impl From<Duration> for TimeDuration
impl From<Duration> for TimeDuration
Source§fn from(d: Duration) -> TimeDuration
fn from(d: Duration) -> TimeDuration
Source§impl From<TimeDuration> for ScheduleAt
impl From<TimeDuration> for ScheduleAt
Source§fn from(value: TimeDuration) -> Self
fn from(value: TimeDuration) -> Self
Source§impl GroundSpacetimeType for TimeDuration
impl GroundSpacetimeType for TimeDuration
Source§fn get_type() -> AlgebraicType
fn get_type() -> AlgebraicType
AlgebraicType representation of Self.Source§impl Hash for TimeDuration
impl Hash for TimeDuration
Source§impl Ord for TimeDuration
impl Ord for TimeDuration
Source§fn cmp(&self, other: &TimeDuration) -> Ordering
fn cmp(&self, other: &TimeDuration) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for TimeDuration
impl PartialEq for TimeDuration
Source§impl PartialOrd for TimeDuration
impl PartialOrd for TimeDuration
Source§impl Serialize for TimeDuration
impl Serialize for TimeDuration
Source§fn serialize<S>(
&self,
__serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
__serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
self in the data format of S using the provided serializer.Source§impl SpacetimeType for TimeDuration
impl SpacetimeType for TimeDuration
Source§fn make_type<S>(_ts: &mut S) -> AlgebraicTypewhere
S: TypespaceBuilder,
fn make_type<S>(_ts: &mut S) -> AlgebraicTypewhere
S: TypespaceBuilder,
AlgebraicType representing the type for Self in SATS
and in the typing context in typespace. This is used by the
automatic type registration system in Rust modules. Read moreimpl Copy for TimeDuration
impl Eq for TimeDuration
impl StructuralPartialEq for TimeDuration
Auto Trait Implementations§
impl Freeze for TimeDuration
impl RefUnwindSafe for TimeDuration
impl Send for TimeDuration
impl Sync for TimeDuration
impl Unpin for TimeDuration
impl UnwindSafe for TimeDuration
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key and return true if they are equal.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>
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>
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 moreSource§impl<T> Satn for T
impl<T> Satn for T
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f.Source§fn fmt_psql(&self, f: &mut Formatter<'_>, ty: &ProductType) -> Result<(), Error>
fn fmt_psql(&self, f: &mut Formatter<'_>, ty: &ProductType) -> Result<(), Error>
f.Source§fn to_satn(&self) -> String
fn to_satn(&self) -> String
String.Source§fn to_satn_pretty(&self) -> String
fn to_satn_pretty(&self) -> String
String.