Enum deno_graph::MediaType
pub enum MediaType {
Show 16 variants
JavaScript,
Jsx,
Mjs,
Cjs,
TypeScript,
Mts,
Cts,
Dts,
Dmts,
Dcts,
Tsx,
Json,
Wasm,
TsBuildInfo,
SourceMap,
Unknown,
}
Variants§
JavaScript
Jsx
Mjs
Cjs
TypeScript
Mts
Cts
Dts
Dmts
Dcts
Tsx
Json
Wasm
TsBuildInfo
SourceMap
Unknown
Implementations§
§impl MediaType
impl MediaType
pub fn as_ts_extension(&self) -> &'static str
pub fn as_ts_extension(&self) -> &'static str
Convert a MediaType to a ts.Extension
.
NOTE This is defined in TypeScript as a string based enum. Changes to that enum in TypeScript should be reflected here.
pub fn as_content_type(&self) -> Option<&'static str>
pub fn as_content_type(&self) -> Option<&'static str>
Returns None
only for MediaType::Unknown
.
There is no 1:1 mapping between content types and MediaType.
Specifically, for some MediaType m
ⓘ
MediaType::from_content_type(module_specifier, m.as_content_type()) != m
pub fn is_declaration(&self) -> bool
pub fn is_declaration(&self) -> bool
Gets if this media type is for a TypeScript declaration file.
pub fn from_specifier_and_headers( specifier: &Url, maybe_headers: Option<&HashMap<String, String>> ) -> MediaType
pub fn from_specifier_and_content_type( specifier: &Url, maybe_content_type: Option<&str> ) -> MediaType
pub fn from_content_type<S>(specifier: &Url, content_type: S) -> MediaType
pub fn from_path(path: &Path) -> MediaType
pub fn from_str(path: &str) -> MediaType
pub fn from_specifier(specifier: &Url) -> MediaType
Trait Implementations§
§impl Ord for MediaType
impl Ord for MediaType
§impl PartialOrd for MediaType
impl PartialOrd for MediaType
§fn partial_cmp(&self, other: &MediaType) -> Option<Ordering>
fn partial_cmp(&self, other: &MediaType) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl Serialize for MediaType
impl Serialize for MediaType
§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for MediaType
impl Eq for MediaType
impl StructuralPartialEq for MediaType
Auto Trait Implementations§
impl RefUnwindSafe for MediaType
impl Send for MediaType
impl Sync for MediaType
impl Unpin for MediaType
impl UnwindSafe for MediaType
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.