pub trait SpinnerValue: Copy + PartialOrd + Debug + FromStr + ToString + 'static {
    // Required methods
    fn default_step() -> Self;
    fn clamp(self, l_bound: Self, u_bound: Self) -> Self;
    fn add_step(self, step: Self, u_bound: Self) -> Self;
    fn sub_step(self, step: Self, l_bound: Self) -> Self;
}
Expand description

Requirements on type used by Spinner

Implementations are provided for standard float and integer types.

Required Methods§

source

fn default_step() -> Self

The default step size (usually 1)

source

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

Clamp self to the range l_bound..=u_bound

source

fn add_step(self, step: Self, u_bound: Self) -> Self

Add x without overflow, clamping the result to no more than u_bound

source

fn sub_step(self, step: Self, l_bound: Self) -> Self

Subtract step without overflow, clamping the result to no less than l_bound

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SpinnerValue for f32

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for f64

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for i8

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for i16

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for i32

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for i64

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for i128

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for isize

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for u8

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for u16

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for u32

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for u64

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for u128

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

source§

impl SpinnerValue for usize

source§

fn default_step() -> Self

source§

fn clamp(self, l_bound: Self, u_bound: Self) -> Self

source§

fn add_step(self, step: Self, u_bound: Self) -> Self

source§

fn sub_step(self, step: Self, l_bound: Self) -> Self

Implementors§