[−][src]Struct grep_searcher::sinks::Lossy
A sink that provides line numbers and matches as (lossily converted) strings while ignoring everything else.
This is like UTF8
, except that if a match contains invalid UTF-8,
then it will be lossily converted to valid UTF-8 by substituting
invalid UTF-8 with Unicode replacement characters.
This implementation will return an error on the first match if the searcher was not configured to count lines.
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> Sink for Lossy<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
[src]
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]
&mut self,
_searcher: &Searcher,
mat: &SinkMatch
) -> Result<bool, Error>
fn context(
&mut self,
_searcher: &Searcher,
_context: &SinkContext
) -> Result<bool, Self::Error>
[src]
&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]
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 binary_data(
&mut self,
_searcher: &Searcher,
_binary_byte_offset: u64
) -> Result<bool, Self::Error>
[src]
&mut self,
_searcher: &Searcher,
_binary_byte_offset: u64
) -> Result<bool, Self::Error>
This method is called whenever binary detection is enabled and binary data is found. If binary data is found, then this is called at least once for the first occurrence with the absolute byte offset at which the binary data begins. Read more
fn begin(&mut self, _searcher: &Searcher) -> Result<bool, Self::Error>
[src]
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]
&mut self,
_searcher: &Searcher,
_: &SinkFinish
) -> Result<(), Self::Error>
This method is called when a search has completed. By default, this does nothing. Read more
impl<F: Clone> Clone for Lossy<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
[src]
F: FnMut(u64, &str) -> Result<bool, Error>,
fn clone(&self) -> Lossy<F>
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<F: Debug> Debug for Lossy<F> where
F: FnMut(u64, &str) -> Result<bool, Error>,
[src]
F: FnMut(u64, &str) -> Result<bool, Error>,
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,