rtbase 0.1.0

async runtime base code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub struct Task(std::pin::Pin<Box<dyn std::future::Future<Output = ()>>>);

impl Task {
    pub fn new(future: impl std::future::Future<Output = ()> + 'static) -> Self {
        Self(Box::pin(future))
    }

    pub fn poll(&mut self, waker: &std::task::Waker) -> std::task::Poll<()> {
        self.0
            .as_mut()
            .poll(&mut std::task::Context::from_waker(waker))
    }
}