Trait fn_move::FnMove
[−]
[src]
pub trait FnMove<Args>: FnOnce<Args> { unsafe fn call_move(&mut self, args: Args) -> Self::Output; }
A version of FnOnce that takes self
by &mut
reference instead of by value.
This allows you to implement FnOnce on a type owning an FnMove trait object, as long as the wrapper type is Sized.
This trait will be obsolete once the unsized rvalues RFC is implemented.
Required Methods
unsafe fn call_move(&mut self, args: Args) -> Self::Output
Unsafety
Unsafe because this takes self
by reference, but treats it as moved.
The caller must somehow stop the closure's destructor from running afterwards,
whether that's by calling mem::forget
on it or something else.
Implementors
impl<F, Args> FnMove<Args> for F where
F: FnOnce<Args>,