Scope

Trait Scope 

Source
pub trait Scope {
    // Provided methods
    fn with<F, R>(self, f: F) -> R
       where Self: Sized,
             F: FnOnce(Self) -> R { ... }
    fn with_ref<F, R>(&self, f: F) -> R
       where F: FnOnce(&Self) -> R { ... }
    fn with_mut<F, R>(&mut self, f: F) -> R
       where F: FnOnce(&mut Self) -> R { ... }
}
Expand description

Scoped functional programming extensions.

Provided Methods§

Source

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.

Source

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.

Source

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.

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.

Implementors§

Source§

impl<T> Scope for T