Skip to main content

dope_fiber/abi/
mod.rs

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