cushy

Trait WithClone

Source
pub trait WithClone: Sized {
    type Cloned;

    // Required method
    fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R;
}
Expand description

Invokes a function with a clone of self.

Required Associated Types§

Source

type Cloned

The type that results from cloning.

Required Methods§

Source

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Maps with with the results of cloning self.

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<'a, T0: Clone> WithClone for (&'a T0,)

Source§

type Cloned = (T0,)

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Source§

impl<'a, T0: Clone, T1: Clone> WithClone for (&'a T0, &'a T1)

Source§

type Cloned = (T0, T1)

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Source§

impl<'a, T0: Clone, T1: Clone, T2: Clone> WithClone for (&'a T0, &'a T1, &'a T2)

Source§

type Cloned = (T0, T1, T2)

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Source§

impl<'a, T0: Clone, T1: Clone, T2: Clone, T3: Clone> WithClone for (&'a T0, &'a T1, &'a T2, &'a T3)

Source§

type Cloned = (T0, T1, T2, T3)

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Source§

impl<'a, T0: Clone, T1: Clone, T2: Clone, T3: Clone, T4: Clone> WithClone for (&'a T0, &'a T1, &'a T2, &'a T3, &'a T4)

Source§

type Cloned = (T0, T1, T2, T3, T4)

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Source§

impl<'a, T0: Clone, T1: Clone, T2: Clone, T3: Clone, T4: Clone, T5: Clone> WithClone for (&'a T0, &'a T1, &'a T2, &'a T3, &'a T4, &'a T5)

Source§

type Cloned = (T0, T1, T2, T3, T4, T5)

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Source§

impl<T> WithClone for &T
where T: Clone,

Source§

type Cloned = T

Source§

fn with_clone<R>(&self, with: impl FnOnce(Self::Cloned) -> R) -> R

Implementors§