MutFunc

Trait MutFunc 

Source
pub trait MutFunc<T> {
    // Required methods
    fn map<F>(self, f: F) -> Self
       where F: FnMut(&mut T);
    fn mmap<F>(&mut self, f: F)
       where F: FnMut(&mut T);
    fn conc(self, other: Self) -> Self;
}

Required Methods§

Source

fn map<F>(self, f: F) -> Self
where F: FnMut(&mut T),

Source

fn mmap<F>(&mut self, f: F)
where F: FnMut(&mut T),

Source

fn conc(self, other: Self) -> Self

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<T> MutFunc<T> for Vec<T>

Source§

fn map<F>(self, f: F) -> Self
where F: FnMut(&mut T),

use fnrs::MutFunc;
assert_eq!(vec![3,6,9],vec![1,2,3].map(|x| *x *= 3));
Source§

fn mmap<F>(&mut self, f: F)
where F: FnMut(&mut T),

use fnrs::MutFunc;
let mut x = vec![0,1,2];
x.mmap(|x| *x += 1);
assert_eq!(x, vec![1,2,3]);
Source§

fn conc(self, other: Self) -> Self

use fnrs::MutFunc;
let x = vec![0,1,2];
let y = vec![0,1,2];
assert_eq!(x.conc(y), vec![0,1,2,0,1,2]);

Implementors§