iii-rust-sdk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRust SDK
Rust SDK
The native async Rust SDK for connecting workers to the iii engine via tokio.
用于通过tokio将工作进程连接到iii引擎的原生异步Rust SDK。
Documentation
文档
Full API reference: https://iii.dev/docs/api-reference/sdk-rust
Install
安装
Add to :
Cargo.tomliii-sdk = { version = "0.10", features = ["otel"] }添加到:
Cargo.tomliii-sdk = { version = "0.10", features = ["otel"] }Key Types and Functions
核心类型与函数
| Export | Purpose |
|---|---|
| Connect to the engine, returns |
| Register a sync function using the builder API |
| Register an async function using the builder API |
| Two-arg convenience method for function registration |
| Builder with |
| Bind a trigger to a function |
| Invoke a function |
| Fire-and-forget invocation |
| Durable async invocation |
| Error type for handler failures |
| Helper for atomic stream CRUD |
| OpenTelemetry (requires |
| HTTP client with trace context propagation |
| 导出内容 | 用途 |
|---|---|
| 连接到引擎,返回 |
| 使用构建器API注册同步函数 |
| 使用构建器API注册异步函数 |
| 用于函数注册的双参数便捷方法 |
| 带有 |
| 将触发器绑定到函数 |
| 调用函数 |
| 即发即弃式调用 |
| 持久化异步调用 |
| 处理器失败时的错误类型 |
| 用于原子流CRUD的辅助工具 |
| OpenTelemetry(需启用 |
| 带有追踪上下文传播的HTTP客户端 |
Key Notes
核心注意事项
- Add to
features = ["otel"]for OpenTelemetry supportCargo.toml - Use for sync handlers,
RegisterFunction::new("id", handler)for asyncRegisterFunction::new_async("id", handler) - Handler input types that derive get auto-generated request schemas
schemars::JsonSchema - Chain on
.description("...")to document the functionRegisterFunction - Keep the tokio runtime alive (e.g., loop) for event processing
tokio::time::sleep - returns
register_triggeron success; propagate errors withOk(())?
- 在中添加
Cargo.toml以获得OpenTelemetry支持features = ["otel"] - 同步处理器使用,异步处理器使用
RegisterFunction::new("id", handler)RegisterFunction::new_async("id", handler) - 派生的处理器输入类型会自动生成请求schema
schemars::JsonSchema - 在上链式调用
RegisterFunction可为函数添加文档说明.description("...") - 保持tokio运行时处于活跃状态(例如循环)以处理事件
tokio::time::sleep - 成功时返回
register_trigger;使用Ok(())传播错误?
Pattern Boundaries
模式边界
- For usage patterns and working examples, see
iii-functions-and-triggers - For Node.js SDK, see
iii-node-sdk - For Python SDK, see
iii-python-sdk
- 有关使用模式和示例,请查看
iii-functions-and-triggers - Node.js SDK请查看
iii-node-sdk - Python SDK请查看
iii-python-sdk
When to Use
使用场景
- Use this skill when the task is primarily about in the iii engine.
iii-rust-sdk - Triggers when the request directly asks for this pattern or an equivalent implementation.
- 当任务主要涉及iii引擎中的时,使用此技能。
iii-rust-sdk - 当请求直接要求此模式或等效实现时触发。
Boundaries
边界限制
- Never use this skill as a generic fallback for unrelated tasks.
- You must not apply this skill when a more specific iii skill is a better fit.
- Always verify environment and safety constraints before applying examples from this skill.
- 切勿将此技能用作无关任务的通用回退方案。
- 当更特定的iii技能更合适时,不得使用此技能。
- 在应用此技能中的示例之前,务必验证环境和安全约束。