cxx icon indicating copy to clipboard operation
cxx copied to clipboard

CxxFunction + rust::Closure

Open smessmer opened this issue 4 years ago • 0 comments

It would be nice to have an effortless way to pass closures across ffi boundaries.

  • Similar to CxxVector in Rust, there could be a CxxFunction that wraps a std::function and allows calling it.
  • Similar to rust::Vec in C++, there could be a rust::Fn that wraps a Rust Box<dyn Fn> and allows calling it. Note that to be actually useful, this would have to be combined with generic support as proposed in https://github.com/dtolnay/cxx/issues/683

smessmer avatar Apr 24 '21 00:04 smessmer