Closed as not planned
Description
What problem does this solve or what need does it fill?
There are many different methods to control the execution flow of a system set. I think many of them could be unified into an easy and intuitive API. For example, "piping" and "chaining" systems is essentially the same thing: you could look at "chaining" as piping ()
. Ideally, these two concepts should be merged into a nice and consistent API.
What solution would you like?
I think we can achieve a really nice looking API by utilizing the Shr
(or Shl
) traits.
For example:
Simple chaining
// Before:
(sys1, sys2, sys3).chain()
// After:
sys1 >> sys2 >> sys3
Simple piping
// Before:
sys1.pipe(sys2).pipe(sys3)
// After:
sys1 >> sys2 >> sys3
Complex chaining + piping
// Before:
(((sys1, sys2, sys3).chain(), sys4, sys5.pipe(sys6)), sys7).chain()
// After:
(sys1 >> sys2 >> sys3, sys4, sys5 >> sys6) >> sys7
What alternative(s) have you considered?
Keep the API as is
Additional context
- We can also use declarative macros. That would offer more flexibility, but it will be harder to implement and maintain (and it's not guaranteed to make the API feel better)
- This could open the gate for "1-N piping" (piping the output of a system into many systems)