widgetry::widgets::plots

Trait Axis

Source
pub trait Axis<T>:
    'static
    + Copy
    + Ord
    + Default {
    // Required methods
    fn from_percent(&self, percent: f64) -> T;
    fn to_percent(self, max: T) -> f64;
    fn prettyprint(self, unit_fmt: &UnitFmt) -> String;
    fn to_f64(self) -> f64;
    fn from_f64(&self, x: f64) -> T;
    fn zero() -> T;
}

Required Methods§

Source

fn from_percent(&self, percent: f64) -> T

Source

fn to_percent(self, max: T) -> f64

Source

fn prettyprint(self, unit_fmt: &UnitFmt) -> String

Source

fn to_f64(self) -> f64

Source

fn from_f64(&self, x: f64) -> T

Source

fn zero() -> T

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Axis<usize> for usize

Source§

fn from_percent(&self, percent: f64) -> usize

Source§

fn to_percent(self, max: usize) -> f64

Source§

fn prettyprint(self, _: &UnitFmt) -> String

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(&self, x: f64) -> usize

Source§

fn zero() -> usize

Source§

impl Axis<Distance> for Distance

Source§

fn from_percent(&self, percent: f64) -> Distance

Source§

fn to_percent(self, max: Distance) -> f64

Source§

fn prettyprint(self, unit_fmt: &UnitFmt) -> String

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(&self, x: f64) -> Distance

Source§

fn zero() -> Distance

Source§

impl Axis<Duration> for Duration

Source§

fn from_percent(&self, percent: f64) -> Duration

Source§

fn to_percent(self, max: Duration) -> f64

Source§

fn prettyprint(self, _: &UnitFmt) -> String

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(&self, x: f64) -> Duration

Source§

fn zero() -> Duration

Source§

impl Axis<Time> for Time

Source§

fn from_percent(&self, percent: f64) -> Time

Source§

fn to_percent(self, max: Time) -> f64

Source§

fn prettyprint(self, _: &UnitFmt) -> String

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(&self, x: f64) -> Time

Source§

fn zero() -> Time

Implementors§