mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-22 10:21:03 +02:00
parent
11087c8411
commit
3aa29c4c8e
60
po/zh-CN.po
60
po/zh-CN.po
@ -12911,15 +12911,15 @@ msgstr ""
|
||||
|
||||
#: src/android/aidl/client.md:1
|
||||
msgid "AIDL Client"
|
||||
msgstr ""
|
||||
msgstr "AIDL 客户端"
|
||||
|
||||
#: src/android/aidl/client.md:3
|
||||
msgid "Finally, we can create a Rust client for our new service."
|
||||
msgstr ""
|
||||
msgstr "最后,我们可以为我们的新服务创建一个 Rust 客户端。"
|
||||
|
||||
#: src/android/aidl/client.md:5
|
||||
msgid "_birthday_service/src/client.rs_:"
|
||||
msgstr ""
|
||||
msgstr "_birthday_service/src/client.rs_:"
|
||||
|
||||
#: src/android/aidl/client.md:7
|
||||
msgid ""
|
||||
@ -12956,6 +12956,38 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,ignore\n"
|
||||
"//! 生日服务。\n"
|
||||
"use com_example_birthdayservice::aidl::com::example::birthdayservice::"
|
||||
"IBirthdayService::IBirthdayService;\n"
|
||||
"use com_example_birthdayservice::binder;\n"
|
||||
"\n"
|
||||
"const SERVICE_IDENTIFIER: &str = \"birthdayservice\";\n"
|
||||
"\n"
|
||||
"/// 连接到 BirthdayService。\n"
|
||||
"pub fn connect() -> Result<binder::Strong<dyn IBirthdayService>, binder::"
|
||||
"StatusCode> {\n"
|
||||
" binder::get_interface(SERVICE_IDENTIFIER)\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"/// 调用生日服务。\n"
|
||||
"fn main() -> Result<(), binder::Status> {\n"
|
||||
" let name = std::env::args()\n"
|
||||
" .nth(1)\n"
|
||||
" .unwrap_or_else(|| String::from(\"Bob\"));\n"
|
||||
" let years = std::env::args()\n"
|
||||
" .nth(2)\n"
|
||||
" .and_then(|arg| arg.parse::<i32>().ok())\n"
|
||||
" .unwrap_or(42);\n"
|
||||
"\n"
|
||||
" binder::ProcessState::start_thread_pool();\n"
|
||||
" let service = connect().expect(\"Failed to connect to BirthdayService"
|
||||
"\");\n"
|
||||
" let msg = service.wishHappyBirthday(&name, years)?;\n"
|
||||
" println!(\"{msg}\");\n"
|
||||
" Ok(())\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/android/aidl/client.md:39
|
||||
msgid ""
|
||||
@ -12972,14 +13004,26 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```javascript\n"
|
||||
"rust_binary {\n"
|
||||
" name: \"birthday_client\",\n"
|
||||
" crate_name: \"birthday_client\",\n"
|
||||
" srcs: [\"src/client.rs\"],\n"
|
||||
" rustlibs: [\n"
|
||||
" \"com.example.birthdayservice-rust\",\n"
|
||||
" \"libbinder_rs\",\n"
|
||||
" ],\n"
|
||||
" prefer_rlib: true,\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/android/aidl/client.md:52
|
||||
msgid "Notice that the client does not depend on `libbirthdayservice`."
|
||||
msgstr ""
|
||||
msgstr "请注意,客户端不依赖于 `libbirthdayservice`。"
|
||||
|
||||
#: src/android/aidl/client.md:54
|
||||
msgid "Build, push, and run the client on your device:"
|
||||
msgstr ""
|
||||
msgstr "在您的设备上构建、推送并运行客户端:"
|
||||
|
||||
#: src/android/aidl/client.md:56
|
||||
msgid ""
|
||||
@ -12990,6 +13034,12 @@ msgid ""
|
||||
"Happy Birthday Charlie, congratulations with the 60 years!\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```shell\n"
|
||||
"$ m birthday_client\n"
|
||||
"$ adb push $ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/tmp\n"
|
||||
"$ adb shell /data/local/tmp/birthday_client Charlie 60\n"
|
||||
"Happy Birthday Charlie, congratulations with the 60 years!\n"
|
||||
"```"
|
||||
|
||||
#: src/android/aidl/changing.md:3
|
||||
msgid ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user