Skip to main content

dope_fiber/abi/
mod.rs

1#[doc(hidden)]
2pub mod __private;
3
4pub mod batch;
5pub mod future;
6pub mod join;
7pub mod pending;
8pub mod pollfn;
9pub mod race;
10pub mod ready;
11
12use core::pin::Pin;
13use core::task::Poll;
14
15use super::Context;
16
17pub trait Fiber<'d> {
18    type Output;
19
20    fn poll(self: Pin<&mut Self>, cx: Pin<&mut Context<'_, 'd>>) -> Poll<Self::Output>;
21}
22
23pub trait IntoFiber<'d> {
24    type Output;
25    type IntoFiber: Fiber<'d, Output = Self::Output>;
26
27    fn into_fiber(self) -> Self::IntoFiber;
28}
29
30impl<'d, F> IntoFiber<'d> for F
31where
32    F: Fiber<'d>,
33{
34    type Output = F::Output;
35    type IntoFiber = Self;
36
37    fn into_fiber(self) -> Self::IntoFiber {
38        self
39    }
40}