#future #value #by-value

valuable_futures

Utils which allow writing futures::Future and futures::Stream by-value

2 releases

Uses old Rust 2015

0.1.1 Aug 21, 2017
0.1.0 Aug 18, 2017

#521 in #value


Used in ciruela

MIT/Apache

10KB
75 lines

Valuable-futures crate

Status:Alpha
Documentation:http://docs.rs/valuable-futures/

A library that allows writing futures having a by-value state (or type-safe futures inspired by #458). This is very useful for implemention futures as state machines or enums.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

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.

Dependencies

~54KB