async-io-model
Installation
SKILL.md
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():