Struct v8::Module

source · []
#[repr(C)]
pub struct Module(_);
Expand description

A compiled JavaScript module.

Implementations

Returns the module’s current status.

For a module in kErrored status, this returns the corresponding exception.

Returns the ModuleRequests for this module.

For the given source text offset in this module, returns the corresponding Location with line and column numbers.

Returns the V8 hash value for this value. The current implementation uses a hidden property to store the identity hash.

The return value will never be 0. Also, it is not guaranteed to be unique.

Returns the underlying script’s id.

The module must be a SourceTextModule and must not have an Errored status.

Returns the namespace object of this module.

The module’s status must be at least kInstantiated.

Instantiates the module and its dependencies.

Returns an empty Maybe if an exception occurred during instantiation. (In the case where the callback throws an exception, that exception is propagated.)

NOTE: requires to set --harmony-import-assertions V8 flag.

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|).

Returns whether the module is a SourceTextModule.

Returns whether the module is a SyntheticModule.

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.

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>

Returns true if this data is a BigInt.

Returns true if this data is a Boolean.

Returns true if this data is a Context.

Returns true if this data is a FixedArray.

Returns true if this data is a FunctionTemplate.

Returns true if this data is a Module.

Returns true if this data is a ModuleRequest.

Returns true if this data is a Name.

Returns true if this data is a Number.

Returns true if this data is a ObjectTemplate.

Returns true if this data is a Primitive.

Returns true if this data is a Private.

Returns true if this data is a String.

Returns true if this data is a Symbol.

Returns true if this data is a Value.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.