blob: 8870d199bb18dbb41659064d690fd933ed4defec [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = output_index_json
#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailRequest {
pub s: String,
}
impl fidl::Persistable for ExampleUseOfErrorSyntaxCallWhichMayFailRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
pub value: i64,
}
impl fidl::Persistable for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {}
pub mod example_use_of_error_syntax_ordinals {
pub const COMPOSED_CALL_WHICH_MAY_FAIL: u64 = 0x3179cf8f46814221;
pub const CALL_WHICH_MAY_FAIL: u64 = 0x3424ff83ce3004a2;
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for ExampleUseOfErrorSyntaxCallWhichMayFailRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ExampleUseOfErrorSyntaxCallWhichMayFailRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ExampleUseOfErrorSyntaxCallWhichMayFailRequest, D>
for &ExampleUseOfErrorSyntaxCallWhichMayFailRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExampleUseOfErrorSyntaxCallWhichMayFailRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<ExampleUseOfErrorSyntaxCallWhichMayFailRequest, D>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.s,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<ExampleUseOfErrorSyntaxCallWhichMayFailRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExampleUseOfErrorSyntaxCallWhichMayFailRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { s: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.s,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ExampleUseOfErrorSyntaxCallWhichMayFailResponse, D>
for &ExampleUseOfErrorSyntaxCallWhichMayFailResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExampleUseOfErrorSyntaxCallWhichMayFailResponse>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ExampleUseOfErrorSyntaxCallWhichMayFailResponse).write_unaligned(
(self as *const ExampleUseOfErrorSyntaxCallWhichMayFailResponse).read(),
);
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<ExampleUseOfErrorSyntaxCallWhichMayFailResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExampleUseOfErrorSyntaxCallWhichMayFailResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
}