18template <
typename SBufT>
class RELOCO_POINTER
sbuf_sink {
25 explicit constexpr sbuf_sink(SBufT *sb RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept : m_sbuf(sb) {}
33 [[nodiscard]]
sink as_sink() const noexcept RELOCO_LIFETIMEBOUND {
34 return sink{.ctx = m_sbuf, .write_fn = [](
void *ctx, microfmt::string_view sv)
noexcept {
35 auto *self =
static_cast<SBufT *
>(ctx);
39 sbuf_bcat(self, sv.data(), sv.size());
49 [[nodiscard]]
constexpr SBufT *
native_handle() const noexcept {
return m_sbuf; }
Output sink that writes formatted characters into a FreeBSD-style sbuf.
Definition sbuf_sink.hpp:18
constexpr sbuf_sink(SBufT *sb RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
Constructs an sbuf sink over an existing buffer pointer.
Definition sbuf_sink.hpp:25
constexpr SBufT * native_handle() const noexcept
Returns the underlying sbuf pointer.
Definition sbuf_sink.hpp:49
sink as_sink() const noexcept RELOCO_LIFETIMEBOUND
Creates a type-erased sink adapter pointing to this instance.
Definition sbuf_sink.hpp:33
Core formatting primitives, sinks, and customization point.
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46