pub enum MimeType {
TextCss,
ImageGif,
TextHtml,
ApplicationJavascript,
ApplicationJson,
AudioMp3,
VideoMp4,
ImagePng,
TextPlain,
TextXml,
FnJavascript,
Unknown,
}
Expand description
Acceptable MIME types for resources used by $redirect
and +js(...)
adblock rules.
Variants§
TextCss
"text/css"
ImageGif
"image/gif"
TextHtml
"text/html"
ApplicationJavascript
"application/javascript"
ApplicationJson
"application/json"
AudioMp3
"audio/mp3"
VideoMp4
"video/mp4"
ImagePng
"image/png"
TextPlain
"text/plain"
TextXml
"text/xml"
FnJavascript
Custom MIME type invented for the uBlock Origin project. Represented by "fn/javascript"
.
Used to describe JavaScript functions that can be used as dependencies of other JavaScript
resources.
Unknown
Any other unhandled MIME type. Maps to "application/octet-stream"
when re-serialized.
Implementations§
source§impl MimeType
impl MimeType
sourcepub fn from_extension(resource_path: &str) -> Self
pub fn from_extension(resource_path: &str) -> Self
Infers a resource’s MIME type according to the extension of its path
sourcepub fn is_textual(&self) -> bool
pub fn is_textual(&self) -> bool
Should the MIME type decode as valid UTF8?
sourcepub fn supports_dependencies(&self) -> bool
pub fn supports_dependencies(&self) -> bool
Can the MIME type have dependencies on other resources?
Trait Implementations§
source§impl<'de> Deserialize<'de> for MimeType
impl<'de> Deserialize<'de> for MimeType
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for MimeType
impl PartialEq for MimeType
impl StructuralPartialEq for MimeType
Auto Trait Implementations§
impl Freeze for MimeType
impl RefUnwindSafe for MimeType
impl Send for MimeType
impl Sync for MimeType
impl Unpin for MimeType
impl UnwindSafe for MimeType
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