Skip to main content

Crate sfo_js

Crate sfo_js 

Source

Modules§

ast
Boa’s boa_ast crate implements an ECMAScript abstract syntax tree.
bigint
Boa’s implementation of ECMAScript’s bigint primitive type.
builtins
Boa’s ECMAScript built-in object implementations, e.g. Object, String, Math, Array, etc.
bytecompiler
This module contains the bytecode compiler.
class
Traits and structs for implementing native classes.
clone
Module containing all types and functions to implement structuredClone.
console
Boa’s implementation of JavaScript’s console Web API object.
context
The ECMAScript context.
environments
Boa’s implementation of ECMAScript’s Environment Records.
error
Error-related types and conversions.
extensions
This module contains all the Runtime extensions that can be registered.
fetch
Boa’s implementation of JavaScript’s fetch function.
gc
Boa’s boa_gc crate implements a garbage collector.
interner
Boa’s boa_interner is a string interner for compiler performance.
interop
Interop module containing traits and types to ease integration between Boa and Rust.
interval
A module that declares any functions for dealing with intervals or timeouts.
job
Boa’s API to create and customize ECMAScript jobs and job queues.
message
Boa’s implementation of the Message API (mainly postMessage and supporting functions).
microtask
Microtask-related functions and types.
module
Boa’s implementation of the ECMAScript’s module system.
native_function
Boa’s wrappers for native Rust functions to be compatible with ECMAScript calls.
object
Boa’s representation of a JavaScript object and builtin object wrappers
optimizer
Implements optimizations.
parser
Boa’s boa_parser crate is a parser targeting the latest ECMAScript language specification.
prelude
A convenience module that re-exports the most commonly-used Boa APIs
property
Boa’s implementation of ECMAScript’s Property Descriptor.
realm
Boa’s implementation of ECMAScript’s Realm Records
script
Boa’s implementation of ECMAScript’s Scripts.
store
Module containing the types related to the JsValueStore.
string
This module contains the js_string macro and the js_str macro.
symbol
Boa’s implementation of ECMAScript’s global Symbol object.
text
Module implementing JavaScript classes to handle text encoding and decoding.
url
Boa’s implementation of JavaScript’s URL Web API class.
value
Boa’s ECMAScript Value implementation.
vm
Boa’s ECMAScript Virtual Machine

Macros§

__embed_module_inner
Implementation of the inner iterator of the embed_module! macro. All arguments are required.
embed_module
Create a module loader that embeds files from the filesystem at build time. This is useful for bundling assets with the binary.
embed_module_inner
Implementation of the inner iterator of the embed_module! macro. All arguments are required.
into_js_pkg_err
js_error
Create an error object from a value or string literal. Optionally the first argument of the macro can be a type of error (such as TypeError, RangeError or InternalError).
js_object
Create a JsObject object from a simpler DSL that resembles JSON.
js_pkg_err
js_str
Convert a utf8 string literal to a JsString
js_string
Utility macro to create a JsString.
js_value
The js_value! macro creates a JsValue instance based on a JSON-like DSL.
utf16
Construct a utf-16 array literal from a utf-8 str literal.

Structs§

Console
This is the internal console object state.
ConsoleState
The current state of the console, passed to the logger backend. This should not be copied or cloned. References are only valid for the current logging call.
Context
ECMAScript context. It is the primary way to interact with the runtime.
DefaultLogger
The default implementation for logging from the console.
HostDefined
This represents a ECMASCript specification [HostDefined] field.
JsBigInt
JavaScript bigint primitive rust type.
JsEngine
JsEngineBuilder
JsError
The error type returned by all operations related to the execution of Javascript code.
JsNativeError
Native representation of an ideal Error object from Javascript.
JsObject
Garbage collected Object.
JsPkg
JsPkgConfig
JsPkgManager
JsStr
This is equivalent to Rust’s &str.
JsString
A Latin1 or UTF-16–encoded, reference counted, immutable string.
JsSymbol
This represents a JavaScript symbol primitive.
JsValue
A generic JavaScript value. This can be any ECMAScript language valid value.
Module
ECMAScript’s Abstract module record.
NativeFunction
A callable Rust function that can be invoked by the engine.
NullLogger
A logger that drops all logging. Useful for testing.
Script
ECMAScript’s Script Record.
Source
A source of ECMAScript code.
SpannedSourceText
Contains pointer to source code and span of the object.

Enums§

JsNativeErrorKind
The list of possible error types a JsNativeError can be.
JsVariant
A non-mutable variant of a JsValue. Represents either a primitive value (bool, f64, i32) or a reference to a heap allocated value (JsString, JsSymbol).

Traits§

Finalize
Substitute for the Drop trait for garbage collected types.
IntoJsFunctionCopied
The safe equivalent of the UnsafeIntoJsFunction trait. This can only be used on closures that have the Copy trait.
IntoJsModule
A trait to convert a type into a JS module.
JsArgs
A utility trait to make working with function arguments easier.
JsData
Represents a type that can be stored inside a JsObject.
Logger
A trait that can be used to forward console logs to an implementation.
NativeObject
This trait allows Rust types to be passed around as objects.
RuntimeExtension
Optional registrable extension (with arguments) in the Boa Runtime should implement this.
Trace
The Trace trait, which needs to be implemented on garbage-collected objects.
TryIntoJsResult
Create a JsResult from a Rust value. This trait is used to convert Rust types to JS types, including JsResult of Rust values and JsValues.
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.

Functions§

register
Register all the built-in objects and functions of the WebAPI runtime, plus any extensions defined.
register_extensions
Register only the extensions provided. An application can use this to register extensions that it previously hadn’t registered.

Type Aliases§

JsEngineInitCallback
JsPkgManagerRef
JsPkgResult
JsResult
The result of a Javascript expression is represented like this so it can succeed (Ok) or fail (Err)

Attribute Macros§

boa_class
boa_class proc macro attribute that applies to an impl XYZ block and add a [boa_engine::JsClass] implementation for it.
boa_module
boa_module proc macro attribute for declaring a boa_engine::Module based on a Rust module. The original Rust module will also be exposed as is.

Derive Macros§

Finalize
Derive the Finalize trait.
JsData
Derive the JsData trait.
Trace
Derive the Trace trait.
TryFromJs
Derives the TryFromJs trait, with the #[boa()] attribute.
TryIntoJs
Derives the TryIntoJs trait, with the #[boa()] attribute.