StepWith

Trait StepWith 

Source
pub trait StepWith<T> {
    type Output;

    // Required method
    fn step_with<F>(&mut self, f: F) -> Self::Output
       where F: FnOnce(&T) -> T;
}
Expand description

StepWith is a trait defining an interface that can be best described as a more flexible take method, however, instead of leaving the default value in place of the previous one, it allows for a generator function to be provided.

Required Associated Types§

Required Methods§

Source

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&T) -> T,

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

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&f32) -> f32,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = f32

Source§

impl StepWith<f64> for f64

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&f64) -> f64,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = f64

Source§

impl StepWith<i8> for i8

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&i8) -> i8,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = i8

Source§

impl StepWith<i16> for i16

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&i16) -> i16,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = i16

Source§

impl StepWith<i32> for i32

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&i32) -> i32,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = i32

Source§

impl StepWith<i64> for i64

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&i64) -> i64,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = i64

Source§

impl StepWith<i128> for i128

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&i128) -> i128,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = i128

Source§

impl StepWith<isize> for isize

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&isize) -> isize,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = isize

Source§

impl StepWith<u8> for u8

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&u8) -> u8,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = u8

Source§

impl StepWith<u16> for u16

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&u16) -> u16,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = u16

Source§

impl StepWith<u32> for u32

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&u32) -> u32,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = u32

Source§

impl StepWith<u64> for u64

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&u64) -> u64,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = u64

Source§

impl StepWith<u128> for u128

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&u128) -> u128,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = u128

Source§

impl StepWith<usize> for usize

Source§

fn step_with<F>(&mut self, f: F) -> Self::Output
where F: FnOnce(&usize) -> usize,

Creates the next value by incrementing the current one using a generator function.

Source§

type Output = usize

Implementors§

Source§

impl<T, K> StepWith<T> for IndexBase<T, K>
where T: RawIndex,