Skip to main content

RatioExt

Trait RatioExt 

Source
pub trait RatioExt: Sized + Copy {
    const ZERO: Self;
    const ONE: Self;

    // Required methods
    fn as_f64(self) -> f64;
    fn percent_f64(self) -> f64;
}
Expand description

Dimensionless fractions.

Required Associated Constants§

Source

const ZERO: Self

Nothing.

Source

const ONE: Self

The whole (1.0, or 100%).

Required Methods§

Source

fn as_f64(self) -> f64

The fraction as a plain number, where 1.0 is the whole.

Source

fn percent_f64(self) -> f64

The fraction as a percentage.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl RatioExt for Ratio

Source§

const ZERO: Self

Source§

const ONE: Self