detcore/
record_or_replay.rs1use reverie::Error;
10use reverie::Guest;
11use reverie::Subscription;
12use reverie::Tool;
13use reverie::syscalls::Syscall;
14use serde::Deserialize;
15use serde::Serialize;
16
17use crate::config::Config;
18use crate::tool_global::GlobalState;
19
20pub trait RecordOrReplay: Tool<GlobalState = GlobalState> {}
22
23impl<T> RecordOrReplay for T where T: Tool<GlobalState = GlobalState> {}
24
25#[derive(Debug, Default, Serialize, Deserialize)]
27pub struct NoopTool;
28
29#[reverie::tool]
30impl Tool for NoopTool {
31 type GlobalState = GlobalState;
32 type ThreadState = ();
33
34 fn subscriptions(_cfg: &Config) -> Subscription {
35 Subscription::none()
38 }
39
40 async fn handle_syscall_event<T: Guest<Self>>(
41 &self,
42 guest: &mut T,
43 call: Syscall,
44 ) -> Result<i64, Error> {
45 Ok(guest.inject(call).await?)
48 }
49}