First, Second
};
-void typeEnum(Enum) {}
+void typeEnumAndDefault(Enum) {}
struct Foo {
Enum property;
void typeNested(const std::pair<Foo, std::vector<Enum>>&) {}
+void typeNestedEnumAndDefault(std::pair<int, Enum>) {}
+
}
PYBIND11_MODULE(pybind_type_links, m) {
.def_readwrite("property", &Foo::property, "A property");
m
- .def("type_enum", &typeEnum, "A function taking an enum", py::arg("value") = Enum::Second)
+ .def("type_enum_and_default", &typeEnumAndDefault, "A function taking an enum with a default", py::arg("value") = Enum::Second)
.def("type_return", &typeReturn, "A function returning a type")
- .def("type_nested", &typeNested, "A function with nested type annotation");
+ .def("type_nested", &typeNested, "A function with nested type annotation")
+ .def("type_nested_enum_and_default", &typeNestedEnumAndDefault, "A function taking a nested enum with a default. This won't have a link.", py::arg("value") = std::pair<int, Enum>{3, Enum::First});
/* Test also attributes (annotated from within Python) */
m.attr("TYPE_DATA") = Foo{Enum::First};
<section id="functions">
<h2><a href="#functions">Functions</a></h2>
<dl class="m-doc">
- <dt id="type_enum">
- <span class="m-doc-wrap-bumper">def <a href="#type_enum" class="m-doc-self">type_enum</a>(</span><span class="m-doc-wrap">value: <a href="pybind_type_links.html#Enum" class="m-doc">Enum</a> = <a href="pybind_type_links.html#Enum-SECOND" class="m-doc">Enum.SECOND</a>) -> <a href="https://docs.python.org/3/library/constants.html#None" class="m-doc-external">None</a></span>
+ <dt id="type_enum_and_default">
+ <span class="m-doc-wrap-bumper">def <a href="#type_enum_and_default" class="m-doc-self">type_enum_and_default</a>(</span><span class="m-doc-wrap">value: <a href="pybind_type_links.html#Enum" class="m-doc">Enum</a> = <a href="pybind_type_links.html#Enum-SECOND" class="m-doc">Enum.SECOND</a>) -> <a href="https://docs.python.org/3/library/constants.html#None" class="m-doc-external">None</a></span>
</dt>
- <dd>A function taking an enum</dd>
+ <dd>A function taking an enum with a default</dd>
<dt id="type_nested">
<span class="m-doc-wrap-bumper">def <a href="#type_nested" class="m-doc-self">type_nested</a>(</span><span class="m-doc-wrap">arg0: <a href="https://docs.python.org/3/library/typing.html#typing.Tuple" class="m-doc-external">typing.Tuple</a>[<a href="pybind_type_links.Foo.html" class="m-doc">Foo</a>, <a href="https://docs.python.org/3/library/typing.html#typing.List" class="m-doc-external">typing.List</a>[<a href="pybind_type_links.html#Enum" class="m-doc">Enum</a>]]<span class="m-text m-dim">, /</span>) -> <a href="https://docs.python.org/3/library/constants.html#None" class="m-doc-external">None</a></span>
</dt>
<dd>A function with nested type annotation</dd>
+ <dt id="type_nested_enum_and_default">
+ <span class="m-doc-wrap-bumper">def <a href="#type_nested_enum_and_default" class="m-doc-self">type_nested_enum_and_default</a>(</span><span class="m-doc-wrap">value: <a href="https://docs.python.org/3/library/typing.html#typing.Tuple" class="m-doc-external">typing.Tuple</a>[<a href="https://docs.python.org/3/library/functions.html#int" class="m-doc-external">int</a>, <a href="pybind_type_links.html#Enum" class="m-doc">Enum</a>] = (3, Enum.FIRST)) -> <a href="https://docs.python.org/3/library/constants.html#None" class="m-doc-external">None</a></span>
+ </dt>
+ <dd>A function taking a nested enum with a default. This won't have a link.</dd>
<dt id="type_return">
<span class="m-doc-wrap-bumper">def <a href="#type_return" class="m-doc-self">type_return</a>(</span><span class="m-doc-wrap">) -> <a href="pybind_type_links.Foo.html" class="m-doc">Foo</a></span>
</dt>