Skip to main content

ClosureMode

Trait ClosureMode 

Source
pub trait ClosureMode {
    type Target<'a, A: 'a, B: 'a>: ?Sized + 'a;
    type SendTarget<'a, A: 'a, B: 'a>: ?Sized + 'a;
}
Expand description

Trait that maps a closure mode marker (Val or Ref) to the corresponding dyn Fn trait object type.

Used by CloneFn to parameterize the Deref target of wrapped closures. Val produces dyn Fn(A) -> B (by-value), Ref produces dyn Fn(&A) -> B (by-reference).

Required Associated Types§

Source

type Target<'a, A: 'a, B: 'a>: ?Sized + 'a

The unsized closure trait object type for this mode.

Source

type SendTarget<'a, A: 'a, B: 'a>: ?Sized + 'a

The unsized closure trait object type for this mode with Send + Sync bounds.

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 ClosureMode for Ref

Source§

type SendTarget<'a, A: 'a, B: 'a> = dyn Fn(&A) -> B + Send + Sync + 'a

Source§

type Target<'a, A: 'a, B: 'a> = dyn Fn(&A) -> B + 'a

Source§

impl ClosureMode for Val

Source§

type SendTarget<'a, A: 'a, B: 'a> = dyn Fn(A) -> B + Send + Sync + 'a

Source§

type Target<'a, A: 'a, B: 'a> = dyn Fn(A) -> B + 'a