Trait WrapperExt

Source
pub trait WrapperExt: Wrapper {
    // Provided methods
    fn replace(&mut self, value: Self::Item) -> Self::Item { ... }
    fn set(&mut self, value: Self::Item) -> &mut Self { ... }
    fn swap(&mut self, other: &mut Self) { ... }
    fn take(&mut self) -> Self::Item
       where Self::Item: Default { ... }
}
Expand description

WrapperExt is an automatically implemented trait extending the Wrapper trait with additional

Provided Methods§

Source

fn replace(&mut self, value: Self::Item) -> Self::Item

replace replaces the value inside the wrapper with a new one, returning the old value.

Source

fn set(&mut self, value: Self::Item) -> &mut Self

update the current value before returning a mutable reference to the wrapper

Source

fn swap(&mut self, other: &mut Self)

swap swaps the inner values of two instances.

Source

fn take(&mut self) -> Self::Item
where Self::Item: Default,

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, U> WrapperExt for T
where T: Wrapper<Item = U>,