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§
Sourcefn apply<F: FnOnce(Self) -> Res>(self, f: F) -> Reswhere
Self: Sized,
fn apply<F: FnOnce(Self) -> Res>(self, f: F) -> Reswhere
Self: Sized,
Apply a function which takes the parameter by 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.