Skip to main content

ApplyOnce

Trait ApplyOnce 

Source
pub trait ApplyOnce<T> {
    type Cont<_T>;

    // Required method
    fn apply_once<U, F>(self, rhs: F) -> Self::Cont<U>
       where F: FnOnce(T) -> U;
}
Expand description

A the ApplyOnce trait is similar to [Map], but it consumes the instance instead of borrowing it;

Required Associated Types§

Source

type Cont<_T>

Required Methods§

Source

fn apply_once<U, F>(self, rhs: F) -> Self::Cont<U>
where F: FnOnce(T) -> U,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> ApplyOnce<T> for Option<T>

Source§

type Cont<U> = Option<U>

Source§

fn apply_once<U, F>(self, rhs: F) -> Self::Cont<U>
where F: FnOnce(T) -> U,

Implementors§