| // 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, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct LocalStructPayload { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for LocalStructPayload {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct MainProtocolOnAnonRequest { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for MainProtocolOnAnonRequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct MainProtocolOneWayAnonRequest { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for MainProtocolOneWayAnonRequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct MainProtocolTwoWayAnonRequest { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for MainProtocolTwoWayAnonRequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct MainProtocolTwoWayAnonResponse { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for MainProtocolTwoWayAnonResponse {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct MainProtocolTwoWayAnonWithErrorRequest { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for MainProtocolTwoWayAnonWithErrorRequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct MainProtocolTwoWayAnonWithErrorResponse { |
| pub a: u32, |
| pub b: u32, |
| } |
| |
| impl fidl::Persistable for MainProtocolTwoWayAnonWithErrorResponse {} |
| |
| pub mod main_protocol_ordinals { |
| pub const ONE_WAY_COMPOSED: u64 = 0x241e4384443ccb10; |
| pub const TWO_WAY_COMPOSED: u64 = 0x2348a1331ca4cfb0; |
| pub const TWO_WAY_COMPOSED_WITH_ERROR: u64 = 0x6a9be48b574d1557; |
| pub const ON_COMPOSED: u64 = 0x19fbe2b2f6f9273a; |
| pub const ONE_WAY_LOCAL: u64 = 0x6b9feaf9305b0715; |
| pub const TWO_WAY_LOCAL: u64 = 0x743776548de3af0f; |
| pub const TWO_WAY_LOCAL_WITH_ERROR: u64 = 0x2839c029915cb8fc; |
| pub const ON_LOCAL: u64 = 0x4745f7438cd80819; |
| pub const ONE_WAY_IMPORT: u64 = 0x2e6b091ae4cee40c; |
| pub const TWO_WAY_IMPORT: u64 = 0x20f4a8f65ff69473; |
| pub const TWO_WAY_IMPORT_WITH_ERROR: u64 = 0x3b7b706d42eb9bbd; |
| pub const ON_IMPORT: u64 = 0x1bb4f4c30b6f8909; |
| pub const ONE_WAY_ANON: u64 = 0xb43565c01ab54ac; |
| pub const TWO_WAY_ANON: u64 = 0x8bdc969ff7dd759; |
| pub const TWO_WAY_ANON_WITH_ERROR: u64 = 0x5862bf8170c87a36; |
| pub const ON_ANON: u64 = 0x42d321dacc4df000; |
| } |
| |
| mod internal { |
| use super::*; |
| |
| impl fidl::encoding::ValueTypeMarker for LocalStructPayload { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for LocalStructPayload { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<LocalStructPayload, D> |
| for &LocalStructPayload |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<LocalStructPayload>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut LocalStructPayload) |
| .write_unaligned((self as *const LocalStructPayload).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<LocalStructPayload, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<LocalStructPayload>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LocalStructPayload { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for MainProtocolOnAnonRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MainProtocolOnAnonRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<MainProtocolOnAnonRequest, D> for &MainProtocolOnAnonRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolOnAnonRequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut MainProtocolOnAnonRequest) |
| .write_unaligned((self as *const MainProtocolOnAnonRequest).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<MainProtocolOnAnonRequest, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolOnAnonRequest>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for MainProtocolOnAnonRequest |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for MainProtocolOneWayAnonRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MainProtocolOneWayAnonRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<MainProtocolOneWayAnonRequest, D> |
| for &MainProtocolOneWayAnonRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolOneWayAnonRequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut MainProtocolOneWayAnonRequest) |
| .write_unaligned((self as *const MainProtocolOneWayAnonRequest).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<MainProtocolOneWayAnonRequest, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolOneWayAnonRequest>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for MainProtocolOneWayAnonRequest |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<MainProtocolTwoWayAnonRequest, D> |
| for &MainProtocolTwoWayAnonRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonRequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut MainProtocolTwoWayAnonRequest) |
| .write_unaligned((self as *const MainProtocolTwoWayAnonRequest).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<MainProtocolTwoWayAnonRequest, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonRequest>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for MainProtocolTwoWayAnonRequest |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonResponse { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<MainProtocolTwoWayAnonResponse, D> |
| for &MainProtocolTwoWayAnonResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonResponse>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut MainProtocolTwoWayAnonResponse) |
| .write_unaligned((self as *const MainProtocolTwoWayAnonResponse).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<MainProtocolTwoWayAnonResponse, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonResponse>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for MainProtocolTwoWayAnonResponse |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonWithErrorRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonWithErrorRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<MainProtocolTwoWayAnonWithErrorRequest, D> |
| for &MainProtocolTwoWayAnonWithErrorRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorRequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut MainProtocolTwoWayAnonWithErrorRequest).write_unaligned( |
| (self as *const MainProtocolTwoWayAnonWithErrorRequest).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<MainProtocolTwoWayAnonWithErrorRequest, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorRequest>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for MainProtocolTwoWayAnonWithErrorRequest |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonWithErrorResponse { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonWithErrorResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[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<MainProtocolTwoWayAnonWithErrorResponse, D> |
| for &MainProtocolTwoWayAnonWithErrorResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorResponse>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut MainProtocolTwoWayAnonWithErrorResponse).write_unaligned( |
| (self as *const MainProtocolTwoWayAnonWithErrorResponse).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<u32, D>, |
| T1: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<MainProtocolTwoWayAnonWithErrorResponse, D> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorResponse>(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)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for MainProtocolTwoWayAnonWithErrorResponse |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(u32, D), b: fidl::new_empty!(u32, 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(()) |
| } |
| } |
| } |