pub struct Timescale(/* private fields */);Expand description
Units per second used by a track for frame timestamps.
Newtype around NonZero<u64>. Zero is structurally impossible, so the
arithmetic on Timestamp can divide by self.scale without ever risking
a divide by zero. Use the named constants (Self::SECOND, Self::MILLI,
Self::MICRO, Self::NANO) instead of writing raw integers at call sites;
for runtime values, use Self::new or TryFrom, which return TimeOverflow
for 0 or for values past the QUIC varint range.
Implementations§
Source§impl Timescale
impl Timescale
Sourcepub const MICRO: Self
pub const MICRO: Self
1,000,000 units per second (1_000_000). Widely used by container formats.
Sourcepub const fn new(units_per_second: u64) -> Result<Self, TimeOverflow>
pub const fn new(units_per_second: u64) -> Result<Self, TimeOverflow>
Construct a timescale from a raw value (units per second).
Returns TimeOverflow if units_per_second is 0 (would divide by zero)
or exceeds 2^62 - 1 (the QUIC varint range, matching Timestamp values).
Every runtime constructor, including TryFrom, goes through this check.
Trait Implementations§
impl Copy for Timescale
impl Eq for Timescale
Source§impl Ord for Timescale
impl Ord for Timescale
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Timescale
impl PartialOrd for Timescale
impl StructuralPartialEq for Timescale
Auto Trait Implementations§
impl Freeze for Timescale
impl RefUnwindSafe for Timescale
impl Send for Timescale
impl Sync for Timescale
impl Unpin for Timescale
impl UnsafeUnpin for Timescale
impl UnwindSafe for Timescale
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.