[][src]Struct syntect::highlighting::ScopeSelectors

pub struct ScopeSelectors {
    pub selectors: Vec<ScopeSelector>,
}

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, this matches

Implementations

impl ScopeSelectors[src]

pub fn does_match(&self, stack: &[Scope]) -> Option<MatchPower>[src]

checks if any of these selectors match the given scope stack if so it returns a match score, higher match scores are 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

impl Clone for ScopeSelectors[src]

impl Debug for ScopeSelectors[src]

impl Default for ScopeSelectors[src]

impl<'de> Deserialize<'de> for ScopeSelectors[src]

impl Eq for ScopeSelectors[src]

impl FromStr for ScopeSelectors[src]

type Err = ParseScopeError

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<ScopeSelectors, ParseScopeError>[src]

Parses a series of selectors separated by commas or pipes

impl PartialEq<ScopeSelectors> for ScopeSelectors[src]

impl Serialize for ScopeSelectors[src]

impl StructuralEq for ScopeSelectors[src]

impl StructuralPartialEq for ScopeSelectors[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.