API ์์
API๋ฅผ ํ์ฅํ์ฌ ๋ ๋ง์ ๊ธฐ๋ฅ์ ์ ๊ณตํด ๋ด ์๋ค. ํด๋ผ์ด์ธํธ๊ฐ ์์ผ ์นด๋์ ๋ด๊ธธ ๋ด์ฉ์ ์ง์ ํ ์ ์๋๋ก ํ๊ฒ ์ต๋๋ค:
package com.example.birthdayservice;
/** ์์ผ ์๋น์ค ์ธํฐํ์ด์ค์
๋๋ค. */
interface IBirthdayService {
/** ์์ผ ์ถํ ๋ฉ์์ง๋ฅผ ์์ฑํฉ๋๋ค. */
String wishHappyBirthday(String name, int years, in String[] text);
}
This results in an updated trait definition for IBirthdayService
:
trait IBirthdayService {
fn wishHappyBirthday(
&self,
name: &str,
years: i32,
text: &[String],
) -> binder::Result<String>;
}
- Note how the
String[]
in the AIDL definition is translated as a&[String]
in Rust, i.e. that idiomatic Rust types are used in the generated bindings wherever possible:in
array arguments are translated to slices.out
andinout
args are translated to&mut Vec<T>
.- Return values are translated to returning a
Vec<T>
.