pub struct MimeClassifier {
image_classifier: GroupedClassifier,
audio_video_classifier: GroupedClassifier,
scriptable_classifier: GroupedClassifier,
plaintext_classifier: GroupedClassifier,
archive_classifier: GroupedClassifier,
binary_or_plaintext: BinaryOrPlaintextClassifier,
font_classifier: GroupedClassifier,
}Fields§
§image_classifier: GroupedClassifier§audio_video_classifier: GroupedClassifier§scriptable_classifier: GroupedClassifier§plaintext_classifier: GroupedClassifier§archive_classifier: GroupedClassifier§binary_or_plaintext: BinaryOrPlaintextClassifier§font_classifier: GroupedClassifierImplementations§
Source§impl MimeClassifier
impl MimeClassifier
Sourcepub fn classify<'a>(
&'a self,
context: LoadContext,
no_sniff_flag: NoSniffFlag,
apache_bug_flag: ApacheBugFlag,
supplied_type: &Option<Mime>,
data: &'a [u8],
) -> Mime
pub fn classify<'a>( &'a self, context: LoadContext, no_sniff_flag: NoSniffFlag, apache_bug_flag: ApacheBugFlag, supplied_type: &Option<Mime>, data: &'a [u8], ) -> Mime
pub fn validate(&self) -> Result<(), String>
fn sniff_unknown_type(&self, no_sniff_flag: NoSniffFlag, data: &[u8]) -> Mime
fn sniff_text_or_data<'a>(&'a self, data: &'a [u8]) -> Mime
Sourcefn is_xml(mt: &Mime) -> bool
fn is_xml(mt: &Mime) -> bool
https://mimesniff.spec.whatwg.org/#xml-mime-type SVG is worth distinguishing from other XML MIME types: https://mimesniff.spec.whatwg.org/#mime-type-miscellaneous
Sourcefn is_audio_video(mt: &Mime) -> bool
fn is_audio_video(mt: &Mime) -> bool
fn is_explicit_unknown(mt: &Mime) -> bool
Sourcepub fn is_javascript(mt: &Mime) -> bool
pub fn is_javascript(mt: &Mime) -> bool
fn is_text(mt: &Mime) -> bool
fn is_css(mt: &Mime) -> bool
pub fn get_media_type(mime: &Mime) -> Option<MediaType>
fn maybe_get_media_type(supplied_type: &Option<Mime>) -> Option<MediaType>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MimeClassifier
impl !RefUnwindSafe for MimeClassifier
impl Send for MimeClassifier
impl Sync for MimeClassifier
impl Unpin for MimeClassifier
impl !UnwindSafe for MimeClassifier
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> 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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert