Struct measurements::energy::Energy[][src]

pub struct Energy { /* fields omitted */ }

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);

Methods

impl Energy
[src]

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

impl Copy for Energy
[src]

impl Clone for Energy
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Energy
[src]

Formats the value using the given formatter. Read more

impl Measurement for Energy
[src]

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

Given a list of units and their scale relative to the base unit, select the most appropriate one. Read more

impl Display for Energy
[src]

Formats the value using the given formatter. Read more

impl Add for Energy
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl Sub for Energy
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl Div<Energy> for Energy
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<f64> for Energy
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Mul<f64> for Energy
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Mul<Energy> for f64
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Eq for Energy
[src]

impl PartialEq for Energy
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialOrd for Energy
[src]

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl From<TorqueEnergy> for Energy
[src]

Performs the conversion.

impl Div<Power> for Energy
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<Duration> for Energy
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<Length> for Energy
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<Force> for Energy
[src]

The resulting type after applying the / operator.

Performs the / operation.

Auto Trait Implementations

impl Send for Energy

impl Sync for Energy