Struct rg::search::SearchWorkerBuilder
source · pub struct SearchWorkerBuilder {
config: Config,
command_builder: CommandReaderBuilder,
decomp_builder: DecompressionReaderBuilder,
}
Expand description
A builder for configuring and constructing a search worker.
Fields§
§config: Config
§command_builder: CommandReaderBuilder
§decomp_builder: DecompressionReaderBuilder
Implementations§
source§impl SearchWorkerBuilder
impl SearchWorkerBuilder
sourcepub fn new() -> SearchWorkerBuilder
pub fn new() -> SearchWorkerBuilder
Create a new builder for configuring and constructing a search worker.
sourcepub fn build<W: WriteColor>(
&self,
matcher: PatternMatcher,
searcher: Searcher,
printer: Printer<W>
) -> SearchWorker<W>
pub fn build<W: WriteColor>( &self, matcher: PatternMatcher, searcher: Searcher, printer: Printer<W> ) -> SearchWorker<W>
Create a new search worker using the given searcher, matcher and printer.
sourcepub fn json_stats(&mut self, yes: bool) -> &mut SearchWorkerBuilder
pub fn json_stats(&mut self, yes: bool) -> &mut SearchWorkerBuilder
Forcefully use JSON to emit statistics, even if the underlying printer is not the JSON printer.
This is useful for implementing flag combinations like
--json --quiet
, which uses the summary printer for implementing
--quiet
but still wants to emit summary statistics, which should
be JSON formatted because of the --json
flag.
sourcepub fn preprocessor(
&mut self,
cmd: Option<PathBuf>
) -> Result<&mut SearchWorkerBuilder, Box<dyn Error>>
pub fn preprocessor( &mut self, cmd: Option<PathBuf> ) -> Result<&mut SearchWorkerBuilder, Box<dyn Error>>
Set the path to a preprocessor command.
When this is set, instead of searching files directly, the given command will be run with the file path as the first argument, and the output of that command will be searched instead.
sourcepub fn preprocessor_globs(
&mut self,
globs: Override
) -> &mut SearchWorkerBuilder
pub fn preprocessor_globs( &mut self, globs: Override ) -> &mut SearchWorkerBuilder
Set the globs for determining which files should be run through the preprocessor. By default, with no globs and a preprocessor specified, every file is run through the preprocessor.
sourcepub fn search_zip(&mut self, yes: bool) -> &mut SearchWorkerBuilder
pub fn search_zip(&mut self, yes: bool) -> &mut SearchWorkerBuilder
Enable the decompression and searching of common compressed files.
When enabled, if a particular file path is recognized as a compressed file, then it is decompressed before searching.
Note that if a preprocessor command is set, then it overrides this setting.
sourcepub fn binary_detection_implicit(
&mut self,
detection: BinaryDetection
) -> &mut SearchWorkerBuilder
pub fn binary_detection_implicit( &mut self, detection: BinaryDetection ) -> &mut SearchWorkerBuilder
Set the binary detection that should be used when searching files found via a recursive directory search.
Generally, this binary detection may be BinaryDetection::quit
if
we want to skip binary files completely.
By default, no binary detection is performed.
sourcepub fn binary_detection_explicit(
&mut self,
detection: BinaryDetection
) -> &mut SearchWorkerBuilder
pub fn binary_detection_explicit( &mut self, detection: BinaryDetection ) -> &mut SearchWorkerBuilder
Set the binary detection that should be used when searching files explicitly supplied by an end user.
Generally, this binary detection should NOT be BinaryDetection::quit
,
since we never want to automatically filter files supplied by the end
user.
By default, no binary detection is performed.
Trait Implementations§
source§impl Clone for SearchWorkerBuilder
impl Clone for SearchWorkerBuilder
source§fn clone(&self) -> SearchWorkerBuilder
fn clone(&self) -> SearchWorkerBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more