Struct grep_cli::DecompressionMatcherBuilder [−][src]
pub struct DecompressionMatcherBuilder { /* fields omitted */ }
Expand description
A builder for a matcher that determines which files get decompressed.
Implementations
Create a new builder for configuring a decompression matcher.
Build a matcher for determining how to decompress files.
If there was a problem compiling the matcher, then an error is returned.
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.
pub fn associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I
) -> &mut DecompressionMatcherBuilder where
P: AsRef<OsStr>,
I: IntoIterator<Item = A>,
A: AsRef<OsStr>,
[src]
pub fn associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I
) -> &mut DecompressionMatcherBuilder where
P: AsRef<OsStr>,
I: IntoIterator<Item = A>,
A: AsRef<OsStr>,
[src]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
.
pub fn try_associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I
) -> Result<&mut DecompressionMatcherBuilder, CommandError> where
P: AsRef<OsStr>,
I: IntoIterator<Item = A>,
A: AsRef<OsStr>,
[src]
pub fn try_associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I
) -> Result<&mut DecompressionMatcherBuilder, CommandError> where
P: AsRef<OsStr>,
I: IntoIterator<Item = A>,
A: AsRef<OsStr>,
[src]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
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for DecompressionMatcherBuilder
impl Send for DecompressionMatcherBuilder
impl Sync for DecompressionMatcherBuilder
impl Unpin for DecompressionMatcherBuilder
impl UnwindSafe for DecompressionMatcherBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more