ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
rpp::constraint::observer_strategy Concept Reference

Concept defines requirements for an user-defined observer strategy. More...

#include <fwd.hpp>

Concept definition

template<typename S, typename Type>
concept rpp::constraint::observer_strategy = observer_strategy_base<S> && requires(const S& const_strategy, const Type& v, Type& mv) {
const_strategy.on_next(v);
const_strategy.on_next(std::move(mv));
{ std::decay_t<S>::preferred_disposables_mode } -> rpp::constraint::decayed_same_as<rpp::details::observers::disposables_mode>;
}
Definition constraints.hpp:19
Concept defines requirements for an user-defined observer strategy.
Definition fwd.hpp:56

Detailed Description

Concept defines requirements for an user-defined observer strategy.

Template Parameters
Sis Strategy
Typeis type of value observer would obtain

Strategy should be able to handle:

  • on_next for both: const lvalue ref and rvalue ref of Type
  • on_error(exception_ptr) for unsuccessful termination event
  • on_completed() for successful termination event
  • set_upstream(disposable) for custom disposables related logic. In most cases you should OR do nothing OR just forward disposable to downstream observer (and set preferred_disposables_mode to None) OR fully handle disposales related logic properly
  • is_disposed() for extending custom disposables related logic with indicating current status.
  • static constexpr rpp::details::observers::disposables_mode preferred_disposables_mode with preferred disposables logic for observer over this strategy