pub struct Decibels(/* private fields */);Expand description
A level, a gain, or a loss in decibels, held to a hundredth of a decibel.
One type carries absolute levels in dBm, antenna gains in dBi, and plain ratios in dB, because a link budget adds and subtracts all three. The name of each value in this module says which one it is. Arithmetic saturates rather than overflowing, and the value prints with two decimals and no unit.
§Examples
use pamoja_lora::budget::Decibels;
// A 2.15 dBi dipole behind half a decibel of cable.
let net = Decibels::from_hundredths(215) - Decibels::from_tenths(5);
assert_eq!(net.to_string(), "1.65");
assert_eq!(net.round_db(), 2);Implementations§
Trait Implementations§
impl Copy for Decibels
impl Eq for Decibels
Source§impl Ord for Decibels
impl Ord for Decibels
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
Source§impl PartialOrd for Decibels
impl PartialOrd for Decibels
impl StructuralPartialEq for Decibels
Auto Trait Implementations§
impl Freeze for Decibels
impl RefUnwindSafe for Decibels
impl Send for Decibels
impl Sync for Decibels
impl Unpin for Decibels
impl UnsafeUnpin for Decibels
impl UnwindSafe for Decibels
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