pub struct Mime(pub Cow<'static, str>);Expand description
the mime type of a file (i.e. at a Url)
Tuple Fields§
§0: Cow<'static, str>Implementations§
Source§impl Mime
impl Mime
Sourcepub const HTML: Self
pub const HTML: Self
text/html: hypertext markup language
Sourcepub const CSS: Self
pub const CSS: Self
text/css: cascading style sheets
Sourcepub const JAVASCRIPT: Self
pub const JAVASCRIPT: Self
text/javascript: ecmascript (née javascript)
Sourcepub const XML: Self
pub const XML: Self
application/xml: extensible markup language
Sourcepub const ATOM: Self
pub const ATOM: Self
application/atom+xml: atom syndication format
Sourcepub const JSON: Self
pub const JSON: Self
application/json: javascript object notation
Sourcepub const PNG: Self
pub const PNG: Self
image/png: portable network graphics
Sourcepub const JPEG: Self
pub const JPEG: Self
image/jpeg: jpeg file interchange format
Sourcepub const GIF: Self
pub const GIF: Self
image/gif: graphics interchange format
Sourcepub const SVG: Self
pub const SVG: Self
image/svg: scalable vector graphics
Sourcepub const WOFF: Self
pub const WOFF: Self
font/woff: web open format font v1.0
Sourcepub const WOFF2: Self
pub const WOFF2: Self
font/woff2: web open format font v2.0
Sourcepub const BYTES: Self
pub const BYTES: Self
application/octet-stream: Arbitrary bytes, and the default for unknown data
Sourcepub fn from_ext(ext: &str) -> Option<Self>
pub fn from_ext(ext: &str) -> Option<Self>
guess the mime type based on a file extension
this is a generally unreliable way to do things. ideally, we would be introspecting the first few bytes of the file, and making an educated decision based on the magic bytes. but that’s far more complex than this approach, and browsers will generally adapt anyway, so w/e.
Trait Implementations§
impl Eq for Mime
impl StructuralPartialEq for Mime
Auto Trait Implementations§
impl Freeze for Mime
impl RefUnwindSafe for Mime
impl Send for Mime
impl Sync for Mime
impl Unpin for Mime
impl UnsafeUnpin for Mime
impl UnwindSafe for Mime
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§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>
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>
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 more