| // DO NOT EDIT: This file is machine-generated by fidlgen |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)] |
| |
| pub type Alias = u32; |
| |
| /// The wire type corresponding to [`Alias`]. |
| pub type WireAlias = ::fidl_next::WireU32; |
| |
| pub const EXAMPLE_CONST: u32 = 0 as u32; |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct ExampleBits: u32 { |
| const MEMBER = 1; |
| |
| } |
| } |
| |
| impl ::fidl_next::Encodable for ExampleBits { |
| type Encoded = WireExampleBits; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleBits |
| 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 ExampleBits |
| 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 WireExampleBits { value } = out); |
| |
| if ::fidl_next::bitflags::Flags::contains_unknown_bits(self) { |
| return Err(::fidl_next::EncodeError::InvalidStrictBits); |
| } |
| |
| let _ = value.write(::fidl_next::WireU32::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireExampleBits> for ExampleBits { |
| fn from(wire: WireExampleBits) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireExampleBits> for ExampleBits { |
| #[inline] |
| fn from_wire(wire: WireExampleBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireExampleBits { |
| type Natural = ExampleBits; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireExampleBits> for ExampleBits { |
| #[inline] |
| fn from_wire_ref(wire: &WireExampleBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`ExampleBits`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireExampleBits { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExampleBits { |
| 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 WireExampleBits |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { value } = slot); |
| let set = u32::from(*value); |
| if set & !ExampleBits::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: ExampleBits::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<ExampleBits> for WireExampleBits { |
| fn from(natural: ExampleBits) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(u32)] |
| pub enum ExampleEnum { |
| Member = 1, |
| } |
| |
| impl ::fidl_next::Encodable for ExampleEnum { |
| type Encoded = WireExampleEnum; |
| } |
| impl ::core::convert::TryFrom<u32> for ExampleEnum { |
| type Error = ::fidl_next::UnknownStrictEnumMemberError; |
| fn try_from( |
| value: u32, |
| ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> { |
| match value { |
| 1 => Ok(Self::Member), |
| |
| _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())), |
| } |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleEnum |
| 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 ExampleEnum |
| 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 WireExampleEnum { value } = out); |
| let _ = value.write(::fidl_next::WireU32::from(match *self { |
| Self::Member => 1, |
| })); |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireExampleEnum> for ExampleEnum { |
| fn from(wire: WireExampleEnum) -> Self { |
| match u32::from(wire.value) { |
| 1 => Self::Member, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireExampleEnum> for ExampleEnum { |
| #[inline] |
| fn from_wire(wire: WireExampleEnum) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireExampleEnum { |
| type Natural = ExampleEnum; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireExampleEnum> for ExampleEnum { |
| #[inline] |
| fn from_wire_ref(wire: &WireExampleEnum) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`ExampleEnum`]. |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(transparent)] |
| pub struct WireExampleEnum { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExampleEnum { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire enums have no padding |
| } |
| } |
| |
| impl WireExampleEnum { |
| pub const MEMBER: WireExampleEnum = WireExampleEnum { value: ::fidl_next::WireU32(1) }; |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExampleEnum |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { value } = slot); |
| |
| match u32::from(*value) { |
| 1 => (), |
| unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<ExampleEnum> for WireExampleEnum { |
| fn from(natural: ExampleEnum) -> Self { |
| match natural { |
| ExampleEnum::Member => WireExampleEnum::MEMBER, |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct ExampleProtocolMethodRequest { |
| pub arg: ::fidl_next_test_exampleusing::Empty, |
| } |
| |
| impl ::fidl_next::Encodable for ExampleProtocolMethodRequest { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireExampleProtocolMethodRequest> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| ::fidl_next_test_exampleusing::Empty as ::fidl_next::Encodable |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| type Encoded = WireExampleProtocolMethodRequest; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleProtocolMethodRequest |
| 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 { |
| arg, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.arg, encoder_, arg)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExampleProtocolMethodRequest |
| 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 { |
| |
| arg, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.arg, encoder_, arg)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExampleProtocolMethodRequest { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireExampleProtocolMethodRequest>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExampleProtocolMethodRequest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ExampleProtocolMethodRequest: ::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 ExampleProtocolMethodRequest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ExampleProtocolMethodRequest: ::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<WireExampleProtocolMethodRequest> for ExampleProtocolMethodRequest { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireExampleProtocolMethodRequest, Self> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true && <::fidl_next_test_exampleusing::Empty as ::fidl_next::FromWire< |
| ::fidl_next_test_exampleusing::WireEmpty, |
| >>::COPY_OPTIMIZATION |
| .is_enabled(), |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: WireExampleProtocolMethodRequest) -> Self { |
| Self { arg: ::fidl_next::FromWire::from_wire(wire.arg) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireExampleProtocolMethodRequest { |
| type Natural = ExampleProtocolMethodRequest; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireExampleProtocolMethodRequest> for ExampleProtocolMethodRequest { |
| #[inline] |
| fn from_wire_ref(wire: &WireExampleProtocolMethodRequest) -> Self { |
| Self { arg: ::fidl_next::FromWireRef::from_wire_ref(&wire.arg) } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExampleProtocolMethodRequest`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct WireExampleProtocolMethodRequest { |
| pub arg: ::fidl_next_test_exampleusing::WireEmpty, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireExampleProtocolMethodRequest>(), 1); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireExampleProtocolMethodRequest>(), 1); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireExampleProtocolMethodRequest, arg), 0); |
| |
| unsafe impl ::fidl_next::Wire for WireExampleProtocolMethodRequest { |
| type Decoded<'de> = WireExampleProtocolMethodRequest; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| arg, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(arg); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExampleProtocolMethodRequest |
| 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 arg, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(arg.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| /// The type corresponding to the ExampleProtocol protocol. |
| #[derive(PartialEq, Debug)] |
| pub struct ExampleProtocol; |
| |
| pub mod example_protocol { |
| pub mod prelude { |
| pub use crate::{ |
| ExampleProtocol, ExampleProtocolClientHandler, ExampleProtocolServerHandler, |
| example_protocol, |
| }; |
| |
| pub use crate::ExampleProtocolMethodRequest; |
| } |
| |
| pub struct Method; |
| |
| impl ::fidl_next::Method for Method { |
| const ORDINAL: u64 = 6023439637367187273; |
| |
| type Protocol = crate::ExampleProtocol; |
| |
| type Request = crate::WireExampleProtocolMethodRequest; |
| |
| type Response = ::fidl_next::Never; |
| } |
| |
| mod ___detail { |
| |
| pub struct Method<T0> { |
| arg: T0, |
| } |
| |
| impl<T0> ::fidl_next::Encodable for Method<T0> |
| where |
| T0: ::fidl_next::Encodable<Encoded = ::fidl_next_test_exampleusing::WireEmpty>, |
| { |
| type Encoded = crate::WireExampleProtocolMethodRequest; |
| } |
| |
| unsafe impl<___E, T0> ::fidl_next::Encode<___E> for Method<T0> |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next_test_exampleusing::WireEmpty>, |
| { |
| #[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 { |
| arg, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.arg, encoder_, arg)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::ExampleProtocol |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| type Client = ExampleProtocolClient<___T>; |
| type Server = ExampleProtocolServer<___T>; |
| } |
| |
| /// The client for the `ExampleProtocol` protocol. |
| #[repr(transparent)] |
| pub struct ExampleProtocolClient<___T: ::fidl_next::Transport> { |
| #[allow(dead_code)] |
| client: ::fidl_next::protocol::Client<___T>, |
| } |
| |
| impl<___T> ExampleProtocolClient<___T> |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| pub fn method( |
| &self, |
| |
| arg: impl ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = ::fidl_next_test_exampleusing::WireEmpty, |
| >, |
| ) -> ::fidl_next::SendFuture<'_, ___T> |
| where |
| <___T as ::fidl_next::Transport>::SendBuffer: |
| ::fidl_next::encoder::InternalHandleEncoder, |
| { |
| self.method_with(Method { arg }) |
| } |
| |
| pub fn method_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T> |
| where |
| ___R: ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = crate::WireExampleProtocolMethodRequest, |
| >, |
| { |
| ::fidl_next::SendFuture::from_untyped( |
| self.client.send_one_way(6023439637367187273, request), |
| ) |
| } |
| } |
| |
| /// The server for the `ExampleProtocol` protocol. |
| #[repr(transparent)] |
| pub struct ExampleProtocolServer<___T: ::fidl_next::Transport> { |
| server: ::fidl_next::protocol::Server<___T>, |
| } |
| |
| impl<___T> ExampleProtocolServer<___T> where ___T: ::fidl_next::Transport {} |
| } |
| } |
| |
| /// A client handler for the ExampleProtocol protocol. |
| /// |
| /// See [`ExampleProtocol`] for more details. |
| pub trait ExampleProtocolClientHandler< |
| #[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 ExampleProtocol |
| where |
| ___H: ExampleProtocolClientHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| { |
| 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 ExampleProtocol protocol. |
| /// |
| /// See [`ExampleProtocol`] for more details. |
| pub trait ExampleProtocolServerHandler< |
| #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport, |
| #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel, |
| > |
| { |
| fn method( |
| &mut self, |
| |
| request: ::fidl_next::Request<example_protocol::Method, ___T>, |
| ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send; |
| } |
| |
| impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ExampleProtocol |
| where |
| ___H: ExampleProtocolServerHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| <example_protocol::Method as ::fidl_next::Method>::Request: |
| ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>, |
| { |
| 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 { |
| 6023439637367187273 => match ::fidl_next::DecoderExt::decode(buffer) { |
| Ok(decoded) => { |
| handler.method(decoded).await; |
| Ok(()) |
| } |
| Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage { |
| ordinal: 6023439637367187273, |
| error, |
| }), |
| }, |
| |
| 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 { |
| ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)), |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| #[repr(C)] |
| pub struct ExampleStruct { |
| pub member: u32, |
| } |
| |
| impl ::fidl_next::Encodable for ExampleStruct { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireExampleStruct> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true && <u32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(), |
| ) |
| }; |
| |
| type Encoded = WireExampleStruct; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleStruct |
| 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 { |
| member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.member, encoder_, member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExampleStruct |
| 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 { |
| |
| member, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::EncodeRef::encode_ref(&self.member, encoder_, member)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExampleStruct { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireExampleStruct>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExampleStruct |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ExampleStruct: ::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 ExampleStruct |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ExampleStruct: ::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<WireExampleStruct> for ExampleStruct { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireExampleStruct, Self> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true && <u32 as ::fidl_next::FromWire<::fidl_next::WireU32>>::COPY_OPTIMIZATION |
| .is_enabled(), |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: WireExampleStruct) -> Self { |
| Self { member: ::fidl_next::FromWire::from_wire(wire.member) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireExampleStruct { |
| type Natural = ExampleStruct; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireExampleStruct> for ExampleStruct { |
| #[inline] |
| fn from_wire_ref(wire: &WireExampleStruct) -> Self { |
| Self { member: ::fidl_next::FromWireRef::from_wire_ref(&wire.member) } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExampleStruct`]. |
| #[derive(Clone, Debug)] |
| #[repr(C)] |
| pub struct WireExampleStruct { |
| pub member: ::fidl_next::WireU32, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireExampleStruct>(), 4); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireExampleStruct>(), 4); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireExampleStruct, member), 0); |
| |
| unsafe impl ::fidl_next::Wire for WireExampleStruct { |
| type Decoded<'de> = WireExampleStruct; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| member, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(member); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireExampleStruct |
| 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 member, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(member.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug, Default)] |
| pub struct ExampleTable { |
| pub member: ::core::option::Option<u32>, |
| } |
| |
| impl ExampleTable { |
| fn __max_ordinal(&self) -> usize { |
| if self.member.is_some() { |
| return 1; |
| } |
| |
| 0 |
| } |
| } |
| |
| impl ::fidl_next::Encodable for ExampleTable { |
| type Encoded = WireExampleTable<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleTable |
| 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 WireExampleTable { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 1 => { |
| if let Some(value) = self.member.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 ExampleTable |
| 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 WireExampleTable { table } = out); |
| |
| let max_ord = self.__max_ordinal(); |
| |
| let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit(); |
| ::fidl_next::Wire::zero_padding(&mut out); |
| |
| let mut preallocated = |
| ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord); |
| |
| for i in 1..=max_ord { |
| match i { |
| 1 => { |
| if let Some(value) = &self.member { |
| ::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<WireExampleTable<'de>> for ExampleTable { |
| #[inline] |
| fn from_wire(wire_: WireExampleTable<'de>) -> Self { |
| let wire_ = ::core::mem::ManuallyDrop::new(wire_); |
| |
| let member = wire_.table.get(1); |
| |
| Self { |
| member: member.map(|envelope| { |
| ::fidl_next::FromWire::from_wire(unsafe { |
| envelope.read_unchecked::<::fidl_next::WireU32>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireExampleTable<'de> { |
| type Natural = ExampleTable; |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<WireExampleTable<'de>> for ExampleTable { |
| #[inline] |
| fn from_wire_ref(wire: &WireExampleTable<'de>) -> Self { |
| Self { |
| member: wire.table.get(1).map(|envelope| { |
| ::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| envelope.deref_unchecked::<::fidl_next::WireU32>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| /// The wire type corresponding to [`ExampleTable`]. |
| #[repr(C)] |
| pub struct WireExampleTable<'de> { |
| table: ::fidl_next::WireTable<'de>, |
| } |
| |
| impl<'de> Drop for WireExampleTable<'de> { |
| fn drop(&mut self) { |
| let _ = self |
| .table |
| .get(1) |
| .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireU32>() }); |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExampleTable<'static> { |
| type Decoded<'de> = WireExampleTable<'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 WireExampleTable<'static> |
| where |
| ___D: ::fidl_next::Decoder + ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| decoder: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge!(let Self { table } = slot); |
| |
| ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| { |
| match ordinal { |
| 0 => unsafe { ::core::hint::unreachable_unchecked() }, |
| |
| 1 => { |
| ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireU32>( |
| slot.as_mut(), |
| decoder, |
| )?; |
| |
| Ok(()) |
| } |
| |
| _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder), |
| } |
| }) |
| } |
| } |
| |
| impl<'de> WireExampleTable<'de> { |
| pub fn member(&self) -> ::core::option::Option<&::fidl_next::WireU32> { |
| unsafe { Some(self.table.get(1)?.deref_unchecked()) } |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireExampleTable<'de> { |
| fn fmt( |
| &self, |
| f: &mut ::core::fmt::Formatter<'_>, |
| ) -> ::core::result::Result<(), ::core::fmt::Error> { |
| f.debug_struct("ExampleTable").field("member", &self.member()).finish() |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub enum ExampleUnion { |
| Variant(u32), |
| } |
| |
| impl ::fidl_next::Encodable for ExampleUnion { |
| type Encoded = WireExampleUnion; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleUnion |
| 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 WireExampleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Variant(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, u32>(value, 1, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExampleUnion |
| 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 WireExampleUnion { raw, _phantom: _ } = out); |
| |
| match self { |
| Self::Variant(value) => { |
| ::fidl_next::RawWireUnion::encode_as_static::<___E, &u32>(value, 1, encoder, raw)? |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ExampleUnion { |
| type EncodedOption = WireOptionalExampleUnion; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExampleUnion |
| where |
| ___E: ?Sized, |
| ExampleUnion: ::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 WireOptionalExampleUnion { 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 ExampleUnion |
| where |
| ___E: ?Sized, |
| ExampleUnion: ::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 WireOptionalExampleUnion { 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<WireExampleUnion> for ExampleUnion { |
| #[inline] |
| fn from_wire(wire: WireExampleUnion) -> Self { |
| let wire = ::core::mem::ManuallyDrop::new(wire); |
| match wire.raw.ordinal() { |
| 1 => Self::Variant(::fidl_next::FromWire::from_wire(unsafe { |
| wire.raw.get().read_unchecked::<::fidl_next::WireU32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireExampleUnion { |
| type Natural = ExampleUnion; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireExampleUnion> for ExampleUnion { |
| #[inline] |
| fn from_wire_ref(wire: &WireExampleUnion) -> Self { |
| match wire.raw.ordinal() { |
| 1 => Self::Variant(::fidl_next::FromWireRef::from_wire_ref(unsafe { |
| wire.raw.get().deref_unchecked::<::fidl_next::WireU32>() |
| })), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWireOption<WireOptionalExampleUnion> for ExampleUnion { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExampleUnion) -> ::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 WireOptionalExampleUnion { |
| type Natural = ::core::option::Option<ExampleUnion>; |
| } |
| |
| impl ::fidl_next::FromWireOption<WireOptionalExampleUnion> for Box<ExampleUnion> { |
| #[inline] |
| fn from_wire_option(wire: WireOptionalExampleUnion) -> ::core::option::Option<Self> { |
| <ExampleUnion as ::fidl_next::FromWireOption<WireOptionalExampleUnion>>::from_wire_option( |
| wire, |
| ) |
| .map(Box::new) |
| } |
| } |
| |
| impl ::fidl_next::FromWireOptionRef<WireOptionalExampleUnion> for Box<ExampleUnion> { |
| #[inline] |
| fn from_wire_option_ref(wire: &WireOptionalExampleUnion) -> ::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 [`ExampleUnion`]. |
| #[repr(transparent)] |
| pub struct WireExampleUnion { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<()>, |
| } |
| |
| impl Drop for WireExampleUnion { |
| fn drop(&mut self) { |
| match self.raw.ordinal() { |
| 1 => { |
| let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() }; |
| } |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireExampleUnion { |
| type Decoded<'de> = WireExampleUnion; |
| |
| #[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 example_union { |
| pub enum Ref<'de> { |
| Variant(&'de ::fidl_next::WireU32), |
| } |
| } |
| |
| impl WireExampleUnion { |
| pub fn as_ref(&self) -> crate::example_union::Ref<'_> { |
| match self.raw.ordinal() { |
| 1 => crate::example_union::Ref::Variant(unsafe { |
| self.raw.get().deref_unchecked::<::fidl_next::WireU32>() |
| }), |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl Clone for WireExampleUnion { |
| fn clone(&self) -> Self { |
| match self.raw.ordinal() { |
| 1 => 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 WireExampleUnion |
| 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, |
| )?, |
| |
| ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)), |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::fmt::Debug for WireExampleUnion { |
| 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) }, |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| #[repr(transparent)] |
| pub struct WireOptionalExampleUnion { |
| raw: ::fidl_next::RawWireUnion, |
| _phantom: ::core::marker::PhantomData<()>, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireOptionalExampleUnion { |
| type Decoded<'de> = WireOptionalExampleUnion; |
| |
| #[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 WireOptionalExampleUnion { |
| 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<&WireExampleUnion> { |
| if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None } |
| } |
| |
| pub fn into_option(self) -> ::core::option::Option<WireExampleUnion> { |
| if self.is_some() { |
| Some(WireExampleUnion { raw: self.raw, _phantom: ::core::marker::PhantomData }) |
| } else { |
| None |
| } |
| } |
| } |
| |
| impl Clone for WireOptionalExampleUnion { |
| fn clone(&self) -> Self { |
| if self.is_none() { |
| return WireOptionalExampleUnion { |
| 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, |
| }, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalExampleUnion |
| 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, |
| )?, |
| |
| 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?, |
| _ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?, |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::fmt::Debug for WireOptionalExampleUnion { |
| 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::ExampleBits> |
| for ::fidl_test_placementofattributes::ExampleBits |
| { |
| fn compat_from(value: crate::ExampleBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleBits> |
| for crate::ExampleBits |
| { |
| fn compat_from(value: ::fidl_test_placementofattributes::ExampleBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExampleEnum> |
| for ::fidl_test_placementofattributes::ExampleEnum |
| { |
| fn compat_from(value: crate::ExampleEnum) -> Self { |
| match value { |
| crate::ExampleEnum::Member => Self::Member, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleEnum> |
| for crate::ExampleEnum |
| { |
| fn compat_from(value: ::fidl_test_placementofattributes::ExampleEnum) -> Self { |
| match value { |
| ::fidl_test_placementofattributes::ExampleEnum::Member => Self::Member, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExampleProtocolMethodRequest> |
| for ::fidl_test_placementofattributes::ExampleProtocolMethodRequest |
| { |
| #[inline] |
| fn compat_from(value: crate::ExampleProtocolMethodRequest) -> Self { |
| Self { arg: ::fidl_next::CompatFrom::compat_from(value.arg) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleProtocolMethodRequest> |
| for crate::ExampleProtocolMethodRequest |
| { |
| #[inline] |
| fn compat_from( |
| value: ::fidl_test_placementofattributes::ExampleProtocolMethodRequest, |
| ) -> Self { |
| Self { arg: ::fidl_next::CompatFrom::compat_from(value.arg) } |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| /// An alias for a client over `zx::Channel` for the `ExampleProtocol` |
| /// protocol. |
| pub type ExampleProtocolProxy = ::fidl_next::Client<crate::ExampleProtocol>; |
| |
| impl ::fidl_next::CompatFrom<crate::ExampleProtocol> |
| for ::fidl_test_placementofattributes::ExampleProtocolMarker |
| { |
| fn compat_from(_: crate::ExampleProtocol) -> Self { |
| Self |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleProtocolMarker> |
| for crate::ExampleProtocol |
| { |
| fn compat_from(_: ::fidl_test_placementofattributes::ExampleProtocolMarker) -> Self { |
| Self |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| |
| impl ::fidl_next::ClientCompatFrom<::fidl_test_placementofattributes::ExampleProtocolProxy> |
| for crate::ExampleProtocol |
| { |
| fn client_compat_from( |
| proxy: ::fidl_test_placementofattributes::ExampleProtocolProxy, |
| ) -> ::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::ExampleStruct> |
| for ::fidl_test_placementofattributes::ExampleStruct |
| { |
| #[inline] |
| fn compat_from(value: crate::ExampleStruct) -> Self { |
| Self { member: ::fidl_next::CompatFrom::compat_from(value.member) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleStruct> |
| for crate::ExampleStruct |
| { |
| #[inline] |
| fn compat_from(value: ::fidl_test_placementofattributes::ExampleStruct) -> Self { |
| Self { member: ::fidl_next::CompatFrom::compat_from(value.member) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExampleTable> |
| for ::fidl_test_placementofattributes::ExampleTable |
| { |
| fn compat_from(value: crate::ExampleTable) -> Self { |
| Self { |
| member: ::fidl_next::CompatFrom::compat_from(value.member), |
| |
| __source_breaking: ::fidl::marker::SourceBreaking, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleTable> |
| for crate::ExampleTable |
| { |
| fn compat_from(value: ::fidl_test_placementofattributes::ExampleTable) -> Self { |
| Self { member: ::fidl_next::CompatFrom::compat_from(value.member) } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::ExampleUnion> |
| for ::fidl_test_placementofattributes::ExampleUnion |
| { |
| fn compat_from(value: crate::ExampleUnion) -> Self { |
| match value { |
| crate::ExampleUnion::Variant(value) => { |
| Self::Variant(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_placementofattributes::ExampleUnion> |
| for crate::ExampleUnion |
| { |
| fn compat_from(value: ::fidl_test_placementofattributes::ExampleUnion) -> Self { |
| match value { |
| ::fidl_test_placementofattributes::ExampleUnion::Variant(value) => { |
| Self::Variant(::fidl_next::CompatFrom::compat_from(value)) |
| } |
| } |
| } |
| } |
| } |