Ruby 4.1.0dev (2026-10-21 revision 536dc6f98b72e6999a84bb6373562c43cb1ddf8a)
stringy.hpp
Go to the documentation of this file.
1
6#ifndef PRISM_STRINGY_HPP
7#define PRISM_STRINGY_HPP
8
11
12#include "prism/stringy.h"
13
14#include <string_view>
15
16namespace prism {
17
24[[nodiscard]] inline std::string_view
25view(const pm_string_t &string PRISM_LIFETIMEBOUND) noexcept {
26 return std::string_view(reinterpret_cast<const char *>(pm_string_source(&string)), pm_string_length(&string));
27}
28
29}
30
31#endif
std::string_view view(const pm_buffer_t *buffer PRISM_LIFETIMEBOUND) noexcept
The bytes written to the given buffer so far.
Definition buffer.hpp:49
#define PRISM_LIFETIMEBOUND
Mark a parameter that the return value points into, so that the compiler warns if a temporary is pass...
A view of a sequence of bytes owned by someone else.
A view of a sequence of bytes.
Definition stringy.h:23