Support calling C++ methods from Rust
These methods can be declared in the bridge by naming the first
argument self and making it a reference to the containing class, e.g.,
fn get(self: &C) -> usize;
fn set(self: &mut C, n: usize);
This syntax requires Rust 1.43.
Note that the implementation also changes the internal naming of shim
functions so that they also contain the name of the owning class, if
any. This allows defining multiple methods with the same name on
different objects.
diff --git a/tests/ffi/lib.rs b/tests/ffi/lib.rs
index 8afa841..a720a80 100644
--- a/tests/ffi/lib.rs
+++ b/tests/ffi/lib.rs
@@ -49,6 +49,9 @@
fn c_try_return_sliceu8(s: &[u8]) -> Result<&[u8]>;
fn c_try_return_rust_string() -> Result<String>;
fn c_try_return_unique_ptr_string() -> Result<UniquePtr<CxxString>>;
+
+ fn get(self: &C) -> usize;
+ fn set(self: &mut C, n: usize) -> usize;
}
extern "Rust" {