Struct grep_cli::DecompressionReaderBuilder
source · pub struct DecompressionReaderBuilder { /* private fields */ }
Expand description
Configures and builds a streaming reader for decompressing data.
Implementations§
source§impl DecompressionReaderBuilder
impl DecompressionReaderBuilder
sourcepub fn new() -> DecompressionReaderBuilder
pub fn new() -> DecompressionReaderBuilder
Create a new builder with the default configuration.
sourcepub fn build<P: AsRef<Path>>(
&self,
path: P,
) -> Result<DecompressionReader, CommandError>
pub fn build<P: AsRef<Path>>( &self, path: P, ) -> Result<DecompressionReader, CommandError>
Build a new streaming reader for decompressing data.
If decompression is done out-of-process and if there was a problem spawning the process, then its error is logged at the debug level and a passthru reader is returned that does no decompression. This behavior typically occurs when the given file path matches a decompression command, but is executing in an environment where the decompression command is not available.
If the given file path could not be matched with a decompression strategy, then a passthru reader is returned that does no decompression.
sourcepub fn matcher(
&mut self,
matcher: DecompressionMatcher,
) -> &mut DecompressionReaderBuilder
pub fn matcher( &mut self, matcher: DecompressionMatcher, ) -> &mut DecompressionReaderBuilder
Set the matcher to use to look up the decompression command for each file path.
A set of sensible rules is enabled by default. Setting this will completely replace the current rules.
sourcepub fn get_matcher(&self) -> &DecompressionMatcher
pub fn get_matcher(&self) -> &DecompressionMatcher
Get the underlying matcher currently used by this builder.
sourcepub fn async_stderr(&mut self, yes: bool) -> &mut DecompressionReaderBuilder
pub fn async_stderr(&mut self, yes: bool) -> &mut DecompressionReaderBuilder
When enabled, the reader will asynchronously read the contents of the command’s stderr output. When disabled, stderr is only read after the stdout stream has been exhausted (or if the process quits with an error code).
Note that when enabled, this may require launching an additional thread in order to read stderr. This is done so that the process being executed is never blocked from writing to stdout or stderr. If this is disabled, then it is possible for the process to fill up the stderr buffer and deadlock.
This is enabled by default.
Trait Implementations§
source§impl Clone for DecompressionReaderBuilder
impl Clone for DecompressionReaderBuilder
source§fn clone(&self) -> DecompressionReaderBuilder
fn clone(&self) -> DecompressionReaderBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DecompressionReaderBuilder
impl Debug for DecompressionReaderBuilder
source§impl Default for DecompressionReaderBuilder
impl Default for DecompressionReaderBuilder
source§fn default() -> DecompressionReaderBuilder
fn default() -> DecompressionReaderBuilder
Auto Trait Implementations§
impl Freeze for DecompressionReaderBuilder
impl RefUnwindSafe for DecompressionReaderBuilder
impl Send for DecompressionReaderBuilder
impl Sync for DecompressionReaderBuilder
impl Unpin for DecompressionReaderBuilder
impl UnwindSafe for DecompressionReaderBuilder
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
)