Skip to main content

Area

Struct Area 

Source
pub struct Area(/* private fields */);
Expand description

An area quantity, stored canonically in square meters (m²).

§Construction

use space_units::Area;
let a = Area::from_km2(0.5);

§Typed arithmetic

Implementations§

Source§

impl Area

Source

pub const fn from_m2(val: f64) -> Self

Create from square meters (m²).

Source

pub const fn from_km2(val: f64) -> Self

Create from square kilometers (km²).

Source

pub const fn from_mm2(val: f64) -> Self

Create from square millimeters (mm²).

Source

pub const fn from_cm2(val: f64) -> Self

Create from square centimeters (cm²).

Source

pub const fn from_ft2(val: f64) -> Self

Create from square feet (ft²).

Source

pub const fn from_in2(val: f64) -> Self

Create from square inches (in²).

Source

pub const fn in_m2(self) -> f64

Get value in square meters (m²).

Source

pub const fn in_km2(self) -> f64

Get value in square kilometers (km²).

Source

pub const fn in_mm2(self) -> f64

Get value in square millimeters (mm²).

Source

pub const fn in_cm2(self) -> f64

Get value in square centimeters (cm²).

Source

pub const fn in_ft2(self) -> f64

Get value in square feet (ft²).

Source

pub const fn in_in2(self) -> f64

Get value in square inches (in²).

Source

pub fn in_unit(self, unit: AreaUnit) -> f64

Get value in the specified AreaUnit.

Source

pub fn display_as(self, unit: AreaUnit) -> DisplayWithUnit

Return a display wrapper that formats this area in the given unit.

Source

pub fn abs(self) -> Self

Return the absolute value of this area.

Trait Implementations§

Source§

impl Add for Area

Source§

type Output = Area

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl AddAssign for Area

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for Area

Source§

fn clone(&self) -> Area

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Area

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Area

Source§

fn default() -> Area

Returns the “default value” for a type. Read more
Source§

impl Display for Area

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<Area> for Force

Source§

type Output = Pressure

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Area) -> Pressure

Performs the / operation. Read more
Source§

impl Div<Area> for GravitationalParameter

Source§

type Output = Acceleration

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Area) -> Acceleration

Performs the / operation. Read more
Source§

impl Div<Area> for MagneticFlux

Source§

type Output = MagneticFluxDensity

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Area) -> MagneticFluxDensity

Performs the / operation. Read more
Source§

impl Div<Area> for Power

Source§

type Output = HeatFlux

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Area) -> HeatFlux

Performs the / operation. Read more
Source§

impl Div<Area> for Volume

Source§

type Output = Length

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Area) -> Length

Performs the / operation. Read more
Source§

impl Div<Length> for Area

Source§

type Output = Length

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Length) -> Length

Performs the / operation. Read more
Source§

impl Div<Time> for Area

Source§

type Output = SpecificAngularMomentum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Time) -> SpecificAngularMomentum

Performs the / operation. Read more
Source§

impl Div<f64> for Area

Source§

type Output = Area

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self

Performs the / operation. Read more
Source§

impl Div for Area

Source§

type Output = f64

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> f64

Performs the / operation. Read more
Source§

impl DivAssign<f64> for Area

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl Mul<Area> for HeatFlux

Source§

type Output = Power

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Area) -> Power

Performs the * operation. Read more
Source§

impl Mul<Area> for Length

Source§

type Output = Volume

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Area) -> Volume

Performs the * operation. Read more
Source§

impl Mul<Area> for MagneticFluxDensity

Source§

type Output = MagneticFlux

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Area) -> MagneticFlux

Performs the * operation. Read more
Source§

impl Mul<Area> for Pressure

Source§

type Output = Force

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Area) -> Force

Performs the * operation. Read more
Source§

impl Mul<Area> for f64

Source§

type Output = Area

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Area) -> Area

Performs the * operation. Read more
Source§

impl Mul<HeatFlux> for Area

Source§

type Output = Power

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: HeatFlux) -> Power

Performs the * operation. Read more
Source§

impl Mul<Length> for Area

Source§

type Output = Volume

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Length) -> Volume

Performs the * operation. Read more
Source§

impl Mul<MagneticFluxDensity> for Area

Source§

type Output = MagneticFlux

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: MagneticFluxDensity) -> MagneticFlux

Performs the * operation. Read more
Source§

impl Mul<Pressure> for Area

Source§

type Output = Force

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Pressure) -> Force

Performs the * operation. Read more
Source§

impl Mul<f64> for Area

Source§

type Output = Area

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self

Performs the * operation. Read more
Source§

impl MulAssign<f64> for Area

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl Neg for Area

Source§

type Output = Area

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl PartialEq for Area

Source§

fn eq(&self, other: &Area) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Area

Source§

fn partial_cmp(&self, other: &Area) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub for Area

Source§

type Output = Area

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl SubAssign for Area

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Sum for Area

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Copy for Area

Source§

impl StructuralPartialEq for Area

Auto Trait Implementations§

§

impl Freeze for Area

§

impl RefUnwindSafe for Area

§

impl Send for Area

§

impl Sync for Area

§

impl Unpin for Area

§

impl UnsafeUnpin for Area

§

impl UnwindSafe for Area

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.