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

General type-erased view over any remote container or data structure. Manages its own formatting options directly. More...

#include <remote_container.hpp>

Public Types

using format_fn_t = bool(*)(void *ctx, address_space_ref space, span< std::byte > scratch, const sink &out, const container_options &opts) noexcept
 Type-erased function signature used to format a container.
 

Public Member Functions

constexpr remote_container_view () noexcept=default
 Constructs an empty, invalid view.
 
template<typename Context >
constexpr remote_container_view (uintptr_t container_addr, address_space_ref space, span< std::byte > scratch RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS, value_ref< Context > ctx RELOCO_LIFETIME_CAPTURE_BY_THIS, container_options options={}) noexcept
 Constructs a remote-container view with explicit options.
 
constexpr uintptr_t container_address () const noexcept
 Returns the remote container address.
 
constexpr address_space_ref space () const noexcept
 Returns the address space.
 
constexpr span< std::byte > scratch () const noexcept RELOCO_LIFETIMEBOUND
 Returns the reusable scratch storage.
 
constexpr const container_options & options () const &noexcept RELOCO_LIFETIMEBOUND
 Returns the rendering configuration.
 
const container_options & options () const &&=delete
 
constexpr bool is_null () const noexcept
 Reports whether the view lacks a container address or context.
 
bool format (const sink &out) const noexcept
 Formats the remote container through its bound context.
 
constexpr operator bool () const noexcept
 Reports whether the view can be formatted.
 

Detailed Description

General type-erased view over any remote container or data structure. Manages its own formatting options directly.

Member Typedef Documentation

◆ format_fn_t

using microfmt::remote_container_view::format_fn_t = bool (*)(void *ctx, address_space_ref space, span<std::byte> scratch, const sink &out, const container_options &opts) noexcept

Type-erased function signature used to format a container.

Constructor & Destructor Documentation

◆ remote_container_view() [1/2]

constexpr microfmt::remote_container_view::remote_container_view ( )
constexprdefaultnoexcept

Constructs an empty, invalid view.

◆ remote_container_view() [2/2]

template<typename Context >
constexpr microfmt::remote_container_view::remote_container_view ( uintptr_t  container_addr,
address_space_ref  space,
span< std::byte > scratch RELOCO_LIFETIMEBOUND  RELOCO_LIFETIME_CAPTURE_BY_THIS,
value_ref< Context > ctx  RELOCO_LIFETIME_CAPTURE_BY_THIS,
container_options  options = {} 
)
inlineconstexprnoexcept

Constructs a remote-container view with explicit options.

Template Parameters
ContextConcrete container_context type.
Parameters
container_addrAddress of the remote container.
spaceAddress space containing the container.
scratchReusable scratch storage for traversal.
ctxRequired context whose lifetime must exceed this view.
optionsFormatting configuration.

Member Function Documentation

◆ container_address()

constexpr uintptr_t microfmt::remote_container_view::container_address ( ) const
inlineconstexprnoexcept

Returns the remote container address.

Returns
Absolute container address.

◆ format()

bool microfmt::remote_container_view::format ( const sink &  out) const
inlinenoexcept

Formats the remote container through its bound context.

Parameters
outDestination sink.
Returns
true when the formatter succeeds; false for an invalid view or formatter failure.

◆ is_null()

constexpr bool microfmt::remote_container_view::is_null ( ) const
inlineconstexprnoexcept

Reports whether the view lacks a container address or context.

Returns
true when the view cannot be formatted.

◆ operator bool()

constexpr microfmt::remote_container_view::operator bool ( ) const
inlineexplicitconstexprnoexcept

Reports whether the view can be formatted.

Returns
true when the view is non-null.

◆ options() [1/2]

const container_options & microfmt::remote_container_view::options ( ) const &&
delete

◆ options() [2/2]

constexpr const container_options & microfmt::remote_container_view::options ( ) const &
inlineconstexprnoexcept

Returns the rendering configuration.

Returns
Const reference to the view options.

◆ scratch()

constexpr span< std::byte > microfmt::remote_container_view::scratch ( ) const
inlineconstexprnoexcept

Returns the reusable scratch storage.

Returns
Scratch byte span.

◆ space()

constexpr address_space_ref microfmt::remote_container_view::space ( ) const
inlineconstexprnoexcept

Returns the address space.

Returns
Address-space handle used for reads.

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