8000 GitHub - richardanaya/asynctimer: A minimal toy async-await executor in web assembly
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

richardanaya/asynctimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async-Await in Web Assembly

This project shows a toy async-await executor written from scratch for web assembly. The goal is to make this real and see output:

pub fn main() -> () {
    Executor::spawn(async {
        say_num(1);
        sleep(1000).await;
        say_num(2);
        sleep(1000).await;
        say_num(3);
    });
}

See it working here

This library only uses once_cell for global state and woke for waker creation (because the pointer magic for that is crazy).

Warning: this project builds only with Rust 1.39 and above

Limitations: this executor can only run a single top level future (i.e. no multiple spawns), management of timeout does not scale. Don't use this code for production, use it to learn!

About

A minimal toy async-await executor in web assembly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0