Skip to main content

FactorUnits

Trait FactorUnits 

Source
pub trait FactorUnits {
    // Required methods
    fn pct(self) -> FactorPercent;
    fn fct(self) -> Factor;
}
Expand description

Extension methods for initializing factor units.

This trait is implemented for f32 and u32 allowing initialization of factor unit types using the <number>.<unit>() syntax.

§Examples

let percent = 100.pct();

Required Methods§

Source

fn pct(self) -> FactorPercent

Percent factor.

Source

fn fct(self) -> Factor

Normalized factor.

§Note

Factor implements From<f32>.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FactorUnits for f32

Source§

impl FactorUnits for i32

Implementors§