Trait Searcher

Source
pub trait Searcher {
    type Input: Input;
    type Match: Match;
    type MatchError: Error;

    // Required methods
    fn input(&self) -> &Self::Input;
    fn last_match_end(&self) -> Option<usize>;
    fn set_last_match_end(&mut self, end: usize);
    fn set_range<R>(&mut self, range: R)
       where R: RangeBounds<usize>;
    fn try_advance<F>(
        &mut self,
        finder: F,
    ) -> Result<Option<Self::Match>, Self::MatchError>
       where F: FnMut(&Self::Input) -> Result<Option<Self::Match>, Self::MatchError>;
    fn handle_overlapping_empty_match<F>(
        &mut self,
        m: Self::Match,
        finder: F,
    ) -> Result<Option<Self::Match>, Self::MatchError>
       where F: FnMut(&Self::Input) -> Result<Option<Self::Match>, Self::MatchError>;

    // Provided method
    fn advance<F>(&mut self, finder: F) -> Option<Self::Match>
       where F: FnMut(&Self::Input) -> Result<Option<Self::Match>, Self::MatchError> { ... }
}

Required Associated Types§

Required Methods§

Source

fn input(&self) -> &Self::Input

Source

fn last_match_end(&self) -> Option<usize>

Source

fn set_last_match_end(&mut self, end: usize)

Source

fn set_range<R>(&mut self, range: R)
where R: RangeBounds<usize>,

Source

fn try_advance<F>( &mut self, finder: F, ) -> Result<Option<Self::Match>, Self::MatchError>
where F: FnMut(&Self::Input) -> Result<Option<Self::Match>, Self::MatchError>,

Source

fn handle_overlapping_empty_match<F>( &mut self, m: Self::Match, finder: F, ) -> Result<Option<Self::Match>, Self::MatchError>
where F: FnMut(&Self::Input) -> Result<Option<Self::Match>, Self::MatchError>,

Provided Methods§

Source

fn advance<F>(&mut self, finder: F) -> Option<Self::Match>
where F: FnMut(&Self::Input) -> Result<Option<Self::Match>, Self::MatchError>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, M, E> Searcher for DefaultSearcher<I, M, E>
where I: Input, M: Match, E: Error,