
Async Io Model
Explicit state-machine pattern for IOResult-based I/O in Turso's core, with re-entrancy and completion-group guidance.
- skills.sh installs
- 1.3K
- GitHub stars
- 25.3K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers the IOResult contract, where a function is called repeatedly until it returns
Doneinstead of using async/await - Includes the
return_if_io!andio_yield_one!macros,CompletionGroupfor waiting on several completions, and a state-machine loop example - Enforces a re-entrancy rule: state mutations before a yield repeat on every call, so changes belong after the yield or in the next state
- Designed for developers writing or changing
corecode that returnsIOResultor keeps I/O state across yields
Install
$ npx -y skills add tursodatabase/turso --skill async-io-model -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Async I/O model
Turso uses cooperative yielding with explicit state machines instead of async/await.
Types
pub enum IOResult<T> {
Done(T), // finished, here is the result
IO(IOCompletions), // wait for the completion, then call again
}
pub struct IOCompletions(pub Completion);
pub type IOResultOr<T> = Result<IOResult<T>, Box<LimboError>>;
A function returning IOResult is called repeatedly until it returns Done.
To wait for several completions, add them to a CompletionGroup and yield the built completion. It finishes when all complete or one fails, can be nested, and can be cancelled with group.cancel():
let mut group = CompletionGroup::new(|_| {});
group.add(&completion1);
group.add(&completion2);
io_yield_one!(group.build());
Macros
return_if_io!(expr)unwrapsDone(v)tovand returns theIOvariant to the caller.io_yield_one!(c)returnsOk(IOResult::IO(IOCompletions(c))).
State machines
Keep progress in a state enum, loop on it, and set the next state before each yield:
Details
- Repository
- github.com/tursodatabase/turso
- Categories
- Rust, Databases
- First seen
- May 16, 2026
More from tursodatabase/turso
All 7Similar to Async Io Model
More Rust
async-python-patternsSkillwshobson/agents19.1K installsConcise async Python guide covering asyncio fundamentals, concurrency patterns, and sync-versus-async decisions for I/O-bound work.
loop-libraryPluginalirezarezvani/claude-skills30.3K starsDiscover, compare, audit, repair, adapt, and design repeatable AI-agent loops with explicit triggers, actions, verification, stopping conditions, guardrails, an
rust-async-patternsSkillsickn33/agentic-awesome-skills241 installsProduction Rust async patterns on Tokio covering tasks, channels, streams, and error handling for concurrent services.
async-repl-protocolSkillparcadei/continuous-claude-v3478 installsAsync REPL harness rules for awaiting Future-returning tools and running one code block per response.
asyncio-concurrency-patternsSkillmanutej/luxor-claude-marketplace491 installsComplete asyncio reference covering event loops, coroutines, tasks, futures, and concurrency patterns with runnable examples.
state-machineSkillowl-listener/designer-skills2.5K installsExplicit state, event, and transition modeling that rules out impossible UI states for complex components.