Struct grep_searcher::sinks::UTF8 [−][src]
A sink that provides line numbers and matches as strings while ignoring everything else.
This implementation will return an error if a match contains invalid
UTF-8 or if the searcher was not configured to count lines. Errors
on invalid UTF-8 can be suppressed by using the Lossy
sink instead
of this one.
The closure accepts two parameters: a line number and a UTF-8 string
containing the matched data. The closure returns a
Result<bool, io::Error>
. If the bool
is false
, then the search
stops immediately. Otherwise, searching continues.
If multi line mode was enabled, the line number refers to the line number of the first line in the match.
Trait Implementations
impl<F: Clone> Clone for UTF8<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
[src]
impl<F: Clone> Clone for UTF8<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
fn clone(&self) -> UTF8<F>
[src]
fn clone(&self) -> UTF8<F>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<F: Debug> Debug for UTF8<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
[src]
impl<F: Debug> Debug for UTF8<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<F> Sink for UTF8<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
[src]
impl<F> Sink for UTF8<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
type Error = Error
The type of an error that should be reported by a searcher. Read more
fn matched(
&mut self,
_searcher: &Searcher,
mat: &SinkMatch
) -> Result<bool, Error>
[src]
fn matched(
&mut self,
_searcher: &Searcher,
mat: &SinkMatch
) -> Result<bool, Error>
This method is called whenever a match is found. Read more
fn context(
&mut self,
_searcher: &Searcher,
_context: &SinkContext
) -> Result<bool, Self::Error>
[src]
fn context(
&mut self,
_searcher: &Searcher,
_context: &SinkContext
) -> Result<bool, Self::Error>
This method is called whenever a context line is found, and is optional to implement. By default, it does nothing and returns true
. Read more
fn context_break(&mut self, _searcher: &Searcher) -> Result<bool, Self::Error>
[src]
fn context_break(&mut self, _searcher: &Searcher) -> Result<bool, Self::Error>
This method is called whenever a break in contextual lines is found, and is optional to implement. By default, it does nothing and returns true
. Read more
fn begin(&mut self, _searcher: &Searcher) -> Result<bool, Self::Error>
[src]
fn begin(&mut self, _searcher: &Searcher) -> Result<bool, Self::Error>
This method is called when a search has begun, before any search is executed. By default, this does nothing. Read more
fn finish(
&mut self,
_searcher: &Searcher,
_: &SinkFinish
) -> Result<(), Self::Error>
[src]
fn finish(
&mut self,
_searcher: &Searcher,
_: &SinkFinish
) -> Result<(), Self::Error>
This method is called when a search has completed. By default, this does nothing. Read more