Expand description
when clauses: where a command applies or a key binds, over named
context keys (in the manner of VS Code’s when clauses).
Grammar: key (true when the key is set and not false or empty),
key == 'text', key != 'text', !expr, a && b, a || b,
parentheses. && binds tighter than ||.
Each key of a WhenContext has a depth: 0 for application-wide
keys, more for keys set by scopes nearer the focus (ADR 0007).
use egui_pop_model::when::{When, WhenContext};
let cx = WhenContext::new().flag("listFocus", true).with("view", "editor");
let w = When::parse("listFocus && view == 'editor'").unwrap();
assert!(w.eval(&cx));
assert_eq!(w.specificity(), 2);Structs§
- When
Context - The current context: focus, view, selection… as named values, each at the depth of the scope that set it.
Enums§
- When
- A parsed expression.