MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / declare_async_wrapper

Function declare_async_wrapper

python/cpp/utils.h:123–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122 template <typename T>
123 static void declare_async_wrapper(py::module& m, const char* name) {
124 py::class_<AsyncResult<T>>(m, name, "Asynchronous wrapper around a result object.")
125 .def("result", &AsyncResult<T>::result,
126 R"pbdoc(
127 Blocks until the result is available and returns it.
128
129 If an exception was raised when computing the result,
130 this method raises the exception.
131 )pbdoc")
132 .def("done", &AsyncResult<T>::done, "Returns ``True`` if the result is available.")
133 ;
134 }
135
136 }
137}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected