pub enum StateFilter {
Any,
Is(WidgetState),
And(Box<StateFilter>, Box<StateFilter>),
Or(Box<StateFilter>, Box<StateFilter>),
Not(Box<StateFilter>),
}Expand description
What a set of states has to look like for one entry of a
WidgetStateProperty to answer (widget_state.dart:27).
A bare state is satisfied when the set contains it; the three operators build the rest.
The reference spells them &, | and ~, and so does this:
use frus_widgets::{StateFilter, WidgetState, WidgetStates};
let held_but_not_broken =
StateFilter::from(WidgetState::Pressed) & !StateFilter::from(WidgetState::Error);
assert!(held_but_not_broken.matches(WidgetStates::of(WidgetState::Pressed)));
assert!(!held_but_not_broken.matches(
WidgetState::Pressed | WidgetState::Error
));Variants§
Any
Satisfied by anything at all, including nothing — the reference’s
WidgetState.any (widget_state.dart:225), and what a last entry uses to mean
otherwise.
Is(WidgetState)
Satisfied when the set contains this state.
And(Box<StateFilter>, Box<StateFilter>)
Both.
Or(Box<StateFilter>, Box<StateFilter>)
Either.
Not(Box<StateFilter>)
The opposite.
Implementations§
Source§impl StateFilter
impl StateFilter
Sourcepub fn matches(&self, states: WidgetStates) -> bool
pub fn matches(&self, states: WidgetStates) -> bool
Do these states satisfy this filter?
Trait Implementations§
Source§impl BitAnd for StateFilter
impl BitAnd for StateFilter
Source§type Output = StateFilter
type Output = StateFilter
The resulting type after applying the
& operator.Source§fn bitand(self, other: StateFilter) -> StateFilter
fn bitand(self, other: StateFilter) -> StateFilter
Performs the
& operation. Read moreSource§impl BitOr for StateFilter
impl BitOr for StateFilter
Source§type Output = StateFilter
type Output = StateFilter
The resulting type after applying the
| operator.Source§fn bitor(self, other: StateFilter) -> StateFilter
fn bitor(self, other: StateFilter) -> StateFilter
Performs the
| operation. Read moreSource§impl Clone for StateFilter
impl Clone for StateFilter
Source§impl Debug for StateFilter
impl Debug for StateFilter
impl Eq for StateFilter
Source§impl From<WidgetState> for StateFilter
impl From<WidgetState> for StateFilter
Source§fn from(state: WidgetState) -> Self
fn from(state: WidgetState) -> Self
Converts to this type from the input type.
Source§impl Not for StateFilter
impl Not for StateFilter
Source§type Output = StateFilter
type Output = StateFilter
The resulting type after applying the
! operator.Source§fn not(self) -> StateFilter
fn not(self) -> StateFilter
Performs the unary
! operation using logical or bitwise negation. Read moreSource§impl PartialEq for StateFilter
impl PartialEq for StateFilter
impl StructuralPartialEq for StateFilter
Auto Trait Implementations§
impl Freeze for StateFilter
impl RefUnwindSafe for StateFilter
impl Send for StateFilter
impl Sync for StateFilter
impl Unpin for StateFilter
impl UnsafeUnpin for StateFilter
impl UnwindSafe for StateFilter
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