in hfendpoints-http/src/lib.rs [101:118]
fn materialize_coroutine(
&self,
request: $pyrequest,
context: Context,
locals: &TaskLocals,
) -> EndpointResult<impl Future<Output = PyResult<PyObject>> + Send + 'static> {
Python::with_gil(|py| {
// Only pass the request part to Python
let py_coro_call = self.inner.call1(py, (request, context))?.into_bound(py);
debug!("[NATIVE] asyncio Handler's coroutine (__call__) created");
pyo3_async_runtimes::into_future_with_locals(&locals, py_coro_call)
})
.map_err(|err| {
error!("Failed to retrieve __call__ coroutine: {err}");
Error::from(Implementation(err.to_string().into()))
})
}