Trait CallInto

Source
pub trait CallInto<T> {
    type Output;

    // Required method
    fn call_into<F>(self, f: F) -> Self::Output
       where F: FnOnce(T) -> Self::Output;
}
Expand description

The CallInto trait is a consuming interface for passing an object into a single-valued function. While the intended affect is the same as CallOn, the difference is that CallInto enables a transfer of ownership instead of relyin upon a reference.

Required Associated Types§

Required Methods§

Source

fn call_into<F>(self, f: F) -> Self::Output
where F: FnOnce(T) -> Self::Output,

The call_into method allows an object to be passed into a function that takes ownership of the object. This is useful for cases where you want to perform an operation on an object and consume 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> CallInto<T> for T