| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)] |
| |
| use bitflags::bitflags; |
| use fidl::client::QueryResponseFut; |
| use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect}; |
| use fidl::endpoints::{ControlHandle as _, Responder as _}; |
| pub use fidl_test_protocollayoutssamelibrary__common::*; |
| use futures::future::{self, MaybeDone, TryFutureExt}; |
| use zx_status; |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct ComposedProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for ComposedProtocolMarker { |
| type Proxy = ComposedProtocolProxy; |
| type RequestStream = ComposedProtocolRequestStream; |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = ComposedProtocolSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) ComposedProtocol"; |
| } |
| pub type ComposedProtocolTwoWayAnonComposedWithErrorResult = |
| Result<ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>; |
| pub type ComposedProtocolTwoWayNamedComposedWithErrorResult = Result<UnionPayload, u32>; |
| |
| pub trait ComposedProtocolProxyInterface: Send + Sync { |
| fn r#one_way_anon_composed( |
| &self, |
| payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error>; |
| type TwoWayAnonComposedResponseFut: std::future::Future< |
| Output = Result<ComposedProtocolTwoWayAnonComposedResponse, fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed( |
| &self, |
| payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut; |
| type TwoWayAnonComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<ComposedProtocolTwoWayAnonComposedWithErrorResult, fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut; |
| fn r#one_way_named_composed(&self, payload: &TablePayload) -> Result<(), fidl::Error>; |
| type TwoWayNamedComposedResponseFut: std::future::Future<Output = Result<TablePayload, fidl::Error>> |
| + Send; |
| fn r#two_way_named_composed( |
| &self, |
| payload: &UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut; |
| type TwoWayNamedComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<ComposedProtocolTwoWayNamedComposedWithErrorResult, fidl::Error>, |
| > + Send; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| payload: &TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut; |
| } |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct ComposedProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for ComposedProtocolSynchronousProxy { |
| type Proxy = ComposedProtocolProxy; |
| type Protocol = ComposedProtocolMarker; |
| |
| fn from_channel(inner: fidl::Channel) -> Self { |
| Self::new(inner) |
| } |
| |
| fn into_channel(self) -> fidl::Channel { |
| self.client.into_channel() |
| } |
| |
| fn as_channel(&self) -> &fidl::Channel { |
| self.client.as_channel() |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl ComposedProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <ComposedProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME; |
| Self { client: fidl::client::sync::Client::new(channel, protocol_name) } |
| } |
| |
| pub fn into_channel(self) -> fidl::Channel { |
| self.client.into_channel() |
| } |
| |
| /// Waits until an event arrives and returns it. It is safe for other |
| /// threads to make concurrent requests while waiting for an event. |
| pub fn wait_for_event( |
| &self, |
| deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolEvent, fidl::Error> { |
| ComposedProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#one_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ComposedProtocolOneWayAnonComposedRequest>( |
| payload, |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedResponse, fidl::Error> { |
| let _response = self.client.send_query::< |
| ComposedProtocolTwoWayAnonComposedRequest, |
| ComposedProtocolTwoWayAnonComposedResponse, |
| >( |
| payload, |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedWithErrorResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| fidl::encoding::ResultType<ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| >( |
| payload, |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| |
| pub fn r#one_way_named_composed(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<TablePayload>( |
| payload, |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &UnionPayload, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<TablePayload, fidl::Error> { |
| let _response = self.client.send_query::<UnionPayload, TablePayload>( |
| payload, |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolTwoWayNamedComposedWithErrorResult, fidl::Error> { |
| let _response = |
| self.client.send_query::<TablePayload, fidl::encoding::ResultType<UnionPayload, u32>>( |
| payload, |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<ComposedProtocolSynchronousProxy> for zx::Handle { |
| fn from(value: ComposedProtocolSynchronousProxy) -> Self { |
| value.into_channel().into() |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<fidl::Channel> for ComposedProtocolSynchronousProxy { |
| fn from(value: fidl::Channel) -> Self { |
| Self::new(value) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ComposedProtocolProxy { |
| client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl fidl::endpoints::Proxy for ComposedProtocolProxy { |
| type Protocol = ComposedProtocolMarker; |
| |
| fn from_channel(inner: ::fidl::AsyncChannel) -> Self { |
| Self::new(inner) |
| } |
| |
| fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> { |
| self.client.into_channel().map_err(|client| Self { client }) |
| } |
| |
| fn as_channel(&self) -> &::fidl::AsyncChannel { |
| self.client.as_channel() |
| } |
| } |
| |
| impl ComposedProtocolProxy { |
| /// Create a new Proxy for test.protocollayoutssamelibrary/ComposedProtocol. |
| pub fn new(channel: ::fidl::AsyncChannel) -> Self { |
| let protocol_name = <ComposedProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME; |
| Self { client: fidl::client::Client::new(channel, protocol_name) } |
| } |
| |
| /// Get a Stream of events from the remote end of the protocol. |
| /// |
| /// # Panics |
| /// |
| /// Panics if the event stream was already taken. |
| pub fn take_event_stream(&self) -> ComposedProtocolEventStream { |
| ComposedProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#one_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| ComposedProtocolProxyInterface::r#one_way_anon_composed(self, payload) |
| } |
| |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| ComposedProtocolProxyInterface::r#two_way_anon_composed(self, payload) |
| } |
| |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| ComposedProtocolProxyInterface::r#two_way_anon_composed_with_error(self, payload) |
| } |
| |
| pub fn r#one_way_named_composed(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| ComposedProtocolProxyInterface::r#one_way_named_composed(self, payload) |
| } |
| |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &UnionPayload, |
| ) -> fidl::client::QueryResponseFut<TablePayload, fidl::encoding::DefaultFuchsiaResourceDialect> |
| { |
| ComposedProtocolProxyInterface::r#two_way_named_composed(self, payload) |
| } |
| |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ) -> fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| ComposedProtocolProxyInterface::r#two_way_named_composed_with_error(self, payload) |
| } |
| } |
| |
| impl ComposedProtocolProxyInterface for ComposedProtocolProxy { |
| fn r#one_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ComposedProtocolOneWayAnonComposedRequest>( |
| payload, |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type TwoWayAnonComposedResponseFut = fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedResponse, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| ComposedProtocolTwoWayAnonComposedResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x7083713dee9435f4, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::< |
| ComposedProtocolTwoWayAnonComposedRequest, |
| ComposedProtocolTwoWayAnonComposedResponse, |
| >( |
| payload, |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TwoWayAnonComposedWithErrorResponseFut = fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedWithErrorResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType< |
| ComposedProtocolTwoWayAnonComposedWithErrorResponse, |
| u32, |
| >, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x4fd32c5e2ffa6828, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| >( |
| payload, |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| fn r#one_way_named_composed(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<TablePayload>( |
| payload, |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type TwoWayNamedComposedResponseFut = |
| fidl::client::QueryResponseFut<TablePayload, fidl::encoding::DefaultFuchsiaResourceDialect>; |
| fn r#two_way_named_composed( |
| &self, |
| mut payload: &UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<TablePayload, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x45b4d3d31b374054, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::<UnionPayload, TablePayload>( |
| payload, |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TwoWayNamedComposedWithErrorResponseFut = fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<ComposedProtocolTwoWayNamedComposedWithErrorResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<UnionPayload, u32>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x450531e2d20c52ef, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| TablePayload, |
| ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| >( |
| payload, |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct ComposedProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl std::marker::Unpin for ComposedProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for ComposedProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for ComposedProtocolEventStream { |
| type Item = Result<ComposedProtocolEvent, fidl::Error>; |
| |
| fn poll_next( |
| mut self: std::pin::Pin<&mut Self>, |
| cx: &mut std::task::Context<'_>, |
| ) -> std::task::Poll<Option<Self::Item>> { |
| match futures::ready!(futures::stream::StreamExt::poll_next_unpin( |
| &mut self.event_receiver, |
| cx |
| )?) { |
| Some(buf) => std::task::Poll::Ready(Some(ComposedProtocolEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ComposedProtocolEvent { |
| OnAnonComposed { payload: ComposedProtocolOnAnonComposedRequest }, |
| OnNamedComposed { payload: UnionPayload }, |
| } |
| |
| impl ComposedProtocolEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_anon_composed(self) -> Option<ComposedProtocolOnAnonComposedRequest> { |
| if let ComposedProtocolEvent::OnAnonComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_named_composed(self) -> Option<UnionPayload> { |
| if let ComposedProtocolEvent::OnNamedComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| |
| /// Decodes a message buffer as a [`ComposedProtocolEvent`]. |
| fn decode( |
| mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, |
| ) -> Result<ComposedProtocolEvent, fidl::Error> { |
| let (bytes, _handles) = buf.split_mut(); |
| let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| debug_assert_eq!(tx_header.tx_id, 0); |
| match tx_header.ordinal { |
| 0x49a6eee3a0300e28 => { |
| let mut out = fidl::new_empty!( |
| ComposedProtocolOnAnonComposedRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolOnAnonComposedRequest>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok((ComposedProtocolEvent::OnAnonComposed { payload: out })) |
| } |
| 0x17c4edb4a4a36d7b => { |
| let mut out = |
| fidl::new_empty!(UnionPayload, fidl::encoding::DefaultFuchsiaResourceDialect); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnionPayload>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok((ComposedProtocolEvent::OnNamedComposed { payload: out })) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <ComposedProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocollayoutssamelibrary/ComposedProtocol. |
| pub struct ComposedProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for ComposedProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for ComposedProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for ComposedProtocolRequestStream { |
| type Protocol = ComposedProtocolMarker; |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn from_channel(channel: ::fidl::AsyncChannel) -> Self { |
| Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false } |
| } |
| |
| fn control_handle(&self) -> Self::ControlHandle { |
| ComposedProtocolControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner( |
| self, |
| ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool) |
| { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner( |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| ) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for ComposedProtocolRequestStream { |
| type Item = Result<ComposedProtocolRequest, fidl::Error>; |
| |
| fn poll_next( |
| mut self: std::pin::Pin<&mut Self>, |
| cx: &mut std::task::Context<'_>, |
| ) -> std::task::Poll<Option<Self::Item>> { |
| let this = &mut *self; |
| if this.inner.check_shutdown(cx) { |
| this.is_terminated = true; |
| return std::task::Poll::Ready(None); |
| } |
| if this.is_terminated { |
| panic!("polled ComposedProtocolRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>( |
| |bytes, handles| { |
| match this.inner.channel().read_etc(cx, bytes, handles) { |
| std::task::Poll::Ready(Ok(())) => {} |
| std::task::Poll::Pending => return std::task::Poll::Pending, |
| std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => { |
| this.is_terminated = true; |
| return std::task::Poll::Ready(None); |
| } |
| std::task::Poll::Ready(Err(e)) => { |
| return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead( |
| e.into(), |
| )))) |
| } |
| } |
| |
| // A message has been received from the channel |
| let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| std::task::Poll::Ready(Some(match header.ordinal { |
| 0x6e7a205bdad7941f => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| ComposedProtocolOneWayAnonComposedRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolOneWayAnonComposedRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ComposedProtocolRequest::OneWayAnonComposed { |
| payload: req, |
| control_handle, |
| }) |
| } |
| 0x7083713dee9435f4 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| ComposedProtocolTwoWayAnonComposedRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolTwoWayAnonComposedRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ComposedProtocolRequest::TwoWayAnonComposed { |
| payload: req, |
| responder: ComposedProtocolTwoWayAnonComposedResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x4fd32c5e2ffa6828 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolTwoWayAnonComposedWithErrorRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ComposedProtocolRequest::TwoWayAnonComposedWithError { |
| payload: req, |
| responder: ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x101636a8fa3e69b8 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TablePayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ComposedProtocolRequest::OneWayNamedComposed { |
| payload: req, |
| control_handle, |
| }) |
| } |
| 0x45b4d3d31b374054 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| UnionPayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnionPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ComposedProtocolRequest::TwoWayNamedComposed { |
| payload: req, |
| responder: ComposedProtocolTwoWayNamedComposedResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x450531e2d20c52ef => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TablePayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ComposedProtocolRequest::TwoWayNamedComposedWithError { |
| payload: req, |
| responder: ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <ComposedProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }, |
| ) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ComposedProtocolRequest { |
| OneWayAnonComposed { |
| payload: ComposedProtocolOneWayAnonComposedRequest, |
| control_handle: ComposedProtocolControlHandle, |
| }, |
| TwoWayAnonComposed { |
| payload: ComposedProtocolTwoWayAnonComposedRequest, |
| responder: ComposedProtocolTwoWayAnonComposedResponder, |
| }, |
| TwoWayAnonComposedWithError { |
| payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| responder: ComposedProtocolTwoWayAnonComposedWithErrorResponder, |
| }, |
| OneWayNamedComposed { |
| payload: TablePayload, |
| control_handle: ComposedProtocolControlHandle, |
| }, |
| TwoWayNamedComposed { |
| payload: UnionPayload, |
| responder: ComposedProtocolTwoWayNamedComposedResponder, |
| }, |
| TwoWayNamedComposedWithError { |
| payload: TablePayload, |
| responder: ComposedProtocolTwoWayNamedComposedWithErrorResponder, |
| }, |
| } |
| |
| impl ComposedProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_anon_composed( |
| self, |
| ) -> Option<(ComposedProtocolOneWayAnonComposedRequest, ComposedProtocolControlHandle)> { |
| if let ComposedProtocolRequest::OneWayAnonComposed { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_composed( |
| self, |
| ) -> Option<( |
| ComposedProtocolTwoWayAnonComposedRequest, |
| ComposedProtocolTwoWayAnonComposedResponder, |
| )> { |
| if let ComposedProtocolRequest::TwoWayAnonComposed { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_composed_with_error( |
| self, |
| ) -> Option<( |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ComposedProtocolTwoWayAnonComposedWithErrorResponder, |
| )> { |
| if let ComposedProtocolRequest::TwoWayAnonComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_named_composed( |
| self, |
| ) -> Option<(TablePayload, ComposedProtocolControlHandle)> { |
| if let ComposedProtocolRequest::OneWayNamedComposed { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_named_composed( |
| self, |
| ) -> Option<(UnionPayload, ComposedProtocolTwoWayNamedComposedResponder)> { |
| if let ComposedProtocolRequest::TwoWayNamedComposed { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_named_composed_with_error( |
| self, |
| ) -> Option<(TablePayload, ComposedProtocolTwoWayNamedComposedWithErrorResponder)> { |
| if let ComposedProtocolRequest::TwoWayNamedComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| ComposedProtocolRequest::OneWayAnonComposed { .. } => "one_way_anon_composed", |
| ComposedProtocolRequest::TwoWayAnonComposed { .. } => "two_way_anon_composed", |
| ComposedProtocolRequest::TwoWayAnonComposedWithError { .. } => { |
| "two_way_anon_composed_with_error" |
| } |
| ComposedProtocolRequest::OneWayNamedComposed { .. } => "one_way_named_composed", |
| ComposedProtocolRequest::TwoWayNamedComposed { .. } => "two_way_named_composed", |
| ComposedProtocolRequest::TwoWayNamedComposedWithError { .. } => { |
| "two_way_named_composed_with_error" |
| } |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ComposedProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for ComposedProtocolControlHandle { |
| fn shutdown(&self) { |
| self.inner.shutdown() |
| } |
| fn shutdown_with_epitaph(&self, status: zx_status::Status) { |
| self.inner.shutdown_with_epitaph(status) |
| } |
| |
| fn is_closed(&self) -> bool { |
| self.inner.channel().is_closed() |
| } |
| fn on_closed(&self) -> fidl::OnSignalsRef<'_> { |
| self.inner.channel().on_closed() |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| fn signal_peer( |
| &self, |
| clear_mask: zx::Signals, |
| set_mask: zx::Signals, |
| ) -> Result<(), zx_status::Status> { |
| use fidl::Peered; |
| self.inner.channel().signal_peer(clear_mask, set_mask) |
| } |
| } |
| |
| impl ComposedProtocolControlHandle { |
| pub fn send_on_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOnAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.inner.send::<ComposedProtocolOnAnonComposedRequest>( |
| payload, |
| 0, |
| 0x49a6eee3a0300e28, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn send_on_named_composed(&self, mut payload: &UnionPayload) -> Result<(), fidl::Error> { |
| self.inner.send::<UnionPayload>( |
| payload, |
| 0, |
| 0x17c4edb4a4a36d7b, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ComposedProtocolTwoWayAnonComposedResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for ComposedProtocolTwoWayAnonComposedResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for ComposedProtocolTwoWayAnonComposedResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl ComposedProtocolTwoWayAnonComposedResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<ComposedProtocolTwoWayAnonComposedResponse>( |
| payload, |
| self.tx_id, |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut result: Result<&ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut result: Result<&ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut result: Result<&ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType< |
| ComposedProtocolTwoWayAnonComposedWithErrorResponse, |
| u32, |
| >>( |
| result, |
| self.tx_id, |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ComposedProtocolTwoWayNamedComposedResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for ComposedProtocolTwoWayNamedComposedResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for ComposedProtocolTwoWayNamedComposedResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl ComposedProtocolTwoWayNamedComposedResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err(self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<TablePayload>( |
| payload, |
| self.tx_id, |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<&UnionPayload, u32>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut result: Result<&UnionPayload, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<&UnionPayload, u32>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType<UnionPayload, u32>>( |
| result, |
| self.tx_id, |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct MainProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for MainProtocolMarker { |
| type Proxy = MainProtocolProxy; |
| type RequestStream = MainProtocolRequestStream; |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = MainProtocolSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) MainProtocol"; |
| } |
| pub type MainProtocolTwoWayLocalWithErrorResult = Result<UnionPayload, u32>; |
| pub type MainProtocolTwoWayAnonWithErrorResult = |
| Result<MainProtocolTwoWayAnonWithErrorResponse, u32>; |
| |
| pub trait MainProtocolProxyInterface: Send + Sync { |
| fn r#one_way_anon_composed( |
| &self, |
| payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error>; |
| type TwoWayAnonComposedResponseFut: std::future::Future< |
| Output = Result<ComposedProtocolTwoWayAnonComposedResponse, fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed( |
| &self, |
| payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut; |
| type TwoWayAnonComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<ComposedProtocolTwoWayAnonComposedWithErrorResult, fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut; |
| fn r#one_way_named_composed(&self, payload: &TablePayload) -> Result<(), fidl::Error>; |
| type TwoWayNamedComposedResponseFut: std::future::Future<Output = Result<TablePayload, fidl::Error>> |
| + Send; |
| fn r#two_way_named_composed( |
| &self, |
| payload: &UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut; |
| type TwoWayNamedComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<ComposedProtocolTwoWayNamedComposedWithErrorResult, fidl::Error>, |
| > + Send; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| payload: &TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut; |
| fn r#one_way_local(&self, payload: &TablePayload) -> Result<(), fidl::Error>; |
| type TwoWayLocalResponseFut: std::future::Future<Output = Result<TablePayload, fidl::Error>> |
| + Send; |
| fn r#two_way_local(&self, payload: &UnionPayload) -> Self::TwoWayLocalResponseFut; |
| type TwoWayLocalWithErrorResponseFut: std::future::Future<Output = Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error>> |
| + Send; |
| fn r#two_way_local_with_error( |
| &self, |
| payload: &TablePayload, |
| ) -> Self::TwoWayLocalWithErrorResponseFut; |
| fn r#one_way_anon(&self, payload: &MainProtocolOneWayAnonRequest) -> Result<(), fidl::Error>; |
| type TwoWayAnonResponseFut: std::future::Future<Output = Result<MainProtocolTwoWayAnonResponse, fidl::Error>> |
| + Send; |
| fn r#two_way_anon( |
| &self, |
| payload: &MainProtocolTwoWayAnonRequest, |
| ) -> Self::TwoWayAnonResponseFut; |
| type TwoWayAnonWithErrorResponseFut: std::future::Future<Output = Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error>> |
| + Send; |
| fn r#two_way_anon_with_error( |
| &self, |
| payload: &MainProtocolTwoWayAnonWithErrorRequest, |
| ) -> Self::TwoWayAnonWithErrorResponseFut; |
| } |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct MainProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for MainProtocolSynchronousProxy { |
| type Proxy = MainProtocolProxy; |
| type Protocol = MainProtocolMarker; |
| |
| fn from_channel(inner: fidl::Channel) -> Self { |
| Self::new(inner) |
| } |
| |
| fn into_channel(self) -> fidl::Channel { |
| self.client.into_channel() |
| } |
| |
| fn as_channel(&self) -> &fidl::Channel { |
| self.client.as_channel() |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl MainProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME; |
| Self { client: fidl::client::sync::Client::new(channel, protocol_name) } |
| } |
| |
| pub fn into_channel(self) -> fidl::Channel { |
| self.client.into_channel() |
| } |
| |
| /// Waits until an event arrives and returns it. It is safe for other |
| /// threads to make concurrent requests while waiting for an event. |
| pub fn wait_for_event( |
| &self, |
| deadline: zx::MonotonicInstant, |
| ) -> Result<MainProtocolEvent, fidl::Error> { |
| MainProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#one_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ComposedProtocolOneWayAnonComposedRequest>( |
| payload, |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedResponse, fidl::Error> { |
| let _response = self.client.send_query::< |
| ComposedProtocolTwoWayAnonComposedRequest, |
| ComposedProtocolTwoWayAnonComposedResponse, |
| >( |
| payload, |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedWithErrorResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| fidl::encoding::ResultType<ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| >( |
| payload, |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| |
| pub fn r#one_way_named_composed(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<TablePayload>( |
| payload, |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &UnionPayload, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<TablePayload, fidl::Error> { |
| let _response = self.client.send_query::<UnionPayload, TablePayload>( |
| payload, |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<ComposedProtocolTwoWayNamedComposedWithErrorResult, fidl::Error> { |
| let _response = |
| self.client.send_query::<TablePayload, fidl::encoding::ResultType<UnionPayload, u32>>( |
| payload, |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| |
| pub fn r#one_way_local(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<TablePayload>( |
| payload, |
| 0x3954b4c6b80956c1, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#two_way_local( |
| &self, |
| mut payload: &UnionPayload, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<TablePayload, fidl::Error> { |
| let _response = self.client.send_query::<UnionPayload, TablePayload>( |
| payload, |
| 0x26998b4c1e8a9a57, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#two_way_local_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error> { |
| let _response = |
| self.client.send_query::<TablePayload, fidl::encoding::ResultType<UnionPayload, u32>>( |
| payload, |
| 0x4a7bf9ce881afde7, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| |
| pub fn r#one_way_anon( |
| &self, |
| mut payload: &MainProtocolOneWayAnonRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<MainProtocolOneWayAnonRequest>( |
| payload, |
| 0x774bf445f584ce2c, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#two_way_anon( |
| &self, |
| mut payload: &MainProtocolTwoWayAnonRequest, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<MainProtocolTwoWayAnonResponse, fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<MainProtocolTwoWayAnonRequest, MainProtocolTwoWayAnonResponse>( |
| payload, |
| 0x3fd7ad8e52b07e2e, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#two_way_anon_with_error( |
| &self, |
| mut payload: &MainProtocolTwoWayAnonWithErrorRequest, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| MainProtocolTwoWayAnonWithErrorRequest, |
| fidl::encoding::ResultType<MainProtocolTwoWayAnonWithErrorResponse, u32>, |
| >( |
| payload, |
| 0x1d33061a424eb245, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<MainProtocolSynchronousProxy> for zx::Handle { |
| fn from(value: MainProtocolSynchronousProxy) -> Self { |
| value.into_channel().into() |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<fidl::Channel> for MainProtocolSynchronousProxy { |
| fn from(value: fidl::Channel) -> Self { |
| Self::new(value) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct MainProtocolProxy { |
| client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl fidl::endpoints::Proxy for MainProtocolProxy { |
| type Protocol = MainProtocolMarker; |
| |
| fn from_channel(inner: ::fidl::AsyncChannel) -> Self { |
| Self::new(inner) |
| } |
| |
| fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> { |
| self.client.into_channel().map_err(|client| Self { client }) |
| } |
| |
| fn as_channel(&self) -> &::fidl::AsyncChannel { |
| self.client.as_channel() |
| } |
| } |
| |
| impl MainProtocolProxy { |
| /// Create a new Proxy for test.protocollayoutssamelibrary/MainProtocol. |
| pub fn new(channel: ::fidl::AsyncChannel) -> Self { |
| let protocol_name = <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME; |
| Self { client: fidl::client::Client::new(channel, protocol_name) } |
| } |
| |
| /// Get a Stream of events from the remote end of the protocol. |
| /// |
| /// # Panics |
| /// |
| /// Panics if the event stream was already taken. |
| pub fn take_event_stream(&self) -> MainProtocolEventStream { |
| MainProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#one_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_anon_composed(self, payload) |
| } |
| |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| MainProtocolProxyInterface::r#two_way_anon_composed(self, payload) |
| } |
| |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| MainProtocolProxyInterface::r#two_way_anon_composed_with_error(self, payload) |
| } |
| |
| pub fn r#one_way_named_composed(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_named_composed(self, payload) |
| } |
| |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &UnionPayload, |
| ) -> fidl::client::QueryResponseFut<TablePayload, fidl::encoding::DefaultFuchsiaResourceDialect> |
| { |
| MainProtocolProxyInterface::r#two_way_named_composed(self, payload) |
| } |
| |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ) -> fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| MainProtocolProxyInterface::r#two_way_named_composed_with_error(self, payload) |
| } |
| |
| pub fn r#one_way_local(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_local(self, payload) |
| } |
| |
| pub fn r#two_way_local( |
| &self, |
| mut payload: &UnionPayload, |
| ) -> fidl::client::QueryResponseFut<TablePayload, fidl::encoding::DefaultFuchsiaResourceDialect> |
| { |
| MainProtocolProxyInterface::r#two_way_local(self, payload) |
| } |
| |
| pub fn r#two_way_local_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ) -> fidl::client::QueryResponseFut< |
| MainProtocolTwoWayLocalWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| MainProtocolProxyInterface::r#two_way_local_with_error(self, payload) |
| } |
| |
| pub fn r#one_way_anon( |
| &self, |
| mut payload: &MainProtocolOneWayAnonRequest, |
| ) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_anon(self, payload) |
| } |
| |
| pub fn r#two_way_anon( |
| &self, |
| mut payload: &MainProtocolTwoWayAnonRequest, |
| ) -> fidl::client::QueryResponseFut< |
| MainProtocolTwoWayAnonResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| MainProtocolProxyInterface::r#two_way_anon(self, payload) |
| } |
| |
| pub fn r#two_way_anon_with_error( |
| &self, |
| mut payload: &MainProtocolTwoWayAnonWithErrorRequest, |
| ) -> fidl::client::QueryResponseFut< |
| MainProtocolTwoWayAnonWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| MainProtocolProxyInterface::r#two_way_anon_with_error(self, payload) |
| } |
| } |
| |
| impl MainProtocolProxyInterface for MainProtocolProxy { |
| fn r#one_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ComposedProtocolOneWayAnonComposedRequest>( |
| payload, |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type TwoWayAnonComposedResponseFut = fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedResponse, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| ComposedProtocolTwoWayAnonComposedResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x7083713dee9435f4, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::< |
| ComposedProtocolTwoWayAnonComposedRequest, |
| ComposedProtocolTwoWayAnonComposedResponse, |
| >( |
| payload, |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TwoWayAnonComposedWithErrorResponseFut = fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<ComposedProtocolTwoWayAnonComposedWithErrorResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType< |
| ComposedProtocolTwoWayAnonComposedWithErrorResponse, |
| u32, |
| >, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x4fd32c5e2ffa6828, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| >( |
| payload, |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| fn r#one_way_named_composed(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<TablePayload>( |
| payload, |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type TwoWayNamedComposedResponseFut = |
| fidl::client::QueryResponseFut<TablePayload, fidl::encoding::DefaultFuchsiaResourceDialect>; |
| fn r#two_way_named_composed( |
| &self, |
| mut payload: &UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<TablePayload, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x45b4d3d31b374054, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::<UnionPayload, TablePayload>( |
| payload, |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TwoWayNamedComposedWithErrorResponseFut = fidl::client::QueryResponseFut< |
| ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<ComposedProtocolTwoWayNamedComposedWithErrorResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<UnionPayload, u32>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x450531e2d20c52ef, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| TablePayload, |
| ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| >( |
| payload, |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| fn r#one_way_local(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<TablePayload>( |
| payload, |
| 0x3954b4c6b80956c1, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type TwoWayLocalResponseFut = |
| fidl::client::QueryResponseFut<TablePayload, fidl::encoding::DefaultFuchsiaResourceDialect>; |
| fn r#two_way_local(&self, mut payload: &UnionPayload) -> Self::TwoWayLocalResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<TablePayload, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x26998b4c1e8a9a57, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::<UnionPayload, TablePayload>( |
| payload, |
| 0x26998b4c1e8a9a57, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TwoWayLocalWithErrorResponseFut = fidl::client::QueryResponseFut< |
| MainProtocolTwoWayLocalWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_local_with_error( |
| &self, |
| mut payload: &TablePayload, |
| ) -> Self::TwoWayLocalWithErrorResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<UnionPayload, u32>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x4a7bf9ce881afde7, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::<TablePayload, MainProtocolTwoWayLocalWithErrorResult>( |
| payload, |
| 0x4a7bf9ce881afde7, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| fn r#one_way_anon( |
| &self, |
| mut payload: &MainProtocolOneWayAnonRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<MainProtocolOneWayAnonRequest>( |
| payload, |
| 0x774bf445f584ce2c, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type TwoWayAnonResponseFut = fidl::client::QueryResponseFut< |
| MainProtocolTwoWayAnonResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_anon( |
| &self, |
| mut payload: &MainProtocolTwoWayAnonRequest, |
| ) -> Self::TwoWayAnonResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<MainProtocolTwoWayAnonResponse, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| MainProtocolTwoWayAnonResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x3fd7ad8e52b07e2e, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client |
| .send_query_and_decode::<MainProtocolTwoWayAnonRequest, MainProtocolTwoWayAnonResponse>( |
| payload, |
| 0x3fd7ad8e52b07e2e, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TwoWayAnonWithErrorResponseFut = fidl::client::QueryResponseFut< |
| MainProtocolTwoWayAnonWithErrorResult, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#two_way_anon_with_error( |
| &self, |
| mut payload: &MainProtocolTwoWayAnonWithErrorRequest, |
| ) -> Self::TwoWayAnonWithErrorResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<MainProtocolTwoWayAnonWithErrorResponse, u32>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0x1d33061a424eb245, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| MainProtocolTwoWayAnonWithErrorRequest, |
| MainProtocolTwoWayAnonWithErrorResult, |
| >( |
| payload, |
| 0x1d33061a424eb245, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct MainProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl std::marker::Unpin for MainProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for MainProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for MainProtocolEventStream { |
| type Item = Result<MainProtocolEvent, fidl::Error>; |
| |
| fn poll_next( |
| mut self: std::pin::Pin<&mut Self>, |
| cx: &mut std::task::Context<'_>, |
| ) -> std::task::Poll<Option<Self::Item>> { |
| match futures::ready!(futures::stream::StreamExt::poll_next_unpin( |
| &mut self.event_receiver, |
| cx |
| )?) { |
| Some(buf) => std::task::Poll::Ready(Some(MainProtocolEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum MainProtocolEvent { |
| OnAnonComposed { payload: ComposedProtocolOnAnonComposedRequest }, |
| OnNamedComposed { payload: UnionPayload }, |
| OnLocal { payload: UnionPayload }, |
| OnAnon { payload: MainProtocolOnAnonRequest }, |
| } |
| |
| impl MainProtocolEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_anon_composed(self) -> Option<ComposedProtocolOnAnonComposedRequest> { |
| if let MainProtocolEvent::OnAnonComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_named_composed(self) -> Option<UnionPayload> { |
| if let MainProtocolEvent::OnNamedComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_local(self) -> Option<UnionPayload> { |
| if let MainProtocolEvent::OnLocal { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_anon(self) -> Option<MainProtocolOnAnonRequest> { |
| if let MainProtocolEvent::OnAnon { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| |
| /// Decodes a message buffer as a [`MainProtocolEvent`]. |
| fn decode( |
| mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, |
| ) -> Result<MainProtocolEvent, fidl::Error> { |
| let (bytes, _handles) = buf.split_mut(); |
| let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| debug_assert_eq!(tx_header.tx_id, 0); |
| match tx_header.ordinal { |
| 0x49a6eee3a0300e28 => { |
| let mut out = fidl::new_empty!( |
| ComposedProtocolOnAnonComposedRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolOnAnonComposedRequest>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok((MainProtocolEvent::OnAnonComposed { payload: out })) |
| } |
| 0x17c4edb4a4a36d7b => { |
| let mut out = |
| fidl::new_empty!(UnionPayload, fidl::encoding::DefaultFuchsiaResourceDialect); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnionPayload>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok((MainProtocolEvent::OnNamedComposed { payload: out })) |
| } |
| 0x71e90a3d364d2e8d => { |
| let mut out = |
| fidl::new_empty!(UnionPayload, fidl::encoding::DefaultFuchsiaResourceDialect); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnionPayload>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok((MainProtocolEvent::OnLocal { payload: out })) |
| } |
| 0xd8fa6d0f5fabb94 => { |
| let mut out = fidl::new_empty!( |
| MainProtocolOnAnonRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolOnAnonRequest>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok((MainProtocolEvent::OnAnon { payload: out })) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocollayoutssamelibrary/MainProtocol. |
| pub struct MainProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for MainProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for MainProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for MainProtocolRequestStream { |
| type Protocol = MainProtocolMarker; |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn from_channel(channel: ::fidl::AsyncChannel) -> Self { |
| Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false } |
| } |
| |
| fn control_handle(&self) -> Self::ControlHandle { |
| MainProtocolControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner( |
| self, |
| ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool) |
| { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner( |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| ) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for MainProtocolRequestStream { |
| type Item = Result<MainProtocolRequest, fidl::Error>; |
| |
| fn poll_next( |
| mut self: std::pin::Pin<&mut Self>, |
| cx: &mut std::task::Context<'_>, |
| ) -> std::task::Poll<Option<Self::Item>> { |
| let this = &mut *self; |
| if this.inner.check_shutdown(cx) { |
| this.is_terminated = true; |
| return std::task::Poll::Ready(None); |
| } |
| if this.is_terminated { |
| panic!("polled MainProtocolRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>( |
| |bytes, handles| { |
| match this.inner.channel().read_etc(cx, bytes, handles) { |
| std::task::Poll::Ready(Ok(())) => {} |
| std::task::Poll::Pending => return std::task::Poll::Pending, |
| std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => { |
| this.is_terminated = true; |
| return std::task::Poll::Ready(None); |
| } |
| std::task::Poll::Ready(Err(e)) => { |
| return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead( |
| e.into(), |
| )))) |
| } |
| } |
| |
| // A message has been received from the channel |
| let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| std::task::Poll::Ready(Some(match header.ordinal { |
| 0x6e7a205bdad7941f => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| ComposedProtocolOneWayAnonComposedRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolOneWayAnonComposedRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::OneWayAnonComposed { payload: req, control_handle }) |
| } |
| 0x7083713dee9435f4 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| ComposedProtocolTwoWayAnonComposedRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolTwoWayAnonComposedRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayAnonComposed { |
| payload: req, |
| responder: MainProtocolTwoWayAnonComposedResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x4fd32c5e2ffa6828 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedProtocolTwoWayAnonComposedWithErrorRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayAnonComposedWithError { |
| payload: req, |
| responder: MainProtocolTwoWayAnonComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x101636a8fa3e69b8 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TablePayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::OneWayNamedComposed { |
| payload: req, |
| control_handle, |
| }) |
| } |
| 0x45b4d3d31b374054 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| UnionPayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnionPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayNamedComposed { |
| payload: req, |
| responder: MainProtocolTwoWayNamedComposedResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x450531e2d20c52ef => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TablePayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayNamedComposedWithError { |
| payload: req, |
| responder: MainProtocolTwoWayNamedComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x3954b4c6b80956c1 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TablePayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::OneWayLocal { payload: req, control_handle }) |
| } |
| 0x26998b4c1e8a9a57 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| UnionPayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnionPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayLocal { |
| payload: req, |
| responder: MainProtocolTwoWayLocalResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x4a7bf9ce881afde7 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| TablePayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TablePayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayLocalWithError { |
| payload: req, |
| responder: MainProtocolTwoWayLocalWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x774bf445f584ce2c => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| MainProtocolOneWayAnonRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolOneWayAnonRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::OneWayAnon { payload: req, control_handle }) |
| } |
| 0x3fd7ad8e52b07e2e => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| MainProtocolTwoWayAnonRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolTwoWayAnonRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayAnon { |
| payload: req, |
| responder: MainProtocolTwoWayAnonResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x1d33061a424eb245 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| MainProtocolTwoWayAnonWithErrorRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolTwoWayAnonWithErrorRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| MainProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(MainProtocolRequest::TwoWayAnonWithError { |
| payload: req, |
| responder: MainProtocolTwoWayAnonWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }, |
| ) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum MainProtocolRequest { |
| OneWayAnonComposed { |
| payload: ComposedProtocolOneWayAnonComposedRequest, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayAnonComposed { |
| payload: ComposedProtocolTwoWayAnonComposedRequest, |
| responder: MainProtocolTwoWayAnonComposedResponder, |
| }, |
| TwoWayAnonComposedWithError { |
| payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| responder: MainProtocolTwoWayAnonComposedWithErrorResponder, |
| }, |
| OneWayNamedComposed { |
| payload: TablePayload, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayNamedComposed { |
| payload: UnionPayload, |
| responder: MainProtocolTwoWayNamedComposedResponder, |
| }, |
| TwoWayNamedComposedWithError { |
| payload: TablePayload, |
| responder: MainProtocolTwoWayNamedComposedWithErrorResponder, |
| }, |
| OneWayLocal { |
| payload: TablePayload, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayLocal { |
| payload: UnionPayload, |
| responder: MainProtocolTwoWayLocalResponder, |
| }, |
| TwoWayLocalWithError { |
| payload: TablePayload, |
| responder: MainProtocolTwoWayLocalWithErrorResponder, |
| }, |
| OneWayAnon { |
| payload: MainProtocolOneWayAnonRequest, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayAnon { |
| payload: MainProtocolTwoWayAnonRequest, |
| responder: MainProtocolTwoWayAnonResponder, |
| }, |
| TwoWayAnonWithError { |
| payload: MainProtocolTwoWayAnonWithErrorRequest, |
| responder: MainProtocolTwoWayAnonWithErrorResponder, |
| }, |
| } |
| |
| impl MainProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_anon_composed( |
| self, |
| ) -> Option<(ComposedProtocolOneWayAnonComposedRequest, MainProtocolControlHandle)> { |
| if let MainProtocolRequest::OneWayAnonComposed { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_composed( |
| self, |
| ) -> Option<(ComposedProtocolTwoWayAnonComposedRequest, MainProtocolTwoWayAnonComposedResponder)> |
| { |
| if let MainProtocolRequest::TwoWayAnonComposed { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_composed_with_error( |
| self, |
| ) -> Option<( |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| MainProtocolTwoWayAnonComposedWithErrorResponder, |
| )> { |
| if let MainProtocolRequest::TwoWayAnonComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_named_composed(self) -> Option<(TablePayload, MainProtocolControlHandle)> { |
| if let MainProtocolRequest::OneWayNamedComposed { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_named_composed( |
| self, |
| ) -> Option<(UnionPayload, MainProtocolTwoWayNamedComposedResponder)> { |
| if let MainProtocolRequest::TwoWayNamedComposed { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_named_composed_with_error( |
| self, |
| ) -> Option<(TablePayload, MainProtocolTwoWayNamedComposedWithErrorResponder)> { |
| if let MainProtocolRequest::TwoWayNamedComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_local(self) -> Option<(TablePayload, MainProtocolControlHandle)> { |
| if let MainProtocolRequest::OneWayLocal { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_local(self) -> Option<(UnionPayload, MainProtocolTwoWayLocalResponder)> { |
| if let MainProtocolRequest::TwoWayLocal { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_local_with_error( |
| self, |
| ) -> Option<(TablePayload, MainProtocolTwoWayLocalWithErrorResponder)> { |
| if let MainProtocolRequest::TwoWayLocalWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_anon( |
| self, |
| ) -> Option<(MainProtocolOneWayAnonRequest, MainProtocolControlHandle)> { |
| if let MainProtocolRequest::OneWayAnon { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon( |
| self, |
| ) -> Option<(MainProtocolTwoWayAnonRequest, MainProtocolTwoWayAnonResponder)> { |
| if let MainProtocolRequest::TwoWayAnon { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_with_error( |
| self, |
| ) -> Option<(MainProtocolTwoWayAnonWithErrorRequest, MainProtocolTwoWayAnonWithErrorResponder)> |
| { |
| if let MainProtocolRequest::TwoWayAnonWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| MainProtocolRequest::OneWayAnonComposed { .. } => "one_way_anon_composed", |
| MainProtocolRequest::TwoWayAnonComposed { .. } => "two_way_anon_composed", |
| MainProtocolRequest::TwoWayAnonComposedWithError { .. } => { |
| "two_way_anon_composed_with_error" |
| } |
| MainProtocolRequest::OneWayNamedComposed { .. } => "one_way_named_composed", |
| MainProtocolRequest::TwoWayNamedComposed { .. } => "two_way_named_composed", |
| MainProtocolRequest::TwoWayNamedComposedWithError { .. } => { |
| "two_way_named_composed_with_error" |
| } |
| MainProtocolRequest::OneWayLocal { .. } => "one_way_local", |
| MainProtocolRequest::TwoWayLocal { .. } => "two_way_local", |
| MainProtocolRequest::TwoWayLocalWithError { .. } => "two_way_local_with_error", |
| MainProtocolRequest::OneWayAnon { .. } => "one_way_anon", |
| MainProtocolRequest::TwoWayAnon { .. } => "two_way_anon", |
| MainProtocolRequest::TwoWayAnonWithError { .. } => "two_way_anon_with_error", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct MainProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for MainProtocolControlHandle { |
| fn shutdown(&self) { |
| self.inner.shutdown() |
| } |
| fn shutdown_with_epitaph(&self, status: zx_status::Status) { |
| self.inner.shutdown_with_epitaph(status) |
| } |
| |
| fn is_closed(&self) -> bool { |
| self.inner.channel().is_closed() |
| } |
| fn on_closed(&self) -> fidl::OnSignalsRef<'_> { |
| self.inner.channel().on_closed() |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| fn signal_peer( |
| &self, |
| clear_mask: zx::Signals, |
| set_mask: zx::Signals, |
| ) -> Result<(), zx_status::Status> { |
| use fidl::Peered; |
| self.inner.channel().signal_peer(clear_mask, set_mask) |
| } |
| } |
| |
| impl MainProtocolControlHandle { |
| pub fn send_on_anon_composed( |
| &self, |
| mut payload: &ComposedProtocolOnAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.inner.send::<ComposedProtocolOnAnonComposedRequest>( |
| payload, |
| 0, |
| 0x49a6eee3a0300e28, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn send_on_named_composed(&self, mut payload: &UnionPayload) -> Result<(), fidl::Error> { |
| self.inner.send::<UnionPayload>( |
| payload, |
| 0, |
| 0x17c4edb4a4a36d7b, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn send_on_local(&self, mut payload: &UnionPayload) -> Result<(), fidl::Error> { |
| self.inner.send::<UnionPayload>( |
| payload, |
| 0, |
| 0x71e90a3d364d2e8d, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn send_on_anon(&self, mut payload: &MainProtocolOnAnonRequest) -> Result<(), fidl::Error> { |
| self.inner.send::<MainProtocolOnAnonRequest>( |
| payload, |
| 0, |
| 0xd8fa6d0f5fabb94, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayAnonComposedResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayAnonComposedResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayAnonComposedResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayAnonComposedResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut payload: &ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<ComposedProtocolTwoWayAnonComposedResponse>( |
| payload, |
| self.tx_id, |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayAnonComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayAnonComposedWithErrorResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayAnonComposedWithErrorResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayAnonComposedWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut result: Result<&ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut result: Result<&ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut result: Result<&ComposedProtocolTwoWayAnonComposedWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType< |
| ComposedProtocolTwoWayAnonComposedWithErrorResponse, |
| u32, |
| >>( |
| result, |
| self.tx_id, |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayNamedComposedResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayNamedComposedResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayNamedComposedResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayNamedComposedResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err(self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<TablePayload>( |
| payload, |
| self.tx_id, |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayNamedComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayNamedComposedWithErrorResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayNamedComposedWithErrorResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayNamedComposedWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<&UnionPayload, u32>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut result: Result<&UnionPayload, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<&UnionPayload, u32>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType<UnionPayload, u32>>( |
| result, |
| self.tx_id, |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayLocalResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayLocalResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayLocalResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayLocalResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err(self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut payload: &TablePayload) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<TablePayload>( |
| payload, |
| self.tx_id, |
| 0x26998b4c1e8a9a57, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayLocalWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayLocalWithErrorResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayLocalWithErrorResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayLocalWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<&UnionPayload, u32>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut result: Result<&UnionPayload, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<&UnionPayload, u32>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType<UnionPayload, u32>>( |
| result, |
| self.tx_id, |
| 0x4a7bf9ce881afde7, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayAnonResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayAnonResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayAnonResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayAnonResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut payload: &MainProtocolTwoWayAnonResponse) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut payload: &MainProtocolTwoWayAnonResponse, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut payload: &MainProtocolTwoWayAnonResponse) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<MainProtocolTwoWayAnonResponse>( |
| payload, |
| self.tx_id, |
| 0x3fd7ad8e52b07e2e, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MainProtocolTwoWayAnonWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`]) |
| /// if the responder is dropped without sending a response, so that the client |
| /// doesn't hang. To prevent this behavior, call `drop_without_shutdown`. |
| impl std::ops::Drop for MainProtocolTwoWayAnonWithErrorResponder { |
| fn drop(&mut self) { |
| self.control_handle.shutdown(); |
| // Safety: drops once, never accessed again |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| } |
| } |
| |
| impl fidl::endpoints::Responder for MainProtocolTwoWayAnonWithErrorResponder { |
| type ControlHandle = MainProtocolControlHandle; |
| |
| fn control_handle(&self) -> &MainProtocolControlHandle { |
| &self.control_handle |
| } |
| |
| fn drop_without_shutdown(mut self) { |
| // Safety: drops once, never accessed again due to mem::forget |
| unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) }; |
| // Prevent Drop from running (which would shut down the channel) |
| std::mem::forget(self); |
| } |
| } |
| |
| impl MainProtocolTwoWayAnonWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut result: Result<&MainProtocolTwoWayAnonWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| if _result.is_err() { |
| self.control_handle.shutdown(); |
| } |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| /// Similar to "send" but does not shutdown the channel if an error occurs. |
| pub fn send_no_shutdown_on_err( |
| self, |
| mut result: Result<&MainProtocolTwoWayAnonWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut result: Result<&MainProtocolTwoWayAnonWithErrorResponse, u32>, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType< |
| MainProtocolTwoWayAnonWithErrorResponse, |
| u32, |
| >>( |
| result, |
| self.tx_id, |
| 0x1d33061a424eb245, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| mod internal { |
| use super::*; |
| } |