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 —— 所有 I/O handler 实现此接口
使用 #[async_trait] 使 trait object-safe,支持 Arc<dyn IoHandler>。
params 来自 Fact::IoRequest.params,已由 TCB 从路径引用解析为具体值。
§实现者职责
- 从
params提取所需字段(如url、query、key) - 执行实际 I/O 操作(HTTP 请求、SQL 查询、文件读写等)
- 返回
Ok(JsonValue)或Err(String)
§调用方
evorule-governance::IoDispatcher根据IoType分发到对应 handlerevorule-governance::IoSubscriber订阅Fact::IoRequest后调用 dispatch
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".