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 wrapping_add(self, delta: Duration) -> Self
pub fn wrapping_add(self, delta: Duration) -> Self
self + delta on the 32-bit millisecond circle: a sum at or past 2^32 ms
wraps, as the wire field does (RFC 1982 serial-number arithmetic,
private/specs-verified/rtmp/rtmp-runtime/rtmp.md §1).
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
serde only.