Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
rpc::AnyHandler Class Referencefinal

A type-erased Handler that can contain any (NextGen) RPC handler class. More...

#include <AnyHandler.hpp>

Public Member Functions

template<SomeHandler HandlerType, typename ProcessingStrategy = impl::DefaultProcessor<HandlerType>>
 AnyHandler (HandlerType &&handler)
 Type-erases any handler class.
 
ReturnType process (boost::json::value const &value, Context const &ctx) const
 Process incoming JSON by the stored handler.
 

Detailed Description

A type-erased Handler that can contain any (NextGen) RPC handler class.

This allows to store different handlers in one map/vector etc. Support for copying was added in order to allow storing in a map/unordered_map using the initializer_list constructor.

Constructor & Destructor Documentation

◆ AnyHandler()

template<SomeHandler HandlerType, typename ProcessingStrategy = impl::DefaultProcessor<HandlerType>>
rpc::AnyHandler::AnyHandler ( HandlerType && handler)
inline

Type-erases any handler class.

Template Parameters
HandlerTypeThe real type of wrapped handler class
ProcessingStrategyA strategy that implements how processing of JSON is to be done
Parameters
handlerThe handler to wrap. Required to fulfil the rpc::SomeHandler concept.

Member Function Documentation

◆ process()

ReturnType rpc::AnyHandler::process ( boost::json::value const & value,
Context const & ctx ) const
inlinenodiscard

Process incoming JSON by the stored handler.

Parameters
valueThe JSON to process
ctxRequest context
Returns
JSON result or Status on error

The documentation for this class was generated from the following file: