pub struct Detector<'a> {
pub file_name: Option<&'a str>,
pub disable_magic: bool,
pub ignore_file_extensions: HashSet<&'a str>,
pub fail_unknown_file_extension: bool,
}
Fields§
§file_name: Option<&'a str>
File name
disable_magic: bool
Disable detection by magic bytes
ignore_file_extensions: HashSet<&'a str>
File name extensions to ignore.
fail_unknown_file_extension: bool
If a file name is present, but the extension is unknown, report as an error
Implementations§
Source§impl<'a> Detector<'a>
impl<'a> Detector<'a>
Sourcepub fn decompress(&'a self, data: Bytes) -> Result<Bytes, Error<'a>>
pub fn decompress(&'a self, data: Bytes) -> Result<Bytes, Error<'a>>
Detect and decompress in a single step.
Sourcepub fn decompress_with(
&'a self,
data: Bytes,
opts: &DecompressionOptions,
) -> Result<Bytes, Error<'a>>
pub fn decompress_with( &'a self, data: Bytes, opts: &DecompressionOptions, ) -> Result<Bytes, Error<'a>>
Detect and decompress in a single step.
pub fn detect(&'a self, data: &[u8]) -> Result<Compression, Error<'a>>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Detector<'a>
impl<'a> RefUnwindSafe for Detector<'a>
impl<'a> Send for Detector<'a>
impl<'a> Sync for Detector<'a>
impl<'a> Unpin for Detector<'a>
impl<'a> UnwindSafe for Detector<'a>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.