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

Output sink that writes formatted characters into a FreeBSD-style sbuf. More...

#include <sbuf_sink.hpp>

Public Member Functions

constexpr sbuf_sink (SBufT *sb RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
 Constructs an sbuf sink over an existing buffer pointer.
 
sink as_sink () const noexcept RELOCO_LIFETIMEBOUND
 Creates a type-erased sink adapter pointing to this instance.
 
constexpr SBufT * native_handle () const noexcept
 Returns the underlying sbuf pointer.
 

Detailed Description

template<typename SBufT>
class microfmt::sbuf_sink< SBufT >

Output sink that writes formatted characters into a FreeBSD-style sbuf.

Wraps an externally provided sbuf-like pointer and exposes a non-owning, zero-allocation sink interface. Writes are appended safely using the environment's sbuf_bcat function.

By being templated on the buffer type, this class introduces zero hard dependencies on <sys/sbuf.h> unless instantiated.

Template Parameters
SBufTThe opaque buffer struct (typically struct sbuf).

Constructor & Destructor Documentation

◆ sbuf_sink()

template<typename SBufT >
constexpr microfmt::sbuf_sink< SBufT >::sbuf_sink ( SBufT *sb RELOCO_LIFETIMEBOUND  RELOCO_LIFETIME_CAPTURE_BY_THIS)
inlineexplicitconstexprnoexcept

Constructs an sbuf sink over an existing buffer pointer.

Parameters
sbThe target sbuf pointer.

Member Function Documentation

◆ as_sink()

template<typename SBufT >
sink microfmt::sbuf_sink< SBufT >::as_sink ( ) const
inlinenoexcept

Creates a type-erased sink adapter pointing to this instance.

Returns
A lightweight sink struct configured with a callback to append to this sbuf.

◆ native_handle()

template<typename SBufT >
constexpr SBufT * microfmt::sbuf_sink< SBufT >::native_handle ( ) const
inlineconstexprnoexcept

Returns the underlying sbuf pointer.

Returns
The wrapped sbuf instance.

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