Giter VIP home page Giter VIP logo

whorl's Introduction

whorl - A single file, std only, async Rust executor

whorl was created to teach you how async executors work in Rust. It is not the fastest executor nor is it's API perfect, but it will teach you about them and how they work and where to get started if you wanted to make your own. It's written in a literate programming style such that reading it from beginning to end tells you a story about how it works or you can read parts of it in chunks depending on what you want to get out of it.

You can read it all online here on GitHub or you can clone the repo yourself and open up src/lib.rs to read through it in your favorite text editor or play around with it and change things. All of the code is licensed under the MIT License so you're mostly free to do with it as you wish. If you want to make the next tokio or just make something for fun you can do that.

If you just want to see it in action an example test program is included as part of the file. You can see it's output by just running:

cargo test -- --nocapture

Which should look something like this:

whorl on ๎‚  main [!โ‡ก] is ๐Ÿ“ฆ v0.1.0 via ๐Ÿฆ€ v1.56.0 took 10s
โฏ cargo test -- --nocapture
   Compiling whorl v0.1.0 (/home/michael/whorl)
    Finished test [unoptimized + debuginfo] target(s) in 0.47s
     Running unittests (target/debug/deps/whorl-6d670ffb5bb225ca)

running 1 test
Begin Asynchronous Execution
Blocking Function Polled To Completion
Spawned Fn #00: Start 1635276666
Spawned Fn #01: Start 1635276666
Spawned Fn #02: Start 1635276666
Spawned Fn #03: Start 1635276666
Spawned Fn #04: Start 1635276666
Spawned Fn #00: Ended 1635276669
Spawned Fn #02: Ended 1635276669
Spawned Fn #03: Ended 1635276669
Spawned Fn #01: Ended 1635276670
Spawned Fn #00: Inner 1635276671
Spawned Fn #03: Inner 1635276674
Spawned Fn #04: Ended 1635276675
Spawned Fn #02: Inner 1635276675
Spawned Fn #01: Inner 1635276678
Spawned Fn #04: Inner 1635276678
End of Asynchronous Execution
test library_test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 23.00s

   Doc-tests whorl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

This was originally created for my monthly newsletter. You can find that post in particular here or you can sign up for it here.

whorl's People

Contributors

mgattozzi avatar wutchzone avatar mgrachev avatar joseluisq avatar mre avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.