[][src]Struct ra_ap_ssr::MatchFinder

pub struct MatchFinder<'db> { /* fields omitted */ }

Searches a crate for pattern matches and possibly replaces them with something else.

Implementations

impl<'db> MatchFinder<'db>[src]

pub fn in_context(
    db: &'db RootDatabase,
    lookup_context: FilePosition,
    restrict_ranges: Vec<FileRange>
) -> MatchFinder<'db>
[src]

Constructs a new instance where names will be looked up as if they appeared at lookup_context.

pub fn at_first_file(
    db: &'db RootDatabase
) -> Result<MatchFinder<'db>, SsrError>
[src]

Constructs an instance using the start of the first file in db as the lookup context.

pub fn add_rule(&mut self, rule: SsrRule) -> Result<(), SsrError>[src]

Adds a rule to be applied. The order in which rules are added matters. Earlier rules take precedence. If a node is matched by an earlier rule, then later rules won't be permitted to match to it.

pub fn edits(&self) -> Vec<SourceFileEdit>[src]

Finds matches for all added rules and returns edits for all found matches.

pub fn add_search_pattern(
    &mut self,
    pattern: SsrPattern
) -> Result<(), SsrError>
[src]

Adds a search pattern. For use if you intend to only call find_matches_in_file. If you intend to do replacement, use add_rule instead.

pub fn matches(&self) -> SsrMatches[src]

Returns matches for all added rules.

pub fn debug_where_text_equal(
    &self,
    file_id: FileId,
    snippet: &str
) -> Vec<MatchDebugInfo>
[src]

Finds all nodes in file_id whose text is exactly equal to snippet and attempts to match them, while recording reasons why they don't match. This API is useful for command line-based debugging where providing a range is difficult.

Auto Trait Implementations

impl<'db> !RefUnwindSafe for MatchFinder<'db>

impl<'db> !Send for MatchFinder<'db>

impl<'db> !Sync for MatchFinder<'db>

impl<'db> Unpin for MatchFinder<'db>

impl<'db> !UnwindSafe for MatchFinder<'db>

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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

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

impl<T> Cast for T

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

impl<T> Instrument for T[src]

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

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.