StepOps

Trait StepOps 

Source
pub trait StepOps:
    Num
    + PartialOrd
    + Copy
    + Debug
    + Display {
    // Required methods
    fn min() -> Self;
    fn max() -> Self;
    fn to_usize(self) -> usize;

    // Provided methods
    fn negative_one() -> Self { ... }
    fn floor(self) -> Self { ... }
    fn abs(self) -> Self { ... }
}
Expand description

StepOps describes trait for ‘step’ in ‘for’ loop

Required Methods§

Source

fn min() -> Self

min value of step

Source

fn max() -> Self

max value of step

Source

fn to_usize(self) -> usize

Provided Methods§

Source

fn negative_one() -> Self

-1 value of step

Source

fn floor(self) -> Self

floor for float, or same for int

Source

fn abs(self) -> Self

abs value

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

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn floor(self) -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for f64

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn floor(self) -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for i8

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for i16

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for i32

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for i64

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for i128

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn to_usize(self) -> usize

Source§

impl StepOps for isize

Source§

fn min() -> Self

Source§

fn max() -> Self

Source§

fn to_usize(self) -> usize

Implementors§