RESTinio
Loading...
Searching...
No Matches
restinio::easy_parser::impl::as_result_consumer_t Struct Reference

A consumer for the case when the current value should be returned as the result for the producer at one level up. More...

#include <easy_parser.hpp>

Inheritance diagram for restinio::easy_parser::impl::as_result_consumer_t:
restinio::easy_parser::impl::consumer_tag

Public Member Functions

template<typename Target_Type, typename Value>
void consume (Target_Type &dest, Value &&src) const

Additional Inherited Members

Static Public Attributes inherited from restinio::easy_parser::impl::consumer_tag
static constexpr entity_type_t entity_type = entity_type_t::consumer

Detailed Description

A consumer for the case when the current value should be returned as the result for the producer at one level up.

For example that consumer can be necessary for rules like that:

 T := 'v' '=' token

such rule will be implemented by a such sequence of clauses:

produce<std::string>(symbol('v'), symbol('='), token_p() >> as_result());
auto symbol(char expected) noexcept
A factory function to create a clause that expects the speficied symbol, extracts it and then skips i...
auto as_result() noexcept
A factory function to create a as_result_consumer.
auto produce(Clauses &&... clauses)
A factory function to create a producer that creates an instance of the target type by using specifie...

The result of token_p() producer in a subclause should be returned as the result of top-level producer.

Since
v.0.6.1

Definition at line 2870 of file easy_parser.hpp.

Member Function Documentation

◆ consume()

template<typename Target_Type, typename Value>
void restinio::easy_parser::impl::as_result_consumer_t::consume ( Target_Type & dest,
Value && src ) const
inline

Definition at line 2874 of file easy_parser.hpp.


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