act_zero/runtimes/
panic.rs1use std::time::Instant;
12
13use futures::future::Pending;
14use futures::task::{Spawn, SpawnError};
15
16use crate::{timer, Actor, Addr};
17
18#[derive(Debug, Copy, Clone, Default)]
20pub struct Runtime;
21
22pub type Timer = timer::Timer<Runtime>;
25
26pub fn spawn_actor<T: Actor>(actor: T) -> Addr<T> {
29 Addr::new(&Runtime, actor).unwrap()
30}
31
32impl Spawn for Runtime {
33 fn spawn_obj(
34 &self,
35 _future: futures::future::FutureObj<'static, ()>,
36 ) -> Result<(), SpawnError> {
37 panic!("No default runtime selected")
38 }
39}
40
41impl timer::SupportsTimers for Runtime {
42 type Delay = Pending<()>;
43 fn delay(&self, _deadline: Instant) -> Self::Delay {
44 panic!("No default runtime selected")
45 }
46}