Crates.io | promises |
lib.rs | promises |
version | 0.2.0 |
source | src |
created_at | 2016-03-28 14:04:28.028951 |
updated_at | 2016-03-28 14:42:59.179396 |
description | Effective, simple, lightweight Javascript promises in Rust |
homepage | |
repository | https://github.com/SnirkImmington/rust-promises |
max_upload_size | |
id | 4588 |
size | 14,073 |
This library seeks to fully, effectively and simply recreate lightweight Javascript-style promises in Rust.
rust-promises
offers all the features of Ecmascript 6 promises plus a few Rust methods from Result<T, E>
, implemented using the std::thread
API and
Rust's asyncronous Sender
and Receiver
.
TODO (after adding some Result
methods to Promise
).
Promises are an excellent building block for asyncronous programming. They're a great way to build an asyncronous library, and also a small dependency for existing code.
Javascript's promises were adapted from promises in a programming language called E, which has a very powerful distributed computing architecture using message passing.
Rust's std::sync::mpsc::{Sender, Receiver}
provide a way to build such an
architecture (and promises) from Rust's safe threading systems.
There are currently 5 asyncronous libraries on crates.io which offer promises or futures. However they all have problems:
(Future, Promise)
pair from Promise::new()
. If you know how to use that, go to those libraries, I guess.