pub trait With: Sized {
// Provided methods
fn wrap_with<U, F: FnOnce(Self) -> U>(self, f: F) -> U { ... }
fn with<F: FnOnce(&mut Self)>(self, f: F) -> Self { ... }
fn try_with<E, F>(self, f: F) -> Result<Self, E>
where F: FnOnce(&mut Self) -> Result<(), E> { ... }
fn with_if<F>(self, condition: bool, f: F) -> Self
where F: FnOnce(&mut Self) { ... }
}Expand description
Generic trait to enable chainable API
Provided Methods§
Sourcefn wrap_with<U, F: FnOnce(Self) -> U>(self, f: F) -> U
fn wrap_with<U, F: FnOnce(Self) -> U>(self, f: F) -> U
Calls the given closure and return the result.
Used to chainify wrapper constructors.
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.