CancelCallback

Trait CancelCallback 

Source
pub trait CancelCallback<'wait_list, L: Lock, I, O>: Sized {
    // Required method
    fn on_cancel(self, list: LockedExclusive<'wait_list, L, I, O>, output: O);
}
Expand description

A callback that is called in the event that the future has been woken but was cancelled before it could complete.

This trait is implemented for all functions and closures that accept a LockedExclusive<'wait_list, L, I, O> and an O, but is also available as a separate trait so you can implement it on concrete types.

Required Methods§

Source

fn on_cancel(self, list: LockedExclusive<'wait_list, L, I, O>, output: O)

Called when the future has been woken but was cancelled before it could complete.

It is given an exclusive lock to the associated WaitList as well as the output value that was not yielded by the future.

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<'wait_list, L, I, O, F> CancelCallback<'wait_list, L, I, O> for F
where L: 'wait_list + Lock, I: 'wait_list, O: 'wait_list, F: FnOnce(LockedExclusive<'wait_list, L, I, O>, O),