Struct measurements::resistance::Resistance
source · [−]pub struct Resistance { /* private fields */ }
Expand description
The Resistance
struct can be used to deal with electrical resistance in a
common way.
Example
use measurements::Resistance;
let r = Resistance::from_kiloohms(4.7);
let o = r.as_ohms();
let mo = r.as_megaohms();
println!("A 4.7 kΩ resistor has {} Ω or {} MΩ", o, mo);
Implementations
sourceimpl Resistance
impl Resistance
sourcepub fn from_ohms(ohms: f64) -> Self
pub fn from_ohms(ohms: f64) -> Self
Create a new Resistance from a floating point value in ohms
sourcepub fn from_kiloohms(kiloohms: f64) -> Self
pub fn from_kiloohms(kiloohms: f64) -> Self
Create a new Resistance from a floating point value in kiloohms
sourcepub fn from_megaohms(megaohms: f64) -> Self
pub fn from_megaohms(megaohms: f64) -> Self
Create a new Resistance from a floating point value in milliohms
sourcepub fn as_kiloohms(&self) -> f64
pub fn as_kiloohms(&self) -> f64
Convert this Resistance into a floating point value in kiloohms
sourcepub fn as_megaohms(&self) -> f64
pub fn as_megaohms(&self) -> f64
Convert this Resistance into a floating point value in milliohms
Trait Implementations
sourceimpl Add<Resistance> for Resistance
impl Add<Resistance> for Resistance
sourceimpl Clone for Resistance
impl Clone for Resistance
sourcefn clone(&self) -> Resistance
fn clone(&self) -> Resistance
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Resistance
impl Debug for Resistance
sourceimpl Display for Resistance
impl Display for Resistance
sourceimpl Div<Resistance> for Resistance
impl Div<Resistance> for Resistance
sourceimpl Div<Resistance> for Voltage
impl Div<Resistance> for Voltage
sourceimpl Div<f64> for Resistance
impl Div<f64> for Resistance
sourceimpl Measurement for Resistance
impl Measurement for Resistance
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 f64
impl Mul<Resistance> for f64
type Output = Resistance
type Output = Resistance
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: Resistance) -> Resistance
fn mul(self, rhs: Resistance) -> Resistance
Performs the *
operation. Read more
sourceimpl Mul<Resistance> for Current
impl Mul<Resistance> for Current
sourceimpl Mul<f64> for Resistance
impl Mul<f64> for Resistance
sourceimpl PartialEq<Resistance> for Resistance
impl PartialEq<Resistance> for Resistance
sourceimpl PartialOrd<Resistance> for Resistance
impl PartialOrd<Resistance> for Resistance
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
sourceimpl Sub<Resistance> for Resistance
impl Sub<Resistance> for Resistance
impl Copy for Resistance
impl Eq for Resistance
Auto Trait Implementations
impl RefUnwindSafe for Resistance
impl Send for Resistance
impl Sync for Resistance
impl Unpin for Resistance
impl UnwindSafe for Resistance
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