Skip to main content

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 the otel 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 the otel 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 the RegisterFunction 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. Signature

Parameters

register_trigger_type

Register a custom trigger type with the engine. Signature

Parameters

unregister_trigger_type

Unregister a previously registered trigger type. Signature

Parameters

register_trigger

Bind a trigger configuration to a registered function. Signature

Parameters

Example

trigger

Invoke a remote function. The routing behavior depends on the action field of the request:
  • No action: synchronous — waits for the function to return.
  • [TriggerAction::Enqueue] - async via named queue.
  • [TriggerAction::Void] — fire-and-forget.
Signature

Parameters

Example

get_connection_state

Get the current connection state. Signature

list_functions

List all registered functions from the engine Signature

on_functions_available

Subscribe to function availability events Returns a guard that will unsubscribe when dropped Signature

Parameters

list_workers

List all connected workers from the engine Signature

list_triggers

List all registered triggers from the engine Signature

Parameters

create_channel

Create a streaming channel pair for worker-to-worker data transfer. Returns a Channel 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 the tracing 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. Signature

Parameters

Example

warn

Log a warning-level message. Signature

Parameters

Example

error

Log an error-level message. Signature

Parameters

Example

debug

Log a debug-level message. Signature

Parameters

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. Use RegisterFunction::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 client

TriggerRequest

Request object for trigger(). 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 by engine::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 by engine::triggers::list

WorkerInfo

Worker information returned by engine::workers::list

WorkerMetadata

Worker metadata for auto-registration

Trigger

Handle returned by III::register_trigger. Call unregister to remove the trigger from the engine.

RegisterFunctionMessage

RegisterServiceMessage

OtelConfig

Configuration for OpenTelemetry initialization

ReconnectionConfig

Configuration for WebSocket reconnection behavior