pub enum When {
Always,
Key(String),
Eq(String, String),
Ne(String, String),
Not(Box<When>),
And(Box<When>, Box<When>),
Or(Box<When>, Box<When>),
}Expand description
A parsed expression.
Variants§
Always
Key(String)
Eq(String, String)
Ne(String, String)
Not(Box<When>)
And(Box<When>, Box<When>)
Or(Box<When>, Box<When>)
Implementations§
Source§impl When
impl When
Sourcepub fn parse(src: &str) -> Result<When, String>
pub fn parse(src: &str) -> Result<When, String>
Parses an expression; an empty one always applies.
pub fn eval(&self, cx: &WhenContext) -> bool
Sourcepub fn specificity(&self) -> usize
pub fn specificity(&self) -> usize
How specific the expression is: the number of keys it tests. Among bindings of one layer and depth, the most specific wins.
Sourcepub fn excludes(&self, other: &When) -> bool
pub fn excludes(&self, other: &When) -> bool
Whether no context makes both expressions hold (view == 'a'
and view == 'b', listFocus and !listFocus): two bindings of
one key under such clauses never compete. Conservative: false
when it cannot tell.
Sourcepub fn depth(&self, cx: &WhenContext) -> u32
pub fn depth(&self, cx: &WhenContext) -> u32
How deep in the focus chain the expression applies: the deepest depth among the keys it tests that are set (0 when none is).
Trait Implementations§
impl StructuralPartialEq for When
Auto Trait Implementations§
impl Freeze for When
impl RefUnwindSafe for When
impl Send for When
impl Sync for When
impl Unpin for When
impl UnsafeUnpin for When
impl UnwindSafe for When
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more