inspect calls to on_next, on_error and on_completed.
More...
Go to the source code of this file.
|
template<class... AN> |
auto | rxcpp::operators::tap (AN &&...an) -> operator_factory< tap_tag, AN... > |
| inspect calls to on_next, on_error and on_completed. More...
|
|
inspect calls to on_next, on_error and on_completed.
- Template Parameters
-
MakeObserverArgN... | these args are passed to make_observer. |
- Parameters
-
an | these args are passed to make_observer. |
- Returns
- Observable that emits the same items as the source observable to both the subscriber and the observer.
- Note
- If an on_error method is not supplied the observer will ignore errors rather than call std::terminate()
- Sample Code
[](int v){printf("Tap - OnNext: %d\n", v);},
[](){printf("Tap - OnCompleted\n");});
values.
[](int v){printf("Subscribe - OnNext: %d\n", v);},
[](){printf("Subscribe - OnCompleted\n");});
Tap - OnNext: 1
Subscribe - OnNext: 1
Tap - OnNext: 2
Subscribe - OnNext: 2
Tap - OnNext: 3
Subscribe - OnNext: 3
Tap - OnCompleted
Subscribe - OnCompleted
If the source observable generates an error, the observer passed to tap is called: [](int v){printf("Tap - OnNext: %d\n", v);},
[](std::exception_ptr ep){
printf(
"Tap - OnError: %s\n",
rxu::what(ep).c_str());
},
[](){printf("Tap - OnCompleted\n");});
values.
[](int v){printf("Subscribe - OnNext: %d\n", v);},
[](std::exception_ptr ep){
printf(
"Subscribe - OnError: %s\n",
rxu::what(ep).c_str());
},
[](){printf("Subscribe - OnCompleted\n");});
Tap - OnNext: 1
Subscribe - OnNext: 1
Tap - OnNext: 2
Subscribe - OnNext: 2
Tap - OnNext: 3
Subscribe - OnNext: 3
Tap - OnError: Error
from source
Subscribe - OnError: Error
from source
#define RXCPP_OPERATORS_RX_TAP_HPP |