1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use futures::future::{ready, Ready};
use std::future::Future;

#[derive(Debug)]
pub struct JoinError;

pub type TaskHandle<T> = Ready<Result<T, JoinError>>;

pub fn spawn_task<F, T>(_: F) -> TaskHandle<T>
where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static,
{
    ready(Err(JoinError))
}

pub fn spawn_blocking<F, T>(_: F) -> TaskHandle<T>
where
    F: FnOnce() -> T + Send + 'static,
    T: Send + 'static,
{
    ready(Err(JoinError))
}

impl std::fmt::Display for JoinError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Please enable a runtime")
    }
}

impl std::error::Error for JoinError {}