Struct measurements::frequency::Frequency
[−]
[src]
pub struct Frequency { /* fields omitted */ }
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);
Methods
impl Frequency
[src]
pub fn from_hertz(hertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in hertz
pub fn from_nanohertz(nanohertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Nanohertz.
pub fn from_microhertz(microhertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Microhertz.
pub fn from_millihertz(millihertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Millihertz.
pub fn from_kilohertz(kilohertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Kilohertz (kHz).
pub fn from_megahertz(megahertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Megahertz (MHz).
pub fn from_gigahertz(gigahertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Gigahertz (GHz).
pub fn from_terahertz(terahertz: f64) -> Self
[src]
Create a new Frequency from a floating point value in Terahertz (THz).
pub fn from_period(period: Duration) -> Self
[src]
Create a new Frequency from a floating point value of the period in seconds.
pub fn as_nanohertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in Nanohertz
pub fn as_microhertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in Microhertz
pub fn as_millihertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in Millihertz
pub fn as_hertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in Hertz (Hz)
pub fn as_kilohertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in Kilohertz (kHz)
pub fn as_megahertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in Megahertz (MHz)
pub fn as_gigahertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in gigahertz (GHz)
pub fn as_terahertz(&self) -> f64
[src]
Convert this Frequency to a floating point value in terahertz (THz)
pub fn as_period(&self) -> Duration
[src]
Convert this Frequency to a floating point value of the period in seconds.
Trait Implementations
impl Copy for Frequency
[src]
impl Clone for Frequency
[src]
fn clone(&self) -> Frequency
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Frequency
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Measurement for Frequency
[src]
fn as_base_units(&self) -> f64
[src]
Get this quantity in the base units
fn from_base_units(units: f64) -> Self
[src]
Create a new quantity from the base units
fn get_base_units_name(&self) -> &'static str
[src]
Return the base unit for this type, as a string. For example "kilograms" Read more
fn get_appropriate_units(&self) -> (&'static str, f64)
[src]
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
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
[src]
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
Given a list of units and their scale relative to the base unit, select the most appropriate one. Read more
impl Display for Frequency
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Add for Frequency
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
Performs the +
operation.
impl Sub for Frequency
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
Performs the -
operation.
impl Div<Frequency> for Frequency
[src]
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> f64
[src]
Performs the /
operation.
impl Div<f64> for Frequency
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: f64) -> Self
[src]
Performs the /
operation.
impl Mul<f64> for Frequency
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Self
[src]
Performs the *
operation.
impl Mul<Frequency> for f64
[src]
type Output = Frequency
The resulting type after applying the *
operator.
fn mul(self, rhs: Frequency) -> Frequency
[src]
Performs the *
operation.
impl Eq for Frequency
[src]
impl PartialEq for Frequency
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialOrd for Frequency
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more