1 unstable release
Uses old Rust 2015
0.1.0 | Jul 20, 2018 |
---|
#7 in #oriented
12KB
208 lines
omnivers3/sink
This crate aims to provide an abstraction for a thing which can be sent values and, immediately, return a Result indicating success / failure of receipt.
As a base primitive this should enable a message oriented variant of the inbound params to the familiar imperitive Result 'and_then' composition pattern.
Background
A primary goal of the interface for ISink is to hide the implementation details of any sink.
Some decisions were made in order to facilitate that:
- Send takes Sink reference
We don't want to consume the sink so that it can be reused to send many times.
We also don't want to require the sender maintain a mutable reference to the sink.
- Delegated Mutation
StatefulSink requires that the creator manages mutation by taking ownership of the state type in it's struct.
This means that mutation and thread-safety level concerns are pushed out to the implementors.
- Send takes ownership of the sent value
Similar to Delegated Mutation, this forces the sender to be responsible for sharing, thread-safety, etc.
This also means that downstream recipients are explicitly decoupled from the originating source.
Some Helpful References
Implementing Function Composition
CI/CD
Building a Rust Project on CircleCI
To Get RustFmt Options:
rustup run nightly -- rustfmt --help