Folly Futures to Python Asyncio Futures Bridge
[folly.git] / folly / python / futures.pxd
diff --git a/folly/python/futures.pxd b/folly/python/futures.pxd
new file mode 100644 (file)
index 0000000..ed38a00
--- /dev/null
@@ -0,0 +1,16 @@
+from cpython.ref cimport PyObject
+from folly cimport cFollyTry, cFollyFuture, cFollyExecutor
+
+cdef extern from "folly/python/futures.h" namespace "folly::python":
+    void bridgeFuture[T](
+        cFollyFuture[T]&& fut,
+        void(*)(cFollyTry[T]&&, PyObject*),
+        PyObject* pyFuture
+    )
+    # No clue but cython overloading is getting confused so we alias
+    void bridgeFutureWith "folly::python::bridgeFuture"[T](
+        cFollyExecutor* executor,
+        cFollyFuture[T]&& fut,
+        void(*)(cFollyTry[T]&&, PyObject*),
+        PyObject* pyFuture
+    )