Commit 1c36d9fa authored by Tom Niget's avatar Tom Niget

Add pybind11 caster for Task<T>

parent b49c90b2
...@@ -378,4 +378,20 @@ auto mapFilter(Map map, Seq seq, Filt filt = Filt()) { ...@@ -378,4 +378,20 @@ auto mapFilter(Map map, Seq seq, Filt filt = Filt()) {
return typon::PyList(std::move(result)); return typon::PyList(std::move(result));
} }
namespace PYBIND11_NAMESPACE {
namespace detail {
template <typename T> struct type_caster<typon::Task<T>> {
using type = typon::Task<T>;
using res_conv = make_caster<T>;
public:
PYBIND11_TYPE_CASTER(type, const_name("Task[") + res_conv::name + const_name("]"));
template <typename U>
static handle cast(U&& src, return_value_policy policy, handle parent) {
return res_conv::cast(std::forward<T>(std::move(src).call()), policy, parent);
}
};
}
}
#endif // TYPON_BUILTINS_HPP #endif // TYPON_BUILTINS_HPP
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment