dtolnay/cxx
Box clone() member function to call Clone on opaque Rust types
Aperta
#105 aperta il 11 apr 2020
help wanted
Metriche repository
- Star
- (4472 stelle)
- Metriche merge PR
- (Merge medio 8m) (3 PR mergiate in 30 g)
Descrizione
We should provide a way to constrain that some opaque Rust type implements Clone and then expose the Clone impl to C++ via a clone() member function on rust::Box.
Something like:
mod ffi {
extern "Rust" {
type ClonableR: Clone;
}
extern "C++" {
fn f(b: Box<ClonableR>); // C++ will be able to clone b
}
}
template <typename T>
class Box {
+ Box clone() const noexcept;
};