Struct syntect::highlighting::ScopeSelectors
source · 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§
source§impl ScopeSelectors
impl ScopeSelectors
sourcepub fn does_match(&self, stack: &[Scope]) -> Option<MatchPower>
pub fn does_match(&self, stack: &[Scope]) -> Option<MatchPower>
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§
source§impl Clone for ScopeSelectors
impl Clone for ScopeSelectors
source§fn clone(&self) -> ScopeSelectors
fn clone(&self) -> ScopeSelectors
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScopeSelectors
impl Debug for ScopeSelectors
source§impl Default for ScopeSelectors
impl Default for ScopeSelectors
source§fn default() -> ScopeSelectors
fn default() -> ScopeSelectors
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ScopeSelectors
impl<'de> Deserialize<'de> for ScopeSelectors
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for ScopeSelectors
impl FromStr for ScopeSelectors
source§fn from_str(s: &str) -> Result<ScopeSelectors, ParseScopeError>
fn from_str(s: &str) -> Result<ScopeSelectors, ParseScopeError>
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.
source§impl PartialEq<ScopeSelectors> for ScopeSelectors
impl PartialEq<ScopeSelectors> for ScopeSelectors
source§fn eq(&self, other: &ScopeSelectors) -> bool
fn eq(&self, other: &ScopeSelectors) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ScopeSelectors
impl Serialize for ScopeSelectors
impl Eq for ScopeSelectors
impl StructuralEq for ScopeSelectors
impl StructuralPartialEq for ScopeSelectors
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§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.