| // DO NOT EDIT: This file is machine-generated by fidlgen |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)] |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct Empty {} |
| |
| impl ::fidl_next::Encodable for Empty { |
| type Encoded = WireEmpty; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Empty |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| *out_ = ::core::mem::MaybeUninit::zeroed(); |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Empty |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| _empty, |
| |
| |
| } = out_; |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for Empty { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireEmpty>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Empty |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Empty: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> for Empty |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Empty: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<WireEmpty> for Empty { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireEmpty, Self> = |
| unsafe { ::fidl_next::CopyOptimization::enable_if(true) }; |
| |
| #[inline] |
| fn from_wire(wire: WireEmpty) -> Self { |
| Self {} |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireEmpty { |
| type Natural = Empty; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireEmpty> for Empty { |
| #[inline] |
| fn from_wire_ref(wire: &WireEmpty) -> Self { |
| Self {} |
| } |
| } |
| |
| /// The wire type corresponding to [`Empty`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct WireEmpty { |
| _empty: fidl_next::WireEmptyStructPlaceholder, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireEmpty>(), 1); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireEmpty>(), 1); |
| |
| unsafe impl ::fidl_next::Wire for WireEmpty { |
| type Decoded<'de> = WireEmpty; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| _empty, |
| |
| |
| } = &mut *out_; |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireEmpty |
| 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 _empty, |
| |
| |
| } = slot_; |
| } |
| |
| if _empty.as_bytes() != &[0u8] { |
| return Err(::fidl_next::DecodeError::InvalidEmptyStruct); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum EmptyFlexibleUnion { |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for EmptyFlexibleUnion { |
| type Encoded = WireEmptyFlexibleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for EmptyFlexibleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireEmptyFlexibleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EmptyFlexibleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireEmptyFlexibleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for EmptyFlexibleUnion { |
| type EncodedOption = WireOptionalEmptyFlexibleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for EmptyFlexibleUnion |
| where |
| ___E: ?Sized, |
| EmptyFlexibleUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalEmptyFlexibleUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for EmptyFlexibleUnion |
| where |
| ___E: ?Sized, |
| EmptyFlexibleUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalEmptyFlexibleUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireEmptyFlexibleUnion<'de>> for EmptyFlexibleUnion { |
| #[inline] |
| fn from_wire(wire: WireEmptyFlexibleUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireEmptyFlexibleUnion<'de> { |
| type Natural = EmptyFlexibleUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireEmptyFlexibleUnion<'de>> for EmptyFlexibleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireEmptyFlexibleUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalEmptyFlexibleUnion<'de>> for EmptyFlexibleUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalEmptyFlexibleUnion<'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::IntoNatural for WireOptionalEmptyFlexibleUnion<'de> { |
| type Natural = ::core::option::Option<EmptyFlexibleUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalEmptyFlexibleUnion<'de>> |
| for Box<EmptyFlexibleUnion> |
| { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalEmptyFlexibleUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| EmptyFlexibleUnion as ::fidl_next::FromWireOption<WireOptionalEmptyFlexibleUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalEmptyFlexibleUnion<'de>> |
| for Box<EmptyFlexibleUnion> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalEmptyFlexibleUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`EmptyFlexibleUnion`]. |
| #[repr(transparent)] |
| pub struct WireEmptyFlexibleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireEmptyFlexibleUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireEmptyFlexibleUnion<'static> { |
| type Decoded<'de> = WireEmptyFlexibleUnion<'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 empty_flexible_union { |
| pub enum Ref { |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireEmptyFlexibleUnion<'de> { |
| pub fn as_ref(&self) -> crate::empty_flexible_union::Ref { |
| match self.raw.ordinal() { |
| unknown => crate::empty_flexible_union::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireEmptyFlexibleUnion<'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()) { |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireEmptyFlexibleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalEmptyFlexibleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalEmptyFlexibleUnion<'static> { |
| type Decoded<'de> = WireOptionalEmptyFlexibleUnion<'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> WireOptionalEmptyFlexibleUnion<'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<&WireEmptyFlexibleUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireEmptyFlexibleUnion<'de>> { |
| if self.is_some() { |
| Some(WireEmptyFlexibleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalEmptyFlexibleUnion<'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()) { |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalEmptyFlexibleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ExplicitFlexibleUnion { |
| I(i64), |
| |
| F(f32), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for ExplicitFlexibleUnion { |
| type Encoded = WireExplicitFlexibleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExplicitFlexibleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitFlexibleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::F(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, f32>(value, 4, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExplicitFlexibleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitFlexibleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::F(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &f32>(value, 4, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExplicitFlexibleUnion { |
| type EncodedOption = WireOptionalExplicitFlexibleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExplicitFlexibleUnion |
| where |
| ___E: ?Sized, |
| ExplicitFlexibleUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitFlexibleUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for ExplicitFlexibleUnion |
| where |
| ___E: ?Sized, |
| ExplicitFlexibleUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitFlexibleUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireExplicitFlexibleUnion<'de>> for ExplicitFlexibleUnion { |
| #[inline] |
| fn from_wire(wire: WireExplicitFlexibleUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| 4 => Self::F(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireF32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExplicitFlexibleUnion<'de> { |
| type Natural = ExplicitFlexibleUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExplicitFlexibleUnion<'de>> for ExplicitFlexibleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireExplicitFlexibleUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| 4 => Self::F(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireF32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitFlexibleUnion<'de>> |
| for ExplicitFlexibleUnion |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalExplicitFlexibleUnion<'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::IntoNatural for WireOptionalExplicitFlexibleUnion<'de> { |
| type Natural = ::core::option::Option<ExplicitFlexibleUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitFlexibleUnion<'de>> |
| for Box<ExplicitFlexibleUnion> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalExplicitFlexibleUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| <ExplicitFlexibleUnion as ::fidl_next::FromWireOption< |
| WireOptionalExplicitFlexibleUnion<'de>, |
| >>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExplicitFlexibleUnion<'de>> |
| for Box<ExplicitFlexibleUnion> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalExplicitFlexibleUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExplicitFlexibleUnion`]. |
| #[repr(transparent)] |
| pub struct WireExplicitFlexibleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireExplicitFlexibleUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI64>() }; |
| } |
| |
| 4 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireF32>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExplicitFlexibleUnion<'static> { |
| type Decoded<'de> = WireExplicitFlexibleUnion<'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 explicit_flexible_union { |
| pub enum Ref<'de> { |
| I(&'de ::fidl_next::WireI64), |
| |
| F(&'de ::fidl_next::WireF32), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireExplicitFlexibleUnion<'de> { |
| pub fn as_ref(&self) -> crate::explicit_flexible_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::explicit_flexible_union::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| }), |
| |
| 4 => crate::explicit_flexible_union::Ref::F(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireF32>() |
| }), |
| |
| unknown => crate::explicit_flexible_union::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExplicitFlexibleUnion<'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::WireI64>(raw, decoder)?, |
| |
| 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireF32>(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExplicitFlexibleUnion<'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::WireI64>().fmt(f) }, |
| 4 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireF32>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExplicitFlexibleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExplicitFlexibleUnion<'static> { |
| type Decoded<'de> = WireOptionalExplicitFlexibleUnion<'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> WireOptionalExplicitFlexibleUnion<'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<&WireExplicitFlexibleUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExplicitFlexibleUnion<'de>> { |
| if self.is_some() { |
| Some(WireExplicitFlexibleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExplicitFlexibleUnion<'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::WireI64>(raw, decoder)?, |
| |
| 4 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireF32>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalExplicitFlexibleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ExplicitFoo { |
| I(i32), |
| |
| S(::std::string::String), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for ExplicitFoo { |
| type Encoded = WireExplicitFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExplicitFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::string::String>( |
| value, 2, encoder, raw, |
| )?, |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExplicitFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::string::String>( |
| value, 2, encoder, raw, |
| )?, |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExplicitFoo { |
| type EncodedOption = WireOptionalExplicitFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExplicitFoo |
| where |
| ___E: ?Sized, |
| ExplicitFoo: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitFoo { 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<___E> ::fidl_next::EncodeOptionRef<___E> for ExplicitFoo |
| where |
| ___E: ?Sized, |
| ExplicitFoo: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitFoo { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireExplicitFoo<'de>> for ExplicitFoo { |
| #[inline] |
| fn from_wire(wire: WireExplicitFoo<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::S(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExplicitFoo<'de> { |
| type Natural = ExplicitFoo; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExplicitFoo<'de>> for ExplicitFoo { |
| #[inline] |
| fn from_wire_ref(wire: &WireExplicitFoo<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::S(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitFoo<'de>> for ExplicitFoo { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExplicitFoo<'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::IntoNatural for WireOptionalExplicitFoo<'de> { |
| type Natural = ::core::option::Option<ExplicitFoo>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitFoo<'de>> for Box<ExplicitFoo> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExplicitFoo<'de>) -> ::core::option::Option<Self> { |
| < |
| ExplicitFoo as ::fidl_next::FromWireOption<WireOptionalExplicitFoo<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExplicitFoo<'de>> for Box<ExplicitFoo> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalExplicitFoo<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExplicitFoo`]. |
| #[repr(transparent)] |
| pub struct WireExplicitFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireExplicitFoo<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExplicitFoo<'static> { |
| type Decoded<'de> = WireExplicitFoo<'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 explicit_foo { |
| pub enum Ref<'de> { |
| I(&'de ::fidl_next::WireI32), |
| |
| S(&'de ::fidl_next::WireString<'de>), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireExplicitFoo<'de> { |
| pub fn as_ref(&self) -> crate::explicit_foo::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::explicit_foo::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 2 => crate::explicit_foo::Ref::S(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| unknown => crate::explicit_foo::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExplicitFoo<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExplicitFoo<'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::WireI32>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExplicitFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExplicitFoo<'static> { |
| type Decoded<'de> = WireOptionalExplicitFoo<'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> WireOptionalExplicitFoo<'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<&WireExplicitFoo<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExplicitFoo<'de>> { |
| if self.is_some() { |
| Some(WireExplicitFoo { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExplicitFoo<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalExplicitFoo<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct Pizza { |
| pub toppings: ::std::vec::Vec<::std::string::String>, |
| } |
| |
| impl ::fidl_next::Encodable for Pizza { |
| type Encoded = WirePizza<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Pizza |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| toppings, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.toppings, encoder_, toppings)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Pizza |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| toppings, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.toppings, encoder_, toppings)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for Pizza { |
| type EncodedOption = ::fidl_next::WireBox<'static, WirePizza<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Pizza |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Pizza: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> for Pizza |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Pizza: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> ::fidl_next::FromWire<WirePizza<'de>> for Pizza { |
| #[inline] |
| fn from_wire(wire: WirePizza<'de>) -> Self { |
| Self { toppings: ::fidl_next::FromWire::from_wire(wire.toppings) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WirePizza<'de> { |
| type Natural = Pizza; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WirePizza<'de>> for Pizza { |
| #[inline] |
| fn from_wire_ref(wire: &WirePizza<'de>) -> Self { |
| Self { toppings: ::fidl_next::FromWireRef::from_wire_ref(&wire.toppings) } |
| } |
| } |
| |
| /// The wire type corresponding to [`Pizza`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WirePizza<'de> { |
| pub toppings: ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WirePizza<'_>>(), 16); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WirePizza<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WirePizza<'_>, toppings), 0); |
| |
| unsafe impl ::fidl_next::Wire for WirePizza<'static> { |
| type Decoded<'de> = WirePizza<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| toppings, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(toppings); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WirePizza<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut toppings, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(toppings.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct Pasta { |
| pub sauce: ::std::string::String, |
| } |
| |
| impl ::fidl_next::Encodable for Pasta { |
| type Encoded = WirePasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Pasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| sauce, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.sauce, encoder_, sauce)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Pasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| sauce, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.sauce, encoder_, sauce)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for Pasta { |
| type EncodedOption = ::fidl_next::WireBox<'static, WirePasta<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Pasta |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Pasta: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> for Pasta |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Pasta: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> ::fidl_next::FromWire<WirePasta<'de>> for Pasta { |
| #[inline] |
| fn from_wire(wire: WirePasta<'de>) -> Self { |
| Self { sauce: ::fidl_next::FromWire::from_wire(wire.sauce) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WirePasta<'de> { |
| type Natural = Pasta; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WirePasta<'de>> for Pasta { |
| #[inline] |
| fn from_wire_ref(wire: &WirePasta<'de>) -> Self { |
| Self { sauce: ::fidl_next::FromWireRef::from_wire_ref(&wire.sauce) } |
| } |
| } |
| |
| /// The wire type corresponding to [`Pasta`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WirePasta<'de> { |
| pub sauce: ::fidl_next::WireString<'de>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WirePasta<'_>>(), 16); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WirePasta<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WirePasta<'_>, sauce), 0); |
| |
| unsafe impl ::fidl_next::Wire for WirePasta<'static> { |
| type Decoded<'de> = WirePasta<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| sauce, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(sauce); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WirePasta<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut sauce, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(sauce.as_mut(), decoder_)?; |
| |
| let sauce = unsafe { sauce.deref_unchecked() }; |
| |
| if sauce.len() > 16 { |
| return Err(::fidl_next::DecodeError::VectorTooLong { |
| size: sauce.len() as u64, |
| limit: 16, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ExplicitPizzaOrPasta { |
| Pizza(crate::Pizza), |
| |
| Pasta(crate::Pasta), |
| } |
| |
| impl ::fidl_next::Encodable for ExplicitPizzaOrPasta { |
| type Encoded = WireExplicitPizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExplicitPizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitPizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pasta>(value, 4, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExplicitPizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitPizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pasta>(value, 4, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExplicitPizzaOrPasta { |
| type EncodedOption = WireOptionalExplicitPizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExplicitPizzaOrPasta |
| where |
| ___E: ?Sized, |
| ExplicitPizzaOrPasta: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitPizzaOrPasta { 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<___E> ::fidl_next::EncodeOptionRef<___E> for ExplicitPizzaOrPasta |
| where |
| ___E: ?Sized, |
| ExplicitPizzaOrPasta: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitPizzaOrPasta { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireExplicitPizzaOrPasta<'de>> for ExplicitPizzaOrPasta { |
| #[inline] |
| fn from_wire(wire: WireExplicitPizzaOrPasta<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 4 => Self::Pasta(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExplicitPizzaOrPasta<'de> { |
| type Natural = ExplicitPizzaOrPasta; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExplicitPizzaOrPasta<'de>> for ExplicitPizzaOrPasta { |
| #[inline] |
| fn from_wire_ref(wire: &WireExplicitPizzaOrPasta<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 4 => Self::Pasta(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitPizzaOrPasta<'de>> |
| for ExplicitPizzaOrPasta |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalExplicitPizzaOrPasta<'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::IntoNatural for WireOptionalExplicitPizzaOrPasta<'de> { |
| type Natural = ::core::option::Option<ExplicitPizzaOrPasta>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitPizzaOrPasta<'de>> |
| for Box<ExplicitPizzaOrPasta> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalExplicitPizzaOrPasta<'de>, |
| ) -> ::core::option::Option<Self> { |
| <ExplicitPizzaOrPasta as ::fidl_next::FromWireOption< |
| WireOptionalExplicitPizzaOrPasta<'de>, |
| >>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExplicitPizzaOrPasta<'de>> |
| for Box<ExplicitPizzaOrPasta> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalExplicitPizzaOrPasta<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExplicitPizzaOrPasta`]. |
| #[repr(transparent)] |
| pub struct WireExplicitPizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireExplicitPizzaOrPasta<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePizza<'de>>() }; |
| } |
| |
| 4 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePasta<'de>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExplicitPizzaOrPasta<'static> { |
| type Decoded<'de> = WireExplicitPizzaOrPasta<'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 explicit_pizza_or_pasta { |
| pub enum Ref<'de> { |
| Pizza(&'de crate::WirePizza<'de>), |
| |
| Pasta(&'de crate::WirePasta<'de>), |
| } |
| } |
| |
| impl<'de> WireExplicitPizzaOrPasta<'de> { |
| pub fn as_ref(&self) -> crate::explicit_pizza_or_pasta::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::explicit_pizza_or_pasta::Ref::Pizza(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePizza<'_>>() |
| }), |
| |
| 4 => crate::explicit_pizza_or_pasta::Ref::Pasta(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePasta<'_>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExplicitPizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExplicitPizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { self.raw.get().deref_unchecked::<crate::WirePizza<'_>>().fmt(f) }, |
| 4 => unsafe { self.raw.get().deref_unchecked::<crate::WirePasta<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExplicitPizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExplicitPizzaOrPasta<'static> { |
| type Decoded<'de> = WireOptionalExplicitPizzaOrPasta<'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> WireOptionalExplicitPizzaOrPasta<'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<&WireExplicitPizzaOrPasta<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExplicitPizzaOrPasta<'de>> { |
| if self.is_some() { |
| Some(WireExplicitPizzaOrPasta { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExplicitPizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 4 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalExplicitPizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ExplicitStrictFoo { |
| I(i32), |
| |
| S(::std::string::String), |
| } |
| |
| impl ::fidl_next::Encodable for ExplicitStrictFoo { |
| type Encoded = WireExplicitStrictFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExplicitStrictFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitStrictFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 2, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::string::String>( |
| value, 3, encoder, raw, |
| )?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExplicitStrictFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitStrictFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 2, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::string::String>( |
| value, 3, encoder, raw, |
| )?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExplicitStrictFoo { |
| type EncodedOption = WireOptionalExplicitStrictFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExplicitStrictFoo |
| where |
| ___E: ?Sized, |
| ExplicitStrictFoo: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitStrictFoo { 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<___E> ::fidl_next::EncodeOptionRef<___E> for ExplicitStrictFoo |
| where |
| ___E: ?Sized, |
| ExplicitStrictFoo: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitStrictFoo { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireExplicitStrictFoo<'de>> for ExplicitStrictFoo { |
| #[inline] |
| fn from_wire(wire: WireExplicitStrictFoo<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 2 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 3 => Self::S(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExplicitStrictFoo<'de> { |
| type Natural = ExplicitStrictFoo; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExplicitStrictFoo<'de>> for ExplicitStrictFoo { |
| #[inline] |
| fn from_wire_ref(wire: &WireExplicitStrictFoo<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 2 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 3 => Self::S(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitStrictFoo<'de>> for ExplicitStrictFoo { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExplicitStrictFoo<'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::IntoNatural for WireOptionalExplicitStrictFoo<'de> { |
| type Natural = ::core::option::Option<ExplicitStrictFoo>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitStrictFoo<'de>> |
| for Box<ExplicitStrictFoo> |
| { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExplicitStrictFoo<'de>) -> ::core::option::Option<Self> { |
| < |
| ExplicitStrictFoo as ::fidl_next::FromWireOption<WireOptionalExplicitStrictFoo<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExplicitStrictFoo<'de>> |
| for Box<ExplicitStrictFoo> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalExplicitStrictFoo<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExplicitStrictFoo`]. |
| #[repr(transparent)] |
| pub struct WireExplicitStrictFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireExplicitStrictFoo<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExplicitStrictFoo<'static> { |
| type Decoded<'de> = WireExplicitStrictFoo<'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 explicit_strict_foo { |
| pub enum Ref<'de> { |
| I(&'de ::fidl_next::WireI32), |
| |
| S(&'de ::fidl_next::WireString<'de>), |
| } |
| } |
| |
| impl<'de> WireExplicitStrictFoo<'de> { |
| pub fn as_ref(&self) -> crate::explicit_strict_foo::Ref<'_> { |
| match self.raw.ordinal() { |
| 2 => crate::explicit_strict_foo::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 3 => crate::explicit_strict_foo::Ref::S(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExplicitStrictFoo<'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()) { |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExplicitStrictFoo<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) }, |
| 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExplicitStrictFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExplicitStrictFoo<'static> { |
| type Decoded<'de> = WireOptionalExplicitStrictFoo<'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> WireOptionalExplicitStrictFoo<'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<&WireExplicitStrictFoo<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExplicitStrictFoo<'de>> { |
| if self.is_some() { |
| Some(WireExplicitStrictFoo { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExplicitStrictFoo<'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()) { |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalExplicitStrictFoo<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ExplicitUnion { |
| Primitive(i32), |
| |
| StringNeedsConstructor(::std::string::String), |
| } |
| |
| impl ::fidl_next::Encodable for ExplicitUnion { |
| type Encoded = WireExplicitUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExplicitUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| ::std::string::String, |
| >(value, 3, encoder, raw)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExplicitUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireExplicitUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| &::std::string::String, |
| >(value, 3, encoder, raw)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExplicitUnion { |
| type EncodedOption = WireOptionalExplicitUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExplicitUnion |
| where |
| ___E: ?Sized, |
| ExplicitUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for ExplicitUnion |
| where |
| ___E: ?Sized, |
| ExplicitUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalExplicitUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireExplicitUnion<'de>> for ExplicitUnion { |
| #[inline] |
| fn from_wire(wire: WireExplicitUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 3 => Self::StringNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExplicitUnion<'de> { |
| type Natural = ExplicitUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExplicitUnion<'de>> for ExplicitUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireExplicitUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 3 => Self::StringNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitUnion<'de>> for ExplicitUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExplicitUnion<'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::IntoNatural for WireOptionalExplicitUnion<'de> { |
| type Natural = ::core::option::Option<ExplicitUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExplicitUnion<'de>> for Box<ExplicitUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExplicitUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| ExplicitUnion as ::fidl_next::FromWireOption<WireOptionalExplicitUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExplicitUnion<'de>> for Box<ExplicitUnion> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalExplicitUnion<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExplicitUnion`]. |
| #[repr(transparent)] |
| pub struct WireExplicitUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireExplicitUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExplicitUnion<'static> { |
| type Decoded<'de> = WireExplicitUnion<'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 explicit_union { |
| pub enum Ref<'de> { |
| Primitive(&'de ::fidl_next::WireI32), |
| |
| StringNeedsConstructor(&'de ::fidl_next::WireString<'de>), |
| } |
| } |
| |
| impl<'de> WireExplicitUnion<'de> { |
| pub fn as_ref(&self) -> crate::explicit_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::explicit_union::Ref::Primitive(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 3 => crate::explicit_union::Ref::StringNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExplicitUnion<'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::WireI32>(raw, decoder)?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExplicitUnion<'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::WireI32>().fmt(f) }, |
| 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExplicitUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExplicitUnion<'static> { |
| type Decoded<'de> = WireOptionalExplicitUnion<'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> WireOptionalExplicitUnion<'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<&WireExplicitUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExplicitUnion<'de>> { |
| if self.is_some() { |
| Some(WireExplicitUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExplicitUnion<'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::WireI32>(raw, decoder)?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalExplicitUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum FieldCollision { |
| FieldCollisionTag(i32), |
| } |
| |
| impl ::fidl_next::Encodable for FieldCollision { |
| type Encoded = WireFieldCollision; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for FieldCollision |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFieldCollision { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::FieldCollisionTag(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, i32>(value, 1, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FieldCollision |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFieldCollision { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::FieldCollisionTag(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for FieldCollision { |
| type EncodedOption = WireOptionalFieldCollision; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for FieldCollision |
| where |
| ___E: ?Sized, |
| FieldCollision: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFieldCollision { 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<___E> ::fidl_next::EncodeOptionRef<___E> for FieldCollision |
| where |
| ___E: ?Sized, |
| FieldCollision: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFieldCollision { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireFieldCollision> for FieldCollision { |
| #[inline] |
| fn from_wire(wire: WireFieldCollision) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::FieldCollisionTag(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireFieldCollision { |
| type Natural = FieldCollision; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireFieldCollision> for FieldCollision { |
| #[inline] |
| fn from_wire_ref(wire: &WireFieldCollision) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::FieldCollisionTag(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWireOption<WireOptionalFieldCollision> for FieldCollision { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalFieldCollision) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.into_option() { |
| Some(::fidl_next::FromWire::from_wire(inner)) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireOptionalFieldCollision { |
| type Natural = ::core::option::Option<FieldCollision>; |
| } |
| |
| impl ::fidl_next::FromWireOption<WireOptionalFieldCollision> for Box<FieldCollision> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalFieldCollision) -> ::core::option::Option<Self> { |
| < |
| FieldCollision as ::fidl_next::FromWireOption<WireOptionalFieldCollision> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl ::fidl_next::FromWireOptionRef<WireOptionalFieldCollision> for Box<FieldCollision> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalFieldCollision) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`FieldCollision`]. |
| #[repr(transparent)] |
| pub struct WireFieldCollision { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<()>, |
| } |
| |
| impl Drop for WireFieldCollision { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFieldCollision { |
| type Decoded<'de> = WireFieldCollision; |
| |
| #[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 field_collision { |
| pub enum Ref<'de> { |
| FieldCollisionTag(&'de ::fidl_next::WireI32), |
| } |
| } |
| |
| impl WireFieldCollision { |
| pub fn as_ref(&self) -> crate::field_collision::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::field_collision::Ref::FieldCollisionTag(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl Clone for WireFieldCollision { |
| fn clone(&self) -> Self { |
| match self.raw.ordinal() { |
| 1 => Self { |
| raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireI32>() }, |
| _phantom: ::core::marker::PhantomData, |
| }, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireFieldCollision |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| { |
| 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_static::<___D, ::fidl_next::WireI32>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::fmt::Debug for WireFieldCollision { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalFieldCollision { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<()>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalFieldCollision { |
| type Decoded<'de> = WireOptionalFieldCollision; |
| |
| #[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 WireOptionalFieldCollision { |
| 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<&WireFieldCollision> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireFieldCollision> { |
| if self.is_some() { |
| Some(WireFieldCollision { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl Clone for WireOptionalFieldCollision { |
| fn clone(&self) -> Self { |
| if self.is_none() { |
| return WireOptionalFieldCollision { |
| raw: ::fidl_next::RawWireUnion::absent(), |
| _phantom: ::core::marker::PhantomData, |
| }; |
| } |
| |
| match self.raw.ordinal() { |
| 1 => Self { |
| raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireI32>() }, |
| _phantom: ::core::marker::PhantomData, |
| }, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalFieldCollision |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| { |
| 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_static::<___D, ::fidl_next::WireI32>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::fmt::Debug for WireOptionalFieldCollision { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum FlexibleFoo { |
| S(::std::string::String), |
| |
| I(i32), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for FlexibleFoo { |
| type Encoded = WireFlexibleFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for FlexibleFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexibleFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::string::String>( |
| value, 1, encoder, raw, |
| )?, |
| |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FlexibleFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexibleFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::string::String>( |
| value, 1, encoder, raw, |
| )?, |
| |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for FlexibleFoo { |
| type EncodedOption = WireOptionalFlexibleFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for FlexibleFoo |
| where |
| ___E: ?Sized, |
| FlexibleFoo: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFlexibleFoo { 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<___E> ::fidl_next::EncodeOptionRef<___E> for FlexibleFoo |
| where |
| ___E: ?Sized, |
| FlexibleFoo: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFlexibleFoo { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireFlexibleFoo<'de>> for FlexibleFoo { |
| #[inline] |
| fn from_wire(wire: WireFlexibleFoo<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::S(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 2 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireFlexibleFoo<'de> { |
| type Natural = FlexibleFoo; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireFlexibleFoo<'de>> for FlexibleFoo { |
| #[inline] |
| fn from_wire_ref(wire: &WireFlexibleFoo<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::S(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 2 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalFlexibleFoo<'de>> for FlexibleFoo { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalFlexibleFoo<'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::IntoNatural for WireOptionalFlexibleFoo<'de> { |
| type Natural = ::core::option::Option<FlexibleFoo>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalFlexibleFoo<'de>> for Box<FlexibleFoo> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalFlexibleFoo<'de>) -> ::core::option::Option<Self> { |
| < |
| FlexibleFoo as ::fidl_next::FromWireOption<WireOptionalFlexibleFoo<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalFlexibleFoo<'de>> for Box<FlexibleFoo> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalFlexibleFoo<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`FlexibleFoo`]. |
| #[repr(transparent)] |
| pub struct WireFlexibleFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireFlexibleFoo<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFlexibleFoo<'static> { |
| type Decoded<'de> = WireFlexibleFoo<'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 flexible_foo { |
| pub enum Ref<'de> { |
| S(&'de ::fidl_next::WireString<'de>), |
| |
| I(&'de ::fidl_next::WireI32), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireFlexibleFoo<'de> { |
| pub fn as_ref(&self) -> crate::flexible_foo::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::flexible_foo::Ref::S(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| 2 => crate::flexible_foo::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| unknown => crate::flexible_foo::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireFlexibleFoo<'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::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireFlexibleFoo<'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::WireString<'_>>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalFlexibleFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalFlexibleFoo<'static> { |
| type Decoded<'de> = WireOptionalFlexibleFoo<'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> WireOptionalFlexibleFoo<'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<&WireFlexibleFoo<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireFlexibleFoo<'de>> { |
| if self.is_some() { |
| Some(WireFlexibleFoo { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalFlexibleFoo<'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::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalFlexibleFoo<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum FlexiblePizzaOrPasta { |
| Pizza(crate::Pizza), |
| |
| Pasta(crate::Pasta), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for FlexiblePizzaOrPasta { |
| type Encoded = WireFlexiblePizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for FlexiblePizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexiblePizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pasta>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FlexiblePizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexiblePizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pasta>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for FlexiblePizzaOrPasta { |
| type EncodedOption = WireOptionalFlexiblePizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for FlexiblePizzaOrPasta |
| where |
| ___E: ?Sized, |
| FlexiblePizzaOrPasta: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFlexiblePizzaOrPasta { 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<___E> ::fidl_next::EncodeOptionRef<___E> for FlexiblePizzaOrPasta |
| where |
| ___E: ?Sized, |
| FlexiblePizzaOrPasta: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFlexiblePizzaOrPasta { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireFlexiblePizzaOrPasta<'de>> for FlexiblePizzaOrPasta { |
| #[inline] |
| fn from_wire(wire: WireFlexiblePizzaOrPasta<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 2 => Self::Pasta(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireFlexiblePizzaOrPasta<'de> { |
| type Natural = FlexiblePizzaOrPasta; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireFlexiblePizzaOrPasta<'de>> for FlexiblePizzaOrPasta { |
| #[inline] |
| fn from_wire_ref(wire: &WireFlexiblePizzaOrPasta<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 2 => Self::Pasta(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalFlexiblePizzaOrPasta<'de>> |
| for FlexiblePizzaOrPasta |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalFlexiblePizzaOrPasta<'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::IntoNatural for WireOptionalFlexiblePizzaOrPasta<'de> { |
| type Natural = ::core::option::Option<FlexiblePizzaOrPasta>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalFlexiblePizzaOrPasta<'de>> |
| for Box<FlexiblePizzaOrPasta> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalFlexiblePizzaOrPasta<'de>, |
| ) -> ::core::option::Option<Self> { |
| <FlexiblePizzaOrPasta as ::fidl_next::FromWireOption< |
| WireOptionalFlexiblePizzaOrPasta<'de>, |
| >>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalFlexiblePizzaOrPasta<'de>> |
| for Box<FlexiblePizzaOrPasta> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalFlexiblePizzaOrPasta<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`FlexiblePizzaOrPasta`]. |
| #[repr(transparent)] |
| pub struct WireFlexiblePizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireFlexiblePizzaOrPasta<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePizza<'de>>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePasta<'de>>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFlexiblePizzaOrPasta<'static> { |
| type Decoded<'de> = WireFlexiblePizzaOrPasta<'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 flexible_pizza_or_pasta { |
| pub enum Ref<'de> { |
| Pizza(&'de crate::WirePizza<'de>), |
| |
| Pasta(&'de crate::WirePasta<'de>), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireFlexiblePizzaOrPasta<'de> { |
| pub fn as_ref(&self) -> crate::flexible_pizza_or_pasta::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::flexible_pizza_or_pasta::Ref::Pizza(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePizza<'_>>() |
| }), |
| |
| 2 => crate::flexible_pizza_or_pasta::Ref::Pasta(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePasta<'_>>() |
| }), |
| |
| unknown => crate::flexible_pizza_or_pasta::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireFlexiblePizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireFlexiblePizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { self.raw.get().deref_unchecked::<crate::WirePizza<'_>>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<crate::WirePasta<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalFlexiblePizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalFlexiblePizzaOrPasta<'static> { |
| type Decoded<'de> = WireOptionalFlexiblePizzaOrPasta<'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> WireOptionalFlexiblePizzaOrPasta<'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<&WireFlexiblePizzaOrPasta<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireFlexiblePizzaOrPasta<'de>> { |
| if self.is_some() { |
| Some(WireFlexiblePizzaOrPasta { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalFlexiblePizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalFlexiblePizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum FlexibleUnion { |
| Primitive(i32), |
| |
| StringNeedsConstructor(::std::string::String), |
| |
| VectorStringAlsoNeedsConstructor(::std::vec::Vec<::std::string::String>), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for FlexibleUnion { |
| type Encoded = WireFlexibleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for FlexibleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexibleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| ::std::string::String, |
| >(value, 2, encoder, raw)?, |
| |
| Self::VectorStringAlsoNeedsConstructor(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, ::std::vec::Vec<::std::string::String>>( |
| value, 3, encoder, raw, |
| )? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FlexibleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexibleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| &::std::string::String, |
| >(value, 2, encoder, raw)?, |
| |
| Self::VectorStringAlsoNeedsConstructor(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &::std::vec::Vec<::std::string::String>>( |
| value, 3, encoder, raw, |
| )? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for FlexibleUnion { |
| type EncodedOption = WireOptionalFlexibleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for FlexibleUnion |
| where |
| ___E: ?Sized, |
| FlexibleUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFlexibleUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for FlexibleUnion |
| where |
| ___E: ?Sized, |
| FlexibleUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalFlexibleUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireFlexibleUnion<'de>> for FlexibleUnion { |
| #[inline] |
| fn from_wire(wire: WireFlexibleUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::StringNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| })) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireFlexibleUnion<'de> { |
| type Natural = FlexibleUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireFlexibleUnion<'de>> for FlexibleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireFlexibleUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::StringNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => Self::VectorStringAlsoNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref( |
| unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }, |
| )), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalFlexibleUnion<'de>> for FlexibleUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalFlexibleUnion<'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::IntoNatural for WireOptionalFlexibleUnion<'de> { |
| type Natural = ::core::option::Option<FlexibleUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalFlexibleUnion<'de>> for Box<FlexibleUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalFlexibleUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| FlexibleUnion as ::fidl_next::FromWireOption<WireOptionalFlexibleUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalFlexibleUnion<'de>> for Box<FlexibleUnion> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalFlexibleUnion<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`FlexibleUnion`]. |
| #[repr(transparent)] |
| pub struct WireFlexibleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireFlexibleUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { |
| self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFlexibleUnion<'static> { |
| type Decoded<'de> = WireFlexibleUnion<'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 flexible_union { |
| pub enum Ref<'de> { |
| Primitive(&'de ::fidl_next::WireI32), |
| |
| StringNeedsConstructor(&'de ::fidl_next::WireString<'de>), |
| |
| VectorStringAlsoNeedsConstructor( |
| &'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>, |
| ), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireFlexibleUnion<'de> { |
| pub fn as_ref(&self) -> crate::flexible_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::flexible_union::Ref::Primitive(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 2 => crate::flexible_union::Ref::StringNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| 3 => { |
| crate::flexible_union::Ref::VectorStringAlsoNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| }) |
| } |
| |
| unknown => crate::flexible_union::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireFlexibleUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireFlexibleUnion<'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::WireI32>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| 3 => unsafe { |
| self.raw |
| .get() |
| .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| .fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalFlexibleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalFlexibleUnion<'static> { |
| type Decoded<'de> = WireOptionalFlexibleUnion<'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> WireOptionalFlexibleUnion<'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<&WireFlexibleUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireFlexibleUnion<'de>> { |
| if self.is_some() { |
| Some(WireFlexibleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalFlexibleUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalFlexibleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum NewerSimpleUnion { |
| I(i64), |
| |
| S(::std::string::String), |
| |
| V(::std::vec::Vec<::std::string::String>), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for NewerSimpleUnion { |
| type Encoded = WireNewerSimpleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for NewerSimpleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireNewerSimpleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::string::String>( |
| value, 2, encoder, raw, |
| )?, |
| |
| Self::V(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| ::std::vec::Vec<::std::string::String>, |
| >(value, 3, encoder, raw)?, |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NewerSimpleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireNewerSimpleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::string::String>( |
| value, 2, encoder, raw, |
| )?, |
| |
| Self::V(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| &::std::vec::Vec<::std::string::String>, |
| >(value, 3, encoder, raw)?, |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for NewerSimpleUnion { |
| type EncodedOption = WireOptionalNewerSimpleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NewerSimpleUnion |
| where |
| ___E: ?Sized, |
| NewerSimpleUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalNewerSimpleUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for NewerSimpleUnion |
| where |
| ___E: ?Sized, |
| NewerSimpleUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalNewerSimpleUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireNewerSimpleUnion<'de>> for NewerSimpleUnion { |
| #[inline] |
| fn from_wire(wire: WireNewerSimpleUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| 2 => Self::S(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => { |
| Self::V(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| })) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireNewerSimpleUnion<'de> { |
| type Natural = NewerSimpleUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireNewerSimpleUnion<'de>> for NewerSimpleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireNewerSimpleUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| 2 => Self::S(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => { |
| Self::V(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| })) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalNewerSimpleUnion<'de>> for NewerSimpleUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalNewerSimpleUnion<'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::IntoNatural for WireOptionalNewerSimpleUnion<'de> { |
| type Natural = ::core::option::Option<NewerSimpleUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalNewerSimpleUnion<'de>> for Box<NewerSimpleUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalNewerSimpleUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| NewerSimpleUnion as ::fidl_next::FromWireOption<WireOptionalNewerSimpleUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalNewerSimpleUnion<'de>> |
| for Box<NewerSimpleUnion> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalNewerSimpleUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`NewerSimpleUnion`]. |
| #[repr(transparent)] |
| pub struct WireNewerSimpleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireNewerSimpleUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI64>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { |
| self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireNewerSimpleUnion<'static> { |
| type Decoded<'de> = WireNewerSimpleUnion<'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 newer_simple_union { |
| pub enum Ref<'de> { |
| I(&'de ::fidl_next::WireI64), |
| |
| S(&'de ::fidl_next::WireString<'de>), |
| |
| V(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireNewerSimpleUnion<'de> { |
| pub fn as_ref(&self) -> crate::newer_simple_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::newer_simple_union::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| }), |
| |
| 2 => crate::newer_simple_union::Ref::S(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| 3 => { |
| crate::newer_simple_union::Ref::V(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| }) |
| } |
| |
| unknown => crate::newer_simple_union::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireNewerSimpleUnion<'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::WireI64>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireNewerSimpleUnion<'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::WireI64>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| 3 => unsafe { |
| self.raw |
| .get() |
| .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| .fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalNewerSimpleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalNewerSimpleUnion<'static> { |
| type Decoded<'de> = WireOptionalNewerSimpleUnion<'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> WireOptionalNewerSimpleUnion<'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<&WireNewerSimpleUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireNewerSimpleUnion<'de>> { |
| if self.is_some() { |
| Some(WireNewerSimpleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalNewerSimpleUnion<'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::WireI64>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalNewerSimpleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct NullableUnionStruct { |
| pub the_union: ::core::option::Option<::std::boxed::Box<crate::Union>>, |
| } |
| |
| impl ::fidl_next::Encodable for NullableUnionStruct { |
| type Encoded = WireNullableUnionStruct<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for NullableUnionStruct |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| the_union, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.the_union, encoder_, the_union)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for NullableUnionStruct |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| the_union, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.the_union, encoder_, the_union)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for NullableUnionStruct { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireNullableUnionStruct<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NullableUnionStruct |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| NullableUnionStruct: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> for NullableUnionStruct |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| NullableUnionStruct: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> ::fidl_next::FromWire<WireNullableUnionStruct<'de>> for NullableUnionStruct { |
| #[inline] |
| fn from_wire(wire: WireNullableUnionStruct<'de>) -> Self { |
| Self { the_union: ::fidl_next::FromWire::from_wire(wire.the_union) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireNullableUnionStruct<'de> { |
| type Natural = NullableUnionStruct; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireNullableUnionStruct<'de>> for NullableUnionStruct { |
| #[inline] |
| fn from_wire_ref(wire: &WireNullableUnionStruct<'de>) -> Self { |
| Self { the_union: ::fidl_next::FromWireRef::from_wire_ref(&wire.the_union) } |
| } |
| } |
| |
| /// The wire type corresponding to [`NullableUnionStruct`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireNullableUnionStruct<'de> { |
| pub the_union: crate::WireOptionalUnion<'de>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireNullableUnionStruct<'_>>(), 16); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireNullableUnionStruct<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!(WireNullableUnionStruct<'_>, the_union), |
| 0 |
| ); |
| |
| unsafe impl ::fidl_next::Wire for WireNullableUnionStruct<'static> { |
| type Decoded<'de> = WireNullableUnionStruct<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| the_union, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(the_union); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireNullableUnionStruct<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut the_union, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(the_union.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum OlderSimpleUnion { |
| I(i64), |
| |
| F(f32), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for OlderSimpleUnion { |
| type Encoded = WireOlderSimpleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for OlderSimpleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOlderSimpleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::F(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, f32>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OlderSimpleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOlderSimpleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::F(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &f32>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for OlderSimpleUnion { |
| type EncodedOption = WireOptionalOlderSimpleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for OlderSimpleUnion |
| where |
| ___E: ?Sized, |
| OlderSimpleUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalOlderSimpleUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for OlderSimpleUnion |
| where |
| ___E: ?Sized, |
| OlderSimpleUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalOlderSimpleUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireOlderSimpleUnion<'de>> for OlderSimpleUnion { |
| #[inline] |
| fn from_wire(wire: WireOlderSimpleUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| 2 => Self::F(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireF32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireOlderSimpleUnion<'de> { |
| type Natural = OlderSimpleUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireOlderSimpleUnion<'de>> for OlderSimpleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireOlderSimpleUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| 2 => Self::F(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireF32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalOlderSimpleUnion<'de>> for OlderSimpleUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalOlderSimpleUnion<'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::IntoNatural for WireOptionalOlderSimpleUnion<'de> { |
| type Natural = ::core::option::Option<OlderSimpleUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalOlderSimpleUnion<'de>> for Box<OlderSimpleUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalOlderSimpleUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| OlderSimpleUnion as ::fidl_next::FromWireOption<WireOptionalOlderSimpleUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalOlderSimpleUnion<'de>> |
| for Box<OlderSimpleUnion> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalOlderSimpleUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`OlderSimpleUnion`]. |
| #[repr(transparent)] |
| pub struct WireOlderSimpleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireOlderSimpleUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI64>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireF32>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOlderSimpleUnion<'static> { |
| type Decoded<'de> = WireOlderSimpleUnion<'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 older_simple_union { |
| pub enum Ref<'de> { |
| I(&'de ::fidl_next::WireI64), |
| |
| F(&'de ::fidl_next::WireF32), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireOlderSimpleUnion<'de> { |
| pub fn as_ref(&self) -> crate::older_simple_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::older_simple_union::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| }), |
| |
| 2 => crate::older_simple_union::Ref::F(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireF32>() |
| }), |
| |
| unknown => crate::older_simple_union::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOlderSimpleUnion<'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::WireI64>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireF32>(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOlderSimpleUnion<'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::WireI64>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireF32>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalOlderSimpleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalOlderSimpleUnion<'static> { |
| type Decoded<'de> = WireOptionalOlderSimpleUnion<'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> WireOptionalOlderSimpleUnion<'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<&WireOlderSimpleUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireOlderSimpleUnion<'de>> { |
| if self.is_some() { |
| Some(WireOlderSimpleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalOlderSimpleUnion<'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::WireI64>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireF32>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalOlderSimpleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum PizzaOrPasta { |
| Pizza(crate::Pizza), |
| |
| Pasta(crate::Pasta), |
| } |
| |
| impl ::fidl_next::Encodable for PizzaOrPasta { |
| type Encoded = WirePizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for PizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WirePizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pasta>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for PizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WirePizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pasta>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for PizzaOrPasta { |
| type EncodedOption = WireOptionalPizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for PizzaOrPasta |
| where |
| ___E: ?Sized, |
| PizzaOrPasta: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalPizzaOrPasta { 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<___E> ::fidl_next::EncodeOptionRef<___E> for PizzaOrPasta |
| where |
| ___E: ?Sized, |
| PizzaOrPasta: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalPizzaOrPasta { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WirePizzaOrPasta<'de>> for PizzaOrPasta { |
| #[inline] |
| fn from_wire(wire: WirePizzaOrPasta<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 2 => Self::Pasta(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WirePizzaOrPasta<'de> { |
| type Natural = PizzaOrPasta; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WirePizzaOrPasta<'de>> for PizzaOrPasta { |
| #[inline] |
| fn from_wire_ref(wire: &WirePizzaOrPasta<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 2 => Self::Pasta(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalPizzaOrPasta<'de>> for PizzaOrPasta { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalPizzaOrPasta<'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::IntoNatural for WireOptionalPizzaOrPasta<'de> { |
| type Natural = ::core::option::Option<PizzaOrPasta>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalPizzaOrPasta<'de>> for Box<PizzaOrPasta> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalPizzaOrPasta<'de>) -> ::core::option::Option<Self> { |
| < |
| PizzaOrPasta as ::fidl_next::FromWireOption<WireOptionalPizzaOrPasta<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalPizzaOrPasta<'de>> for Box<PizzaOrPasta> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalPizzaOrPasta<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`PizzaOrPasta`]. |
| #[repr(transparent)] |
| pub struct WirePizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WirePizzaOrPasta<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePizza<'de>>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePasta<'de>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WirePizzaOrPasta<'static> { |
| type Decoded<'de> = WirePizzaOrPasta<'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 pizza_or_pasta { |
| pub enum Ref<'de> { |
| Pizza(&'de crate::WirePizza<'de>), |
| |
| Pasta(&'de crate::WirePasta<'de>), |
| } |
| } |
| |
| impl<'de> WirePizzaOrPasta<'de> { |
| pub fn as_ref(&self) -> crate::pizza_or_pasta::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::pizza_or_pasta::Ref::Pizza(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePizza<'_>>() |
| }), |
| |
| 2 => crate::pizza_or_pasta::Ref::Pasta(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePasta<'_>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WirePizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WirePizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { self.raw.get().deref_unchecked::<crate::WirePizza<'_>>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<crate::WirePasta<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalPizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalPizzaOrPasta<'static> { |
| type Decoded<'de> = WireOptionalPizzaOrPasta<'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> WireOptionalPizzaOrPasta<'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<&WirePizzaOrPasta<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WirePizzaOrPasta<'de>> { |
| if self.is_some() { |
| Some(WirePizzaOrPasta { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalPizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalPizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ReverseOrdinalUnion { |
| First(u32), |
| |
| Second(u32), |
| } |
| |
| impl ::fidl_next::Encodable for ReverseOrdinalUnion { |
| type Encoded = WireReverseOrdinalUnion; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ReverseOrdinalUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireReverseOrdinalUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::First(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, u32>(value, 1, encoder, raw)? |
| } |
| |
| Self::Second(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, u32>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ReverseOrdinalUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireReverseOrdinalUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::First(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, &u32>(value, 1, encoder, raw)? |
| } |
| |
| Self::Second(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, &u32>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ReverseOrdinalUnion { |
| type EncodedOption = WireOptionalReverseOrdinalUnion; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ReverseOrdinalUnion |
| where |
| ___E: ?Sized, |
| ReverseOrdinalUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalReverseOrdinalUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for ReverseOrdinalUnion |
| where |
| ___E: ?Sized, |
| ReverseOrdinalUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalReverseOrdinalUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireReverseOrdinalUnion> for ReverseOrdinalUnion { |
| #[inline] |
| fn from_wire(wire: WireReverseOrdinalUnion) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::First(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireU32>() |
| })), |
| |
| 2 => Self::Second(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireU32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireReverseOrdinalUnion { |
| type Natural = ReverseOrdinalUnion; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireReverseOrdinalUnion> for ReverseOrdinalUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireReverseOrdinalUnion) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::First(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireU32>() |
| })), |
| |
| 2 => Self::Second(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireU32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWireOption<WireOptionalReverseOrdinalUnion> for ReverseOrdinalUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalReverseOrdinalUnion) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.into_option() { |
| Some(::fidl_next::FromWire::from_wire(inner)) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireOptionalReverseOrdinalUnion { |
| type Natural = ::core::option::Option<ReverseOrdinalUnion>; |
| } |
| |
| impl ::fidl_next::FromWireOption<WireOptionalReverseOrdinalUnion> for Box<ReverseOrdinalUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalReverseOrdinalUnion) -> ::core::option::Option<Self> { |
| < |
| ReverseOrdinalUnion as ::fidl_next::FromWireOption<WireOptionalReverseOrdinalUnion> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl ::fidl_next::FromWireOptionRef<WireOptionalReverseOrdinalUnion> for Box<ReverseOrdinalUnion> { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalReverseOrdinalUnion, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ReverseOrdinalUnion`]. |
| #[repr(transparent)] |
| pub struct WireReverseOrdinalUnion { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<()>, |
| } |
| |
| impl Drop for WireReverseOrdinalUnion { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireReverseOrdinalUnion { |
| type Decoded<'de> = WireReverseOrdinalUnion; |
| |
| #[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 reverse_ordinal_union { |
| pub enum Ref<'de> { |
| First(&'de ::fidl_next::WireU32), |
| |
| Second(&'de ::fidl_next::WireU32), |
| } |
| } |
| |
| impl WireReverseOrdinalUnion { |
| pub fn as_ref(&self) -> crate::reverse_ordinal_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::reverse_ordinal_union::Ref::First(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireU32>() |
| }), |
| |
| 2 => crate::reverse_ordinal_union::Ref::Second(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireU32>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl Clone for WireReverseOrdinalUnion { |
| fn clone(&self) -> Self { |
| match self.raw.ordinal() { |
| 1 => Self { |
| raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireU32>() }, |
| _phantom: ::core::marker::PhantomData, |
| }, |
| |
| 2 => Self { |
| raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireU32>() }, |
| _phantom: ::core::marker::PhantomData, |
| }, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireReverseOrdinalUnion |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| { |
| 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_static::<___D, ::fidl_next::WireU32>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireU32>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::fmt::Debug for WireReverseOrdinalUnion { |
| 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>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalReverseOrdinalUnion { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<()>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalReverseOrdinalUnion { |
| type Decoded<'de> = WireOptionalReverseOrdinalUnion; |
| |
| #[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 WireOptionalReverseOrdinalUnion { |
| 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<&WireReverseOrdinalUnion> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireReverseOrdinalUnion> { |
| if self.is_some() { |
| Some(WireReverseOrdinalUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl Clone for WireOptionalReverseOrdinalUnion { |
| fn clone(&self) -> Self { |
| if self.is_none() { |
| return WireOptionalReverseOrdinalUnion { |
| raw: ::fidl_next::RawWireUnion::absent(), |
| _phantom: ::core::marker::PhantomData, |
| }; |
| } |
| |
| match self.raw.ordinal() { |
| 1 => Self { |
| raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireU32>() }, |
| _phantom: ::core::marker::PhantomData, |
| }, |
| |
| 2 => Self { |
| raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireU32>() }, |
| _phantom: ::core::marker::PhantomData, |
| }, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalReverseOrdinalUnion |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| { |
| 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_static::<___D, ::fidl_next::WireU32>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireU32>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::fmt::Debug for WireOptionalReverseOrdinalUnion { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum StrictBoundedUnion { |
| V(::std::vec::Vec<u8>), |
| } |
| |
| impl ::fidl_next::Encodable for StrictBoundedUnion { |
| type Encoded = WireStrictBoundedUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StrictBoundedUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictBoundedUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::V(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::vec::Vec<u8>>( |
| value, 1, encoder, raw, |
| )?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StrictBoundedUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictBoundedUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::V(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::vec::Vec<u8>>( |
| value, 1, encoder, raw, |
| )?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for StrictBoundedUnion { |
| type EncodedOption = WireOptionalStrictBoundedUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StrictBoundedUnion |
| where |
| ___E: ?Sized, |
| StrictBoundedUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictBoundedUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for StrictBoundedUnion |
| where |
| ___E: ?Sized, |
| StrictBoundedUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictBoundedUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireStrictBoundedUnion<'de>> for StrictBoundedUnion { |
| #[inline] |
| fn from_wire(wire: WireStrictBoundedUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::V(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireStrictBoundedUnion<'de> { |
| type Natural = StrictBoundedUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireStrictBoundedUnion<'de>> for StrictBoundedUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireStrictBoundedUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::V(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, u8>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictBoundedUnion<'de>> for StrictBoundedUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictBoundedUnion<'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::IntoNatural for WireOptionalStrictBoundedUnion<'de> { |
| type Natural = ::core::option::Option<StrictBoundedUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictBoundedUnion<'de>> |
| for Box<StrictBoundedUnion> |
| { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictBoundedUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| StrictBoundedUnion as ::fidl_next::FromWireOption<WireOptionalStrictBoundedUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalStrictBoundedUnion<'de>> |
| for Box<StrictBoundedUnion> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalStrictBoundedUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`StrictBoundedUnion`]. |
| #[repr(transparent)] |
| pub struct WireStrictBoundedUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireStrictBoundedUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = |
| unsafe { self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireStrictBoundedUnion<'static> { |
| type Decoded<'de> = WireStrictBoundedUnion<'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 strict_bounded_union { |
| pub enum Ref<'de> { |
| V(&'de ::fidl_next::WireVector<'de, u8>), |
| } |
| } |
| |
| impl<'de> WireStrictBoundedUnion<'de> { |
| pub fn as_ref(&self) -> crate::strict_bounded_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::strict_bounded_union::Ref::V(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireStrictBoundedUnion<'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::WireVector<'static, u8>>( |
| raw, decoder, |
| )? |
| } |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireStrictBoundedUnion<'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::WireVector<'_, u8>>().fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalStrictBoundedUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalStrictBoundedUnion<'static> { |
| type Decoded<'de> = WireOptionalStrictBoundedUnion<'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> WireOptionalStrictBoundedUnion<'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<&WireStrictBoundedUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireStrictBoundedUnion<'de>> { |
| if self.is_some() { |
| Some(WireStrictBoundedUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalStrictBoundedUnion<'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::WireVector<'static, u8>>( |
| raw, decoder, |
| )? |
| } |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalStrictBoundedUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum StrictFoo { |
| S(::std::string::String), |
| |
| I(i32), |
| } |
| |
| impl ::fidl_next::Encodable for StrictFoo { |
| type Encoded = WireStrictFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StrictFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::string::String>( |
| value, 1, encoder, raw, |
| )?, |
| |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StrictFoo |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictFoo { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::string::String>( |
| value, 1, encoder, raw, |
| )?, |
| |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for StrictFoo { |
| type EncodedOption = WireOptionalStrictFoo<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StrictFoo |
| where |
| ___E: ?Sized, |
| StrictFoo: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictFoo { 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<___E> ::fidl_next::EncodeOptionRef<___E> for StrictFoo |
| where |
| ___E: ?Sized, |
| StrictFoo: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictFoo { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireStrictFoo<'de>> for StrictFoo { |
| #[inline] |
| fn from_wire(wire: WireStrictFoo<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::S(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 2 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireStrictFoo<'de> { |
| type Natural = StrictFoo; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireStrictFoo<'de>> for StrictFoo { |
| #[inline] |
| fn from_wire_ref(wire: &WireStrictFoo<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::S(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 2 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictFoo<'de>> for StrictFoo { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictFoo<'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::IntoNatural for WireOptionalStrictFoo<'de> { |
| type Natural = ::core::option::Option<StrictFoo>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictFoo<'de>> for Box<StrictFoo> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictFoo<'de>) -> ::core::option::Option<Self> { |
| <StrictFoo as ::fidl_next::FromWireOption<WireOptionalStrictFoo<'de>>>::from_wire_option( |
| wire, |
| ) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalStrictFoo<'de>> for Box<StrictFoo> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalStrictFoo<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`StrictFoo`]. |
| #[repr(transparent)] |
| pub struct WireStrictFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireStrictFoo<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireStrictFoo<'static> { |
| type Decoded<'de> = WireStrictFoo<'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 strict_foo { |
| pub enum Ref<'de> { |
| S(&'de ::fidl_next::WireString<'de>), |
| |
| I(&'de ::fidl_next::WireI32), |
| } |
| } |
| |
| impl<'de> WireStrictFoo<'de> { |
| pub fn as_ref(&self) -> crate::strict_foo::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::strict_foo::Ref::S(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| 2 => crate::strict_foo::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireStrictFoo<'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::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireStrictFoo<'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::WireString<'_>>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalStrictFoo<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalStrictFoo<'static> { |
| type Decoded<'de> = WireOptionalStrictFoo<'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> WireOptionalStrictFoo<'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<&WireStrictFoo<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireStrictFoo<'de>> { |
| if self.is_some() { |
| Some(WireStrictFoo { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalStrictFoo<'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::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireI32>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalStrictFoo<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum StrictPizzaOrPasta { |
| Pizza(crate::Pizza), |
| |
| Pasta(crate::Pasta), |
| } |
| |
| impl ::fidl_next::Encodable for StrictPizzaOrPasta { |
| type Encoded = WireStrictPizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StrictPizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictPizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Pasta>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StrictPizzaOrPasta |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictPizzaOrPasta { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Pizza(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pizza>(value, 1, encoder, raw)? |
| } |
| |
| Self::Pasta(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Pasta>(value, 2, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for StrictPizzaOrPasta { |
| type EncodedOption = WireOptionalStrictPizzaOrPasta<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StrictPizzaOrPasta |
| where |
| ___E: ?Sized, |
| StrictPizzaOrPasta: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictPizzaOrPasta { 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<___E> ::fidl_next::EncodeOptionRef<___E> for StrictPizzaOrPasta |
| where |
| ___E: ?Sized, |
| StrictPizzaOrPasta: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictPizzaOrPasta { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireStrictPizzaOrPasta<'de>> for StrictPizzaOrPasta { |
| #[inline] |
| fn from_wire(wire: WireStrictPizzaOrPasta<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 2 => Self::Pasta(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireStrictPizzaOrPasta<'de> { |
| type Natural = StrictPizzaOrPasta; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireStrictPizzaOrPasta<'de>> for StrictPizzaOrPasta { |
| #[inline] |
| fn from_wire_ref(wire: &WireStrictPizzaOrPasta<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Pizza(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePizza<'de>>() |
| })), |
| |
| 2 => Self::Pasta(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WirePasta<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictPizzaOrPasta<'de>> for StrictPizzaOrPasta { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictPizzaOrPasta<'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::IntoNatural for WireOptionalStrictPizzaOrPasta<'de> { |
| type Natural = ::core::option::Option<StrictPizzaOrPasta>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictPizzaOrPasta<'de>> |
| for Box<StrictPizzaOrPasta> |
| { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictPizzaOrPasta<'de>) -> ::core::option::Option<Self> { |
| < |
| StrictPizzaOrPasta as ::fidl_next::FromWireOption<WireOptionalStrictPizzaOrPasta<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalStrictPizzaOrPasta<'de>> |
| for Box<StrictPizzaOrPasta> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalStrictPizzaOrPasta<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`StrictPizzaOrPasta`]. |
| #[repr(transparent)] |
| pub struct WireStrictPizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireStrictPizzaOrPasta<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePizza<'de>>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WirePasta<'de>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireStrictPizzaOrPasta<'static> { |
| type Decoded<'de> = WireStrictPizzaOrPasta<'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 strict_pizza_or_pasta { |
| pub enum Ref<'de> { |
| Pizza(&'de crate::WirePizza<'de>), |
| |
| Pasta(&'de crate::WirePasta<'de>), |
| } |
| } |
| |
| impl<'de> WireStrictPizzaOrPasta<'de> { |
| pub fn as_ref(&self) -> crate::strict_pizza_or_pasta::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::strict_pizza_or_pasta::Ref::Pizza(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePizza<'_>>() |
| }), |
| |
| 2 => crate::strict_pizza_or_pasta::Ref::Pasta(unsafe { |
| self.raw.get().deref_unchecked::<crate::WirePasta<'_>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireStrictPizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireStrictPizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { self.raw.get().deref_unchecked::<crate::WirePizza<'_>>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<crate::WirePasta<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalStrictPizzaOrPasta<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalStrictPizzaOrPasta<'static> { |
| type Decoded<'de> = WireOptionalStrictPizzaOrPasta<'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> WireOptionalStrictPizzaOrPasta<'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<&WireStrictPizzaOrPasta<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireStrictPizzaOrPasta<'de>> { |
| if self.is_some() { |
| Some(WireStrictPizzaOrPasta { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalStrictPizzaOrPasta<'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, crate::WirePizza<'static>>( |
| raw, decoder, |
| )?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WirePasta<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalStrictPizzaOrPasta<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum StrictSimpleUnion { |
| I(i32), |
| |
| F(f32), |
| |
| S(::std::string::String), |
| } |
| |
| impl ::fidl_next::Encodable for StrictSimpleUnion { |
| type Encoded = WireStrictSimpleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StrictSimpleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictSimpleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::F(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, f32>(value, 2, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, ::std::string::String>( |
| value, 3, encoder, raw, |
| )?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StrictSimpleUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictSimpleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::I(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::F(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &f32>(value, 2, encoder, raw)? |
| } |
| |
| Self::S(value) => ::fidl_next::RawWireUnion::encode_as::<___E, &::std::string::String>( |
| value, 3, encoder, raw, |
| )?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for StrictSimpleUnion { |
| type EncodedOption = WireOptionalStrictSimpleUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StrictSimpleUnion |
| where |
| ___E: ?Sized, |
| StrictSimpleUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictSimpleUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for StrictSimpleUnion |
| where |
| ___E: ?Sized, |
| StrictSimpleUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictSimpleUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireStrictSimpleUnion<'de>> for StrictSimpleUnion { |
| #[inline] |
| fn from_wire(wire: WireStrictSimpleUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::F(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireF32>() |
| })), |
| |
| 3 => Self::S(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireStrictSimpleUnion<'de> { |
| type Natural = StrictSimpleUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireStrictSimpleUnion<'de>> for StrictSimpleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireStrictSimpleUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::I(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::F(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireF32>() |
| })), |
| |
| 3 => Self::S(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictSimpleUnion<'de>> for StrictSimpleUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictSimpleUnion<'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::IntoNatural for WireOptionalStrictSimpleUnion<'de> { |
| type Natural = ::core::option::Option<StrictSimpleUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictSimpleUnion<'de>> |
| for Box<StrictSimpleUnion> |
| { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictSimpleUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| StrictSimpleUnion as ::fidl_next::FromWireOption<WireOptionalStrictSimpleUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalStrictSimpleUnion<'de>> |
| for Box<StrictSimpleUnion> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalStrictSimpleUnion<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`StrictSimpleUnion`]. |
| #[repr(transparent)] |
| pub struct WireStrictSimpleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireStrictSimpleUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireF32>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireStrictSimpleUnion<'static> { |
| type Decoded<'de> = WireStrictSimpleUnion<'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 strict_simple_union { |
| pub enum Ref<'de> { |
| I(&'de ::fidl_next::WireI32), |
| |
| F(&'de ::fidl_next::WireF32), |
| |
| S(&'de ::fidl_next::WireString<'de>), |
| } |
| } |
| |
| impl<'de> WireStrictSimpleUnion<'de> { |
| pub fn as_ref(&self) -> crate::strict_simple_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::strict_simple_union::Ref::I(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 2 => crate::strict_simple_union::Ref::F(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireF32>() |
| }), |
| |
| 3 => crate::strict_simple_union::Ref::S(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireStrictSimpleUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireF32>(raw, decoder)?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireStrictSimpleUnion<'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::WireI32>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireF32>().fmt(f) }, |
| 3 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalStrictSimpleUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalStrictSimpleUnion<'static> { |
| type Decoded<'de> = WireOptionalStrictSimpleUnion<'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> WireOptionalStrictSimpleUnion<'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<&WireStrictSimpleUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireStrictSimpleUnion<'de>> { |
| if self.is_some() { |
| Some(WireStrictSimpleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalStrictSimpleUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireF32>(raw, decoder)?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalStrictSimpleUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum StrictUnion { |
| Primitive(i32), |
| |
| StringNeedsConstructor(::std::string::String), |
| |
| VectorStringAlsoNeedsConstructor(::std::vec::Vec<::std::string::String>), |
| } |
| |
| impl ::fidl_next::Encodable for StrictUnion { |
| type Encoded = WireStrictUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StrictUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| ::std::string::String, |
| >(value, 2, encoder, raw)?, |
| |
| Self::VectorStringAlsoNeedsConstructor(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, ::std::vec::Vec<::std::string::String>>( |
| value, 3, encoder, raw, |
| )? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StrictUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| &::std::string::String, |
| >(value, 2, encoder, raw)?, |
| |
| Self::VectorStringAlsoNeedsConstructor(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &::std::vec::Vec<::std::string::String>>( |
| value, 3, encoder, raw, |
| )? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for StrictUnion { |
| type EncodedOption = WireOptionalStrictUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StrictUnion |
| where |
| ___E: ?Sized, |
| StrictUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for StrictUnion |
| where |
| ___E: ?Sized, |
| StrictUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalStrictUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireStrictUnion<'de>> for StrictUnion { |
| #[inline] |
| fn from_wire(wire: WireStrictUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::StringNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| })) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireStrictUnion<'de> { |
| type Natural = StrictUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireStrictUnion<'de>> for StrictUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireStrictUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::StringNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => Self::VectorStringAlsoNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref( |
| unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }, |
| )), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictUnion<'de>> for StrictUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictUnion<'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::IntoNatural for WireOptionalStrictUnion<'de> { |
| type Natural = ::core::option::Option<StrictUnion>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalStrictUnion<'de>> for Box<StrictUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalStrictUnion<'de>) -> ::core::option::Option<Self> { |
| < |
| StrictUnion as ::fidl_next::FromWireOption<WireOptionalStrictUnion<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalStrictUnion<'de>> for Box<StrictUnion> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalStrictUnion<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`StrictUnion`]. |
| #[repr(transparent)] |
| pub struct WireStrictUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireStrictUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { |
| self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireStrictUnion<'static> { |
| type Decoded<'de> = WireStrictUnion<'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 strict_union { |
| pub enum Ref<'de> { |
| Primitive(&'de ::fidl_next::WireI32), |
| |
| StringNeedsConstructor(&'de ::fidl_next::WireString<'de>), |
| |
| VectorStringAlsoNeedsConstructor( |
| &'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>, |
| ), |
| } |
| } |
| |
| impl<'de> WireStrictUnion<'de> { |
| pub fn as_ref(&self) -> crate::strict_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::strict_union::Ref::Primitive(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 2 => crate::strict_union::Ref::StringNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| 3 => { |
| crate::strict_union::Ref::VectorStringAlsoNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| }) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireStrictUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireStrictUnion<'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::WireI32>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| 3 => unsafe { |
| self.raw |
| .get() |
| .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| .fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalStrictUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalStrictUnion<'static> { |
| type Decoded<'de> = WireOptionalStrictUnion<'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> WireOptionalStrictUnion<'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<&WireStrictUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireStrictUnion<'de>> { |
| if self.is_some() { |
| Some(WireStrictUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalStrictUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalStrictUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct StructWithNullableUnion { |
| pub x1: ::core::option::Option<::std::boxed::Box<crate::OlderSimpleUnion>>, |
| } |
| |
| impl ::fidl_next::Encodable for StructWithNullableUnion { |
| type Encoded = WireStructWithNullableUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| x1, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.x1, encoder_, x1)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StructWithNullableUnion |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| x1, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.x1, encoder_, x1)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for StructWithNullableUnion { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireStructWithNullableUnion<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableUnion |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| StructWithNullableUnion: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> for StructWithNullableUnion |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| StructWithNullableUnion: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> ::fidl_next::FromWire<WireStructWithNullableUnion<'de>> for StructWithNullableUnion { |
| #[inline] |
| fn from_wire(wire: WireStructWithNullableUnion<'de>) -> Self { |
| Self { x1: ::fidl_next::FromWire::from_wire(wire.x1) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireStructWithNullableUnion<'de> { |
| type Natural = StructWithNullableUnion; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireStructWithNullableUnion<'de>> for StructWithNullableUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireStructWithNullableUnion<'de>) -> Self { |
| Self { x1: ::fidl_next::FromWireRef::from_wire_ref(&wire.x1) } |
| } |
| } |
| |
| /// The wire type corresponding to [`StructWithNullableUnion`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireStructWithNullableUnion<'de> { |
| pub x1: crate::WireOptionalOlderSimpleUnion<'de>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireStructWithNullableUnion<'_>>(), 16); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireStructWithNullableUnion<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireStructWithNullableUnion<'_>, x1), 0); |
| |
| unsafe impl ::fidl_next::Wire for WireStructWithNullableUnion<'static> { |
| type Decoded<'de> = WireStructWithNullableUnion<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| x1, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(x1); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireStructWithNullableUnion<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut x1, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(x1.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse { |
| pub xu: crate::StrictBoundedUnion, |
| } |
| |
| impl ::fidl_next::Encodable for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse { |
| type Encoded = WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> |
| for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| xu, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.xu, encoder_, xu)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> |
| for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| xu, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.xu, encoder_, xu)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption |
| for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| { |
| type EncodedOption = ::fidl_next::WireBox< |
| 'static, |
| WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'static>, |
| >; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> |
| for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> |
| for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> |
| ::fidl_next::FromWire<WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de>> |
| for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| { |
| #[inline] |
| fn from_wire( |
| wire: WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de>, |
| ) -> Self { |
| Self { xu: ::fidl_next::FromWire::from_wire(wire.xu) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural |
| for WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de> |
| { |
| type Natural = TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse; |
| } |
| |
| impl<'de> |
| ::fidl_next::FromWireRef< |
| WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de>, |
| > for TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| { |
| #[inline] |
| fn from_wire_ref( |
| wire: &WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de>, |
| ) -> Self { |
| Self { xu: ::fidl_next::FromWireRef::from_wire_ref(&wire.xu) } |
| } |
| } |
| |
| /// The wire type corresponding to [`TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de> { |
| pub xu: crate::WireStrictBoundedUnion<'de>, |
| } |
| static_assertions::const_assert_eq!( |
| std::mem::size_of::<WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'_>>(), |
| 16 |
| ); |
| static_assertions::const_assert_eq!( |
| std::mem::align_of::<WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'_>>(), |
| 8 |
| ); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!( |
| WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'_>, |
| xu |
| ), |
| 0 |
| ); |
| |
| unsafe impl ::fidl_next::Wire |
| for WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'static> |
| { |
| type Decoded<'de> = WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| xu, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(xu); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> |
| for WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut xu, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(xu.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse { |
| pub xu: crate::OlderSimpleUnion, |
| } |
| |
| impl ::fidl_next::Encodable for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse { |
| type Encoded = WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> |
| for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| xu, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.xu, encoder_, xu)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> |
| for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| xu, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.xu, encoder_, xu)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption |
| for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| { |
| type EncodedOption = ::fidl_next::WireBox< |
| 'static, |
| WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'static>, |
| >; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> |
| for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> |
| for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> |
| ::fidl_next::FromWire< |
| WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de>, |
| > for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| { |
| #[inline] |
| fn from_wire( |
| wire: WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de>, |
| ) -> Self { |
| Self { xu: ::fidl_next::FromWire::from_wire(wire.xu) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural |
| for WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de> |
| { |
| type Natural = TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse; |
| } |
| |
| impl<'de> |
| ::fidl_next::FromWireRef< |
| WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de>, |
| > for TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| { |
| #[inline] |
| fn from_wire_ref( |
| wire: &WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de>, |
| ) -> Self { |
| Self { xu: ::fidl_next::FromWireRef::from_wire_ref(&wire.xu) } |
| } |
| } |
| |
| /// The wire type corresponding to [`TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de> { |
| pub xu: crate::WireOlderSimpleUnion<'de>, |
| } |
| static_assertions::const_assert_eq!( |
| std::mem::size_of::<WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'_>>( |
| ), |
| 16 |
| ); |
| static_assertions::const_assert_eq!( |
| std::mem::align_of::<WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'_>>( |
| ), |
| 8 |
| ); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!( |
| WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'_>, |
| xu |
| ), |
| 0 |
| ); |
| |
| unsafe impl ::fidl_next::Wire |
| for WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'static> |
| { |
| type Decoded<'de> = WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| xu, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(xu); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> |
| for WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut xu, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(xu.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| /// The type corresponding to the TestProtocol protocol. |
| #[derive(PartialEq, Debug)] |
| pub struct TestProtocol; |
| |
| pub mod test_protocol { |
| pub mod prelude { |
| pub use crate::{ |
| TestProtocol, TestProtocolClientHandler, TestProtocolServerHandler, test_protocol, |
| }; |
| |
| pub use crate::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse; |
| |
| pub use crate::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse; |
| } |
| |
| pub struct StrictUnionHenceResponseMayBeStackAllocated; |
| |
| impl ::fidl_next::Method for StrictUnionHenceResponseMayBeStackAllocated { |
| const ORDINAL: u64 = 6628358876445129155; |
| |
| type Protocol = crate::TestProtocol; |
| |
| type Request = (); |
| |
| type Response = |
| crate::WireTestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse<'static>; |
| } |
| |
| pub struct FlexibleUnionHenceResponseMustBeHeapAllocated; |
| |
| impl ::fidl_next::Method for FlexibleUnionHenceResponseMustBeHeapAllocated { |
| const ORDINAL: u64 = 7588545459451501794; |
| |
| type Protocol = crate::TestProtocol; |
| |
| type Request = (); |
| |
| type Response = |
| crate::WireTestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse<'static>; |
| } |
| |
| mod ___detail { |
| |
| unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::TestProtocol |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| type Client = TestProtocolClient<___T>; |
| type Server = TestProtocolServer<___T>; |
| } |
| |
| /// The client for the `TestProtocol` protocol. |
| #[repr(transparent)] |
| pub struct TestProtocolClient<___T: ::fidl_next::Transport> { |
| #[allow(dead_code)] |
| client: ::fidl_next::protocol::Client<___T>, |
| } |
| |
| impl<___T> TestProtocolClient<___T> |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| pub fn strict_union_hence_response_may_be_stack_allocated( |
| &self, |
| ) -> ::fidl_next::TwoWayFuture< |
| '_, |
| super::StrictUnionHenceResponseMayBeStackAllocated, |
| ___T, |
| > { |
| ::fidl_next::TwoWayFuture::from_untyped( |
| self.client.send_two_way(6628358876445129155, ()), |
| ) |
| } |
| |
| pub fn flexible_union_hence_response_must_be_heap_allocated( |
| &self, |
| ) -> ::fidl_next::TwoWayFuture< |
| '_, |
| super::FlexibleUnionHenceResponseMustBeHeapAllocated, |
| ___T, |
| > { |
| ::fidl_next::TwoWayFuture::from_untyped( |
| self.client.send_two_way(7588545459451501794, ()), |
| ) |
| } |
| } |
| |
| /// The server for the `TestProtocol` protocol. |
| #[repr(transparent)] |
| pub struct TestProtocolServer<___T: ::fidl_next::Transport> { |
| server: ::fidl_next::protocol::Server<___T>, |
| } |
| |
| impl<___T> TestProtocolServer<___T> where ___T: ::fidl_next::Transport {} |
| } |
| } |
| |
| /// A client handler for the TestProtocol protocol. |
| /// |
| /// See [`TestProtocol`] for more details. |
| pub trait TestProtocolClientHandler< |
| #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport, |
| #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel, |
| > |
| { |
| } |
| |
| impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for TestProtocol |
| where |
| ___H: TestProtocolClientHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| <test_protocol::StrictUnionHenceResponseMayBeStackAllocated as ::fidl_next::Method>::Response: |
| ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>, |
| <test_protocol::FlexibleUnionHenceResponseMustBeHeapAllocated as ::fidl_next::Method>::Response: |
| ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>, |
| { |
| async fn on_event( |
| handler: &mut ___H, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> { |
| match ordinal { |
| ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)), |
| } |
| } |
| } |
| |
| /// A server handler for the TestProtocol protocol. |
| /// |
| /// See [`TestProtocol`] for more details. |
| pub trait TestProtocolServerHandler< |
| #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport, |
| #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel, |
| > |
| { |
| fn strict_union_hence_response_may_be_stack_allocated( |
| &mut self, |
| |
| responder: ::fidl_next::Responder< |
| test_protocol::StrictUnionHenceResponseMayBeStackAllocated, |
| ___T, |
| >, |
| ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send; |
| |
| fn flexible_union_hence_response_must_be_heap_allocated( |
| &mut self, |
| |
| responder: ::fidl_next::Responder< |
| test_protocol::FlexibleUnionHenceResponseMustBeHeapAllocated, |
| ___T, |
| >, |
| ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send; |
| } |
| |
| impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for TestProtocol |
| where |
| ___H: TestProtocolServerHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| { |
| async fn on_one_way( |
| handler: &mut ___H, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| ) -> ::core::result::Result< |
| (), |
| ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>, |
| > { |
| match ordinal { |
| ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)), |
| } |
| } |
| |
| async fn on_two_way( |
| handler: &mut ___H, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| responder: ::fidl_next::protocol::Responder<___T>, |
| ) -> ::core::result::Result< |
| (), |
| ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>, |
| > { |
| match ordinal { |
| 6628358876445129155 => { |
| let responder = ::fidl_next::Responder::from_untyped(responder); |
| |
| handler.strict_union_hence_response_may_be_stack_allocated(responder).await; |
| Ok(()) |
| } |
| |
| 7588545459451501794 => { |
| let responder = ::fidl_next::Responder::from_untyped(responder); |
| |
| handler.flexible_union_hence_response_must_be_heap_allocated(responder).await; |
| Ok(()) |
| } |
| |
| ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)), |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum Union { |
| Primitive(i32), |
| |
| StringNeedsConstructor(::std::string::String), |
| |
| VectorStringAlsoNeedsConstructor(::std::vec::Vec<::std::string::String>), |
| } |
| |
| impl ::fidl_next::Encodable for Union { |
| type Encoded = WireUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Union |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| ::std::string::String, |
| >(value, 2, encoder, raw)?, |
| |
| Self::VectorStringAlsoNeedsConstructor(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, ::std::vec::Vec<::std::string::String>>( |
| value, 3, encoder, raw, |
| )? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Union |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Primitive(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i32>(value, 1, encoder, raw)? |
| } |
| |
| Self::StringNeedsConstructor(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| &::std::string::String, |
| >(value, 2, encoder, raw)?, |
| |
| Self::VectorStringAlsoNeedsConstructor(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &::std::vec::Vec<::std::string::String>>( |
| value, 3, encoder, raw, |
| )? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for Union { |
| type EncodedOption = WireOptionalUnion<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Union |
| where |
| ___E: ?Sized, |
| Union: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalUnion { 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<___E> ::fidl_next::EncodeOptionRef<___E> for Union |
| where |
| ___E: ?Sized, |
| Union: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalUnion { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireUnion<'de>> for Union { |
| #[inline] |
| fn from_wire(wire: WireUnion<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::StringNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| })) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireUnion<'de> { |
| type Natural = Union; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireUnion<'de>> for Union { |
| #[inline] |
| fn from_wire_ref(wire: &WireUnion<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Primitive(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| })), |
| |
| 2 => Self::StringNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>() |
| })), |
| |
| 3 => Self::VectorStringAlsoNeedsConstructor(::fidl_next::FromWireRef::from_wire_ref( |
| unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }, |
| )), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnion<'de>> for Union { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalUnion<'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::IntoNatural for WireOptionalUnion<'de> { |
| type Natural = ::core::option::Option<Union>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnion<'de>> for Box<Union> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalUnion<'de>) -> ::core::option::Option<Self> { |
| <Union as ::fidl_next::FromWireOption<WireOptionalUnion<'de>>>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalUnion<'de>> for Box<Union> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalUnion<'de>) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`Union`]. |
| #[repr(transparent)] |
| pub struct WireUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireUnion<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { |
| self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>() |
| }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireUnion<'static> { |
| type Decoded<'de> = WireUnion<'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 { |
| pub enum Ref<'de> { |
| Primitive(&'de ::fidl_next::WireI32), |
| |
| StringNeedsConstructor(&'de ::fidl_next::WireString<'de>), |
| |
| VectorStringAlsoNeedsConstructor( |
| &'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>, |
| ), |
| } |
| } |
| |
| impl<'de> WireUnion<'de> { |
| pub fn as_ref(&self) -> crate::union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::union::Ref::Primitive(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI32>() |
| }), |
| |
| 2 => crate::union::Ref::StringNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }), |
| |
| 3 => { |
| crate::union::Ref::VectorStringAlsoNeedsConstructor(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| }) |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireUnion<'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::WireI32>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) }, |
| 3 => unsafe { |
| self.raw |
| .get() |
| .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>() |
| .fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalUnion<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalUnion<'static> { |
| type Decoded<'de> = WireOptionalUnion<'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> WireOptionalUnion<'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<&WireUnion<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireUnion<'de>> { |
| if self.is_some() { |
| Some(WireUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalUnion<'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::WireI32>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>, |
| >(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalUnion<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum UnionContainingEmptyStruct { |
| Empty(crate::Empty), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for UnionContainingEmptyStruct { |
| type Encoded = WireUnionContainingEmptyStruct<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for UnionContainingEmptyStruct |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireUnionContainingEmptyStruct { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Empty(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::Empty>(value, 1, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UnionContainingEmptyStruct |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireUnionContainingEmptyStruct { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Empty(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::Empty>(value, 1, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for UnionContainingEmptyStruct { |
| type EncodedOption = WireOptionalUnionContainingEmptyStruct<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for UnionContainingEmptyStruct |
| where |
| ___E: ?Sized, |
| UnionContainingEmptyStruct: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalUnionContainingEmptyStruct { 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<___E> ::fidl_next::EncodeOptionRef<___E> for UnionContainingEmptyStruct |
| where |
| ___E: ?Sized, |
| UnionContainingEmptyStruct: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalUnionContainingEmptyStruct { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireUnionContainingEmptyStruct<'de>> |
| for UnionContainingEmptyStruct |
| { |
| #[inline] |
| fn from_wire(wire: WireUnionContainingEmptyStruct<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Empty(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WireEmpty>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireUnionContainingEmptyStruct<'de> { |
| type Natural = UnionContainingEmptyStruct; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireUnionContainingEmptyStruct<'de>> |
| for UnionContainingEmptyStruct |
| { |
| #[inline] |
| fn from_wire_ref(wire: &WireUnionContainingEmptyStruct<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Empty(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WireEmpty>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnionContainingEmptyStruct<'de>> |
| for UnionContainingEmptyStruct |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalUnionContainingEmptyStruct<'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::IntoNatural for WireOptionalUnionContainingEmptyStruct<'de> { |
| type Natural = ::core::option::Option<UnionContainingEmptyStruct>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnionContainingEmptyStruct<'de>> |
| for Box<UnionContainingEmptyStruct> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalUnionContainingEmptyStruct<'de>, |
| ) -> ::core::option::Option<Self> { |
| <UnionContainingEmptyStruct as ::fidl_next::FromWireOption< |
| WireOptionalUnionContainingEmptyStruct<'de>, |
| >>::from_wire_option(wire) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalUnionContainingEmptyStruct<'de>> |
| for Box<UnionContainingEmptyStruct> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalUnionContainingEmptyStruct<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`UnionContainingEmptyStruct`]. |
| #[repr(transparent)] |
| pub struct WireUnionContainingEmptyStruct<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireUnionContainingEmptyStruct<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WireEmpty>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireUnionContainingEmptyStruct<'static> { |
| type Decoded<'de> = WireUnionContainingEmptyStruct<'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_containing_empty_struct { |
| pub enum Ref<'de> { |
| Empty(&'de crate::WireEmpty), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireUnionContainingEmptyStruct<'de> { |
| pub fn as_ref(&self) -> crate::union_containing_empty_struct::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::union_containing_empty_struct::Ref::Empty(unsafe { |
| self.raw.get().deref_unchecked::<crate::WireEmpty>() |
| }), |
| |
| unknown => crate::union_containing_empty_struct::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireUnionContainingEmptyStruct<'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, crate::WireEmpty>(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireUnionContainingEmptyStruct<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 1 => unsafe { self.raw.get().deref_unchecked::<crate::WireEmpty>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalUnionContainingEmptyStruct<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalUnionContainingEmptyStruct<'static> { |
| type Decoded<'de> = WireOptionalUnionContainingEmptyStruct<'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> WireOptionalUnionContainingEmptyStruct<'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<&WireUnionContainingEmptyStruct<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireUnionContainingEmptyStruct<'de>> { |
| if self.is_some() { |
| Some(WireUnionContainingEmptyStruct { |
| raw: self.raw, |
| _phantom: ::core::marker::PhantomData, |
| }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalUnionContainingEmptyStruct<'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, crate::WireEmpty>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalUnionContainingEmptyStruct<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct UnionSandwich { |
| pub a: u32, |
| |
| pub u: crate::ExplicitFlexibleUnion, |
| |
| pub b: u32, |
| } |
| |
| impl ::fidl_next::Encodable for UnionSandwich { |
| type Encoded = WireUnionSandwich<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for UnionSandwich |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| a, |
| u, |
| b, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.a, encoder_, a)?; |
| |
| ::fidl_next::Encode::encode(self.u, encoder_, u)?; |
| |
| ::fidl_next::Encode::encode(self.b, encoder_, b)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UnionSandwich |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let Self::Encoded { |
| |
| a, |
| u, |
| b, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.a, encoder_, a)?; |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.u, encoder_, u)?; |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.b, encoder_, b)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for UnionSandwich { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireUnionSandwich<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for UnionSandwich |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| UnionSandwich: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<___E> ::fidl_next::EncodeOptionRef<___E> for UnionSandwich |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| UnionSandwich: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::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<'de> ::fidl_next::FromWire<WireUnionSandwich<'de>> for UnionSandwich { |
| #[inline] |
| fn from_wire(wire: WireUnionSandwich<'de>) -> Self { |
| Self { |
| a: ::fidl_next::FromWire::from_wire(wire.a), |
| |
| u: ::fidl_next::FromWire::from_wire(wire.u), |
| |
| b: ::fidl_next::FromWire::from_wire(wire.b), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireUnionSandwich<'de> { |
| type Natural = UnionSandwich; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireUnionSandwich<'de>> for UnionSandwich { |
| #[inline] |
| fn from_wire_ref(wire: &WireUnionSandwich<'de>) -> Self { |
| Self { |
| a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a), |
| |
| u: ::fidl_next::FromWireRef::from_wire_ref(&wire.u), |
| |
| b: ::fidl_next::FromWireRef::from_wire_ref(&wire.b), |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`UnionSandwich`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireUnionSandwich<'de> { |
| pub a: ::fidl_next::WireU32, |
| |
| pub u: crate::WireExplicitFlexibleUnion<'de>, |
| |
| pub b: ::fidl_next::WireU32, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireUnionSandwich<'_>>(), 32); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireUnionSandwich<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireUnionSandwich<'_>, a), 0); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireUnionSandwich<'_>, u), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireUnionSandwich<'_>, b), 24); |
| |
| unsafe impl ::fidl_next::Wire for WireUnionSandwich<'static> { |
| type Decoded<'de> = WireUnionSandwich<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| a, |
| u, |
| b, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(a); |
| |
| ::fidl_next::Wire::zero_padding(u); |
| |
| ::fidl_next::Wire::zero_padding(b); |
| |
| unsafe { |
| out_.as_mut_ptr().cast::<u8>().add(28).write_bytes(0, 4); |
| } |
| |
| unsafe { |
| out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4); |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireUnionSandwich<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut a, |
| mut u, |
| mut b, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(a.as_mut(), decoder_)?; |
| |
| ::fidl_next::Decode::decode(u.as_mut(), decoder_)?; |
| |
| ::fidl_next::Decode::decode(b.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum UnionWithAttributes { |
| X(i64), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for UnionWithAttributes { |
| type Encoded = WireUnionWithAttributes<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for UnionWithAttributes |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireUnionWithAttributes { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::X(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for UnionWithAttributes |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireUnionWithAttributes { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::X(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &i64>(value, 1, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for UnionWithAttributes { |
| type EncodedOption = WireOptionalUnionWithAttributes<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for UnionWithAttributes |
| where |
| ___E: ?Sized, |
| UnionWithAttributes: ::fidl_next::Encode<___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalUnionWithAttributes { 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<___E> ::fidl_next::EncodeOptionRef<___E> for UnionWithAttributes |
| where |
| ___E: ?Sized, |
| UnionWithAttributes: ::fidl_next::EncodeRef<___E>, |
| { |
| #[inline] |
| fn encode_option_ref( |
| this: ::core::option::Option<&Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireOptionalUnionWithAttributes { raw, _phantom: _ } = &mut *out); |
| |
| if let Some(inner) = this { |
| let value_out = unsafe { &mut *out.as_mut_ptr().cast() }; |
| ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?; |
| } else { |
| ::fidl_next::RawWireUnion::encode_absent(raw); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireUnionWithAttributes<'de>> for UnionWithAttributes { |
| #[inline] |
| fn from_wire(wire: WireUnionWithAttributes<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::X(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireUnionWithAttributes<'de> { |
| type Natural = UnionWithAttributes; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireUnionWithAttributes<'de>> for UnionWithAttributes { |
| #[inline] |
| fn from_wire_ref(wire: &WireUnionWithAttributes<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::X(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnionWithAttributes<'de>> |
| for UnionWithAttributes |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalUnionWithAttributes<'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::IntoNatural for WireOptionalUnionWithAttributes<'de> { |
| type Natural = ::core::option::Option<UnionWithAttributes>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnionWithAttributes<'de>> |
| for Box<UnionWithAttributes> |
| { |
| #[inline] |
| fn from_wire_option( |
| wire: WireOptionalUnionWithAttributes<'de>, |
| ) -> ::core::option::Option<Self> { |
| < |
| UnionWithAttributes as ::fidl_next::FromWireOption<WireOptionalUnionWithAttributes<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalUnionWithAttributes<'de>> |
| for Box<UnionWithAttributes> |
| { |
| #[inline] |
| fn from_wire_option_ref( |
| wire: &WireOptionalUnionWithAttributes<'de>, |
| ) -> ::core::option::Option<Self> { |
| if let Some(inner) = wire.as_ref() { |
| Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner))) |
| } else { |
| None |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`UnionWithAttributes`]. |
| #[repr(transparent)] |
| pub struct WireUnionWithAttributes<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireUnionWithAttributes<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI64>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireUnionWithAttributes<'static> { |
| type Decoded<'de> = WireUnionWithAttributes<'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_with_attributes { |
| pub enum Ref<'de> { |
| X(&'de ::fidl_next::WireI64), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireUnionWithAttributes<'de> { |
| pub fn as_ref(&self) -> crate::union_with_attributes::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::union_with_attributes::Ref::X(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireI64>() |
| }), |
| |
| unknown => crate::union_with_attributes::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireUnionWithAttributes<'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::WireI64>(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireUnionWithAttributes<'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::WireI64>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalUnionWithAttributes<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalUnionWithAttributes<'static> { |
| type Decoded<'de> = WireOptionalUnionWithAttributes<'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> WireOptionalUnionWithAttributes<'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<&WireUnionWithAttributes<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireUnionWithAttributes<'de>> { |
| if self.is_some() { |
| Some(WireUnionWithAttributes { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalUnionWithAttributes<'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::WireI64>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalUnionWithAttributes<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| /// Compatibility shims which mimic some API surfaces of the current Rust bindings. |
| pub mod compat { |
| |
| impl ::fidl_next::CompatFrom<crate::Empty> for ::fidl_test_union::Empty { |
| #[inline] |
| fn compat_from(value: crate::Empty) -> Self { |
| Self {} |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::Empty> for crate::Empty { |
| #[inline] |
| fn compat_from(value: ::fidl_test_union::Empty) -> Self { |
| Self {} |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::EmptyFlexibleUnion> for ::fidl_test_union::EmptyFlexibleUnion { |
| fn compat_from(value: crate::EmptyFlexibleUnion) -> Self { |
| match value { |
| crate::EmptyFlexibleUnion::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::EmptyFlexibleUnion> for crate::EmptyFlexibleUnion { |
| fn compat_from(value: ::fidl_test_union::EmptyFlexibleUnion) -> Self { |
| match value { |
| ::fidl_test_union::EmptyFlexibleUnion::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExplicitFlexibleUnion> |
| for ::fidl_test_union::ExplicitFlexibleUnion |
| { |
| fn compat_from(value: crate::ExplicitFlexibleUnion) -> Self { |
| match value { |
| crate::ExplicitFlexibleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitFlexibleUnion::F(value) => { |
| Self::F(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitFlexibleUnion::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::ExplicitFlexibleUnion> |
| for crate::ExplicitFlexibleUnion |
| { |
| fn compat_from(value: ::fidl_test_union::ExplicitFlexibleUnion) -> Self { |
| match value { |
| ::fidl_test_union::ExplicitFlexibleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitFlexibleUnion::F(value) => { |
| Self::F(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitFlexibleUnion::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExplicitFoo> for ::fidl_test_union::ExplicitFoo { |
| fn compat_from(value: crate::ExplicitFoo) -> Self { |
| match value { |
| crate::ExplicitFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitFoo::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::ExplicitFoo> for crate::ExplicitFoo { |
| fn compat_from(value: ::fidl_test_union::ExplicitFoo) -> Self { |
| match value { |
| ::fidl_test_union::ExplicitFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitFoo::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Pizza> for ::fidl_test_union::Pizza { |
| #[inline] |
| fn compat_from(value: crate::Pizza) -> Self { |
| Self { toppings: ::fidl_next::CompatFrom::compat_from(value.toppings) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::Pizza> for crate::Pizza { |
| #[inline] |
| fn compat_from(value: ::fidl_test_union::Pizza) -> Self { |
| Self { toppings: ::fidl_next::CompatFrom::compat_from(value.toppings) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Pasta> for ::fidl_test_union::Pasta { |
| #[inline] |
| fn compat_from(value: crate::Pasta) -> Self { |
| Self { sauce: ::fidl_next::CompatFrom::compat_from(value.sauce) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::Pasta> for crate::Pasta { |
| #[inline] |
| fn compat_from(value: ::fidl_test_union::Pasta) -> Self { |
| Self { sauce: ::fidl_next::CompatFrom::compat_from(value.sauce) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExplicitPizzaOrPasta> |
| for ::fidl_test_union::ExplicitPizzaOrPasta |
| { |
| fn compat_from(value: crate::ExplicitPizzaOrPasta) -> Self { |
| match value { |
| crate::ExplicitPizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitPizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::ExplicitPizzaOrPasta> |
| for crate::ExplicitPizzaOrPasta |
| { |
| fn compat_from(value: ::fidl_test_union::ExplicitPizzaOrPasta) -> Self { |
| match value { |
| ::fidl_test_union::ExplicitPizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitPizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExplicitStrictFoo> for ::fidl_test_union::ExplicitStrictFoo { |
| fn compat_from(value: crate::ExplicitStrictFoo) -> Self { |
| match value { |
| crate::ExplicitStrictFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitStrictFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::ExplicitStrictFoo> for crate::ExplicitStrictFoo { |
| fn compat_from(value: ::fidl_test_union::ExplicitStrictFoo) -> Self { |
| match value { |
| ::fidl_test_union::ExplicitStrictFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitStrictFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExplicitUnion> for ::fidl_test_union::ExplicitUnion { |
| fn compat_from(value: crate::ExplicitUnion) -> Self { |
| match value { |
| crate::ExplicitUnion::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ExplicitUnion::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::ExplicitUnion> for crate::ExplicitUnion { |
| fn compat_from(value: ::fidl_test_union::ExplicitUnion) -> Self { |
| match value { |
| ::fidl_test_union::ExplicitUnion::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ExplicitUnion::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::FieldCollision> for ::fidl_test_union::FieldCollision { |
| fn compat_from(value: crate::FieldCollision) -> Self { |
| match value { |
| crate::FieldCollision::FieldCollisionTag(value) => { |
| Self::FieldCollisionTag(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::FieldCollision> for crate::FieldCollision { |
| fn compat_from(value: ::fidl_test_union::FieldCollision) -> Self { |
| match value { |
| ::fidl_test_union::FieldCollision::FieldCollisionTag(value) => { |
| Self::FieldCollisionTag(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::FlexibleFoo> for ::fidl_test_union::FlexibleFoo { |
| fn compat_from(value: crate::FlexibleFoo) -> Self { |
| match value { |
| crate::FlexibleFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::FlexibleFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::FlexibleFoo::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::FlexibleFoo> for crate::FlexibleFoo { |
| fn compat_from(value: ::fidl_test_union::FlexibleFoo) -> Self { |
| match value { |
| ::fidl_test_union::FlexibleFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::FlexibleFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::FlexibleFoo::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::FlexiblePizzaOrPasta> |
| for ::fidl_test_union::FlexiblePizzaOrPasta |
| { |
| fn compat_from(value: crate::FlexiblePizzaOrPasta) -> Self { |
| match value { |
| crate::FlexiblePizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::FlexiblePizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::FlexiblePizzaOrPasta::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::FlexiblePizzaOrPasta> |
| for crate::FlexiblePizzaOrPasta |
| { |
| fn compat_from(value: ::fidl_test_union::FlexiblePizzaOrPasta) -> Self { |
| match value { |
| ::fidl_test_union::FlexiblePizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::FlexiblePizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::FlexiblePizzaOrPasta::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::FlexibleUnion> for ::fidl_test_union::FlexibleUnion { |
| fn compat_from(value: crate::FlexibleUnion) -> Self { |
| match value { |
| crate::FlexibleUnion::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::FlexibleUnion::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::FlexibleUnion::VectorStringAlsoNeedsConstructor(value) => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::CompatFrom::compat_from( |
| value, |
| )) |
| } |
| |
| crate::FlexibleUnion::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::FlexibleUnion> for crate::FlexibleUnion { |
| fn compat_from(value: ::fidl_test_union::FlexibleUnion) -> Self { |
| match value { |
| ::fidl_test_union::FlexibleUnion::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::FlexibleUnion::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::FlexibleUnion::VectorStringAlsoNeedsConstructor(value) => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::CompatFrom::compat_from( |
| value, |
| )) |
| } |
| |
| ::fidl_test_union::FlexibleUnion::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::NewerSimpleUnion> for ::fidl_test_union::NewerSimpleUnion { |
| fn compat_from(value: crate::NewerSimpleUnion) -> Self { |
| match value { |
| crate::NewerSimpleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::NewerSimpleUnion::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::NewerSimpleUnion::V(value) => { |
| Self::V(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::NewerSimpleUnion::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::NewerSimpleUnion> for crate::NewerSimpleUnion { |
| fn compat_from(value: ::fidl_test_union::NewerSimpleUnion) -> Self { |
| match value { |
| ::fidl_test_union::NewerSimpleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::NewerSimpleUnion::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::NewerSimpleUnion::V(value) => { |
| Self::V(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::NewerSimpleUnion::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::NullableUnionStruct> |
| for ::fidl_test_union::NullableUnionStruct |
| { |
| #[inline] |
| fn compat_from(value: crate::NullableUnionStruct) -> Self { |
| Self { the_union: ::fidl_next::CompatFrom::compat_from(value.the_union) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::NullableUnionStruct> |
| for crate::NullableUnionStruct |
| { |
| #[inline] |
| fn compat_from(value: ::fidl_test_union::NullableUnionStruct) -> Self { |
| Self { the_union: ::fidl_next::CompatFrom::compat_from(value.the_union) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::OlderSimpleUnion> for ::fidl_test_union::OlderSimpleUnion { |
| fn compat_from(value: crate::OlderSimpleUnion) -> Self { |
| match value { |
| crate::OlderSimpleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::OlderSimpleUnion::F(value) => { |
| Self::F(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::OlderSimpleUnion::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::OlderSimpleUnion> for crate::OlderSimpleUnion { |
| fn compat_from(value: ::fidl_test_union::OlderSimpleUnion) -> Self { |
| match value { |
| ::fidl_test_union::OlderSimpleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::OlderSimpleUnion::F(value) => { |
| Self::F(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::OlderSimpleUnion::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::PizzaOrPasta> for ::fidl_test_union::PizzaOrPasta { |
| fn compat_from(value: crate::PizzaOrPasta) -> Self { |
| match value { |
| crate::PizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::PizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::PizzaOrPasta> for crate::PizzaOrPasta { |
| fn compat_from(value: ::fidl_test_union::PizzaOrPasta) -> Self { |
| match value { |
| ::fidl_test_union::PizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::PizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ReverseOrdinalUnion> |
| for ::fidl_test_union::ReverseOrdinalUnion |
| { |
| fn compat_from(value: crate::ReverseOrdinalUnion) -> Self { |
| match value { |
| crate::ReverseOrdinalUnion::First(value) => { |
| Self::First(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::ReverseOrdinalUnion::Second(value) => { |
| Self::Second(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::ReverseOrdinalUnion> |
| for crate::ReverseOrdinalUnion |
| { |
| fn compat_from(value: ::fidl_test_union::ReverseOrdinalUnion) -> Self { |
| match value { |
| ::fidl_test_union::ReverseOrdinalUnion::First(value) => { |
| Self::First(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::ReverseOrdinalUnion::Second(value) => { |
| Self::Second(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StrictBoundedUnion> for ::fidl_test_union::StrictBoundedUnion { |
| fn compat_from(value: crate::StrictBoundedUnion) -> Self { |
| match value { |
| crate::StrictBoundedUnion::V(value) => { |
| Self::V(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::StrictBoundedUnion> for crate::StrictBoundedUnion { |
| fn compat_from(value: ::fidl_test_union::StrictBoundedUnion) -> Self { |
| match value { |
| ::fidl_test_union::StrictBoundedUnion::V(value) => { |
| Self::V(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StrictFoo> for ::fidl_test_union::StrictFoo { |
| fn compat_from(value: crate::StrictFoo) -> Self { |
| match value { |
| crate::StrictFoo::S(value) => Self::S(::fidl_next::CompatFrom::compat_from(value)), |
| |
| crate::StrictFoo::I(value) => Self::I(::fidl_next::CompatFrom::compat_from(value)), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::StrictFoo> for crate::StrictFoo { |
| fn compat_from(value: ::fidl_test_union::StrictFoo) -> Self { |
| match value { |
| ::fidl_test_union::StrictFoo::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::StrictFoo::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StrictPizzaOrPasta> for ::fidl_test_union::StrictPizzaOrPasta { |
| fn compat_from(value: crate::StrictPizzaOrPasta) -> Self { |
| match value { |
| crate::StrictPizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::StrictPizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::StrictPizzaOrPasta> for crate::StrictPizzaOrPasta { |
| fn compat_from(value: ::fidl_test_union::StrictPizzaOrPasta) -> Self { |
| match value { |
| ::fidl_test_union::StrictPizzaOrPasta::Pizza(value) => { |
| Self::Pizza(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::StrictPizzaOrPasta::Pasta(value) => { |
| Self::Pasta(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StrictSimpleUnion> for ::fidl_test_union::StrictSimpleUnion { |
| fn compat_from(value: crate::StrictSimpleUnion) -> Self { |
| match value { |
| crate::StrictSimpleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::StrictSimpleUnion::F(value) => { |
| Self::F(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::StrictSimpleUnion::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::StrictSimpleUnion> for crate::StrictSimpleUnion { |
| fn compat_from(value: ::fidl_test_union::StrictSimpleUnion) -> Self { |
| match value { |
| ::fidl_test_union::StrictSimpleUnion::I(value) => { |
| Self::I(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::StrictSimpleUnion::F(value) => { |
| Self::F(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::StrictSimpleUnion::S(value) => { |
| Self::S(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StrictUnion> for ::fidl_test_union::StrictUnion { |
| fn compat_from(value: crate::StrictUnion) -> Self { |
| match value { |
| crate::StrictUnion::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::StrictUnion::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::StrictUnion::VectorStringAlsoNeedsConstructor(value) => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::CompatFrom::compat_from( |
| value, |
| )) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::StrictUnion> for crate::StrictUnion { |
| fn compat_from(value: ::fidl_test_union::StrictUnion) -> Self { |
| match value { |
| ::fidl_test_union::StrictUnion::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::StrictUnion::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::StrictUnion::VectorStringAlsoNeedsConstructor(value) => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::CompatFrom::compat_from( |
| value, |
| )) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StructWithNullableUnion> |
| for ::fidl_test_union::StructWithNullableUnion |
| { |
| #[inline] |
| fn compat_from(value: crate::StructWithNullableUnion) -> Self { |
| Self { x1: ::fidl_next::CompatFrom::compat_from(value.x1) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::StructWithNullableUnion> |
| for crate::StructWithNullableUnion |
| { |
| #[inline] |
| fn compat_from(value: ::fidl_test_union::StructWithNullableUnion) -> Self { |
| Self { x1: ::fidl_next::CompatFrom::compat_from(value.x1) } |
| } |
| } |
| |
| impl |
| ::fidl_next::CompatFrom< |
| crate::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse, |
| > for ::fidl_test_union::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| { |
| #[inline] |
| fn compat_from( |
| value: crate::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse, |
| ) -> Self { |
| Self { xu: ::fidl_next::CompatFrom::compat_from(value.xu) } |
| } |
| } |
| |
| impl |
| ::fidl_next::CompatFrom< |
| ::fidl_test_union::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse, |
| > for crate::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse |
| { |
| #[inline] |
| fn compat_from( |
| value: ::fidl_test_union::TestProtocolStrictUnionHenceResponseMayBeStackAllocatedResponse, |
| ) -> Self { |
| Self { xu: ::fidl_next::CompatFrom::compat_from(value.xu) } |
| } |
| } |
| |
| impl |
| ::fidl_next::CompatFrom< |
| crate::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse, |
| > for ::fidl_test_union::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| { |
| #[inline] |
| fn compat_from( |
| value: crate::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse, |
| ) -> Self { |
| Self { xu: ::fidl_next::CompatFrom::compat_from(value.xu) } |
| } |
| } |
| |
| impl |
| ::fidl_next::CompatFrom< |
| ::fidl_test_union::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse, |
| > for crate::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse |
| { |
| #[inline] |
| fn compat_from( |
| value: ::fidl_test_union::TestProtocolFlexibleUnionHenceResponseMustBeHeapAllocatedResponse, |
| ) -> Self { |
| Self { xu: ::fidl_next::CompatFrom::compat_from(value.xu) } |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| /// An alias for a client over `zx::Channel` for the `TestProtocol` |
| /// protocol. |
| pub type TestProtocolProxy = ::fidl_next::Client<crate::TestProtocol>; |
| |
| impl ::fidl_next::CompatFrom<crate::TestProtocol> for ::fidl_test_union::TestProtocolMarker { |
| fn compat_from(_: crate::TestProtocol) -> Self { |
| Self |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::TestProtocolMarker> for crate::TestProtocol { |
| fn compat_from(_: ::fidl_test_union::TestProtocolMarker) -> Self { |
| Self |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| |
| impl ::fidl_next::ClientCompatFrom<::fidl_test_union::TestProtocolProxy> for crate::TestProtocol { |
| fn client_compat_from( |
| proxy: ::fidl_test_union::TestProtocolProxy, |
| ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> { |
| let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel(); |
| let client_end = ::fidl_next::ClientEnd::from_untyped(channel); |
| ::fidl_next::ClientDispatcher::new(client_end) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Union> for ::fidl_test_union::Union { |
| fn compat_from(value: crate::Union) -> Self { |
| match value { |
| crate::Union::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::Union::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::Union::VectorStringAlsoNeedsConstructor(value) => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::CompatFrom::compat_from( |
| value, |
| )) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::Union> for crate::Union { |
| fn compat_from(value: ::fidl_test_union::Union) -> Self { |
| match value { |
| ::fidl_test_union::Union::Primitive(value) => { |
| Self::Primitive(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::Union::StringNeedsConstructor(value) => { |
| Self::StringNeedsConstructor(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::Union::VectorStringAlsoNeedsConstructor(value) => { |
| Self::VectorStringAlsoNeedsConstructor(::fidl_next::CompatFrom::compat_from( |
| value, |
| )) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::UnionContainingEmptyStruct> |
| for ::fidl_test_union::UnionContainingEmptyStruct |
| { |
| fn compat_from(value: crate::UnionContainingEmptyStruct) -> Self { |
| match value { |
| crate::UnionContainingEmptyStruct::Empty(value) => { |
| Self::Empty(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::UnionContainingEmptyStruct::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::UnionContainingEmptyStruct> |
| for crate::UnionContainingEmptyStruct |
| { |
| fn compat_from(value: ::fidl_test_union::UnionContainingEmptyStruct) -> Self { |
| match value { |
| ::fidl_test_union::UnionContainingEmptyStruct::Empty(value) => { |
| Self::Empty(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::UnionContainingEmptyStruct::__SourceBreaking { |
| unknown_ordinal, |
| } => Self::UnknownOrdinal_(unknown_ordinal), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::UnionSandwich> for ::fidl_test_union::UnionSandwich { |
| #[inline] |
| fn compat_from(value: crate::UnionSandwich) -> Self { |
| Self { |
| a: ::fidl_next::CompatFrom::compat_from(value.a), |
| |
| u: ::fidl_next::CompatFrom::compat_from(value.u), |
| |
| b: ::fidl_next::CompatFrom::compat_from(value.b), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::UnionSandwich> for crate::UnionSandwich { |
| #[inline] |
| fn compat_from(value: ::fidl_test_union::UnionSandwich) -> Self { |
| Self { |
| a: ::fidl_next::CompatFrom::compat_from(value.a), |
| |
| u: ::fidl_next::CompatFrom::compat_from(value.u), |
| |
| b: ::fidl_next::CompatFrom::compat_from(value.b), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::UnionWithAttributes> |
| for ::fidl_test_union::UnionWithAttributes |
| { |
| fn compat_from(value: crate::UnionWithAttributes) -> Self { |
| match value { |
| crate::UnionWithAttributes::X(value) => { |
| Self::X(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::UnionWithAttributes::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_union::UnionWithAttributes> |
| for crate::UnionWithAttributes |
| { |
| fn compat_from(value: ::fidl_test_union::UnionWithAttributes) -> Self { |
| match value { |
| ::fidl_test_union::UnionWithAttributes::X(value) => { |
| Self::X(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_union::UnionWithAttributes::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| } |