macro_rules! repeat {
($name:ident<$T:ty> = {
counter: $counter:expr,
limit: $limit_var:expr,
ops: [$($op:expr),+ $(,)?]
}) => { ... };
($name:ident<$T:ty> = {
counter: $counter:expr,
limit: $limit_var:expr,
continue_on_error: $continue_on_error:expr,
ops: [$($op:expr),+ $(,)?]
}) => { ... };
($name:ident<$T:ty> -> $strategy:ident = {
counter: $counter:expr,
limit: $limit_var:expr,
ops: [$($op:expr),+ $(,)?]
}) => { ... };
($name:ident<$T:ty> -> $strategy:ident = {
counter: $counter:expr,
limit: $limit_var:expr,
continue_on_error: $continue_on_error:expr,
ops: [$($op:expr),+ $(,)?]
}) => { ... };
(@strategy all) => { ... };
(@strategy last) => { ... };
(@strategy first) => { ... };
(@strategy merge) => { ... };
(@strategy unit) => { ... };
(@impl $name:ident<$T:ty> -> all) => { ... };
(@impl $name:ident<$T:ty> -> last) => { ... };
(@impl $name:ident<$T:ty> -> first) => { ... };
(@impl $name:ident<$T:ty> -> unit) => { ... };
(@impl $name:ident<$T:ty> -> merge) => { ... };
}Expand description
Create a named for-loop op type with flexible return types The limit is loaded from a variable in the dry context Usage:
ⓘ
// Returns Vec<T> (default)
repeat! {
ProcessLoop<String> = {
counter: "iteration",
limit: "max_iterations",
ops: [StepOp::new(), LogOp::new()]
}
}
// Returns T using last result
repeat! {
ProcessLoop<String> -> last = {
counter: "iteration",
limit: "max_iterations",
ops: [StepOp::new(), LogOp::new()]
}
}