| // DO NOT EDIT: This file is machine-generated by fidlgen |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)] |
| |
| pub mod natural { |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct StructLargeArray { |
| pub a: [u32; 100], |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::StructLargeArray, ___E> for StructLargeArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization< |
| Self, |
| crate::wire::StructLargeArray, |
| > = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| [u32; 100] as ::fidl_next::Encode<[::fidl_next::WireU32; 100], ___E> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::StructLargeArray>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::StructLargeArray { |
| a, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.a, encoder_, a, ())?; |
| |
| let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) }; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::StructLargeArray, ___E> |
| for &'a StructLargeArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::StructLargeArray>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::StructLargeArray { |
| |
| a, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(&self.a, encoder_, a, ())?; |
| |
| let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) }; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> |
| ::fidl_next::EncodeOption< |
| ::fidl_next::WireBox<'static, crate::wire::StructLargeArray>, |
| ___E, |
| > for StructLargeArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| StructLargeArray: ::fidl_next::Encode<crate::wire::StructLargeArray, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit< |
| ::fidl_next::WireBox<'static, crate::wire::StructLargeArray>, |
| >, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| if let Some(inner) = this { |
| ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?; |
| ::fidl_next::WireBox::encode_present(out); |
| } else { |
| ::fidl_next::WireBox::encode_absent(out); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> |
| ::fidl_next::EncodeOption< |
| ::fidl_next::WireBox<'static, crate::wire::StructLargeArray>, |
| ___E, |
| > for &'a StructLargeArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| &'a StructLargeArray: ::fidl_next::Encode<crate::wire::StructLargeArray, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit< |
| ::fidl_next::WireBox<'static, crate::wire::StructLargeArray>, |
| >, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| if let Some(inner) = this { |
| ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?; |
| ::fidl_next::WireBox::encode_present(out); |
| } else { |
| ::fidl_next::WireBox::encode_absent(out); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::StructLargeArray> for StructLargeArray { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization< |
| crate::wire::StructLargeArray, |
| Self, |
| > = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| [u32; 100] as ::fidl_next::FromWire<[::fidl_next::WireU32; 100]> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: crate::wire::StructLargeArray) -> Self { |
| Self { a: ::fidl_next::FromWire::from_wire(wire.a) } |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::StructLargeArray> for StructLargeArray { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::StructLargeArray) -> Self { |
| Self { a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a) } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct StructSmallArray { |
| pub a: [u32; 2], |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::StructSmallArray, ___E> for StructSmallArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization< |
| Self, |
| crate::wire::StructSmallArray, |
| > = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| [u32; 2] as ::fidl_next::Encode<[::fidl_next::WireU32; 2], ___E> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::StructSmallArray>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::StructSmallArray { |
| a, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.a, encoder_, a, ())?; |
| |
| let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) }; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::StructSmallArray, ___E> |
| for &'a StructSmallArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::StructSmallArray>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::StructSmallArray { |
| |
| a, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(&self.a, encoder_, a, ())?; |
| |
| let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) }; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> |
| ::fidl_next::EncodeOption< |
| ::fidl_next::WireBox<'static, crate::wire::StructSmallArray>, |
| ___E, |
| > for StructSmallArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| StructSmallArray: ::fidl_next::Encode<crate::wire::StructSmallArray, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit< |
| ::fidl_next::WireBox<'static, crate::wire::StructSmallArray>, |
| >, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| if let Some(inner) = this { |
| ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?; |
| ::fidl_next::WireBox::encode_present(out); |
| } else { |
| ::fidl_next::WireBox::encode_absent(out); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> |
| ::fidl_next::EncodeOption< |
| ::fidl_next::WireBox<'static, crate::wire::StructSmallArray>, |
| ___E, |
| > for &'a StructSmallArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| &'a StructSmallArray: ::fidl_next::Encode<crate::wire::StructSmallArray, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit< |
| ::fidl_next::WireBox<'static, crate::wire::StructSmallArray>, |
| >, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| if let Some(inner) = this { |
| ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?; |
| ::fidl_next::WireBox::encode_present(out); |
| } else { |
| ::fidl_next::WireBox::encode_absent(out); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::StructSmallArray> for StructSmallArray { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization< |
| crate::wire::StructSmallArray, |
| Self, |
| > = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| [u32; 2] as ::fidl_next::FromWire<[::fidl_next::WireU32; 2]> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: crate::wire::StructSmallArray) -> Self { |
| Self { a: ::fidl_next::FromWire::from_wire(wire.a) } |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::StructSmallArray> for StructSmallArray { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::StructSmallArray) -> Self { |
| Self { a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a) } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug, Default)] |
| pub struct TableLargeArray { |
| pub a: ::core::option::Option<[u32; 100]>, |
| } |
| |
| impl TableLargeArray { |
| fn __max_ordinal(&self) -> usize { |
| if self.a.is_some() { |
| return 1; |
| } |
| |
| 0 |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::TableLargeArray<'static>, ___E> |
| for TableLargeArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| mut self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::TableLargeArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::TableLargeArray { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 1 => { |
| if let Some(value) = self.a.take() { |
| ::fidl_next::WireEnvelope::encode_value::< |
| [::fidl_next::WireU32; 100], |
| ___E, |
| >( |
| value, preallocated.encoder, &mut out, () |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::TableLargeArray<'static>, ___E> |
| for &'a TableLargeArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::TableLargeArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::TableLargeArray { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 1 => { |
| if let Some(value) = &self.a { |
| ::fidl_next::WireEnvelope::encode_value::< |
| [::fidl_next::WireU32; 100], |
| ___E, |
| >( |
| value, preallocated.encoder, &mut out, () |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<crate::wire::TableLargeArray<'de>> for TableLargeArray { |
| #[inline] |
| fn from_wire(wire_: crate::wire::TableLargeArray<'de>) -> Self { |
| let wire_ = ::core::mem::ManuallyDrop::new(wire_); |
| |
| let a = wire_.table.get(1); |
| |
| Self { |
| a: a.map(|envelope| { |
| ::fidl_next::FromWire::from_wire(unsafe { |
| envelope.read_unchecked::<[::fidl_next::WireU32; 100]>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<crate::wire::TableLargeArray<'de>> for TableLargeArray { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::TableLargeArray<'de>) -> Self { |
| Self { |
| a: wire.table.get(1).map(|envelope| { |
| ::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| envelope.deref_unchecked::<[::fidl_next::WireU32; 100]>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug, Default)] |
| pub struct TableSmallArray { |
| pub a: ::core::option::Option<[u32; 2]>, |
| } |
| |
| impl TableSmallArray { |
| fn __max_ordinal(&self) -> usize { |
| if self.a.is_some() { |
| return 1; |
| } |
| |
| 0 |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::TableSmallArray<'static>, ___E> |
| for TableSmallArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| mut self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::TableSmallArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::TableSmallArray { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 1 => { |
| if let Some(value) = self.a.take() { |
| ::fidl_next::WireEnvelope::encode_value::< |
| [::fidl_next::WireU32; 2], |
| ___E, |
| >( |
| value, preallocated.encoder, &mut out, () |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::TableSmallArray<'static>, ___E> |
| for &'a TableSmallArray |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::TableSmallArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::TableSmallArray { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 1 => { |
| if let Some(value) = &self.a { |
| ::fidl_next::WireEnvelope::encode_value::< |
| [::fidl_next::WireU32; 2], |
| ___E, |
| >( |
| value, preallocated.encoder, &mut out, () |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<crate::wire::TableSmallArray<'de>> for TableSmallArray { |
| #[inline] |
| fn from_wire(wire_: crate::wire::TableSmallArray<'de>) -> Self { |
| let wire_ = ::core::mem::ManuallyDrop::new(wire_); |
| |
| let a = wire_.table.get(1); |
| |
| Self { |
| a: a.map(|envelope| { |
| ::fidl_next::FromWire::from_wire(unsafe { |
| envelope.read_unchecked::<[::fidl_next::WireU32; 2]>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<crate::wire::TableSmallArray<'de>> for TableSmallArray { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::TableSmallArray<'de>) -> Self { |
| Self { |
| a: wire.table.get(1).map(|envelope| { |
| ::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| envelope.deref_unchecked::<[::fidl_next::WireU32; 2]>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum UnionLargeArray { |
| A([u32; 100]), |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::UnionLargeArray<'static>, ___E> |
| for UnionLargeArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::UnionLargeArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::UnionLargeArray { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::A(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| [::fidl_next::WireU32; 100], |
| >(value, 1, encoder, raw, ())?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::UnionLargeArray<'static>, ___E> |
| for &'a UnionLargeArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::UnionLargeArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::UnionLargeArray { raw, _phantom: _ } = out); |
| |
| match self { |
| UnionLargeArray::A(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| [::fidl_next::WireU32; 100], |
| >(value, 1, encoder, raw, ())?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> |
| ::fidl_next::EncodeOption<crate::wire_optional::UnionLargeArray<'static>, ___E> |
| for UnionLargeArray |
| where |
| ___E: ?Sized, |
| UnionLargeArray: ::fidl_next::Encode<crate::wire::UnionLargeArray<'static>, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire_optional::UnionLargeArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire_optional::UnionLargeArray { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::Encode::encode(inner, encoder, value_out, ())?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> |
| ::fidl_next::EncodeOption<crate::wire_optional::UnionLargeArray<'static>, ___E> |
| for &'a UnionLargeArray |
| where |
| ___E: ?Sized, |
| &'a UnionLargeArray: ::fidl_next::Encode<crate::wire::UnionLargeArray<'static>, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire_optional::UnionLargeArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire_optional::UnionLargeArray { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::Encode::encode(inner, encoder, value_out, ())?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<crate::wire::UnionLargeArray<'de>> for UnionLargeArray { |
| #[inline] |
| fn from_wire(wire: crate::wire::UnionLargeArray<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::A(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<[::fidl_next::WireU32; 100]>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<crate::wire::UnionLargeArray<'de>> for UnionLargeArray { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::UnionLargeArray<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::A(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<[::fidl_next::WireU32; 100]>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::UnionLargeArray<'de>> |
| for UnionLargeArray |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: crate::wire_optional::UnionLargeArray<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.into_option() { |
| Some(::fidl_next::FromWire::from_wire(inner)) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::UnionLargeArray<'de>> |
| for Box<UnionLargeArray> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: crate::wire_optional::UnionLargeArray<'de>, |
| ) -> ::core::option::Option<Self> { |
| <UnionLargeArray as ::fidl_next::FromWireOption< |
| crate::wire_optional::UnionLargeArray<'de>, |
| >>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::UnionLargeArray<'de>> |
| for Box<UnionLargeArray> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &crate::wire_optional::UnionLargeArray<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum UnionSmallArray { |
| A([u32; 2]), |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::UnionSmallArray<'static>, ___E> |
| for UnionSmallArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::UnionSmallArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::UnionSmallArray { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::A(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| [::fidl_next::WireU32; 2], |
| >(value, 1, encoder, raw, ())?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::UnionSmallArray<'static>, ___E> |
| for &'a UnionSmallArray |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::UnionSmallArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::UnionSmallArray { raw, _phantom: _ } = out); |
| |
| match self { |
| UnionSmallArray::A(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| [::fidl_next::WireU32; 2], |
| >(value, 1, encoder, raw, ())?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> |
| ::fidl_next::EncodeOption<crate::wire_optional::UnionSmallArray<'static>, ___E> |
| for UnionSmallArray |
| where |
| ___E: ?Sized, |
| UnionSmallArray: ::fidl_next::Encode<crate::wire::UnionSmallArray<'static>, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire_optional::UnionSmallArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire_optional::UnionSmallArray { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::Encode::encode(inner, encoder, value_out, ())?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> |
| ::fidl_next::EncodeOption<crate::wire_optional::UnionSmallArray<'static>, ___E> |
| for &'a UnionSmallArray |
| where |
| ___E: ?Sized, |
| &'a UnionSmallArray: ::fidl_next::Encode<crate::wire::UnionSmallArray<'static>, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire_optional::UnionSmallArray<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire_optional::UnionSmallArray { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::Encode::encode(inner, encoder, value_out, ())?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<crate::wire::UnionSmallArray<'de>> for UnionSmallArray { |
| #[inline] |
| fn from_wire(wire: crate::wire::UnionSmallArray<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::A(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<[::fidl_next::WireU32; 2]>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<crate::wire::UnionSmallArray<'de>> for UnionSmallArray { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::UnionSmallArray<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::A(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<[::fidl_next::WireU32; 2]>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::UnionSmallArray<'de>> |
| for UnionSmallArray |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: crate::wire_optional::UnionSmallArray<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.into_option() { |
| Some(::fidl_next::FromWire::from_wire(inner)) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::UnionSmallArray<'de>> |
| for Box<UnionSmallArray> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: crate::wire_optional::UnionSmallArray<'de>, |
| ) -> ::core::option::Option<Self> { |
| <UnionSmallArray as ::fidl_next::FromWireOption< |
| crate::wire_optional::UnionSmallArray<'de>, |
| >>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::UnionSmallArray<'de>> |
| for Box<UnionSmallArray> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &crate::wire_optional::UnionSmallArray<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| } |
| |
| pub mod wire { |
| |
| /// The wire type corresponding to [`StructLargeArray`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct StructLargeArray { |
| pub a: [::fidl_next::WireU32; 100], |
| } |
| |
| static_assertions::const_assert_eq!(std::mem::size_of::<StructLargeArray>(), 400); |
| static_assertions::const_assert_eq!(std::mem::align_of::<StructLargeArray>(), 4); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(StructLargeArray, a), 0); |
| |
| unsafe impl ::fidl_next::Wire for StructLargeArray { |
| type Owned<'de> = StructLargeArray; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| a, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(a); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for StructLargeArray |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut a, |
| |
| } = slot_; |
| } |
| |
| let _field = a.as_mut(); |
| |
| ::fidl_next::Decode::decode(a.as_mut(), decoder_, ())?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for StructLargeArray { |
| type Natural = crate::natural::StructLargeArray; |
| } |
| |
| impl ::fidl_next::Unconstrained for StructLargeArray {} |
| |
| /// The wire type corresponding to [`StructSmallArray`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct StructSmallArray { |
| pub a: [::fidl_next::WireU32; 2], |
| } |
| |
| static_assertions::const_assert_eq!(std::mem::size_of::<StructSmallArray>(), 8); |
| static_assertions::const_assert_eq!(std::mem::align_of::<StructSmallArray>(), 4); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(StructSmallArray, a), 0); |
| |
| unsafe impl ::fidl_next::Wire for StructSmallArray { |
| type Owned<'de> = StructSmallArray; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| a, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(a); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for StructSmallArray |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut a, |
| |
| } = slot_; |
| } |
| |
| let _field = a.as_mut(); |
| |
| ::fidl_next::Decode::decode(a.as_mut(), decoder_, ())?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for StructSmallArray { |
| type Natural = crate::natural::StructSmallArray; |
| } |
| |
| impl ::fidl_next::Unconstrained for StructSmallArray {} |
| |
| /// The wire type corresponding to [`TableLargeArray`]. |
| #[repr(C)] |
| pub struct TableLargeArray<'de> { |
| pub(crate) table: ::fidl_next::WireTable<'de>, |
| } |
| |
| impl<'de> Drop for TableLargeArray<'de> { |
| fn drop(&mut self) { |
| let _ = self.table.get(1).map(|envelope| unsafe { |
| envelope.read_unchecked::<[::fidl_next::WireU32; 100]>() |
| }); |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for TableLargeArray<'static> { |
| type Owned<'de> = TableLargeArray<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { table } = out); |
| ::fidl_next::WireTable::zero_padding(table); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for TableLargeArray<'static> |
| where |
| ___D: ::fidl_next::Decoder + ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { table } = slot); |
| |
| ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| { |
| match ordinal { |
| 0 => unsafe { ::core::hint::unreachable_unchecked() }, |
| |
| 1 => { |
| ::fidl_next::WireEnvelope::decode_as::<___D, [::fidl_next::WireU32; 100]>( |
| slot.as_mut(), |
| decoder, |
| (), |
| )?; |
| |
| Ok(()) |
| } |
| |
| _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder), |
| } |
| }) |
| } |
| } |
| |
| impl<'de> TableLargeArray<'de> { |
| pub fn a(&self) -> ::core::option::Option<&[::fidl_next::WireU32; 100]> { |
| unsafe { Some(self.table.get(1)?.deref_unchecked()) } |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for TableLargeArray<'de> { |
| fn fmt( |
| &self, |
| f: &mut ::core::fmt::Formatter<'_>, |
| ) -> ::core::result::Result<(), ::core::fmt::Error> { |
| f.debug_struct("TableLargeArray").field("a", &self.a()).finish() |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for TableLargeArray<'de> { |
| type Natural = crate::natural::TableLargeArray; |
| } |
| |
| impl ::fidl_next::Unconstrained for TableLargeArray<'_> {} |
| |
| /// The wire type corresponding to [`TableSmallArray`]. |
| #[repr(C)] |
| pub struct TableSmallArray<'de> { |
| pub(crate) table: ::fidl_next::WireTable<'de>, |
| } |
| |
| impl<'de> Drop for TableSmallArray<'de> { |
| fn drop(&mut self) { |
| let _ = self |
| .table |
| .get(1) |
| .map(|envelope| unsafe { envelope.read_unchecked::<[::fidl_next::WireU32; 2]>() }); |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for TableSmallArray<'static> { |
| type Owned<'de> = TableSmallArray<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { table } = out); |
| ::fidl_next::WireTable::zero_padding(table); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for TableSmallArray<'static> |
| where |
| ___D: ::fidl_next::Decoder + ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { table } = slot); |
| |
| ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| { |
| match ordinal { |
| 0 => unsafe { ::core::hint::unreachable_unchecked() }, |
| |
| 1 => { |
| ::fidl_next::WireEnvelope::decode_as::<___D, [::fidl_next::WireU32; 2]>( |
| slot.as_mut(), |
| decoder, |
| (), |
| )?; |
| |
| Ok(()) |
| } |
| |
| _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder), |
| } |
| }) |
| } |
| } |
| |
| impl<'de> TableSmallArray<'de> { |
| pub fn a(&self) -> ::core::option::Option<&[::fidl_next::WireU32; 2]> { |
| unsafe { Some(self.table.get(1)?.deref_unchecked()) } |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for TableSmallArray<'de> { |
| fn fmt( |
| &self, |
| f: &mut ::core::fmt::Formatter<'_>, |
| ) -> ::core::result::Result<(), ::core::fmt::Error> { |
| f.debug_struct("TableSmallArray").field("a", &self.a()).finish() |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for TableSmallArray<'de> { |
| type Natural = crate::natural::TableSmallArray; |
| } |
| |
| impl ::fidl_next::Unconstrained for TableSmallArray<'_> {} |
| |
| /// The wire type corresponding to [`UnionLargeArray`]. |
| #[repr(transparent)] |
| pub struct UnionLargeArray<'de> { |
| pub(crate) raw: ::fidl_next::RawWireUnion, |
| pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for UnionLargeArray<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = |
| unsafe { self.raw.get().read_unchecked::<[::fidl_next::WireU32; 100]>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for UnionLargeArray<'static> { |
| type Owned<'de> = UnionLargeArray<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { raw, _phantom: _ } = out); |
| ::fidl_next::RawWireUnion::zero_padding(raw); |
| } |
| } |
| |
| pub mod union_large_array { |
| pub enum Ref<'de> { |
| A(&'de [::fidl_next::WireU32; 100]), |
| } |
| } |
| |
| impl<'de> UnionLargeArray<'de> { |
| pub fn as_ref(&self) -> crate::wire::union_large_array::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::wire::union_large_array::Ref::A(unsafe { |
| self.raw.get().deref_unchecked::<[::fidl_next::WireU32; 100]>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for UnionLargeArray<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| mut slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut()); |
| match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) { |
| 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [::fidl_next::WireU32; 100]>( |
| raw, |
| decoder, |
| (), |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for UnionLargeArray<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { |
| self.raw.get().deref_unchecked::<[::fidl_next::WireU32; 100]>().fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for UnionLargeArray<'de> { |
| type Natural = crate::natural::UnionLargeArray; |
| } |
| |
| impl ::fidl_next::Unconstrained for UnionLargeArray<'static> {} |
| |
| /// The wire type corresponding to [`UnionSmallArray`]. |
| #[repr(transparent)] |
| pub struct UnionSmallArray<'de> { |
| pub(crate) raw: ::fidl_next::RawWireUnion, |
| pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for UnionSmallArray<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<[::fidl_next::WireU32; 2]>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for UnionSmallArray<'static> { |
| type Owned<'de> = UnionSmallArray<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { raw, _phantom: _ } = out); |
| ::fidl_next::RawWireUnion::zero_padding(raw); |
| } |
| } |
| |
| pub mod union_small_array { |
| pub enum Ref<'de> { |
| A(&'de [::fidl_next::WireU32; 2]), |
| } |
| } |
| |
| impl<'de> UnionSmallArray<'de> { |
| pub fn as_ref(&self) -> crate::wire::union_small_array::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::wire::union_small_array::Ref::A(unsafe { |
| self.raw.get().deref_unchecked::<[::fidl_next::WireU32; 2]>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for UnionSmallArray<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| mut slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut()); |
| match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) { |
| 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [::fidl_next::WireU32; 2]>( |
| raw, |
| decoder, |
| (), |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for UnionSmallArray<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { |
| self.raw.get().deref_unchecked::<[::fidl_next::WireU32; 2]>().fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for UnionSmallArray<'de> { |
| type Natural = crate::natural::UnionSmallArray; |
| } |
| |
| impl ::fidl_next::Unconstrained for UnionSmallArray<'static> {} |
| } |
| |
| pub mod wire_optional { |
| |
| #[repr(transparent)] |
| pub struct UnionLargeArray<'de> { |
| pub(crate) raw: ::fidl_next::RawWireUnion, |
| pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for UnionLargeArray<'static> { |
| type Owned<'de> = UnionLargeArray<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { raw, _phantom: _ } = out); |
| ::fidl_next::RawWireUnion::zero_padding(raw); |
| } |
| } |
| |
| impl<'de> UnionLargeArray<'de> { |
| pub fn is_some(&self) -> bool { |
| self.raw.is_some() |
| } |
| |
| pub fn is_none(&self) -> bool { |
| self.raw.is_none() |
| } |
| |
| pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::UnionLargeArray<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<crate::wire::UnionLargeArray<'de>> { |
| if self.is_some() { |
| Some(crate::wire::UnionLargeArray { |
| raw: self.raw, |
| _phantom: ::core::marker::PhantomData, |
| }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for UnionLargeArray<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| mut slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut()); |
| match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) { |
| 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [::fidl_next::WireU32; 100]>( |
| raw, |
| decoder, |
| (), |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for UnionLargeArray<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for UnionLargeArray<'de> { |
| type Natural = ::core::option::Option<crate::natural::UnionLargeArray>; |
| } |
| |
| impl ::fidl_next::Unconstrained for UnionLargeArray<'static> {} |
| |
| #[repr(transparent)] |
| pub struct UnionSmallArray<'de> { |
| pub(crate) raw: ::fidl_next::RawWireUnion, |
| pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for UnionSmallArray<'static> { |
| type Owned<'de> = UnionSmallArray<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { raw, _phantom: _ } = out); |
| ::fidl_next::RawWireUnion::zero_padding(raw); |
| } |
| } |
| |
| impl<'de> UnionSmallArray<'de> { |
| pub fn is_some(&self) -> bool { |
| self.raw.is_some() |
| } |
| |
| pub fn is_none(&self) -> bool { |
| self.raw.is_none() |
| } |
| |
| pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::UnionSmallArray<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<crate::wire::UnionSmallArray<'de>> { |
| if self.is_some() { |
| Some(crate::wire::UnionSmallArray { |
| raw: self.raw, |
| _phantom: ::core::marker::PhantomData, |
| }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for UnionSmallArray<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| mut slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut()); |
| match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) { |
| 1 => ::fidl_next::RawWireUnion::decode_as::<___D, [::fidl_next::WireU32; 2]>( |
| raw, |
| decoder, |
| (), |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for UnionSmallArray<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for UnionSmallArray<'de> { |
| type Natural = ::core::option::Option<crate::natural::UnionSmallArray>; |
| } |
| |
| impl ::fidl_next::Unconstrained for UnionSmallArray<'static> {} |
| } |
| |
| pub mod generic { |
| |
| pub struct StructLargeArray<T0> { |
| pub a: T0, |
| } |
| |
| unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::StructLargeArray, ___E> |
| for StructLargeArray<T0> |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| T0: ::fidl_next::Encode<[::fidl_next::WireU32; 100], ___E>, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::StructLargeArray>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::StructLargeArray { |
| |
| a, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.a, encoder_, a, ())?; |
| |
| Ok(()) |
| } |
| } |
| |
| pub struct StructSmallArray<T0> { |
| pub a: T0, |
| } |
| |
| unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::StructSmallArray, ___E> |
| for StructSmallArray<T0> |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| T0: ::fidl_next::Encode<[::fidl_next::WireU32; 2], ___E>, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::StructSmallArray>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::StructSmallArray { |
| |
| a, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.a, encoder_, a, ())?; |
| |
| Ok(()) |
| } |
| } |
| } |
| |
| pub use self::natural::*; |
| |
| /// Compatibility shims which mimic some API surfaces of the current Rust bindings. |
| pub mod compat { |
| |
| impl ::fidl_next::CompatFrom<crate::StructLargeArray> for ::fidl_test_arrays::StructLargeArray { |
| #[inline] |
| fn compat_from(value: crate::StructLargeArray) -> Self { |
| Self { a: ::fidl_next::CompatFrom::compat_from(value.a) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_arrays::StructLargeArray> for crate::StructLargeArray { |
| #[inline] |
| fn compat_from(value: ::fidl_test_arrays::StructLargeArray) -> Self { |
| Self { a: ::fidl_next::CompatFrom::compat_from(value.a) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StructSmallArray> for ::fidl_test_arrays::StructSmallArray { |
| #[inline] |
| fn compat_from(value: crate::StructSmallArray) -> Self { |
| Self { a: ::fidl_next::CompatFrom::compat_from(value.a) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_arrays::StructSmallArray> for crate::StructSmallArray { |
| #[inline] |
| fn compat_from(value: ::fidl_test_arrays::StructSmallArray) -> Self { |
| Self { a: ::fidl_next::CompatFrom::compat_from(value.a) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::TableLargeArray> for ::fidl_test_arrays::TableLargeArray { |
| fn compat_from(value: crate::TableLargeArray) -> Self { |
| Self { |
| a: ::fidl_next::CompatFrom::compat_from(value.a), |
| |
| __source_breaking: ::fidl::marker::SourceBreaking, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_arrays::TableLargeArray> for crate::TableLargeArray { |
| fn compat_from(value: ::fidl_test_arrays::TableLargeArray) -> Self { |
| Self { a: ::fidl_next::CompatFrom::compat_from(value.a) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::TableSmallArray> for ::fidl_test_arrays::TableSmallArray { |
| fn compat_from(value: crate::TableSmallArray) -> Self { |
| Self { |
| a: ::fidl_next::CompatFrom::compat_from(value.a), |
| |
| __source_breaking: ::fidl::marker::SourceBreaking, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_arrays::TableSmallArray> for crate::TableSmallArray { |
| fn compat_from(value: ::fidl_test_arrays::TableSmallArray) -> Self { |
| Self { a: ::fidl_next::CompatFrom::compat_from(value.a) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::UnionLargeArray> for ::fidl_test_arrays::UnionLargeArray { |
| fn compat_from(value: crate::UnionLargeArray) -> Self { |
| match value { |
| crate::UnionLargeArray::A(value) => { |
| Self::A(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_arrays::UnionLargeArray> for crate::UnionLargeArray { |
| fn compat_from(value: ::fidl_test_arrays::UnionLargeArray) -> Self { |
| match value { |
| ::fidl_test_arrays::UnionLargeArray::A(value) => { |
| Self::A(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::UnionSmallArray> for ::fidl_test_arrays::UnionSmallArray { |
| fn compat_from(value: crate::UnionSmallArray) -> Self { |
| match value { |
| crate::UnionSmallArray::A(value) => { |
| Self::A(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_arrays::UnionSmallArray> for crate::UnionSmallArray { |
| fn compat_from(value: ::fidl_test_arrays::UnionSmallArray) -> Self { |
| match value { |
| ::fidl_test_arrays::UnionSmallArray::A(value) => { |
| Self::A(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| } |