macro_rules! interrupt {
($input:expr, $arg:expr) => {{
yield Ok($arg);
$input.take_result()
}};
}
pub(crate) use interrupt;
macro_rules! interrupt_with_maybe_value {
($input:expr, $arg:expr) => {{
use crate::runtime::execution::macros::interrupt;
let res = interrupt!($input, $arg).unwrap();
match res {
crate::runtime::execution::execution_loop::interrupts::InterruptResult::ResolvedValue(value) => value,
_ => unreachable!(),
}
}};
}
pub(crate) use interrupt_with_maybe_value;
macro_rules! interrupt_with_value {
($input:expr, $arg:expr) => {{
use crate::runtime::execution::macros::interrupt_with_maybe_value;
let maybe_value = interrupt_with_maybe_value!($input, $arg);
if let Some(value) = maybe_value {
value
} else {
unreachable!();
}
}};
}
pub(crate) use interrupt_with_value;
macro_rules! interrupt_with_values {
($input:expr, $arg:expr) => {{
use crate::runtime::execution::macros::interrupt;
let res = interrupt!($input, $arg).unwrap();
match res {
crate::runtime::execution::execution_loop::interrupts::InterruptResult::ResolvedValues(values) => values,
_ => unreachable!(),
}
}};
}
pub(crate) use interrupt_with_values;
macro_rules! yield_unwrap {
($e:expr) => {{
let res = $e;
if let Ok(res) = res {
res
} else if let Err(err) = res {
return yield Err(err.into());
} else {
unreachable!();
}
}};
}
pub(crate) use yield_unwrap;