Observer specified with specific template types of callbacks to avoid extra heap usage. More...
#include <specific_observer.hpp>
Public Member Functions | |
template<constraint::on_next_fn< T > TOnNext = utils::empty_function_t<T>, constraint::on_error_fn TOnError = utils::rethrow_error_t, constraint::on_completed_fn TOnCompleted = utils::empty_function_t<>> | |
specific_observer (TOnNext &&on_next={}, TOnError &&on_error={}, TOnCompleted &&on_completed={}) | |
specific_observer (constraint::on_next_fn< T > auto &&on_next, constraint::on_completed_fn auto &&on_completed) | |
auto | as_dynamic () const & |
Converting current rpp::specific_observer to rpp::dynamic_observer alternative with erasing of type (and using heap) | |
auto | as_dynamic () && |
Public Member Functions inherited from rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States > | |
template<typename ... TStates> requires (constraint::decayed_same_as<States, TStates> && ...) | |
state_observer (std::invocable< T, States... > auto &&on_next, std::invocable< std::exception_ptr, States... > auto &&on_error, std::invocable< States... > auto &&on_completed, TStates &&...states) | |
void | on_next (const T &v) const |
Observable calls this methods to notify observer about new value. | |
void | on_next (T &&v) const |
Observable calls this methods to notify observer about new value. | |
void | on_error (const std::exception_ptr &err) const |
Observable calls this method to notify observer about some error during generation next data. | |
void | on_completed () const |
Observable calls this method to notify observer about finish of work. | |
Observer specified with specific template types of callbacks to avoid extra heap usage.
It has better performance comparing to rpp::dynamic_observer due to using stack instead of heap as long as possible. It is default return type of all operators
T | is type of value handled by this observer |
OnNext | type of on_next callback |
OnError | type of on_error callback |
OnCompleted | type of on_completed callback |
|
inline |
Converting current rpp::specific_observer to rpp::dynamic_observer alternative with erasing of type (and using heap)