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§
Source§impl 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)