Area

Enum Area 

Source
#[non_exhaustive]
pub enum Area { Hectare, Decare, Are, Deciare, Centiare, Barn, Acre, }
Expand description

A unit of area.

Measurements of area are of the same kind as measurements of length with power 2. Thus, any measurement created with an area unit can be converted to a a length unit squared, and vice versa.

The listed abbreviations are the abbreviations used to parse the unit with FromStr. The main abbreviation comes first, followed by any alternate abbreviations that can be used.

The conversions are listed in terms of the base unit. The base unit for Area is Area::Are.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Hectare

  • Abbreviation: ha

  • 1 ha = 100.0 a

§

Decare

  • Abbreviation: daa

  • 1 daa = 10.0 a

§

Are

  • Abbreviation: a

  • 1 a = 1.0 a

§

Deciare

  • Abbreviation: da

  • 1 da = 0.1 a

§

Centiare

  • Abbreviation: ca

  • 1 ca = 0.01 a

§

Barn

  • Abbreviation: b

  • 1 b = 1e-30 a

§

Acre

  • Abbreviation: ac

  • 1 ac = 40.468564224 a

Implementations§

Source§

impl Area

Source

pub fn pow(&self, power: i8) -> Unit

Creates a Unit with this quantity type and specified power.

Source

pub fn squared(&self) -> Unit

Creates a Unit with this quantity type and power 2.

Source

pub fn cubed(&self) -> Unit

Creates a Unit with this quantity type and power 3.

Trait Implementations§

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 Convert for Area

Source§

const BASE: Self = Area::Are

The base unit of this unit. Read more
Source§

fn conversion_factor(&self) -> f64

Returns the conversion factor from &self to Convert::BASE, i.e. the value to multiply a quantity in this unit by, in order to get a quantity in Convert::BASE. If the self unit is the same as this unit, then this function should return 1.0. Read more
Source§

fn conversion_factor_to(&self, target: impl Into<Unit>) -> Option<f64>

Defines the conversion factor from Convert::BASE, to a base unit that Convert::BASE is derived from. Returns None if there is no conversion factor, meaning the two units are unrelated. 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 Display for Area

Source§

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

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

impl From<Area> for Base

Source§

fn from(u: Area) -> Self

Converts to this type from the input type.
Source§

impl From<Area> for CompoundUnit

Source§

fn from(u: Area) -> Self

Converts to this type from the input type.
Source§

impl From<Area> for Unit

Source§

fn from(u: Area) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Area

Source§

type Err = InvalidUnit

The associated error which can be returned from parsing.
Source§

fn from_str(value: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. 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 TryFrom<&str> for Area

Source§

type Error = InvalidUnit

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

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Area

Source§

impl Eq 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 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.