pub struct Loop<S: Unpin, T, F: Stateful<S, T>> { /* private fields */ }Expand description
Composable asynchronous event loop.
Implementations
sourceimpl<S: Unpin, T, F: Stateful<S, T>> Loop<S, T, F>
impl<S: Unpin, T, F: Stateful<S, T>> Loop<S, T, F>
sourcepub fn on<P, O, N>(
self,
past: P,
then: fn(_: &mut S, _: O) -> Poll<T>
) -> Loop<S, T, impl Stateful<S, T>>ⓘNotable traits for Loop<S, T, F>impl<S: Unpin, T: Unpin, F: Stateful<S, T>> Future for Loop<S, T, F> type Output = T; where
P: ToPast<N, O>,
N: Pasty<O>,
pub fn on<P, O, N>(
self,
past: P,
then: fn(_: &mut S, _: O) -> Poll<T>
) -> Loop<S, T, impl Stateful<S, T>>ⓘNotable traits for Loop<S, T, F>impl<S: Unpin, T: Unpin, F: Stateful<S, T>> Future for Loop<S, T, F> type Output = T; where
P: ToPast<N, O>,
N: Pasty<O>,
Register an event handler.
Parameter past may be one of:
IntoIterator<IntoIter =RepeatWith<Future>>:
(future must beUnpin)- An async function (no parameters) / closure that returns a future (allocates):
- A poll function (
FnMut(&mut Context<'_>) -> Poll<O>) - Anything that dereferences to a slice of any of the above
(passes
(usize, O)tothen())
Trait Implementations
Auto Trait Implementations
impl<S, T, F> RefUnwindSafe for Loop<S, T, F> where
F: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T, F> Send for Loop<S, T, F> where
F: Send,
S: Send,
T: Send,
impl<S, T, F> Sync for Loop<S, T, F> where
F: Sync,
S: Sync,
T: Sync,
impl<S, T, F> Unpin for Loop<S, T, F> where
T: Unpin,
impl<S, T, F> UnwindSafe for Loop<S, T, F> where
F: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for F where
F: Future,
impl<F> IntoFuture for F where
F: Future,
type Output = <F as Future>::Output
type Output = <F as Future>::Output
🔬 This is a nightly-only experimental API. (
into_future)The output that the future will produce on completion.
type IntoFuture = F
type IntoFuture = F
🔬 This is a nightly-only experimental API. (
into_future)Which kind of future are we turning this into?
sourcefn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
🔬 This is a nightly-only experimental API. (
into_future)Creates a future from a value.