With

Trait With 

Source
pub(crate) trait With<T> {
    // Required methods
    fn with<O, F: FnOnce(T) -> O>(self, f: F) -> O;
    fn try_with_or<E, F: FnOnce() -> Result<T, E>>(
        f: F,
        err: E,
    ) -> Result<Self, E>
       where Self: Sized;
}

Required Methods§

Source

fn with<O, F: FnOnce(T) -> O>(self, f: F) -> O

Source

fn try_with_or<E, F: FnOnce() -> Result<T, E>>(f: F, err: E) -> Result<Self, E>
where Self: Sized,

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> With<T> for Infallible

Source§

fn with<O, F: FnOnce(T) -> O>(self, _f: F) -> O

Source§

fn try_with_or<E, F: FnOnce() -> Result<T, E>>(_f: F, err: E) -> Result<Self, E>

Implementors§

Source§

impl<T: Inhabited> With<T> for T