pub struct ImportCall { /* private fields */ }Expand description
The import() syntax, commonly called dynamic import, is a function-like expression that allows
loading an ECMAScript module asynchronously and dynamically into a potentially non-module
environment.
More information:
Implementations§
Source§impl ImportCall
impl ImportCall
Sourcepub fn new<S>(
specifier: S,
options: Option<Expression>,
phase: ImportPhase,
span: Span,
) -> Selfwhere
S: Into<Expression>,
pub fn new<S>(
specifier: S,
options: Option<Expression>,
phase: ImportPhase,
span: Span,
) -> Selfwhere
S: Into<Expression>,
Creates a new ImportCall AST node.
Sourcepub const fn specifier(&self) -> &Expression
pub const fn specifier(&self) -> &Expression
Retrieves the specifier (first argument) of the import call.
Sourcepub fn options(&self) -> Option<&Expression>
pub fn options(&self) -> Option<&Expression>
Retrieves the options (second argument) of the import call, if present.
This is used for import attributes:
import("foo.json", { with: { type: "json" } })Sourcepub const fn phase(&self) -> ImportPhase
pub const fn phase(&self) -> ImportPhase
Returns the phase of this import call.
Sourcepub const fn argument(&self) -> &Expression
👎Deprecated since 0.21.0: use specifier instead
pub const fn argument(&self) -> &Expression
use specifier instead
Gets the module specifier of the import call.
This is an alias for Self::specifier for backwards compatibility.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for ImportCall
impl<'arbitrary> Arbitrary<'arbitrary> for ImportCall
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for ImportCall
impl Clone for ImportCall
Source§fn clone(&self) -> ImportCall
fn clone(&self) -> ImportCall
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ImportCall
impl Debug for ImportCall
Source§impl<'de> Deserialize<'de> for ImportCall
impl<'de> Deserialize<'de> for ImportCall
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<'a> From<&'a ImportCall> for NodeRef<'a>
impl<'a> From<&'a ImportCall> for NodeRef<'a>
Source§fn from(node: &'a ImportCall) -> NodeRef<'a>
fn from(node: &'a ImportCall) -> NodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a mut ImportCall> for NodeRefMut<'a>
impl<'a> From<&'a mut ImportCall> for NodeRefMut<'a>
Source§fn from(node: &'a mut ImportCall) -> NodeRefMut<'a>
fn from(node: &'a mut ImportCall) -> NodeRefMut<'a>
Converts to this type from the input type.
Source§impl From<ImportCall> for Expression
impl From<ImportCall> for Expression
Source§fn from(call: ImportCall) -> Self
fn from(call: ImportCall) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ImportCall
impl PartialEq for ImportCall
Source§impl Serialize for ImportCall
impl Serialize for ImportCall
Source§impl Spanned for ImportCall
impl Spanned for ImportCall
impl StructuralPartialEq for ImportCall
Source§impl ToInternedString for ImportCall
impl ToInternedString for ImportCall
Source§fn to_interned_string(&self, interner: &Interner) -> String
fn to_interned_string(&self, interner: &Interner) -> String
Converts a given element to a string using an interner.
Source§impl VisitWith for ImportCall
impl VisitWith for ImportCall
Source§fn visit_with<'a, V>(&'a self, visitor: &mut V) -> ControlFlow<V::BreakTy>where
V: Visitor<'a>,
fn visit_with<'a, V>(&'a self, visitor: &mut V) -> ControlFlow<V::BreakTy>where
V: Visitor<'a>,
Visit this node with the provided visitor.
Source§fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<V::BreakTy>where
V: VisitorMut<'a>,
fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<V::BreakTy>where
V: VisitorMut<'a>,
Visit this node with the provided visitor mutably, allowing the visitor to modify private
fields.
Auto Trait Implementations§
impl !RefUnwindSafe for ImportCall
impl !Send for ImportCall
impl !Sync for ImportCall
impl !UnwindSafe for ImportCall
impl Freeze for ImportCall
impl Unpin for ImportCall
impl UnsafeUnpin for ImportCall
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