Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
/ promise-rs Public archive

Rust Promise library for guys from JavaScript world 🚲 [work in progress]

Notifications You must be signed in to change notification settings

stan-kondrat/promise-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Promise library

Build Status Crates.io

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.

Links

  1. JavaScript Promise Syntax
  2. Zero-cost futures and streams in Rust
  3. Asynchronous promises in rust using threads

About

Rust Promise library for guys from JavaScript world 🚲 [work in progress]

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages