pub struct Bitrate(pub(crate) u64);Expand description
Media bitrate in bits per second, with decimal kilo- and megabit units.
Unit conversion and addition saturate at u64::MAX. Subtraction saturates
at zero.
Tuple Fields§
§0: u64Implementations§
Source§impl Bitrate
impl Bitrate
pub const fn from_bps(value: u64) -> Self
pub const fn from_kbps(value: u64) -> Self
pub const fn from_mbps(value: u64) -> Self
pub const fn zero() -> Self
pub const fn as_bps(self) -> u64
pub const fn saturating_add(self, other: Self) -> Self
pub const fn saturating_sub(self, other: Self) -> Self
Sourcepub const fn divided_by(self, divisor: u64) -> Self
pub const fn divided_by(self, divisor: u64) -> Self
Divides the bitrate, rounding down to whole bits per second.
A zero divisor returns zero.
Trait Implementations§
Source§impl Ord for Bitrate
impl Ord for Bitrate
Source§impl PartialOrd for Bitrate
impl PartialOrd for Bitrate
impl Copy for Bitrate
impl Eq for Bitrate
impl StructuralPartialEq for Bitrate
Auto Trait Implementations§
impl Freeze for Bitrate
impl RefUnwindSafe for Bitrate
impl Send for Bitrate
impl Sync for Bitrate
impl Unpin for Bitrate
impl UnsafeUnpin for Bitrate
impl UnwindSafe for Bitrate
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