This library is counterpart to [P1055 - *A Modest Executor Proposal*](http://wg21.link/p1055r0).
*pushmi* is a header-only library that uses git submodules for dependencies (`git clone --recursive`), uses CMake to build, requires compliant C++14 compiler to build and has dependencies on meta and catch2 and some other libraries for testing and examples.
*pushmi* is an implementation for prototyping how Futures, Executors can be defined with shared Concepts. These Concepts can be implemented over and over again to solve different problems and make different tradeoffs. User implementations of the Concepts are first-class citizens due to the attention to composition. Composition also enables each implementation of the Concepts to focus on one concern and then be composed to build more complex solutions.
...
...
@@ -46,154 +46,66 @@ f.get();
it is this convolution that creates the race between the producer and consumer that requires expensive internal state to resolve.
## `none`
## `receiver`
The `none` type in the library provides simple ways to construct new implementations of the None concept.
construct a sink type that accepts any error type (and aborts on error)
```cpp
none<>n;
```
construct new type using one or more lambdas, or with designated initializers, use multiple lambdas to build overload sets
```cpp
// provide done
auton0=none{on_done{[](){}}};
// these are quite dangerous as they suppress errors
construct a new type with shared state across the lambdas. very useful for building a filter on top of an existing none. The state must be a None, but can be a super-set with additional state for this filter.
construct a type-erased type for a particular E (which could be a std::variant of supported types). I have a plan to provide operators to collapse values and errors to variant or tuple and then expand from variant or tuple back to their constituent values/errors.
```cpp
auton0=any_none{none{}};
auton1=any_none<std::exception_ptr>{none{}};
```
## `single`
The `single` type in the library provides simple ways to construct new implementations of the Single concept.
The `receiver` type in the library provides simple ways to construct new implementations of the Receiver concept.
construct a sink type that accepts any value or error type (and aborts on error)
```cpp
single<>s;
receiver<>s;
```
construct new type using one or more lambdas, or with designated initializers, use multiple lambdas to build overload sets
```cpp
// provide done
autos0=single{on_done{[](){}}};
autos0=receiver{on_done{[](){}}};
// provide value
autos1=single{[](autov){}};
autos2=single{on_value{[](int){},[](autov){}}};
autos1=receiver{[](autov){}};
autos2=receiver{on_value{[](int){},[](autov){}}};
// these are quite dangerous as they suppress errors
construct a new type with shared state across the lambdas. very useful for building a filter on top of an existing single. The state must be a Single, but can be a super-set with additional state for this filter.
construct a new type with shared state across the lambdas. very useful for building a filter on top of an existing receiver. The state must be a Receiver, but can be a super-set with additional state for this filter.
construct a type-erased type for a particular T & E (each of which could be a std::variant of supported types). I have a plan to provide operators to collapse values and errors to variant or tuple and then expand from variant or tuple back to their constituent values/errors.
```cpp
autos0=single<int>{single{}};
autos1=single<int,std::exception_ptr>{single{}};
```
## `sender`
The `sender` type in the library provides simple ways to construct new implementations of the NoneSender concept.
construct a producer of nothing, aka `never()`
```cpp
sender<>d;
```
construct new type using one or more lambdas, or with designated initializers, use multiple lambdas to build overload sets
construct a new type with shared state across the lambdas. very useful for building a filter on top of an existing sender. The state must be a NoneSender, but can be a super-set with additional state for this filter.
```cpp
autod0=sender{sender{}};
autod1=sender{sender{},on_submit{
[](sender<>&in,autoout){in|submit(out);}}};
autod2=sender{sender{},
[](sender<>&in,autoout){in|submit(out);}};
```
construct a type-erased type for a particular E (which could be a std::variant of supported types). I have a plan to provide operators to collapse values and errors to variant or tuple and then expand from variant or tuple back to their constituent values/errors.
@@ -231,8 +143,8 @@ auto sd2 = single_sender{single_sender{},
construct a type-erased type for a particular T & E (which could be a std::variant of supported types). I have a plan to provide operators to collapse values and errors to variant or tuple and then expand from variant or tuple back to their constituent values/errors.
@@ -270,13 +182,13 @@ auto tsd2 = time_single_sender{single_sender{},
construct a type-erased type for a particular T & E (which could be a std::variant of supported types). I have a plan to provide operators to collapse values and errors to variant or tuple and then expand from variant or tuple back to their constituent values/errors.