#[cfg(feature = "use_tokio")]
pub mod tokio;
#[cfg(feature = "use_async-std")]
pub mod async_std;
use core::future::Future;
use std::{fs::File, io};
use crate::rpc::handler::Handler;
pub trait Spawner: Handler {
type Handle;
fn spawn<Fut>(&self, future: Fut) -> Self::Handle
where
Fut: Future<Output = ()> + Send + 'static;
}
#[cfg(unix)]
pub fn unbuffered_stdout() -> io::Result<File> {
use std::{io::stdout, os::fd::AsFd};
let owned_sout_fd = stdout().as_fd().try_clone_to_owned()?;
Ok(File::from(owned_sout_fd))
}
#[cfg(windows)]
pub fn unbuffered_stdout() -> io::Result<File> {
use std::{io::stdout, os::windows::io::AsHandle};
let owned_sout_handle = stdout().as_handle().try_clone_to_owned()?;
Ok(File::from(owned_sout_handle))
}