aral_runtime_noop/task/
mod.rs

1use std::{
2    any::Any,
3    future::Future,
4    marker::PhantomData,
5    pin::Pin,
6    result,
7    task::{Context, Poll},
8    time::Duration,
9};
10
11#[inline]
12pub async fn sleep(_duration: Duration) {
13    no_runtime_specified!();
14}
15
16pub struct JoinHandle<T>(PhantomData<T>);
17
18impl<T> Unpin for JoinHandle<T> {}
19
20impl<T> JoinHandle<T> {
21    #[inline]
22    pub async fn cancel(self) -> Option<T> {
23        no_runtime_specified!();
24    }
25}
26
27impl<T> Future for JoinHandle<T> {
28    type Output = result::Result<T, Box<dyn Any + Send + 'static>>;
29
30    #[inline]
31    fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
32        no_runtime_specified!();
33    }
34}
35
36#[inline]
37pub fn spawn<T: Send + 'static>(
38    _future: impl Future<Output = T> + Send + 'static,
39) -> JoinHandle<T> {
40    no_runtime_specified!();
41}
42
43#[inline]
44pub fn spawn_blocking<T: Send + 'static>(_f: impl FnOnce() -> T + Send + 'static) -> JoinHandle<T> {
45    no_runtime_specified!();
46}