Skip to main content

Parcelable

Trait Parcelable 

Source
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§

Source

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.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<STABILITY: StabilityType> Parcelable for ParcelableHolder<STABILITY>