pub struct Timestamp(/* private fields */);Expand description
An RTMP timestamp / timestamp delta (§5.3.1.2) — a whole number of
milliseconds on the wire, held as a span so a caller never passes a raw
tick count.
The wire is a 24-bit field plus the 4-byte Extended Timestamp (§5.3.1.3),
so any Duration below 2^32 ms converts exactly; a coarser Duration
(sub-millisecond units) is rounded down to the millisecond the wire
carries.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn try_new(span: Duration) -> Result<Self, TimestampOutOfRange>
pub fn try_new(span: Duration) -> Result<Self, TimestampOutOfRange>
Build from a span, rejecting one the 32-bit wire field cannot hold (2^32 ms is about 49.7 days).
§Errors
TimestampOutOfRange when the span is 2^32 ms or longer.
Sourcepub const fn from_millis(millis: u32) -> Self
pub const fn from_millis(millis: u32) -> Self
Read a value straight off the wire (always representable).
Sourcepub fn checked_add(self, delta: Duration) -> Option<Self>
pub fn checked_add(self, delta: Duration) -> Option<Self>
self + delta, or None when that leaves the 32-bit field.
Trait Implementations§
impl Copy for Timestamp
Source§impl<'de> Deserialize<'de> for Timestamp
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Timestamp
Available on crate feature
serde only.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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Forget for Timestamp
impl Freeze for Timestamp
impl Move for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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