Expand description
The embedding API over quickjs-oxide-core: one realm per runtime, values as
Rust data or handles, the host as one trait, host functions with a
Scope, module loaders with a ModuleScope.
Re-exports§
pub use crate::engine::api::error::Error;pub use crate::engine::api::error::ErrorKind;pub use crate::engine::api::error::NativeErrorKind;pub use crate::engine::api::declare_thread_stack;pub use crate::engine::api::number_to_string;pub use crate::engine::api::quickjs_detect_module_bytes;
Structs§
- Callable
Ref - An object reference known to be callable.
- Compile
Options - Named source compilation options.
- Compiled
Module - A module compiled through a
ModuleScope, to return from the loader. - Context
- The runtime’s one realm.
- Core
Value - The core’s value, which
Host::promise_rejectionreceives. A JavaScript value, or the internal hole markerValue::EMPTY. - Eval
Options - Options of
Context::eval_with_options. - Function
Bytecode Ref - A compiled script, run by
Context::execute. - Function
Options - How a host function is made: its
nameandlength, whethernewmay call it, and the values it captures (Scope::data). Captured values are traced by the collector; a Rust value the closure captures is not. - GcStats
- The collector’s statistics.
- Heap
Limits - Interrupt
Handle - Interrupts a runtime’s running script from any thread: the script stops
at its next poll (about every thousand loop back-edges and calls)
with
RuntimeError::Interrupted, uncatchable by the script. The flag stays set untilInterruptHandle::clear, so every script after it is interrupted too. - JsBig
Int - An ECMAScript BigInt using the same short/heap split as
QuickJS. - JsString
- ECMAScript strings are sequences of UTF-16 code units, not UTF-8 scalar values. Compact Latin-1/UTF-16 leaves and bounded ropes mirror QuickJS’s current representation while preserving lone surrogates.
- Memory
Report - A runtime’s memory, part by part.
- Module
Bytecode Ref - A compiled module, run by
Context::execute_module. - Module
Import Attribute - One decoded entry from a static import declaration’s
withclause. - Module
Scope - A module loader’s view of the runtime: creating objects, errors, host
functions and host objects, compiling a module source. It is the
compile-time view (no job queue, no running script), so it has these
operations and not those of
Js. Values made through it are handles like any other and outlive the callback. - Object
Ref - A reference to an object of a runtime.
- Ordinary
Property Descriptor - A property descriptor for
[[DefineOwnProperty]], possibly partial. - Promise
Capability - A promise and its resolving functions (
Js::new_promise). A host function returnspromiseat once and keeps the capability; when the embedder’s event arrives it settles the promise from the top level and drains the job queue. - Promise
Snapshot - A promise’s state and result, read without running JavaScript.
- Property
Key - A property key: a string, an array index or a symbol. Made by
Runtime::intern_property_keyor from aSymbolRef. - QjsHelpers
- qjs’s helpers (
Context::install_qjs_helpers). - Raw
- The marker of a closure over the
Scopealone. - Runtime
- A runtime: one heap, one realm, one job queue. Cloning shares it.
- Runtime
Options - How a runtime is configured.
Defaultis the behavior every runtime had before the options existed. - Scope
- A host function’s view of the engine: its call, and every operation of
Js. Values it hands out are handles like any other and outlive the call. - Symbol
Ref - A reference to a symbol of a runtime.
- System
Host - A default host over the process: its streams, the system clock, UTC. The default host: the process’s streams, the system clock, UTC.
- Typed
Array View - A typed array’s window on its buffer (
Js::typed_array_view).
Enums§
- Accessor
Value - A present
getorsetfield: a function orundefined. - BigInt
Error - A failure produced by the BigInt value layer.
- Complete
Ordinary Property Descriptor - A complete own property, as
[[GetOwnProperty]]reports it. - Debug
Info Mode - Runtime-wide policy for the currently represented, JS-observable portion
of QuickJS
JS_SetStripInfo. - Descriptor
Field - A descriptor field: absent, or present with a value (
Present(undefined)andAbsentmean different things). - GcPolicy
- When the collector runs.
- JsString
Error - Why a string-kernel operation failed. It becomes a QuickJS InternalError
(
ErrorKind::JsInternal) in the front end’s errors, and aRuntimeErrorin the embedding API. - Module
Import Attributes - Syntactic import-attribute state for one requested module.
- Module
Source - What a loader returns for a module name.
- Pending
JobOutcome - What
run_pending_jobdid. - Promise
State - A promise’s state.
- Rejection
Event - What
Host::promise_rejectionreports (ECMAScript’sHostPromiseRejectionTrackeroperations). - Runtime
Error - Why an API call failed.
- Stream
- Which output stream
printand the console write to. - Typed
Array Kind - A typed array’s element type. A typed array’s element type.
- Value
- A JavaScript value held by the embedder.
- Well
Known Symbol - The well-known symbols.
Traits§
- FromJs
- A Rust value made from a JavaScript value, as the specification’s
conversions make it (
ToNumber,ToString, …). A conversion that may run JavaScript runs it throughjs. - Host
- The embedder’s services. Every method has a default suitable for a standalone runtime: the process’s streams, the system clock and UTC.
- Host
Function - What
Js::new_functiontakes: a closure over aScope.Argsis the marker the closure’s shape selects on. - IntoJs
- A JavaScript value made from a Rust value.
- Js
- The operations
Contextand a host function’sScopeshare, for code generic over where it runs. Sealed; both types also have each as an inherent method, so calling one needs no import. - Module
Loader - The embedder’s module loader. Errors are values to throw, made through
the
ModuleScope.
Type Aliases§
- JsResult
- What every operation returns.