proxygen
set_done_2.cpp File Reference
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <folly/experimental/pushmi/o/empty.h>
#include <folly/experimental/pushmi/o/filter.h>
#include <folly/experimental/pushmi/o/just.h>
#include <folly/experimental/pushmi/o/tap.h>
#include <folly/experimental/pushmi/o/transform.h>

Go to the source code of this file.

Functions

auto get_setting ()
 
int main ()
 

Variables

const bool setting_exists = false
 
auto println = [](auto v) { std::cout << v << std::endl; }
 
template<class T , class E = std::exception_ptr>
auto concat
 

Function Documentation

auto get_setting ( )

Definition at line 31 of file set_done_2.cpp.

References folly::pushmi::operators::just, folly::pushmi::make_single_sender, setting_exists, and submit.

Referenced by main().

31  {
32  return mi::make_single_sender([](auto out) {
33  if (setting_exists) {
34  op::just(42) | op::submit(out);
35  } else {
36  op::empty<int>() | op::submit(out);
37  }
38  });
39 }
const bool setting_exists
Definition: set_done_2.cpp:29
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::operators::just_fn just
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::make_single_sender_fn make_single_sender
int main ( void  )

Definition at line 53 of file set_done_2.cpp.

References folly::pushmi::operators::filter, get_setting(), i, folly::pushmi::operators::just, println, submit, and folly::pushmi::operators::transform.

53  {
54  get_setting() | op::transform([](int i) { return std::to_string(i); }) |
56 
57  op::just(42) | op::filter([](int i) { return i < 42; }) |
58  op::transform([](int i) { return std::to_string(i); }) |
60 
61  op::just(42) | op::transform([](int i) {
62  if (i < 42) {
64  op::empty<std::string>()};
65  }
67  op::just(std::to_string(i))};
68  }) | concat<std::string> |
70 
71  std::cout << "OK" << std::endl;
72 }
PUSHMI_INLINE_VAR constexpr detail::filter_fn filter
Definition: filter.h:75
PUSHMI_INLINE_VAR constexpr detail::transform_fn transform
Definition: transform.h:158
auto println
Definition: set_done_2.cpp:41
auto get_setting()
Definition: set_done_2.cpp:31
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::operators::just_fn just

Variable Documentation

template<class T , class E = std::exception_ptr>
auto concat
Initial value:
= [](auto in) {
return mi::make_single_sender([in](auto out) mutable {
mi::submit(in, mi::make_receiver(out, [](auto out, auto v) {
}));
});
}
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::make_receiver_fn make_receiver
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::make_single_sender_fn make_single_sender

Definition at line 45 of file set_done_2.cpp.

auto println = [](auto v) { std::cout << v << std::endl; }

Definition at line 41 of file set_done_2.cpp.

Referenced by main(), and folly::symbolizer::SymbolizePrinter::println().

const bool setting_exists = false

Definition at line 29 of file set_done_2.cpp.

Referenced by get_setting().