fidl_message

Trait Decode

Source
pub trait Decode<T, D>: Sized + 'static
where T: TypeMarker,
{ // Required methods fn new_empty() -> Self; unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error> where D: ResourceDialect; }
Expand description

A Rust type that can be decoded from the FIDL type T.

Required Methods§

Source

fn new_empty() -> Self

Creates a valid instance of Self. The specific value does not matter, since it will be overwritten by decode.

Source

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>
where D: ResourceDialect,

Decodes an object of type T from the decoder’s buffers into self.

Implementations must validate every byte in decoder.buf[offset..offset + T::inline_size(decoder.context)] unless returning an Err value. Implementations that decode out-of-line objects must call depth.increment()?.

§Safety

Callers must ensure offset is a multiple of T::inline_align and decoder.buf has room for reading T::inline_size bytes at offset.

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<D> Decode<bool, D> for bool
where D: ResourceDialect,

Source§

fn new_empty() -> bool

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<f32, D> for f32
where D: ResourceDialect,

Source§

fn new_empty() -> f32

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<f64, D> for f64
where D: ResourceDialect,

Source§

fn new_empty() -> f64

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<i8, D> for i8
where D: ResourceDialect,

Source§

fn new_empty() -> i8

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<i16, D> for i16
where D: ResourceDialect,

Source§

fn new_empty() -> i16

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<i32, D> for i32
where D: ResourceDialect,

Source§

fn new_empty() -> i32

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<i64, D> for i64
where D: ResourceDialect,

Source§

fn new_empty() -> i64

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<u8, D> for u8
where D: ResourceDialect,

Source§

fn new_empty() -> u8

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<u16, D> for u16
where D: ResourceDialect,

Source§

fn new_empty() -> u16

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<u32, D> for u32
where D: ResourceDialect,

Source§

fn new_empty() -> u32

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<u64, D> for u64
where D: ResourceDialect,

Source§

fn new_empty() -> u64

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<EmptyPayload, D> for ()
where D: ResourceDialect,

Source§

fn new_empty()

Source§

unsafe fn decode( &mut self, _decoder: &mut Decoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<EmptyStruct, D> for ()
where D: ResourceDialect,

Source§

fn new_empty()

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<ObjectType, D> for ObjectType
where D: ResourceDialect,

Source§

fn new_empty() -> ObjectType

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D> Decode<Rights, D> for Rights
where D: ResourceDialect,

Source§

fn new_empty() -> Rights

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<D, T, E> Decode<ResultType<T, E>, D> for Result<<T as TypeMarker>::Owned, <E as TypeMarker>::Owned>
where D: ResourceDialect, T: TypeMarker, E: TypeMarker, <T as TypeMarker>::Owned: Decode<T, D>, <E as TypeMarker>::Owned: Decode<E, D>,

Source§

fn new_empty() -> Result<<T as TypeMarker>::Owned, <E as TypeMarker>::Owned>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Source§

impl<T, D> Decode<Boxed<T>, D> for Option<Box<<T as TypeMarker>::Owned>>
where T: TypeMarker, D: ResourceDialect, <T as TypeMarker>::Owned: Decode<T, D>,

Source§

fn new_empty() -> Option<Box<<T as TypeMarker>::Owned>>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Source§

impl<T, D> Decode<Optional<T>, D> for Option<<T as TypeMarker>::Owned>
where T: TypeMarker, D: ResourceDialect, <T as TypeMarker>::Owned: Decode<T, D>,

Source§

fn new_empty() -> Option<<T as TypeMarker>::Owned>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Source§

impl<T, D> Decode<OptionalUnion<T>, D> for Option<Box<<T as TypeMarker>::Owned>>
where T: TypeMarker, D: ResourceDialect, <T as TypeMarker>::Owned: Decode<T, D>,

Source§

fn new_empty() -> Option<Box<<T as TypeMarker>::Owned>>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Source§

impl<T, D> Decode<Instant<T>, D> for Instant<T>
where T: Timeline + 'static, D: ResourceDialect,

Source§

fn new_empty() -> Instant<T>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<T, D> Decode<Instant<T, TicksUnit>, D> for Instant<T, TicksUnit>
where T: Timeline + 'static, D: ResourceDialect,

Source§

fn new_empty() -> Instant<T, TicksUnit>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, _depth: Depth, ) -> Result<(), Error>

Source§

impl<T, const N: usize, D> Decode<Array<T, N>, D> for [<T as TypeMarker>::Owned; N]
where T: TypeMarker, D: ResourceDialect, <T as TypeMarker>::Owned: Decode<T, D>,

Source§

fn new_empty() -> [<T as TypeMarker>::Owned; N]

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Source§

impl<T, const N: usize, D> Decode<Vector<T, N>, D> for Vec<<T as TypeMarker>::Owned>
where T: TypeMarker, D: ResourceDialect, <T as TypeMarker>::Owned: Decode<T, D>,

Source§

fn new_empty() -> Vec<<T as TypeMarker>::Owned>

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Source§

impl<const N: usize, D> Decode<BoundedString<N>, D> for String
where D: ResourceDialect,

Source§

fn new_empty() -> String

Source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_, D>, offset: usize, depth: Depth, ) -> Result<(), Error>

Implementors§

Source§

impl<D> Decode<FrameworkErr, D> for FrameworkErr
where D: ResourceDialect,

Source§

impl<D> Decode<Ambiguous1, D> for AmbiguousNever
where D: ResourceDialect,

Source§

impl<D> Decode<Ambiguous2, D> for AmbiguousNever
where D: ResourceDialect,

Source§

impl<D> Decode<EpitaphBody, D> for EpitaphBody
where D: ResourceDialect,

Source§

impl<D> Decode<WireMetadata, D> for WireMetadata
where D: ResourceDialect,

Source§

impl<D> Decode<TransactionHeader, D> for TransactionHeader
where D: ResourceDialect,

Source§

impl<H, T, D> Decode<GenericMessageType<H, T>, D> for GenericMessageOwned

Source§

impl<T, const OBJECT_TYPE: u32, const RIGHTS: u32> Decode<HandleType<T, OBJECT_TYPE, RIGHTS>, <T as EncodableAsHandle>::Dialect> for T
where T: 'static + EncodableAsHandle,