Trait Observer

Source
pub trait Observer<Out: ?Sized> {
    // Provided methods
    fn on_first_poll(&mut self) { ... }
    fn on_poll(&mut self) { ... }
    fn on_poll_ready(&mut self, output: &Out) { ... }
    fn on_finish(&mut self, output: Option<&Out>) { ... }
    fn on_drop(&mut self) { ... }
}
Expand description

Represents an observer, which reacts to different events happening to the future.

If any of the functions is used incorrectly, implementation’s behaviour could be undefined but must always be safe.

Provided Methods§

Source

fn on_first_poll(&mut self)

Called once before the first future’s poll.

Source

fn on_poll(&mut self)

Called each time before the future is polled, but after on_first_poll.

Source

fn on_poll_ready(&mut self, output: &Out)

Called once after the future returns Poll::Ready.

Source

fn on_finish(&mut self, output: Option<&Out>)

Called once after on_poll_ready or before on_drop, depending on whether future was cancelled or not. It isn’t called if there was no call to on_first_poll.

Source

fn on_drop(&mut self)

Called once before the future is dropped, therefore is never called twice and forbids calls to other trait’s functions.

Implementations on Foreign Types§

Source§

impl<Out: ?Sized, O1> Observer<Out> for (O1,)
where O1: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2> Observer<Out> for (O1, O2)
where O1: Observer<Out>, O2: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2, O3> Observer<Out> for (O1, O2, O3)
where O1: Observer<Out>, O2: Observer<Out>, O3: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2, O3, O4> Observer<Out> for (O1, O2, O3, O4)
where O1: Observer<Out>, O2: Observer<Out>, O3: Observer<Out>, O4: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2, O3, O4, O5> Observer<Out> for (O1, O2, O3, O4, O5)
where O1: Observer<Out>, O2: Observer<Out>, O3: Observer<Out>, O4: Observer<Out>, O5: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2, O3, O4, O5, O6> Observer<Out> for (O1, O2, O3, O4, O5, O6)
where O1: Observer<Out>, O2: Observer<Out>, O3: Observer<Out>, O4: Observer<Out>, O5: Observer<Out>, O6: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2, O3, O4, O5, O6, O7> Observer<Out> for (O1, O2, O3, O4, O5, O6, O7)
where O1: Observer<Out>, O2: Observer<Out>, O3: Observer<Out>, O4: Observer<Out>, O5: Observer<Out>, O6: Observer<Out>, O7: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Source§

impl<Out: ?Sized, O1, O2, O3, O4, O5, O6, O7, O8> Observer<Out> for (O1, O2, O3, O4, O5, O6, O7, O8)
where O1: Observer<Out>, O2: Observer<Out>, O3: Observer<Out>, O4: Observer<Out>, O5: Observer<Out>, O6: Observer<Out>, O7: Observer<Out>, O8: Observer<Out>,

Source§

fn on_first_poll(&mut self)

Source§

fn on_poll(&mut self)

Source§

fn on_poll_ready(&mut self, output: &Out)

Source§

fn on_finish(&mut self, output: Option<&Out>)

Source§

fn on_drop(&mut self)

Implementors§