Description

Simple asynchronous functions

Package Information

Version0.0.1 (2016-Feb-06)
Repositoryhttps://github.com/evenex/simple_future
LicenseMIT
CopyrightCopyright © 2016 Vlad Levenfeld
AuthorsVlad Levenfeld
Registered byVlad Levenfeld
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

simple_future

Provides a (very) simple async function combinator.

If f :: A -> B, then async!f :: A -> Future!B. Suppose f(a) = b and async!f(a) = c.

async!f will execute f in a separate thread when invoked.

While f is being computed, c.pending.

If f succeeds, c.completed and b == c.result.

If f throws, c.failed.

Attempting to read c.result before c.completed is an error.

async!f can be made blocking at any time with c.await.

For convenience, c.await returns c so that c.await.result == c.result.

Available versions

0.0.1 ~master