cfx_executor/stack/
resources.rs1use crate::{
2 executive_observer::TracerTrait, stack::CallStackInfo, state::State,
3};
4
5pub struct RuntimeRes<'a> {
7 pub state: &'a mut State,
10
11 pub callstack: &'a mut CallStackInfo,
13
14 pub tracer: &'a mut dyn TracerTrait,
18}
19
20#[cfg(test)]
21pub mod runtime_res_test {
22 use super::RuntimeRes;
23 use crate::stack::CallStackInfo;
24
25 use super::State;
26
27 pub struct OwnedRuntimeRes<'a> {
28 state: &'a mut State,
29 callstack: CallStackInfo,
30 tracer: (),
31 }
32
33 impl<'a> From<&'a mut State> for OwnedRuntimeRes<'a> {
34 fn from(state: &'a mut State) -> Self {
35 OwnedRuntimeRes {
36 state,
37 callstack: CallStackInfo::new(),
38 tracer: (),
39 }
40 }
41 }
42
43 impl<'a> OwnedRuntimeRes<'a> {
44 pub fn as_res<'b>(&'b mut self) -> RuntimeRes<'b> {
45 RuntimeRes {
46 state: &mut self.state,
47 callstack: &mut self.callstack,
48 tracer: &mut self.tracer,
49 }
50 }
51 }
52}