microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Public Member Functions | List of all members
microfmt::callback_sink< Callable > Class Template Reference

Output sink that adapts any callable object (lambda, functor) to a sink. More...

#include <microfmt.hpp>

Public Member Functions

constexpr callback_sink (Callable &fn RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
 Constructs a callback sink wrapping a reference to a callable.
 
sink as_sink () noexcept RELOCO_LIFETIMEBOUND
 Creates a type-erased sink adapter pointing to the wrapped callable.
 

Detailed Description

template<typename Callable>
class microfmt::callback_sink< Callable >

Output sink that adapts any callable object (lambda, functor) to a sink.

Template Parameters
CallableA callable accepting (microfmt::string_view) or (const char*, std::size_t).

Constructor & Destructor Documentation

◆ callback_sink()

template<typename Callable >
constexpr microfmt::callback_sink< Callable >::callback_sink ( Callable &fn RELOCO_LIFETIMEBOUND  RELOCO_LIFETIME_CAPTURE_BY_THIS)
inlineexplicitconstexprnoexcept

Constructs a callback sink wrapping a reference to a callable.

Parameters
fnReference to the target callable.

Member Function Documentation

◆ as_sink()

template<typename Callable >
sink microfmt::callback_sink< Callable >::as_sink ( )
inlinenoexcept

Creates a type-erased sink adapter pointing to the wrapped callable.

Returns
A lightweight sink struct forwarding writes to the callable.

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