pub trait Remotable:
Send
+ Sync
+ 'static {
// Required methods
fn get_descriptor() -> &'static str;
fn on_transact(
&self,
code: TransactionCode,
data: &BorrowedParcel<'_>,
reply: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>;
fn on_dump(
&self,
file: &mut dyn Write,
args: &[&CStr],
) -> Result<(), StatusCode>;
fn get_class() -> InterfaceClass;
}
Expand description
A local service that can be remotable via Binder.
An object that implement this interface made be made into a Binder service
via Binder::new(object)
.
This is a low-level interface that should normally be automatically
generated from AIDL via the crate::declare_binder_interface!
macro.
When using the AIDL backend, users need only implement the high-level AIDL-defined
interface. The AIDL compiler then generates a container struct that wraps
the user-defined service and implements Remotable
.
Required Methods§
Sourcefn get_descriptor() -> &'static str
fn get_descriptor() -> &'static str
The Binder interface descriptor string.
This string is a unique identifier for a Binder interface, and should be the same between all implementations of that interface.
Sourcefn on_transact(
&self,
code: TransactionCode,
data: &BorrowedParcel<'_>,
reply: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn on_transact( &self, code: TransactionCode, data: &BorrowedParcel<'_>, reply: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Handle and reply to a request to invoke a transaction on this object.
reply
may be None
if the sender does not expect a reply.
Sourcefn on_dump(
&self,
file: &mut dyn Write,
args: &[&CStr],
) -> Result<(), StatusCode>
fn on_dump( &self, file: &mut dyn Write, args: &[&CStr], ) -> Result<(), StatusCode>
Handle a request to invoke the dump transaction on this object.
Sourcefn get_class() -> InterfaceClass
fn get_class() -> InterfaceClass
Retrieve the class of this remote object.
This method should always return the same InterfaceClass for the same type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Remotable for ()
impl Remotable for ()
Tests often create a base BBinder instance; so allowing the unit type to be remotable translates nicely to Binder::new(()).