Skip to main content

interface

Attribute Macro interface 

Source
#[interface]
Expand description

A binder interface from a plain Rust trait — the .aidl-free interface.

Emits what rsbinder-aidl emits for the equivalent .aidl interface: the trait, BnFoo, BpFoo and IFooDefault (and the async halves with the async feature). Transaction codes follow declaration order, so reordering methods is a wire break. The descriptor defaults to the trait name; pass #[interface(descriptor = "…")] for anything shared across crates.

ⓘ
#[rsbinder::interface(descriptor = "my.pkg.IHello")]
pub trait IHello {
    fn echo(&self, msg: &str) -> rsbinder::BinderResult<String>;
}

Each signature must be the spelling .aidl renders for its type and direction, and anything else is refused with that spelling named. The full contract — directions, #[oneway], #[inout], the type table and what the macro cannot express — is the crate documentation.