Installation
Initialization
Create and return a connected SDK instance. The WebSocket connection is established automatically in a background Tokio task.Methods
shutdown
Shutdown the III client. This stops the connection loop and sends a shutdown signal. If theotel feature is enabled, this will spawn a background task
to flush telemetry data, but does NOT wait for it to complete.
For guaranteed telemetry flush, use shutdown_async() instead.
Signature
shutdown_async
Shutdown the III client and flush all pending telemetry data. This method stops the connection loop and sends a shutdown signal. When theotel feature is enabled, it additionally awaits the
OpenTelemetry flush, ensuring all spans, metrics, and logs are
exported before returning.
Signature
register
Register a function using theRegisterFunction builder.
This is the recommended API — combines ID, handler, and auto-generated
request_format/response_format schemas in one step.
Signature
Parameters
Example
register_function
Register a function with the engine (low-level API). Pass a closure/async fn for local execution, or an [HttpInvocationConfig]
for HTTP-invoked functions (Lambda, Cloudflare Workers, etc.).
For a simpler API with auto-generated schemas, use register instead.
Signature
Parameters
Example
register_service
Register a service with the engine. SignatureParameters
register_trigger_type
Register a custom trigger type with the engine. SignatureParameters
unregister_trigger_type
Unregister a previously registered trigger type. SignatureParameters
register_trigger
Bind a trigger configuration to a registered function. SignatureParameters
Example
trigger
Invoke a remote function. The routing behavior depends on theaction field of the request:
- No action: synchronous — waits for the function to return.
- [
TriggerAction::Enqueue] - async via named queue. - [
TriggerAction::Void] — fire-and-forget.
Parameters
Example
get_connection_state
Get the current connection state. Signaturelist_functions
List all registered functions from the engine Signatureon_functions_available
Subscribe to function availability events Returns a guard that will unsubscribe when dropped SignatureParameters
list_workers
List all connected workers from the engine Signaturelist_triggers
List all registered triggers from the engine SignatureParameters
create_channel
Create a streaming channel pair for worker-to-worker data transfer. Returns aChannel with writer, reader, and their serializable refs
that can be passed as fields in invocation data to other functions.
Signature
Parameters
Logger
Structured logger that emits logs as OpenTelemetry LogRecords. Every log call automatically captures the active trace and span context, correlating your logs with distributed traces without any manual wiring. When OTel is not initialized, Logger gracefully falls back to thetracing
crate.
Pass structured data as the second argument to any log method. Using a
serde_json::Value object of key-value pairs (instead of string
interpolation) lets you filter, aggregate, and build dashboards in your
observability backend.
info
Log an info-level message. SignatureParameters
Example
warn
Log a warning-level message. SignatureParameters
Example
error
Log an error-level message. SignatureParameters
Example
debug
Log a debug-level message. SignatureParameters
Example
Types
RegisterFunction · iii_fn · iii_async_fn · InitOptions · IIIError · IIIConnectionState · TriggerRequest · TriggerAction · HttpInvocationConfig · HttpAuthConfig · HttpMethod · Channel · ChannelReader · ChannelWriter · ChannelDirection · StreamChannelRef · FunctionInfo · FunctionRef · TriggerInfo · WorkerInfo · WorkerMetadata · Trigger · RegisterFunctionMessage · RegisterServiceMessage · OtelConfig · ReconnectionConfig
RegisterFunction
One-step function registration combining ID, handler, and auto-generated schemas. UseRegisterFunction::new for sync functions or RegisterFunction::new_async
for async functions, then pass to III::register.
Constructors
Builder methods
Arity rules
Auto-generated schemas:
request_format and response_format are automatically
populated as JSON Schema (draft-07) using
schemars. Input and output types must derive
schemars::JsonSchema alongside serde::Deserialize/serde::Serialize.
iii_fn
pub fn iii_fn<F, M>(f: F) -> IIIFn<F>
Wraps a sync function into an III-compatible handler.
The input type must implement DeserializeOwned + JsonSchema and the return
type must implement Serialize + JsonSchema.
iii_async_fn
pub fn iii_async_fn<F, M>(f: F) -> IIIAsyncFn<F>
Wraps an async function into an III-compatible handler. Same semantics as iii_fn.
InitOptions
Configuration options passed to [register_worker].
IIIError
Errors returned by the III SDK.IIIConnectionState
Connection state for the III WebSocket clientTriggerRequest
Request object fortrigger(). Matches the Node/Python SDK signature:
trigger({ function_id, payload, action?, timeout_ms? })
TriggerAction
Routing action for [TriggerRequest]. Determines how the engine handles
the invocation.
Enqueue— Routes through a named queue for async processing.Void— Fire-and-forget, no response.
HttpInvocationConfig
Configuration for registering an HTTP-invoked function (Lambda, Cloudflare Workers, etc.) instead of a local handler.HttpAuthConfig
Authentication configuration for HTTP-invoked functions.Hmac— HMAC signature verification using a shared secret.Bearer— Bearer token authentication.ApiKey— API key sent via a custom header.
HttpMethod
Channel
A streaming channel pair for worker-to-worker data transfer.ChannelReader
WebSocket-backed reader for streaming binary data and text messages.ChannelWriter
WebSocket-backed writer for streaming binary data and text messages.ChannelDirection
StreamChannelRef
FunctionInfo
Function information returned byengine::functions::list. The engine auto-generates standard JSON Schema for request_format and response_format from Rust types using schemars.
FunctionRef
TriggerInfo
Trigger information returned byengine::triggers::list
WorkerInfo
Worker information returned byengine::workers::list
WorkerMetadata
Worker metadata for auto-registrationTrigger
Handle returned byIII::register_trigger.
Call unregister to remove the trigger from the engine.