| // DO NOT EDIT: This file is machine-generated by fidlgen |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)] |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct BitsMember: u32 { |
| const BIT_ONE = 1; |
| const BIT_TWO = 2; |
| const _ = !0; |
| } |
| } |
| |
| impl ::fidl_next::Encodable for BitsMember { |
| type Encoded = WireBitsMember; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for BitsMember |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for BitsMember |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireBitsMember { value } = out); |
| |
| let _ = value.write(::fidl_next::WireU32::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireBitsMember> for BitsMember { |
| fn from(wire: WireBitsMember) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireBitsMember> for BitsMember { |
| #[inline] |
| fn from_wire(wire: WireBitsMember) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireBitsMember { |
| type Natural = BitsMember; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireBitsMember> for BitsMember { |
| #[inline] |
| fn from_wire_ref(wire: &WireBitsMember) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`BitsMember`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireBitsMember { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireBitsMember { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire bits have no padding |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireBitsMember |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<BitsMember> for WireBitsMember { |
| fn from(natural: BitsMember) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(u32)] |
| pub enum Op { |
| Add = 1, |
| Mul = 2, |
| Div = 3, |
| UnknownOrdinal_(u32) = 4, |
| } |
| |
| impl ::fidl_next::Encodable for Op { |
| type Encoded = WireOp; |
| } |
| impl ::std::convert::From<u32> for Op { |
| fn from(value: u32) -> Self { |
| match value { |
| 1 => Self::Add, |
| 2 => Self::Mul, |
| 3 => Self::Div, |
| |
| _ => Self::UnknownOrdinal_(value), |
| } |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Op |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Op |
| where |
| ___E: ?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 WireOp { value } = out); |
| let _ = value.write(::fidl_next::WireU32::from(match *self { |
| Self::Add => 1, |
| |
| Self::Mul => 2, |
| |
| Self::Div => 3, |
| |
| Self::UnknownOrdinal_(value) => value, |
| })); |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireOp> for Op { |
| fn from(wire: WireOp) -> Self { |
| match u32::from(wire.value) { |
| 1 => Self::Add, |
| |
| 2 => Self::Mul, |
| |
| 3 => Self::Div, |
| |
| value => Self::UnknownOrdinal_(value), |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireOp> for Op { |
| #[inline] |
| fn from_wire(wire: WireOp) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireOp { |
| type Natural = Op; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireOp> for Op { |
| #[inline] |
| fn from_wire_ref(wire: &WireOp) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`Op`]. |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(transparent)] |
| pub struct WireOp { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOp { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire enums have no padding |
| } |
| } |
| |
| impl WireOp { |
| pub const ADD: WireOp = WireOp { value: ::fidl_next::WireU32(1) }; |
| |
| pub const MUL: WireOp = WireOp { value: ::fidl_next::WireU32(2) }; |
| |
| pub const DIV: WireOp = WireOp { value: ::fidl_next::WireU32(3) }; |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOp |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<Op> for WireOp { |
| fn from(natural: Op) -> Self { |
| match natural { |
| Op::Add => WireOp::ADD, |
| |
| Op::Mul => WireOp::MUL, |
| |
| Op::Div => WireOp::DIV, |
| |
| Op::UnknownOrdinal_(value) => WireOp { value: ::fidl_next::WireU32::from(value) }, |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct OverrideTest { |
| pub op: crate::Op, |
| |
| pub left: ::core::option::Option<::std::boxed::Box<crate::Expression>>, |
| |
| pub right: ::core::option::Option<::std::boxed::Box<crate::Expression>>, |
| } |
| |
| impl ::fidl_next::Encodable for OverrideTest { |
| type Encoded = WireOverrideTest<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for OverrideTest |
| 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 { |
| op, |
| left, |
| right, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.op, encoder_, op)?; |
| |
| ::fidl_next::Encode::encode(self.left, encoder_, left)?; |
| |
| ::fidl_next::Encode::encode(self.right, encoder_, right)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for OverrideTest |
| 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 { |
| |
| op, |
| left, |
| right, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.op, encoder_, op)?; |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.left, encoder_, left)?; |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.right, encoder_, right)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for OverrideTest { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireOverrideTest<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for OverrideTest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| OverrideTest: ::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 OverrideTest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| OverrideTest: ::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<WireOverrideTest<'de>> for OverrideTest { |
| #[inline] |
| fn from_wire(wire: WireOverrideTest<'de>) -> Self { |
| Self { |
| op: ::fidl_next::FromWire::from_wire(wire.op), |
| |
| left: ::fidl_next::FromWire::from_wire(wire.left), |
| |
| right: ::fidl_next::FromWire::from_wire(wire.right), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireOverrideTest<'de> { |
| type Natural = OverrideTest; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireOverrideTest<'de>> for OverrideTest { |
| #[inline] |
| fn from_wire_ref(wire: &WireOverrideTest<'de>) -> Self { |
| Self { |
| op: ::fidl_next::FromWireRef::from_wire_ref(&wire.op), |
| |
| left: ::fidl_next::FromWireRef::from_wire_ref(&wire.left), |
| |
| right: ::fidl_next::FromWireRef::from_wire_ref(&wire.right), |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`OverrideTest`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireOverrideTest<'de> { |
| pub op: crate::WireOp, |
| |
| pub left: crate::WireOptionalExpression<'de>, |
| |
| pub right: crate::WireOptionalExpression<'de>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireOverrideTest<'_>>(), 40); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireOverrideTest<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireOverrideTest<'_>, op), 0); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireOverrideTest<'_>, left), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireOverrideTest<'_>, right), 24); |
| |
| unsafe impl ::fidl_next::Wire for WireOverrideTest<'static> { |
| type Decoded<'de> = WireOverrideTest<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| op, |
| left, |
| right, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(op); |
| |
| ::fidl_next::Wire::zero_padding(left); |
| |
| ::fidl_next::Wire::zero_padding(right); |
| |
| unsafe { |
| out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4); |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOverrideTest<'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 op, |
| mut left, |
| mut right, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(op.as_mut(), decoder_)?; |
| |
| ::fidl_next::Decode::decode(left.as_mut(), decoder_)?; |
| |
| ::fidl_next::Decode::decode(right.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct Flags: u16 { |
| const INLINE = 1; |
| const _ = !0; |
| } |
| } |
| |
| impl ::fidl_next::Encodable for Flags { |
| type Encoded = WireFlags; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Flags |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Flags |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlags { value } = out); |
| |
| let _ = value.write(::fidl_next::WireU16::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireFlags> for Flags { |
| fn from(wire: WireFlags) -> Self { |
| Self::from_bits_retain(u16::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireFlags> for Flags { |
| #[inline] |
| fn from_wire(wire: WireFlags) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireFlags { |
| type Natural = Flags; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireFlags> for Flags { |
| #[inline] |
| fn from_wire_ref(wire: &WireFlags) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`Flags`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireFlags { |
| value: ::fidl_next::WireU16, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFlags { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire bits have no padding |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireFlags |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<Flags> for WireFlags { |
| fn from(natural: Flags) -> Self { |
| Self { value: ::fidl_next::WireU16::from(natural.bits()) } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug, Default)] |
| pub struct FunctionApplication { |
| pub func: ::core::option::Option<::std::string::String>, |
| |
| pub args: ::core::option::Option< |
| ::std::vec::Vec<::core::option::Option<::std::boxed::Box<crate::Expression>>>, |
| >, |
| |
| pub flags: ::core::option::Option<crate::Flags>, |
| } |
| |
| impl FunctionApplication { |
| fn __max_ordinal(&self) -> usize { |
| if self.flags.is_some() { |
| return 4; |
| } |
| |
| if self.args.is_some() { |
| return 3; |
| } |
| |
| if self.func.is_some() { |
| return 1; |
| } |
| |
| 0 |
| } |
| } |
| |
| impl ::fidl_next::Encodable for FunctionApplication { |
| type Encoded = WireFunctionApplication<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for FunctionApplication |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| mut self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFunctionApplication { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 4 => { |
| if let Some(value) = self.flags.take() { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| 3 => { |
| if let Some(value) = self.args.take() { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| 1 => { |
| if let Some(value) = self.func.take() { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FunctionApplication |
| where |
| ___E: ::fidl_next::Encoder + ?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 WireFunctionApplication { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 4 => { |
| if let Some(value) = &self.flags { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| 3 => { |
| if let Some(value) = &self.args { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| 1 => { |
| if let Some(value) = &self.func { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireFunctionApplication<'de>> for FunctionApplication { |
| #[inline] |
| fn from_wire(wire_: WireFunctionApplication<'de>) -> Self { |
| let wire_ = ::core::mem::ManuallyDrop::new(wire_); |
| |
| let func = wire_.table.get(1); |
| |
| let args = wire_.table.get(3); |
| |
| let flags = wire_.table.get(4); |
| |
| Self { |
| |
| |
| func: func.map(|envelope| ::fidl_next::FromWire::from_wire( |
| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() } |
| )), |
| |
| |
| args: args.map(|envelope| ::fidl_next::FromWire::from_wire( |
| unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireOptionalExpression<'de>>>() } |
| )), |
| |
| |
| flags: flags.map(|envelope| ::fidl_next::FromWire::from_wire( |
| unsafe { envelope.read_unchecked::<crate::WireFlags>() } |
| )), |
| |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireFunctionApplication<'de> { |
| type Natural = FunctionApplication; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireFunctionApplication<'de>> for FunctionApplication { |
| #[inline] |
| fn from_wire_ref(wire: &WireFunctionApplication<'de>) -> Self { |
| Self { |
| |
| |
| func: wire.table.get(1) |
| .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref( |
| unsafe { envelope.deref_unchecked::<::fidl_next::WireString<'de>>() } |
| )), |
| |
| |
| args: wire.table.get(3) |
| .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref( |
| unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireOptionalExpression<'de>>>() } |
| )), |
| |
| |
| flags: wire.table.get(4) |
| .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref( |
| unsafe { envelope.deref_unchecked::<crate::WireFlags>() } |
| )), |
| |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`FunctionApplication`]. |
| #[repr(C)] |
| pub struct WireFunctionApplication<'de> { |
| table: ::fidl_next::WireTable<'de>, |
| } |
| |
| impl<'de> Drop for WireFunctionApplication<'de> { |
| fn drop(&mut self) { |
| let _ = self |
| .table |
| .get(1) |
| .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() }); |
| |
| let _ = self.table.get(3).map(|envelope| unsafe { |
| envelope |
| .read_unchecked::<::fidl_next::WireVector<'de, crate::WireOptionalExpression<'de>>>( |
| ) |
| }); |
| |
| let _ = self |
| .table |
| .get(4) |
| .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireFlags>() }); |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFunctionApplication<'static> { |
| type Decoded<'de> = WireFunctionApplication<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { table } = out); |
| ::fidl_next::WireTable::zero_padding(table); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireFunctionApplication<'static> |
| where |
| ___D: ::fidl_next::Decoder + ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { table } = slot); |
| |
| ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| { |
| match ordinal { |
| 0 => unsafe { ::core::hint::unreachable_unchecked() }, |
| |
| 1 => { |
| ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>( |
| slot.as_mut(), |
| decoder, |
| )?; |
| |
| let value = unsafe { |
| slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>() |
| }; |
| |
| if value.len() > 100 { |
| return Err(::fidl_next::DecodeError::VectorTooLong { |
| size: value.len() as u64, |
| limit: 100, |
| }); |
| } |
| |
| Ok(()) |
| } |
| |
| 3 => { |
| ::fidl_next::WireEnvelope::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, crate::WireOptionalExpression<'static>>, |
| >(slot.as_mut(), decoder)?; |
| |
| let value = unsafe { |
| slot |
| .deref_unchecked() |
| .deref_unchecked::< |
| ::fidl_next::WireVector<'_, crate::WireOptionalExpression<'_>> |
| >() |
| }; |
| |
| if value.len() > 5 { |
| return Err(::fidl_next::DecodeError::VectorTooLong { |
| size: value.len() as u64, |
| limit: 5, |
| }); |
| } |
| |
| Ok(()) |
| } |
| |
| 4 => { |
| ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireFlags>( |
| slot.as_mut(), |
| decoder, |
| )?; |
| |
| Ok(()) |
| } |
| |
| _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder), |
| } |
| }) |
| } |
| } |
| |
| impl<'de> WireFunctionApplication<'de> { |
| pub fn func(&self) -> ::core::option::Option<&::fidl_next::WireString<'de>> { |
| unsafe { Some(self.table.get(1)?.deref_unchecked()) } |
| } |
| |
| pub fn args( |
| &self, |
| ) -> ::core::option::Option<&::fidl_next::WireVector<'de, crate::WireOptionalExpression<'de>>> |
| { |
| unsafe { Some(self.table.get(3)?.deref_unchecked()) } |
| } |
| |
| pub fn flags(&self) -> ::core::option::Option<&crate::WireFlags> { |
| unsafe { Some(self.table.get(4)?.deref_unchecked()) } |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireFunctionApplication<'de> { |
| fn fmt( |
| &self, |
| f: &mut ::core::fmt::Formatter<'_>, |
| ) -> ::core::result::Result<(), ::core::fmt::Error> { |
| f.debug_struct("FunctionApplication") |
| .field("func", &self.func()) |
| .field("args", &self.args()) |
| .field("flags", &self.flags()) |
| .finish() |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum Expression { |
| Value(u64), |
| |
| BinOp(crate::OverrideTest), |
| |
| FunctionApplication(crate::FunctionApplication), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for Expression { |
| type Encoded = WireExpression<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for Expression |
| 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 WireExpression { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Value(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, u64>(value, 1, encoder, raw)? |
| } |
| |
| Self::BinOp(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, crate::OverrideTest>( |
| value, 2, encoder, raw, |
| )? |
| } |
| |
| Self::FunctionApplication(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| crate::FunctionApplication, |
| >(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 Expression |
| 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 WireExpression { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Value(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &u64>(value, 1, encoder, raw)? |
| } |
| |
| Self::BinOp(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &crate::OverrideTest>( |
| value, 2, encoder, raw, |
| )? |
| } |
| |
| Self::FunctionApplication(value) => ::fidl_next::RawWireUnion::encode_as::< |
| ___E, |
| &crate::FunctionApplication, |
| >(value, 3, encoder, raw)?, |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for Expression { |
| type EncodedOption = WireOptionalExpression<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Expression |
| where |
| ___E: ?Sized, |
| Expression: ::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 WireOptionalExpression { 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 Expression |
| where |
| ___E: ?Sized, |
| Expression: ::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 WireOptionalExpression { 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<WireExpression<'de>> for Expression { |
| #[inline] |
| fn from_wire(wire: WireExpression<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Value(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireU64>() |
| })), |
| |
| 2 => Self::BinOp(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WireOverrideTest<'de>>() |
| })), |
| |
| 3 => Self::FunctionApplication(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<crate::WireFunctionApplication<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExpression<'de> { |
| type Natural = Expression; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExpression<'de>> for Expression { |
| #[inline] |
| fn from_wire_ref(wire: &WireExpression<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Value(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireU64>() |
| })), |
| |
| 2 => Self::BinOp(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WireOverrideTest<'de>>() |
| })), |
| |
| 3 => Self::FunctionApplication(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<crate::WireFunctionApplication<'de>>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExpression<'de>> for Expression { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExpression<'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 WireOptionalExpression<'de> { |
| type Natural = ::core::option::Option<Expression>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalExpression<'de>> for Box<Expression> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExpression<'de>) -> ::core::option::Option<Self> { |
| <Expression as ::fidl_next::FromWireOption<WireOptionalExpression<'de>>>::from_wire_option( |
| wire, |
| ) |
| .map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalExpression<'de>> for Box<Expression> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalExpression<'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 [`Expression`]. |
| #[repr(transparent)] |
| pub struct WireExpression<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireExpression<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU64>() }; |
| } |
| |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<crate::WireOverrideTest<'de>>() }; |
| } |
| |
| 3 => { |
| let _ = unsafe { |
| self.raw.get().read_unchecked::<crate::WireFunctionApplication<'de>>() |
| }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExpression<'static> { |
| type Decoded<'de> = WireExpression<'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 expression { |
| pub enum Ref<'de> { |
| Value(&'de ::fidl_next::WireU64), |
| |
| BinOp(&'de crate::WireOverrideTest<'de>), |
| |
| FunctionApplication(&'de crate::WireFunctionApplication<'de>), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireExpression<'de> { |
| pub fn as_ref(&self) -> crate::expression::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::expression::Ref::Value(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireU64>() |
| }), |
| |
| 2 => crate::expression::Ref::BinOp(unsafe { |
| self.raw.get().deref_unchecked::<crate::WireOverrideTest<'_>>() |
| }), |
| |
| 3 => crate::expression::Ref::FunctionApplication(unsafe { |
| self.raw.get().deref_unchecked::<crate::WireFunctionApplication<'_>>() |
| }), |
| |
| unknown => crate::expression::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExpression<'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::WireU64>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOverrideTest<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| crate::WireFunctionApplication<'static>, |
| >(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExpression<'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::WireU64>().fmt(f) }, |
| 2 => unsafe { self.raw.get().deref_unchecked::<crate::WireOverrideTest<'_>>().fmt(f) }, |
| 3 => unsafe { |
| self.raw.get().deref_unchecked::<crate::WireFunctionApplication<'_>>().fmt(f) |
| }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExpression<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExpression<'static> { |
| type Decoded<'de> = WireOptionalExpression<'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> WireOptionalExpression<'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<&WireExpression<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExpression<'de>> { |
| if self.is_some() { |
| Some(WireExpression { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExpression<'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::WireU64>(raw, decoder)?, |
| |
| 2 => ::fidl_next::RawWireUnion::decode_as::<___D, crate::WireOverrideTest<'static>>( |
| raw, decoder, |
| )?, |
| |
| 3 => ::fidl_next::RawWireUnion::decode_as::< |
| ___D, |
| crate::WireFunctionApplication<'static>, |
| >(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalExpression<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum UnionMember { |
| UnionData(u8), |
| |
| UnknownOrdinal_(u64), |
| } |
| |
| impl ::fidl_next::Encodable for UnionMember { |
| type Encoded = WireUnionMember<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for UnionMember |
| 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 WireUnionMember { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::UnionData(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, u8>(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 UnionMember |
| 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 WireUnionMember { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::UnionData(value) => { |
| ::fidl_next::RawWireUnion::encode_as::<___E, &u8>(value, 2, encoder, raw)? |
| } |
| |
| Self::UnknownOrdinal_(ordinal) => { |
| return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for UnionMember { |
| type EncodedOption = WireOptionalUnionMember<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for UnionMember |
| where |
| ___E: ?Sized, |
| UnionMember: ::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 WireOptionalUnionMember { 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 UnionMember |
| where |
| ___E: ?Sized, |
| UnionMember: ::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 WireOptionalUnionMember { 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<WireUnionMember<'de>> for UnionMember { |
| #[inline] |
| fn from_wire(wire: WireUnionMember<'de>) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 2 => Self::UnionData(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<u8>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireUnionMember<'de> { |
| type Natural = UnionMember; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireUnionMember<'de>> for UnionMember { |
| #[inline] |
| fn from_wire_ref(wire: &WireUnionMember<'de>) -> Self { |
| match wire.raw.ordinal() { |
| 2 => Self::UnionData(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<u8>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnionMember<'de>> for UnionMember { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalUnionMember<'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 WireOptionalUnionMember<'de> { |
| type Natural = ::core::option::Option<UnionMember>; |
| } |
| |
| impl<'de> ::fidl_next::FromWireOption<WireOptionalUnionMember<'de>> for Box<UnionMember> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalUnionMember<'de>) -> ::core::option::Option<Self> { |
| < |
| UnionMember as ::fidl_next::FromWireOption<WireOptionalUnionMember<'de>> |
| >::from_wire_option(wire).map(Box::new) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalUnionMember<'de>> for Box<UnionMember> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalUnionMember<'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 [`UnionMember`]. |
| #[repr(transparent)] |
| pub struct WireUnionMember<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| impl<'de> Drop for WireUnionMember<'de> { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 2 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<u8>() }; |
| } |
| |
| _ => (), |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireUnionMember<'static> { |
| type Decoded<'de> = WireUnionMember<'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_member { |
| pub enum Ref<'de> { |
| UnionData(&'de u8), |
| |
| UnknownOrdinal_(u64), |
| } |
| } |
| |
| impl<'de> WireUnionMember<'de> { |
| pub fn as_ref(&self) -> crate::union_member::Ref<'_> { |
| match self.raw.ordinal() { |
| 2 => crate::union_member::Ref::UnionData(unsafe { |
| self.raw.get().deref_unchecked::<u8>() |
| }), |
| |
| unknown => crate::union_member::Ref::UnknownOrdinal_(unknown), |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireUnionMember<'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, u8>(raw, decoder)?, |
| |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireUnionMember<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| match self.raw.ordinal() { |
| 2 => unsafe { self.raw.get().deref_unchecked::<u8>().fmt(f) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalUnionMember<'de> { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalUnionMember<'static> { |
| type Decoded<'de> = WireOptionalUnionMember<'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> WireOptionalUnionMember<'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<&WireUnionMember<'de>> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireUnionMember<'de>> { |
| if self.is_some() { |
| Some(WireUnionMember { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalUnionMember<'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, u8>(raw, decoder)?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireOptionalUnionMember<'de> { |
| fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { |
| self.as_ref().fmt(f) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct TableData { |
| pub data: u8, |
| } |
| |
| impl ::fidl_next::Encodable for TableData { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireTableData> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true && <u8 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(), |
| ) |
| }; |
| |
| type Encoded = WireTableData; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for TableData |
| 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 Self::Encoded { |
| data, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.data, encoder_, data)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for TableData |
| 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 { |
| |
| data, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.data, encoder_, data)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for TableData { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireTableData>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for TableData |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| TableData: ::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 TableData |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| TableData: ::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<WireTableData> for TableData { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireTableData, Self> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(), |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: WireTableData) -> Self { |
| Self { data: ::fidl_next::FromWire::from_wire(wire.data) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireTableData { |
| type Natural = TableData; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireTableData> for TableData { |
| #[inline] |
| fn from_wire_ref(wire: &WireTableData) -> Self { |
| Self { data: ::fidl_next::FromWireRef::from_wire_ref(&wire.data) } |
| } |
| } |
| |
| /// The wire type corresponding to [`TableData`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct WireTableData { |
| pub data: u8, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireTableData>(), 1); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireTableData>(), 1); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireTableData, data), 0); |
| |
| unsafe impl ::fidl_next::Wire for WireTableData { |
| type Decoded<'de> = WireTableData; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| data, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(data); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireTableData |
| 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 data, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(data.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug, Default)] |
| pub struct TableMember { |
| pub table_data: ::core::option::Option<::std::vec::Vec<crate::TableData>>, |
| } |
| |
| impl TableMember { |
| fn __max_ordinal(&self) -> usize { |
| if self.table_data.is_some() { |
| return 2; |
| } |
| |
| 0 |
| } |
| } |
| |
| impl ::fidl_next::Encodable for TableMember { |
| type Encoded = WireTableMember<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for TableMember |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| { |
| #[inline] |
| fn encode( |
| mut self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireTableMember { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 2 => { |
| if let Some(value) = self.table_data.take() { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for TableMember |
| where |
| ___E: ::fidl_next::Encoder + ?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 WireTableMember { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 2 => { |
| if let Some(value) = &self.table_data { |
| ::fidl_next::WireEnvelope::encode_value( |
| value, |
| preallocated.encoder, |
| &mut out, |
| )?; |
| } else { |
| ::fidl_next::WireEnvelope::encode_zero(&mut out) |
| } |
| } |
| |
| _ => ::fidl_next::WireEnvelope::encode_zero(&mut out), |
| } |
| unsafe { |
| preallocated.write_next(out.assume_init_ref()); |
| } |
| } |
| |
| ::fidl_next::WireTable::encode_len(table, max_ord); |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireTableMember<'de>> for TableMember { |
| #[inline] |
| fn from_wire(wire_: WireTableMember<'de>) -> Self { |
| let wire_ = ::core::mem::ManuallyDrop::new(wire_); |
| |
| let table_data = wire_.table.get(2); |
| |
| Self { |
| table_data: table_data.map(|envelope| { |
| ::fidl_next::FromWire::from_wire(unsafe { |
| envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireTableData>>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireTableMember<'de> { |
| type Natural = TableMember; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireTableMember<'de>> for TableMember { |
| #[inline] |
| fn from_wire_ref(wire: &WireTableMember<'de>) -> Self { |
| Self { |
| table_data: wire.table.get(2).map(|envelope| { |
| ::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireTableData>>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`TableMember`]. |
| #[repr(C)] |
| pub struct WireTableMember<'de> { |
| table: ::fidl_next::WireTable<'de>, |
| } |
| |
| impl<'de> Drop for WireTableMember<'de> { |
| fn drop(&mut self) { |
| let _ = self.table.get(2).map(|envelope| unsafe { |
| envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireTableData>>() |
| }); |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireTableMember<'static> { |
| type Decoded<'de> = WireTableMember<'de>; |
| |
| #[inline] |
| fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge!(let Self { table } = out); |
| ::fidl_next::WireTable::zero_padding(table); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireTableMember<'static> |
| where |
| ___D: ::fidl_next::Decoder + ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { table } = slot); |
| |
| ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| { |
| match ordinal { |
| 0 => unsafe { ::core::hint::unreachable_unchecked() }, |
| |
| 2 => { |
| ::fidl_next::WireEnvelope::decode_as::< |
| ___D, |
| ::fidl_next::WireVector<'static, crate::WireTableData>, |
| >(slot.as_mut(), decoder)?; |
| |
| let value = unsafe { |
| slot.deref_unchecked() |
| .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireTableData>>() |
| }; |
| |
| if value.len() > 10 { |
| return Err(::fidl_next::DecodeError::VectorTooLong { |
| size: value.len() as u64, |
| limit: 10, |
| }); |
| } |
| |
| Ok(()) |
| } |
| |
| _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder), |
| } |
| }) |
| } |
| } |
| |
| impl<'de> WireTableMember<'de> { |
| pub fn table_data( |
| &self, |
| ) -> ::core::option::Option<&::fidl_next::WireVector<'de, crate::WireTableData>> { |
| unsafe { Some(self.table.get(2)?.deref_unchecked()) } |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireTableMember<'de> { |
| fn fmt( |
| &self, |
| f: &mut ::core::fmt::Formatter<'_>, |
| ) -> ::core::result::Result<(), ::core::fmt::Error> { |
| f.debug_struct("TableMember").field("table_data", &self.table_data()).finish() |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct SomeProtocolSomeMethodRequest { |
| pub union_member: crate::UnionMember, |
| |
| pub table_member: crate::TableMember, |
| } |
| |
| impl ::fidl_next::Encodable for SomeProtocolSomeMethodRequest { |
| type Encoded = WireSomeProtocolSomeMethodRequest<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for SomeProtocolSomeMethodRequest |
| 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 { |
| union_member, |
| table_member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.union_member, encoder_, union_member)?; |
| |
| ::fidl_next::Encode::encode(self.table_member, encoder_, table_member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SomeProtocolSomeMethodRequest |
| 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 { |
| |
| union_member, |
| table_member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.union_member, encoder_, union_member)?; |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.table_member, encoder_, table_member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for SomeProtocolSomeMethodRequest { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireSomeProtocolSomeMethodRequest<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for SomeProtocolSomeMethodRequest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| SomeProtocolSomeMethodRequest: ::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 SomeProtocolSomeMethodRequest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| SomeProtocolSomeMethodRequest: ::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<WireSomeProtocolSomeMethodRequest<'de>> |
| for SomeProtocolSomeMethodRequest |
| { |
| #[inline] |
| fn from_wire(wire: WireSomeProtocolSomeMethodRequest<'de>) -> Self { |
| Self { |
| union_member: ::fidl_next::FromWire::from_wire(wire.union_member), |
| |
| table_member: ::fidl_next::FromWire::from_wire(wire.table_member), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireSomeProtocolSomeMethodRequest<'de> { |
| type Natural = SomeProtocolSomeMethodRequest; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireSomeProtocolSomeMethodRequest<'de>> |
| for SomeProtocolSomeMethodRequest |
| { |
| #[inline] |
| fn from_wire_ref(wire: &WireSomeProtocolSomeMethodRequest<'de>) -> Self { |
| Self { |
| union_member: ::fidl_next::FromWireRef::from_wire_ref(&wire.union_member), |
| |
| table_member: ::fidl_next::FromWireRef::from_wire_ref(&wire.table_member), |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`SomeProtocolSomeMethodRequest`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireSomeProtocolSomeMethodRequest<'de> { |
| pub union_member: crate::WireUnionMember<'de>, |
| |
| pub table_member: crate::WireTableMember<'de>, |
| } |
| static_assertions::const_assert_eq!( |
| std::mem::size_of::<WireSomeProtocolSomeMethodRequest<'_>>(), |
| 32 |
| ); |
| static_assertions::const_assert_eq!( |
| std::mem::align_of::<WireSomeProtocolSomeMethodRequest<'_>>(), |
| 8 |
| ); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!(WireSomeProtocolSomeMethodRequest<'_>, union_member), |
| 0 |
| ); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!(WireSomeProtocolSomeMethodRequest<'_>, table_member), |
| 16 |
| ); |
| |
| unsafe impl ::fidl_next::Wire for WireSomeProtocolSomeMethodRequest<'static> { |
| type Decoded<'de> = WireSomeProtocolSomeMethodRequest<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| union_member, |
| table_member, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(union_member); |
| |
| ::fidl_next::Wire::zero_padding(table_member); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireSomeProtocolSomeMethodRequest<'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 union_member, |
| mut table_member, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(union_member.as_mut(), decoder_)?; |
| |
| ::fidl_next::Decode::decode(table_member.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct SomeProtocolSomeMethodResponse { |
| pub bits_member: crate::BitsMember, |
| } |
| |
| impl ::fidl_next::Encodable for SomeProtocolSomeMethodResponse { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization< |
| Self, |
| WireSomeProtocolSomeMethodResponse, |
| > = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true && <crate::BitsMember as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(), |
| ) |
| }; |
| |
| type Encoded = WireSomeProtocolSomeMethodResponse; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for SomeProtocolSomeMethodResponse |
| 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 Self::Encoded { |
| bits_member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.bits_member, encoder_, bits_member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SomeProtocolSomeMethodResponse |
| 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 { |
| |
| bits_member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.bits_member, encoder_, bits_member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for SomeProtocolSomeMethodResponse { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireSomeProtocolSomeMethodResponse>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for SomeProtocolSomeMethodResponse |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| SomeProtocolSomeMethodResponse: ::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 SomeProtocolSomeMethodResponse |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| SomeProtocolSomeMethodResponse: ::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<WireSomeProtocolSomeMethodResponse> for SomeProtocolSomeMethodResponse { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization< |
| WireSomeProtocolSomeMethodResponse, |
| Self, |
| > = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| crate::BitsMember as ::fidl_next::FromWire<crate::WireBitsMember> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: WireSomeProtocolSomeMethodResponse) -> Self { |
| Self { bits_member: ::fidl_next::FromWire::from_wire(wire.bits_member) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireSomeProtocolSomeMethodResponse { |
| type Natural = SomeProtocolSomeMethodResponse; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireSomeProtocolSomeMethodResponse> |
| for SomeProtocolSomeMethodResponse |
| { |
| #[inline] |
| fn from_wire_ref(wire: &WireSomeProtocolSomeMethodResponse) -> Self { |
| Self { bits_member: ::fidl_next::FromWireRef::from_wire_ref(&wire.bits_member) } |
| } |
| } |
| |
| /// The wire type corresponding to [`SomeProtocolSomeMethodResponse`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct WireSomeProtocolSomeMethodResponse { |
| pub bits_member: crate::WireBitsMember, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireSomeProtocolSomeMethodResponse>(), 4); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireSomeProtocolSomeMethodResponse>(), 4); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!(WireSomeProtocolSomeMethodResponse, bits_member), |
| 0 |
| ); |
| |
| unsafe impl ::fidl_next::Wire for WireSomeProtocolSomeMethodResponse { |
| type Decoded<'de> = WireSomeProtocolSomeMethodResponse; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| bits_member, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(bits_member); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireSomeProtocolSomeMethodResponse |
| 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 bits_member, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(bits_member.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(u32)] |
| pub enum SomeProtocolSomeMethodError { |
| ErrorOne = 1, |
| ErrorTwo = 2, |
| UnknownOrdinal_(u32) = 3, |
| } |
| |
| impl ::fidl_next::Encodable for SomeProtocolSomeMethodError { |
| type Encoded = WireSomeProtocolSomeMethodError; |
| } |
| impl ::std::convert::From<u32> for SomeProtocolSomeMethodError { |
| fn from(value: u32) -> Self { |
| match value { |
| 1 => Self::ErrorOne, |
| 2 => Self::ErrorTwo, |
| |
| _ => Self::UnknownOrdinal_(value), |
| } |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for SomeProtocolSomeMethodError |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SomeProtocolSomeMethodError |
| where |
| ___E: ?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 WireSomeProtocolSomeMethodError { value } = out); |
| let _ = value.write(::fidl_next::WireU32::from(match *self { |
| Self::ErrorOne => 1, |
| |
| Self::ErrorTwo => 2, |
| |
| Self::UnknownOrdinal_(value) => value, |
| })); |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireSomeProtocolSomeMethodError> for SomeProtocolSomeMethodError { |
| fn from(wire: WireSomeProtocolSomeMethodError) -> Self { |
| match u32::from(wire.value) { |
| 1 => Self::ErrorOne, |
| |
| 2 => Self::ErrorTwo, |
| |
| value => Self::UnknownOrdinal_(value), |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireSomeProtocolSomeMethodError> for SomeProtocolSomeMethodError { |
| #[inline] |
| fn from_wire(wire: WireSomeProtocolSomeMethodError) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireSomeProtocolSomeMethodError { |
| type Natural = SomeProtocolSomeMethodError; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireSomeProtocolSomeMethodError> for SomeProtocolSomeMethodError { |
| #[inline] |
| fn from_wire_ref(wire: &WireSomeProtocolSomeMethodError) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`SomeProtocolSomeMethodError`]. |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(transparent)] |
| pub struct WireSomeProtocolSomeMethodError { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireSomeProtocolSomeMethodError { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire enums have no padding |
| } |
| } |
| |
| impl WireSomeProtocolSomeMethodError { |
| pub const ERROR_ONE: WireSomeProtocolSomeMethodError = |
| WireSomeProtocolSomeMethodError { value: ::fidl_next::WireU32(1) }; |
| |
| pub const ERROR_TWO: WireSomeProtocolSomeMethodError = |
| WireSomeProtocolSomeMethodError { value: ::fidl_next::WireU32(2) }; |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireSomeProtocolSomeMethodError |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<SomeProtocolSomeMethodError> for WireSomeProtocolSomeMethodError { |
| fn from(natural: SomeProtocolSomeMethodError) -> Self { |
| match natural { |
| SomeProtocolSomeMethodError::ErrorOne => WireSomeProtocolSomeMethodError::ERROR_ONE, |
| |
| SomeProtocolSomeMethodError::ErrorTwo => WireSomeProtocolSomeMethodError::ERROR_TWO, |
| |
| SomeProtocolSomeMethodError::UnknownOrdinal_(value) => { |
| WireSomeProtocolSomeMethodError { value: ::fidl_next::WireU32::from(value) } |
| } |
| } |
| } |
| } |
| |
| /// The type corresponding to the SomeProtocol protocol. |
| #[derive(PartialEq, Debug)] |
| pub struct SomeProtocol; |
| |
| pub mod some_protocol { |
| pub mod prelude { |
| pub use crate::{ |
| SomeProtocol, SomeProtocolClientHandler, SomeProtocolServerHandler, some_protocol, |
| }; |
| |
| pub use crate::SomeProtocolSomeMethodRequest; |
| |
| pub use crate::SomeProtocolSomeMethodError; |
| |
| pub use crate::SomeProtocolSomeMethodResponse; |
| } |
| |
| pub struct SomeMethod; |
| |
| impl ::fidl_next::Method for SomeMethod { |
| const ORDINAL: u64 = 2515914517457749720; |
| |
| type Protocol = crate::SomeProtocol; |
| |
| type Request = crate::WireSomeProtocolSomeMethodRequest<'static>; |
| |
| type Response = ::fidl_next::WireResult< |
| 'static, |
| crate::WireSomeProtocolSomeMethodResponse, |
| crate::WireSomeProtocolSomeMethodError, |
| >; |
| } |
| |
| mod ___detail { |
| |
| pub struct SomeMethod<T0, T1> { |
| union_member: T0, |
| |
| table_member: T1, |
| } |
| |
| impl<T0, T1> ::fidl_next::Encodable for SomeMethod<T0, T1> |
| where |
| T0: ::fidl_next::Encodable<Encoded = crate::WireUnionMember<'static>>, |
| T1: ::fidl_next::Encodable<Encoded = crate::WireTableMember<'static>>, |
| { |
| type Encoded = crate::WireSomeProtocolSomeMethodRequest<'static>; |
| } |
| |
| unsafe impl<___E, T0, T1> ::fidl_next::Encode<___E> for SomeMethod<T0, T1> |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| T0: ::fidl_next::Encode<___E, Encoded = crate::WireUnionMember<'static>>, |
| T1: ::fidl_next::Encode<___E, Encoded = crate::WireTableMember<'static>>, |
| { |
| #[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 { |
| union_member, |
| table_member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.union_member, encoder_, union_member)?; |
| |
| ::fidl_next::Encode::encode(self.table_member, encoder_, table_member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::SomeProtocol |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| type Client = SomeProtocolClient<___T>; |
| type Server = SomeProtocolServer<___T>; |
| } |
| |
| /// The client for the `SomeProtocol` protocol. |
| #[repr(transparent)] |
| pub struct SomeProtocolClient<___T: ::fidl_next::Transport> { |
| #[allow(dead_code)] |
| client: ::fidl_next::protocol::Client<___T>, |
| } |
| |
| impl<___T> SomeProtocolClient<___T> |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| pub fn some_method( |
| &self, |
| |
| union_member: impl ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = crate::WireUnionMember<'static>, |
| >, |
| |
| table_member: impl ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = crate::WireTableMember<'static>, |
| >, |
| ) -> ::fidl_next::TwoWayFuture<'_, super::SomeMethod, ___T> |
| where |
| <___T as ::fidl_next::Transport>::SendBuffer: |
| ::fidl_next::encoder::InternalHandleEncoder, |
| <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder, |
| { |
| self.some_method_with(SomeMethod { union_member, table_member }) |
| } |
| |
| pub fn some_method_with<___R>( |
| &self, |
| request: ___R, |
| ) -> ::fidl_next::TwoWayFuture<'_, super::SomeMethod, ___T> |
| where |
| ___R: ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = crate::WireSomeProtocolSomeMethodRequest<'static>, |
| >, |
| { |
| ::fidl_next::TwoWayFuture::from_untyped( |
| self.client.send_two_way(2515914517457749720, request), |
| ) |
| } |
| } |
| |
| /// The server for the `SomeProtocol` protocol. |
| #[repr(transparent)] |
| pub struct SomeProtocolServer<___T: ::fidl_next::Transport> { |
| server: ::fidl_next::protocol::Server<___T>, |
| } |
| |
| impl<___T> SomeProtocolServer<___T> where ___T: ::fidl_next::Transport {} |
| } |
| } |
| |
| /// A client handler for the SomeProtocol protocol. |
| /// |
| /// See [`SomeProtocol`] for more details. |
| pub trait SomeProtocolClientHandler< |
| #[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 SomeProtocol |
| where |
| ___H: SomeProtocolClientHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| <some_protocol::SomeMethod as ::fidl_next::Method>::Response: |
| ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>, |
| { |
| async fn on_event( |
| handler: &mut ___H, |
| client: &::fidl_next::Client<Self, ___T>, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| ) { |
| match ordinal { |
| ordinal => client.close(), |
| } |
| } |
| } |
| |
| /// A server handler for the SomeProtocol protocol. |
| /// |
| /// See [`SomeProtocol`] for more details. |
| pub trait SomeProtocolServerHandler< |
| #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport, |
| #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel, |
| > |
| { |
| fn some_method( |
| &mut self, |
| |
| request: ::fidl_next::Request<some_protocol::SomeMethod, ___T>, |
| |
| responder: ::fidl_next::Responder<some_protocol::SomeMethod, ___T>, |
| ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send; |
| } |
| |
| impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for SomeProtocol |
| where |
| ___H: SomeProtocolServerHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| <some_protocol::SomeMethod as ::fidl_next::Method>::Request: |
| ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>, |
| { |
| async fn on_one_way( |
| handler: &mut ___H, |
| server: &::fidl_next::Server<Self, ___T>, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| ) { |
| match ordinal { |
| ordinal => server.close(), |
| } |
| } |
| |
| async fn on_two_way( |
| handler: &mut ___H, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| responder: ::fidl_next::protocol::Responder<___T>, |
| ) { |
| match ordinal { |
| 2515914517457749720 => { |
| let responder = ::fidl_next::Responder::from_untyped(responder); |
| |
| match ::fidl_next::DecoderExt::decode(buffer) { |
| Ok(decoded) => handler.some_method(decoded, responder).await, |
| Err(e) => drop(responder), |
| } |
| } |
| |
| ordinal => responder.server().close(), |
| } |
| } |
| } |
| |
| /// Compatibility shims which mimic some API surfaces of the current Rust bindings. |
| pub mod compat { |
| |
| impl ::fidl_next::CompatFrom<crate::BitsMember> for ::fidl_test_anonymous::BitsMember { |
| fn compat_from(value: crate::BitsMember) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::BitsMember> for crate::BitsMember { |
| fn compat_from(value: ::fidl_test_anonymous::BitsMember) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Op> for ::fidl_test_anonymous::Op { |
| fn compat_from(value: crate::Op) -> Self { |
| match value { |
| crate::Op::Add => Self::Add, |
| |
| crate::Op::Mul => Self::Mul, |
| |
| crate::Op::Div => Self::Div, |
| |
| crate::Op::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::Op> for crate::Op { |
| fn compat_from(value: ::fidl_test_anonymous::Op) -> Self { |
| match value { |
| ::fidl_test_anonymous::Op::Add => Self::Add, |
| |
| ::fidl_test_anonymous::Op::Mul => Self::Mul, |
| |
| ::fidl_test_anonymous::Op::Div => Self::Div, |
| |
| ::fidl_test_anonymous::Op::__SourceBreaking { unknown_ordinal: value } => { |
| Self::UnknownOrdinal_(value) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::OverrideTest> for ::fidl_test_anonymous::OverrideTest { |
| #[inline] |
| fn compat_from(value: crate::OverrideTest) -> Self { |
| Self { |
| op: ::fidl_next::CompatFrom::compat_from(value.op), |
| |
| left: ::fidl_next::CompatFrom::compat_from(value.left), |
| |
| right: ::fidl_next::CompatFrom::compat_from(value.right), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::OverrideTest> for crate::OverrideTest { |
| #[inline] |
| fn compat_from(value: ::fidl_test_anonymous::OverrideTest) -> Self { |
| Self { |
| op: ::fidl_next::CompatFrom::compat_from(value.op), |
| |
| left: ::fidl_next::CompatFrom::compat_from(value.left), |
| |
| right: ::fidl_next::CompatFrom::compat_from(value.right), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Flags> for ::fidl_test_anonymous::Flags { |
| fn compat_from(value: crate::Flags) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::Flags> for crate::Flags { |
| fn compat_from(value: ::fidl_test_anonymous::Flags) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::FunctionApplication> |
| for ::fidl_test_anonymous::FunctionApplication |
| { |
| fn compat_from(value: crate::FunctionApplication) -> Self { |
| Self { |
| func: ::fidl_next::CompatFrom::compat_from(value.func), |
| |
| args: ::fidl_next::CompatFrom::compat_from(value.args), |
| |
| flags: ::fidl_next::CompatFrom::compat_from(value.flags), |
| |
| __source_breaking: ::fidl::marker::SourceBreaking, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::FunctionApplication> |
| for crate::FunctionApplication |
| { |
| fn compat_from(value: ::fidl_test_anonymous::FunctionApplication) -> Self { |
| Self { |
| func: ::fidl_next::CompatFrom::compat_from(value.func), |
| |
| args: ::fidl_next::CompatFrom::compat_from(value.args), |
| |
| flags: ::fidl_next::CompatFrom::compat_from(value.flags), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Expression> for ::fidl_test_anonymous::Expression { |
| fn compat_from(value: crate::Expression) -> Self { |
| match value { |
| crate::Expression::Value(value) => { |
| Self::Value(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::Expression::BinOp(value) => { |
| Self::BinOp(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::Expression::FunctionApplication(value) => { |
| Self::FunctionApplication(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::Expression::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::Expression> for crate::Expression { |
| fn compat_from(value: ::fidl_test_anonymous::Expression) -> Self { |
| match value { |
| ::fidl_test_anonymous::Expression::Value(value) => { |
| Self::Value(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_anonymous::Expression::BinOp(value) => { |
| Self::BinOp(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_anonymous::Expression::FunctionApplication(value) => { |
| Self::FunctionApplication(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_anonymous::Expression::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::UnionMember> for ::fidl_test_anonymous::UnionMember { |
| fn compat_from(value: crate::UnionMember) -> Self { |
| match value { |
| crate::UnionMember::UnionData(value) => { |
| Self::UnionData(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| crate::UnionMember::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::UnionMember> for crate::UnionMember { |
| fn compat_from(value: ::fidl_test_anonymous::UnionMember) -> Self { |
| match value { |
| ::fidl_test_anonymous::UnionMember::UnionData(value) => { |
| Self::UnionData(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| |
| ::fidl_test_anonymous::UnionMember::__SourceBreaking { unknown_ordinal } => { |
| Self::UnknownOrdinal_(unknown_ordinal) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::TableData> for ::fidl_test_anonymous::TableData { |
| #[inline] |
| fn compat_from(value: crate::TableData) -> Self { |
| Self { data: ::fidl_next::CompatFrom::compat_from(value.data) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::TableData> for crate::TableData { |
| #[inline] |
| fn compat_from(value: ::fidl_test_anonymous::TableData) -> Self { |
| Self { data: ::fidl_next::CompatFrom::compat_from(value.data) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::TableMember> for ::fidl_test_anonymous::TableMember { |
| fn compat_from(value: crate::TableMember) -> Self { |
| Self { |
| table_data: ::fidl_next::CompatFrom::compat_from(value.table_data), |
| |
| __source_breaking: ::fidl::marker::SourceBreaking, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::TableMember> for crate::TableMember { |
| fn compat_from(value: ::fidl_test_anonymous::TableMember) -> Self { |
| Self { table_data: ::fidl_next::CompatFrom::compat_from(value.table_data) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::SomeProtocolSomeMethodRequest> |
| for ::fidl_test_anonymous::SomeProtocolSomeMethodRequest |
| { |
| #[inline] |
| fn compat_from(value: crate::SomeProtocolSomeMethodRequest) -> Self { |
| Self { |
| union_member: ::fidl_next::CompatFrom::compat_from(value.union_member), |
| |
| table_member: ::fidl_next::CompatFrom::compat_from(value.table_member), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::SomeProtocolSomeMethodRequest> |
| for crate::SomeProtocolSomeMethodRequest |
| { |
| #[inline] |
| fn compat_from(value: ::fidl_test_anonymous::SomeProtocolSomeMethodRequest) -> Self { |
| Self { |
| union_member: ::fidl_next::CompatFrom::compat_from(value.union_member), |
| |
| table_member: ::fidl_next::CompatFrom::compat_from(value.table_member), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::SomeProtocolSomeMethodResponse> |
| for ::fidl_test_anonymous::SomeProtocolSomeMethodResponse |
| { |
| #[inline] |
| fn compat_from(value: crate::SomeProtocolSomeMethodResponse) -> Self { |
| Self { bits_member: ::fidl_next::CompatFrom::compat_from(value.bits_member) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::SomeProtocolSomeMethodResponse> |
| for crate::SomeProtocolSomeMethodResponse |
| { |
| #[inline] |
| fn compat_from(value: ::fidl_test_anonymous::SomeProtocolSomeMethodResponse) -> Self { |
| Self { bits_member: ::fidl_next::CompatFrom::compat_from(value.bits_member) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::SomeProtocolSomeMethodError> |
| for ::fidl_test_anonymous::SomeProtocolSomeMethodError |
| { |
| fn compat_from(value: crate::SomeProtocolSomeMethodError) -> Self { |
| match value { |
| crate::SomeProtocolSomeMethodError::ErrorOne => Self::ErrorOne, |
| |
| crate::SomeProtocolSomeMethodError::ErrorTwo => Self::ErrorTwo, |
| |
| crate::SomeProtocolSomeMethodError::UnknownOrdinal_(unknown_ordinal) => { |
| Self::__SourceBreaking { unknown_ordinal } |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::SomeProtocolSomeMethodError> |
| for crate::SomeProtocolSomeMethodError |
| { |
| fn compat_from(value: ::fidl_test_anonymous::SomeProtocolSomeMethodError) -> Self { |
| match value { |
| ::fidl_test_anonymous::SomeProtocolSomeMethodError::ErrorOne => Self::ErrorOne, |
| |
| ::fidl_test_anonymous::SomeProtocolSomeMethodError::ErrorTwo => Self::ErrorTwo, |
| |
| ::fidl_test_anonymous::SomeProtocolSomeMethodError::__SourceBreaking { |
| unknown_ordinal: value, |
| } => Self::UnknownOrdinal_(value), |
| } |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| /// An alias for a client over `zx::Channel` for the `SomeProtocol` |
| /// protocol. |
| pub type SomeProtocolProxy = ::fidl_next::Client<crate::SomeProtocol>; |
| |
| impl ::fidl_next::CompatFrom<crate::SomeProtocol> for ::fidl_test_anonymous::SomeProtocolMarker { |
| fn compat_from(_: crate::SomeProtocol) -> Self { |
| Self |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_anonymous::SomeProtocolMarker> for crate::SomeProtocol { |
| fn compat_from(_: ::fidl_test_anonymous::SomeProtocolMarker) -> Self { |
| Self |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| |
| impl ::fidl_next::ClientCompatFrom<::fidl_test_anonymous::SomeProtocolProxy> |
| for crate::SomeProtocol |
| { |
| fn client_compat_from( |
| proxy: ::fidl_test_anonymous::SomeProtocolProxy, |
| ) -> ::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) |
| } |
| } |
| } |