Trait CallInPlace

Source
pub trait CallInPlace<T>: CallInto<T> {
    // Required method
    fn call_inplace<F>(&mut self, f: F) -> Self::Output
       where F: FnMut(&mut T) -> Self::Output;
}
Expand description

The [CallOnMut] is a supertrait of the CallInto trait that enables an object to be passed onto a unary, or single value, function that is applied to the object, but with the ability to mutate the object in-place.

Required Methods§

Source

fn call_inplace<F>(&mut self, f: F) -> Self::Output
where F: FnMut(&mut T) -> Self::Output,

The call_on_mut method allows an object to be passed onto a function that takes a mutable reference to the object. This is useful for cases where you want to perform an operation on an object and mutate it in the process.

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> CallInPlace<T> for T
where T: CallInto<T>,