pub trait Parcelable {
// Required methods
fn write_to_parcel(
&self,
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>;
fn read_from_parcel(
&mut self,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>;
}
Expand description
Super-trait for structured Binder parcelables, i.e. those generated from AIDL.
This trait is equivalent android::Parcelable
in C++,
and defines a common interface that all parcelables need
to implement.
Required Methods§
Sourcefn write_to_parcel(
&self,
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn write_to_parcel( &self, parcel: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Internal serialization function for parcelables.
This method is mainly for internal use.
Serialize::serialize
and its variants are generally
preferred over this function, since the former also
prepend a header.
Sourcefn read_from_parcel(
&mut self,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn read_from_parcel( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Internal deserialization function for parcelables.
This method is mainly for internal use.
Deserialize::deserialize
and its variants are generally
preferred over this function, since the former also
parse the additional header.