pub struct Frequency { /* private fields */ }
Expand description
Number of occurrences of a repeating event per unit of time
Definition: 1/Duration
Reference unit: Hertz (‘Hz’ = ‘1/s’)
Predefined units:
Symbol | Name | Definition | Equivalent in ‘Hz’ |
---|---|---|---|
kHz | Kilohertz | 1000·Hz | 1000 |
MHz | Megahertz | 1000000·Hz | 1000000 |
GHz | Gigahertz | 1000000000·Hz | 1000000000 |
Trait Implementations§
Source§impl HasRefUnit for Frequency
impl HasRefUnit for Frequency
Source§const REF_UNIT: FrequencyUnit = FrequencyUnit::Hertz
const REF_UNIT: FrequencyUnit = FrequencyUnit::Hertz
Unit used as reference for scaling the units of
Self::UnitType
.Source§fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
Returns
Some(unit)
where unit.scale()
== amnt
, or None
if
there is no such unit.Source§fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
Returns
factor
so that factor
* unit
== self
.Source§fn convert(&self, to_unit: Self::UnitType) -> Self
fn convert(&self, to_unit: Self::UnitType) -> Self
Returns
qty
where qty
== self
and qty.unit()
is to_unit
.Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Returns true, if
self
and other
have equivalent amounts, otherwise
false
.Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of
self
s amount and other
s eqivalent
amount in self
s unit.Source§impl PartialOrd for Frequency
impl PartialOrd for Frequency
Source§impl Quantity for Frequency
impl Quantity for Frequency
Source§type UnitType = FrequencyUnit
type UnitType = FrequencyUnit
Associated type of unit
Source§fn new(amount: AmountT, unit: Self::UnitType) -> Self
fn new(amount: AmountT, unit: Self::UnitType) -> Self
Returns a new instance of the type implementing
Quantity
.Source§fn iter_units() -> impl Iterator<Item = Self::UnitType>
fn iter_units() -> impl Iterator<Item = Self::UnitType>
Returns an iterator over the variants of
Self::UnitType
.Source§fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
Returns
Some(unit)
where unit.symbol()
== symbol
, or None
if
there is no such unit.Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Return
true
if self
and other
have the same unit and their
amounts are equal, otherwise false
.Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of
self
s and other
s amounts, if both
have the same unit, otherwise None
.impl Copy for Frequency
impl Eq for Frequency
Auto Trait Implementations§
impl Freeze for Frequency
impl RefUnwindSafe for Frequency
impl Send for Frequency
impl Sync for Frequency
impl Unpin for Frequency
impl UnwindSafe for Frequency
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