Struct rusty_v8::Module [−][src]
A compiled JavaScript module.
Implementations
impl Module
[src]
pub fn get_status(&self) -> ModuleStatus
[src]
Returns the module’s current status.
pub fn get_exception(&self) -> Local<'_, Value>
[src]
For a module in kErrored status, this returns the corresponding exception.
pub fn get_module_requests_length(&self) -> usize
[src]
Use Module::get_module_requests() and FixedArray::length().
Returns the number of modules requested by this module.
pub fn get_module_request(&self, i: usize) -> Local<'_, String>
[src]
Use Module::get_module_requests() and ModuleRequest::get_specifier().
Returns the ith module specifier in this module. i must be < self.get_module_requests_length() and >= 0.
pub fn get_module_requests(&self) -> Local<'_, FixedArray>
[src]
Returns the ModuleRequests for this module.
pub fn get_module_request_location(&self, i: usize) -> Location
[src]
Use Module::get_module_requests(), ModuleRequest::get_source_offset() and Module::source_offset_to_location().
Returns the source location (line number and column number) of the ith module specifier’s first occurrence in this module.
pub fn source_offset_to_location(&self, offset: int) -> Location
[src]
For the given source text offset in this module, returns the corresponding Location with line and column numbers.
pub fn script_id(&self) -> Option<int>
[src]
Returns the underlying script’s id.
The module must be a SourceTextModule and must not have an Errored status.
pub fn get_module_namespace(&self) -> Local<'_, Value>
[src]
Returns the namespace object of this module.
The module’s status must be at least kInstantiated.
#[must_use]pub fn instantiate_module<'a>(
&self,
scope: &mut HandleScope<'_>,
callback: impl MapFnTo<ResolveModuleCallback<'a>>
) -> Option<bool>
[src]
&self,
scope: &mut HandleScope<'_>,
callback: impl MapFnTo<ResolveModuleCallback<'a>>
) -> Option<bool>
Instantiates the module and its dependencies.
Returns an empty Maybe
NOTE: requires to set --harmony-import-assertions
V8 flag.
#[must_use]pub fn evaluate<'s>(
&self,
scope: &mut HandleScope<'s>
) -> Option<Local<'s, Value>>
[src]
&self,
scope: &mut HandleScope<'s>
) -> Option<Local<'s, Value>>
Evaluates the module and its dependencies.
If status is kInstantiated, run the module’s code. On success, set status to kEvaluated and return the completion value; on failure, set status to kErrored and propagate the thrown exception (which is then also available via |GetException|).
pub fn is_source_text_module(&self) -> bool
[src]
Returns whether the module is a SourceTextModule.
pub fn is_synthetic_module(&self) -> bool
[src]
Returns whether the module is a SyntheticModule.
pub fn create_synthetic_module<'s, 'a>(
scope: &mut HandleScope<'s>,
module_name: Local<'_, String>,
export_names: &[Local<'_, String>],
evaluation_steps: impl MapFnTo<SyntheticModuleEvaluationSteps<'a>>
) -> Local<'s, Module>
[src]
scope: &mut HandleScope<'s>,
module_name: Local<'_, String>,
export_names: &[Local<'_, String>],
evaluation_steps: impl MapFnTo<SyntheticModuleEvaluationSteps<'a>>
) -> Local<'s, Module>
Creates a new SyntheticModule with the specified export names, where evaluation_steps will be executed upon module evaluation. export_names must not contain duplicates. module_name is used solely for logging/debugging and doesn’t affect module behavior.
#[must_use]pub fn set_synthetic_module_export(
&self,
scope: &mut HandleScope<'_>,
export_name: Local<'_, String>,
export_value: Local<'_, Value>
) -> Option<bool>
[src]
&self,
scope: &mut HandleScope<'_>,
export_name: Local<'_, String>,
export_value: Local<'_, Value>
) -> Option<bool>
Set this module’s exported value for the name export_name to the specified export_value. This method must be called only on Modules created via create_synthetic_module. An error will be thrown if export_name is not one of the export_names that were passed in that create_synthetic_module call. Returns Some(true) on success, None if an error was thrown.
Methods from Deref<Target = Data>
pub fn get_hash(&self) -> int
[src]
Returns the V8 hash value for this value. The current implementation uses a hidden property to store the identity hash on some object types.
The return value will never be 0. Also, it is not guaranteed to be unique.
pub fn is_value(&self) -> bool
[src]
Returns true if this data is a Value
.
pub fn is_module(&self) -> bool
[src]
Returns true if this data is a Module
.
pub fn is_private(&self) -> bool
[src]
Returns true if this data is a Private
.
pub fn is_object_template(&self) -> bool
[src]
Returns true if this data is an ObjectTemplate
pub fn is_function_template(&self) -> bool
[src]
Returns true if this data is a FunctionTemplate.
Trait Implementations
impl Debug for Module
[src]
impl Deref for Module
[src]
impl Eq for Module
[src]
impl Hash for Module
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'s> PartialEq<Data> for Module
[src]
impl<'s> PartialEq<Module> for Data
[src]
impl<'s> PartialEq<Module> for Module
[src]
Auto Trait Implementations
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,