blob: 923b37739a06dea7b4c4a3788d4cc40d1233f3d5 [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,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Foo {
pub field: fidl_test_dependent::MyEnum,
}
impl fidl::Persistable for Foo {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Foo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for Foo {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Foo> for &Foo {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Foo>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<Foo>::encode(
(<fidl_test_dependent::MyEnum as fidl::encoding::ValueTypeMarker>::borrow(
&self.field,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_test_dependent::MyEnum>> fidl::encoding::Encode<Foo>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Foo>(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 fidl::encoding::Decode<Self> for Foo {
#[inline(always)]
fn new_empty() -> Self {
Self { field: fidl::new_empty!(fidl_test_dependent::MyEnum) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl_test_dependent::MyEnum,
&mut self.field,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}