Trait SpinnerValue

Source
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

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 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§