Skip to main content

Scale

Trait Scale 

Source
pub trait Scale<T> {
    // Required method
    fn tick(&self, value: &T) -> Option<f32>;

    // Provided method
    fn nearest_index(&self, _tick: f32) -> usize { ... }
}

Required Methods§

Source

fn tick(&self, value: &T) -> Option<f32>

Get the tick of the scale.

Provided Methods§

Source

fn nearest_index(&self, _tick: f32) -> usize

The index of the domain value whose position is nearest tick; 0 for an empty domain or a scale without discrete positions.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> Scale<T> for ScaleBand<T>
where T: Eq + Hash,

Source§

impl<T> Scale<T> for ScaleLinear<T>
where T: PlotValue,

Source§

impl<T> Scale<T> for ScalePoint<T>
where T: PartialEq,