rtvm_interpreter/
interpreter_action.rs1mod call_inputs;
2mod call_outcome;
3mod create_inputs;
4mod create_outcome;
5mod eof_create_inputs;
6mod eof_create_outcome;
7
8pub use call_inputs::{CallInputs, CallScheme, CallValue};
9pub use call_outcome::CallOutcome;
10pub use create_inputs::{CreateInputs, CreateScheme};
11pub use create_outcome::CreateOutcome;
12pub use eof_create_inputs::EOFCreateInput;
13pub use eof_create_outcome::EOFCreateOutcome;
14
15use crate::InterpreterResult;
16use std::boxed::Box;
17
18#[derive(Clone, Debug, Default, PartialEq, Eq)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20pub enum InterpreterAction {
21 Call { inputs: Box<CallInputs> },
24 Create { inputs: Box<CreateInputs> },
26 EOFCreate { inputs: Box<EOFCreateInput> },
28 Return { result: InterpreterResult },
30 #[default]
32 None,
33}
34
35impl InterpreterAction {
36 pub fn is_call(&self) -> bool {
38 matches!(self, InterpreterAction::Call { .. })
39 }
40
41 pub fn is_create(&self) -> bool {
43 matches!(self, InterpreterAction::Create { .. })
44 }
45
46 pub fn is_return(&self) -> bool {
48 matches!(self, InterpreterAction::Return { .. })
49 }
50
51 pub fn is_none(&self) -> bool {
53 matches!(self, InterpreterAction::None)
54 }
55
56 pub fn is_some(&self) -> bool {
58 !self.is_none()
59 }
60
61 pub fn into_result_return(self) -> Option<InterpreterResult> {
63 match self {
64 InterpreterAction::Return { result } => Some(result),
65 _ => None,
66 }
67 }
68}