binder::binder_impl

Trait Deserialize

Source
pub trait Deserialize: Sized {
    type UninitType;

    const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _;

    // Required methods
    fn uninit() -> Self::UninitType;
    fn from_init(value: Self) -> Self::UninitType;
    fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>;

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

A struct whose instances can be restored from a crate::parcel::Parcel.

Provided Associated Constants§

Source

const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _

Assert at compile-time that Self and Self::UninitType have the same size and alignment. This will either fail to compile or evaluate to true. The only two macros that work here are panic! and assert!, so we cannot use assert_eq!.

Required Associated Types§

Source

type UninitType

Type for the uninitialized value of this type. Will be either Self if the type implements Default, Option<Self> otherwise.

Required Methods§

Source

fn uninit() -> Self::UninitType

Return an uninitialized or default-initialized value for this type.

Source

fn from_init(value: Self) -> Self::UninitType

Convert an initialized value of type Self into Self::UninitType.

Source

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

Deserialize an instance from the given crate::parcel::Parcel.

Provided Methods§

Source

fn deserialize_from( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>

Deserialize an instance from the given crate::parcel::Parcel onto the current object. This operation will overwrite the old value partially or completely, depending on how much data is available.

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 Deserialize for Option<String>

Source§

impl Deserialize for bool

Source§

impl Deserialize for f32

Source§

impl Deserialize for f64

Source§

impl Deserialize for i8

Source§

impl Deserialize for i16

Source§

impl Deserialize for i32

Source§

impl Deserialize for i64

Source§

impl Deserialize for u8

Source§

impl Deserialize for u16

Source§

impl Deserialize for u32

Source§

impl Deserialize for u64

Source§

impl Deserialize for String

Source§

impl<T: Deserialize> Deserialize for Box<T>

Source§

impl<T: DeserializeArray> Deserialize for Vec<T>

Source§

type UninitType = Vec<T>

Source§

fn uninit() -> Self::UninitType

Source§

fn from_init(value: Self) -> Self::UninitType

Source§

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

Source§

impl<T: DeserializeArray, const N: usize> Deserialize for [T; N]

Source§

impl<T: DeserializeOption> Deserialize for Option<T>

Source§

type UninitType = Option<T>

Source§

fn uninit() -> Self::UninitType

Source§

fn from_init(value: Self) -> Self::UninitType

Source§

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

Source§

fn deserialize_from( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>

Implementors§