docs.rs failed to build bicoro-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
bicoro-0.19.0
(Bi)directional (Coro)utines
This is a simple pure library to model a bidirectional coroutine in rust. This allows a coroutine to be defined abstracted away from the actual IO implementations.
The main motivation is writing unit testable coroutines, that respond to inputs, and generate outputs. This is a more generic form of Future.
Example
use *;
use *;
use m;
// The coroutine in dot-notation
let co : =
m! ;
// Arrange inputs and an store outputs in a vec
let inputs = vec!;
let mut outputs = vec!;
let on_output = ;
// run (and consume the inputs), mutate the output
let exec = execute_from_iter;
// Verify
assert!;
assert_eq!;
Executing
The coroutine just describes what to do, it won't actually do anything. You need to run it through an executor. One that works on an iterator is provided, but you may also want to create your own to implement with different contexts.
do-notatation
Implementation is compatible with https://github.com/phaazon/do-notation allowing for a syntax 'similar in feel' to using .await on futures.
This helps a bit with the callback hell, but is not strictly necessary.