core-adapters 0.1.1
Third-party adapters for snicholls-core: nanobind helpers, nlohmann/json hooks, the snicholls_core Python package
Loading...
Searching...
No Matches
snicholls::python::text_view Class Reference

A view of a str's UTF-8, or of a bytes-like buffer taken as UTF-8. More...

#include <snicholls/core_adapters/nanobind/bytes.hpp>

Public Member Functions

std::string_view view () const noexcept
 The text.
 
std::size_t size () const noexcept
 The length in bytes of UTF-8.
 
bool acquire (PyObject *src) noexcept
 Takes src's UTF-8 or buffer (the type caster's step).
 

Detailed Description

A view of a str's UTF-8, or of a bytes-like buffer taken as UTF-8.

Definition at line 203 of file bytes.hpp.

Member Function Documentation

◆ acquire()

bool snicholls::python::text_view::acquire ( PyObject *  src)
inlinenoexcept

Takes src's UTF-8 or buffer (the type caster's step).

Parameters
srcthe object.
Returns
success.

Definition at line 212 of file bytes.hpp.

◆ size()

std::size_t snicholls::python::text_view::size ( ) const
inlinenoexcept

The length in bytes of UTF-8.

Returns
the size.

Definition at line 209 of file bytes.hpp.

◆ view()

std::string_view snicholls::python::text_view::view ( ) const
inlinenoexcept

The text.

Returns
a string_view valid while this view lives.

Definition at line 207 of file bytes.hpp.


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