GithubHelp home page GithubHelp logo

bradobro / books-futures-explained Goto Github PK

View Code? Open in Web Editor NEW

This project forked from verhovsky/books-futures-explained

0.0 1.0 0.0 2.51 MB

The repository for the book Futures Explained in 200 lines of Rust

License: MIT License

CSS 100.00%

books-futures-explained's Introduction

build status

Futures Explained in 200 Lines of Rust

The rendered version is found at: https://cfsamson.github.io/books-futures-explained/

You can find the main example in the repository examples-futures.

This book aims to explain Futures in Rust using an example driven approach, exploring why they're designed the way they are, and how they work. We'll also take a look at some of the alternatives we have when dealing with concurrency in programming.

Going into the level of detail I do in this book is not needed to use futures or async/await in Rust. It's for the curious out there that want to know how it all works.

What this book covers

This book will try to explain everything you might wonder about up until the topic of different types of executors and runtimes. We'll just implement a very simple runtime in this book introducing some concepts but it's enough to get started.

Stjepan Glavina has made an excellent series of articles about async runtimes and executors, and if the rumors are right there is more to come from him in the near future.

The way you should go about it is to read this book first, then continue reading the articles from stejpang to learn more about runtimes and how they work, especially:

  1. Build your own block_on()
  2. Build your own executor

Contributing

All kinds of contributions are welcome. Spelling, wording or clarifications are very welcome as well as adding or suggesting changes to the content. I'd appreciate if you contribute through a PR.

Feedback, questions or discussion is welcome in the issue tracker.

Changelog

2020-04-06: Final draft finished

2020-04-10: Rather substantial rewrite of the Reactor to better the readability and make it easier to reason about. In addition I fixed a mistake in the Poll method and a possible race condition. See #2 for more details.

2020-04-13: Added a "bonus section" to the Implementing Futures chapter where we avoid using thread::park and instead show how we can use a Condvar and a Mutex to create a proper Parker. Updated the Finished Example to reflect these changes. Unfortunately, this led us a few lines over my initial promis of keeping the example below 200 LOC but the I think the inclusion is worth it.

License

This book is MIT licensed.

books-futures-explained's People

Contributors

cfsamson avatar olehmisar avatar eupn avatar rkr35 avatar chengcyber avatar ianthetechie avatar robert-steiner avatar stanislav-tkach avatar gitbook-bot 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.