Trait kas_widgets::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§
sourcefn default_step() -> Self
fn default_step() -> Self
The default step size (usually 1)
sourcefn div_as_f64(self, rhs: Self) -> f64
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.
sourcefn mul_f64(self, scalar: f64) -> Self
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).
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl SliderValue for f32
impl SliderValue for f32
source§impl SliderValue for f64
impl SliderValue for f64
source§impl SliderValue for i8
impl SliderValue for i8
source§impl SliderValue for i16
impl SliderValue for i16
source§impl SliderValue for i32
impl SliderValue for i32
source§impl SliderValue for i64
impl SliderValue for i64
source§impl SliderValue for i128
impl SliderValue for i128
source§impl SliderValue for isize
impl SliderValue for isize
source§impl SliderValue for u8
impl SliderValue for u8
source§impl SliderValue for u16
impl SliderValue for u16
source§impl SliderValue for u32
impl SliderValue for u32
source§impl SliderValue for u64
impl SliderValue for u64
source§impl SliderValue for u128
impl SliderValue for u128
source§impl SliderValue for usize
impl SliderValue for usize
source§impl SliderValue for Duration
impl SliderValue for Duration
Implement for Duration
The default step size is 1 second.