cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
cli::action::Custom< Fn > Struct Template Reference

Wraps a user-defined callable as a non-terminal action pipeline step. More...

#include <action.hh>

Public Types

template<class Prev>
using after_type
template<class Prev>
using storage_type = void

Public Member Functions

template<class T>
auto operator() (ActionCtx< void > ctx, ActionResult< T > input) const -> ActionResult< after_type< T > >

Static Public Attributes

template<class Prev>
static constexpr bool accepts_input

Detailed Description

template<auto Fn>
struct cli::action::Custom< Fn >

Wraps a user-defined callable as a non-terminal action pipeline step.

Fn must be invocable as:

Context passed to each action function during pipeline execution.
Definition action.hh:246
The result type produced and consumed at each step of an action pipeline.
Definition action.hh:48

for each input type T it supports. The returned ActionResult<U> becomes the input to the next action in the pipeline.

This is the escape hatch for conversions or transformations that do not fit the built-in conversion or validation actions. Unlike pack::callback, Custom does not terminate the pipeline and does not store a value; its storage_type is always void.

Template Parameters
FnA constexpr callable used to transform the current pipeline value.

Definition at line 1918 of file action.hh.

Member Typedef Documentation

◆ after_type

template<auto Fn>
template<class Prev>
using cli::action::Custom< Fn >::after_type
Initial value:
typename std::invoke_result_t<decltype(Fn), ActionCtx<void>&,
ActionResult<Prev>>::value_type

Definition at line 1924 of file action.hh.

◆ storage_type

template<auto Fn>
template<class Prev>
using cli::action::Custom< Fn >::storage_type = void

Definition at line 1929 of file action.hh.

Member Function Documentation

◆ operator()()

template<auto Fn>
template<class T>
auto cli::action::Custom< Fn >::operator() ( ActionCtx< void > ctx,
ActionResult< T > input ) const -> ActionResult< after_type< T > >
inline

Definition at line 1933 of file action.hh.

Member Data Documentation

◆ accepts_input

template<auto Fn>
template<class Prev>
bool cli::action::Custom< Fn >::accepts_input
staticconstexpr
Initial value:
=
std::invocable<decltype(Fn), ActionCtx<void>&, ActionResult<Prev>>

Definition at line 1920 of file action.hh.


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