binder::binder_impl

Trait UnstructuredParcelable

Source
pub trait UnstructuredParcelable: Sized {
    // Required methods
    fn write_to_parcel(
        &self,
        parcel: &mut BorrowedParcel<'_>,
    ) -> Result<(), StatusCode>;
    fn from_parcel(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>;

    // Provided method
    fn read_from_parcel(
        &mut self,
        parcel: &BorrowedParcel<'_>,
    ) -> Result<(), StatusCode> { ... }
}
Expand description

Super-trait for unstructured Binder parcelables, i.e. those implemented manually.

These differ from structured parcelables in that they may not have a reasonable default value and so aren’t required to implement Default.

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 calling this function, since the former also prepend a header.

Source

fn from_parcel(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>

Internal deserialization function for parcelables.

This method is mainly for internal use. Deserialize::deserialize and its variants are generally preferred over calling this function, since the former also parse the additional header.

Provided Methods§

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_from and its variants are generally preferred over calling this function, since the former also parse the additional header.

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.

Implementors§