Struct grep_cli::DecompressionMatcherBuilder
source · pub struct DecompressionMatcherBuilder { /* private fields */ }
Expand description
A builder for a matcher that determines which files get decompressed.
Implementations§
source§impl DecompressionMatcherBuilder
impl DecompressionMatcherBuilder
sourcepub fn new() -> DecompressionMatcherBuilder
pub fn new() -> DecompressionMatcherBuilder
Create a new builder for configuring a decompression matcher.
sourcepub fn build(&self) -> Result<DecompressionMatcher, CommandError>
pub fn build(&self) -> Result<DecompressionMatcher, CommandError>
Build a matcher for determining how to decompress files.
If there was a problem compiling the matcher, then an error is returned.
sourcepub fn defaults(&mut self, yes: bool) -> &mut DecompressionMatcherBuilder
pub fn defaults(&mut self, yes: bool) -> &mut DecompressionMatcherBuilder
When enabled, the default matching rules will be compiled into this matcher before any other associations. When disabled, only the rules explicitly given to this builder will be used.
This is enabled by default.
sourcepub fn associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I,
) -> &mut DecompressionMatcherBuilder
pub fn associate<P, I, A>( &mut self, glob: &str, program: P, args: I, ) -> &mut DecompressionMatcherBuilder
Associates a glob with a command to decompress files matching the glob.
If multiple globs match the same file, then the most recently added glob takes precedence.
The syntax for the glob is documented in the
globset
crate.
The program
given is resolved with respect to PATH
and turned
into an absolute path internally before being executed by the current
platform. Notably, on Windows, this avoids a security problem where
passing a relative path to CreateProcess
will automatically search
the current directory for a matching program. If the program could
not be resolved, then it is silently ignored and the association is
dropped. For this reason, callers should prefer try_associate
.
sourcepub fn try_associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I,
) -> Result<&mut DecompressionMatcherBuilder, CommandError>
pub fn try_associate<P, I, A>( &mut self, glob: &str, program: P, args: I, ) -> Result<&mut DecompressionMatcherBuilder, CommandError>
Associates a glob with a command to decompress files matching the glob.
If multiple globs match the same file, then the most recently added glob takes precedence.
The syntax for the glob is documented in the
globset
crate.
The program
given is resolved with respect to PATH
and turned
into an absolute path internally before being executed by the current
platform. Notably, on Windows, this avoids a security problem where
passing a relative path to CreateProcess
will automatically search
the current directory for a matching program. If the program could not
be resolved, then an error is returned.
Trait Implementations§
source§impl Clone for DecompressionMatcherBuilder
impl Clone for DecompressionMatcherBuilder
source§fn clone(&self) -> DecompressionMatcherBuilder
fn clone(&self) -> DecompressionMatcherBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DecompressionMatcherBuilder
impl Debug for DecompressionMatcherBuilder
source§impl Default for DecompressionMatcherBuilder
impl Default for DecompressionMatcherBuilder
source§fn default() -> DecompressionMatcherBuilder
fn default() -> DecompressionMatcherBuilder
Auto Trait Implementations§
impl Freeze for DecompressionMatcherBuilder
impl RefUnwindSafe for DecompressionMatcherBuilder
impl Send for DecompressionMatcherBuilder
impl Sync for DecompressionMatcherBuilder
impl Unpin for DecompressionMatcherBuilder
impl UnwindSafe for DecompressionMatcherBuilder
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
)