4.1.7 更改 API
07-更改 API — Comprehensive Rust
1分钟内可阅读完
译文 · 基于 Comprehensive Rust
原文链接: https://google.github.io/comprehensive-rust/android/aidl/example-service/changing-definition.html
4.1.7 更改 API
扩展一下 API:让客户端能为生日贺卡指定一系列行:
| |
这会得到更新后的 IBirthdayService trait 定义:
| |
- 注意 AIDL 定义中的
String[]在 Rust 中被翻译为&[String],即生成的绑定在可能的情况下会使用符合习惯的 Rust 类型:
in数组参数翻译为切片。out与inout参数翻译为&mut Vec<T>。- 返回值翻译为返回
Vec<T>。