Rust バイナリ
簡単なアプリから始めましょう。AOSP チェックアウトのルートで、次のファイルを作成します。
hello_rust/Android.bp:
rust_binary {
name: "hello_rust",
crate_name: "hello_rust",
srcs: ["src/main.rs"],
}
hello_rust/src/main.rs:
//! Rust のデモ。
/// 挨拶を標準出力に出力します。
fn main() {
println!("Hello from Rust!");
}
これで、バイナリをビルド、push、実行できます。
m hello_rust
adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust" /data/local/tmp
adb shell /data/local/tmp/hello_rust
Hello from Rust!