datex_core/runtime/execution/
macros.rs1macro_rules! interrupt {
3 ($input:expr, $arg:expr) => {{
4 yield Ok($arg);
5 $input.take_result()
6 }};
7}
8pub(crate) use interrupt;
9
10macro_rules! interrupt_with_maybe_value {
13 ($input:expr, $arg:expr) => {{
14 use crate::runtime::execution::macros::interrupt;
15
16 let res = interrupt!($input, $arg).unwrap();
17 match res {
18 crate::runtime::execution::execution_loop::interrupts::InterruptResult::ResolvedValue(value) => value,
19 _ => unreachable!(),
20 }
21 }};
22}
23pub(crate) use interrupt_with_maybe_value;
24
25macro_rules! interrupt_with_value {
28 ($input:expr, $arg:expr) => {{
29 use crate::runtime::execution::macros::interrupt_with_maybe_value;
30 let maybe_value = interrupt_with_maybe_value!($input, $arg);
31 if let Some(value) = maybe_value {
32 value
33 } else {
34 unreachable!();
35 }
36 }};
37}
38pub(crate) use interrupt_with_value;
39
40macro_rules! yield_unwrap {
44 ($e:expr) => {{
45 let res = $e;
46 if let Ok(res) = res {
47 res
48 } else if let Err(err) = res {
49 return yield Err(err.into());
50 } else {
51 unreachable!();
52 }
53 }};
54}
55pub(crate) use yield_unwrap;