pub struct Energy { /* private fields */ }Expand description
Property that must be transferred to an object in order to perform work on or to heat it.
Definition: Force·Length
Reference unit: Joule (‘J’ = ‘N·m’ = ‘kg·m²/s²’)
Predefined units:
| Symbol | Name | Definition | Equivalent in ‘J’ |
|---|---|---|---|
| Nm | Newton Meter | N·m | 1 |
| Ws | Watt Second | W·s | 1 |
| kWh | Kilowatt Hour | kW·h | 3600000 |
Implementations§
Trait Implementations§
Source§impl AddAssign for Energy
impl AddAssign for Energy
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl DivAssign<f64> for Energy
impl DivAssign<f64> for Energy
Source§fn div_assign(&mut self, rhs: AmountT)
fn div_assign(&mut self, rhs: AmountT)
Performs the
/= operation. Read moreSource§impl HasRefUnit for Energy
impl HasRefUnit for Energy
Source§const REF_UNIT: EnergyUnit = EnergyUnit::Joule
const REF_UNIT: EnergyUnit = EnergyUnit::Joule
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 convert_assign(&mut self, to_unit: Self::UnitType)
fn convert_assign(&mut self, to_unit: Self::UnitType)
Converts
self to the equivalent 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§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Adds the unit-equivalent amount of
other to self in place.Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Subtracts the unit-equivalent amount of
other from self in place.Source§impl MulAssign<f64> for Energy
impl MulAssign<f64> for Energy
Source§fn mul_assign(&mut self, rhs: AmountT)
fn mul_assign(&mut self, rhs: AmountT)
Performs the
*= operation. Read moreSource§impl PartialOrd for Energy
impl PartialOrd for Energy
Source§impl Quantity for Energy
impl Quantity for Energy
Source§fn new(amount: AmountT, unit: Self::UnitType) -> Self
fn new(amount: AmountT, unit: Self::UnitType) -> Self
Creates a new Energy value with the given amount and unit.
Source§type UnitType = EnergyUnit
type UnitType = EnergyUnit
Associated type of unit
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.Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Source§impl SubAssign for Energy
impl SubAssign for Energy
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Energy
impl Eq for Energy
Auto Trait Implementations§
impl Freeze for Energy
impl RefUnwindSafe for Energy
impl Send for Energy
impl Sync for Energy
impl Unpin for Energy
impl UnsafeUnpin for Energy
impl UnwindSafe for Energy
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