/// Decode some bytes into a FIDL type
Decode some bytes into a FIDL type
Decode some bytes into a FIDL type
pub fn decode_fidl_with_context<T: fidl::encoding::Persistable>(
    ctx: Context,
    bytes: &mut [u8],
) -> Result<T, Error> {
    if ctx.use_persistent_header {
        fidl::encoding::decode_persistent(bytes).map_err(Into::into)
    } else {
        let mut value = T::new_empty();
        // WARNING: Since we are decoding without a transaction header, we have to
        // provide a context manually. This could cause problems in future FIDL wire
        // format migrations, which are driven by header flags.
        let context =
            fidl::encoding::Context { wire_format_version: fidl::encoding::WireFormatVersion::V1 };
        fidl::encoding::Decoder::decode_with_context(&context, bytes, &mut [], &mut value)?;
        Ok(value)
    }
}
pub fn decode_fidl_with_context < T : fidl :: encoding :: Persistable > ( ctx : Context , bytes : & mut [ u8 ] , ) -> Result < T , Error > { if ctx . use_persistent_header { fidl :: encoding :: decode_persistent ( bytes ) . map_err ( Into :: into ) } else { let mut value = T :: new_empty ( ) ; // WARNING: Since we are decoding without a transaction header, we have to // provide a context manually. This could cause problems in future FIDL wire // format migrations, which are driven by header flags. let context = fidl :: encoding :: Context { wire_format_version : fidl :: encoding :: WireFormatVersion :: V1 } ; fidl :: encoding :: Decoder :: decode_with_context ( & context , bytes , & mut [ ] , & mut value ) ? ; Ok ( value ) } }
Decode some bytes into a FIDL type
Decode some bytes into a FIDL type
ctx
Context
bytes
&mut [u8]