Output sink that guarantees a null-terminated string within an externally provided, fixed-size memory buffer.
More...
#include <c_string_span_sink.hpp>
|
| constexpr | c_string_span_sink (span< char > buf RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept |
| | Constructs a null-terminated string sink over a microfmt::span.
|
| |
| sink | as_sink () noexcept RELOCO_LIFETIMEBOUND |
| | Creates a type-erased sink adapter pointing to this instance.
|
| |
| constexpr const char * | c_str () const noexcept RELOCO_LIFETIMEBOUND |
| | Returns a null-terminated C string pointer.
|
| |
| constexpr microfmt::string_view | view () const noexcept RELOCO_LIFETIMEBOUND |
| | Returns a string view over the characters written (excluding null terminator).
|
| |
| constexpr std::size_t | size () const noexcept |
| | Returns the length of the string in bytes (excluding null terminator).
|
| |
| constexpr std::size_t | max_size () const noexcept |
| | Returns the maximum characters the sink can store (excluding null terminator).
|
| |
| RELOCO_REINITIALIZES constexpr void | reset () noexcept |
| | Resets the sink to an empty, null-terminated state.
|
| |
Output sink that guarantees a null-terminated string within an externally provided, fixed-size memory buffer.
Reserves 1 byte for the trailing \0. Output is clamped to the buffer's capacity minus 1, and is guaranteed to be null-terminated after every write.
◆ c_string_span_sink()
| constexpr microfmt::c_string_span_sink::c_string_span_sink |
( |
span< char > buf RELOCO_LIFETIMEBOUND |
RELOCO_LIFETIME_CAPTURE_BY_THIS | ) |
|
|
inlineexplicitconstexprnoexcept |
Constructs a null-terminated string sink over a microfmt::span.
- Parameters
-
| buf | The target character buffer view. If empty, the sink discards all writes safely. |
◆ as_sink()
| sink microfmt::c_string_span_sink::as_sink |
( |
| ) |
|
|
inlinenoexcept |
Creates a type-erased sink adapter pointing to this instance.
- Returns
- A lightweight sink struct configured to append and null-terminate.
◆ c_str()
| constexpr const char * microfmt::c_string_span_sink::c_str |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Returns a null-terminated C string pointer.
- Returns
- Pointer to the underlying null-terminated buffer, or a safe empty static string if the initial span was empty.
◆ max_size()
| constexpr std::size_t microfmt::c_string_span_sink::max_size |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Returns the maximum characters the sink can store (excluding null terminator).
- Returns
- Maximum payload capacity (
buf.size() - 1).
◆ reset()
| RELOCO_REINITIALIZES constexpr void microfmt::c_string_span_sink::reset |
( |
| ) |
|
|
inlineconstexprnoexcept |
Resets the sink to an empty, null-terminated state.
◆ size()
| constexpr std::size_t microfmt::c_string_span_sink::size |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Returns the length of the string in bytes (excluding null terminator).
- Returns
- String length in bytes.
◆ view()
| constexpr microfmt::string_view microfmt::c_string_span_sink::view |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Returns a string view over the characters written (excluding null terminator).
- Returns
- Non-owning view of formatted text.
The documentation for this class was generated from the following file: