macro_rules! program_ctor {
(
$prg:ident = $($call:ident)::+ ( $( $arg:ident ),* $(,)? ) .await .unwrap(),
params_struct = $params_ty:ty $(,)?
) => { ... };
(
$prg:ident = $($call:ident)::+ ( $( $arg:ident ),* $(,)? ) .await,
params_struct = $params_ty:ty $(,)?
) => { ... };
(
$prg:ident = $($call:ident)::+ ( $( $arg:ident ),* $(,)? ) .unwrap(),
params_struct = $params_ty:ty $(,)?
) => { ... };
(
$prg:ident = $($call:ident)::+ ( $( $arg:ident ),* $(,)? ),
params_struct = $params_ty:ty $(,)?
) => { ... };
(@store $prg:ident = $program:expr) => { ... };
}Expand description
Evaluates a program constructor call and stores the resulting program in a mutable static slot.
The constructor arguments are expected to already be bound in the local
scope. params_struct = ... is required and is used to convert .unwrap()
failures into a structured panic through
[ok_or_throws!].
§Examples
ⓘ
program_ctor!(
PROGRAM = MyProgram::new(p1, p2).await,
params_struct = meta_in_program::__NewParams,
);
program_ctor!(
PROGRAM = MyProgram::new_result(p1, p2).await.unwrap(),
params_struct = meta_in_program::__NewResultParams,
);