Struct measurements::current::Current
source · [−]pub struct Current { /* private fields */ }
Expand description
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);
Implementations
sourceimpl Current
impl Current
sourcepub fn from_amperes(amperes: f64) -> Self
pub fn from_amperes(amperes: f64) -> Self
Create a new Current from a floating point value in amperes
sourcepub fn from_milliamperes(milliamperes: f64) -> Self
pub fn from_milliamperes(milliamperes: f64) -> Self
Create a new Current from a floating point value in milliamperes
sourcepub fn from_microamperes(microamperes: f64) -> Self
pub fn from_microamperes(microamperes: f64) -> Self
Create a new Current from a floating point value in microamperes
sourcepub fn from_nanoamperes(nanoamperes: f64) -> Self
pub fn from_nanoamperes(nanoamperes: f64) -> Self
Create a new Current from a floating point value in nanoamperes
sourcepub fn as_amperes(&self) -> f64
pub fn as_amperes(&self) -> f64
Convert this Current into a floating point value in amperes
sourcepub fn as_milliamperes(&self) -> f64
pub fn as_milliamperes(&self) -> f64
Convert this Current into a floating point value in milliamperes
sourcepub fn as_microamperes(&self) -> f64
pub fn as_microamperes(&self) -> f64
Convert this Current into a floating point value in microamperes
sourcepub fn as_nanoamperes(&self) -> f64
pub fn as_nanoamperes(&self) -> f64
Convert this Current into a floating point value in nanoamperes
Trait Implementations
sourceimpl Measurement for Current
impl Measurement for Current
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 Mul<Current> for Resistance
impl Mul<Current> for Resistance
sourceimpl Mul<Resistance> for Current
impl Mul<Resistance> for Current
sourceimpl PartialOrd<Current> for Current
impl PartialOrd<Current> for Current
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 Current
impl Eq for Current
Auto Trait Implementations
impl RefUnwindSafe for Current
impl Send for Current
impl Sync for Current
impl Unpin for Current
impl UnwindSafe for Current
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