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 and inout args are translated to &mut Vec<T>.
    • Return values are translated to returning a Vec<T>.