pub struct EventTimestamp { /* private fields */ }event only.Expand description
๐ซ ๐ The time at which the event occurs, stored as single-precision milliseconds.
๐ ui/event
๐ฆ size_of::<EventTimestamp>() == 4 bytes / 32 bits
โ๏ธOption<T>
Backend dependent and relative to an arbitrary origin.
The underlying representation can be treated as either f32 milliseconds
or u32 milliseconds, depending on the event source.
Implementationsยง
Sourceยงimpl EventTimestamp
General methods.
impl EventTimestamp
General methods.
Sourcepub fn as_duration(&self) -> Duration
pub fn as_duration(&self) -> Duration
Converts the timestamp to a Duration, truncating fractional milliseconds.
Sourceยงimpl EventTimestamp
Methods related to floating-point representations.
impl EventTimestamp
Methods related to floating-point representations.
Sourcepub const fn from_secs_f32(seconds: f32) -> Self
pub const fn from_secs_f32(seconds: f32) -> Self
Creates a timestamp from milliseconds, ensuring a valid value.
Sourcepub const fn from_millis_f32(ms: f32) -> Self
pub const fn from_millis_f32(ms: f32) -> Self
Creates a timestamp from milliseconds, ensuring a valid value.
Sourcepub const fn as_secs_f32(self) -> f32
pub const fn as_secs_f32(self) -> f32
Converts to seconds as f32 for calculations.
Sourcepub const fn as_millis_f32(self) -> f32
pub const fn as_millis_f32(self) -> f32
Converts to seconds as f32 for calculations.
Sourceยงimpl EventTimestamp
Methods related to integer representations.
impl EventTimestamp
Methods related to integer representations.
Sourcepub const fn from_millis_u32(ms: u32) -> Self
pub const fn from_millis_u32(ms: u32) -> Self
Creates a timestamp from integer milliseconds.
The u32 value is stored directly as the underlying bit pattern and is
intended to be paired with as_millis_u32.
Sourcepub const fn as_millis_u32(&self) -> u32
pub const fn as_millis_u32(&self) -> u32
Interprets the stored bits as u32 milliseconds and returns them.
Only meaningful if the timestamp was created through
from_millis_u32.
Sourcepub const fn from_millis_u32_as_f32(ms: u32) -> Self
pub const fn from_millis_u32_as_f32(ms: u32) -> Self
Converts integer milliseconds to f32 and stores the resulting bit pattern.
This is the integer โ floating-point path and is intended to be paired
with as_millis_f32_to_u32.
Sourcepub const fn as_millis_f32_to_u32(&self) -> u32
pub const fn as_millis_f32_to_u32(&self) -> u32
Returns the stored f32 milliseconds truncated to u32.
Only meaningful if the timestamp was created from a floating-point-based
constructor (such as from_secs_f32 or
from_millis_f32).
Sourceยงimpl EventTimestamp
Methods related to formatting.
impl EventTimestamp
Methods related to formatting.
Sourcepub fn fmt_auto_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
pub fn fmt_auto_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
Formats the timestamp using heuristic detection.
Chooses between integer, float, or dual representations based on the
stored bit pattern. Intended for default Debug output.
Sourcepub fn fmt_int_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
pub fn fmt_int_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
Formats the timestamp by interpreting the stored bits as integer milliseconds.
Sourcepub fn fmt_float_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
pub fn fmt_float_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
Formats the timestamp by interpreting the stored bits as floating-point milliseconds.
Sourcepub fn fmt_dual_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
pub fn fmt_dual_ms(&self, f: &mut Formatter<'_>) -> FmtResult<()>
Formats the timestamp by showing both integer and floating-point interpretations.
Sourcepub fn fmt_split_full(&self, f: &mut Formatter<'_>) -> FmtResult<()>
pub fn fmt_split_full(&self, f: &mut Formatter<'_>) -> FmtResult<()>
Formats the timestamp using a full TimeSplit from years down to nanoseconds.
Trait Implementationsยง
Sourceยงimpl Clone for EventTimestamp
impl Clone for EventTimestamp
Sourceยงfn clone(&self) -> EventTimestamp
fn clone(&self) -> EventTimestamp
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl ConstInit for EventTimestamp
impl ConstInit for EventTimestamp
impl Copy for EventTimestamp
Sourceยงimpl Debug for EventTimestamp
impl Debug for EventTimestamp
Sourceยงimpl DebugExt for EventTimestamp
impl DebugExt for EventTimestamp
Sourceยงimpl Default for EventTimestamp
impl Default for EventTimestamp
Sourceยงfn default() -> EventTimestamp
fn default() -> EventTimestamp
Sourceยงimpl Display for EventTimestamp
impl Display for EventTimestamp
impl Eq for EventTimestamp
Sourceยงimpl From<EventTimestamp> for JsInstant
Available on crate feature js only.
impl From<EventTimestamp> for JsInstant
js only.Sourceยงfn from(from: EventTimestamp) -> Self
fn from(from: EventTimestamp) -> Self
Sourceยงimpl From<JsInstant> for EventTimestamp
Available on crate feature js only.
impl From<JsInstant> for EventTimestamp
js only.Sourceยงimpl Hash for EventTimestamp
impl Hash for EventTimestamp
Sourceยงimpl PartialEq for EventTimestamp
impl PartialEq for EventTimestamp
Sourceยงfn eq(&self, other: &EventTimestamp) -> bool
fn eq(&self, other: &EventTimestamp) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for EventTimestamp
Auto Trait Implementationsยง
impl Freeze for EventTimestamp
impl RefUnwindSafe for EventTimestamp
impl Send for EventTimestamp
impl Sync for EventTimestamp
impl Unpin for EventTimestamp
impl UnsafeUnpin for EventTimestamp
impl UnwindSafe for EventTimestamp
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
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ยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.