Crate valuable_futures

Crate valuable_futures 

Source
Expand description

The crate provides by-value futures that make certain patterns easier and more typesafe

Examples | Github

There are two by-value future traits:

  • Future – similar to normal future, but receives self by value. You must call into_future() to convert it to futures::Future
  • StateMachine – similar to Future but also receives a mutable pointer of Supply type. Basically having both mutable state, and type-safe state machine. Converted to futures::Future by calling Supply::new

This crate also has it’s own Async type that contains a new state in NotReady option.

Structs§

FutureWrapper
A wrapper that converts type-safe future into normal future
Supply
A wrapper that provides mutable state to future-like StateMachine

Enums§

Async
A variant of futures::Async that carries state in NotReady

Traits§

Future
A type-safe future trait
StateMachine
A type-safe future-like trait that has also borrowed mutable state