Trait zng_layout::unit::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>.

Implementations on Foreign Types§

source§

impl FactorUnits for f32

source§

impl FactorUnits for i32

Implementors§