pub struct DecompressionMatcherBuilder { /* private fields */ }
Expand description

A builder for a matcher that determines which files get decompressed.

Implementations§

source§

impl DecompressionMatcherBuilder

source

pub fn new() -> DecompressionMatcherBuilder

Create a new builder for configuring a decompression matcher.

source

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.

source

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.

source

pub fn associate<P, I, A>( &mut self, glob: &str, program: P, args: I ) -> &mut DecompressionMatcherBuilderwhere P: AsRef<OsStr>, I: IntoIterator<Item = A>, A: AsRef<OsStr>,

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.

source

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>,

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

source§

fn clone(&self) -> DecompressionMatcherBuilder

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 DecompressionMatcherBuilder

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for DecompressionMatcherBuilder

source§

fn default() -> DecompressionMatcherBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.