3 releases (breaking)
Uses old Rust 2015
0.3.0 | Apr 9, 2017 |
---|---|
0.2.0 | Mar 20, 2017 |
0.1.0 | Mar 16, 2017 |
#32 in #promise
69 downloads per month
12KB
189 lines
Rust Promise library
Under the hood, executor spawn new thread at each time when Promise::new(executor)
invoked.
Documentation https://docs.rs/promise-rs
Usage
extern crate promise;
use promise::Promise;
fn main() {
let mut promise = Promise::new(|resolve, reject| {
// do something
let result: Option<String> = Some("resolve result".to_string());
resolve(result);
});
promise
.then(|value| { /* on fulfilled */ None }, |reason| { /* on rejected */ None })
.catch(|reason| { /* on rejected: */ None });
}
Motivation
Best way to begin learning a new language is start write own library. As I came from front-end world, will create yet another Promise library for Rust.