| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)] |
| |
| use bitflags::bitflags; |
| use fidl::client::QueryResponseFut; |
| use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect}; |
| use fidl::endpoints::{ControlHandle as _, Responder as _}; |
| pub use fidl_test_protocolrequest__common::*; |
| use futures::future::{self, MaybeDone, TryFutureExt}; |
| use zx_status; |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ParentGetChildRequestResponse { |
| pub r: fidl::endpoints::ServerEnd<ChildMarker>, |
| } |
| |
| impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> |
| for ParentGetChildRequestResponse |
| { |
| } |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ParentGetChildResponse { |
| pub c: fidl::endpoints::ClientEnd<ChildMarker>, |
| } |
| |
| impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ParentGetChildResponse {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ParentTakeChildRequest { |
| pub c: fidl::endpoints::ClientEnd<ChildMarker>, |
| } |
| |
| impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ParentTakeChildRequest {} |
| |
| #[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| pub struct ParentTakeChildRequestRequest { |
| pub r: fidl::endpoints::ServerEnd<ChildMarker>, |
| } |
| |
| impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> |
| for ParentTakeChildRequestRequest |
| { |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct ChildMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for ChildMarker { |
| type Proxy = ChildProxy; |
| type RequestStream = ChildRequestStream; |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = ChildSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) Child"; |
| } |
| |
| pub trait ChildProxyInterface: Send + Sync {} |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct ChildSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for ChildSynchronousProxy { |
| type Proxy = ChildProxy; |
| type Protocol = ChildMarker; |
| |
| 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 ChildSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <ChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME; |
| Self { client: fidl::client::sync::Client::new(channel, protocol_name) } |
| } |
| |
| pub fn into_channel(self) -> fidl::Channel { |
| self.client.into_channel() |
| } |
| |
| /// Waits until an event arrives and returns it. It is safe for other |
| /// threads to make concurrent requests while waiting for an event. |
| pub fn wait_for_event( |
| &self, |
| deadline: zx::MonotonicInstant, |
| ) -> Result<ChildEvent, fidl::Error> { |
| ChildEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<ChildSynchronousProxy> for zx::Handle { |
| fn from(value: ChildSynchronousProxy) -> Self { |
| value.into_channel().into() |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<fidl::Channel> for ChildSynchronousProxy { |
| fn from(value: fidl::Channel) -> Self { |
| Self::new(value) |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::FromClient for ChildSynchronousProxy { |
| type Protocol = ChildMarker; |
| |
| fn from_client(value: fidl::endpoints::ClientEnd<ChildMarker>) -> Self { |
| Self::new(value.into_channel()) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ChildProxy { |
| client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl fidl::endpoints::Proxy for ChildProxy { |
| type Protocol = ChildMarker; |
| |
| 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 ChildProxy { |
| /// Create a new Proxy for test.protocolrequest/Child. |
| pub fn new(channel: ::fidl::AsyncChannel) -> Self { |
| let protocol_name = <ChildMarker 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) -> ChildEventStream { |
| ChildEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| } |
| |
| impl ChildProxyInterface for ChildProxy {} |
| |
| pub struct ChildEventStream { |
| event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl std::marker::Unpin for ChildEventStream {} |
| |
| impl futures::stream::FusedStream for ChildEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for ChildEventStream { |
| type Item = Result<ChildEvent, 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(ChildEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ChildEvent {} |
| |
| impl ChildEvent { |
| /// Decodes a message buffer as a [`ChildEvent`]. |
| fn decode( |
| mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, |
| ) -> Result<ChildEvent, 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: <ChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocolrequest/Child. |
| pub struct ChildRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for ChildRequestStream {} |
| |
| impl futures::stream::FusedStream for ChildRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for ChildRequestStream { |
| type Protocol = ChildMarker; |
| type ControlHandle = ChildControlHandle; |
| |
| 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 { |
| ChildControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner( |
| self, |
| ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool) |
| { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner( |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| ) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for ChildRequestStream { |
| type Item = Result<ChildRequest, 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 ChildRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>( |
| |bytes, handles| { |
| match this.inner.channel().read_etc(cx, bytes, handles) { |
| std::task::Poll::Ready(Ok(())) => {} |
| std::task::Poll::Pending => return std::task::Poll::Pending, |
| std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => { |
| this.is_terminated = true; |
| return std::task::Poll::Ready(None); |
| } |
| std::task::Poll::Ready(Err(e)) => { |
| return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead( |
| e.into(), |
| )))); |
| } |
| } |
| |
| // A message has been received from the channel |
| let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| std::task::Poll::Ready(Some(match header.ordinal { |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: <ChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }, |
| ) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ChildRequest {} |
| |
| impl ChildRequest { |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self {} |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ChildControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for ChildControlHandle { |
| fn shutdown(&self) { |
| self.inner.shutdown() |
| } |
| fn shutdown_with_epitaph(&self, status: zx_status::Status) { |
| self.inner.shutdown_with_epitaph(status) |
| } |
| |
| fn is_closed(&self) -> bool { |
| self.inner.channel().is_closed() |
| } |
| fn on_closed(&self) -> fidl::OnSignalsRef<'_> { |
| self.inner.channel().on_closed() |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| fn signal_peer( |
| &self, |
| clear_mask: zx::Signals, |
| set_mask: zx::Signals, |
| ) -> Result<(), zx_status::Status> { |
| use fidl::Peered; |
| self.inner.channel().signal_peer(clear_mask, set_mask) |
| } |
| } |
| |
| impl ChildControlHandle {} |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct ParentMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for ParentMarker { |
| type Proxy = ParentProxy; |
| type RequestStream = ParentRequestStream; |
| #[cfg(target_os = "fuchsia")] |
| type SynchronousProxy = ParentSynchronousProxy; |
| |
| const DEBUG_NAME: &'static str = "(anonymous) Parent"; |
| } |
| |
| pub trait ParentProxyInterface: Send + Sync { |
| type GetChildResponseFut: std::future::Future<Output = Result<fidl::endpoints::ClientEnd<ChildMarker>, fidl::Error>> |
| + Send; |
| fn r#get_child(&self) -> Self::GetChildResponseFut; |
| type GetChildRequestResponseFut: std::future::Future<Output = Result<fidl::endpoints::ServerEnd<ChildMarker>, fidl::Error>> |
| + Send; |
| fn r#get_child_request(&self) -> Self::GetChildRequestResponseFut; |
| fn r#take_child(&self, c: fidl::endpoints::ClientEnd<ChildMarker>) -> Result<(), fidl::Error>; |
| fn r#take_child_request( |
| &self, |
| r: fidl::endpoints::ServerEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error>; |
| } |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct ParentSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::SynchronousProxy for ParentSynchronousProxy { |
| type Proxy = ParentProxy; |
| type Protocol = ParentMarker; |
| |
| 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 ParentSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <ParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME; |
| Self { client: fidl::client::sync::Client::new(channel, protocol_name) } |
| } |
| |
| pub fn into_channel(self) -> fidl::Channel { |
| self.client.into_channel() |
| } |
| |
| /// Waits until an event arrives and returns it. It is safe for other |
| /// threads to make concurrent requests while waiting for an event. |
| pub fn wait_for_event( |
| &self, |
| deadline: zx::MonotonicInstant, |
| ) -> Result<ParentEvent, fidl::Error> { |
| ParentEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| |
| pub fn r#get_child( |
| &self, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<fidl::endpoints::ClientEnd<ChildMarker>, fidl::Error> { |
| let _response = |
| self.client.send_query::<fidl::encoding::EmptyPayload, ParentGetChildResponse>( |
| (), |
| 0xc3cd963aafc873b, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.c) |
| } |
| |
| pub fn r#get_child_request( |
| &self, |
| ___deadline: zx::MonotonicInstant, |
| ) -> Result<fidl::endpoints::ServerEnd<ChildMarker>, fidl::Error> { |
| let _response = |
| self.client.send_query::<fidl::encoding::EmptyPayload, ParentGetChildRequestResponse>( |
| (), |
| 0xf38d08d64f71c79, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_response.r) |
| } |
| |
| pub fn r#take_child( |
| &self, |
| mut c: fidl::endpoints::ClientEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ParentTakeChildRequest>( |
| (c,), |
| 0x3e08fd7ca04b2290, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| pub fn r#take_child_request( |
| &self, |
| mut r: fidl::endpoints::ServerEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ParentTakeChildRequestRequest>( |
| (r,), |
| 0x2063f76b1bb45f87, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<ParentSynchronousProxy> for zx::Handle { |
| fn from(value: ParentSynchronousProxy) -> Self { |
| value.into_channel().into() |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl From<fidl::Channel> for ParentSynchronousProxy { |
| fn from(value: fidl::Channel) -> Self { |
| Self::new(value) |
| } |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl fidl::endpoints::FromClient for ParentSynchronousProxy { |
| type Protocol = ParentMarker; |
| |
| fn from_client(value: fidl::endpoints::ClientEnd<ParentMarker>) -> Self { |
| Self::new(value.into_channel()) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ParentProxy { |
| client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl fidl::endpoints::Proxy for ParentProxy { |
| type Protocol = ParentMarker; |
| |
| 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 ParentProxy { |
| /// Create a new Proxy for test.protocolrequest/Parent. |
| pub fn new(channel: ::fidl::AsyncChannel) -> Self { |
| let protocol_name = <ParentMarker 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) -> ParentEventStream { |
| ParentEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| |
| pub fn r#get_child( |
| &self, |
| ) -> fidl::client::QueryResponseFut< |
| fidl::endpoints::ClientEnd<ChildMarker>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| ParentProxyInterface::r#get_child(self) |
| } |
| |
| pub fn r#get_child_request( |
| &self, |
| ) -> fidl::client::QueryResponseFut< |
| fidl::endpoints::ServerEnd<ChildMarker>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > { |
| ParentProxyInterface::r#get_child_request(self) |
| } |
| |
| pub fn r#take_child( |
| &self, |
| mut c: fidl::endpoints::ClientEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| ParentProxyInterface::r#take_child(self, c) |
| } |
| |
| pub fn r#take_child_request( |
| &self, |
| mut r: fidl::endpoints::ServerEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| ParentProxyInterface::r#take_child_request(self, r) |
| } |
| } |
| |
| impl ParentProxyInterface for ParentProxy { |
| type GetChildResponseFut = fidl::client::QueryResponseFut< |
| fidl::endpoints::ClientEnd<ChildMarker>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#get_child(&self) -> Self::GetChildResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<fidl::endpoints::ClientEnd<ChildMarker>, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| ParentGetChildResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0xc3cd963aafc873b, |
| >(_buf?)?; |
| Ok(_response.c) |
| } |
| self.client.send_query_and_decode::< |
| fidl::encoding::EmptyPayload, |
| fidl::endpoints::ClientEnd<ChildMarker>, |
| >( |
| (), |
| 0xc3cd963aafc873b, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| type GetChildRequestResponseFut = fidl::client::QueryResponseFut< |
| fidl::endpoints::ServerEnd<ChildMarker>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >; |
| fn r#get_child_request(&self) -> Self::GetChildRequestResponseFut { |
| fn _decode( |
| mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>, |
| ) -> Result<fidl::endpoints::ServerEnd<ChildMarker>, fidl::Error> { |
| let _response = fidl::client::decode_transaction_body::< |
| ParentGetChildRequestResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| 0xf38d08d64f71c79, |
| >(_buf?)?; |
| Ok(_response.r) |
| } |
| self.client.send_query_and_decode::< |
| fidl::encoding::EmptyPayload, |
| fidl::endpoints::ServerEnd<ChildMarker>, |
| >( |
| (), |
| 0xf38d08d64f71c79, |
| fidl::encoding::DynamicFlags::empty(), |
| _decode, |
| ) |
| } |
| |
| fn r#take_child( |
| &self, |
| mut c: fidl::endpoints::ClientEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ParentTakeChildRequest>( |
| (c,), |
| 0x3e08fd7ca04b2290, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| |
| fn r#take_child_request( |
| &self, |
| mut r: fidl::endpoints::ServerEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<ParentTakeChildRequestRequest>( |
| (r,), |
| 0x2063f76b1bb45f87, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| pub struct ParentEventStream { |
| event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>, |
| } |
| |
| impl std::marker::Unpin for ParentEventStream {} |
| |
| impl futures::stream::FusedStream for ParentEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for ParentEventStream { |
| type Item = Result<ParentEvent, 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(ParentEvent::decode(buf))), |
| None => std::task::Poll::Ready(None), |
| } |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ParentEvent {} |
| |
| impl ParentEvent { |
| /// Decodes a message buffer as a [`ParentEvent`]. |
| fn decode( |
| mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, |
| ) -> Result<ParentEvent, 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: <ParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for test.protocolrequest/Parent. |
| pub struct ParentRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for ParentRequestStream {} |
| |
| impl futures::stream::FusedStream for ParentRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for ParentRequestStream { |
| type Protocol = ParentMarker; |
| type ControlHandle = ParentControlHandle; |
| |
| 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 { |
| ParentControlHandle { inner: self.inner.clone() } |
| } |
| |
| fn into_inner( |
| self, |
| ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool) |
| { |
| (self.inner, self.is_terminated) |
| } |
| |
| fn from_inner( |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| is_terminated: bool, |
| ) -> Self { |
| Self { inner, is_terminated } |
| } |
| } |
| |
| impl futures::Stream for ParentRequestStream { |
| type Item = Result<ParentRequest, 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 ParentRequestStream after completion"); |
| } |
| fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>( |
| |bytes, handles| { |
| match this.inner.channel().read_etc(cx, bytes, handles) { |
| std::task::Poll::Ready(Ok(())) => {} |
| std::task::Poll::Pending => return std::task::Poll::Pending, |
| std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => { |
| this.is_terminated = true; |
| return std::task::Poll::Ready(None); |
| } |
| std::task::Poll::Ready(Err(e)) => { |
| return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead( |
| e.into(), |
| )))); |
| } |
| } |
| |
| // A message has been received from the channel |
| let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| std::task::Poll::Ready(Some(match header.ordinal { |
| 0xc3cd963aafc873b => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| fidl::encoding::EmptyPayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = ParentControlHandle { inner: this.inner.clone() }; |
| Ok(ParentRequest::GetChild { |
| responder: ParentGetChildResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0xf38d08d64f71c79 => { |
| header.validate_request_tx_id(fidl::MethodType::TwoWay)?; |
| let mut req = fidl::new_empty!( |
| fidl::encoding::EmptyPayload, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = ParentControlHandle { inner: this.inner.clone() }; |
| Ok(ParentRequest::GetChildRequest { |
| responder: ParentGetChildRequestResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id, |
| }, |
| }) |
| } |
| 0x3e08fd7ca04b2290 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| ParentTakeChildRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ParentTakeChildRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = ParentControlHandle { inner: this.inner.clone() }; |
| Ok(ParentRequest::TakeChild { c: req.c, control_handle }) |
| } |
| 0x2063f76b1bb45f87 => { |
| header.validate_request_tx_id(fidl::MethodType::OneWay)?; |
| let mut req = fidl::new_empty!( |
| ParentTakeChildRequestRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ); |
| fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ParentTakeChildRequestRequest>(&header, _body_bytes, handles, &mut req)?; |
| let control_handle = ParentControlHandle { inner: this.inner.clone() }; |
| Ok(ParentRequest::TakeChildRequest { r: req.r, control_handle }) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: header.ordinal, |
| protocol_name: |
| <ParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }, |
| ) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ParentRequest { |
| GetChild { |
| responder: ParentGetChildResponder, |
| }, |
| GetChildRequest { |
| responder: ParentGetChildRequestResponder, |
| }, |
| TakeChild { |
| c: fidl::endpoints::ClientEnd<ChildMarker>, |
| control_handle: ParentControlHandle, |
| }, |
| TakeChildRequest { |
| r: fidl::endpoints::ServerEnd<ChildMarker>, |
| control_handle: ParentControlHandle, |
| }, |
| } |
| |
| impl ParentRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_get_child(self) -> Option<(ParentGetChildResponder)> { |
| if let ParentRequest::GetChild { responder } = self { Some((responder)) } else { None } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_get_child_request(self) -> Option<(ParentGetChildRequestResponder)> { |
| if let ParentRequest::GetChildRequest { responder } = self { |
| Some((responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_take_child( |
| self, |
| ) -> Option<(fidl::endpoints::ClientEnd<ChildMarker>, ParentControlHandle)> { |
| if let ParentRequest::TakeChild { c, control_handle } = self { |
| Some((c, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_take_child_request( |
| self, |
| ) -> Option<(fidl::endpoints::ServerEnd<ChildMarker>, ParentControlHandle)> { |
| if let ParentRequest::TakeChildRequest { r, control_handle } = self { |
| Some((r, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| ParentRequest::GetChild { .. } => "get_child", |
| ParentRequest::GetChildRequest { .. } => "get_child_request", |
| ParentRequest::TakeChild { .. } => "take_child", |
| ParentRequest::TakeChildRequest { .. } => "take_child_request", |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ParentControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for ParentControlHandle { |
| fn shutdown(&self) { |
| self.inner.shutdown() |
| } |
| fn shutdown_with_epitaph(&self, status: zx_status::Status) { |
| self.inner.shutdown_with_epitaph(status) |
| } |
| |
| fn is_closed(&self) -> bool { |
| self.inner.channel().is_closed() |
| } |
| fn on_closed(&self) -> fidl::OnSignalsRef<'_> { |
| self.inner.channel().on_closed() |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| fn signal_peer( |
| &self, |
| clear_mask: zx::Signals, |
| set_mask: zx::Signals, |
| ) -> Result<(), zx_status::Status> { |
| use fidl::Peered; |
| self.inner.channel().signal_peer(clear_mask, set_mask) |
| } |
| } |
| |
| impl ParentControlHandle {} |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ParentGetChildResponder { |
| control_handle: std::mem::ManuallyDrop<ParentControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ParentControlHandle::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 ParentGetChildResponder { |
| 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 ParentGetChildResponder { |
| type ControlHandle = ParentControlHandle; |
| |
| fn control_handle(&self) -> &ParentControlHandle { |
| &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 ParentGetChildResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut c: fidl::endpoints::ClientEnd<ChildMarker>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(c); |
| 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 c: fidl::endpoints::ClientEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(c); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut c: fidl::endpoints::ClientEnd<ChildMarker>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<ParentGetChildResponse>( |
| (c,), |
| self.tx_id, |
| 0xc3cd963aafc873b, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| #[must_use = "FIDL methods require a response to be sent"] |
| #[derive(Debug)] |
| pub struct ParentGetChildRequestResponder { |
| control_handle: std::mem::ManuallyDrop<ParentControlHandle>, |
| tx_id: u32, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ParentControlHandle::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 ParentGetChildRequestResponder { |
| 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 ParentGetChildRequestResponder { |
| type ControlHandle = ParentControlHandle; |
| |
| fn control_handle(&self) -> &ParentControlHandle { |
| &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 ParentGetChildRequestResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut r: fidl::endpoints::ServerEnd<ChildMarker>) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(r); |
| 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 r: fidl::endpoints::ServerEnd<ChildMarker>, |
| ) -> Result<(), fidl::Error> { |
| let _result = self.send_raw(r); |
| self.drop_without_shutdown(); |
| _result |
| } |
| |
| fn send_raw(&self, mut r: fidl::endpoints::ServerEnd<ChildMarker>) -> Result<(), fidl::Error> { |
| self.control_handle.inner.send::<ParentGetChildRequestResponse>( |
| (r,), |
| self.tx_id, |
| 0xf38d08d64f71c79, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| } |
| |
| mod internal { |
| use super::*; |
| |
| impl fidl::encoding::ResourceTypeMarker for ParentGetChildRequestResponse { |
| 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::TypeMarker for ParentGetChildRequestResponse { |
| 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 |
| } |
| } |
| |
| unsafe impl |
| fidl::encoding::Encode< |
| ParentGetChildRequestResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for &mut ParentGetChildRequestResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentGetChildRequestResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ParentGetChildRequestResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode( |
| ( |
| <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.r), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| > |
| fidl::encoding::Encode< |
| ParentGetChildRequestResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentGetChildRequestResponse>(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, fidl::encoding::DefaultFuchsiaResourceDialect> |
| for ParentGetChildRequestResponse |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| r: fidl::new_empty!( |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| 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<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| &mut self.r, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ResourceTypeMarker for ParentGetChildResponse { |
| 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::TypeMarker for ParentGetChildResponse { |
| 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 |
| } |
| } |
| |
| unsafe impl |
| fidl::encoding::Encode< |
| ParentGetChildResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for &mut ParentGetChildResponse |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentGetChildResponse>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ParentGetChildResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode( |
| ( |
| <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChildMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.c), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| > |
| fidl::encoding::Encode< |
| ParentGetChildResponse, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentGetChildResponse>(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, fidl::encoding::DefaultFuchsiaResourceDialect> |
| for ParentGetChildResponse |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| c: fidl::new_empty!( |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| 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<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| &mut self.c, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ResourceTypeMarker for ParentTakeChildRequest { |
| 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::TypeMarker for ParentTakeChildRequest { |
| 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 |
| } |
| } |
| |
| unsafe impl |
| fidl::encoding::Encode< |
| ParentTakeChildRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for &mut ParentTakeChildRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentTakeChildRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ParentTakeChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode( |
| ( |
| <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChildMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.c), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| > |
| fidl::encoding::Encode< |
| ParentTakeChildRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentTakeChildRequest>(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, fidl::encoding::DefaultFuchsiaResourceDialect> |
| for ParentTakeChildRequest |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| c: fidl::new_empty!( |
| fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| 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<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| &mut self.c, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::ResourceTypeMarker for ParentTakeChildRequestRequest { |
| 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::TypeMarker for ParentTakeChildRequestRequest { |
| 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 |
| } |
| } |
| |
| unsafe impl |
| fidl::encoding::Encode< |
| ParentTakeChildRequestRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for &mut ParentTakeChildRequestRequest |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentTakeChildRequestRequest>(offset); |
| // Delegate to tuple encoding. |
| fidl::encoding::Encode::<ParentTakeChildRequestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode( |
| ( |
| <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.r), |
| ), |
| encoder, offset, _depth |
| ) |
| } |
| } |
| unsafe impl< |
| T0: fidl::encoding::Encode< |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| > |
| fidl::encoding::Encode< |
| ParentTakeChildRequestRequest, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| > for (T0,) |
| { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| offset: usize, |
| depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<ParentTakeChildRequestRequest>(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, fidl::encoding::DefaultFuchsiaResourceDialect> |
| for ParentTakeChildRequestRequest |
| { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self { |
| r: fidl::new_empty!( |
| fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect |
| ), |
| } |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder< |
| '_, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| >, |
| 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<ChildMarker>>, |
| fidl::encoding::DefaultFuchsiaResourceDialect, |
| &mut self.r, |
| decoder, |
| offset + 0, |
| _depth |
| )?; |
| Ok(()) |
| } |
| } |
| } |