pub trait IoHandler: Send + Sync {
// Required method
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 JsonValue,
) -> Pin<Box<dyn Future<Output = Result<JsonValue, String>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
I/O handler trait — all I/O handlers implement this interface.
Uses #[async_trait] to make the trait object-safe, enabling
Arc<dyn IoHandler> dynamic dispatch.
params comes from Fact::IoRequest.params, already resolved from path
references into concrete values by the TCB.
§Implementer responsibilities
- Extract the required fields from
params(e.g.url,query,key) - Perform the actual I/O operation (HTTP request, SQL query, file I/O, etc.)
- Return
Ok(JsonValue)orErr(String)
§Callers
- The governance
IoDispatcherdispatches to the matching handler byIoType - The governance
IoSubscribersubscribes toFact::IoRequestand calls dispatch
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 JsonValue,
) -> Pin<Box<dyn Future<Output = Result<JsonValue, String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 JsonValue,
) -> Pin<Box<dyn Future<Output = Result<JsonValue, String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Execute the I/O operation.
§Parameters
params: I/O request parameters (passed through by theio_requestinstruction; e.g.call_externalcarries{"messages": [...], "tools": [...]},call_servicecarries{"service_name": "...", "args": {...}})
§Returns
Ok(JsonValue): I/O result (injected intopayload.__io_results__.{io_type})Err(String): error message (recorded intoIoResponse.error; the result is not consumed)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".