microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Public Member Functions | List of all members
microfmt::limit_sink Class Reference

#include <styled_sink.hpp>

Public Member Functions

constexpr limit_sink (sink target RELOCO_LIFETIME_CAPTURE_BY_THIS, size_t max_bytes) noexcept
 
 limit_sink (const limit_sink &)=delete
 
limit_sink & operator= (const limit_sink &)=delete
 
 limit_sink (limit_sink &&) noexcept=default
 
limit_sink & operator= (limit_sink &&) noexcept=default
 
sink as_sink () &noexcept RELOCO_LIFETIMEBOUND
 
void put (char c) noexcept
 
void write (microfmt::string_view sv) noexcept
 
constexpr size_t remaining () const noexcept
 
constexpr bool capped () const noexcept
 

Detailed Description

A sink adapter that discards output after a fixed number of bytes.

Constructor & Destructor Documentation

◆ limit_sink() [1/3]

constexpr microfmt::limit_sink::limit_sink ( sink target  RELOCO_LIFETIME_CAPTURE_BY_THIS,
size_t  max_bytes 
)
inlineexplicitconstexprnoexcept

Create an adapter that forwards at most max_bytes to target.

◆ limit_sink() [2/3]

microfmt::limit_sink::limit_sink ( const limit_sink &  )
delete

◆ limit_sink() [3/3]

microfmt::limit_sink::limit_sink ( limit_sink &&  )
defaultnoexcept

Member Function Documentation

◆ as_sink()

sink microfmt::limit_sink::as_sink ( ) &
inlinenoexcept

Return a type-erased sink suitable for format_to.

◆ capped()

constexpr bool microfmt::limit_sink::capped ( ) const
inlineconstexprnoexcept

Return true when the configured byte limit has been reached.

◆ operator=() [1/2]

limit_sink & microfmt::limit_sink::operator= ( const limit_sink &  )
delete

◆ operator=() [2/2]

limit_sink & microfmt::limit_sink::operator= ( limit_sink &&  )
defaultnoexcept

◆ put()

void microfmt::limit_sink::put ( char  c)
inlinenoexcept

◆ remaining()

constexpr size_t microfmt::limit_sink::remaining ( ) const
inlineconstexprnoexcept

Return the number of bytes that can still be forwarded.

◆ write()

void microfmt::limit_sink::write ( microfmt::string_view  sv)
inlinenoexcept

The documentation for this class was generated from the following file: