pub struct TimeInt(/* private fields */);Expand description
A 64-bit number describing either nanoseconds, sequence numbers or fully static data.
Must be matched with a crate::TimeType to know what.
Used both for time points and durations.
Implementations§
Source§impl TimeInt
impl TimeInt
Sourcepub const STATIC: Self
pub const STATIC: Self
Special value used to represent static data.
It is illegal to create a TimeInt with that value in a temporal context.
SDK users cannot log data at that timestamp explicitly, the only way to do so is to use the static APIs.
Sourcepub const MIN: Self
pub const MIN: Self
Value used to represent the minimal temporal value a TimeInt can hold.
This is not i64::MIN, as that is a special value reserved as a marker for static
data (see Self::STATIC).
pub const ZERO: Self
pub const ONE: Self
pub fn is_static(self) -> bool
Sourcepub fn new_temporal(time: i64) -> Self
pub fn new_temporal(time: i64) -> Self
Creates a new temporal TimeInt.
If time is i64::MIN, this will return TimeInt::MIN.
This can’t return TimeInt::STATIC, ever.
Sourcepub fn from_nanos(nanos: NonMinI64) -> Self
pub fn from_nanos(nanos: NonMinI64) -> Self
For time timelines.
Sourcepub fn from_millis(millis: NonMinI64) -> Self
pub fn from_millis(millis: NonMinI64) -> Self
For time timelines.
Sourcepub fn from_sequence(sequence: NonMinI64) -> Self
pub fn from_sequence(sequence: NonMinI64) -> Self
For sequence timelines.
Sourcepub fn saturated_temporal_i64(value: impl Into<i64>) -> Self
pub fn saturated_temporal_i64(value: impl Into<i64>) -> Self
Clamp to valid non-static range.
Sourcepub fn saturated_temporal(value: impl TryInto<Self>) -> Self
pub fn saturated_temporal(value: impl TryInto<Self>) -> Self
Clamp to valid non-static range.
Sourcepub const fn as_i64(self) -> i64
pub const fn as_i64(self) -> i64
Returns i64::MIN for Self::STATIC.
Sourcepub const fn as_f64(self) -> f64
pub const fn as_f64(self) -> f64
Returns f64::MIN for Self::STATIC.
Sourcepub fn inc(self) -> Self
pub fn inc(self) -> Self
Always returns Self::STATIC for Self::STATIC.
Sourcepub fn dec(self) -> Self
pub fn dec(self) -> Self
Always returns Self::STATIC for Self::STATIC.
Sourcepub fn midpoint(&self, rhs: Self) -> Self
pub fn midpoint(&self, rhs: Self) -> Self
Calculates the midpoint (average) between self and rhs.
If either is static (non-temporal), then this returns Self::STATIC.
pub fn closest_multiple_of(&self, snap_interval: i64) -> Self
pub fn saturating_sub(&self, arg: i64) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TimeInt
impl<'de> Deserialize<'de> for TimeInt
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>,
Source§impl Ord for TimeInt
impl Ord for TimeInt
Source§impl PartialOrd<TimeInt> for TimeReal
impl PartialOrd<TimeInt> for TimeReal
Source§impl PartialOrd<TimeReal> for TimeInt
impl PartialOrd<TimeReal> for TimeInt
Source§impl PartialOrd for TimeInt
impl PartialOrd for TimeInt
Source§impl SizeBytes for TimeInt
impl SizeBytes for TimeInt
Source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self uses on the heap. Read moreSource§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self in bytes, accounting for both stack and heap space.Source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self on the stack, in bytes. Read moreimpl Copy for TimeInt
impl Eq for TimeInt
impl StructuralPartialEq for TimeInt
Auto Trait Implementations§
impl Freeze for TimeInt
impl RefUnwindSafe for TimeInt
impl Send for TimeInt
impl Sync for TimeInt
impl Unpin for TimeInt
impl UnsafeUnpin for TimeInt
impl UnwindSafe for TimeInt
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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§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> 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>
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 more