[−][src]Struct ra_ap_ssr::MatchFinder
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]
db: &'db RootDatabase,
lookup_context: FilePosition,
restrict_ranges: Vec<FileRange>
) -> MatchFinder<'db>
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]
db: &'db RootDatabase
) -> Result<MatchFinder<'db>, SsrError>
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]
&mut self,
pattern: SsrPattern
) -> Result<(), SsrError>
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]
&self,
file_id: FileId,
snippet: &str
) -> Vec<MatchDebugInfo>
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]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Cast for T
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Self: CastTo<U>,
U: HasInterner,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,