dharitri_vm_executor/new_traits/
breakpoint_value_new.rs1use crate::BreakpointValueLegacy;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum BreakpointValue {
5 None = 0,
7
8 OutOfGas = 1,
10
11 MemoryLimit = 2,
13}
14
15impl BreakpointValue {
16 pub fn as_u64(self) -> u64 {
17 self as u64
18 }
19
20 pub fn to_legacy(self) -> BreakpointValueLegacy {
21 match self {
22 BreakpointValue::None => BreakpointValueLegacy::None,
23 BreakpointValue::OutOfGas => BreakpointValueLegacy::OutOfGas,
24 BreakpointValue::MemoryLimit => BreakpointValueLegacy::MemoryLimit,
25 }
26 }
27}
28
29pub struct UnknownBreakpointValueError;
30
31impl TryFrom<u64> for BreakpointValue {
32 type Error = UnknownBreakpointValueError;
33
34 fn try_from(value: u64) -> Result<Self, Self::Error> {
35 match value {
36 0 => Ok(BreakpointValue::None),
37 4 => Ok(BreakpointValue::OutOfGas),
38 5 => Ok(BreakpointValue::MemoryLimit),
39 _ => Err(UnknownBreakpointValueError),
40 }
41 }
42}