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" {
diff --git a/tests/ffi/tests.cc b/tests/ffi/tests.cc
index d72bfd0..2daae53 100644
--- a/tests/ffi/tests.cc
+++ b/tests/ffi/tests.cc
@@ -15,6 +15,11 @@
 
 size_t C::get() const { return this->n; }
 
+size_t C::set(size_t n) {
+  this->n = n;
+  return this->n;
+}
+
 size_t c_return_primitive() { return 2020; }
 
 Shared c_return_shared() { return Shared{2020}; }
diff --git a/tests/ffi/tests.h b/tests/ffi/tests.h
index a68be5c..43ac229 100644
--- a/tests/ffi/tests.h
+++ b/tests/ffi/tests.h
@@ -12,6 +12,7 @@
 public:
   C(size_t n);
   size_t get() const;
+  size_t set(size_t n);
 
 private:
   size_t n;
diff --git a/tests/test.rs b/tests/test.rs
index 511c52b..36de8f9 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -107,6 +107,18 @@
     check!(cxx_run_test());
 }
 
+#[test]
+fn test_c_method_calls() {
+    let mut unique_ptr = ffi::c_return_unique_ptr();
+
+    let old_value = unique_ptr.as_ref().unwrap().get();
+    assert_eq!(2020, old_value);
+    assert_eq!(2021, unique_ptr.as_mut().unwrap().set(2021));
+    assert_eq!(2021, unique_ptr.as_ref().unwrap().get());
+    assert_eq!(old_value, unique_ptr.as_mut().unwrap().set(old_value));
+    assert_eq!(old_value, unique_ptr.as_ref().unwrap().get())
+}
+
 #[no_mangle]
 extern "C" fn cxx_test_suite_get_box() -> *mut cxx_test_suite::R {
     Box::into_raw(Box::new(2020usize))