Trait SliderValue

Source
pub trait SliderValue:
    Copy
    + Debug
    + PartialOrd
    + Add<Output = Self>
    + Sub<Output = Self>
    + 'static {
    // Required methods
    fn default_step() -> Self;
    fn div_as_f64(self, rhs: Self) -> f64;
    fn mul_f64(self, scalar: f64) -> Self;
}
Expand description

Requirements on type used by Slider

Implementations are provided for standard float and integer types.

Required Methods§

Source

fn default_step() -> Self

The default step size (usually 1)

Source

fn div_as_f64(self, rhs: Self) -> f64

Divide self by another instance of this type, returning an f64

Note: in practice, we always have rhs >= self and expect the result to be between 0 and 1.

Source

fn mul_f64(self, scalar: f64) -> Self

Return the result of multiplying self by an f64 scalar

Note: the scalar is expected to be between 0 and 1, hence this operation should not produce a value larger than self.

Also note that this method is not required to preserve precision (e.g. u128::mul_64 may drop some low-order bits with large numbers).

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 SliderValue for f32

Source§

fn default_step() -> f32

Source§

fn div_as_f64(self, rhs: f32) -> f64

Source§

fn mul_f64(self, scalar: f64) -> f32

Source§

impl SliderValue for f64

Source§

fn default_step() -> f64

Source§

fn div_as_f64(self, rhs: f64) -> f64

Source§

fn mul_f64(self, scalar: f64) -> f64

Source§

impl SliderValue for i8

Source§

fn default_step() -> i8

Source§

fn div_as_f64(self, rhs: i8) -> f64

Source§

fn mul_f64(self, scalar: f64) -> i8

Source§

impl SliderValue for i16

Source§

fn default_step() -> i16

Source§

fn div_as_f64(self, rhs: i16) -> f64

Source§

fn mul_f64(self, scalar: f64) -> i16

Source§

impl SliderValue for i32

Source§

fn default_step() -> i32

Source§

fn div_as_f64(self, rhs: i32) -> f64

Source§

fn mul_f64(self, scalar: f64) -> i32

Source§

impl SliderValue for i64

Source§

fn default_step() -> i64

Source§

fn div_as_f64(self, rhs: i64) -> f64

Source§

fn mul_f64(self, scalar: f64) -> i64

Source§

impl SliderValue for i128

Source§

fn default_step() -> i128

Source§

fn div_as_f64(self, rhs: i128) -> f64

Source§

fn mul_f64(self, scalar: f64) -> i128

Source§

impl SliderValue for isize

Source§

fn default_step() -> isize

Source§

fn div_as_f64(self, rhs: isize) -> f64

Source§

fn mul_f64(self, scalar: f64) -> isize

Source§

impl SliderValue for u8

Source§

fn default_step() -> u8

Source§

fn div_as_f64(self, rhs: u8) -> f64

Source§

fn mul_f64(self, scalar: f64) -> u8

Source§

impl SliderValue for u16

Source§

fn default_step() -> u16

Source§

fn div_as_f64(self, rhs: u16) -> f64

Source§

fn mul_f64(self, scalar: f64) -> u16

Source§

impl SliderValue for u32

Source§

fn default_step() -> u32

Source§

fn div_as_f64(self, rhs: u32) -> f64

Source§

fn mul_f64(self, scalar: f64) -> u32

Source§

impl SliderValue for u64

Source§

fn default_step() -> u64

Source§

fn div_as_f64(self, rhs: u64) -> f64

Source§

fn mul_f64(self, scalar: f64) -> u64

Source§

impl SliderValue for u128

Source§

fn default_step() -> u128

Source§

fn div_as_f64(self, rhs: u128) -> f64

Source§

fn mul_f64(self, scalar: f64) -> u128

Source§

impl SliderValue for usize

Source§

fn default_step() -> usize

Source§

fn div_as_f64(self, rhs: usize) -> f64

Source§

fn mul_f64(self, scalar: f64) -> usize

Source§

impl SliderValue for Duration

Implement for Duration

The default step size is 1 second.

Implementors§