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 std::time as walltime;
use anyhow::Result;
use traffloat_def::edge::AlphaBeta;
use traffloat_def::node::NodeId;
use traffloat_types::time::Instant;
use crate::{edge, node, Sun};
pub trait Server: 'static {
fn receive(&mut self) -> Result<Option<Event>>;
fn load_asset(&self, name: &str) -> String;
}
pub enum Event {
AddNode(node::View),
RemoveNode(NodeId),
AddEdge(edge::View),
RemoveEdge(AlphaBeta),
SetClock(SetClock),
SetSun(Sun),
}
pub struct SetClock {
pub now: Instant,
pub wall_time_per_tick: walltime::Duration,
}