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

source

pub fn new() -> PathPrinterBuilder

Return a new path printer builder with a default configuration.

source

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.

source

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 UserColorSpecs.

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.

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.

source

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.

source

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

source§

fn clone(&self) -> PathPrinterBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PathPrinterBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.