Giter Club home page Giter Club logo

asynchronous's People

Contributors

bcndanos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

asynchronous's Issues

Avoid thread creation when chaining continuations

It makes sense to have the promise chain begin in a new thread from Promise::new(), however beyond that the continuations themselves shouldn't be in separate threads of their own. They should all run on the originating thread where the Promise was created.

Apart from the thread locality of the continuations, the idea of creating a separate thread for each continuation is expensive. These aren't green threads, and so I'm afraid this Promise implementation will not scale well when put to the test.

Create enum to allow either Promise<T, E> or Result<T, E> to be returned from a closure

Right now the promise closure must return only a Result<T, E> type, which makes it clunky to chain promise handlers together. A coherent promise implementation allows one to return a value or another promise, and when a continuation is done on the outer promise, it is continuing on the inner promise that was returned.

I suggest creating an enum type for the return type of all the methods, that can be either another Promise<T, E> type or be a Result<T, E> type. I have no idea if Rust's type system will get in the way here, or type inference will fail miserably...but this is the first thing that comes to my mind when thinking about solving the problem.

Feature request: try_sync

Hi,

Looks like a cool library, only have one small feature request: a non blocking try_sync that returns a value if there is one and None otherwise.

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.