Struct grep_printer::Standard

source ·
pub struct Standard<W> { /* private fields */ }
Expand description

The standard printer, which implements grep-like formatting, including color support.

A default printer can be created with either of the Standard::new or Standard::new_no_color constructors. However, there are a considerable number of options that configure this printer’s output. Those options can be configured using StandardBuilder.

This type is generic over W, which represents any implementation of the termcolor::WriteColor trait. If colors are not desired, then the new_no_color constructor can be used, or, alternatively, the termcolor::NoColor adapter can be used to wrap any io::Write implementation without enabling any colors.

Implementations§

Return a standard printer with a default configuration that writes matches to the given writer.

The writer should be an implementation of termcolor::WriteColor and not just a bare implementation of io::Write. To use a normal io::Write implementation (simultaneously sacrificing colors), use the new_no_color constructor.

Return a standard printer with a default configuration that writes matches to the given writer.

The writer can be any implementation of io::Write. With this constructor, the printer will never emit colors.

Return an implementation of Sink for the standard printer.

This does not associate the printer with a file path, which means this implementation will never print a file path along with the matches.

Return an implementation of Sink associated with a file path.

When the printer is associated with a path, then it may, depending on its configuration, print the path along with the matches found.

Returns true if and only if this printer has written at least one byte to the underlying writer during any of the previous searches.

Return a mutable reference to the underlying writer.

Consume this printer and return back ownership of the underlying writer.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.