Module interop

Module interop 

Source
Expand description

Interop module containing traits and types to ease integration between Boa and Rust.

Structs§

ContextData
Captures a ContextData data from the Context as a JS function argument, based on its type.
Ignore
An argument that would be ignored in a JS function. This is equivalent of typing () in Rust functions argument, but more explicit.
JsAll
An argument that when used in a JS function will capture all the arguments that can be converted to T. The first argument that cannot be converted to T will stop the conversion.
JsClass
Captures a class instance from the this value in a JS function. The class will be a non-mutable reference of Rust type T, if it is an instance of T.
JsRest
An argument that when used in a JS function will empty the list of JS arguments as JsValues. This can be used for having the rest of the arguments in a function. It should be the last argument of your function, before the Context argument if any.
JsThis
Captures the this value in a JS function. Although this can be specified multiple times as argument, it will always be filled with clone of the same value.

Traits§

IntoJsFunctionCopied
The safe equivalent of the UnsafeIntoJsFunction trait. This can only be used on closures that have the Copy trait.
TryFromJsArgument
Create a Rust value from a JS argument. This trait is used to convert arguments from JS to Rust types. It allows support for optional arguments or rest arguments.
UnsafeIntoJsFunction
A trait to convert a type into a JS function. This trait does not require the implementing type to be Copy, which can lead to undefined behaviour if it contains Garbage Collected objects.