Documentation Index
Fetch the complete documentation index at: https://mintlify.com/iii-hq/iii/llms.txt
Use this file to discover all available pages before exploring further.
EngineBuilder provides a fluent API for configuring, building, and running the iii framework engine. It handles module registration, initialization, and server lifecycle.
Constructor
EngineBuilder::new()
Creates a new EngineBuilder with default settings.
EngineBuilder instance with:
- Default module registry (from inventory)
- Address set to
0.0.0.0:49134 - Empty module list
Configuration Methods
address()
Sets the server address and port.
Server address in format
host:port (e.g., "0.0.0.0:3000")config_file_or_default()
Loads configuration from a YAML file if it exists, otherwise uses default modules.
Path to YAML configuration file (e.g.,
"config.yaml")Result<Self> - Updated builder or error if config parsing fails
Behavior:
- If file exists: Parses YAML and loads modules from config
- If file missing: Uses default modules registered via inventory
- Supports environment variable expansion (see Configuration)
src/main.rs
register_module()
Registers a custom module type that can be instantiated by class name.
Fully qualified class name for the module (e.g.,
"my::CustomModule")Type implementing the
Module traitadd_module()
Adds a module instance to be loaded at runtime.
Module class name (must be registered in the registry)
Optional JSON configuration passed to the module’s
create() methodBuild and Execution
build()
Builds and initializes all configured modules.
Result<Self> - Builder with initialized modules or error
Process:
- Ensures default metrics are available
- Adds mandatory modules if not present
- Creates all module instances via registry
- Calls
initialize()on each module - Registers module functions with the engine
src/main.rs
serve()
Starts the WebSocket server and begins serving requests.
Result<()> - Blocks until shutdown signal received
Behavior:
- Starts background tasks for all modules
- Starts channel TTL sweep task
- Sets up WebSocket routes:
/- Main worker connections/ws/channels/{channel_id}- Channel-specific connections
- Binds TCP listener and starts serving
- Waits for shutdown signal (SIGTERM, SIGINT, or Ctrl+C)
- Calls
destroy()on all modules for cleanup
src/main.rs
destroy()
Cleans up and destroys all modules. Called automatically by serve().
Result<()> - Success or first error encountered
Complete Examples
Basic Usage
src/main.rs
Custom Module Registration
Programmatic Configuration
Type Information
Module Trait Bound
Modules registered withregister_module() must implement:
Related
Configuration
Learn about EngineConfig and YAML structure
Module Trait
Module trait reference
Custom Modules
Build your own modules
Deployment
Production configuration guide