Skip to main content

Scoper

Trait Scoper 

Source
pub trait Scoper: Send + Sync {
    // Required method
    fn scope_raw<'viewee>(
        &self,
        input: &'viewee str,
    ) -> RangesWithContext<'viewee>;

    // Provided method
    fn scope<'viewee>(&self, input: &'viewee str) -> ROScopes<'viewee> { ... }
}
Expand description

An item capable of scoping down a given input into individual scopes.

Required Methods§

Source

fn scope_raw<'viewee>(&self, input: &'viewee str) -> RangesWithContext<'viewee>

Scope the given input, returning raw ranges.

Raw ranges are those not turned into ROScopes yet.

Provided Methods§

Source

fn scope<'viewee>(&self, input: &'viewee str) -> ROScopes<'viewee>

Scope the given input.

After application, the returned scopes are a collection of either in-scope or out-of-scope parts of the input. Assembling them back together should yield the original input.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Scoper for &[Box<dyn LanguageScoper>]

Source§

fn scope_raw<'viewee>(&self, input: &'viewee str) -> RangesWithContext<'viewee>

Allows multiple scopers to be applied all at once.

They are OR’d together in the sense that if any of the scopers hit, a position/range is considered in scope. In some sense, this is the opposite of ScopedViewBuilder::explode, which is subtractive.

Source§

impl Scoper for Box<dyn LanguageScoper>

Source§

fn scope_raw<'viewee>(&self, input: &'viewee str) -> RangesWithContext<'viewee>

Implementors§