pub fn scan_pattern_to_printer<R: Read, P: Printer>(
reader: R,
pattern: &str,
printer: P,
) -> Result<(), Error>Expand description
scan_pattern_to_printer will print a Read’s contents to the given Printer, while also scanning its contents
for a regular expression. Lines that match this pattern will be highlighted in the output.
Note that this pattern is not anchored at the start of the line by default, and therefore a match anywhere in the
line will force the entire line to be considered a match. For instance, the pattern [a-z] will match 123abc456.
§Errors
There are four general error cases
- An invalid regular expression
- An error produced by the underlying grep library during the search
- I/O errors in scanning from the
Read(these will be manifested as search errors, as the search process is what performs the reading). - A failure to print to the given printer
See Error for more details.