Enum deno_core::RequestedModuleType
source · #[repr(u8)]pub enum RequestedModuleType {
None,
Json,
Other(Cow<'static, str>),
}
Variants§
None
There was no attribute specified in the import statement.
Example:
ⓘ
import foo from "./foo.js";
const bar = await import("bar");
Json
The type
attribute had value json
. This is the only known module type
in deno_core
.
Embedders should use Other
variant for custom module
types like wasm
, bytes
or text
.
Example:
ⓘ
import jsonData from "./data.json" with { type: "json" };
const jsonData2 = await import"./data2.json", { with { type: "json" } });
Other(Cow<'static, str>)
An arbitrary module type. It is up to the embedder to handle (or deny) it.
If [CustomModuleEvaluationCb
] was not passed when creating a runtime,
then all “other” module types cause an error to be returned.
Example:
ⓘ
import text from "./log.txt" with { type: "text" };
const imgData = await import(`./images/${name}.png`, { with: { type: "bytes" }});
Implementations§
source§impl RequestedModuleType
impl RequestedModuleType
pub fn to_v8<'s>(&self, scope: &mut HandleScope<'s>) -> Local<'s, Value>
pub fn try_from_v8( scope: &mut HandleScope<'_>, value: Local<'_, Value> ) -> Option<Self>
Trait Implementations§
source§impl AsRef<RequestedModuleType> for RequestedModuleType
impl AsRef<RequestedModuleType> for RequestedModuleType
source§fn as_ref(&self) -> &RequestedModuleType
fn as_ref(&self) -> &RequestedModuleType
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for RequestedModuleType
impl Clone for RequestedModuleType
source§fn clone(&self) -> RequestedModuleType
fn clone(&self) -> RequestedModuleType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RequestedModuleType
impl Debug for RequestedModuleType
source§impl<'de> Deserialize<'de> for RequestedModuleType
impl<'de> Deserialize<'de> for RequestedModuleType
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 Display for RequestedModuleType
impl Display for RequestedModuleType
source§impl From<ModuleType> for RequestedModuleType
impl From<ModuleType> for RequestedModuleType
source§fn from(module_type: ModuleType) -> RequestedModuleType
fn from(module_type: ModuleType) -> RequestedModuleType
Converts to this type from the input type.
source§impl Hash for RequestedModuleType
impl Hash for RequestedModuleType
source§impl PartialEq<ModuleType> for RequestedModuleType
impl PartialEq<ModuleType> for RequestedModuleType
source§fn eq(&self, other: &ModuleType) -> bool
fn eq(&self, other: &ModuleType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq for RequestedModuleType
impl PartialEq for RequestedModuleType
source§fn eq(&self, other: &RequestedModuleType) -> bool
fn eq(&self, other: &RequestedModuleType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for RequestedModuleType
impl Serialize for RequestedModuleType
impl Eq for RequestedModuleType
impl StructuralPartialEq for RequestedModuleType
Auto Trait Implementations§
impl RefUnwindSafe for RequestedModuleType
impl Send for RequestedModuleType
impl Sync for RequestedModuleType
impl Unpin for RequestedModuleType
impl UnwindSafe for RequestedModuleType
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> 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.