|
welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
|
welder nanobind rod (header-only). More...
#include <array>#include <cstddef>#include <cstdint>#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 <nanobind/ndarray.h>#include <nanobind/stl/bind_vector.h>#include <nanobind/stl/optional.h>#include <nanobind/stl/bind_map.h>#include <welder/containers.hpp>#include <welder/rods/python/array_interface.hpp>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 |
Macros | |
| #define | WELDER_OPAQUE(...) |
| Declare a container type opaque so nanobind binds it by reference (via weld-an-alias + bind_vector/bind_map) instead of copy-converting it through <nanobind/stl/…>. | |
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):
(For the WELDER_MODULE entry-point macro, include this directory's module.hpp instead.)
Definition in file rod.hpp.
| #define WELDER_OPAQUE | ( | ... | ) |
Declare a container type opaque so nanobind binds it by reference (via weld-an-alias + bind_vector/bind_map) instead of copy-converting it through <nanobind/stl/…>.
A thin, backend-neutral spelling of NB_MAKE_OPAQUE; place it at namespace scope, before the module. (nanobind also hard-errors at compile time if a container is bind_vector-bound while its stl caster is included without this — the error names NB_MAKE_OPAQUE as the fix.) In a translation unit with more than one Python rod, use the framework-native macros directly (this resolves to whichever rod header was included first).