pub struct TimeDelta { /* private fields */ }Implementations§
Source§impl TimeDelta
impl TimeDelta
Sourcepub const fn is_extended(&self) -> bool
pub const fn is_extended(&self) -> bool
Returns true if the TimeDelta requires extended format (4 bytes), false if it can be represented in single format (2 bytes).
Sourcepub fn write_bytes(&self, writer: &mut BufferWriter)
pub fn write_bytes(&self, writer: &mut BufferWriter)
Write the TimeDelta into the provided writer. It will use either 2 or 4 bytes depending on the size:
- If the delta is less than 2^15, it will be written as a 2-byte value with the highest bit set to 0.
- If the delta is 2^15 or more, it will be written as a 4-byte value with the highest bit set to 1. If the delta exceeds 2^31 - 1, it will be capped to that value.
pub fn write_bytes_mut(&self, writer: &mut [u8]) -> usize
Sourcepub fn read_bytes(
reader: &mut BufferReader<'_>,
) -> Result<TimeDelta, ReadTracingError>
pub fn read_bytes( reader: &mut BufferReader<'_>, ) -> Result<TimeDelta, ReadTracingError>
Reads a TimeDelta from the provided reader. Returns None if reading fails. It automatically detects whether the format is single (2 bytes) or extended (4 bytes) based on the highest bit. This method can only “fail” if there is not enough data in the reader.
Trait Implementations§
impl Copy for TimeDelta
impl Eq for TimeDelta
impl StructuralPartialEq for TimeDelta
Auto Trait Implementations§
impl Freeze for TimeDelta
impl RefUnwindSafe for TimeDelta
impl Send for TimeDelta
impl Sync for TimeDelta
impl Unpin for TimeDelta
impl UnwindSafe for TimeDelta
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