| // 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, |
| fidl::{ |
| client::QueryResponseFut, |
| endpoints::{ControlHandle as _, Responder as _}, |
| }, |
| fuchsia_zircon_status as zx_status, |
| futures::future::{self, MaybeDone, TryFutureExt}, |
| }; |
| |
| #[cfg(target_os = "fuchsia")] |
| use fuchsia_zircon as zx; |
| |
| #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| #[repr(u32)] |
| pub enum ErrorEnum { |
| ErrFoo = 1, |
| ErrBar = 2, |
| } |
| |
| impl ErrorEnum { |
| #[inline] |
| pub fn from_primitive(prim: u32) -> Option<Self> { |
| match prim { |
| 1 => Some(Self::ErrFoo), |
| 2 => Some(Self::ErrBar), |
| _ => None, |
| } |
| } |
| |
| #[inline] |
| pub const fn into_primitive(self) -> u32 { |
| self as u32 |
| } |
| |
| #[deprecated = "Strict enums should not use `is_unknown`"] |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| false |
| } |
| } |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct ChannelProtocolEventARequest { |
| pub a: i64, |
| pub b: i64, |
| } |
| |
| impl fidl::Persistable for ChannelProtocolEventARequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct ChannelProtocolMethodARequest { |
| pub a: i64, |
| pub b: i64, |
| } |
| |
| impl fidl::Persistable for ChannelProtocolMethodARequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct ChannelProtocolMethodBRequest { |
| pub a: i64, |
| pub b: i64, |
| } |
| |
| impl fidl::Persistable for ChannelProtocolMethodBRequest {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct ChannelProtocolMethodBResponse { |
| pub result: i64, |
| } |
| |
| impl fidl::Persistable for ChannelProtocolMethodBResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ChannelProtocolMutateSocketRequest { |
| pub a: fidl::Socket, |
| } |
| |
| impl fidl::Standalone for ChannelProtocolMutateSocketRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ChannelProtocolMutateSocketResponse { |
| pub b: fidl::Socket, |
| } |
| |
| impl fidl::Standalone for ChannelProtocolMutateSocketResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ChannelProtocolTakeHandleRequest { |
| pub h: fidl::Handle, |
| } |
| |
| impl fidl::Standalone for ChannelProtocolTakeHandleRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct HandleRightsProtocolAnEventRequest { |
| pub h: fidl::Socket, |
| } |
| |
| impl fidl::Standalone for HandleRightsProtocolAnEventRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct HandleRightsProtocolNoResponseMethodRequest { |
| pub h: fidl::Socket, |
| } |
| |
| impl fidl::Standalone for HandleRightsProtocolNoResponseMethodRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct HandleRightsProtocolResponseMethodRequest { |
| pub h: fidl::Socket, |
| } |
| |
| impl fidl::Standalone for HandleRightsProtocolResponseMethodRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct HandleRightsProtocolResponseMethodResponse { |
| pub h: fidl::Socket, |
| } |
| |
| impl fidl::Standalone for HandleRightsProtocolResponseMethodResponse {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ManyParametersFifteenRequest { |
| pub p1: bool, |
| pub p2: bool, |
| pub p3: bool, |
| pub p4: bool, |
| pub p5: bool, |
| pub p6: bool, |
| pub p7: bool, |
| pub p8: bool, |
| pub p9: bool, |
| pub p10: bool, |
| pub p11: bool, |
| pub p12: bool, |
| pub p13: bool, |
| pub p14: bool, |
| pub p15: bool, |
| } |
| |
| impl fidl::Persistable for ManyParametersFifteenRequest {} |
| |
| #[derive(Clone, Debug, PartialEq)] |
| pub struct MethodWithUnionUnionMethodRequest { |
| pub u: TheUnion, |
| } |
| |
| impl fidl::Persistable for MethodWithUnionUnionMethodRequest {} |
| |
| #[derive(Clone, Debug, PartialEq)] |
| pub struct MethodWithUnionUnionMethodResponse { |
| pub u: Option<Box<TheUnion>>, |
| } |
| |
| impl fidl::Persistable for MethodWithUnionUnionMethodResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ProtocolEnds { |
| pub client: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| pub server: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| pub client_opt: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| pub server_opt: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| } |
| |
| impl fidl::Standalone for ProtocolEnds {} |
| |
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithAndWithoutRequestResponseNoRequestWithResponseResponse { |
| pub ret: String, |
| } |
| |
| impl fidl::Persistable for WithAndWithoutRequestResponseNoRequestWithResponseResponse {} |
| |
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithAndWithoutRequestResponseOnWithResponseRequest { |
| pub ret: String, |
| } |
| |
| impl fidl::Persistable for WithAndWithoutRequestResponseOnWithResponseRequest {} |
| |
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithAndWithoutRequestResponseWithRequestEmptyResponseRequest { |
| pub arg: String, |
| } |
| |
| impl fidl::Persistable for WithAndWithoutRequestResponseWithRequestEmptyResponseRequest {} |
| |
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithAndWithoutRequestResponseWithRequestNoResponseRequest { |
| pub arg: String, |
| } |
| |
| impl fidl::Persistable for WithAndWithoutRequestResponseWithRequestNoResponseRequest {} |
| |
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithAndWithoutRequestResponseWithRequestWithResponseRequest { |
| pub arg: String, |
| } |
| |
| impl fidl::Persistable for WithAndWithoutRequestResponseWithRequestWithResponseRequest {} |
| |
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithAndWithoutRequestResponseWithRequestWithResponseResponse { |
| pub ret: String, |
| } |
| |
| impl fidl::Persistable for WithAndWithoutRequestResponseWithRequestWithResponseResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithErrorSyntaxHandleInResultResponse { |
| pub h: fidl::Handle, |
| } |
| |
| impl fidl::Standalone for WithErrorSyntaxHandleInResultResponse {} |
| |
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| #[repr(C)] |
| pub struct WithErrorSyntaxResponseAsStructResponse { |
| pub a: i64, |
| pub b: i64, |
| pub c: i64, |
| } |
| |
| impl fidl::Persistable for WithErrorSyntaxResponseAsStructResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithProtocolEndsClientEndsRequest { |
| pub in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| } |
| |
| impl fidl::Standalone for WithProtocolEndsClientEndsRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithProtocolEndsClientEndsResponse { |
| pub out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| } |
| |
| impl fidl::Standalone for WithProtocolEndsClientEndsResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithProtocolEndsServerEndsRequest { |
| pub in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| } |
| |
| impl fidl::Standalone for WithProtocolEndsServerEndsRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithProtocolEndsServerEndsResponse { |
| pub out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| } |
| |
| impl fidl::Standalone for WithProtocolEndsServerEndsResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithProtocolEndsStructContainingEndsRequest { |
| pub in_: ProtocolEnds, |
| } |
| |
| impl fidl::Standalone for WithProtocolEndsStructContainingEndsRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct WithProtocolEndsStructContainingEndsResponse { |
| pub out: ProtocolEnds, |
| } |
| |
| impl fidl::Standalone for WithProtocolEndsStructContainingEndsResponse {} |
| |
| #[derive(Clone, Debug)] |
| pub enum TheUnion { |
| V(u32), |
| #[doc(hidden)] |
| __SourceBreaking { |
| unknown_ordinal: u64, |
| }, |
| } |
| |
| /// Pattern that matches an unknown `TheUnion` member. |
| #[macro_export] |
| macro_rules! TheUnionUnknown { |
| () => { |
| _ |
| }; |
| } |
| |
| // Custom PartialEq so that unknown variants are not equal to themselves. |
| impl PartialEq for TheUnion { |
| fn eq(&self, other: &Self) -> bool { |
| match (self, other) { |
| (Self::V(x), Self::V(y)) => *x == *y, |
| _ => false, |
| } |
| } |
| } |
| |
| impl TheUnion { |
| #[inline] |
| pub fn ordinal(&self) -> u64 { |
| match *self { |
| Self::V(_) => 1, |
| Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal, |
| } |
| } |
| |
| #[inline] |
| pub fn unknown_variant_for_testing() -> Self { |
| Self::__SourceBreaking { unknown_ordinal: 0 } |
| } |
| |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| match self { |
| Self::__SourceBreaking { .. } => true, |
| _ => false, |
| } |
| } |
| } |
| |
| impl fidl::Persistable for TheUnion {} |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct AnotherDiscoverableProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for AnotherDiscoverableProtocolMarker { |
| type Proxy = AnotherDiscoverableProtocolProxy; |
| type RequestStream = AnotherDiscoverableProtocolRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = AnotherDiscoverableProtocolSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "fake.library.FakeProtocol"; |
| } |
| impl fidl::endpoints::DiscoverableProtocolMarker for AnotherDiscoverableProtocolMarker {} |
| |
| pub trait AnotherDiscoverableProtocolProxyInterface: Send + Sync {} |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct AnotherDiscoverableProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for AnotherDiscoverableProtocolSynchronousProxy { |
| type Proxy = AnotherDiscoverableProtocolProxy; |
| type Protocol = AnotherDiscoverableProtocolMarker; |
| |
| 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 AnotherDiscoverableProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = |
| <AnotherDiscoverableProtocolMarker 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::Time, |
| ) -> Result<AnotherDiscoverableProtocolEvent, fidl::Error> { |
| AnotherDiscoverableProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct AnotherDiscoverableProtocolProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for AnotherDiscoverableProtocolProxy { |
| type Protocol = AnotherDiscoverableProtocolMarker; |
| |
| 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 AnotherDiscoverableProtocolProxy { |
| /// Create a new Proxy for test.protocols/AnotherDiscoverableProtocol. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = |
| <AnotherDiscoverableProtocolMarker 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) -> AnotherDiscoverableProtocolEventStream { |
| AnotherDiscoverableProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| } |
| |
| impl AnotherDiscoverableProtocolProxyInterface for AnotherDiscoverableProtocolProxy {} |
| |
| pub struct AnotherDiscoverableProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for AnotherDiscoverableProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for AnotherDiscoverableProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for AnotherDiscoverableProtocolEventStream { |
| type Item = Result<AnotherDiscoverableProtocolEvent, 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(AnotherDiscoverableProtocolEvent::decode(buf))) |
| } |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum AnotherDiscoverableProtocolEvent {} |
| |
| impl AnotherDiscoverableProtocolEvent { |
| /// Decodes a message buffer as a [`AnotherDiscoverableProtocolEvent`]. |
| fn decode( |
| mut buf: fidl::MessageBufEtc, |
| ) -> Result<AnotherDiscoverableProtocolEvent, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: <AnotherDiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }) |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/AnotherDiscoverableProtocol. |
| pub struct AnotherDiscoverableProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for AnotherDiscoverableProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for AnotherDiscoverableProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for AnotherDiscoverableProtocolRequestStream { |
| type Protocol = AnotherDiscoverableProtocolMarker; |
| type ControlHandle = AnotherDiscoverableProtocolControlHandle; |
| |
| 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 { |
| AnotherDiscoverableProtocolControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for AnotherDiscoverableProtocolRequestStream { |
| type Item = Result<AnotherDiscoverableProtocolRequest, 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 AnotherDiscoverableProtocolRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: <AnotherDiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum AnotherDiscoverableProtocolRequest {} |
| |
| impl AnotherDiscoverableProtocolRequest { |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self {} |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct AnotherDiscoverableProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for AnotherDiscoverableProtocolControlHandle { |
| 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() |
| } |
| } |
| |
| impl AnotherDiscoverableProtocolControlHandle {} |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct ChannelProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for ChannelProtocolMarker { |
| type Proxy = ChannelProtocolProxy; |
| type RequestStream = ChannelProtocolRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = ChannelProtocolSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) ChannelProtocol"; |
| } |
| |
| pub trait ChannelProtocolProxyInterface: Send + Sync { |
| fn r#method_a(&self, a: i64, b: i64) -> Result<(), fidl::Error>; |
| type MethodBResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send; |
| fn r#method_b(&self, a: i64, b: i64) -> Self::MethodBResponseFut; |
| type TakeHandleResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send; |
| fn r#take_handle(&self, h: fidl::Handle) -> Self::TakeHandleResponseFut; |
| type MutateSocketResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>> |
| + Send; |
| fn r#mutate_socket(&self, a: fidl::Socket) -> Self::MutateSocketResponseFut; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct ChannelProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for ChannelProtocolSynchronousProxy { |
| type Proxy = ChannelProtocolProxy; |
| type Protocol = ChannelProtocolMarker; |
| |
| 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 ChannelProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <ChannelProtocolMarker 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::Time) -> Result<ChannelProtocolEvent, fidl::Error> { |
| ChannelProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#method_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> { |
| self.client.send::<ChannelProtocolMethodARequest>( |
| (a, b), |
| 0x2bc8d7d32bc66ba2, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#method_b( |
| &self, |
| mut a: i64, |
| mut b: i64, |
| ___deadline: zx::Time, |
| ) -> Result<i64, fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<ChannelProtocolMethodBRequest, ChannelProtocolMethodBResponse>( |
| (a, b), |
| 0x7b8dd3d6c741c9c6, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.result) |
| } |
| |
| pub fn r#take_handle( |
| &self, |
| mut h: fidl::Handle, |
| ___deadline: zx::Time, |
| ) -> Result<(), fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<ChannelProtocolTakeHandleRequest, fidl::encoding::EmptyPayload>( |
| (h,), |
| 0x836fa31201a0a65, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#mutate_socket( |
| &self, |
| mut a: fidl::Socket, |
| ___deadline: zx::Time, |
| ) -> Result<fidl::Socket, fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<ChannelProtocolMutateSocketRequest, ChannelProtocolMutateSocketResponse>( |
| (a,), |
| 0x66dbcccc06f7f14f, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.b) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ChannelProtocolProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for ChannelProtocolProxy { |
| type Protocol = ChannelProtocolMarker; |
| |
| 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 ChannelProtocolProxy { |
| /// Create a new Proxy for test.protocols/ChannelProtocol. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <ChannelProtocolMarker 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) -> ChannelProtocolEventStream { |
| ChannelProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#method_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> { |
| ChannelProtocolProxyInterface::r#method_a(self, a, b) |
| } |
| |
| pub fn r#method_b(&self, mut a: i64, mut b: i64) -> fidl::client::QueryResponseFut<i64> { |
| ChannelProtocolProxyInterface::r#method_b(self, a, b) |
| } |
| |
| pub fn r#take_handle(&self, mut h: fidl::Handle) -> fidl::client::QueryResponseFut<()> { |
| ChannelProtocolProxyInterface::r#take_handle(self, h) |
| } |
| |
| pub fn r#mutate_socket( |
| &self, |
| mut a: fidl::Socket, |
| ) -> fidl::client::QueryResponseFut<fidl::Socket> { |
| ChannelProtocolProxyInterface::r#mutate_socket(self, a) |
| } |
| } |
| |
| impl ChannelProtocolProxyInterface for ChannelProtocolProxy { |
| fn r#method_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> { |
| self.client.send::<ChannelProtocolMethodARequest>( |
| (a, b), |
| 0x2bc8d7d32bc66ba2, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type MethodBResponseFut = fidl::client::QueryResponseFut<i64>; |
| fn r#method_b(&self, mut a: i64, mut b: i64) -> Self::MethodBResponseFut { |
| fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i64, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| ChannelProtocolMethodBResponse, |
| 0x7b8dd3d6c741c9c6, |
| >(_buf?)?; |
| Ok(_response.result) |
| } |
| self.client.send_query_and_decode::<ChannelProtocolMethodBRequest, i64>( |
| (a, b), |
| 0x7b8dd3d6c741c9c6, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type TakeHandleResponseFut = fidl::client::QueryResponseFut<()>; |
| fn r#take_handle(&self, mut h: fidl::Handle) -> Self::TakeHandleResponseFut { |
| fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::EmptyPayload, |
| 0x836fa31201a0a65, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::<ChannelProtocolTakeHandleRequest, ()>( |
| (h,), |
| 0x836fa31201a0a65, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type MutateSocketResponseFut = fidl::client::QueryResponseFut<fidl::Socket>; |
| fn r#mutate_socket(&self, mut a: fidl::Socket) -> Self::MutateSocketResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<fidl::Socket, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| ChannelProtocolMutateSocketResponse, |
| 0x66dbcccc06f7f14f, |
| >(_buf?)?; |
| Ok(_response.b) |
| } |
| self.client.send_query_and_decode::<ChannelProtocolMutateSocketRequest, fidl::Socket>( |
| (a,), |
| 0x66dbcccc06f7f14f, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct ChannelProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for ChannelProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for ChannelProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for ChannelProtocolEventStream { |
| type Item = Result<ChannelProtocolEvent, 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(ChannelProtocolEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ChannelProtocolEvent { |
| EventA { a: i64, b: i64 }, |
| } |
| |
| impl ChannelProtocolEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_event_a(self) -> Option<(i64, i64)> { |
| if let ChannelProtocolEvent::EventA { a, b } = self { |
| Some((a, b)) |
| } else { |
| None |
| } |
| } |
| |
| /// Decodes a message buffer as a [`ChannelProtocolEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<ChannelProtocolEvent, 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 { |
| 0x1ed0a220297145ce => { |
| let mut out = fidl::new_empty!(ChannelProtocolEventARequest); |
| fidl::encoding::Decoder::decode_into::<ChannelProtocolEventARequest>( |
| &tx_header, |
| _body_bytes, |
| _handles, |
| &mut out, |
| )?; |
| Ok((ChannelProtocolEvent::EventA { a: out.a, b: out.b })) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <ChannelProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/ChannelProtocol. |
| pub struct ChannelProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for ChannelProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for ChannelProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for ChannelProtocolRequestStream { |
| type Protocol = ChannelProtocolMarker; |
| type ControlHandle = ChannelProtocolControlHandle; |
| |
| 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 { |
| ChannelProtocolControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for ChannelProtocolRequestStream { |
| type Item = Result<ChannelProtocolRequest, 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 ChannelProtocolRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x2bc8d7d32bc66ba2 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!(ChannelProtocolMethodARequest); |
| fidl::encoding::Decoder::decode_into::<ChannelProtocolMethodARequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = ChannelProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ChannelProtocolRequest::MethodA { a: req.a, b: req.b, control_handle }) |
| } |
| 0x7b8dd3d6c741c9c6 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(ChannelProtocolMethodBRequest); |
| fidl::encoding::Decoder::decode_into::<ChannelProtocolMethodBRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = ChannelProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ChannelProtocolRequest::MethodB { |
| a: req.a, |
| b: req.b, |
| |
| responder: ChannelProtocolMethodBResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x836fa31201a0a65 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(ChannelProtocolTakeHandleRequest); |
| fidl::encoding::Decoder::decode_into::<ChannelProtocolTakeHandleRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = ChannelProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ChannelProtocolRequest::TakeHandle { |
| h: req.h, |
| |
| responder: ChannelProtocolTakeHandleResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x66dbcccc06f7f14f => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(ChannelProtocolMutateSocketRequest); |
| fidl::encoding::Decoder::decode_into::<ChannelProtocolMutateSocketRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = ChannelProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(ChannelProtocolRequest::MutateSocket { |
| a: req.a, |
| |
| responder: ChannelProtocolMutateSocketResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <ChannelProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ChannelProtocolRequest { |
| MethodA { a: i64, b: i64, control_handle: ChannelProtocolControlHandle }, |
| MethodB { a: i64, b: i64, responder: ChannelProtocolMethodBResponder }, |
| TakeHandle { h: fidl::Handle, responder: ChannelProtocolTakeHandleResponder }, |
| MutateSocket { a: fidl::Socket, responder: ChannelProtocolMutateSocketResponder }, |
| } |
| |
| impl ChannelProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_method_a(self) -> Option<(i64, i64, ChannelProtocolControlHandle)> { |
| if let ChannelProtocolRequest::MethodA { a, b, control_handle } = self { |
| Some((a, b, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_method_b(self) -> Option<(i64, i64, ChannelProtocolMethodBResponder)> { |
| if let ChannelProtocolRequest::MethodB { a, b, responder } = self { |
| Some((a, b, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_take_handle(self) -> Option<(fidl::Handle, ChannelProtocolTakeHandleResponder)> { |
| if let ChannelProtocolRequest::TakeHandle { h, responder } = self { |
| Some((h, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_mutate_socket( |
| self, |
| ) -> Option<(fidl::Socket, ChannelProtocolMutateSocketResponder)> { |
| if let ChannelProtocolRequest::MutateSocket { a, responder } = self { |
| Some((a, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| ChannelProtocolRequest::MethodA { .. } => "method_a", |
| ChannelProtocolRequest::MethodB { .. } => "method_b", |
| ChannelProtocolRequest::TakeHandle { .. } => "take_handle", |
| ChannelProtocolRequest::MutateSocket { .. } => "mutate_socket", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ChannelProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for ChannelProtocolControlHandle { |
| 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() |
| } |
| } |
| |
| impl ChannelProtocolControlHandle { |
| pub fn send_event_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> { |
| self.inner.send::<ChannelProtocolEventARequest>( |
| (a, b), |
| 0, |
| 0x1ed0a220297145ce, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ChannelProtocolMethodBResponder { |
| control_handle: std::mem::ManuallyDrop<ChannelProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ChannelProtocolControlHandle::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 ChannelProtocolMethodBResponder { |
| 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 ChannelProtocolMethodBResponder { |
| type ControlHandle = ChannelProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ChannelProtocolControlHandle { |
| &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 ChannelProtocolMethodBResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: i64) -> 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: i64) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: i64) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<ChannelProtocolMethodBResponse>( |
| (result,), |
| self.tx_id, |
| 0x7b8dd3d6c741c9c6, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ChannelProtocolTakeHandleResponder { |
| control_handle: std::mem::ManuallyDrop<ChannelProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ChannelProtocolControlHandle::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 ChannelProtocolTakeHandleResponder { |
| 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 ChannelProtocolTakeHandleResponder { |
| type ControlHandle = ChannelProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ChannelProtocolControlHandle { |
| &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 ChannelProtocolTakeHandleResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(); |
| 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) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::EmptyPayload>( |
| (), |
| self.tx_id, |
| 0x836fa31201a0a65, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ChannelProtocolMutateSocketResponder { |
| control_handle: std::mem::ManuallyDrop<ChannelProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ChannelProtocolControlHandle::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 ChannelProtocolMutateSocketResponder { |
| 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 ChannelProtocolMutateSocketResponder { |
| type ControlHandle = ChannelProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ChannelProtocolControlHandle { |
| &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 ChannelProtocolMutateSocketResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut b: fidl::Socket) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(b); |
| 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 b: fidl::Socket) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(b); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut b: fidl::Socket) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<ChannelProtocolMutateSocketResponse>( |
| (b,), |
| self.tx_id, |
| 0x66dbcccc06f7f14f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct DiscoverableProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for DiscoverableProtocolMarker { |
| type Proxy = DiscoverableProtocolProxy; |
| type RequestStream = DiscoverableProtocolRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = DiscoverableProtocolSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "test.protocols.DiscoverableProtocol"; |
| } |
| impl fidl::endpoints::DiscoverableProtocolMarker for DiscoverableProtocolMarker {} |
| |
| pub trait DiscoverableProtocolProxyInterface: Send + Sync { |
| fn r#method(&self) -> Result<(), fidl::Error>; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct DiscoverableProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for DiscoverableProtocolSynchronousProxy { |
| type Proxy = DiscoverableProtocolProxy; |
| type Protocol = DiscoverableProtocolMarker; |
| |
| 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 DiscoverableProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = |
| <DiscoverableProtocolMarker 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::Time, |
| ) -> Result<DiscoverableProtocolEvent, fidl::Error> { |
| DiscoverableProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#method(&self) -> Result<(), fidl::Error> { |
| self.client.send::<fidl::encoding::EmptyPayload>( |
| (), |
| 0x2ff5ba3a2bd170eb, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct DiscoverableProtocolProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for DiscoverableProtocolProxy { |
| type Protocol = DiscoverableProtocolMarker; |
| |
| 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 DiscoverableProtocolProxy { |
| /// Create a new Proxy for test.protocols/DiscoverableProtocol. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = |
| <DiscoverableProtocolMarker 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) -> DiscoverableProtocolEventStream { |
| DiscoverableProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#method(&self) -> Result<(), fidl::Error> { |
| DiscoverableProtocolProxyInterface::r#method(self) |
| } |
| } |
| |
| impl DiscoverableProtocolProxyInterface for DiscoverableProtocolProxy { |
| fn r#method(&self) -> Result<(), fidl::Error> { |
| self.client.send::<fidl::encoding::EmptyPayload>( |
| (), |
| 0x2ff5ba3a2bd170eb, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| pub struct DiscoverableProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for DiscoverableProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for DiscoverableProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for DiscoverableProtocolEventStream { |
| type Item = Result<DiscoverableProtocolEvent, 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(DiscoverableProtocolEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum DiscoverableProtocolEvent {} |
| |
| impl DiscoverableProtocolEvent { |
| /// Decodes a message buffer as a [`DiscoverableProtocolEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<DiscoverableProtocolEvent, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <DiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/DiscoverableProtocol. |
| pub struct DiscoverableProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for DiscoverableProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for DiscoverableProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for DiscoverableProtocolRequestStream { |
| type Protocol = DiscoverableProtocolMarker; |
| type ControlHandle = DiscoverableProtocolControlHandle; |
| |
| 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 { |
| DiscoverableProtocolControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for DiscoverableProtocolRequestStream { |
| type Item = Result<DiscoverableProtocolRequest, 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 DiscoverableProtocolRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x2ff5ba3a2bd170eb => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = |
| DiscoverableProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(DiscoverableProtocolRequest::Method { control_handle }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <DiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum DiscoverableProtocolRequest { |
| Method { control_handle: DiscoverableProtocolControlHandle }, |
| } |
| |
| impl DiscoverableProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_method(self) -> Option<(DiscoverableProtocolControlHandle)> { |
| if let DiscoverableProtocolRequest::Method { control_handle } = self { |
| Some((control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| DiscoverableProtocolRequest::Method { .. } => "method", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct DiscoverableProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for DiscoverableProtocolControlHandle { |
| 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() |
| } |
| } |
| |
| impl DiscoverableProtocolControlHandle {} |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct HandleRightsProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for HandleRightsProtocolMarker { |
| type Proxy = HandleRightsProtocolProxy; |
| type RequestStream = HandleRightsProtocolRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = HandleRightsProtocolSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) HandleRightsProtocol"; |
| } |
| |
| pub trait HandleRightsProtocolProxyInterface: Send + Sync { |
| fn r#no_response_method(&self, h: fidl::Socket) -> Result<(), fidl::Error>; |
| type ResponseMethodResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>> |
| + Send; |
| fn r#response_method(&self, h: fidl::Socket) -> Self::ResponseMethodResponseFut; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct HandleRightsProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for HandleRightsProtocolSynchronousProxy { |
| type Proxy = HandleRightsProtocolProxy; |
| type Protocol = HandleRightsProtocolMarker; |
| |
| 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 HandleRightsProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = |
| <HandleRightsProtocolMarker 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::Time, |
| ) -> Result<HandleRightsProtocolEvent, fidl::Error> { |
| HandleRightsProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#no_response_method(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> { |
| self.client.send::<HandleRightsProtocolNoResponseMethodRequest>( |
| (h,), |
| 0x10078afd320d2bfd, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#response_method( |
| &self, |
| mut h: fidl::Socket, |
| ___deadline: zx::Time, |
| ) -> Result<fidl::Socket, fidl::Error> { |
| let _response = self.client.send_query::< |
| HandleRightsProtocolResponseMethodRequest, |
| HandleRightsProtocolResponseMethodResponse, |
| >( |
| (h,), |
| 0x52a8f194ac143547, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.h) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct HandleRightsProtocolProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for HandleRightsProtocolProxy { |
| type Protocol = HandleRightsProtocolMarker; |
| |
| 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 HandleRightsProtocolProxy { |
| /// Create a new Proxy for test.protocols/HandleRightsProtocol. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = |
| <HandleRightsProtocolMarker 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) -> HandleRightsProtocolEventStream { |
| HandleRightsProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#no_response_method(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> { |
| HandleRightsProtocolProxyInterface::r#no_response_method(self, h) |
| } |
| |
| pub fn r#response_method( |
| &self, |
| mut h: fidl::Socket, |
| ) -> fidl::client::QueryResponseFut<fidl::Socket> { |
| HandleRightsProtocolProxyInterface::r#response_method(self, h) |
| } |
| } |
| |
| impl HandleRightsProtocolProxyInterface for HandleRightsProtocolProxy { |
| fn r#no_response_method(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> { |
| self.client.send::<HandleRightsProtocolNoResponseMethodRequest>( |
| (h,), |
| 0x10078afd320d2bfd, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type ResponseMethodResponseFut = fidl::client::QueryResponseFut<fidl::Socket>; |
| fn r#response_method(&self, mut h: fidl::Socket) -> Self::ResponseMethodResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<fidl::Socket, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| HandleRightsProtocolResponseMethodResponse, |
| 0x52a8f194ac143547, |
| >(_buf?)?; |
| Ok(_response.h) |
| } |
| self.client |
| .send_query_and_decode::<HandleRightsProtocolResponseMethodRequest, fidl::Socket>( |
| (h,), |
| 0x52a8f194ac143547, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct HandleRightsProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for HandleRightsProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for HandleRightsProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for HandleRightsProtocolEventStream { |
| type Item = Result<HandleRightsProtocolEvent, 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(HandleRightsProtocolEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum HandleRightsProtocolEvent { |
| AnEvent { h: fidl::Socket }, |
| } |
| |
| impl HandleRightsProtocolEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_an_event(self) -> Option<fidl::Socket> { |
| if let HandleRightsProtocolEvent::AnEvent { h } = self { |
| Some((h)) |
| } else { |
| None |
| } |
| } |
| |
| /// Decodes a message buffer as a [`HandleRightsProtocolEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<HandleRightsProtocolEvent, 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 { |
| 0x69dad41418eb133 => { |
| let mut out = fidl::new_empty!(HandleRightsProtocolAnEventRequest); |
| fidl::encoding::Decoder::decode_into::<HandleRightsProtocolAnEventRequest>( |
| &tx_header, |
| _body_bytes, |
| _handles, |
| &mut out, |
| )?; |
| Ok((HandleRightsProtocolEvent::AnEvent { h: out.h })) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <HandleRightsProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/HandleRightsProtocol. |
| pub struct HandleRightsProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for HandleRightsProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for HandleRightsProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for HandleRightsProtocolRequestStream { |
| type Protocol = HandleRightsProtocolMarker; |
| type ControlHandle = HandleRightsProtocolControlHandle; |
| |
| 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 { |
| HandleRightsProtocolControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for HandleRightsProtocolRequestStream { |
| type Item = Result<HandleRightsProtocolRequest, 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 HandleRightsProtocolRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x10078afd320d2bfd => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!(HandleRightsProtocolNoResponseMethodRequest); |
| fidl::encoding::Decoder::decode_into::< |
| HandleRightsProtocolNoResponseMethodRequest, |
| >(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| HandleRightsProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(HandleRightsProtocolRequest::NoResponseMethod { h: req.h, control_handle }) |
| } |
| 0x52a8f194ac143547 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(HandleRightsProtocolResponseMethodRequest); |
| fidl::encoding::Decoder::decode_into::< |
| HandleRightsProtocolResponseMethodRequest, |
| >(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| HandleRightsProtocolControlHandle { inner: this.inner.clone() }; |
| Ok(HandleRightsProtocolRequest::ResponseMethod { |
| h: req.h, |
| |
| responder: HandleRightsProtocolResponseMethodResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <HandleRightsProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum HandleRightsProtocolRequest { |
| NoResponseMethod { h: fidl::Socket, control_handle: HandleRightsProtocolControlHandle }, |
| ResponseMethod { h: fidl::Socket, responder: HandleRightsProtocolResponseMethodResponder }, |
| } |
| |
| impl HandleRightsProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_no_response_method( |
| self, |
| ) -> Option<(fidl::Socket, HandleRightsProtocolControlHandle)> { |
| if let HandleRightsProtocolRequest::NoResponseMethod { h, control_handle } = self { |
| Some((h, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_response_method( |
| self, |
| ) -> Option<(fidl::Socket, HandleRightsProtocolResponseMethodResponder)> { |
| if let HandleRightsProtocolRequest::ResponseMethod { h, responder } = self { |
| Some((h, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| HandleRightsProtocolRequest::NoResponseMethod { .. } => "no_response_method", |
| HandleRightsProtocolRequest::ResponseMethod { .. } => "response_method", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct HandleRightsProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for HandleRightsProtocolControlHandle { |
| 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() |
| } |
| } |
| |
| impl HandleRightsProtocolControlHandle { |
| pub fn send_an_event(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> { |
| self.inner.send::<HandleRightsProtocolAnEventRequest>( |
| (h,), |
| 0, |
| 0x69dad41418eb133, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct HandleRightsProtocolResponseMethodResponder { |
| control_handle: std::mem::ManuallyDrop<HandleRightsProtocolControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`HandleRightsProtocolControlHandle::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 HandleRightsProtocolResponseMethodResponder { |
| 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 HandleRightsProtocolResponseMethodResponder { |
| type ControlHandle = HandleRightsProtocolControlHandle; |
| |
| fn control_handle(&self) -> &HandleRightsProtocolControlHandle { |
| &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 HandleRightsProtocolResponseMethodResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut h: fidl::Socket) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(h); |
| 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 h: fidl::Socket) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(h); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<HandleRightsProtocolResponseMethodResponse>( |
| (h,), |
| self.tx_id, |
| 0x52a8f194ac143547, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct ManyParametersMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for ManyParametersMarker { |
| type Proxy = ManyParametersProxy; |
| type RequestStream = ManyParametersRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = ManyParametersSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) ManyParameters"; |
| } |
| |
| pub trait ManyParametersProxyInterface: Send + Sync { |
| fn r#fifteen( |
| &self, |
| p1: bool, |
| p2: bool, |
| p3: bool, |
| p4: bool, |
| p5: bool, |
| p6: bool, |
| p7: bool, |
| p8: bool, |
| p9: bool, |
| p10: bool, |
| p11: bool, |
| p12: bool, |
| p13: bool, |
| p14: bool, |
| p15: bool, |
| ) -> Result<(), fidl::Error>; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct ManyParametersSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for ManyParametersSynchronousProxy { |
| type Proxy = ManyParametersProxy; |
| type Protocol = ManyParametersMarker; |
| |
| 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 ManyParametersSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <ManyParametersMarker 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::Time) -> Result<ManyParametersEvent, fidl::Error> { |
| ManyParametersEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#fifteen( |
| &self, |
| mut p1: bool, |
| mut p2: bool, |
| mut p3: bool, |
| mut p4: bool, |
| mut p5: bool, |
| mut p6: bool, |
| mut p7: bool, |
| mut p8: bool, |
| mut p9: bool, |
| mut p10: bool, |
| mut p11: bool, |
| mut p12: bool, |
| mut p13: bool, |
| mut p14: bool, |
| mut p15: bool, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ManyParametersFifteenRequest>( |
| (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15), |
| 0x59233bcecd338967, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ManyParametersProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for ManyParametersProxy { |
| type Protocol = ManyParametersMarker; |
| |
| 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 ManyParametersProxy { |
| /// Create a new Proxy for test.protocols/ManyParameters. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <ManyParametersMarker 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) -> ManyParametersEventStream { |
| ManyParametersEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#fifteen( |
| &self, |
| mut p1: bool, |
| mut p2: bool, |
| mut p3: bool, |
| mut p4: bool, |
| mut p5: bool, |
| mut p6: bool, |
| mut p7: bool, |
| mut p8: bool, |
| mut p9: bool, |
| mut p10: bool, |
| mut p11: bool, |
| mut p12: bool, |
| mut p13: bool, |
| mut p14: bool, |
| mut p15: bool, |
| ) -> Result<(), fidl::Error> { |
| ManyParametersProxyInterface::r#fifteen( |
| self, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, |
| ) |
| } |
| } |
| |
| impl ManyParametersProxyInterface for ManyParametersProxy { |
| fn r#fifteen( |
| &self, |
| mut p1: bool, |
| mut p2: bool, |
| mut p3: bool, |
| mut p4: bool, |
| mut p5: bool, |
| mut p6: bool, |
| mut p7: bool, |
| mut p8: bool, |
| mut p9: bool, |
| mut p10: bool, |
| mut p11: bool, |
| mut p12: bool, |
| mut p13: bool, |
| mut p14: bool, |
| mut p15: bool, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ManyParametersFifteenRequest>( |
| (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15), |
| 0x59233bcecd338967, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| pub struct ManyParametersEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for ManyParametersEventStream {} |
| |
| impl futures::stream::FusedStream for ManyParametersEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for ManyParametersEventStream { |
| type Item = Result<ManyParametersEvent, 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(ManyParametersEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ManyParametersEvent {} |
| |
| impl ManyParametersEvent { |
| /// Decodes a message buffer as a [`ManyParametersEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<ManyParametersEvent, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <ManyParametersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/ManyParameters. |
| pub struct ManyParametersRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for ManyParametersRequestStream {} |
| |
| impl futures::stream::FusedStream for ManyParametersRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for ManyParametersRequestStream { |
| type Protocol = ManyParametersMarker; |
| type ControlHandle = ManyParametersControlHandle; |
| |
| 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 { |
| ManyParametersControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for ManyParametersRequestStream { |
| type Item = Result<ManyParametersRequest, 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 ManyParametersRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x59233bcecd338967 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!(ManyParametersFifteenRequest); |
| fidl::encoding::Decoder::decode_into::<ManyParametersFifteenRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = ManyParametersControlHandle { inner: this.inner.clone() }; |
| Ok(ManyParametersRequest::Fifteen { |
| p1: req.p1, |
| p2: req.p2, |
| p3: req.p3, |
| p4: req.p4, |
| p5: req.p5, |
| p6: req.p6, |
| p7: req.p7, |
| p8: req.p8, |
| p9: req.p9, |
| p10: req.p10, |
| p11: req.p11, |
| p12: req.p12, |
| p13: req.p13, |
| p14: req.p14, |
| p15: req.p15, |
| |
| control_handle, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <ManyParametersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ManyParametersRequest { |
| Fifteen { |
| p1: bool, |
| p2: bool, |
| p3: bool, |
| p4: bool, |
| p5: bool, |
| p6: bool, |
| p7: bool, |
| p8: bool, |
| p9: bool, |
| p10: bool, |
| p11: bool, |
| p12: bool, |
| p13: bool, |
| p14: bool, |
| p15: bool, |
| control_handle: ManyParametersControlHandle, |
| }, |
| } |
| |
| impl ManyParametersRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_fifteen( |
| self, |
| ) -> Option<( |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| bool, |
| ManyParametersControlHandle, |
| )> { |
| if let ManyParametersRequest::Fifteen { |
| p1, |
| p2, |
| p3, |
| p4, |
| p5, |
| p6, |
| p7, |
| p8, |
| p9, |
| p10, |
| p11, |
| p12, |
| p13, |
| p14, |
| p15, |
| control_handle, |
| } = self |
| { |
| Some((p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| ManyParametersRequest::Fifteen { .. } => "fifteen", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ManyParametersControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for ManyParametersControlHandle { |
| 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() |
| } |
| } |
| |
| impl ManyParametersControlHandle {} |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct MethodWithUnionMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for MethodWithUnionMarker { |
| type Proxy = MethodWithUnionProxy; |
| type RequestStream = MethodWithUnionRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = MethodWithUnionSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) MethodWithUnion"; |
| } |
| |
| pub trait MethodWithUnionProxyInterface: Send + Sync { |
| type UnionMethodResponseFut: std::future::Future<Output = Result<Option<Box<TheUnion>>, fidl::Error>> |
| + Send; |
| fn r#union_method(&self, u: &TheUnion) -> Self::UnionMethodResponseFut; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct MethodWithUnionSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for MethodWithUnionSynchronousProxy { |
| type Proxy = MethodWithUnionProxy; |
| type Protocol = MethodWithUnionMarker; |
| |
| 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 MethodWithUnionSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <MethodWithUnionMarker 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::Time) -> Result<MethodWithUnionEvent, fidl::Error> { |
| MethodWithUnionEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#union_method( |
| &self, |
| mut u: &TheUnion, |
| ___deadline: zx::Time, |
| ) -> Result<Option<Box<TheUnion>>, fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<MethodWithUnionUnionMethodRequest, MethodWithUnionUnionMethodResponse>( |
| (u,), |
| 0x393e7f5b2b821218, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.u) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct MethodWithUnionProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for MethodWithUnionProxy { |
| type Protocol = MethodWithUnionMarker; |
| |
| 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 MethodWithUnionProxy { |
| /// Create a new Proxy for test.protocols/MethodWithUnion. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <MethodWithUnionMarker 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) -> MethodWithUnionEventStream { |
| MethodWithUnionEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#union_method( |
| &self, |
| mut u: &TheUnion, |
| ) -> fidl::client::QueryResponseFut<Option<Box<TheUnion>>> { |
| MethodWithUnionProxyInterface::r#union_method(self, u) |
| } |
| } |
| |
| impl MethodWithUnionProxyInterface for MethodWithUnionProxy { |
| type UnionMethodResponseFut = fidl::client::QueryResponseFut<Option<Box<TheUnion>>>; |
| fn r#union_method(&self, mut u: &TheUnion) -> Self::UnionMethodResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<Option<Box<TheUnion>>, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| MethodWithUnionUnionMethodResponse, |
| 0x393e7f5b2b821218, |
| >(_buf?)?; |
| Ok(_response.u) |
| } |
| self.client |
| .send_query_and_decode::<MethodWithUnionUnionMethodRequest, Option<Box<TheUnion>>>( |
| (u,), |
| 0x393e7f5b2b821218, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct MethodWithUnionEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for MethodWithUnionEventStream {} |
| |
| impl futures::stream::FusedStream for MethodWithUnionEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for MethodWithUnionEventStream { |
| type Item = Result<MethodWithUnionEvent, 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(MethodWithUnionEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum MethodWithUnionEvent {} |
| |
| impl MethodWithUnionEvent { |
| /// Decodes a message buffer as a [`MethodWithUnionEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<MethodWithUnionEvent, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <MethodWithUnionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/MethodWithUnion. |
| pub struct MethodWithUnionRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for MethodWithUnionRequestStream {} |
| |
| impl futures::stream::FusedStream for MethodWithUnionRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for MethodWithUnionRequestStream { |
| type Protocol = MethodWithUnionMarker; |
| type ControlHandle = MethodWithUnionControlHandle; |
| |
| 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 { |
| MethodWithUnionControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for MethodWithUnionRequestStream { |
| type Item = Result<MethodWithUnionRequest, 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 MethodWithUnionRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x393e7f5b2b821218 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(MethodWithUnionUnionMethodRequest); |
| fidl::encoding::Decoder::decode_into::<MethodWithUnionUnionMethodRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = MethodWithUnionControlHandle { inner: this.inner.clone() }; |
| Ok(MethodWithUnionRequest::UnionMethod { |
| u: req.u, |
| |
| responder: MethodWithUnionUnionMethodResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <MethodWithUnionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum MethodWithUnionRequest { |
| UnionMethod { u: TheUnion, responder: MethodWithUnionUnionMethodResponder }, |
| } |
| |
| impl MethodWithUnionRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_union_method(self) -> Option<(TheUnion, MethodWithUnionUnionMethodResponder)> { |
| if let MethodWithUnionRequest::UnionMethod { u, responder } = self { |
| Some((u, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| MethodWithUnionRequest::UnionMethod { .. } => "union_method", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct MethodWithUnionControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for MethodWithUnionControlHandle { |
| 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() |
| } |
| } |
| |
| impl MethodWithUnionControlHandle {} |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct MethodWithUnionUnionMethodResponder { |
| control_handle: std::mem::ManuallyDrop<MethodWithUnionControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`MethodWithUnionControlHandle::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 MethodWithUnionUnionMethodResponder { |
| 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 MethodWithUnionUnionMethodResponder { |
| type ControlHandle = MethodWithUnionControlHandle; |
| |
| fn control_handle(&self) -> &MethodWithUnionControlHandle { |
| &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 MethodWithUnionUnionMethodResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut u: Option<&TheUnion>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(u); |
| 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 u: Option<&TheUnion>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(u); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut u: Option<&TheUnion>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<MethodWithUnionUnionMethodResponse>( |
| (u,), |
| self.tx_id, |
| 0x393e7f5b2b821218, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct PlatformServer_Marker; |
| |
| impl fidl::endpoints::ProtocolMarker for PlatformServer_Marker { |
| type Proxy = PlatformServer_Proxy; |
| type RequestStream = PlatformServer_RequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = PlatformServer_SynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "test.protocols.PlatformServer"; |
| } |
| impl fidl::endpoints::DiscoverableProtocolMarker for PlatformServer_Marker {} |
| |
| pub trait PlatformServer_ProxyInterface: Send + Sync {} |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct PlatformServer_SynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for PlatformServer_SynchronousProxy { |
| type Proxy = PlatformServer_Proxy; |
| type Protocol = PlatformServer_Marker; |
| |
| 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 PlatformServer_SynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <PlatformServer_Marker 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::Time) -> Result<PlatformServer_Event, fidl::Error> { |
| PlatformServer_Event::decode(self.client.wait_for_event(deadline)?) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct PlatformServer_Proxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for PlatformServer_Proxy { |
| type Protocol = PlatformServer_Marker; |
| |
| 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 PlatformServer_Proxy { |
| /// Create a new Proxy for test.protocols/PlatformServer. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <PlatformServer_Marker 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) -> PlatformServer_EventStream { |
| PlatformServer_EventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| } |
| |
| impl PlatformServer_ProxyInterface for PlatformServer_Proxy {} |
| |
| pub struct PlatformServer_EventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for PlatformServer_EventStream {} |
| |
| impl futures::stream::FusedStream for PlatformServer_EventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for PlatformServer_EventStream { |
| type Item = Result<PlatformServer_Event, 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(PlatformServer_Event::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum PlatformServer_Event {} |
| |
| impl PlatformServer_Event { |
| /// Decodes a message buffer as a [`PlatformServer_Event`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<PlatformServer_Event, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <PlatformServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/PlatformServer. |
| pub struct PlatformServer_RequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for PlatformServer_RequestStream {} |
| |
| impl futures::stream::FusedStream for PlatformServer_RequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for PlatformServer_RequestStream { |
| type Protocol = PlatformServer_Marker; |
| type ControlHandle = PlatformServer_ControlHandle; |
| |
| 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 { |
| PlatformServer_ControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for PlatformServer_RequestStream { |
| type Item = Result<PlatformServer_Request, 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 PlatformServer_RequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <PlatformServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum PlatformServer_Request {} |
| |
| impl PlatformServer_Request { |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self {} |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct PlatformServer_ControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for PlatformServer_ControlHandle { |
| 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() |
| } |
| } |
| |
| impl PlatformServer_ControlHandle {} |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct WithAndWithoutRequestResponseMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for WithAndWithoutRequestResponseMarker { |
| type Proxy = WithAndWithoutRequestResponseProxy; |
| type RequestStream = WithAndWithoutRequestResponseRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = WithAndWithoutRequestResponseSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) WithAndWithoutRequestResponse"; |
| } |
| |
| pub trait WithAndWithoutRequestResponseProxyInterface: Send + Sync { |
| fn r#no_request_no_response(&self) -> Result<(), fidl::Error>; |
| type NoRequestEmptyResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> |
| + Send; |
| fn r#no_request_empty_response(&self) -> Self::NoRequestEmptyResponseResponseFut; |
| type NoRequestWithResponseResponseFut: std::future::Future<Output = Result<String, fidl::Error>> |
| + Send; |
| fn r#no_request_with_response(&self) -> Self::NoRequestWithResponseResponseFut; |
| fn r#with_request_no_response(&self, arg: &str) -> Result<(), fidl::Error>; |
| type WithRequestEmptyResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> |
| + Send; |
| fn r#with_request_empty_response(&self, arg: &str) |
| -> Self::WithRequestEmptyResponseResponseFut; |
| type WithRequestWithResponseResponseFut: std::future::Future<Output = Result<String, fidl::Error>> |
| + Send; |
| fn r#with_request_with_response(&self, arg: &str) -> Self::WithRequestWithResponseResponseFut; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct WithAndWithoutRequestResponseSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for WithAndWithoutRequestResponseSynchronousProxy { |
| type Proxy = WithAndWithoutRequestResponseProxy; |
| type Protocol = WithAndWithoutRequestResponseMarker; |
| |
| 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 WithAndWithoutRequestResponseSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = |
| <WithAndWithoutRequestResponseMarker 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::Time, |
| ) -> Result<WithAndWithoutRequestResponseEvent, fidl::Error> { |
| WithAndWithoutRequestResponseEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#no_request_no_response(&self) -> Result<(), fidl::Error> { |
| self.client.send::<fidl::encoding::EmptyPayload>( |
| (), |
| 0x4b212a6c8c5f7bab, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#no_request_empty_response(&self, ___deadline: zx::Time) -> Result<(), fidl::Error> { |
| let _response = |
| self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>( |
| (), |
| 0x16a329d17f458668, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#no_request_with_response(&self, ___deadline: zx::Time) -> Result<String, fidl::Error> { |
| let _response = self.client.send_query::< |
| fidl::encoding::EmptyPayload, |
| WithAndWithoutRequestResponseNoRequestWithResponseResponse, |
| >( |
| (), |
| 0x7d6b2fcf0e2a65bd, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.ret) |
| } |
| |
| pub fn r#with_request_no_response(&self, mut arg: &str) -> Result<(), fidl::Error> { |
| self.client.send::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>( |
| (arg,), |
| 0x65ab625138c50a77, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#with_request_empty_response( |
| &self, |
| mut arg: &str, |
| ___deadline: zx::Time, |
| ) -> Result<(), fidl::Error> { |
| let _response = self.client.send_query::< |
| WithAndWithoutRequestResponseWithRequestEmptyResponseRequest, |
| fidl::encoding::EmptyPayload, |
| >( |
| (arg,), |
| 0x27ee4d2bd405df5f, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response) |
| } |
| |
| pub fn r#with_request_with_response( |
| &self, |
| mut arg: &str, |
| ___deadline: zx::Time, |
| ) -> Result<String, fidl::Error> { |
| let _response = self.client.send_query::< |
| WithAndWithoutRequestResponseWithRequestWithResponseRequest, |
| WithAndWithoutRequestResponseWithRequestWithResponseResponse, |
| >( |
| (arg,), |
| 0x590e91945d58f5b1, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.ret) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct WithAndWithoutRequestResponseProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for WithAndWithoutRequestResponseProxy { |
| type Protocol = WithAndWithoutRequestResponseMarker; |
| |
| 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 WithAndWithoutRequestResponseProxy { |
| /// Create a new Proxy for test.protocols/WithAndWithoutRequestResponse. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = |
| <WithAndWithoutRequestResponseMarker 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) -> WithAndWithoutRequestResponseEventStream { |
| WithAndWithoutRequestResponseEventStream { |
| event_receiver: self.client.take_event_receiver(), |
| } |
| } |
| |
| pub fn r#no_request_no_response(&self) -> Result<(), fidl::Error> { |
| WithAndWithoutRequestResponseProxyInterface::r#no_request_no_response(self) |
| } |
| |
| pub fn r#no_request_empty_response(&self) -> fidl::client::QueryResponseFut<()> { |
| WithAndWithoutRequestResponseProxyInterface::r#no_request_empty_response(self) |
| } |
| |
| pub fn r#no_request_with_response(&self) -> fidl::client::QueryResponseFut<String> { |
| WithAndWithoutRequestResponseProxyInterface::r#no_request_with_response(self) |
| } |
| |
| pub fn r#with_request_no_response(&self, mut arg: &str) -> Result<(), fidl::Error> { |
| WithAndWithoutRequestResponseProxyInterface::r#with_request_no_response(self, arg) |
| } |
| |
| pub fn r#with_request_empty_response( |
| &self, |
| mut arg: &str, |
| ) -> fidl::client::QueryResponseFut<()> { |
| WithAndWithoutRequestResponseProxyInterface::r#with_request_empty_response(self, arg) |
| } |
| |
| pub fn r#with_request_with_response( |
| &self, |
| mut arg: &str, |
| ) -> fidl::client::QueryResponseFut<String> { |
| WithAndWithoutRequestResponseProxyInterface::r#with_request_with_response(self, arg) |
| } |
| } |
| |
| impl WithAndWithoutRequestResponseProxyInterface for WithAndWithoutRequestResponseProxy { |
| fn r#no_request_no_response(&self) -> Result<(), fidl::Error> { |
| self.client.send::<fidl::encoding::EmptyPayload>( |
| (), |
| 0x4b212a6c8c5f7bab, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type NoRequestEmptyResponseResponseFut = fidl::client::QueryResponseFut<()>; |
| fn r#no_request_empty_response(&self) -> Self::NoRequestEmptyResponseResponseFut { |
| fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::EmptyPayload, |
| 0x16a329d17f458668, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>( |
| (), |
| 0x16a329d17f458668, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type NoRequestWithResponseResponseFut = fidl::client::QueryResponseFut<String>; |
| fn r#no_request_with_response(&self) -> Self::NoRequestWithResponseResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<String, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| WithAndWithoutRequestResponseNoRequestWithResponseResponse, |
| 0x7d6b2fcf0e2a65bd, |
| >(_buf?)?; |
| Ok(_response.ret) |
| } |
| self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>( |
| (), |
| 0x7d6b2fcf0e2a65bd, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| fn r#with_request_no_response(&self, mut arg: &str) -> Result<(), fidl::Error> { |
| self.client.send::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>( |
| (arg,), |
| 0x65ab625138c50a77, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| type WithRequestEmptyResponseResponseFut = fidl::client::QueryResponseFut<()>; |
| fn r#with_request_empty_response( |
| &self, |
| mut arg: &str, |
| ) -> Self::WithRequestEmptyResponseResponseFut { |
| fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::EmptyPayload, |
| 0x27ee4d2bd405df5f, |
| >(_buf?)?; |
| Ok(_response) |
| } |
| self.client.send_query_and_decode::< |
| WithAndWithoutRequestResponseWithRequestEmptyResponseRequest, |
| (), |
| >( |
| (arg,), |
| 0x27ee4d2bd405df5f, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type WithRequestWithResponseResponseFut = fidl::client::QueryResponseFut<String>; |
| fn r#with_request_with_response( |
| &self, |
| mut arg: &str, |
| ) -> Self::WithRequestWithResponseResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<String, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| WithAndWithoutRequestResponseWithRequestWithResponseResponse, |
| 0x590e91945d58f5b1, |
| >(_buf?)?; |
| Ok(_response.ret) |
| } |
| self.client.send_query_and_decode::< |
| WithAndWithoutRequestResponseWithRequestWithResponseRequest, |
| String, |
| >( |
| (arg,), |
| 0x590e91945d58f5b1, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct WithAndWithoutRequestResponseEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for WithAndWithoutRequestResponseEventStream {} |
| |
| impl futures::stream::FusedStream for WithAndWithoutRequestResponseEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for WithAndWithoutRequestResponseEventStream { |
| type Item = Result<WithAndWithoutRequestResponseEvent, 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(WithAndWithoutRequestResponseEvent::decode(buf))) |
| } |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum WithAndWithoutRequestResponseEvent { |
| OnEmptyResponse {}, |
| OnWithResponse { ret: String }, |
| } |
| |
| impl WithAndWithoutRequestResponseEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_empty_response(self) -> Option<()> { |
| if let WithAndWithoutRequestResponseEvent::OnEmptyResponse {} = self { |
| Some(()) |
| } else { |
| None |
| } |
| } |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_with_response(self) -> Option<String> { |
| if let WithAndWithoutRequestResponseEvent::OnWithResponse { ret } = self { |
| Some((ret)) |
| } else { |
| None |
| } |
| } |
| |
| /// Decodes a message buffer as a [`WithAndWithoutRequestResponseEvent`]. |
| fn decode( |
| mut buf: fidl::MessageBufEtc, |
| ) -> Result<WithAndWithoutRequestResponseEvent, 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 { |
| 0x4ae85a2b8d7c2e56 => { |
| let mut out = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok(( |
| WithAndWithoutRequestResponseEvent::OnEmptyResponse { |
| } |
| )) |
| } |
| 0x50a6f21a322f31a8 => { |
| let mut out = fidl::new_empty!(WithAndWithoutRequestResponseOnWithResponseRequest); |
| fidl::encoding::Decoder::decode_into::<WithAndWithoutRequestResponseOnWithResponseRequest>(&tx_header, _body_bytes, _handles, &mut out)?; |
| Ok(( |
| WithAndWithoutRequestResponseEvent::OnWithResponse {ret: out.ret, |
| |
| } |
| )) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: <WithAndWithoutRequestResponseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }) |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/WithAndWithoutRequestResponse. |
| pub struct WithAndWithoutRequestResponseRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for WithAndWithoutRequestResponseRequestStream {} |
| |
| impl futures::stream::FusedStream for WithAndWithoutRequestResponseRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for WithAndWithoutRequestResponseRequestStream { |
| type Protocol = WithAndWithoutRequestResponseMarker; |
| type ControlHandle = WithAndWithoutRequestResponseControlHandle; |
| |
| 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 { |
| WithAndWithoutRequestResponseControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for WithAndWithoutRequestResponseRequestStream { |
| type Item = Result<WithAndWithoutRequestResponseRequest, 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 WithAndWithoutRequestResponseRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x4b212a6c8c5f7bab => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = WithAndWithoutRequestResponseControlHandle { |
| inner: this.inner.clone(), |
| }; |
| Ok(WithAndWithoutRequestResponseRequest::NoRequestNoResponse { |
| control_handle, |
| }) |
| } |
| 0x16a329d17f458668 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = WithAndWithoutRequestResponseControlHandle { |
| inner: this.inner.clone(), |
| }; |
| Ok(WithAndWithoutRequestResponseRequest::NoRequestEmptyResponse { |
| responder: WithAndWithoutRequestResponseNoRequestEmptyResponseResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x7d6b2fcf0e2a65bd => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = WithAndWithoutRequestResponseControlHandle { |
| inner: this.inner.clone(), |
| }; |
| Ok(WithAndWithoutRequestResponseRequest::NoRequestWithResponse { |
| responder: WithAndWithoutRequestResponseNoRequestWithResponseResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x65ab625138c50a77 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!(WithAndWithoutRequestResponseWithRequestNoResponseRequest); |
| fidl::encoding::Decoder::decode_into::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = WithAndWithoutRequestResponseControlHandle { |
| inner: this.inner.clone(), |
| }; |
| Ok(WithAndWithoutRequestResponseRequest::WithRequestNoResponse {arg: req.arg, |
| |
| control_handle, |
| }) |
| } |
| 0x27ee4d2bd405df5f => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(WithAndWithoutRequestResponseWithRequestEmptyResponseRequest); |
| fidl::encoding::Decoder::decode_into::<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = WithAndWithoutRequestResponseControlHandle { |
| inner: this.inner.clone(), |
| }; |
| Ok(WithAndWithoutRequestResponseRequest::WithRequestEmptyResponse {arg: req.arg, |
| |
| responder: WithAndWithoutRequestResponseWithRequestEmptyResponseResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x590e91945d58f5b1 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(WithAndWithoutRequestResponseWithRequestWithResponseRequest); |
| fidl::encoding::Decoder::decode_into::<WithAndWithoutRequestResponseWithRequestWithResponseRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = WithAndWithoutRequestResponseControlHandle { |
| inner: this.inner.clone(), |
| }; |
| Ok(WithAndWithoutRequestResponseRequest::WithRequestWithResponse {arg: req.arg, |
| |
| responder: WithAndWithoutRequestResponseWithRequestWithResponseResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: <WithAndWithoutRequestResponseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum WithAndWithoutRequestResponseRequest { |
| NoRequestNoResponse { |
| control_handle: WithAndWithoutRequestResponseControlHandle, |
| }, |
| NoRequestEmptyResponse { |
| responder: WithAndWithoutRequestResponseNoRequestEmptyResponseResponder, |
| }, |
| NoRequestWithResponse { |
| responder: WithAndWithoutRequestResponseNoRequestWithResponseResponder, |
| }, |
| WithRequestNoResponse { |
| arg: String, |
| control_handle: WithAndWithoutRequestResponseControlHandle, |
| }, |
| WithRequestEmptyResponse { |
| arg: String, |
| responder: WithAndWithoutRequestResponseWithRequestEmptyResponseResponder, |
| }, |
| WithRequestWithResponse { |
| arg: String, |
| responder: WithAndWithoutRequestResponseWithRequestWithResponseResponder, |
| }, |
| } |
| |
| impl WithAndWithoutRequestResponseRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_no_request_no_response( |
| self, |
| ) -> Option<(WithAndWithoutRequestResponseControlHandle)> { |
| if let WithAndWithoutRequestResponseRequest::NoRequestNoResponse { control_handle } = self { |
| Some((control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_no_request_empty_response( |
| self, |
| ) -> Option<(WithAndWithoutRequestResponseNoRequestEmptyResponseResponder)> { |
| if let WithAndWithoutRequestResponseRequest::NoRequestEmptyResponse { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_no_request_with_response( |
| self, |
| ) -> Option<(WithAndWithoutRequestResponseNoRequestWithResponseResponder)> { |
| if let WithAndWithoutRequestResponseRequest::NoRequestWithResponse { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_with_request_no_response( |
| self, |
| ) -> Option<(String, WithAndWithoutRequestResponseControlHandle)> { |
| if let WithAndWithoutRequestResponseRequest::WithRequestNoResponse { arg, control_handle } = |
| self |
| { |
| Some((arg, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_with_request_empty_response( |
| self, |
| ) -> Option<(String, WithAndWithoutRequestResponseWithRequestEmptyResponseResponder)> { |
| if let WithAndWithoutRequestResponseRequest::WithRequestEmptyResponse { arg, responder } = |
| self |
| { |
| Some((arg, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_with_request_with_response( |
| self, |
| ) -> Option<(String, WithAndWithoutRequestResponseWithRequestWithResponseResponder)> { |
| if let WithAndWithoutRequestResponseRequest::WithRequestWithResponse { arg, responder } = |
| self |
| { |
| Some((arg, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| WithAndWithoutRequestResponseRequest::NoRequestNoResponse { .. } => { |
| "no_request_no_response" |
| } |
| WithAndWithoutRequestResponseRequest::NoRequestEmptyResponse { .. } => { |
| "no_request_empty_response" |
| } |
| WithAndWithoutRequestResponseRequest::NoRequestWithResponse { .. } => { |
| "no_request_with_response" |
| } |
| WithAndWithoutRequestResponseRequest::WithRequestNoResponse { .. } => { |
| "with_request_no_response" |
| } |
| WithAndWithoutRequestResponseRequest::WithRequestEmptyResponse { .. } => { |
| "with_request_empty_response" |
| } |
| WithAndWithoutRequestResponseRequest::WithRequestWithResponse { .. } => { |
| "with_request_with_response" |
| } |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct WithAndWithoutRequestResponseControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for WithAndWithoutRequestResponseControlHandle { |
| 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() |
| } |
| } |
| |
| impl WithAndWithoutRequestResponseControlHandle { |
| pub fn send_on_empty_response(&self) -> Result<(), fidl::Error> { |
| self.inner.send::<fidl::encoding::EmptyPayload>( |
| (), |
| 0, |
| 0x4ae85a2b8d7c2e56, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn send_on_with_response(&self, mut ret: &str) -> Result<(), fidl::Error> { |
| self.inner.send::<WithAndWithoutRequestResponseOnWithResponseRequest>( |
| (ret,), |
| 0, |
| 0x50a6f21a322f31a8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithAndWithoutRequestResponseNoRequestEmptyResponseResponder { |
| control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::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 WithAndWithoutRequestResponseNoRequestEmptyResponseResponder { |
| 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 WithAndWithoutRequestResponseNoRequestEmptyResponseResponder { |
| type ControlHandle = WithAndWithoutRequestResponseControlHandle; |
| |
| fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle { |
| &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 WithAndWithoutRequestResponseNoRequestEmptyResponseResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(); |
| 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) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::EmptyPayload>( |
| (), |
| self.tx_id, |
| 0x16a329d17f458668, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithAndWithoutRequestResponseNoRequestWithResponseResponder { |
| control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::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 WithAndWithoutRequestResponseNoRequestWithResponseResponder { |
| 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 WithAndWithoutRequestResponseNoRequestWithResponseResponder { |
| type ControlHandle = WithAndWithoutRequestResponseControlHandle; |
| |
| fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle { |
| &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 WithAndWithoutRequestResponseNoRequestWithResponseResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut ret: &str) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(ret); |
| 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 ret: &str) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(ret); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut ret: &str) -> Result<(), fidl::Error> { |
| self.control_handle |
| .inner |
| .send::<WithAndWithoutRequestResponseNoRequestWithResponseResponse>( |
| (ret,), |
| self.tx_id, |
| 0x7d6b2fcf0e2a65bd, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithAndWithoutRequestResponseWithRequestEmptyResponseResponder { |
| control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::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 WithAndWithoutRequestResponseWithRequestEmptyResponseResponder { |
| 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 WithAndWithoutRequestResponseWithRequestEmptyResponseResponder { |
| type ControlHandle = WithAndWithoutRequestResponseControlHandle; |
| |
| fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle { |
| &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 WithAndWithoutRequestResponseWithRequestEmptyResponseResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(); |
| 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) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::EmptyPayload>( |
| (), |
| self.tx_id, |
| 0x27ee4d2bd405df5f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithAndWithoutRequestResponseWithRequestWithResponseResponder { |
| control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::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 WithAndWithoutRequestResponseWithRequestWithResponseResponder { |
| 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 WithAndWithoutRequestResponseWithRequestWithResponseResponder { |
| type ControlHandle = WithAndWithoutRequestResponseControlHandle; |
| |
| fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle { |
| &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 WithAndWithoutRequestResponseWithRequestWithResponseResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut ret: &str) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(ret); |
| 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 ret: &str) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(ret); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut ret: &str) -> Result<(), fidl::Error> { |
| self.control_handle |
| .inner |
| .send::<WithAndWithoutRequestResponseWithRequestWithResponseResponse>( |
| (ret,), |
| self.tx_id, |
| 0x590e91945d58f5b1, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct WithErrorSyntaxMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for WithErrorSyntaxMarker { |
| type Proxy = WithErrorSyntaxProxy; |
| type RequestStream = WithErrorSyntaxRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = WithErrorSyntaxSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) WithErrorSyntax"; |
| } |
| pub type WithErrorSyntaxResponseAsStructResult = Result<(i64, i64, i64), u32>; |
| pub type WithErrorSyntaxErrorAsPrimitiveResult = Result<(), u32>; |
| pub type WithErrorSyntaxErrorAsEnumResult = Result<(), ErrorEnum>; |
| pub type WithErrorSyntaxHandleInResultResult = Result<fidl::Handle, u32>; |
| |
| pub trait WithErrorSyntaxProxyInterface: Send + Sync { |
| type ResponseAsStructResponseFut: std::future::Future<Output = Result<WithErrorSyntaxResponseAsStructResult, fidl::Error>> |
| + Send; |
| fn r#response_as_struct(&self) -> Self::ResponseAsStructResponseFut; |
| type ErrorAsPrimitiveResponseFut: std::future::Future<Output = Result<WithErrorSyntaxErrorAsPrimitiveResult, fidl::Error>> |
| + Send; |
| fn r#error_as_primitive(&self) -> Self::ErrorAsPrimitiveResponseFut; |
| type ErrorAsEnumResponseFut: std::future::Future<Output = Result<WithErrorSyntaxErrorAsEnumResult, fidl::Error>> |
| + Send; |
| fn r#error_as_enum(&self) -> Self::ErrorAsEnumResponseFut; |
| type HandleInResultResponseFut: std::future::Future<Output = Result<WithErrorSyntaxHandleInResultResult, fidl::Error>> |
| + Send; |
| fn r#handle_in_result(&self) -> Self::HandleInResultResponseFut; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct WithErrorSyntaxSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for WithErrorSyntaxSynchronousProxy { |
| type Proxy = WithErrorSyntaxProxy; |
| type Protocol = WithErrorSyntaxMarker; |
| |
| 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 WithErrorSyntaxSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <WithErrorSyntaxMarker 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::Time) -> Result<WithErrorSyntaxEvent, fidl::Error> { |
| WithErrorSyntaxEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#response_as_struct( |
| &self, |
| ___deadline: zx::Time, |
| ) -> Result<WithErrorSyntaxResponseAsStructResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| fidl::encoding::EmptyPayload, |
| fidl::encoding::ResultType<WithErrorSyntaxResponseAsStructResponse, u32>, |
| >( |
| (), |
| 0x3b902a6d8d24693, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| (x.a, x.b, x.c))) |
| } |
| |
| pub fn r#error_as_primitive( |
| &self, |
| ___deadline: zx::Time, |
| ) -> Result<WithErrorSyntaxErrorAsPrimitiveResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| fidl::encoding::EmptyPayload, |
| fidl::encoding::ResultType<fidl::encoding::EmptyStruct, u32>, |
| >( |
| (), |
| 0x602fd6bd920135e7, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| |
| pub fn r#error_as_enum( |
| &self, |
| ___deadline: zx::Time, |
| ) -> Result<WithErrorSyntaxErrorAsEnumResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| fidl::encoding::EmptyPayload, |
| fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorEnum>, |
| >( |
| (), |
| 0x4c371e1673212f43, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x)) |
| } |
| |
| pub fn r#handle_in_result( |
| &self, |
| ___deadline: zx::Time, |
| ) -> Result<WithErrorSyntaxHandleInResultResult, fidl::Error> { |
| let _response = self.client.send_query::< |
| fidl::encoding::EmptyPayload, |
| fidl::encoding::ResultType<WithErrorSyntaxHandleInResultResponse, u32>, |
| >( |
| (), |
| 0x13092c5b835b0cbf, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.map(|x| x.h)) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct WithErrorSyntaxProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for WithErrorSyntaxProxy { |
| type Protocol = WithErrorSyntaxMarker; |
| |
| 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 WithErrorSyntaxProxy { |
| /// Create a new Proxy for test.protocols/WithErrorSyntax. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <WithErrorSyntaxMarker 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) -> WithErrorSyntaxEventStream { |
| WithErrorSyntaxEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#response_as_struct( |
| &self, |
| ) -> fidl::client::QueryResponseFut<WithErrorSyntaxResponseAsStructResult> { |
| WithErrorSyntaxProxyInterface::r#response_as_struct(self) |
| } |
| |
| pub fn r#error_as_primitive( |
| &self, |
| ) -> fidl::client::QueryResponseFut<WithErrorSyntaxErrorAsPrimitiveResult> { |
| WithErrorSyntaxProxyInterface::r#error_as_primitive(self) |
| } |
| |
| pub fn r#error_as_enum( |
| &self, |
| ) -> fidl::client::QueryResponseFut<WithErrorSyntaxErrorAsEnumResult> { |
| WithErrorSyntaxProxyInterface::r#error_as_enum(self) |
| } |
| |
| pub fn r#handle_in_result( |
| &self, |
| ) -> fidl::client::QueryResponseFut<WithErrorSyntaxHandleInResultResult> { |
| WithErrorSyntaxProxyInterface::r#handle_in_result(self) |
| } |
| } |
| |
| impl WithErrorSyntaxProxyInterface for WithErrorSyntaxProxy { |
| type ResponseAsStructResponseFut = |
| fidl::client::QueryResponseFut<WithErrorSyntaxResponseAsStructResult>; |
| fn r#response_as_struct(&self) -> Self::ResponseAsStructResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<WithErrorSyntaxResponseAsStructResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<WithErrorSyntaxResponseAsStructResponse, u32>, |
| 0x3b902a6d8d24693, |
| >(_buf?)?; |
| Ok(_response.map(|x| (x.a, x.b, x.c))) |
| } |
| self.client.send_query_and_decode::< |
| fidl::encoding::EmptyPayload, |
| WithErrorSyntaxResponseAsStructResult, |
| >( |
| (), |
| 0x3b902a6d8d24693, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type ErrorAsPrimitiveResponseFut = |
| fidl::client::QueryResponseFut<WithErrorSyntaxErrorAsPrimitiveResult>; |
| fn r#error_as_primitive(&self) -> Self::ErrorAsPrimitiveResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<WithErrorSyntaxErrorAsPrimitiveResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<fidl::encoding::EmptyStruct, u32>, |
| 0x602fd6bd920135e7, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| fidl::encoding::EmptyPayload, |
| WithErrorSyntaxErrorAsPrimitiveResult, |
| >( |
| (), |
| 0x602fd6bd920135e7, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type ErrorAsEnumResponseFut = fidl::client::QueryResponseFut<WithErrorSyntaxErrorAsEnumResult>; |
| fn r#error_as_enum(&self) -> Self::ErrorAsEnumResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<WithErrorSyntaxErrorAsEnumResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorEnum>, |
| 0x4c371e1673212f43, |
| >(_buf?)?; |
| Ok(_response.map(|x| x)) |
| } |
| self.client.send_query_and_decode::< |
| fidl::encoding::EmptyPayload, |
| WithErrorSyntaxErrorAsEnumResult, |
| >( |
| (), |
| 0x4c371e1673212f43, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type HandleInResultResponseFut = |
| fidl::client::QueryResponseFut<WithErrorSyntaxHandleInResultResult>; |
| fn r#handle_in_result(&self) -> Self::HandleInResultResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<WithErrorSyntaxHandleInResultResult, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| fidl::encoding::ResultType<WithErrorSyntaxHandleInResultResponse, u32>, |
| 0x13092c5b835b0cbf, |
| >(_buf?)?; |
| Ok(_response.map(|x| x.h)) |
| } |
| self.client.send_query_and_decode::< |
| fidl::encoding::EmptyPayload, |
| WithErrorSyntaxHandleInResultResult, |
| >( |
| (), |
| 0x13092c5b835b0cbf, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct WithErrorSyntaxEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for WithErrorSyntaxEventStream {} |
| |
| impl futures::stream::FusedStream for WithErrorSyntaxEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for WithErrorSyntaxEventStream { |
| type Item = Result<WithErrorSyntaxEvent, 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(WithErrorSyntaxEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum WithErrorSyntaxEvent {} |
| |
| impl WithErrorSyntaxEvent { |
| /// Decodes a message buffer as a [`WithErrorSyntaxEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<WithErrorSyntaxEvent, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <WithErrorSyntaxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/WithErrorSyntax. |
| pub struct WithErrorSyntaxRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for WithErrorSyntaxRequestStream {} |
| |
| impl futures::stream::FusedStream for WithErrorSyntaxRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for WithErrorSyntaxRequestStream { |
| type Protocol = WithErrorSyntaxMarker; |
| type ControlHandle = WithErrorSyntaxControlHandle; |
| |
| 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 { |
| WithErrorSyntaxControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for WithErrorSyntaxRequestStream { |
| type Item = Result<WithErrorSyntaxRequest, 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 WithErrorSyntaxRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x3b902a6d8d24693 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = WithErrorSyntaxControlHandle { inner: this.inner.clone() }; |
| Ok(WithErrorSyntaxRequest::ResponseAsStruct { |
| responder: WithErrorSyntaxResponseAsStructResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x602fd6bd920135e7 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = WithErrorSyntaxControlHandle { inner: this.inner.clone() }; |
| Ok(WithErrorSyntaxRequest::ErrorAsPrimitive { |
| responder: WithErrorSyntaxErrorAsPrimitiveResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x4c371e1673212f43 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = WithErrorSyntaxControlHandle { inner: this.inner.clone() }; |
| Ok(WithErrorSyntaxRequest::ErrorAsEnum { |
| responder: WithErrorSyntaxErrorAsEnumResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x13092c5b835b0cbf => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload); |
| fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = WithErrorSyntaxControlHandle { inner: this.inner.clone() }; |
| Ok(WithErrorSyntaxRequest::HandleInResult { |
| responder: WithErrorSyntaxHandleInResultResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <WithErrorSyntaxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum WithErrorSyntaxRequest { |
| ResponseAsStruct { responder: WithErrorSyntaxResponseAsStructResponder }, |
| ErrorAsPrimitive { responder: WithErrorSyntaxErrorAsPrimitiveResponder }, |
| ErrorAsEnum { responder: WithErrorSyntaxErrorAsEnumResponder }, |
| HandleInResult { responder: WithErrorSyntaxHandleInResultResponder }, |
| } |
| |
| impl WithErrorSyntaxRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_response_as_struct(self) -> Option<(WithErrorSyntaxResponseAsStructResponder)> { |
| if let WithErrorSyntaxRequest::ResponseAsStruct { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_error_as_primitive(self) -> Option<(WithErrorSyntaxErrorAsPrimitiveResponder)> { |
| if let WithErrorSyntaxRequest::ErrorAsPrimitive { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_error_as_enum(self) -> Option<(WithErrorSyntaxErrorAsEnumResponder)> { |
| if let WithErrorSyntaxRequest::ErrorAsEnum { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_handle_in_result(self) -> Option<(WithErrorSyntaxHandleInResultResponder)> { |
| if let WithErrorSyntaxRequest::HandleInResult { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| WithErrorSyntaxRequest::ResponseAsStruct { .. } => "response_as_struct", |
| WithErrorSyntaxRequest::ErrorAsPrimitive { .. } => "error_as_primitive", |
| WithErrorSyntaxRequest::ErrorAsEnum { .. } => "error_as_enum", |
| WithErrorSyntaxRequest::HandleInResult { .. } => "handle_in_result", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct WithErrorSyntaxControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for WithErrorSyntaxControlHandle { |
| 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() |
| } |
| } |
| |
| impl WithErrorSyntaxControlHandle {} |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithErrorSyntaxResponseAsStructResponder { |
| control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::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 WithErrorSyntaxResponseAsStructResponder { |
| 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 WithErrorSyntaxResponseAsStructResponder { |
| type ControlHandle = WithErrorSyntaxControlHandle; |
| |
| fn control_handle(&self) -> &WithErrorSyntaxControlHandle { |
| &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 WithErrorSyntaxResponseAsStructResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<(i64, i64, i64), 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<(i64, i64, i64), u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<(i64, i64, i64), u32>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType< |
| WithErrorSyntaxResponseAsStructResponse, |
| u32, |
| >>( |
| result, |
| self.tx_id, |
| 0x3b902a6d8d24693, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithErrorSyntaxErrorAsPrimitiveResponder { |
| control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::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 WithErrorSyntaxErrorAsPrimitiveResponder { |
| 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 WithErrorSyntaxErrorAsPrimitiveResponder { |
| type ControlHandle = WithErrorSyntaxControlHandle; |
| |
| fn control_handle(&self) -> &WithErrorSyntaxControlHandle { |
| &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 WithErrorSyntaxErrorAsPrimitiveResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<(), 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<(), u32>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<(), u32>) -> Result<(), fidl::Error> { |
| self.control_handle |
| .inner |
| .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, u32>>( |
| result, |
| self.tx_id, |
| 0x602fd6bd920135e7, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithErrorSyntaxErrorAsEnumResponder { |
| control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::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 WithErrorSyntaxErrorAsEnumResponder { |
| 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 WithErrorSyntaxErrorAsEnumResponder { |
| type ControlHandle = WithErrorSyntaxControlHandle; |
| |
| fn control_handle(&self) -> &WithErrorSyntaxControlHandle { |
| &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 WithErrorSyntaxErrorAsEnumResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<(), ErrorEnum>) -> 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<(), ErrorEnum>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<(), ErrorEnum>) -> Result<(), fidl::Error> { |
| self.control_handle |
| .inner |
| .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorEnum>>( |
| result, |
| self.tx_id, |
| 0x4c371e1673212f43, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithErrorSyntaxHandleInResultResponder { |
| control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::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 WithErrorSyntaxHandleInResultResponder { |
| 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 WithErrorSyntaxHandleInResultResponder { |
| type ControlHandle = WithErrorSyntaxControlHandle; |
| |
| fn control_handle(&self) -> &WithErrorSyntaxControlHandle { |
| &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 WithErrorSyntaxHandleInResultResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut result: Result<fidl::Handle, 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<fidl::Handle, u32>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(result); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut result: Result<fidl::Handle, u32>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<fidl::encoding::ResultType< |
| WithErrorSyntaxHandleInResultResponse, |
| u32, |
| >>( |
| result.map(|h| (h,)), |
| self.tx_id, |
| 0x13092c5b835b0cbf, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct WithProtocolEndsMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for WithProtocolEndsMarker { |
| type Proxy = WithProtocolEndsProxy; |
| type RequestStream = WithProtocolEndsRequestStream; |
| |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = WithProtocolEndsSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) WithProtocolEnds"; |
| } |
| |
| pub trait WithProtocolEndsProxyInterface: Send + Sync { |
| type ClientEndsResponseFut: std::future::Future< |
| Output = Result< |
| Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| fidl::Error, |
| >, |
| > + Send; |
| fn r#client_ends( |
| &self, |
| in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| ) -> Self::ClientEndsResponseFut; |
| type ServerEndsResponseFut: std::future::Future< |
| Output = Result<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, fidl::Error>, |
| > + Send; |
| fn r#server_ends( |
| &self, |
| in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| ) -> Self::ServerEndsResponseFut; |
| type StructContainingEndsResponseFut: std::future::Future<Output = Result<ProtocolEnds, fidl::Error>> |
| + Send; |
| fn r#struct_containing_ends(&self, in_: ProtocolEnds) -> Self::StructContainingEndsResponseFut; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct WithProtocolEndsSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for WithProtocolEndsSynchronousProxy { |
| type Proxy = WithProtocolEndsProxy; |
| type Protocol = WithProtocolEndsMarker; |
| |
| 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 WithProtocolEndsSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <WithProtocolEndsMarker 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::Time) -> Result<WithProtocolEndsEvent, fidl::Error> { |
| WithProtocolEndsEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#client_ends( |
| &self, |
| mut in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| ___deadline: zx::Time, |
| ) -> Result<Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<WithProtocolEndsClientEndsRequest, WithProtocolEndsClientEndsResponse>( |
| (in_,), |
| 0x51780563edb15042, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.out) |
| } |
| |
| pub fn r#server_ends( |
| &self, |
| mut in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| ___deadline: zx::Time, |
| ) -> Result<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, fidl::Error> { |
| let _response = self |
| .client |
| .send_query::<WithProtocolEndsServerEndsRequest, WithProtocolEndsServerEndsResponse>( |
| (in_,), |
| 0x70a02c2ba2228a33, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.out) |
| } |
| |
| pub fn r#struct_containing_ends( |
| &self, |
| mut in_: ProtocolEnds, |
| ___deadline: zx::Time, |
| ) -> Result<ProtocolEnds, fidl::Error> { |
| let _response = self.client.send_query::< |
| WithProtocolEndsStructContainingEndsRequest, |
| WithProtocolEndsStructContainingEndsResponse, |
| >( |
| (&mut in_,), |
| 0x3893f0baad26f5d5, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.out) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct WithProtocolEndsProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for WithProtocolEndsProxy { |
| type Protocol = WithProtocolEndsMarker; |
| |
| 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 WithProtocolEndsProxy { |
| /// Create a new Proxy for test.protocols/WithProtocolEnds. |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <WithProtocolEndsMarker 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) -> WithProtocolEndsEventStream { |
| WithProtocolEndsEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#client_ends( |
| &self, |
| mut in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| ) -> fidl::client::QueryResponseFut< |
| Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| > { |
| WithProtocolEndsProxyInterface::r#client_ends(self, in_) |
| } |
| |
| pub fn r#server_ends( |
| &self, |
| mut in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| ) -> fidl::client::QueryResponseFut<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>> |
| { |
| WithProtocolEndsProxyInterface::r#server_ends(self, in_) |
| } |
| |
| pub fn r#struct_containing_ends( |
| &self, |
| mut in_: ProtocolEnds, |
| ) -> fidl::client::QueryResponseFut<ProtocolEnds> { |
| WithProtocolEndsProxyInterface::r#struct_containing_ends(self, in_) |
| } |
| } |
| |
| impl WithProtocolEndsProxyInterface for WithProtocolEndsProxy { |
| type ClientEndsResponseFut = fidl::client::QueryResponseFut< |
| Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| >; |
| fn r#client_ends( |
| &self, |
| mut in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| ) -> Self::ClientEndsResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, fidl::Error> |
| { |
| let _response = fidl::client::decode_transaction_body::< |
| WithProtocolEndsClientEndsResponse, |
| 0x51780563edb15042, |
| >(_buf?)?; |
| Ok(_response.out) |
| } |
| self.client.send_query_and_decode::< |
| WithProtocolEndsClientEndsRequest, |
| Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| >( |
| (in_,), |
| 0x51780563edb15042, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type ServerEndsResponseFut = |
| fidl::client::QueryResponseFut<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>; |
| fn r#server_ends( |
| &self, |
| mut in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| ) -> Self::ServerEndsResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| WithProtocolEndsServerEndsResponse, |
| 0x70a02c2ba2228a33, |
| >(_buf?)?; |
| Ok(_response.out) |
| } |
| self.client.send_query_and_decode::< |
| WithProtocolEndsServerEndsRequest, |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >( |
| (in_,), |
| 0x70a02c2ba2228a33, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type StructContainingEndsResponseFut = fidl::client::QueryResponseFut<ProtocolEnds>; |
| fn r#struct_containing_ends( |
| &self, |
| mut in_: ProtocolEnds, |
| ) -> Self::StructContainingEndsResponseFut { |
| fn _decode( |
| mut _buf: Result<fidl::MessageBufEtc, fidl::Error>, |
| ) -> Result<ProtocolEnds, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| WithProtocolEndsStructContainingEndsResponse, |
| 0x3893f0baad26f5d5, |
| >(_buf?)?; |
| Ok(_response.out) |
| } |
| self.client |
| .send_query_and_decode::<WithProtocolEndsStructContainingEndsRequest, ProtocolEnds>( |
| (&mut in_,), |
| 0x3893f0baad26f5d5, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| } |
| |
| pub struct WithProtocolEndsEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for WithProtocolEndsEventStream {} |
| |
| impl futures::stream::FusedStream for WithProtocolEndsEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for WithProtocolEndsEventStream { |
| type Item = Result<WithProtocolEndsEvent, 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(WithProtocolEndsEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum WithProtocolEndsEvent {} |
| |
| impl WithProtocolEndsEvent { |
| /// Decodes a message buffer as a [`WithProtocolEndsEvent`]. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<WithProtocolEndsEvent, 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 { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal, |
| protocol_name: |
| <WithProtocolEndsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocols/WithProtocolEnds. |
| pub struct WithProtocolEndsRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for WithProtocolEndsRequestStream {} |
| |
| impl futures::stream::FusedStream for WithProtocolEndsRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for WithProtocolEndsRequestStream { |
| type Protocol = WithProtocolEndsMarker; |
| type ControlHandle = WithProtocolEndsControlHandle; |
| |
| 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 { |
| WithProtocolEndsControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for WithProtocolEndsRequestStream { |
| type Item = Result<WithProtocolEndsRequest, 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 WithProtocolEndsRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf(|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)))) |
| } |
| } |
| |
| // 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 { |
| 0x51780563edb15042 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(WithProtocolEndsClientEndsRequest); |
| fidl::encoding::Decoder::decode_into::<WithProtocolEndsClientEndsRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = |
| WithProtocolEndsControlHandle { inner: this.inner.clone() }; |
| Ok(WithProtocolEndsRequest::ClientEnds { |
| in_: req.in_, |
| |
| responder: WithProtocolEndsClientEndsResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x70a02c2ba2228a33 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(WithProtocolEndsServerEndsRequest); |
| fidl::encoding::Decoder::decode_into::<WithProtocolEndsServerEndsRequest>( |
| &header, |
| _body_bytes, |
| handles, |
| &mut req, |
| )?; |
| let control_handle = |
| WithProtocolEndsControlHandle { inner: this.inner.clone() }; |
| Ok(WithProtocolEndsRequest::ServerEnds { |
| in_: req.in_, |
| |
| responder: WithProtocolEndsServerEndsResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x3893f0baad26f5d5 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!(WithProtocolEndsStructContainingEndsRequest); |
| fidl::encoding::Decoder::decode_into::< |
| WithProtocolEndsStructContainingEndsRequest, |
| >(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = |
| WithProtocolEndsControlHandle { inner: this.inner.clone() }; |
| Ok(WithProtocolEndsRequest::StructContainingEnds { |
| in_: req.in_, |
| |
| responder: WithProtocolEndsStructContainingEndsResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <WithProtocolEndsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum WithProtocolEndsRequest { |
| ClientEnds { |
| in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| responder: WithProtocolEndsClientEndsResponder, |
| }, |
| ServerEnds { |
| in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| responder: WithProtocolEndsServerEndsResponder, |
| }, |
| StructContainingEnds { |
| in_: ProtocolEnds, |
| responder: WithProtocolEndsStructContainingEndsResponder, |
| }, |
| } |
| |
| impl WithProtocolEndsRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_client_ends( |
| self, |
| ) -> Option<( |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| WithProtocolEndsClientEndsResponder, |
| )> { |
| if let WithProtocolEndsRequest::ClientEnds { in_, responder } = self { |
| Some((in_, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_server_ends( |
| self, |
| ) -> Option<( |
| Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| WithProtocolEndsServerEndsResponder, |
| )> { |
| if let WithProtocolEndsRequest::ServerEnds { in_, responder } = self { |
| Some((in_, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_struct_containing_ends( |
| self, |
| ) -> Option<(ProtocolEnds, WithProtocolEndsStructContainingEndsResponder)> { |
| if let WithProtocolEndsRequest::StructContainingEnds { in_, responder } = self { |
| Some((in_, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| WithProtocolEndsRequest::ClientEnds { .. } => "client_ends", |
| WithProtocolEndsRequest::ServerEnds { .. } => "server_ends", |
| WithProtocolEndsRequest::StructContainingEnds { .. } => "struct_containing_ends", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct WithProtocolEndsControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for WithProtocolEndsControlHandle { |
| 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() |
| } |
| } |
| |
| impl WithProtocolEndsControlHandle {} |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithProtocolEndsClientEndsResponder { |
| control_handle: std::mem::ManuallyDrop<WithProtocolEndsControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithProtocolEndsControlHandle::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 WithProtocolEndsClientEndsResponder { |
| 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 WithProtocolEndsClientEndsResponder { |
| type ControlHandle = WithProtocolEndsControlHandle; |
| |
| fn control_handle(&self) -> &WithProtocolEndsControlHandle { |
| &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 WithProtocolEndsClientEndsResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(out); |
| 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 out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(out); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<WithProtocolEndsClientEndsResponse>( |
| (out,), |
| self.tx_id, |
| 0x51780563edb15042, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithProtocolEndsServerEndsResponder { |
| control_handle: std::mem::ManuallyDrop<WithProtocolEndsControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithProtocolEndsControlHandle::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 WithProtocolEndsServerEndsResponder { |
| 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 WithProtocolEndsServerEndsResponder { |
| type ControlHandle = WithProtocolEndsControlHandle; |
| |
| fn control_handle(&self) -> &WithProtocolEndsControlHandle { |
| &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 WithProtocolEndsServerEndsResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(out); |
| 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 out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(out); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw( |
| &self, |
| mut out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| ) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<WithProtocolEndsServerEndsResponse>( |
| (out,), |
| self.tx_id, |
| 0x70a02c2ba2228a33, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct WithProtocolEndsStructContainingEndsResponder { |
| control_handle: std::mem::ManuallyDrop<WithProtocolEndsControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`WithProtocolEndsControlHandle::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 WithProtocolEndsStructContainingEndsResponder { |
| 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 WithProtocolEndsStructContainingEndsResponder { |
| type ControlHandle = WithProtocolEndsControlHandle; |
| |
| fn control_handle(&self) -> &WithProtocolEndsControlHandle { |
| &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 WithProtocolEndsStructContainingEndsResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut out: ProtocolEnds) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(out); |
| 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 out: ProtocolEnds) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(out); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut out: ProtocolEnds) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<WithProtocolEndsStructContainingEndsResponse>( |
| (&mut out,), |
| self.tx_id, |
| 0x3893f0baad26f5d5, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| mod internal { |
| use super::*; |
| unsafe impl fidl::encoding::TypeMarker for ErrorEnum { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| std::mem::align_of::<u32>() |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| std::mem::size_of::<u32>() |
| } |
| |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| false |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for ErrorEnum { |
| type Borrowed<'a> = Self; |
| #[inline(always)] |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| *value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<Self> for ErrorEnum { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<Self>(offset); |
| encoder.write_num(self.into_primitive(), offset); |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ErrorEnum { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::ErrFoo |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let prim = decoder.read_num::<u32>(offset); |
| |
| *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolEventARequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| true |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for ChannelProtocolEventARequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolEventARequest> for &ChannelProtocolEventARequest { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolEventARequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut ChannelProtocolEventARequest) |
| .write_unaligned((self as *const ChannelProtocolEventARequest).read()); |
| // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be |
| // done second because the memcpy will write garbage to these bytes. |
| } |
| Ok(()) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<i64>, T1: fidl::encoding::Encode<i64>> |
| fidl::encoding::Encode<ChannelProtocolEventARequest> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolEventARequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolEventARequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(i64), b: fidl::new_empty!(i64) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) }; |
| // Verify that padding bytes are zero. |
| // Copy from the buffer into the object. |
| unsafe { |
| std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16); |
| } |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolMethodARequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| true |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for ChannelProtocolMethodARequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolMethodARequest> |
| for &ChannelProtocolMethodARequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMethodARequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut ChannelProtocolMethodARequest) |
| .write_unaligned((self as *const ChannelProtocolMethodARequest).read()); |
| // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be |
| // done second because the memcpy will write garbage to these bytes. |
| } |
| Ok(()) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<i64>, T1: fidl::encoding::Encode<i64>> |
| fidl::encoding::Encode<ChannelProtocolMethodARequest> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMethodARequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolMethodARequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(i64), b: fidl::new_empty!(i64) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) }; |
| // Verify that padding bytes are zero. |
| // Copy from the buffer into the object. |
| unsafe { |
| std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16); |
| } |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolMethodBRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| true |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for ChannelProtocolMethodBRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolMethodBRequest> |
| for &ChannelProtocolMethodBRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMethodBRequest>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut ChannelProtocolMethodBRequest) |
| .write_unaligned((self as *const ChannelProtocolMethodBRequest).read()); |
| // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be |
| // done second because the memcpy will write garbage to these bytes. |
| } |
| Ok(()) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<i64>, T1: fidl::encoding::Encode<i64>> |
| fidl::encoding::Encode<ChannelProtocolMethodBRequest> for (T0, T1) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMethodBRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolMethodBRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(i64), b: fidl::new_empty!(i64) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) }; |
| // Verify that padding bytes are zero. |
| // Copy from the buffer into the object. |
| unsafe { |
| std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16); |
| } |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolMethodBResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| true |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for ChannelProtocolMethodBResponse { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolMethodBResponse> |
| for &ChannelProtocolMethodBResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMethodBResponse>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut ChannelProtocolMethodBResponse) |
| .write_unaligned((self as *const ChannelProtocolMethodBResponse).read()); |
| // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be |
| // done second because the memcpy will write garbage to these bytes. |
| } |
| Ok(()) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<i64>> |
| fidl::encoding::Encode<ChannelProtocolMethodBResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMethodBResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolMethodBResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { result: fidl::new_empty!(i64) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) }; |
| // Verify that padding bytes are zero. |
| // Copy from the buffer into the object. |
| unsafe { |
| std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8); |
| } |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolMutateSocketRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for ChannelProtocolMutateSocketRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolMutateSocketRequest> |
| for &mut ChannelProtocolMutateSocketRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMutateSocketRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ChannelProtocolMutateSocketRequest>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 2147483648, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.a |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 2147483648, |
| >, |
| >, |
| > fidl::encoding::Encode<ChannelProtocolMutateSocketRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMutateSocketRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolMutateSocketRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| a: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, &mut self.a, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolMutateSocketResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for ChannelProtocolMutateSocketResponse { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolMutateSocketResponse> |
| for &mut ChannelProtocolMutateSocketResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMutateSocketResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ChannelProtocolMutateSocketResponse>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 2147483648, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.b |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 2147483648, |
| >, |
| >, |
| > fidl::encoding::Encode<ChannelProtocolMutateSocketResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolMutateSocketResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolMutateSocketResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| b: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, &mut self.b, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ChannelProtocolTakeHandleRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for ChannelProtocolTakeHandleRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ChannelProtocolTakeHandleRequest> |
| for &mut ChannelProtocolTakeHandleRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolTakeHandleRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ChannelProtocolTakeHandleRequest>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Handle, |
| { fidl::ObjectType::NONE.into_raw() }, |
| 2147483648, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.h |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Handle, |
| { fidl::ObjectType::NONE.into_raw() }, |
| 2147483648, |
| >, |
| >, |
| > fidl::encoding::Encode<ChannelProtocolTakeHandleRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ChannelProtocolTakeHandleRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ChannelProtocolTakeHandleRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, &mut self.h, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for HandleRightsProtocolAnEventRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolAnEventRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<HandleRightsProtocolAnEventRequest> |
| for &mut HandleRightsProtocolAnEventRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolAnEventRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<HandleRightsProtocolAnEventRequest>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 3, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.h |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 3, |
| >, |
| >, |
| > fidl::encoding::Encode<HandleRightsProtocolAnEventRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolAnEventRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for HandleRightsProtocolAnEventRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, &mut self.h, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for HandleRightsProtocolNoResponseMethodRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolNoResponseMethodRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<HandleRightsProtocolNoResponseMethodRequest> |
| for &mut HandleRightsProtocolNoResponseMethodRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolNoResponseMethodRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<HandleRightsProtocolNoResponseMethodRequest>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 3, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.h |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 3, |
| >, |
| >, |
| > fidl::encoding::Encode<HandleRightsProtocolNoResponseMethodRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolNoResponseMethodRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for HandleRightsProtocolNoResponseMethodRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, &mut self.h, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for HandleRightsProtocolResponseMethodRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolResponseMethodRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<HandleRightsProtocolResponseMethodRequest> |
| for &mut HandleRightsProtocolResponseMethodRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<HandleRightsProtocolResponseMethodRequest>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 3, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.h |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 3, |
| >, |
| >, |
| > fidl::encoding::Encode<HandleRightsProtocolResponseMethodRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for HandleRightsProtocolResponseMethodRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, &mut self.h, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for HandleRightsProtocolResponseMethodResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolResponseMethodResponse { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<HandleRightsProtocolResponseMethodResponse> |
| for &mut HandleRightsProtocolResponseMethodResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<HandleRightsProtocolResponseMethodResponse>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 2, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.h |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Socket, |
| { fidl::ObjectType::SOCKET.into_raw() }, |
| 2, |
| >, |
| >, |
| > fidl::encoding::Encode<HandleRightsProtocolResponseMethodResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for HandleRightsProtocolResponseMethodResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2>, &mut self.h, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ManyParametersFifteenRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 1 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 15 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for ManyParametersFifteenRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ManyParametersFifteenRequest> for &ManyParametersFifteenRequest { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ManyParametersFifteenRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ManyParametersFifteenRequest>::encode( |
| ( |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p1), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p2), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p3), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p4), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p5), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p6), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p7), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p8), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p9), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p10), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p11), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p12), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p13), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p14), |
| <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.p15), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode<bool>, |
| T1: fidl::encoding::Encode<bool>, |
| T2: fidl::encoding::Encode<bool>, |
| T3: fidl::encoding::Encode<bool>, |
| T4: fidl::encoding::Encode<bool>, |
| T5: fidl::encoding::Encode<bool>, |
| T6: fidl::encoding::Encode<bool>, |
| T7: fidl::encoding::Encode<bool>, |
| T8: fidl::encoding::Encode<bool>, |
| T9: fidl::encoding::Encode<bool>, |
| T10: fidl::encoding::Encode<bool>, |
| T11: fidl::encoding::Encode<bool>, |
| T12: fidl::encoding::Encode<bool>, |
| T13: fidl::encoding::Encode<bool>, |
| T14: fidl::encoding::Encode<bool>, |
| > fidl::encoding::Encode<ManyParametersFifteenRequest> |
| for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ManyParametersFifteenRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 1, depth)?; |
| self.2.encode(encoder, offset + 2, depth)?; |
| self.3.encode(encoder, offset + 3, depth)?; |
| self.4.encode(encoder, offset + 4, depth)?; |
| self.5.encode(encoder, offset + 5, depth)?; |
| self.6.encode(encoder, offset + 6, depth)?; |
| self.7.encode(encoder, offset + 7, depth)?; |
| self.8.encode(encoder, offset + 8, depth)?; |
| self.9.encode(encoder, offset + 9, depth)?; |
| self.10.encode(encoder, offset + 10, depth)?; |
| self.11.encode(encoder, offset + 11, depth)?; |
| self.12.encode(encoder, offset + 12, depth)?; |
| self.13.encode(encoder, offset + 13, depth)?; |
| self.14.encode(encoder, offset + 14, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ManyParametersFifteenRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| p1: fidl::new_empty!(bool), |
| p2: fidl::new_empty!(bool), |
| p3: fidl::new_empty!(bool), |
| p4: fidl::new_empty!(bool), |
| p5: fidl::new_empty!(bool), |
| p6: fidl::new_empty!(bool), |
| p7: fidl::new_empty!(bool), |
| p8: fidl::new_empty!(bool), |
| p9: fidl::new_empty!(bool), |
| p10: fidl::new_empty!(bool), |
| p11: fidl::new_empty!(bool), |
| p12: fidl::new_empty!(bool), |
| p13: fidl::new_empty!(bool), |
| p14: fidl::new_empty!(bool), |
| p15: fidl::new_empty!(bool), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(bool, &mut self.p1, decoder, offset + 0, _depth)?; |
| fidl::decode!(bool, &mut self.p2, decoder, offset + 1, _depth)?; |
| fidl::decode!(bool, &mut self.p3, decoder, offset + 2, _depth)?; |
| fidl::decode!(bool, &mut self.p4, decoder, offset + 3, _depth)?; |
| fidl::decode!(bool, &mut self.p5, decoder, offset + 4, _depth)?; |
| fidl::decode!(bool, &mut self.p6, decoder, offset + 5, _depth)?; |
| fidl::decode!(bool, &mut self.p7, decoder, offset + 6, _depth)?; |
| fidl::decode!(bool, &mut self.p8, decoder, offset + 7, _depth)?; |
| fidl::decode!(bool, &mut self.p9, decoder, offset + 8, _depth)?; |
| fidl::decode!(bool, &mut self.p10, decoder, offset + 9, _depth)?; |
| fidl::decode!(bool, &mut self.p11, decoder, offset + 10, _depth)?; |
| fidl::decode!(bool, &mut self.p12, decoder, offset + 11, _depth)?; |
| fidl::decode!(bool, &mut self.p13, decoder, offset + 12, _depth)?; |
| fidl::decode!(bool, &mut self.p14, decoder, offset + 13, _depth)?; |
| fidl::decode!(bool, &mut self.p15, decoder, offset + 14, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MethodWithUnionUnionMethodRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for MethodWithUnionUnionMethodRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<MethodWithUnionUnionMethodRequest> |
| for &MethodWithUnionUnionMethodRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MethodWithUnionUnionMethodRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<MethodWithUnionUnionMethodRequest>::encode( |
| (<TheUnion as fidl::encoding::ValueTypeMarker>::borrow(&self.u),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<TheUnion>> |
| fidl::encoding::Encode<MethodWithUnionUnionMethodRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MethodWithUnionUnionMethodRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for MethodWithUnionUnionMethodRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { u: fidl::new_empty!(TheUnion) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(TheUnion, &mut self.u, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for MethodWithUnionUnionMethodResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for MethodWithUnionUnionMethodResponse { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<MethodWithUnionUnionMethodResponse> |
| for &MethodWithUnionUnionMethodResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MethodWithUnionUnionMethodResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<MethodWithUnionUnionMethodResponse>::encode( |
| ( |
| <fidl::encoding::OptionalUnion<TheUnion> as fidl::encoding::ValueTypeMarker>::borrow(&self.u), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<TheUnion>>> |
| fidl::encoding::Encode<MethodWithUnionUnionMethodResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<MethodWithUnionUnionMethodResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for MethodWithUnionUnionMethodResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { u: fidl::new_empty!(fidl::encoding::OptionalUnion<TheUnion>) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::OptionalUnion<TheUnion>, |
| &mut self.u, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for ProtocolEnds { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for ProtocolEnds { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<ProtocolEnds> for &mut ProtocolEnds { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ProtocolEnds>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ProtocolEnds>::encode( |
| ( |
| <fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.client |
| ), |
| <fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.server |
| ), |
| <fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.client_opt |
| ), |
| <fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.server_opt |
| ), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| >, |
| T1: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| >, |
| T2: fidl::encoding::Encode< |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| >, |
| T3: fidl::encoding::Encode< |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| >, |
| > fidl::encoding::Encode<ProtocolEnds> for (T0, T1, T2, T3) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ProtocolEnds>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 4, depth)?; |
| self.2.encode(encoder, offset + 8, depth)?; |
| self.3.encode(encoder, offset + 12, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for ProtocolEnds { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| client: fidl::new_empty!( |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| > |
| ), |
| server: fidl::new_empty!( |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| > |
| ), |
| client_opt: fidl::new_empty!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| > |
| ), |
| server_opt: fidl::new_empty!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| > |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| &mut self.client, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| fidl::decode!( |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| &mut self.server, |
| decoder, |
| offset + 4, |
| _depth |
| )?; |
| fidl::decode!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| &mut self.client_opt, |
| decoder, |
| offset + 8, |
| _depth |
| )?; |
| fidl::decode!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| &mut self.server_opt, |
| decoder, |
| offset + 12, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker |
| for WithAndWithoutRequestResponseNoRequestWithResponseResponse |
| { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker |
| for WithAndWithoutRequestResponseNoRequestWithResponseResponse |
| { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithAndWithoutRequestResponseNoRequestWithResponseResponse> |
| for &WithAndWithoutRequestResponseNoRequestWithResponseResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseNoRequestWithResponseResponse>( |
| offset, |
| ); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithAndWithoutRequestResponseNoRequestWithResponseResponse>::encode( |
| ( |
| <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.ret), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>> |
| fidl::encoding::Encode<WithAndWithoutRequestResponseNoRequestWithResponseResponse> |
| for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseNoRequestWithResponseResponse>( |
| offset, |
| ); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithAndWithoutRequestResponseNoRequestWithResponseResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { ret: fidl::new_empty!(fidl::encoding::UnboundedString) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::UnboundedString, |
| &mut self.ret, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithAndWithoutRequestResponseOnWithResponseRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for WithAndWithoutRequestResponseOnWithResponseRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithAndWithoutRequestResponseOnWithResponseRequest> |
| for &WithAndWithoutRequestResponseOnWithResponseRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseOnWithResponseRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithAndWithoutRequestResponseOnWithResponseRequest>::encode( |
| (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow( |
| &self.ret, |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>> |
| fidl::encoding::Encode<WithAndWithoutRequestResponseOnWithResponseRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseOnWithResponseRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithAndWithoutRequestResponseOnWithResponseRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { ret: fidl::new_empty!(fidl::encoding::UnboundedString) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::UnboundedString, |
| &mut self.ret, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker |
| for WithAndWithoutRequestResponseWithRequestEmptyResponseRequest |
| { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker |
| for WithAndWithoutRequestResponseWithRequestEmptyResponseRequest |
| { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest> |
| for &WithAndWithoutRequestResponseWithRequestEmptyResponseRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest>( |
| offset, |
| ); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest>::encode( |
| ( |
| <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.arg), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>> |
| fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest> |
| for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest>( |
| offset, |
| ); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithAndWithoutRequestResponseWithRequestEmptyResponseRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { arg: fidl::new_empty!(fidl::encoding::UnboundedString) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::UnboundedString, |
| &mut self.arg, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker |
| for WithAndWithoutRequestResponseWithRequestNoResponseRequest |
| { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for WithAndWithoutRequestResponseWithRequestNoResponseRequest { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestNoResponseRequest> |
| for &WithAndWithoutRequestResponseWithRequestNoResponseRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>( |
| offset, |
| ); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>::encode( |
| ( |
| <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.arg), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>> |
| fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestNoResponseRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>( |
| offset, |
| ); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithAndWithoutRequestResponseWithRequestNoResponseRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { arg: fidl::new_empty!(fidl::encoding::UnboundedString) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::UnboundedString, |
| &mut self.arg, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker |
| for WithAndWithoutRequestResponseWithRequestWithResponseRequest |
| { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker |
| for WithAndWithoutRequestResponseWithRequestWithResponseRequest |
| { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestWithResponseRequest> |
| for &WithAndWithoutRequestResponseWithRequestWithResponseRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestWithResponseRequest>( |
| offset, |
| ); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithAndWithoutRequestResponseWithRequestWithResponseRequest>::encode( |
| ( |
| <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.arg), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>> |
| fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestWithResponseRequest> |
| for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestWithResponseRequest>( |
| offset, |
| ); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithAndWithoutRequestResponseWithRequestWithResponseRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { arg: fidl::new_empty!(fidl::encoding::UnboundedString) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::UnboundedString, |
| &mut self.arg, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker |
| for WithAndWithoutRequestResponseWithRequestWithResponseResponse |
| { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker |
| for WithAndWithoutRequestResponseWithRequestWithResponseResponse |
| { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestWithResponseResponse> |
| for &WithAndWithoutRequestResponseWithRequestWithResponseResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestWithResponseResponse>( |
| offset, |
| ); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithAndWithoutRequestResponseWithRequestWithResponseResponse>::encode( |
| ( |
| <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.ret), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>> |
| fidl::encoding::Encode<WithAndWithoutRequestResponseWithRequestWithResponseResponse> |
| for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder |
| .debug_check_bounds::<WithAndWithoutRequestResponseWithRequestWithResponseResponse>( |
| offset, |
| ); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithAndWithoutRequestResponseWithRequestWithResponseResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { ret: fidl::new_empty!(fidl::encoding::UnboundedString) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::UnboundedString, |
| &mut self.ret, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithErrorSyntaxHandleInResultResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithErrorSyntaxHandleInResultResponse { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithErrorSyntaxHandleInResultResponse> |
| for &mut WithErrorSyntaxHandleInResultResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithErrorSyntaxHandleInResultResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithErrorSyntaxHandleInResultResponse>::encode( |
| (<fidl::encoding::HandleType< |
| fidl::Handle, |
| { fidl::ObjectType::NONE.into_raw() }, |
| 2147483648, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.h |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::HandleType< |
| fidl::Handle, |
| { fidl::ObjectType::NONE.into_raw() }, |
| 2147483648, |
| >, |
| >, |
| > fidl::encoding::Encode<WithErrorSyntaxHandleInResultResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithErrorSyntaxHandleInResultResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithErrorSyntaxHandleInResultResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, &mut self.h, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithErrorSyntaxResponseAsStructResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 24 |
| } |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| true |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for WithErrorSyntaxResponseAsStructResponse { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithErrorSyntaxResponseAsStructResponse> |
| for &WithErrorSyntaxResponseAsStructResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithErrorSyntaxResponseAsStructResponse>(offset); |
| unsafe { |
| // Copy the object into the buffer. |
| let buf_ptr = encoder.buf.as_mut_ptr().add(offset); |
| (buf_ptr as *mut WithErrorSyntaxResponseAsStructResponse).write_unaligned( |
| (self as *const WithErrorSyntaxResponseAsStructResponse).read(), |
| ); |
| // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be |
| // done second because the memcpy will write garbage to these bytes. |
| } |
| Ok(()) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode<i64>, |
| T1: fidl::encoding::Encode<i64>, |
| T2: fidl::encoding::Encode<i64>, |
| > fidl::encoding::Encode<WithErrorSyntaxResponseAsStructResponse> for (T0, T1, T2) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithErrorSyntaxResponseAsStructResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| self.1.encode(encoder, offset + 8, depth)?; |
| self.2.encode(encoder, offset + 16, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithErrorSyntaxResponseAsStructResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { a: fidl::new_empty!(i64), b: fidl::new_empty!(i64), c: fidl::new_empty!(i64) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) }; |
| // Verify that padding bytes are zero. |
| // Copy from the buffer into the object. |
| unsafe { |
| std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24); |
| } |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithProtocolEndsClientEndsRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsClientEndsRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithProtocolEndsClientEndsRequest> |
| for &mut WithProtocolEndsClientEndsRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsClientEndsRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithProtocolEndsClientEndsRequest>::encode( |
| ( |
| <fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.in_ |
| ), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| >, |
| > fidl::encoding::Encode<WithProtocolEndsClientEndsRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsClientEndsRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithProtocolEndsClientEndsRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| in_: fidl::new_empty!( |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| > |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, |
| &mut self.in_, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithProtocolEndsClientEndsResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsClientEndsResponse { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithProtocolEndsClientEndsResponse> |
| for &mut WithProtocolEndsClientEndsResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsClientEndsResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithProtocolEndsClientEndsResponse>::encode( |
| (<fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.out |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| >, |
| > fidl::encoding::Encode<WithProtocolEndsClientEndsResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsClientEndsResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithProtocolEndsClientEndsResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| out: fidl::new_empty!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| > |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| &mut self.out, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithProtocolEndsServerEndsRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsServerEndsRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithProtocolEndsServerEndsRequest> |
| for &mut WithProtocolEndsServerEndsRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsServerEndsRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithProtocolEndsServerEndsRequest>::encode( |
| (<fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.in_ |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| >, |
| > fidl::encoding::Encode<WithProtocolEndsServerEndsRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsServerEndsRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithProtocolEndsServerEndsRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| in_: fidl::new_empty!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| > |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::Optional< |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| >, |
| >, |
| &mut self.in_, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithProtocolEndsServerEndsResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsServerEndsResponse { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithProtocolEndsServerEndsResponse> |
| for &mut WithProtocolEndsServerEndsResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsServerEndsResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithProtocolEndsServerEndsResponse>::encode( |
| ( |
| <fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| > as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.out |
| ), |
| ), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| >, |
| > fidl::encoding::Encode<WithProtocolEndsServerEndsResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsServerEndsResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithProtocolEndsServerEndsResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| out: fidl::new_empty!( |
| fidl::encoding::Endpoint< |
| fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, |
| > |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!( |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>, |
| &mut self.out, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithProtocolEndsStructContainingEndsRequest { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsStructContainingEndsRequest { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithProtocolEndsStructContainingEndsRequest> |
| for &mut WithProtocolEndsStructContainingEndsRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithProtocolEndsStructContainingEndsRequest>::encode( |
| (<ProtocolEnds as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.in_, |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<ProtocolEnds>> |
| fidl::encoding::Encode<WithProtocolEndsStructContainingEndsRequest> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsRequest>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithProtocolEndsStructContainingEndsRequest { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { in_: fidl::new_empty!(ProtocolEnds) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(ProtocolEnds, &mut self.in_, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for WithProtocolEndsStructContainingEndsResponse { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 4 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsStructContainingEndsResponse { |
| type Borrowed<'a> = &'a mut Self; |
| fn take_or_borrow<'a>( |
| value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<WithProtocolEndsStructContainingEndsResponse> |
| for &mut WithProtocolEndsStructContainingEndsResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<WithProtocolEndsStructContainingEndsResponse>::encode( |
| (<ProtocolEnds as fidl::encoding::ResourceTypeMarker>::take_or_borrow( |
| &mut self.out, |
| ),), |
| encoder, |
| offset, |
| _depth, |
| ) |
| } |
| } |
| unsafe impl<T0: fidl::encoding::Encode<ProtocolEnds>> |
| fidl::encoding::Encode<WithProtocolEndsStructContainingEndsResponse> for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsResponse>(offset); |
| // Zero out padding regions. There's no need to apply masks |
| // because the unmasked parts will be overwritten by fields. |
| // Write the fields. |
| self.0.encode(encoder, offset + 0, depth)?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for WithProtocolEndsStructContainingEndsResponse { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { out: fidl::new_empty!(ProtocolEnds) } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| // Verify that padding bytes are zero. |
| fidl::decode!(ProtocolEnds, &mut self.out, decoder, offset + 0, _depth)?; |
| Ok(()) |
| } |
| } |
| |
| unsafe impl fidl::encoding::TypeMarker for TheUnion { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| 8 |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| 16 |
| } |
| } |
| impl fidl::encoding::ValueTypeMarker for TheUnion { |
| type Borrowed<'a> = &'a Self; |
| fn borrow<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<TheUnion> for &TheUnion { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<TheUnion>(offset); |
| encoder.write_num::<u64>(self.ordinal(), offset); |
| match self { |
| TheUnion::V(ref val) => fidl::encoding::encode_in_envelope::<u32>( |
| <u32 as fidl::encoding::ValueTypeMarker>::borrow(val), |
| encoder, |
| offset + 8, |
| _depth, |
| ), |
| TheUnion::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag), |
| } |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for TheUnion { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::__SourceBreaking { unknown_ordinal: 0 } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| mut depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| #[allow(unused_variables)] |
| let next_out_of_line = decoder.next_out_of_line(); |
| let handles_before = decoder.remaining_handles(); |
| let (ordinal, inlined, num_bytes, num_handles) = |
| fidl::encoding::decode_union_inline_portion(decoder, offset)?; |
| |
| let member_inline_size = match ordinal { |
| 1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context), |
| 0 => return Err(fidl::Error::UnknownUnionTag), |
| _ => num_bytes as usize, |
| }; |
| |
| if inlined != (member_inline_size <= 4) { |
| return Err(fidl::Error::InvalidInlineBitInEnvelope); |
| } |
| let _inner_offset; |
| if inlined { |
| decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?; |
| _inner_offset = offset + 8; |
| } else { |
| depth.increment()?; |
| _inner_offset = decoder.out_of_line_offset(member_inline_size)?; |
| } |
| match ordinal { |
| 1 => { |
| #[allow(irrefutable_let_patterns)] |
| if let TheUnion::V(_) = self { |
| // Do nothing, read the value into the object |
| } else { |
| // Initialize `self` to the right variant |
| *self = TheUnion::V(fidl::new_empty!(u32)); |
| } |
| #[allow(irrefutable_let_patterns)] |
| if let TheUnion::V(ref mut val) = self { |
| fidl::decode!(u32, val, decoder, _inner_offset, depth)?; |
| } else { |
| unreachable!() |
| } |
| } |
| #[allow(deprecated)] |
| ordinal => { |
| for _ in 0..num_handles { |
| decoder.drop_next_handle()?; |
| } |
| *self = TheUnion::__SourceBreaking { unknown_ordinal: ordinal }; |
| } |
| } |
| if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) { |
| return Err(fidl::Error::InvalidNumBytesInEnvelope); |
| } |
| if handles_before != decoder.remaining_handles() + (num_handles as usize) { |
| return Err(fidl::Error::InvalidNumHandlesInEnvelope); |
| } |
| Ok(()) |
| } |
| } |
| } |