Struct measurements::force::Force
source · [−]pub struct Force { /* private fields */ }
Expand description
The Force
struct can be used to deal with force in a common way.
#Example
use measurements::Force;
use measurements::Mass;
use measurements::Acceleration;
let metric_ton = Mass::from_metric_tons(1.0);
let gravity = Acceleration::from_meters_per_second_per_second(9.81);
let force: Force = metric_ton * gravity; // F=ma
println!(
"One metric ton exerts a force of {} due to gravity",
force);
Implementations
sourceimpl Force
impl Force
sourcepub fn from_newtons(newtons: f64) -> Self
pub fn from_newtons(newtons: f64) -> Self
Create a Force from a floating point value in Newtons
sourcepub fn from_micronewtons(micronewtons: f64) -> Self
pub fn from_micronewtons(micronewtons: f64) -> Self
Create a Force from a floating point value in Micronewtons
sourcepub fn from_millinewtons(millinewtons: f64) -> Self
pub fn from_millinewtons(millinewtons: f64) -> Self
Create a Force from a floating point value in Millinewtons
sourcepub fn from_pounds(pounds: f64) -> Self
pub fn from_pounds(pounds: f64) -> Self
Create a Force from a floating point value in pounds
sourcepub fn from_poundals(poundals: f64) -> Self
pub fn from_poundals(poundals: f64) -> Self
Create a Force from a floating point value in poundals
sourcepub fn from_kiloponds(kiloponds: f64) -> Self
pub fn from_kiloponds(kiloponds: f64) -> Self
Create a Force from a floating point value in kiloponds
sourcepub fn from_dynes(dynes: f64) -> Self
pub fn from_dynes(dynes: f64) -> Self
Create a Force from a floating point value in Dynes
sourcepub fn as_micronewtons(&self) -> f64
pub fn as_micronewtons(&self) -> f64
Convert this Force into a floating point value in Micronewtons
sourcepub fn as_millinewtons(&self) -> f64
pub fn as_millinewtons(&self) -> f64
Convert this Force into a floating point value in Milliewtons
sourcepub fn as_newtons(&self) -> f64
pub fn as_newtons(&self) -> f64
Convert this Force into a floating point value in Newtons
sourcepub fn as_pounds(&self) -> f64
pub fn as_pounds(&self) -> f64
Convert this Force into a floating point value in pound-force (lb.f)
sourcepub fn as_poundals(&self) -> f64
pub fn as_poundals(&self) -> f64
Convert this Force into a floating point value in poundals
sourcepub fn as_kiloponds(&self) -> f64
pub fn as_kiloponds(&self) -> f64
Convert this Force into a floating point value in kiloponds
Trait Implementations
sourceimpl Div<Acceleration> for Force
impl Div<Acceleration> for Force
sourceimpl Div<Force> for TorqueEnergy
impl Div<Force> for TorqueEnergy
sourceimpl Measurement for Force
impl Measurement for Force
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 PartialOrd<Force> for Force
impl PartialOrd<Force> for Force
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 Force
impl Eq for Force
Auto Trait Implementations
impl RefUnwindSafe for Force
impl Send for Force
impl Sync for Force
impl Unpin for Force
impl UnwindSafe for Force
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