Expand description
Bindings
§Bindings Module
This module provides a framework for exposing Rust functions to dynamic environments such as CLIs, Python bindings, or visual editors.
§Architecture
- Registry: A global collection of
Bindingstructs, collected viainventory. - AppState: A thread-safe storage for “Big Types” (e.g., EventLogs) that are passed by reference (ID) rather than serialized.
- Execution: Functions are invoked via
call(), which handles argument extraction and result storage.
§Usage
- Define a function and annotate it with
#[register_binding]. - Use
list_functions()to discover available commands. - Use
call()to execute them.
§Type Handling
- Simple Types: Serialized/Deserialized via
serde_json. - Big Types: Stored in
AppState. Arguments are string IDs pointing to the state. Return values are stored in state, and their new ID is returned.
§Helper Features
- Auto-Loading: The
resolve_argumentfunction can automatically load “Big Types” from file paths if the argument schema indicates a registry reference.
Structs§
- AppState
- State that can store ‘big’ types
- Binding
- Function Binding
- Binding
Meta - Metadata of a function binding
Enums§
- Registry
Item - Manually maintained Registry enum of ‘big’ types
- Registry
Item Kind
Traits§
- From
Context - Derive Value from Context
Functions§
- call
- Call the specified function with the passed arguments
- extract_
param - Try to extract function args (used in macro)
- get_
fn_ binding - Get the binding information of an function by its name
- index_
link_ ocel - Convert an
OCELto anIndexLinkedOCEL - list_
functions - Get a list of all functions available through bindings
- list_
functions_ meta - Get a list of all function metadata available through bindings
- num_
events - Get the number of events in an
OCEL - num_
objects - Get the number of objects in an
OCEL - resolve_
argument - Resolve an argument value based on its schema and the current state.
- test_
some_ inputs - This is a test function.
Type Aliases§
- Inner
AppState - Inner App State