Crate gj [] [src]

A library providing high-level abstractions for event loop concurrency, heavily borrowing ideas from KJ. Allows for coordination of asynchronous tasks using promises as a basic building block.

Modules

io

Asynchronous input and output.

Macros

pry!

Like try!(), but for functions that return a Promise<T, E> rather than a Result<T, E>.

Structs

EventLoop

A queue of events being executed in a loop on a single thread.

ForkedPromise

The result of Promise::fork(). Allows branches to be created.

Promise

A computation that might eventually resolve to a value of type T or to an error of type E.

PromiseFulfiller

A handle that can be used to fulfill or reject a promise. If you think of a promise as the receiving end of a oneshot channel, then this is the sending end.

TaskSet

Holds a collection of Promise<T, E>s and ensures that each executes to completion. Destroying a TaskSet automatically cancels all of its unfinished promises.

WaitScope

A scope in which asynchronous programming can occur. Corresponds to the top level scope of some event loop.

Traits

FulfillerDropped

Specifies an error to generate when a PromiseFulfiller is dropped.

TaskReaper

Callbacks to be invoked when a task in a TaskSet finishes. You are required to implement at least the failure case.