mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-29 00:51:04 +02:00
760 B
760 B
Rust Libraries
You use rust_library
to create a new Rust library for Android.
Here we declare a dependency on two libraries:
libgreeting
, which we define below,libtextwrap
, which is a crate already vendored inexternal/rust/crates/
.
hello_rust/Android.bp:
{{#include library/Android.bp}}
hello_rust/src/main.rs:
{{#include library/src/main.rs:main}}
hello_rust/src/lib.rs:
{{#include library/src/lib.rs:greeting}}
You build, push, and run the binary like before:
{{#include ../build_all.sh:hello_rust_with_dep}}
Hello Bob, it is very
nice to meet you!