pub enum ImportPhase {
Evaluation,
Defer,
Source,
}Expand description
The phase a module request asks for.
This is the source-phase-imports proposal’s [[Phase]]. A plain import asks for the
evaluation phase, which is the only one ECMA-262 itself defines; the other two come
from proposals that hang off the same grammar:
import defer * as ns from "m"— a namespace whose module is not evaluated until something reads through it (the import-defer proposal);import source x from "m"— the module source object rather than its namespace (source-phase-imports).
The phase belongs to the request rather than to the binding, because two clauses naming
one specifier at different phases are two requests: §16.2.1.5 de-duplicates
[[RequestedModules]] on [[Specifier]] and [[Phase]].
Variants§
Evaluation
import … / import(…) — evaluate the module and hand back its namespace.
Defer
import defer … / import.defer(…) — evaluate on first use.
Source
import source … / import.source(…) — hand back the source text.
Implementations§
Source§impl ImportPhase
impl ImportPhase
Sourcepub fn is_evaluation(self) -> bool
pub fn is_evaluation(self) -> bool
Whether this is the ordinary, spec-defined phase.
Trait Implementations§
Source§impl Clone for ImportPhase
impl Clone for ImportPhase
impl Copy for ImportPhase
Source§impl Debug for ImportPhase
impl Debug for ImportPhase
Source§impl Default for ImportPhase
impl Default for ImportPhase
impl Eq for ImportPhase
Source§impl PartialEq for ImportPhase
impl PartialEq for ImportPhase
impl StructuralPartialEq for ImportPhase
Auto Trait Implementations§
impl Forget for ImportPhase
impl Freeze for ImportPhase
impl Move for ImportPhase
impl RefUnwindSafe for ImportPhase
impl Send for ImportPhase
impl Sync for ImportPhase
impl Unpin for ImportPhase
impl UnsafeUnpin for ImportPhase
impl UnwindSafe for ImportPhase
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