Struct measurements::energy::Energy
source · [−]pub struct Energy { /* private fields */ }
Expand description
The Energy
struct can be used to deal with energies in a common way.
Common metric and imperial units are supported.
Example
use measurements::Energy;
let energy = Energy::from_kcalories(2500.0);
println!("Some say a health adult male should consume {} per day", energy);
Implementations
Create a new Energy from a floating point value in Joules (or watt-seconds)
Create a new Energy from a floating point value in Kilocalories (often just called calories)
Create a new Energy from a floating point value in British Thermal Units
Create a new Energy from a floating point value in electron Volts (eV).
Create a new Energy from a floating point value in Watt-hours (Wh)
Create a new Energy from a floating point value in Kilowatt-Hours (kWh)
Convert this Energy into a floating point value in Joules (or watt-seconds)
Convert this Energy into a floating point value in Kilocalories (often just called calories)
Convert this Energy into a floating point value in British Thermal Units
Convert this Energy into a floating point value in electron volts (eV)
Convert this Energy into a floating point value in Watt-hours (Wh)
Convert this Energy into a floating point value in kilowatt-hours (kWh)
Trait Implementations
Performs the conversion.
Get this quantity in the base units
Create a new quantity from the base units
Return the base unit for this type, as a string. For example “kilograms” Read more
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
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Energy
impl UnwindSafe for Energy
Blanket Implementations
Mutably borrows from an owned value. Read more