|
microfmt
Zero-allocation C++ formatting for constrained environments
|
Traits-based, type-erased sink provider customization point. More...

Go to the source code of this file.
Namespaces | |
| namespace | microfmt |
| namespace | microfmt::detail |
Traits-based, type-erased sink provider customization point.
Mirrors reloco's context_type-based provider pattern (see reloco's docs/extending.md, "Extending reloco: the context_type-based provider
pattern", which is itself adapted from microfmt): an empty tag selects a sink_provider_traits<Tag> specialization declaring a context_type and static operations; a typed sink_provider<Tag> wrapper or caller-owned context object holds that state by value; and the type-erased sink_provider_ref borrows it for use in non-templated code. No virtual interfaces, no allocation, and no runtime registration are involved.
This is an additive customization point alongside the hand-written as_sink() methods already on span_sink, buffer_sink, and friends (see microfmt.hpp) – it exists for backends that want the same boilerplate reloco's allocator_ref gets (mandatory/optional operation detection, stateless-vs-stateful tag dispatch) instead of writing a context pointer + lambda pair by hand. Both shapes ultimately produce an ordinary microfmt::sink, so either can be passed to format_to/ vformat_to interchangeably.