Commit 03b1c46
committed
feat: Add async/await support to ZRTL SDK for native async functions
Enable language frontend developers to expose native async functions
that can be awaited from Zyntax-based languages.
New in sdk/zrtl:
- async_support module with ZrtlPromise, PollResult, StateMachineHeader
- Promise combinators: PromiseAll, PromiseRace, PromiseAllSettled
- FutureAdapter for wrapping Rust futures
- yield_once() and sleep() async primitives
- 34 comprehensive async tests
New in sdk/zrtl_macros:
- #[zrtl_async] attribute macro for exporting async functions
- Generates state machine, poll function, and promise wrapper
- Auto-registers both wrapper and poll symbols
Example usage:
```rust
#[zrtl_async("$IO$read_file")]
pub async fn read_file(path: *const u8) -> i64 {
let contents = async_read(path).await;
contents.len() as i64
}
```
Guest language can then: `let size = await read_file("data.txt");`1 parent 82f5dcb commit 03b1c46
4 files changed
Lines changed: 1638 additions & 0 deletions
0 commit comments