23 explicit constexpr c_string_span_sink(span<char> buf RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
30#if RELOCO_HAS_STD_SPAN
37 template <std::
size_t Extent>
38 explicit constexpr c_string_span_sink(
39 std::span<char, Extent> buf RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
40 : detail::c_string_sink_base{buf.empty() ? nullptr : buf.data(), buf.empty() ? 0 : buf.size() - 1, 0} {
54 return sink{
this, &detail::c_string_sink_base::write_thunk};
63 [[nodiscard]]
constexpr const char *
c_str() const noexcept RELOCO_LIFETIMEBOUND {
return m_data ? m_data :
""; }
71 [[nodiscard]]
constexpr microfmt::string_view
view() const noexcept RELOCO_LIFETIMEBOUND {
72 return microfmt::string_view(m_data, m_pos);
81 [[nodiscard]]
constexpr std::size_t
size() const noexcept {
return m_pos; }
89 [[nodiscard]]
constexpr std::size_t
max_size() const noexcept {
return m_max_payload; }
94 RELOCO_REINITIALIZES
constexpr void reset() noexcept {
Output sink that guarantees a null-terminated string within an externally provided,...
Definition c_string_span_sink.hpp:15
constexpr std::size_t max_size() const noexcept
Returns the maximum characters the sink can store (excluding null terminator).
Definition c_string_span_sink.hpp:89
sink as_sink() noexcept RELOCO_LIFETIMEBOUND
Creates a type-erased sink adapter pointing to this instance.
Definition c_string_span_sink.hpp:53
constexpr std::size_t size() const noexcept
Returns the length of the string in bytes (excluding null terminator).
Definition c_string_span_sink.hpp:81
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.
Definition c_string_span_sink.hpp:23
constexpr microfmt::string_view view() const noexcept RELOCO_LIFETIMEBOUND
Returns a string view over the characters written (excluding null terminator).
Definition c_string_span_sink.hpp:71
constexpr const char * c_str() const noexcept RELOCO_LIFETIMEBOUND
Returns a null-terminated C string pointer.
Definition c_string_span_sink.hpp:63
RELOCO_REINITIALIZES constexpr void reset() noexcept
Resets the sink to an empty, null-terminated state.
Definition c_string_span_sink.hpp:94
#define MICROFMT_API_CLASS
Definition compat.hpp:181
Core formatting primitives, sinks, and customization point.
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46
Definition microfmt.hpp:445