pub struct Volume { /* private fields */ }Expand description
The quantity expressing the amount of three-dimensional space enclosed by a closed surface.
Definition: Length³
Reference unit: Cubic Meter (‘m³’)
Predefined units:
| Symbol | Name | Definition | Equivalent in ‘m³’ |
|---|---|---|---|
| mm³ | Cubic Millimeter | mm³ | 0.000000001 |
| cm³ | Cubic Centimeter | cm³ | 0.000001 |
| ml | Milliliter | 0.001·l | 0.000001 |
| cl | Centiliter | 0.01·l | 0.00001 |
| in³ | Cubic Inch | in³ | 0.000016387064 |
| dl | Deciliter | 0.1·l | 0.0001 |
| dm³ | Cubic Decimeter | dm³ | 0.001 |
| l | Liter | 0.001·m³ | 0.001 |
| ft³ | Cubic Foot | ft³ | 0.028316846592 |
| yd³ | Cubic Yard | yd³ | 0.764554857984 |
| km³ | Cubic Kilometer | km³ | 1000000000 |
Trait Implementations§
Source§impl HasRefUnit for Volume
impl HasRefUnit for Volume
Source§const REF_UNIT: VolumeUnit = VolumeUnit::CubicMeter
const REF_UNIT: VolumeUnit = VolumeUnit::CubicMeter
Unit used as reference for scaling the units of
Self::UnitType.Source§fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
Returns
Some(unit) where unit.scale() == amnt, or None if
there is no such unit.Source§fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
Returns
factor so that factor * unit == self.Source§fn convert(&self, to_unit: Self::UnitType) -> Self
fn convert(&self, to_unit: Self::UnitType) -> Self
Returns
qty where qty == self and qty.unit() is to_unit.Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Returns true, if
self and other have equivalent amounts, otherwise
false.Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of
selfs amount and others eqivalent
amount in selfs unit.Source§impl PartialOrd for Volume
impl PartialOrd for Volume
Source§impl Quantity for Volume
impl Quantity for Volume
Source§type UnitType = VolumeUnit
type UnitType = VolumeUnit
Associated type of unit
Source§fn new(amount: AmountT, unit: Self::UnitType) -> Self
fn new(amount: AmountT, unit: Self::UnitType) -> Self
Returns a new instance of the type implementing
Quantity.Source§fn iter_units() -> impl Iterator<Item = Self::UnitType>
fn iter_units() -> impl Iterator<Item = Self::UnitType>
Returns an iterator over the variants of
Self::UnitType.Source§fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
Returns
Some(unit) where unit.symbol() == symbol, or None if
there is no such unit.Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Return
true if self and other have the same unit and their
amounts are equal, otherwise false.Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of
selfs and others amounts, if both
have the same unit, otherwise None.impl Copy for Volume
impl Eq for Volume
Auto Trait Implementations§
impl Freeze for Volume
impl RefUnwindSafe for Volume
impl Send for Volume
impl Sync for Volume
impl Unpin for Volume
impl UnwindSafe for Volume
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more