| // 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)] |
| pub struct SandwichUnionSize12Alignment4 { |
| pub before: u32, |
| pub union: UnionSize12Alignment4, |
| pub after: i32, |
| } |
| |
| impl fidl::Persistable for SandwichUnionSize12Alignment4 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct SandwichUnionSize24Alignment8 { |
| pub before: u32, |
| pub union: UnionSize24Alignment8, |
| pub after: u32, |
| } |
| |
| impl fidl::Persistable for SandwichUnionSize24Alignment8 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct SandwichUnionSize36Alignment4 { |
| pub before: u32, |
| pub union: UnionSize36Alignment4, |
| pub after: u32, |
| } |
| |
| impl fidl::Persistable for SandwichUnionSize36Alignment4 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct SandwichUnionSize8Alignment4 { |
| pub before: u32, |
| pub union: UnionSize8Alignment4, |
| pub after: u32, |
| } |
| |
| impl fidl::Persistable for SandwichUnionSize8Alignment4 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct StructSize16Alignment8 { |
| pub f1: u64, |
| pub f2: u64, |
| } |
| |
| impl fidl::Persistable for StructSize16Alignment8 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub enum UnionSize12Alignment4 { |
| Variant([u8; 6]), |
| } |
| |
| impl UnionSize12Alignment4 { |
| #[inline] |
| pub fn ordinal(&self) -> u64 { |
| match *self { |
| Self::Variant(_) => 1, |
| } |
| } |
| } |
| |
| impl fidl::Persistable for UnionSize12Alignment4 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub enum UnionSize24Alignment8 { |
| Variant(StructSize16Alignment8), |
| } |
| |
| impl UnionSize24Alignment8 { |
| #[inline] |
| pub fn ordinal(&self) -> u64 { |
| match *self { |
| Self::Variant(_) => 1, |
| } |
| } |
| } |
| |
| impl fidl::Persistable for UnionSize24Alignment8 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub enum UnionSize36Alignment4 { |
| Variant([u8; 32]), |
| } |
| |
| impl UnionSize36Alignment4 { |
| #[inline] |
| pub fn ordinal(&self) -> u64 { |
| match *self { |
| Self::Variant(_) => 1, |
| } |
| } |
| } |
| |
| impl fidl::Persistable for UnionSize36Alignment4 {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub enum UnionSize8Alignment4 { |
| Variant(u32), |
| } |
| |
| impl UnionSize8Alignment4 { |
| #[inline] |
| pub fn ordinal(&self) -> u64 { |
| match *self { |
| Self::Variant(_) => 1, |
| } |
| } |
| } |
| |
| impl fidl::Persistable for UnionSize8Alignment4 {} |
| |
| mod internal { |
| use super::*; |
| |
| impl fidl::encoding::ValueTypeMarker for SandwichUnionSize12Alignment4 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for SandwichUnionSize12Alignment4 { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 32 |
| } |
| } |
| |
| unsafe impl<D: fidl::encoding::ResourceDialect> |
| fidl::encoding::Encode<SandwichUnionSize12Alignment4, D> |
| for &SandwichUnionSize12Alignment4 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize12Alignment4>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<SandwichUnionSize12Alignment4, D>::encode( |
| ( |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.before), |
| <UnionSize12Alignment4 as fidl::encoding::ValueTypeMarker>::borrow(&self.union), |
| <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.after), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| D: fidl::encoding::ResourceDialect, |
| T0: fidl::encoding::Encode<u32, D>, |
| T1: fidl::encoding::Encode<UnionSize12Alignment4, D>, |
| T2: fidl::encoding::Encode<i32, D>, |
| > fidl::encoding::Encode<SandwichUnionSize12Alignment4, D> for (T0, T1, T2) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize12Alignment4>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| self.2.encode(encoder, offset + 24, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for SandwichUnionSize12Alignment4 |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| before: fidl::new_empty!(u32, D), |
| union: fidl::new_empty!(UnionSize12Alignment4, D), |
| after: fidl::new_empty!(i32, 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. |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| fidl::decode!(u32, D, &mut self.before, decoder, offset + 0, _depth)?; |
| fidl::decode!(UnionSize12Alignment4, D, &mut self.union, decoder, offset + 8, _depth)?; |
| fidl::decode!(i32, D, &mut self.after, decoder, offset + 24, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for SandwichUnionSize24Alignment8 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for SandwichUnionSize24Alignment8 { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 32 |
| } |
| } |
| |
| unsafe impl<D: fidl::encoding::ResourceDialect> |
| fidl::encoding::Encode<SandwichUnionSize24Alignment8, D> |
| for &SandwichUnionSize24Alignment8 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize24Alignment8>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<SandwichUnionSize24Alignment8, D>::encode( |
| ( |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.before), |
| <UnionSize24Alignment8 as fidl::encoding::ValueTypeMarker>::borrow(&self.union), |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.after), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| D: fidl::encoding::ResourceDialect, |
| T0: fidl::encoding::Encode<u32, D>, |
| T1: fidl::encoding::Encode<UnionSize24Alignment8, D>, |
| T2: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<SandwichUnionSize24Alignment8, D> for (T0, T1, T2) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize24Alignment8>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| self.2.encode(encoder, offset + 24, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for SandwichUnionSize24Alignment8 |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| before: fidl::new_empty!(u32, D), |
| union: fidl::new_empty!(UnionSize24Alignment8, D), |
| after: 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); |
| // Verify that padding bytes are zero. |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| fidl::decode!(u32, D, &mut self.before, decoder, offset + 0, _depth)?; |
| fidl::decode!(UnionSize24Alignment8, D, &mut self.union, decoder, offset + 8, _depth)?; |
| fidl::decode!(u32, D, &mut self.after, decoder, offset + 24, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for SandwichUnionSize36Alignment4 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for SandwichUnionSize36Alignment4 { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 32 |
| } |
| } |
| |
| unsafe impl<D: fidl::encoding::ResourceDialect> |
| fidl::encoding::Encode<SandwichUnionSize36Alignment4, D> |
| for &SandwichUnionSize36Alignment4 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize36Alignment4>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<SandwichUnionSize36Alignment4, D>::encode( |
| ( |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.before), |
| <UnionSize36Alignment4 as fidl::encoding::ValueTypeMarker>::borrow(&self.union), |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.after), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| D: fidl::encoding::ResourceDialect, |
| T0: fidl::encoding::Encode<u32, D>, |
| T1: fidl::encoding::Encode<UnionSize36Alignment4, D>, |
| T2: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<SandwichUnionSize36Alignment4, D> for (T0, T1, T2) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize36Alignment4>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| self.2.encode(encoder, offset + 24, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for SandwichUnionSize36Alignment4 |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| before: fidl::new_empty!(u32, D), |
| union: fidl::new_empty!(UnionSize36Alignment4, D), |
| after: 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); |
| // Verify that padding bytes are zero. |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| fidl::decode!(u32, D, &mut self.before, decoder, offset + 0, _depth)?; |
| fidl::decode!(UnionSize36Alignment4, D, &mut self.union, decoder, offset + 8, _depth)?; |
| fidl::decode!(u32, D, &mut self.after, decoder, offset + 24, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for SandwichUnionSize8Alignment4 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for SandwichUnionSize8Alignment4 { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 32 |
| } |
| } |
| |
| unsafe impl<D: fidl::encoding::ResourceDialect> |
| fidl::encoding::Encode<SandwichUnionSize8Alignment4, D> for &SandwichUnionSize8Alignment4 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize8Alignment4>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<SandwichUnionSize8Alignment4, D>::encode( |
| ( |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.before), |
| <UnionSize8Alignment4 as fidl::encoding::ValueTypeMarker>::borrow(&self.union), |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.after), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| D: fidl::encoding::ResourceDialect, |
| T0: fidl::encoding::Encode<u32, D>, |
| T1: fidl::encoding::Encode<UnionSize8Alignment4, D>, |
| T2: fidl::encoding::Encode<u32, D>, |
| > fidl::encoding::Encode<SandwichUnionSize8Alignment4, D> for (T0, T1, T2) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<SandwichUnionSize8Alignment4>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| unsafe { |
| let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24); |
| (ptr as *mut u64).write_unaligned(0); |
| } |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| self.2.encode(encoder, offset + 24, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for SandwichUnionSize8Alignment4 |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| before: fidl::new_empty!(u32, D), |
| union: fidl::new_empty!(UnionSize8Alignment4, D), |
| after: 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); |
| // Verify that padding bytes are zero. |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) }; |
| let padval = unsafe { (ptr as *const u64).read_unaligned() }; |
| let mask = 0xffffffff00000000u64; |
| let maskedval = padval & mask; |
| if maskedval != 0 { |
| return Err(fidl::Error::NonZeroPadding { |
| padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize, |
| }); |
| } |
| fidl::decode!(u32, D, &mut self.before, decoder, offset + 0, _depth)?; |
| fidl::decode!(UnionSize8Alignment4, D, &mut self.union, decoder, offset + 8, _depth)?; |
| fidl::decode!(u32, D, &mut self.after, decoder, offset + 24, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for StructSize16Alignment8 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for StructSize16Alignment8 { |
| 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 |
| } |
| #[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<StructSize16Alignment8, D> for &StructSize16Alignment8 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<StructSize16Alignment8>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut StructSize16Alignment8) |
| .write_unaligned((self as *const StructSize16Alignment8).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<u64, D>, |
| T1: fidl::encoding::Encode<u64, D>, |
| > fidl::encoding::Encode<StructSize16Alignment8, 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::<StructSize16Alignment8>(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 + 8, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> |
| for StructSize16Alignment8 |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { f1: fidl::new_empty!(u64, D), f2: fidl::new_empty!(u64, 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, 16); |
| } |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for UnionSize12Alignment4 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for UnionSize12Alignment4 { |
| 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<UnionSize12Alignment4, D> |
| for &UnionSize12Alignment4 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<UnionSize12Alignment4>(offset); |
| encoder.write_num::<u64>(self.ordinal(), offset); |
| match self { |
| UnionSize12Alignment4::Variant(ref val) => fidl::encoding::encode_in_envelope::< |
| fidl::encoding::Array<u8, 6>, |
| D, |
| >( |
| <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(val), |
| encoder, |
| offset + 8, |
| _depth, |
| ), |
| } |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnionSize12Alignment4 { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::Variant(fidl::new_empty!(fidl::encoding::Array<u8, 6>, D)) |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_, D>, |
| offset: usize, |
| mut depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| #[allow(unused_variables)] |
| let next_out_of_line = decoder.next_out_of_line(); |
| let handles_before = decoder.remaining_handles(); |
| let (ordinal, inlined, num_bytes, num_handles) = |
| fidl::encoding::decode_union_inline_portion(decoder, offset)?; |
| |
| let member_inline_size = match ordinal { |
| 1 => <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size( |
| decoder.context, |
| ), |
| _ => return Err(fidl::Error::UnknownUnionTag), |
| }; |
| |
| if inlined != (member_inline_size <= 4) { |
| return Err(fidl::Error::InvalidInlineBitInEnvelope); |
| } |
| let _inner_offset; |
| if inlined { |
| decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?; |
| _inner_offset = offset + 8; |
| } else { |
| depth.increment()?; |
| _inner_offset = decoder.out_of_line_offset(member_inline_size)?; |
| } |
| match ordinal { |
| 1 => { |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize12Alignment4::Variant(_) = self { |
| // Do nothing, read the value into the object |
| } else { |
| // Initialize `self` to the right variant |
| *self = UnionSize12Alignment4::Variant( |
| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D), |
| ); |
| } |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize12Alignment4::Variant(ref mut val) = self { |
| fidl::decode!(fidl::encoding::Array<u8, 6>, D, val, decoder, _inner_offset, depth)?; |
| } else { |
| unreachable!() |
| } |
| } |
| ordinal => panic!("unexpected ordinal {:?}", ordinal), |
| } |
| if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) { |
| return Err(fidl::Error::InvalidNumBytesInEnvelope); |
| } |
| if handles_before != decoder.remaining_handles() + (num_handles as usize) { |
| return Err(fidl::Error::InvalidNumHandlesInEnvelope); |
| } |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for UnionSize24Alignment8 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for UnionSize24Alignment8 { |
| 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<UnionSize24Alignment8, D> |
| for &UnionSize24Alignment8 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<UnionSize24Alignment8>(offset); |
| encoder.write_num::<u64>(self.ordinal(), offset); |
| match self { |
| UnionSize24Alignment8::Variant(ref val) => { |
| fidl::encoding::encode_in_envelope::<StructSize16Alignment8, D>( |
| <StructSize16Alignment8 as fidl::encoding::ValueTypeMarker>::borrow(val), |
| encoder, |
| offset + 8, |
| _depth, |
| ) |
| } |
| } |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnionSize24Alignment8 { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::Variant(fidl::new_empty!(StructSize16Alignment8, D)) |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_, D>, |
| offset: usize, |
| mut depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| #[allow(unused_variables)] |
| let next_out_of_line = decoder.next_out_of_line(); |
| let handles_before = decoder.remaining_handles(); |
| let (ordinal, inlined, num_bytes, num_handles) = |
| fidl::encoding::decode_union_inline_portion(decoder, offset)?; |
| |
| let member_inline_size = match ordinal { |
| 1 => <StructSize16Alignment8 as fidl::encoding::TypeMarker>::inline_size( |
| decoder.context, |
| ), |
| _ => return Err(fidl::Error::UnknownUnionTag), |
| }; |
| |
| if inlined != (member_inline_size <= 4) { |
| return Err(fidl::Error::InvalidInlineBitInEnvelope); |
| } |
| let _inner_offset; |
| if inlined { |
| decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?; |
| _inner_offset = offset + 8; |
| } else { |
| depth.increment()?; |
| _inner_offset = decoder.out_of_line_offset(member_inline_size)?; |
| } |
| match ordinal { |
| 1 => { |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize24Alignment8::Variant(_) = self { |
| // Do nothing, read the value into the object |
| } else { |
| // Initialize `self` to the right variant |
| *self = UnionSize24Alignment8::Variant(fidl::new_empty!( |
| StructSize16Alignment8, |
| D |
| )); |
| } |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize24Alignment8::Variant(ref mut val) = self { |
| fidl::decode!( |
| StructSize16Alignment8, |
| D, |
| val, |
| decoder, |
| _inner_offset, |
| depth |
| )?; |
| } else { |
| unreachable!() |
| } |
| } |
| ordinal => panic!("unexpected ordinal {:?}", ordinal), |
| } |
| if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) { |
| return Err(fidl::Error::InvalidNumBytesInEnvelope); |
| } |
| if handles_before != decoder.remaining_handles() + (num_handles as usize) { |
| return Err(fidl::Error::InvalidNumHandlesInEnvelope); |
| } |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for UnionSize36Alignment4 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for UnionSize36Alignment4 { |
| 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<UnionSize36Alignment4, D> |
| for &UnionSize36Alignment4 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<UnionSize36Alignment4>(offset); |
| encoder.write_num::<u64>(self.ordinal(), offset); |
| match self { |
| UnionSize36Alignment4::Variant(ref val) => fidl::encoding::encode_in_envelope::< |
| fidl::encoding::Array<u8, 32>, |
| D, |
| >( |
| <fidl::encoding::Array<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(val), |
| encoder, |
| offset + 8, |
| _depth, |
| ), |
| } |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnionSize36Alignment4 { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::Variant(fidl::new_empty!(fidl::encoding::Array<u8, 32>, D)) |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_, D>, |
| offset: usize, |
| mut depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| #[allow(unused_variables)] |
| let next_out_of_line = decoder.next_out_of_line(); |
| let handles_before = decoder.remaining_handles(); |
| let (ordinal, inlined, num_bytes, num_handles) = |
| fidl::encoding::decode_union_inline_portion(decoder, offset)?; |
| |
| let member_inline_size = match ordinal { |
| 1 => <fidl::encoding::Array<u8, 32> as fidl::encoding::TypeMarker>::inline_size( |
| decoder.context, |
| ), |
| _ => return Err(fidl::Error::UnknownUnionTag), |
| }; |
| |
| if inlined != (member_inline_size <= 4) { |
| return Err(fidl::Error::InvalidInlineBitInEnvelope); |
| } |
| let _inner_offset; |
| if inlined { |
| decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?; |
| _inner_offset = offset + 8; |
| } else { |
| depth.increment()?; |
| _inner_offset = decoder.out_of_line_offset(member_inline_size)?; |
| } |
| match ordinal { |
| 1 => { |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize36Alignment4::Variant(_) = self { |
| // Do nothing, read the value into the object |
| } else { |
| // Initialize `self` to the right variant |
| *self = UnionSize36Alignment4::Variant( |
| fidl::new_empty!(fidl::encoding::Array<u8, 32>, D), |
| ); |
| } |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize36Alignment4::Variant(ref mut val) = self { |
| fidl::decode!(fidl::encoding::Array<u8, 32>, D, val, decoder, _inner_offset, depth)?; |
| } else { |
| unreachable!() |
| } |
| } |
| ordinal => panic!("unexpected ordinal {:?}", ordinal), |
| } |
| if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) { |
| return Err(fidl::Error::InvalidNumBytesInEnvelope); |
| } |
| if handles_before != decoder.remaining_handles() + (num_handles as usize) { |
| return Err(fidl::Error::InvalidNumHandlesInEnvelope); |
| } |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for UnionSize8Alignment4 { |
| type Borrowed<'a> = &'a Self; |
| fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for UnionSize8Alignment4 { |
| 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<UnionSize8Alignment4, D> |
| for &UnionSize8Alignment4 |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_, D>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<UnionSize8Alignment4>(offset); |
| encoder.write_num::<u64>(self.ordinal(), offset); |
| match self { |
| UnionSize8Alignment4::Variant(ref val) => { |
| fidl::encoding::encode_in_envelope::<u32, D>( |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(val), |
| encoder, |
| offset + 8, |
| _depth, |
| ) |
| } |
| } |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnionSize8Alignment4 { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::Variant(fidl::new_empty!(u32, D)) |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_, D>, |
| offset: usize, |
| mut depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| #[allow(unused_variables)] |
| let next_out_of_line = decoder.next_out_of_line(); |
| let handles_before = decoder.remaining_handles(); |
| let (ordinal, inlined, num_bytes, num_handles) = |
| fidl::encoding::decode_union_inline_portion(decoder, offset)?; |
| |
| let member_inline_size = match ordinal { |
| 1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context), |
| _ => return Err(fidl::Error::UnknownUnionTag), |
| }; |
| |
| if inlined != (member_inline_size <= 4) { |
| return Err(fidl::Error::InvalidInlineBitInEnvelope); |
| } |
| let _inner_offset; |
| if inlined { |
| decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?; |
| _inner_offset = offset + 8; |
| } else { |
| depth.increment()?; |
| _inner_offset = decoder.out_of_line_offset(member_inline_size)?; |
| } |
| match ordinal { |
| 1 => { |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize8Alignment4::Variant(_) = self { |
| // Do nothing, read the value into the object |
| } else { |
| // Initialize `self` to the right variant |
| *self = UnionSize8Alignment4::Variant(fidl::new_empty!(u32, D)); |
| } |
| #[allow(irrefutable_let_patterns)] |
| if let UnionSize8Alignment4::Variant(ref mut val) = self { |
| fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?; |
| } else { |
| unreachable!() |
| } |
| } |
| ordinal => panic!("unexpected ordinal {:?}", ordinal), |
| } |
| if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) { |
| return Err(fidl::Error::InvalidNumBytesInEnvelope); |
| } |
| if handles_before != decoder.remaining_handles() + (num_handles as usize) { |
| return Err(fidl::Error::InvalidNumHandlesInEnvelope); |
| } |
| Ok(()) |
| } |
| } |
| } |