Struct measurements::frequency::Frequency
source · [−]pub struct Frequency { /* private fields */ }
Expand description
The Frequency struct can be used to deal with frequencies in a common way. Common SI prefixes are supported.
Example
use measurements::Frequency;
let radio_station = Frequency::from_hertz(101.5e6);
println!("Tune to {}.", radio_station);
Implementations
sourceimpl Frequency
impl Frequency
sourcepub fn from_hertz(hertz: f64) -> Self
pub fn from_hertz(hertz: f64) -> Self
Create a new Frequency from a floating point value in hertz
sourcepub fn from_nanohertz(nanohertz: f64) -> Self
pub fn from_nanohertz(nanohertz: f64) -> Self
Create a new Frequency from a floating point value in Nanohertz.
sourcepub fn from_microhertz(microhertz: f64) -> Self
pub fn from_microhertz(microhertz: f64) -> Self
Create a new Frequency from a floating point value in Microhertz.
sourcepub fn from_millihertz(millihertz: f64) -> Self
pub fn from_millihertz(millihertz: f64) -> Self
Create a new Frequency from a floating point value in Millihertz.
sourcepub fn from_kilohertz(kilohertz: f64) -> Self
pub fn from_kilohertz(kilohertz: f64) -> Self
Create a new Frequency from a floating point value in Kilohertz (kHz).
sourcepub fn from_megahertz(megahertz: f64) -> Self
pub fn from_megahertz(megahertz: f64) -> Self
Create a new Frequency from a floating point value in Megahertz (MHz).
sourcepub fn from_gigahertz(gigahertz: f64) -> Self
pub fn from_gigahertz(gigahertz: f64) -> Self
Create a new Frequency from a floating point value in Gigahertz (GHz).
sourcepub fn from_terahertz(terahertz: f64) -> Self
pub fn from_terahertz(terahertz: f64) -> Self
Create a new Frequency from a floating point value in Terahertz (THz).
sourcepub fn from_period(period: Duration) -> Self
pub fn from_period(period: Duration) -> Self
Create a new Frequency from a floating point value of the period in seconds.
sourcepub fn as_nanohertz(&self) -> f64
pub fn as_nanohertz(&self) -> f64
Convert this Frequency to a floating point value in Nanohertz
sourcepub fn as_microhertz(&self) -> f64
pub fn as_microhertz(&self) -> f64
Convert this Frequency to a floating point value in Microhertz
sourcepub fn as_millihertz(&self) -> f64
pub fn as_millihertz(&self) -> f64
Convert this Frequency to a floating point value in Millihertz
sourcepub fn as_kilohertz(&self) -> f64
pub fn as_kilohertz(&self) -> f64
Convert this Frequency to a floating point value in Kilohertz (kHz)
sourcepub fn as_megahertz(&self) -> f64
pub fn as_megahertz(&self) -> f64
Convert this Frequency to a floating point value in Megahertz (MHz)
sourcepub fn as_gigahertz(&self) -> f64
pub fn as_gigahertz(&self) -> f64
Convert this Frequency to a floating point value in gigahertz (GHz)
sourcepub fn as_terahertz(&self) -> f64
pub fn as_terahertz(&self) -> f64
Convert this Frequency to a floating point value in terahertz (THz)
Trait Implementations
sourceimpl Measurement for Frequency
impl Measurement for Frequency
sourcefn as_base_units(&self) -> f64
fn as_base_units(&self) -> f64
Get this quantity in the base units
sourcefn from_base_units(units: f64) -> Self
fn from_base_units(units: f64) -> Self
Create a new quantity from the base units
sourcefn get_base_units_name(&self) -> &'static str
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example “kilograms” Read more
sourcefn get_appropriate_units(&self) -> (&'static str, f64)
fn get_appropriate_units(&self) -> (&'static str, f64)
Returns a string containing the most appropriate units for this quantity, and a floating point value representing this quantity in those units. Useful when, for example, a length might be in millimeters if it is very small, or kilometers when it is very large. Read more
sourceimpl PartialOrd<Frequency> for Frequency
impl PartialOrd<Frequency> for Frequency
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Frequency
impl Eq for Frequency
Auto Trait Implementations
impl RefUnwindSafe for Frequency
impl Send for Frequency
impl Sync for Frequency
impl Unpin for Frequency
impl UnwindSafe for Frequency
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more