Crate futures_shuttle [] [src]

Futures-based Shuttle

A channel for shuttling a single object/message back and forth between two asynchronous tasks. Contrary to the mutex or lock, shuttle always belongs to one of the two tasks. The side that owns the control over Shuttle at a specific moment can manipulate its content and send it to the other side. At this point control goes over to the other side and the original side loses the ability to access the Shuttle object. It, however, can wait for Shuttle to come back from the other side of the track, and then regain the access.

Structs

Shuttle

This is created by the shuttle function.

ShuttleCombined
ShuttleValue

ShuttleValue is a guard for the object inside Shuttle, much like MutexGuard' forMutex`.

ShuttleWait

ShuttleWait object is a Future that waits for Shuttle to arrive back. I.e. it completes when the other side calls send on its object and the ownership turns to this object. ShuttleWait is created when Shuttle is converted into Future (it implements IntoFuture) and it consumes the Shuttle object. When the future completes it yields the Shuttle object back.

Enums

ShuttleError

Describes the possible error state of the Shuttle object.

Functions

shuttle

Creates a new shuttle synchronization object for sharing values between two asynchronous tasks.

shuttle_combined