Trait fidl_message::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.

Object Safety§

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,