use std::time::Instant;
use futures::future::Pending;
use futures::task::{Spawn, SpawnError};
use crate::{timer, Actor, Addr};
#[derive(Debug, Copy, Clone, Default)]
pub struct Runtime;
pub type Timer = timer::Timer<Runtime>;
pub fn spawn_actor<T: Actor>(actor: T) -> Addr<T> {
Addr::new(&Runtime, actor).unwrap()
}
impl Spawn for Runtime {
fn spawn_obj(
&self,
_future: futures::future::FutureObj<'static, ()>,
) -> Result<(), SpawnError> {
panic!("No default runtime selected")
}
}
impl timer::SupportsTimers for Runtime {
type Delay = Pending<()>;
fn delay(&self, _deadline: Instant) -> Self::Delay {
panic!("No default runtime selected")
}
}