Struct measurements::area::Area
source · [−]pub struct Area { /* private fields */ }
Expand description
The Area
struct can be used to deal with areas in a common way.
Common metric and imperial units are supported.
Example
use measurements::Area;
let football_field = Area::from_square_meters(7140.0);
let acres = football_field.as_acres();
println!("There are {} acres in a football field.", acres);
Implementations
sourceimpl Area
impl Area
sourcepub fn from_square_meters(square_meters: f64) -> Self
pub fn from_square_meters(square_meters: f64) -> Self
Create new area from floating point value in Square Meters
sourcepub fn from_square_metres(square_metres: f64) -> Self
pub fn from_square_metres(square_metres: f64) -> Self
Create new area from floating point value in Square Metres
sourcepub fn from_square_nanometers(square_nanometers: f64) -> Self
pub fn from_square_nanometers(square_nanometers: f64) -> Self
Create new area from floating point value in Square Nanometers
sourcepub fn from_square_nanometres(square_nanometres: f64) -> Self
pub fn from_square_nanometres(square_nanometres: f64) -> Self
Create new area from floating point value in Square Nanometres
sourcepub fn from_square_micrometers(square_micrometers: f64) -> Self
pub fn from_square_micrometers(square_micrometers: f64) -> Self
Create new area from floating point value in Square Micrometers
sourcepub fn from_square_micrometres(square_micrometres: f64) -> Self
pub fn from_square_micrometres(square_micrometres: f64) -> Self
Create new area from floating point value in Square Micrometres
sourcepub fn from_square_millimeters(square_millimeters: f64) -> Self
pub fn from_square_millimeters(square_millimeters: f64) -> Self
Create new area from floating point value in Square Millimeters
sourcepub fn from_square_millimetres(square_millimetres: f64) -> Self
pub fn from_square_millimetres(square_millimetres: f64) -> Self
Create new area from floating point value in Square Millimetres
sourcepub fn from_square_centimeters(square_centimeters: f64) -> Self
pub fn from_square_centimeters(square_centimeters: f64) -> Self
Create new area from floating point value in Square Centimeters
sourcepub fn from_square_centimetres(square_centimetres: f64) -> Self
pub fn from_square_centimetres(square_centimetres: f64) -> Self
Create new area from floating point value in Square Centimetres
sourcepub fn from_square_decimeters(square_decimeters: f64) -> Self
pub fn from_square_decimeters(square_decimeters: f64) -> Self
Create new area from floating point value in Square Decimeters
sourcepub fn from_square_decimetres(square_decimetres: f64) -> Self
pub fn from_square_decimetres(square_decimetres: f64) -> Self
Create new area from floating point value in Square Decimetres
sourcepub fn from_square_hectometers(square_hectometers: f64) -> Self
pub fn from_square_hectometers(square_hectometers: f64) -> Self
Create new area from floating point value in Square Hectometers
sourcepub fn from_square_hectometres(square_hectometres: f64) -> Self
pub fn from_square_hectometres(square_hectometres: f64) -> Self
Create new area from floating point value in Square Hectometres
sourcepub fn from_hectares(hectares: f64) -> Self
pub fn from_hectares(hectares: f64) -> Self
Create new area from floating point value in Hectares
sourcepub fn from_square_kilometers(square_kilometers: f64) -> Self
pub fn from_square_kilometers(square_kilometers: f64) -> Self
Create new area from floating point value in Square Kilometers
sourcepub fn from_square_kilometres(square_kilometres: f64) -> Self
pub fn from_square_kilometres(square_kilometres: f64) -> Self
Create new area from floating point value in Square Kilometres
sourcepub fn from_square_inches(square_inches: f64) -> Self
pub fn from_square_inches(square_inches: f64) -> Self
Create new area from floating point value in Square Inches
sourcepub fn from_square_feet(square_feet: f64) -> Self
pub fn from_square_feet(square_feet: f64) -> Self
Create new area from floating point value in Square Feet
sourcepub fn from_square_yards(square_yards: f64) -> Self
pub fn from_square_yards(square_yards: f64) -> Self
Create new area from floating point value in Square Yards
sourcepub fn from_acres(acres: f64) -> Self
pub fn from_acres(acres: f64) -> Self
Create new area from floating point value in Acres
sourcepub fn from_square_miles(square_miles: f64) -> Self
pub fn from_square_miles(square_miles: f64) -> Self
Create new area from floating point value in Square Miles
sourcepub fn as_square_nanometers(&self) -> f64
pub fn as_square_nanometers(&self) -> f64
Convert this Area to a floating point value in Square Nanometers
sourcepub fn as_square_nanometres(&self) -> f64
pub fn as_square_nanometres(&self) -> f64
Convert this Area to a floating point value in Square Nanometres
sourcepub fn as_square_micrometers(&self) -> f64
pub fn as_square_micrometers(&self) -> f64
Convert this Area to a floating point value in Square Micrometers
sourcepub fn as_square_micrometres(&self) -> f64
pub fn as_square_micrometres(&self) -> f64
Convert this Area to a floating point value in Square Micrometres
sourcepub fn as_square_millimeters(&self) -> f64
pub fn as_square_millimeters(&self) -> f64
Convert this Area to a floating point value in Square Millimeters
sourcepub fn as_square_millimetres(&self) -> f64
pub fn as_square_millimetres(&self) -> f64
Convert this Area to a floating point value in Square Millimetres
sourcepub fn as_square_centimeters(&self) -> f64
pub fn as_square_centimeters(&self) -> f64
Convert this Area to a floating point value in Square Centimeters
sourcepub fn as_square_centimetres(&self) -> f64
pub fn as_square_centimetres(&self) -> f64
Convert this Area to a floating point value in Square Centimetres
sourcepub fn as_square_meters(&self) -> f64
pub fn as_square_meters(&self) -> f64
Convert this Area to a floating point value in Square Meters
sourcepub fn as_square_metres(&self) -> f64
pub fn as_square_metres(&self) -> f64
Convert this Area to a floating point value in Square Metres
sourcepub fn as_square_decimeters(&self) -> f64
pub fn as_square_decimeters(&self) -> f64
Convert this Area to a floating point value in Square Decimeters
sourcepub fn as_square_decimetres(&self) -> f64
pub fn as_square_decimetres(&self) -> f64
Convert this Area to a floating point value in Square Decimetres
sourcepub fn as_square_hectometers(&self) -> f64
pub fn as_square_hectometers(&self) -> f64
Convert this Area to a floating point value in Square Hectometers
sourcepub fn as_square_hectometres(&self) -> f64
pub fn as_square_hectometres(&self) -> f64
Convert this Area to a floating point value in Square Hectometres
sourcepub fn as_hectares(&self) -> f64
pub fn as_hectares(&self) -> f64
Convert this Area to a floating point value in Hectares
sourcepub fn as_square_kilometers(&self) -> f64
pub fn as_square_kilometers(&self) -> f64
Convert this Area to a floating point value in Square Kilometers
sourcepub fn as_square_kilometres(&self) -> f64
pub fn as_square_kilometres(&self) -> f64
Convert this Area to a floating point value in Square Kilometres
sourcepub fn as_square_inches(&self) -> f64
pub fn as_square_inches(&self) -> f64
Convert this Area to a floating point value in Square Inches
sourcepub fn as_square_feet(&self) -> f64
pub fn as_square_feet(&self) -> f64
Convert this Area to a floating point value in Square Feet
sourcepub fn as_square_yards(&self) -> f64
pub fn as_square_yards(&self) -> f64
Convert this Area to a floating point value in Square Yards
sourcepub fn as_square_miles(&self) -> f64
pub fn as_square_miles(&self) -> f64
Convert this Area to a floating point value in Square Miles
Trait Implementations
sourceimpl Measurement for Area
impl Measurement for Area
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<Area> for Area
impl PartialOrd<Area> for Area
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 Area
impl Eq for Area
Auto Trait Implementations
impl RefUnwindSafe for Area
impl Send for Area
impl Sync for Area
impl Unpin for Area
impl UnwindSafe for Area
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