[][src]Struct grep_searcher::sinks::UTF8

pub struct UTF8<F>(pub F)
where
    F: FnMut(u64, &str) -> Result<bool, Error>
;

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: Debug> Debug 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>, 
[src]

type Error = Error

The type of an error that should be reported by a searcher. Read more

Auto Trait Implementations

impl<F> RefUnwindSafe for UTF8<F> where
    F: RefUnwindSafe

impl<F> Send for UTF8<F> where
    F: Send

impl<F> Sync for UTF8<F> where
    F: Sync

impl<F> Unpin for UTF8<F> where
    F: Unpin

impl<F> UnwindSafe for UTF8<F> where
    F: UnwindSafe

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.