Struct measurements::voltage::Voltage[][src]

pub struct Voltage { /* fields omitted */ }

The Voltage struct can be used to deal with electric potential difference in a common way.

Example

use measurements::Voltage;

let volts = Voltage::from_millivolts(1500.0);
let m_v = volts.as_millivolts();
let k_v = volts.as_kilovolts();
println!("A 1.5 V battery has {} mV or {} kV", m_v, k_v);

Methods

impl Voltage
[src]

Create a new Voltage from a floating point value in Volts

Create a new Voltage from a floating point value in Microvolts

Create a new Voltage from a floating point value in Millivolts

Create a new Voltage from a floating point value in Kilovolts

Convert this Voltage into a floating point value in Volts

Convert this Voltage into a floating point value in Microvolts

Convert this Voltage into a floating point value in Millivolts

Convert this Voltage into a floating point value in Kilovolts

Trait Implementations

impl Copy for Voltage
[src]

impl Clone for Voltage
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Voltage
[src]

Formats the value using the given formatter. Read more

impl Measurement for Voltage
[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 Voltage
[src]

Formats the value using the given formatter. Read more

impl Add for Voltage
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl Sub for Voltage
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl Div<Voltage> for Voltage
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<f64> for Voltage
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Mul<f64> for Voltage
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Mul<Voltage> for f64
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Eq for Voltage
[src]

impl PartialEq for Voltage
[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 Voltage
[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 Mul<Voltage> for Current
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Mul<Current> for Voltage
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Div<Voltage> for Power
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<Current> for Voltage
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl Div<Resistance> for Voltage
[src]

The resulting type after applying the / operator.

Performs the / operation.

Auto Trait Implementations

impl Send for Voltage

impl Sync for Voltage