| // DO NOT EDIT: This file is machine-generated by fidlgen |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)] |
| |
| #[derive(PartialEq, Debug)] |
| #[repr(C)] |
| pub struct ClientEndWrapper { |
| pub value: ::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel>, |
| } |
| |
| impl ::fidl_next::Encodable for ClientEndWrapper { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireClientEndWrapper> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| ::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel> as ::fidl_next::Encodable |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| type Encoded = WireClientEndWrapper; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ClientEndWrapper |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::fuchsia::HandleEncoder, |
| { |
| #[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 { |
| value, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.value, encoder_, value)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ClientEndWrapper { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireClientEndWrapper>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ClientEndWrapper |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ClientEndWrapper: ::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(()) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireClientEndWrapper> for ClientEndWrapper { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireClientEndWrapper, Self> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| ::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel> as ::fidl_next::FromWire<::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::WireDriverChannel>> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: WireClientEndWrapper) -> Self { |
| Self { value: ::fidl_next::FromWire::from_wire(wire.value) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireClientEndWrapper { |
| type Natural = ClientEndWrapper; |
| } |
| |
| /// The wire type corresponding to [`ClientEndWrapper`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireClientEndWrapper { |
| pub value: ::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::WireDriverChannel>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireClientEndWrapper>(), 4); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireClientEndWrapper>(), 4); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireClientEndWrapper, value), 0); |
| |
| unsafe impl ::fidl_next::Wire for WireClientEndWrapper { |
| type Decoded<'de> = WireClientEndWrapper; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| value, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(value); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireClientEndWrapper |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::fuchsia::HandleDecoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut value, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(value.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| /// The type corresponding to the DriverProtocol protocol. |
| #[derive(PartialEq, Debug)] |
| pub struct DriverProtocol; |
| |
| pub mod driver_protocol { |
| pub mod prelude { |
| pub use crate::{ |
| DriverProtocol, DriverProtocolClientHandler, DriverProtocolServerHandler, |
| driver_protocol, |
| }; |
| } |
| |
| mod ___detail { |
| |
| unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::DriverProtocol |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| type Client = DriverProtocolClient<___T>; |
| type Server = DriverProtocolServer<___T>; |
| } |
| |
| /// The client for the `DriverProtocol` protocol. |
| #[repr(transparent)] |
| pub struct DriverProtocolClient<___T: ::fidl_next::Transport> { |
| #[allow(dead_code)] |
| client: ::fidl_next::protocol::Client<___T>, |
| } |
| |
| impl<___T> DriverProtocolClient<___T> where ___T: ::fidl_next::Transport {} |
| |
| /// The server for the `DriverProtocol` protocol. |
| #[repr(transparent)] |
| pub struct DriverProtocolServer<___T: ::fidl_next::Transport> { |
| server: ::fidl_next::protocol::Server<___T>, |
| } |
| |
| impl<___T> DriverProtocolServer<___T> where ___T: ::fidl_next::Transport {} |
| } |
| } |
| |
| /// A client handler for the DriverProtocol protocol. |
| /// |
| /// See [`DriverProtocol`] for more details. |
| pub trait DriverProtocolClientHandler< |
| #[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 DriverProtocol |
| where |
| ___H: DriverProtocolClientHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| { |
| 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 DriverProtocol protocol. |
| /// |
| /// See [`DriverProtocol`] for more details. |
| pub trait DriverProtocolServerHandler< |
| #[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::DispatchServerMessage<___H, ___T> for DriverProtocol |
| where |
| ___H: DriverProtocolServerHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| { |
| 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 { |
| ordinal => responder.server().close(), |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Debug, Default)] |
| pub struct T { |
| pub zircon_handle: ::core::option::Option<::fidl_next::fuchsia::zx::Event>, |
| |
| pub fdf_handle: ::core::option::Option< |
| ::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel>, |
| >, |
| } |
| |
| impl T { |
| fn __max_ordinal(&self) -> usize { |
| if self.fdf_handle.is_some() { |
| return 2; |
| } |
| |
| if self.zircon_handle.is_some() { |
| return 1; |
| } |
| |
| 0 |
| } |
| } |
| |
| impl ::fidl_next::Encodable for T { |
| type Encoded = WireT<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for T |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ___E: ::fidl_next::fuchsia::HandleEncoder, |
| { |
| #[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 WireT { 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.fdf_handle.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.zircon_handle.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(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireT<'de>> for T { |
| #[inline] |
| fn from_wire(wire_: WireT<'de>) -> Self { |
| let wire_ = ::core::mem::ManuallyDrop::new(wire_); |
| |
| let zircon_handle = wire_.table.get(1); |
| |
| let fdf_handle = wire_.table.get(2); |
| |
| Self { |
| zircon_handle: zircon_handle.map(|envelope| { |
| ::fidl_next::FromWire::from_wire(unsafe { |
| envelope.read_unchecked::<::fidl_next::fuchsia::WireEvent>() |
| }) |
| }), |
| |
| fdf_handle: |
| fdf_handle.map(|envelope| { |
| ::fidl_next::FromWire::from_wire(unsafe { |
| envelope.read_unchecked::<::fidl_next::ClientEnd< |
| crate::DriverProtocol, |
| ::fdf_fidl::WireDriverChannel, |
| >>() |
| }) |
| }), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireT<'de> { |
| type Natural = T; |
| } |
| |
| /// The wire type corresponding to [`T`]. |
| #[repr(C)] |
| pub struct WireT<'de> { |
| table: ::fidl_next::WireTable<'de>, |
| } |
| |
| impl<'de> Drop for WireT<'de> { |
| fn drop(&mut self) { |
| let _ = self.table.get(1).map(|envelope| unsafe { |
| envelope.read_unchecked::<::fidl_next::fuchsia::WireEvent>() |
| }); |
| |
| let _ = self.table.get(2) |
| .map(|envelope| unsafe { |
| envelope.read_unchecked::<::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::WireDriverChannel>>() |
| }); |
| } |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireT<'static> { |
| type Decoded<'de> = WireT<'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 WireT<'static> |
| where |
| ___D: ::fidl_next::Decoder + ?Sized, |
| ___D: ::fidl_next::fuchsia::HandleDecoder, |
| { |
| 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::fuchsia::WireEvent>( |
| slot.as_mut(), |
| decoder, |
| )?; |
| |
| Ok(()) |
| } |
| |
| 2 => { |
| ::fidl_next::WireEnvelope::decode_as::< |
| ___D, |
| ::fidl_next::ClientEnd< |
| crate::DriverProtocol, |
| ::fdf_fidl::WireDriverChannel, |
| >, |
| >(slot.as_mut(), decoder)?; |
| |
| Ok(()) |
| } |
| |
| _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder), |
| } |
| }) |
| } |
| } |
| |
| impl<'de> WireT<'de> { |
| pub fn zircon_handle(&self) -> ::core::option::Option<&::fidl_next::fuchsia::WireEvent> { |
| unsafe { Some(self.table.get(1)?.deref_unchecked()) } |
| } |
| |
| pub fn fdf_handle( |
| &self, |
| ) -> ::core::option::Option< |
| &::fidl_next::ClientEnd<crate::DriverProtocol, ::fdf_fidl::WireDriverChannel>, |
| > { |
| unsafe { Some(self.table.get(2)?.deref_unchecked()) } |
| } |
| } |
| |
| impl<'de> ::core::fmt::Debug for WireT<'de> { |
| fn fmt( |
| &self, |
| f: &mut ::core::fmt::Formatter<'_>, |
| ) -> ::core::result::Result<(), ::core::fmt::Error> { |
| f.debug_struct("T") |
| .field("zircon_handle", &self.zircon_handle()) |
| .field("fdf_handle", &self.fdf_handle()) |
| .finish() |
| } |
| } |
| |
| #[derive(PartialEq, Debug)] |
| pub struct HandlesInProtocolSendHandlesRequest { |
| pub t: crate::T, |
| } |
| |
| impl ::fidl_next::Encodable for HandlesInProtocolSendHandlesRequest { |
| type Encoded = WireHandlesInProtocolSendHandlesRequest<'static>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for HandlesInProtocolSendHandlesRequest |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| ___E: ::fidl_next::fuchsia::HandleEncoder, |
| { |
| #[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 { |
| t, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.t, encoder_, t)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for HandlesInProtocolSendHandlesRequest { |
| type EncodedOption = |
| ::fidl_next::WireBox<'static, WireHandlesInProtocolSendHandlesRequest<'static>>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for HandlesInProtocolSendHandlesRequest |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| HandlesInProtocolSendHandlesRequest: ::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(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWire<WireHandlesInProtocolSendHandlesRequest<'de>> |
| for HandlesInProtocolSendHandlesRequest |
| { |
| #[inline] |
| fn from_wire(wire: WireHandlesInProtocolSendHandlesRequest<'de>) -> Self { |
| Self { t: ::fidl_next::FromWire::from_wire(wire.t) } |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for WireHandlesInProtocolSendHandlesRequest<'de> { |
| type Natural = HandlesInProtocolSendHandlesRequest; |
| } |
| |
| /// The wire type corresponding to [`HandlesInProtocolSendHandlesRequest`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireHandlesInProtocolSendHandlesRequest<'de> { |
| pub t: crate::WireT<'de>, |
| } |
| static_assertions::const_assert_eq!( |
| std::mem::size_of::<WireHandlesInProtocolSendHandlesRequest<'_>>(), |
| 16 |
| ); |
| static_assertions::const_assert_eq!( |
| std::mem::align_of::<WireHandlesInProtocolSendHandlesRequest<'_>>(), |
| 8 |
| ); |
| |
| static_assertions::const_assert_eq!( |
| std::mem::offset_of!(WireHandlesInProtocolSendHandlesRequest<'_>, t), |
| 0 |
| ); |
| |
| unsafe impl ::fidl_next::Wire for WireHandlesInProtocolSendHandlesRequest<'static> { |
| type Decoded<'de> = WireHandlesInProtocolSendHandlesRequest<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| t, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(t); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireHandlesInProtocolSendHandlesRequest<'static> |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::Decoder, |
| ___D: ::fidl_next::fuchsia::HandleDecoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut t, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(t.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| /// The type corresponding to the HandlesInProtocol protocol. |
| #[derive(PartialEq, Debug)] |
| pub struct HandlesInProtocol; |
| |
| pub mod handles_in_protocol { |
| pub mod prelude { |
| pub use crate::{ |
| HandlesInProtocol, HandlesInProtocolClientHandler, HandlesInProtocolServerHandler, |
| handles_in_protocol, |
| }; |
| |
| pub use crate::HandlesInProtocolSendHandlesRequest; |
| } |
| |
| pub struct SendHandles; |
| |
| impl ::fidl_next::Method for SendHandles { |
| const ORDINAL: u64 = 8904504160365833729; |
| |
| type Protocol = crate::HandlesInProtocol; |
| |
| type Request = crate::WireHandlesInProtocolSendHandlesRequest<'static>; |
| |
| type Response = ::fidl_next::Never; |
| } |
| |
| mod ___detail { |
| |
| pub struct SendHandles<T0> { |
| t: T0, |
| } |
| |
| impl<T0> ::fidl_next::Encodable for SendHandles<T0> |
| where |
| T0: ::fidl_next::Encodable<Encoded = crate::WireT<'static>>, |
| { |
| type Encoded = crate::WireHandlesInProtocolSendHandlesRequest<'static>; |
| } |
| |
| unsafe impl<___E, T0> ::fidl_next::Encode<___E> for SendHandles<T0> |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| ___E: ::fidl_next::fuchsia::HandleEncoder, |
| T0: ::fidl_next::Encode<___E, Encoded = crate::WireT<'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 { |
| t, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.t, encoder_, t)?; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::HandlesInProtocol |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| type Client = HandlesInProtocolClient<___T>; |
| type Server = HandlesInProtocolServer<___T>; |
| } |
| |
| /// The client for the `HandlesInProtocol` protocol. |
| #[repr(transparent)] |
| pub struct HandlesInProtocolClient<___T: ::fidl_next::Transport> { |
| #[allow(dead_code)] |
| client: ::fidl_next::protocol::Client<___T>, |
| } |
| |
| impl<___T> HandlesInProtocolClient<___T> |
| where |
| ___T: ::fidl_next::Transport, |
| { |
| pub fn send_handles( |
| &self, |
| |
| t: impl ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = crate::WireT<'static>, |
| >, |
| ) -> ::fidl_next::SendFuture<'_, ___T> |
| where |
| <___T as ::fidl_next::Transport>::SendBuffer: |
| ::fidl_next::encoder::InternalHandleEncoder, |
| <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder, |
| <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder, |
| { |
| self.send_handles_with(SendHandles { t }) |
| } |
| |
| pub fn send_handles_with<___R>( |
| &self, |
| request: ___R, |
| ) -> ::fidl_next::SendFuture<'_, ___T> |
| where |
| ___R: ::fidl_next::Encode< |
| <___T as ::fidl_next::Transport>::SendBuffer, |
| Encoded = crate::WireHandlesInProtocolSendHandlesRequest<'static>, |
| >, |
| { |
| ::fidl_next::SendFuture::from_untyped( |
| self.client.send_one_way(8904504160365833729, request), |
| ) |
| } |
| } |
| |
| /// The server for the `HandlesInProtocol` protocol. |
| #[repr(transparent)] |
| pub struct HandlesInProtocolServer<___T: ::fidl_next::Transport> { |
| server: ::fidl_next::protocol::Server<___T>, |
| } |
| |
| impl<___T> HandlesInProtocolServer<___T> where ___T: ::fidl_next::Transport {} |
| } |
| } |
| |
| /// A client handler for the HandlesInProtocol protocol. |
| /// |
| /// See [`HandlesInProtocol`] for more details. |
| pub trait HandlesInProtocolClientHandler< |
| #[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 HandlesInProtocol |
| where |
| ___H: HandlesInProtocolClientHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| { |
| 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 HandlesInProtocol protocol. |
| /// |
| /// See [`HandlesInProtocol`] for more details. |
| pub trait HandlesInProtocolServerHandler< |
| #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport, |
| #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel, |
| > |
| { |
| fn send_handles( |
| &mut self, |
| server: &::fidl_next::Server<HandlesInProtocol, ___T>, |
| |
| request: ::fidl_next::Request<handles_in_protocol::SendHandles, ___T>, |
| ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send; |
| } |
| |
| impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for HandlesInProtocol |
| where |
| ___H: HandlesInProtocolServerHandler<___T> + ::core::marker::Send, |
| ___T: ::fidl_next::Transport, |
| <handles_in_protocol::SendHandles 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 { |
| 8904504160365833729 => match ::fidl_next::DecoderExt::decode(buffer) { |
| Ok(decoded) => handler.send_handles(server, decoded).await, |
| Err(e) => server.close(), |
| }, |
| |
| ordinal => server.close(), |
| } |
| } |
| |
| async fn on_two_way( |
| handler: &mut ___H, |
| ordinal: u64, |
| buffer: ___T::RecvBuffer, |
| responder: ::fidl_next::protocol::Responder<___T>, |
| ) { |
| match ordinal { |
| ordinal => responder.server().close(), |
| } |
| } |
| } |
| |
| #[derive(PartialEq, Debug)] |
| #[repr(C)] |
| pub struct ServerEndWrapper { |
| pub value: ::fidl_next::ServerEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel>, |
| } |
| |
| impl ::fidl_next::Encodable for ServerEndWrapper { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireServerEndWrapper> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| ::fidl_next::ServerEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel> as ::fidl_next::Encodable |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| type Encoded = WireServerEndWrapper; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for ServerEndWrapper |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::fuchsia::HandleEncoder, |
| { |
| #[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 { |
| value, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.value, encoder_, value)?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::fidl_next::EncodableOption for ServerEndWrapper { |
| type EncodedOption = ::fidl_next::WireBox<'static, WireServerEndWrapper>; |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ServerEndWrapper |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| ServerEndWrapper: ::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(()) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireServerEndWrapper> for ServerEndWrapper { |
| const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireServerEndWrapper, Self> = unsafe { |
| ::fidl_next::CopyOptimization::enable_if( |
| true |
| |
| && < |
| ::fidl_next::ServerEnd<crate::DriverProtocol, ::fdf_fidl::DriverChannel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::DriverProtocol, ::fdf_fidl::WireDriverChannel>> |
| >::COPY_OPTIMIZATION.is_enabled() |
| |
| ) |
| }; |
| |
| #[inline] |
| fn from_wire(wire: WireServerEndWrapper) -> Self { |
| Self { value: ::fidl_next::FromWire::from_wire(wire.value) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireServerEndWrapper { |
| type Natural = ServerEndWrapper; |
| } |
| |
| /// The wire type corresponding to [`ServerEndWrapper`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct WireServerEndWrapper { |
| pub value: ::fidl_next::ServerEnd<crate::DriverProtocol, ::fdf_fidl::WireDriverChannel>, |
| } |
| static_assertions::const_assert_eq!(std::mem::size_of::<WireServerEndWrapper>(), 4); |
| static_assertions::const_assert_eq!(std::mem::align_of::<WireServerEndWrapper>(), 4); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(WireServerEndWrapper, value), 0); |
| |
| unsafe impl ::fidl_next::Wire for WireServerEndWrapper { |
| type Decoded<'de> = WireServerEndWrapper; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| value, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(value); |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for WireServerEndWrapper |
| where |
| ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized, |
| ___D: ::fidl_next::fuchsia::HandleDecoder, |
| { |
| fn decode( |
| slot_: ::fidl_next::Slot<'_, Self>, |
| decoder_: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut value, |
| |
| } = slot_; |
| } |
| |
| ::fidl_next::Decode::decode(value.as_mut(), decoder_)?; |
| |
| Ok(()) |
| } |
| } |
| |
| /// Compatibility shims which mimic some API surfaces of the current Rust bindings. |
| pub mod compat { |
| |
| #[cfg(target_os = "fuchsia")] |
| /// An alias for a client over `zx::Channel` for the `DriverProtocol` |
| /// protocol. |
| pub type DriverProtocolProxy = ::fidl_next::Client<crate::DriverProtocol>; |
| |
| #[cfg(feature = "driver")] |
| impl ::fidl_next::CompatFrom<crate::DriverProtocol> |
| for ::fidl_test_driverhandle::DriverProtocolMarker |
| { |
| fn compat_from(_: crate::DriverProtocol) -> Self { |
| Self |
| } |
| } |
| |
| #[cfg(feature = "driver")] |
| impl ::fidl_next::CompatFrom<::fidl_test_driverhandle::DriverProtocolMarker> |
| for crate::DriverProtocol |
| { |
| fn compat_from(_: ::fidl_test_driverhandle::DriverProtocolMarker) -> Self { |
| Self |
| } |
| } |
| } |