welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
rod.hpp File Reference

welder nanobind rod (header-only). More...

#include <array>
#include <cstddef>
#include <meta>
#include <string>
#include <type_traits>
#include <utility>
#include <welder/welder.hpp>
#include <welder/rods/python/doc_style.hpp>
#include <welder/rods/python/operators.hpp>
#include <welder/rods/python/trampoline.hpp>
#include <welder/bind_traits.hpp>
#include <welder/doc.hpp>
#include <nanobind/nanobind.h>
Include dependency graph for rod.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  welder::rods::nanobind::rod< DocStyle >
 The nanobind rod: a stateless policy type satisfying welder::rod. More...

Namespaces

namespace  welder
namespace  welder::rods
namespace  welder::rods::nanobind

Detailed Description

welder nanobind rod (header-only).

This is a thin rod: it implements welder's rod contract (<welder/welder.hpp>) for nanobind and hands the traversal/resolution off to welder's generic driver. All the language-agnostic work — deciding which members bind, gating bindability, folding docstrings, walking bases and namespaces — lives in the core; only the nanobind emission primitives are here. It is a near-mirror of the pybind11 backend (same class-handle model), differing only where nanobind's API does: def_rw/def_ro instead of def_readwrite/def_readonly, a placement-__init__ factory, module docstrings set through __doc__, and the is_base_caster bindability probe.

Requires the welder vocabulary first (#include <welder/vocabulary.hpp>). This header exposes exactly one thing: the rod template welder::rods::nanobind::rod<DocStyle = google_style>, to plug into welder::welder (rod<> for the default Google docstring style; rod<numpy_style> / rod<sphinx_style> for the other dialects):

#include <nanobind/nanobind.h>
NB_MODULE(mymod, m) {
}
welder nanobind rod (header-only).
welder's binding entry point, parameterized on a rod.
Definition welder.hpp:85

(For the WELDER_MODULE entry-point macro, include this directory's module.hpp instead.)

Note
nanobind supports only single inheritance at the binding level (one C++ base per nb::class_). welder's driver may hand this backend more than one welded base (e.g. a multiple-inheritance diamond); those cases bind under pybind11 but not nanobind, and trip nanobind's own single-base static assertion.

Definition in file rod.hpp.