Skip to main content

require_opt_child

Macro require_opt_child 

Source
macro_rules! require_opt_child {
    ($parent:expr, $child_opt:expr, $idx:expr => $M:ty) => { ... };
}
Expand description

Like require_child!, but for optional children. If the child is None, this is a no-op. If the child is Some but does not match $M, early-returns an ExecutionResult requesting execution of child $idx.

Unlike require_child!, this is a statement macro (no value produced) and does not clone $parent — it is moved into the early-return path.

require_opt_child!(array, array.patches().map(|p| p.indices()), 1 => Primitive);