(:nearest) - Operators
refine the selection to the nearest enclosing value if available
clojure
(:nearest anchor val)Where:
Guides
Behavior
- Yields the matched value in case the anchor could not be resolved.
Examples
Find match arms that call log::debug!()
clojure
(:nearest (match-arm) (call log::debug!))Selects in lines { 4, 12 }:
rust
fn main(args: Vec<String>) {
for arg in args {
match arg.as_str() {
"--help" => {
log::debug!("is asking for help")
}
_ => {}
};
}
log::debug!("done")
}Arguments
anchor
Does NOT support: Composition — Refinement — Replacement
val
- inherit