Skip to content

Small examples to explain Futures, Waker, Tasks in Rust

License

Notifications You must be signed in to change notification settings

cfsamson/examples-futures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example code for the book Futures explained in 200 lines of Rust

This is the example repository for the book: Futures Explained in 200 lines of Rust

This example shows a self contained example of a Future implementation. In addition we create a simple Executor and a Reactor which can work without relying on real I/O which should make the example easy to play around with and learn from.

All the code and concepts are explained thoroughly in the accompanying book.

There are several branches to explore:

  • master: The example code for the book. Futures can be run on both async_std and tokio.
  • basic_example_commented: The same as the master branch but with extensive comments explaining everything.
  • bonus_runtimes: A simple proof that using other executors runs our example as expected
  • vtable: Example of a fat pointer. We create a Trait object from raw parts implementing our own vtable and data.

Contributing

Contributions are welcome. Minor corrections, or correctness issues will be merged to master and updated in the book, but remember that larger rewrites needs to be updated in the book as well.

I'll create new branches for contributions showing cool, different, interesting or improved versions of the example and point to them from the readme.

Questions and discussions are welcome in the issue tracker.

About

Small examples to explain Futures, Waker, Tasks in Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages