Struct measurements::current::Current [−][src]
pub struct Current { /* fields omitted */ }
The Current
struct can be used to deal with electric potential difference
in a common way.
Example
use measurements::Current; let amperes = Current::from_milliamperes(35.0); let a = amperes.as_amperes(); let u_a = amperes.as_microamperes(); println!("35 mA correspond to {} A or {} µA", a, u_a);
Methods
impl Current
[src]
impl Current
pub fn from_amperes(amperes: f64) -> Self
[src]
pub fn from_amperes(amperes: f64) -> Self
Create a new Current from a floating point value in amperes
pub fn from_milliamperes(milliamperes: f64) -> Self
[src]
pub fn from_milliamperes(milliamperes: f64) -> Self
Create a new Current from a floating point value in milliamperes
pub fn from_microamperes(microamperes: f64) -> Self
[src]
pub fn from_microamperes(microamperes: f64) -> Self
Create a new Current from a floating point value in microamperes
pub fn from_nanoamperes(nanoamperes: f64) -> Self
[src]
pub fn from_nanoamperes(nanoamperes: f64) -> Self
Create a new Current from a floating point value in nanoamperes
pub fn as_amperes(&self) -> f64
[src]
pub fn as_amperes(&self) -> f64
Convert this Current into a floating point value in amperes
pub fn as_milliamperes(&self) -> f64
[src]
pub fn as_milliamperes(&self) -> f64
Convert this Current into a floating point value in milliamperes
pub fn as_microamperes(&self) -> f64
[src]
pub fn as_microamperes(&self) -> f64
Convert this Current into a floating point value in microamperes
pub fn as_nanoamperes(&self) -> f64
[src]
pub fn as_nanoamperes(&self) -> f64
Convert this Current into a floating point value in nanoamperes
Trait Implementations
impl Copy for Current
[src]
impl Copy for Current
impl Clone for Current
[src]
impl Clone for Current
fn clone(&self) -> Current
[src]
fn clone(&self) -> Current
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Current
[src]
impl Debug for Current
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Measurement for Current
[src]
impl Measurement for Current
fn as_base_units(&self) -> f64
[src]
fn as_base_units(&self) -> f64
Get this quantity in the base units
fn from_base_units(units: f64) -> Self
[src]
fn from_base_units(units: f64) -> Self
Create a new quantity from the base units
fn get_base_units_name(&self) -> &'static str
[src]
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example "kilograms" Read more
fn get_appropriate_units(&self) -> (&'static str, f64)
[src]
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
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
[src]
fn pick_appropriate_units(
&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 Current
[src]
impl Display for Current
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Add for Current
[src]
impl Add for Current
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
fn add(self, rhs: Self) -> Self
Performs the +
operation.
impl Sub for Current
[src]
impl Sub for Current
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
fn sub(self, rhs: Self) -> Self
Performs the -
operation.
impl Div<Current> for Current
[src]
impl Div<Current> for Current
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> f64
[src]
fn div(self, rhs: Self) -> f64
Performs the /
operation.
impl Div<f64> for Current
[src]
impl Div<f64> for Current
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: f64) -> Self
[src]
fn div(self, rhs: f64) -> Self
Performs the /
operation.
impl Mul<f64> for Current
[src]
impl Mul<f64> for Current
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Self
[src]
fn mul(self, rhs: f64) -> Self
Performs the *
operation.
impl Mul<Current> for f64
[src]
impl Mul<Current> for f64
type Output = Current
The resulting type after applying the *
operator.
fn mul(self, rhs: Current) -> Current
[src]
fn mul(self, rhs: Current) -> Current
Performs the *
operation.
impl Eq for Current
[src]
impl Eq for Current
impl PartialEq for Current
[src]
impl PartialEq for Current
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
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]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialOrd for Current
[src]
impl PartialOrd for Current
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
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]
fn lt(&self, other: &Rhs) -> bool
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]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
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]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Mul<Voltage> for Current
[src]
impl Mul<Voltage> for Current
type Output = Power
The resulting type after applying the *
operator.
fn mul(self, rhs: Voltage) -> Self::Output
[src]
fn mul(self, rhs: Voltage) -> Self::Output
Performs the *
operation.
impl Mul<Current> for Voltage
[src]
impl Mul<Current> for Voltage
type Output = Power
The resulting type after applying the *
operator.
fn mul(self, rhs: Current) -> Self::Output
[src]
fn mul(self, rhs: Current) -> Self::Output
Performs the *
operation.
impl Div<Current> for Power
[src]
impl Div<Current> for Power
type Output = Voltage
The resulting type after applying the /
operator.
fn div(self, rhs: Current) -> Self::Output
[src]
fn div(self, rhs: Current) -> Self::Output
Performs the /
operation.
impl Mul<Resistance> for Current
[src]
impl Mul<Resistance> for Current
type Output = Voltage
The resulting type after applying the *
operator.
fn mul(self, rhs: Resistance) -> Self::Output
[src]
fn mul(self, rhs: Resistance) -> Self::Output
Performs the *
operation.
impl Mul<Current> for Resistance
[src]
impl Mul<Current> for Resistance
type Output = Voltage
The resulting type after applying the *
operator.
fn mul(self, rhs: Current) -> Self::Output
[src]
fn mul(self, rhs: Current) -> Self::Output
Performs the *
operation.
impl Div<Current> for Voltage
[src]
impl Div<Current> for Voltage