pub enum SelectorSpec {
And(Vec<SelectorSpec>),
Or(Vec<SelectorSpec>),
Not(Box<SelectorSpec>),
Path(Vec<SelectorPathItem>),
}
Expand description
A selector that can match paths of processing states.
To use a selector, you most likely want to check whether it matches the path of a
ProcessingState
. For this you turn the state into a Path
using
ProcessingState::path
and call SelectorSpec::matches_path
, which will iterate through
the path items in the processing state and check whether the selector matches.
Variants§
And(Vec<SelectorSpec>)
A selector that matches both of two sub-selectors.
Or(Vec<SelectorSpec>)
A selector that matches either of two sub-selectors.
Not(Box<SelectorSpec>)
A selector that matches all paths that do not match the sub-selector.
Path(Vec<SelectorPathItem>)
A direct path to an item.
Implementations§
source§impl SelectorSpec
impl SelectorSpec
sourcepub fn parse_non_legacy(s: &str) -> Result<SelectorSpec, InvalidSelectorError>
pub fn parse_non_legacy(s: &str) -> Result<SelectorSpec, InvalidSelectorError>
Parses a selector from a string without legacy special handling.
sourcepub fn matches_path(&self, path: &Path<'_>) -> bool
pub fn matches_path(&self, path: &Path<'_>) -> bool
Checks if a path matches given selector.
This walks both the selector and the path starting at the end and towards the root to determine if the selector matches the current path.
Trait Implementations§
source§impl Clone for SelectorSpec
impl Clone for SelectorSpec
source§fn clone(&self) -> SelectorSpec
fn clone(&self) -> SelectorSpec
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SelectorSpec
impl Debug for SelectorSpec
source§impl<'de> Deserialize<'de> for SelectorSpec
impl<'de> Deserialize<'de> for SelectorSpec
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl Display for SelectorSpec
impl Display for SelectorSpec
source§impl From<ValueType> for SelectorSpec
impl From<ValueType> for SelectorSpec
source§impl FromStr for SelectorSpec
impl FromStr for SelectorSpec
source§impl Ord for SelectorSpec
impl Ord for SelectorSpec
source§fn cmp(&self, other: &SelectorSpec) -> Ordering
fn cmp(&self, other: &SelectorSpec) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for SelectorSpec
impl PartialEq for SelectorSpec
source§impl PartialOrd for SelectorSpec
impl PartialOrd for SelectorSpec
source§impl Serialize for SelectorSpec
impl Serialize for SelectorSpec
impl Eq for SelectorSpec
impl StructuralPartialEq for SelectorSpec
Auto Trait Implementations§
impl Freeze for SelectorSpec
impl RefUnwindSafe for SelectorSpec
impl Send for SelectorSpec
impl Sync for SelectorSpec
impl Unpin for SelectorSpec
impl UnwindSafe for SelectorSpec
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.