Ruby 4.1.0dev (2026-10-21 revision 536dc6f98b72e6999a84bb6373562c43cb1ddf8a)
Data Structures | Typedefs | Functions
buffer.hpp File Reference

(536dc6f98b72e6999a84bb6373562c43cb1ddf8a)

Ownership of buffers from C++, and access to their contents. More...

#include "prism/compiler/cplusplus.hpp"
#include "prism/compiler/lifetimebound.hpp"
#include "prism/buffer.h"
#include <memory>
#include <string_view>
Include dependency graph for buffer.hpp:

Go to the source code of this file.

Data Structures

struct  prism::buffer_deleter
 Frees a buffer with pm_buffer_free. More...
 

Typedefs

using prism::unique_buffer = std::unique_ptr< pm_buffer_t, buffer_deleter >
 An owned buffer.
 

Functions

unique_buffer prism::make_buffer () noexcept
 Allocate a new empty buffer.
 
std::string_view prism::view (const pm_buffer_t *buffer PRISM_LIFETIMEBOUND) noexcept
 The bytes written to the given buffer so far.
 

Detailed Description

Ownership of buffers from C++, and access to their contents.

Definition in file buffer.hpp.

Typedef Documentation

◆ unique_buffer

using prism::unique_buffer = typedef std::unique_ptr<pm_buffer_t, buffer_deleter>

An owned buffer.

Definition at line 30 of file buffer.hpp.

Function Documentation

◆ make_buffer()

unique_buffer prism::make_buffer ( )
inlinenoexcept

Allocate a new empty buffer.

Allocation failure aborts, so this never throws.

Returns
A unique_buffer managing the newly allocated buffer.

Definition at line 38 of file buffer.hpp.

Referenced by prism::make_buffer().

◆ view()

std::string_view prism::view ( const pm_buffer_t *buffer  PRISM_LIFETIMEBOUND)
inlinenoexcept

The bytes written to the given buffer so far.

Parameters
bufferThe buffer to view.
Returns
A string_view of the contents of the buffer.

Definition at line 49 of file buffer.hpp.

Referenced by prism::view(), and prism::view().