diff --git a/src/android/interoperability/cpp.md b/src/android/interoperability/cpp.md index 673b4f24..3a523db1 100644 --- a/src/android/interoperability/cpp.md +++ b/src/android/interoperability/cpp.md @@ -9,5 +9,26 @@ The overall approach looks like this: See the [CXX tutorial][2] for an full example of using this. +
+ +- At this point, the instructor should switch to the [CXX tutorial][2]. + +- Walk the students through the tutorial step by step. + +- Highlight how CXX presents a clean interface without unsafe code in _both languages_. + +- Show the correspondence between [Rust and C++ types](https://cxx.rs/bindings.html): + + - Explain how a Rust `String` cannot map to a C++ `std::string` + (the latter does not uphold the UTF-8 invariant). Show that + despite being different types, `rust::String` in C++ can be + easily constructed from a C++ `std::string`, making it very + ergonomic to use. + + - Explain that a Rust function returning `Result` becomes a + function which throws a `E` exception in C++ (and vice versa). + +
+ [1]: https://cxx.rs/ [2]: https://cxx.rs/tutorial.html