|
quill
|
Provides codec functionality for serializing complex user-defined types into strings. More...
#include <DirectFormatCodec.h>

Provides codec functionality for serializing complex user-defined types into strings.
This codec is particularly useful for logging user-defined types, it converts an object into a string representation using the fmt::formatteron the hot path.
When using this codec, a fmt::formatter specialization must exist for the user-defined type.
It eliminates the need to explicitly write more verbose code, such as:
Instead, you can directly write:
fmtquill::formatter<T> must be a pure function of arg: its output must depend only on the argument and produce the same byte count every time it is invoked on the same value. This is required because the formatter runs twice on the frontend: once in compute_encoded_size() to determine the buffer size, and again in encode() to write the bytes. The same property allows the codec to be used with view types (e.g. fmtquill::join_view) — for views we additionally construct a temporary T{arg} each time, since fmt disallows formatting view types as lvalues.
1.8.13