Skip to main content

dope_fiber/abi/
pending.rs

1use core::{marker, task};
2
3use crate::{abi, context};
4
5#[must_use = "a fiber does nothing unless it is driven"]
6#[derive(Debug)]
7pub struct Pending<T> {
8    output: marker::PhantomData<fn() -> T>,
9}
10
11impl<T> Pending<T> {
12    pub const fn new() -> Self {
13        Self {
14            output: marker::PhantomData,
15        }
16    }
17}
18
19impl<T> Default for Pending<T> {
20    fn default() -> Self {
21        Self::new()
22    }
23}
24
25impl<'d, T> abi::Fiber<'d> for Pending<T> {
26    type Output = T;
27
28    fn poll(_call: context::PollCall<'_, '_, 'd, Self>) -> task::Poll<Self::Output> {
29        use core::task::Poll;
30        Poll::Pending
31    }
32}