Struct grep_printer::PathPrinterBuilder
source · pub struct PathPrinterBuilder { /* private fields */ }
Expand description
A builder for a printer that emits file paths.
Implementations§
source§impl PathPrinterBuilder
impl PathPrinterBuilder
sourcepub fn new() -> PathPrinterBuilder
pub fn new() -> PathPrinterBuilder
Return a new path printer builder with a default configuration.
sourcepub fn build<W: WriteColor>(&self, wtr: W) -> PathPrinter<W>
pub fn build<W: WriteColor>(&self, wtr: W) -> PathPrinter<W>
Create a new path printer with the current configuration that writes paths to the given writer.
sourcepub fn color_specs(&mut self, specs: ColorSpecs) -> &mut PathPrinterBuilder
pub fn color_specs(&mut self, specs: ColorSpecs) -> &mut PathPrinterBuilder
Set the user color specifications to use for coloring in this printer.
A UserColorSpec
can be constructed from
a string in accordance with the color specification format. See
the UserColorSpec
type documentation for more details on the
format. A ColorSpecs
can then be generated from zero or more
UserColorSpec
s.
Regardless of the color specifications provided here, whether color
is actually used or not is determined by the implementation of
WriteColor
provided to build
. For example, if termcolor::NoColor
is provided to build
, then no color will ever be printed regardless
of the color specifications provided here.
This completely overrides any previous color specifications. This does not add to any previously provided color specifications on this builder.
The default color specifications provide no styling.
sourcepub fn hyperlink(&mut self, config: HyperlinkConfig) -> &mut PathPrinterBuilder
pub fn hyperlink(&mut self, config: HyperlinkConfig) -> &mut PathPrinterBuilder
Set the configuration to use for hyperlinks output by this printer.
Regardless of the hyperlink format provided here, whether hyperlinks
are actually used or not is determined by the implementation of
WriteColor
provided to build
. For example, if termcolor::NoColor
is provided to build
, then no hyperlinks will ever be printed
regardless of the format provided here.
This completely overrides any previous hyperlink format.
The default configuration results in not emitting any hyperlinks.
sourcepub fn separator(&mut self, sep: Option<u8>) -> &mut PathPrinterBuilder
pub fn separator(&mut self, sep: Option<u8>) -> &mut PathPrinterBuilder
Set the path separator used when printing file paths.
Typically, printing is done by emitting the file path as is. However, this setting provides the ability to use a different path separator from what the current environment has configured.
A typical use for this option is to permit cygwin users on Windows to
set the path separator to /
instead of using the system default of
\
.
This is disabled by default.
sourcepub fn terminator(&mut self, terminator: u8) -> &mut PathPrinterBuilder
pub fn terminator(&mut self, terminator: u8) -> &mut PathPrinterBuilder
Set the path terminator used.
The path terminator is a byte that is printed after every file path emitted by this printer.
The default path terminator is \n
.
Trait Implementations§
source§impl Clone for PathPrinterBuilder
impl Clone for PathPrinterBuilder
source§fn clone(&self) -> PathPrinterBuilder
fn clone(&self) -> PathPrinterBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for PathPrinterBuilder
impl RefUnwindSafe for PathPrinterBuilder
impl Send for PathPrinterBuilder
impl Sync for PathPrinterBuilder
impl Unpin for PathPrinterBuilder
impl UnwindSafe for PathPrinterBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)