Module bindings

Module bindings 

Source
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 Binding structs, collected via inventory.
  • 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

  1. Define a function and annotate it with #[register_binding].
  2. Use list_functions() to discover available commands.
  3. 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_argument function 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
BindingMeta
Metadata of a function binding

Enums§

RegistryItem
Manually maintained Registry enum of ‘big’ types
RegistryItemKind

Traits§

FromContext
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 OCEL to an IndexLinkedOCEL
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§

InnerAppState
Inner App State