apply

Trait Apply

source
pub trait Apply<Res> {
    // Provided methods
    fn apply<F: FnOnce(Self) -> Res>(self, f: F) -> Res
       where Self: Sized { ... }
    fn apply_ref<F: FnOnce(&Self) -> Res>(&self, f: F) -> Res { ... }
    fn apply_mut<F: FnOnce(&mut Self) -> Res>(&mut self, f: F) -> Res { ... }
}
Expand description

Represents a type which can have functions applied to it (implemented by default for all types).

Provided Methods§

source

fn apply<F: FnOnce(Self) -> Res>(self, f: F) -> Res
where Self: Sized,

Apply a function which takes the parameter by value.

source

fn apply_ref<F: FnOnce(&Self) -> Res>(&self, f: F) -> Res

Apply a function which takes the parameter by reference.

source

fn apply_mut<F: FnOnce(&mut Self) -> Res>(&mut self, f: F) -> Res

Apply a function which takes the parameter by mutable reference.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: ?Sized, Res> Apply<Res> for T