Struct syntect::highlighting::ScopeSelectors [−][src]
pub struct ScopeSelectors {
pub selectors: Vec<ScopeSelector>,
}
Expand description
A selector set that matches anything matched by any of its component selectors.
See The TextMate Docs for how these work.
Fields
selectors: Vec<ScopeSelector>
The selectors, if any of them match, that this matches
Implementations
Checks if any of the given selectors match the given scope stack
If so, it returns a match score. Higher match scores indicate stronger matches. Scores are ordered according to the rules found at https://manual.macromates.com/en/scope_selectors.
Examples
use syntect::parsing::{ScopeStack, MatchPower};
use syntect::highlighting::ScopeSelectors;
use std::str::FromStr;
assert_eq!(ScopeSelectors::from_str("a.b, a e.f - c k, e.f - a.b").unwrap()
.does_match(ScopeStack::from_str("a.b c.d j e.f").unwrap().as_slice()),
Some(MatchPower(0o2001u64 as f64)));
Trait Implementations
Returns the “default value” for a type. Read more
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>,
Deserialize this value from the given Serde deserializer. Read more
Parses a series of selectors separated by commas or pipes
type Err = ParseScopeError
type Err = ParseScopeError
The associated error which can be returned from parsing.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for ScopeSelectors
impl Send for ScopeSelectors
impl Sync for ScopeSelectors
impl Unpin for ScopeSelectors
impl UnwindSafe for ScopeSelectors
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.