Skip to main content

PollWith

Trait PollWith 

Source
pub trait PollWith<'a, E: ?Sized, EMut: ?Sized>: PollStrategy {
    type Progress;

    // Required method
    fn poll_progress(
        state: Pin<&mut Self::Pollable>,
        ext: &'a E,
        ext_mut: &mut EMut,
        cx: &mut Context<'_>,
    ) -> Poll<ControlFlow<Option<Self::Progress>, Self::Progress>>;
}
Expand description

Determines how the Selector polls the tasks and interprets their outputs.

Required Associated Types§

Source

type Progress

Type of values returned when polling the task.

Required Methods§

Source

fn poll_progress( state: Pin<&mut Self::Pollable>, ext: &'a E, ext_mut: &mut EMut, cx: &mut Context<'_>, ) -> Poll<ControlFlow<Option<Self::Progress>, Self::Progress>>

Polls the given task, providing references to strongly typed extensions.

§Extensions

This method supports passing references to immutable and immutable extensions that can be used by the task. This allows the tasks for operating on a shared state without any unsafe code or synchronization primitives. Even more, extensions allow for static polymorphism in the types returned by the task. See relevant example.

§Returns
  • ControlFlow::Continue if the task has not finished and might yield more values
  • ControlFlow::Break if the task has finished

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, F: Future> PollWith<'a, (), ()> for PollAsFuture<F>

Source§

impl<'a, S: Stream> PollWith<'a, (), ()> for PollAsStream<S>