Module grep_searcher::sinks
source · Expand description
A collection of convenience implementations of Sink
.
Each implementation in this module makes some kind of sacrifice in the name
of making common cases easier to use. Most frequently, each type is a
wrapper around a closure specified by the caller that provides limited
access to the full suite of information available to implementors of
Sink
.
For example, the UTF8
sink makes the following sacrifices:
- All matches must be UTF-8. An arbitrary
Sink
does not have this restriction and can deal with arbitrary data. If this sink sees invalid UTF-8, then an error is returned and searching stops. (Use theLossy
sink instead to suppress this error.) - The searcher must be configured to report line numbers. If it isn’t, an error is reported at the first match and searching stops.
- Context lines, context breaks and summary data reported at the end of a search are all ignored.
- Implementors are forced to use
std::io::Error
as their error type.
If you need more flexibility, then you’re advised to implement the Sink
trait directly.
Structs§
- A sink that provides line numbers and matches as raw bytes while ignoring everything else.
- A sink that provides line numbers and matches as (lossily converted) strings while ignoring everything else.
- A sink that provides line numbers and matches as strings while ignoring everything else.