Rust Binaries

اجازه دهید با یک برنامه ساده شروع کنیم. در ریشه یک AOSP، فایل های زیر را ایجاد کنید:

hello_rust/Android.bp:

rust_binary { name: "hello_rust", crate_name: "hello_rust", srcs: ["src/main.rs"], }

hello_rust/src/main.rs:

//! Rust demo. /// Prints a greeting to standard output. fn main() { println!("سلام از 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!