evm_interpreter/error/
mod.rs

1use alloc::boxed::Box;
2
3mod exit;
4
5pub use self::exit::{ExitError, ExitException, ExitFatal, ExitResult, ExitSucceed};
6
7/// Capture represents the result of execution.
8#[derive(Debug, Eq, PartialEq)]
9pub enum Capture<E, T> {
10	/// The machine has exited. It cannot be executed again.
11	Exit(E),
12	/// The machine has trapped. It is waiting for external information, and can
13	/// be executed again.
14	Trap(Box<T>),
15}
16
17impl<E, T> Capture<E, T> {
18	pub fn exit(self) -> Option<E> {
19		match self {
20			Self::Exit(e) => Some(e),
21			Self::Trap(_) => None,
22		}
23	}
24
25	pub fn trap(self) -> Option<Box<T>> {
26		match self {
27			Self::Exit(_) => None,
28			Self::Trap(t) => Some(t),
29		}
30	}
31}