Trait ActingClosures

Source
pub trait ActingClosures<T, U> {
    // Required methods
    fn apply<F>(self, closure: F) -> U
       where F: Fn(T) -> U;
    fn also<F>(self, closure: F) -> T
       where F: Fn(&T);
}
Expand description

Trait for closures acting on a generic type

Required Methods§

Source

fn apply<F>(self, closure: F) -> U
where F: Fn(T) -> U,

returns a new value returned by the closure

Source

fn also<F>(self, closure: F) -> T
where F: Fn(&T),

returns the value on which the closure is applied

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.

Implementors§

Source§

impl<T, U> ActingClosures<T, U> for T