From d3923f21cdbc7c0ed33bfb8fe7f08e480da76a4a Mon Sep 17 00:00:00 2001 From: Adel Bouachraoui <83282440+Popy21@users.noreply.github.com> Date: Sat, 17 Oct 2026 08:56:26 +0200 Subject: [PATCH] Split overlong bindgen slide into two smaller slides --- src/SUMMARY.md | 1 + .../interoperability/with-c/bindgen.md | 21 ------------- .../interoperability/with-c/using-bindings.md | 31 +++++++++++++++++++ 3 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 src/android/interoperability/with-c/using-bindings.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 470b43eee78f..168c3af70803 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -275,6 +275,7 @@ SPDX-License-Identifier: CC-BY-4.0 - [With C](android/interoperability/with-c.md) - [A Simple C Library](android/interoperability/with-c/c-library.md) - [Bindgen](android/interoperability/with-c/bindgen.md) + - [Using the Bindings](android/interoperability/with-c/using-bindings.md) - [Running Our Binary](android/interoperability/with-c/run-our-binary.md) - [A Simple Rust Library](android/interoperability/with-c/rust-library.md) - [Calling Rust from C](android/interoperability/with-c/rust.md) diff --git a/src/android/interoperability/with-c/bindgen.md b/src/android/interoperability/with-c/bindgen.md index b00122a91dda..983c5aa71d39 100644 --- a/src/android/interoperability/with-c/bindgen.md +++ b/src/android/interoperability/with-c/bindgen.md @@ -23,30 +23,9 @@ _interoperability/bindgen/Android.bp_: {{#include bindgen/Android.bp:libbirthday_bindgen}} ``` -Finally, we can use the bindings in our Rust program: - -_interoperability/bindgen/Android.bp_: - -```javascript -{{#include bindgen/Android.bp:print_birthday_card}} -``` - -_interoperability/bindgen/main.rs_: - -```rust,compile_fail -# // Copyright 2022 Google LLC -# // SPDX-License-Identifier: Apache-2.0 -# -{{#include bindgen/main.rs:main}} -``` -
- The Android build rules will automatically call `bindgen` for you behind the scenes. -- Notice that the Rust code in `main` is still hard to write. It is good - practice to encapsulate the output of `bindgen` in a Rust library which - exposes a safe interface to caller. -
diff --git a/src/android/interoperability/with-c/using-bindings.md b/src/android/interoperability/with-c/using-bindings.md new file mode 100644 index 000000000000..a61025bedce1 --- /dev/null +++ b/src/android/interoperability/with-c/using-bindings.md @@ -0,0 +1,31 @@ + + +# Using the Bindings + +Finally, we can use the bindings in our Rust program: + +_interoperability/bindgen/Android.bp_: + +```javascript +{{#include bindgen/Android.bp:print_birthday_card}} +``` + +_interoperability/bindgen/main.rs_: + +```rust,compile_fail +# // Copyright 2022 Google LLC +# // SPDX-License-Identifier: Apache-2.0 +# +{{#include bindgen/main.rs:main}} +``` + +
+ +- Notice that the Rust code in `main` is still hard to write. It is good + practice to encapsulate the output of `bindgen` in a Rust library which + exposes a safe interface to caller. + +