pub struct EventMetadata {
pub ts: u64,
pub tid: i64,
}
Expand description
Metadata for an event, containing the timestamp and thread ID.
Fields§
§ts: u64
Timestamp of the event in nanoseconds since the UNIX epoch.
tid: i64
Thread ID of the event.
Implementations§
Source§impl EventMetadata
impl EventMetadata
Sourcepub fn timestamp(&self) -> Option<SystemTime>
pub fn timestamp(&self) -> Option<SystemTime>
Return the timestamp of the event as an Option<SystemTime>
.
If the timestamp is u64::MAX
, it indicates that no timestamp was set, and None
is returned.
Sourcepub fn write_header<W: Write>(
&self,
len: u32,
event_type: u16,
nparams: u32,
writer: W,
) -> Result<()>
pub fn write_header<W: Write>( &self, len: u32, event_type: u16, nparams: u32, writer: W, ) -> Result<()>
Write event header
To form a valid event, after calling this method, the caller must write out the payload
at exactly len - 26
bytes, containing nparam
lengths (as the proper type)
and the parameter values themselves.
Sourcepub fn write_header_with_lengths<W: Write, L: Into<u32> + Copy, const N: usize>(
&self,
event_type: u16,
lengths: [L; N],
writer: W,
) -> Result<()>
pub fn write_header_with_lengths<W: Write, L: Into<u32> + Copy, const N: usize>( &self, event_type: u16, lengths: [L; N], writer: W, ) -> Result<()>
Write event header and parameter lengths
To form a valid event, after calling this method, the caller must write out the payload
for each parameter, lengths[i]
bytes in length.
Trait Implementations§
Source§impl Clone for EventMetadata
impl Clone for EventMetadata
Source§fn clone(&self) -> EventMetadata
fn clone(&self) -> EventMetadata
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 EventMetadata
impl Debug for EventMetadata
Auto Trait Implementations§
impl Freeze for EventMetadata
impl RefUnwindSafe for EventMetadata
impl Send for EventMetadata
impl Sync for EventMetadata
impl Unpin for EventMetadata
impl UnwindSafe for EventMetadata
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