Expand description
JavaScript functions and Fetch handlers hosted by Rust.
Re-exports§
pub use http;
Structs§
- App
- A managed, reusable application instance with fixed host bindings.
- AppBuilder
- AppHandle
- A cloneable Send + Sync handle to one application on its worker threads.
- Boa
- BoaOptions
- Boa interpreter limits. None uses the engine’s own setting (10,240 value stack slots and 512 nested calls in Boa 0.22).
- Body
- An HTTP body owned by fetchlet.
- Call
- A call of an exported function: its arguments, which are JSON values,
byte arrays and channels Rust lends to it, and the trusted
Contextof its invocation. - Call
Output - The result of an exported function: the JSON value
JSON.stringifymade of it, with eachArrayBufferor view inside it as bytes. - Channel
End - Rust’s end of a channel whose other end is JavaScript in one invocation.
- Channel
Request - A channel JavaScript asked a
ChannelServiceto open, withenv.NAME.connect(options). - Close
Frame - How a channel ended, in WebSocket’s close code space (RFC 6455 §7.4).
- Context
- Trusted, request-scoped values that Rust supplies to in-process services.
- Fetch
App - Low-level Fetch adapter; prefer App for managed deadlines and host services.
- Fetch
Policy - Exact normalized origins; no wildcard or substring matching.
- Fetch
Service - A transport with an origin policy and optional trusted request callbacks.
- Function
Error - The failure of a
Functionsmethod. - Function
Request - What a
Functionsmethod receives when JavaScript calls it: the method’s name, its arguments and the invocation’s trustedContext. - Function
Response - The result of a
Functionsmethod: a JSON value, with byte arrays and channels at positions inside it. - Functions
- Rust functions that JavaScript calls as the methods of
env.NAME. - Held
Connection - A place among the
Instances::max_held_connectionsof anAppHandle, fromAppHandle::reserve_connection. - Host
Services - Fixed bindings and services for one App. No process environment is inherited.
- Instances
- The instances of an
AppHandle, each on its own worker thread and each running one call at a time. - Limits
- Resource budgets selected by the embedding application.
- Module
- A prebuilt script exposing named functions through
fetchletExports, with what it needs from the host that runs it. - Origin
Router - Exact-origin routing of host fetches to registered transports.
- Pool
State - What the instances and queue of an
AppHandleare doing, fromAppHandle::pool_state, for operators to sizeInstancesand the queue from their own load. - Process
Options - How the child process of an isolated instance starts and what bounds it.
- QuickJs
- Quick
JsOptions - QuickJS resource settings. None uses the engine’s own setting. The heap
budget is
Limits::heap_bytes, which every engine that can enforce one shares. - Require
Http2 - A request extension that
FetchServiceadds when the request’s body streams and its policy does not allow that over HTTP/1.x (FetchPolicy::allow_http1_streaming). - Requirements
- What a module needs from the host that runs it, as
fetchlet/buildrecords in an artifact’s manifest: native engine APIs and the locales they must support, the engine’s async context, and the Web APIs and protocol of fetchlet-web. - Server
WebSocket - The response extension of a Fetch handler that accepted a WebSocket
upgrade with
upgradeWebSocket(request). - Socket
Address - A TCP destination: a host name or IP literal, and a port.
- Socket
Policy - Exact normalized hosts, each with the ports it allows; no wildcard or suffix matching.
- Socket
Request - A TCP connection JavaScript asked for with
connect(address, options). - Socket
Service - A socket transport with the policy that authorizes each address
JavaScript connects to, as
FetchServicepairs a fetch transport with aFetchPolicy. - WebSocket
Accept - What the server selected in the opening handshake.
- WebSocket
Request - A client WebSocket JavaScript opened with
new WebSocket(url, protocols). - WebSocket
Service - A WebSocket transport with the
FetchPolicythat authorizes the origin of each URL JavaScript connects to,ws:andwss:counting ashttp:andhttps:, asFetchServicepairs a fetch transport with it. - Worker
Options - Configuration of the threads that own a shared application.
Enums§
- Backend
- Engine selection and its engine-specific configuration.
- Cancelled
Calls - What the worker does with a call or Fetch request whose caller goes away while JavaScript runs it, such as a request the HTTP client cancels.
- Channel
Event - What one end of a channel receives: a message, a socket’s signal, or the close that ends it.
- Console
Level - The console method a message came from.
- Error
- Failures at the Rust/JavaScript execution and host-service boundaries.
- Isolation
- Where an App’s engine runs: in the embedder’s process, or in a child process of its own (docs/research/process-isolation.md).
- Message
- One message of a channel: text or binary, as WebSocket frames carry them.
- Program
- The executable of an isolated instance’s child process.
- Secure
Transport - Whether a socket speaks TLS from its start.
Traits§
- Channel
Service - Opens the channels of one
envbinding for JavaScript. - Fetch
Transport - A trusted, single-hop transport.
- Instance
- Low-level engine execution. App supplies invocation and host-service ownership. Instances are not necessarily Send; keep them on their owning worker thread.
- Socket
Transport - A trusted transport that opens TCP connections for JavaScript.
- WebSocket
Transport - A trusted transport that opens client WebSockets for JavaScript.
Functions§
- channel_
fn - Adapt an async Rust function to a channel service.
- serve_
if_ child - Serve as an isolated instance when the parent started this process as
one, and never return; otherwise return at once. An executable that
Programnames calls this first thing inmain, before it reads its own arguments or writes to standard output, which carries the frames to the parent. - socket_
fn - Adapt an async Rust function, such as an in-process server or a mock, to a socket transport.
- transport_
fn - Adapt an async Rust function, including a mock, to a host transport.
- websocket_
fn - Adapt an async Rust function, such as an in-process server or a mock, to a WebSocket transport.
Type Aliases§
- Channel
Future - The future of an open: Ok once the channel is open, or the error that refuses it.
- Function
Future - The future of an async method of a
Functionsbinding. - Request
- Response
- Result
- Transport
Future - WebSocket
Future - The opening handshake of a client WebSocket.