fidl_fuchsia_fdomain/
fidl_fuchsia_fdomain.rs

1// WARNING: This file is machine generated by fidlgen.
2
3// fidl_experiment = allow_arbitrary_error_types
4// fidl_experiment = no_resource_attribute
5
6#![warn(clippy::all)]
7#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
8
9use bitflags::bitflags;
10use fidl::client::QueryResponseFut;
11use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
12use fidl::endpoints::{ControlHandle as _, Responder as _};
13pub use fidl_fuchsia_fdomain__common::*;
14use futures::future::{self, MaybeDone, TryFutureExt};
15use zx_status;
16
17#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
18pub struct ChannelMarker;
19
20impl fidl::endpoints::ProtocolMarker for ChannelMarker {
21    type Proxy = ChannelProxy;
22    type RequestStream = ChannelRequestStream;
23    #[cfg(target_os = "fuchsia")]
24    type SynchronousProxy = ChannelSynchronousProxy;
25
26    const DEBUG_NAME: &'static str = "(anonymous) Channel";
27}
28pub type ChannelCreateChannelResult = Result<(), Error>;
29pub type ChannelReadChannelResult = Result<(Vec<u8>, Vec<HandleInfo>), Error>;
30pub type ChannelWriteChannelResult = Result<(), WriteChannelError>;
31pub type ChannelReadChannelStreamingStartResult = Result<(), Error>;
32pub type ChannelReadChannelStreamingStopResult = Result<(), Error>;
33
34pub trait ChannelProxyInterface: Send + Sync {
35    type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
36        + Send;
37    fn r#create_channel(&self, handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut;
38    type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
39        + Send;
40    fn r#read_channel(&self, handle: &HandleId) -> Self::ReadChannelResponseFut;
41    type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
42        + Send;
43    fn r#write_channel(
44        &self,
45        handle: &HandleId,
46        data: &[u8],
47        handles: &Handles,
48    ) -> Self::WriteChannelResponseFut;
49    type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
50        + Send;
51    fn r#read_channel_streaming_start(
52        &self,
53        handle: &HandleId,
54    ) -> Self::ReadChannelStreamingStartResponseFut;
55    type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
56        + Send;
57    fn r#read_channel_streaming_stop(
58        &self,
59        handle: &HandleId,
60    ) -> Self::ReadChannelStreamingStopResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct ChannelSynchronousProxy {
65    client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for ChannelSynchronousProxy {
70    type Proxy = ChannelProxy;
71    type Protocol = ChannelMarker;
72
73    fn from_channel(inner: fidl::Channel) -> Self {
74        Self::new(inner)
75    }
76
77    fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    fn as_channel(&self) -> &fidl::Channel {
82        self.client.as_channel()
83    }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl ChannelSynchronousProxy {
88    pub fn new(channel: fidl::Channel) -> Self {
89        let protocol_name = <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
90        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
91    }
92
93    pub fn into_channel(self) -> fidl::Channel {
94        self.client.into_channel()
95    }
96
97    /// Waits until an event arrives and returns it. It is safe for other
98    /// threads to make concurrent requests while waiting for an event.
99    pub fn wait_for_event(
100        &self,
101        deadline: zx::MonotonicInstant,
102    ) -> Result<ChannelEvent, fidl::Error> {
103        ChannelEvent::decode(self.client.wait_for_event(deadline)?)
104    }
105
106    pub fn r#create_channel(
107        &self,
108        mut handles: &[NewHandleId; 2],
109        ___deadline: zx::MonotonicInstant,
110    ) -> Result<ChannelCreateChannelResult, fidl::Error> {
111        let _response = self.client.send_query::<
112            ChannelCreateChannelRequest,
113            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
114        >(
115            (handles,),
116            0x182d38bfe88673b5,
117            fidl::encoding::DynamicFlags::FLEXIBLE,
118            ___deadline,
119        )?
120        .into_result::<ChannelMarker>("create_channel")?;
121        Ok(_response.map(|x| x))
122    }
123
124    pub fn r#read_channel(
125        &self,
126        mut handle: &HandleId,
127        ___deadline: zx::MonotonicInstant,
128    ) -> Result<ChannelReadChannelResult, fidl::Error> {
129        let _response = self.client.send_query::<
130            ChannelReadChannelRequest,
131            fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
132        >(
133            (handle,),
134            0x6ef47bf27bf7d050,
135            fidl::encoding::DynamicFlags::FLEXIBLE,
136            ___deadline,
137        )?
138        .into_result::<ChannelMarker>("read_channel")?;
139        Ok(_response.map(|x| (x.data, x.handles)))
140    }
141
142    pub fn r#write_channel(
143        &self,
144        mut handle: &HandleId,
145        mut data: &[u8],
146        mut handles: &Handles,
147        ___deadline: zx::MonotonicInstant,
148    ) -> Result<ChannelWriteChannelResult, fidl::Error> {
149        let _response = self.client.send_query::<
150            ChannelWriteChannelRequest,
151            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
152        >(
153            (handle, data, handles,),
154            0x75a2559b945d5eb5,
155            fidl::encoding::DynamicFlags::FLEXIBLE,
156            ___deadline,
157        )?
158        .into_result::<ChannelMarker>("write_channel")?;
159        Ok(_response.map(|x| x))
160    }
161
162    pub fn r#read_channel_streaming_start(
163        &self,
164        mut handle: &HandleId,
165        ___deadline: zx::MonotonicInstant,
166    ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
167        let _response = self.client.send_query::<
168            ChannelReadChannelStreamingStartRequest,
169            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
170        >(
171            (handle,),
172            0x3c73e85476a203df,
173            fidl::encoding::DynamicFlags::FLEXIBLE,
174            ___deadline,
175        )?
176        .into_result::<ChannelMarker>("read_channel_streaming_start")?;
177        Ok(_response.map(|x| x))
178    }
179
180    pub fn r#read_channel_streaming_stop(
181        &self,
182        mut handle: &HandleId,
183        ___deadline: zx::MonotonicInstant,
184    ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
185        let _response = self.client.send_query::<
186            ChannelReadChannelStreamingStopRequest,
187            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
188        >(
189            (handle,),
190            0x56f21d6ed68186e0,
191            fidl::encoding::DynamicFlags::FLEXIBLE,
192            ___deadline,
193        )?
194        .into_result::<ChannelMarker>("read_channel_streaming_stop")?;
195        Ok(_response.map(|x| x))
196    }
197}
198
199#[cfg(target_os = "fuchsia")]
200impl From<ChannelSynchronousProxy> for zx::Handle {
201    fn from(value: ChannelSynchronousProxy) -> Self {
202        value.into_channel().into()
203    }
204}
205
206#[cfg(target_os = "fuchsia")]
207impl From<fidl::Channel> for ChannelSynchronousProxy {
208    fn from(value: fidl::Channel) -> Self {
209        Self::new(value)
210    }
211}
212
213#[derive(Debug, Clone)]
214pub struct ChannelProxy {
215    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
216}
217
218impl fidl::endpoints::Proxy for ChannelProxy {
219    type Protocol = ChannelMarker;
220
221    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
222        Self::new(inner)
223    }
224
225    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
226        self.client.into_channel().map_err(|client| Self { client })
227    }
228
229    fn as_channel(&self) -> &::fidl::AsyncChannel {
230        self.client.as_channel()
231    }
232}
233
234impl ChannelProxy {
235    /// Create a new Proxy for fuchsia.fdomain/Channel.
236    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
237        let protocol_name = <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
238        Self { client: fidl::client::Client::new(channel, protocol_name) }
239    }
240
241    /// Get a Stream of events from the remote end of the protocol.
242    ///
243    /// # Panics
244    ///
245    /// Panics if the event stream was already taken.
246    pub fn take_event_stream(&self) -> ChannelEventStream {
247        ChannelEventStream { event_receiver: self.client.take_event_receiver() }
248    }
249
250    pub fn r#create_channel(
251        &self,
252        mut handles: &[NewHandleId; 2],
253    ) -> fidl::client::QueryResponseFut<
254        ChannelCreateChannelResult,
255        fidl::encoding::DefaultFuchsiaResourceDialect,
256    > {
257        ChannelProxyInterface::r#create_channel(self, handles)
258    }
259
260    pub fn r#read_channel(
261        &self,
262        mut handle: &HandleId,
263    ) -> fidl::client::QueryResponseFut<
264        ChannelReadChannelResult,
265        fidl::encoding::DefaultFuchsiaResourceDialect,
266    > {
267        ChannelProxyInterface::r#read_channel(self, handle)
268    }
269
270    pub fn r#write_channel(
271        &self,
272        mut handle: &HandleId,
273        mut data: &[u8],
274        mut handles: &Handles,
275    ) -> fidl::client::QueryResponseFut<
276        ChannelWriteChannelResult,
277        fidl::encoding::DefaultFuchsiaResourceDialect,
278    > {
279        ChannelProxyInterface::r#write_channel(self, handle, data, handles)
280    }
281
282    pub fn r#read_channel_streaming_start(
283        &self,
284        mut handle: &HandleId,
285    ) -> fidl::client::QueryResponseFut<
286        ChannelReadChannelStreamingStartResult,
287        fidl::encoding::DefaultFuchsiaResourceDialect,
288    > {
289        ChannelProxyInterface::r#read_channel_streaming_start(self, handle)
290    }
291
292    pub fn r#read_channel_streaming_stop(
293        &self,
294        mut handle: &HandleId,
295    ) -> fidl::client::QueryResponseFut<
296        ChannelReadChannelStreamingStopResult,
297        fidl::encoding::DefaultFuchsiaResourceDialect,
298    > {
299        ChannelProxyInterface::r#read_channel_streaming_stop(self, handle)
300    }
301}
302
303impl ChannelProxyInterface for ChannelProxy {
304    type CreateChannelResponseFut = fidl::client::QueryResponseFut<
305        ChannelCreateChannelResult,
306        fidl::encoding::DefaultFuchsiaResourceDialect,
307    >;
308    fn r#create_channel(&self, mut handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut {
309        fn _decode(
310            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
311        ) -> Result<ChannelCreateChannelResult, fidl::Error> {
312            let _response = fidl::client::decode_transaction_body::<
313                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
314                fidl::encoding::DefaultFuchsiaResourceDialect,
315                0x182d38bfe88673b5,
316            >(_buf?)?
317            .into_result::<ChannelMarker>("create_channel")?;
318            Ok(_response.map(|x| x))
319        }
320        self.client
321            .send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
322                (handles,),
323                0x182d38bfe88673b5,
324                fidl::encoding::DynamicFlags::FLEXIBLE,
325                _decode,
326            )
327    }
328
329    type ReadChannelResponseFut = fidl::client::QueryResponseFut<
330        ChannelReadChannelResult,
331        fidl::encoding::DefaultFuchsiaResourceDialect,
332    >;
333    fn r#read_channel(&self, mut handle: &HandleId) -> Self::ReadChannelResponseFut {
334        fn _decode(
335            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
336        ) -> Result<ChannelReadChannelResult, fidl::Error> {
337            let _response = fidl::client::decode_transaction_body::<
338                fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
339                fidl::encoding::DefaultFuchsiaResourceDialect,
340                0x6ef47bf27bf7d050,
341            >(_buf?)?
342            .into_result::<ChannelMarker>("read_channel")?;
343            Ok(_response.map(|x| (x.data, x.handles)))
344        }
345        self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
346            (handle,),
347            0x6ef47bf27bf7d050,
348            fidl::encoding::DynamicFlags::FLEXIBLE,
349            _decode,
350        )
351    }
352
353    type WriteChannelResponseFut = fidl::client::QueryResponseFut<
354        ChannelWriteChannelResult,
355        fidl::encoding::DefaultFuchsiaResourceDialect,
356    >;
357    fn r#write_channel(
358        &self,
359        mut handle: &HandleId,
360        mut data: &[u8],
361        mut handles: &Handles,
362    ) -> Self::WriteChannelResponseFut {
363        fn _decode(
364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
365        ) -> Result<ChannelWriteChannelResult, fidl::Error> {
366            let _response = fidl::client::decode_transaction_body::<
367                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
368                fidl::encoding::DefaultFuchsiaResourceDialect,
369                0x75a2559b945d5eb5,
370            >(_buf?)?
371            .into_result::<ChannelMarker>("write_channel")?;
372            Ok(_response.map(|x| x))
373        }
374        self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
375            (handle, data, handles),
376            0x75a2559b945d5eb5,
377            fidl::encoding::DynamicFlags::FLEXIBLE,
378            _decode,
379        )
380    }
381
382    type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
383        ChannelReadChannelStreamingStartResult,
384        fidl::encoding::DefaultFuchsiaResourceDialect,
385    >;
386    fn r#read_channel_streaming_start(
387        &self,
388        mut handle: &HandleId,
389    ) -> Self::ReadChannelStreamingStartResponseFut {
390        fn _decode(
391            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
392        ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
393            let _response = fidl::client::decode_transaction_body::<
394                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
395                fidl::encoding::DefaultFuchsiaResourceDialect,
396                0x3c73e85476a203df,
397            >(_buf?)?
398            .into_result::<ChannelMarker>("read_channel_streaming_start")?;
399            Ok(_response.map(|x| x))
400        }
401        self.client.send_query_and_decode::<
402            ChannelReadChannelStreamingStartRequest,
403            ChannelReadChannelStreamingStartResult,
404        >(
405            (handle,),
406            0x3c73e85476a203df,
407            fidl::encoding::DynamicFlags::FLEXIBLE,
408            _decode,
409        )
410    }
411
412    type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
413        ChannelReadChannelStreamingStopResult,
414        fidl::encoding::DefaultFuchsiaResourceDialect,
415    >;
416    fn r#read_channel_streaming_stop(
417        &self,
418        mut handle: &HandleId,
419    ) -> Self::ReadChannelStreamingStopResponseFut {
420        fn _decode(
421            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
422        ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
423            let _response = fidl::client::decode_transaction_body::<
424                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
425                fidl::encoding::DefaultFuchsiaResourceDialect,
426                0x56f21d6ed68186e0,
427            >(_buf?)?
428            .into_result::<ChannelMarker>("read_channel_streaming_stop")?;
429            Ok(_response.map(|x| x))
430        }
431        self.client.send_query_and_decode::<
432            ChannelReadChannelStreamingStopRequest,
433            ChannelReadChannelStreamingStopResult,
434        >(
435            (handle,),
436            0x56f21d6ed68186e0,
437            fidl::encoding::DynamicFlags::FLEXIBLE,
438            _decode,
439        )
440    }
441}
442
443pub struct ChannelEventStream {
444    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
445}
446
447impl std::marker::Unpin for ChannelEventStream {}
448
449impl futures::stream::FusedStream for ChannelEventStream {
450    fn is_terminated(&self) -> bool {
451        self.event_receiver.is_terminated()
452    }
453}
454
455impl futures::Stream for ChannelEventStream {
456    type Item = Result<ChannelEvent, fidl::Error>;
457
458    fn poll_next(
459        mut self: std::pin::Pin<&mut Self>,
460        cx: &mut std::task::Context<'_>,
461    ) -> std::task::Poll<Option<Self::Item>> {
462        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
463            &mut self.event_receiver,
464            cx
465        )?) {
466            Some(buf) => std::task::Poll::Ready(Some(ChannelEvent::decode(buf))),
467            None => std::task::Poll::Ready(None),
468        }
469    }
470}
471
472#[derive(Debug)]
473pub enum ChannelEvent {
474    OnChannelStreamingData {
475        handle: HandleId,
476        channel_sent: ChannelSent,
477    },
478    #[non_exhaustive]
479    _UnknownEvent {
480        /// Ordinal of the event that was sent.
481        ordinal: u64,
482    },
483}
484
485impl ChannelEvent {
486    #[allow(irrefutable_let_patterns)]
487    pub fn into_on_channel_streaming_data(self) -> Option<(HandleId, ChannelSent)> {
488        if let ChannelEvent::OnChannelStreamingData { handle, channel_sent } = self {
489            Some((handle, channel_sent))
490        } else {
491            None
492        }
493    }
494
495    /// Decodes a message buffer as a [`ChannelEvent`].
496    fn decode(
497        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
498    ) -> Result<ChannelEvent, fidl::Error> {
499        let (bytes, _handles) = buf.split_mut();
500        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
501        debug_assert_eq!(tx_header.tx_id, 0);
502        match tx_header.ordinal {
503            0x7d4431805202dfe1 => {
504                let mut out = fidl::new_empty!(
505                    ChannelOnChannelStreamingDataRequest,
506                    fidl::encoding::DefaultFuchsiaResourceDialect
507                );
508                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
509                Ok((ChannelEvent::OnChannelStreamingData {
510                    handle: out.handle,
511                    channel_sent: out.channel_sent,
512                }))
513            }
514            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
515                Ok(ChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
516            }
517            _ => Err(fidl::Error::UnknownOrdinal {
518                ordinal: tx_header.ordinal,
519                protocol_name: <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
520            }),
521        }
522    }
523}
524
525/// A Stream of incoming requests for fuchsia.fdomain/Channel.
526pub struct ChannelRequestStream {
527    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
528    is_terminated: bool,
529}
530
531impl std::marker::Unpin for ChannelRequestStream {}
532
533impl futures::stream::FusedStream for ChannelRequestStream {
534    fn is_terminated(&self) -> bool {
535        self.is_terminated
536    }
537}
538
539impl fidl::endpoints::RequestStream for ChannelRequestStream {
540    type Protocol = ChannelMarker;
541    type ControlHandle = ChannelControlHandle;
542
543    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
544        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
545    }
546
547    fn control_handle(&self) -> Self::ControlHandle {
548        ChannelControlHandle { inner: self.inner.clone() }
549    }
550
551    fn into_inner(
552        self,
553    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
554    {
555        (self.inner, self.is_terminated)
556    }
557
558    fn from_inner(
559        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
560        is_terminated: bool,
561    ) -> Self {
562        Self { inner, is_terminated }
563    }
564}
565
566impl futures::Stream for ChannelRequestStream {
567    type Item = Result<ChannelRequest, fidl::Error>;
568
569    fn poll_next(
570        mut self: std::pin::Pin<&mut Self>,
571        cx: &mut std::task::Context<'_>,
572    ) -> std::task::Poll<Option<Self::Item>> {
573        let this = &mut *self;
574        if this.inner.check_shutdown(cx) {
575            this.is_terminated = true;
576            return std::task::Poll::Ready(None);
577        }
578        if this.is_terminated {
579            panic!("polled ChannelRequestStream after completion");
580        }
581        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
582            |bytes, handles| {
583                match this.inner.channel().read_etc(cx, bytes, handles) {
584                    std::task::Poll::Ready(Ok(())) => {}
585                    std::task::Poll::Pending => return std::task::Poll::Pending,
586                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
587                        this.is_terminated = true;
588                        return std::task::Poll::Ready(None);
589                    }
590                    std::task::Poll::Ready(Err(e)) => {
591                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
592                            e.into(),
593                        ))))
594                    }
595                }
596
597                // A message has been received from the channel
598                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
599
600                std::task::Poll::Ready(Some(match header.ordinal {
601                    0x182d38bfe88673b5 => {
602                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
603                        let mut req = fidl::new_empty!(
604                            ChannelCreateChannelRequest,
605                            fidl::encoding::DefaultFuchsiaResourceDialect
606                        );
607                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
608                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
609                        Ok(ChannelRequest::CreateChannel {
610                            handles: req.handles,
611
612                            responder: ChannelCreateChannelResponder {
613                                control_handle: std::mem::ManuallyDrop::new(control_handle),
614                                tx_id: header.tx_id,
615                            },
616                        })
617                    }
618                    0x6ef47bf27bf7d050 => {
619                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
620                        let mut req = fidl::new_empty!(
621                            ChannelReadChannelRequest,
622                            fidl::encoding::DefaultFuchsiaResourceDialect
623                        );
624                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
625                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
626                        Ok(ChannelRequest::ReadChannel {
627                            handle: req.handle,
628
629                            responder: ChannelReadChannelResponder {
630                                control_handle: std::mem::ManuallyDrop::new(control_handle),
631                                tx_id: header.tx_id,
632                            },
633                        })
634                    }
635                    0x75a2559b945d5eb5 => {
636                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
637                        let mut req = fidl::new_empty!(
638                            ChannelWriteChannelRequest,
639                            fidl::encoding::DefaultFuchsiaResourceDialect
640                        );
641                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
642                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
643                        Ok(ChannelRequest::WriteChannel {
644                            handle: req.handle,
645                            data: req.data,
646                            handles: req.handles,
647
648                            responder: ChannelWriteChannelResponder {
649                                control_handle: std::mem::ManuallyDrop::new(control_handle),
650                                tx_id: header.tx_id,
651                            },
652                        })
653                    }
654                    0x3c73e85476a203df => {
655                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
656                        let mut req = fidl::new_empty!(
657                            ChannelReadChannelStreamingStartRequest,
658                            fidl::encoding::DefaultFuchsiaResourceDialect
659                        );
660                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
661                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
662                        Ok(ChannelRequest::ReadChannelStreamingStart {
663                            handle: req.handle,
664
665                            responder: ChannelReadChannelStreamingStartResponder {
666                                control_handle: std::mem::ManuallyDrop::new(control_handle),
667                                tx_id: header.tx_id,
668                            },
669                        })
670                    }
671                    0x56f21d6ed68186e0 => {
672                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
673                        let mut req = fidl::new_empty!(
674                            ChannelReadChannelStreamingStopRequest,
675                            fidl::encoding::DefaultFuchsiaResourceDialect
676                        );
677                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
678                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
679                        Ok(ChannelRequest::ReadChannelStreamingStop {
680                            handle: req.handle,
681
682                            responder: ChannelReadChannelStreamingStopResponder {
683                                control_handle: std::mem::ManuallyDrop::new(control_handle),
684                                tx_id: header.tx_id,
685                            },
686                        })
687                    }
688                    _ if header.tx_id == 0
689                        && header
690                            .dynamic_flags()
691                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
692                    {
693                        Ok(ChannelRequest::_UnknownMethod {
694                            ordinal: header.ordinal,
695                            control_handle: ChannelControlHandle { inner: this.inner.clone() },
696                            method_type: fidl::MethodType::OneWay,
697                        })
698                    }
699                    _ if header
700                        .dynamic_flags()
701                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
702                    {
703                        this.inner.send_framework_err(
704                            fidl::encoding::FrameworkErr::UnknownMethod,
705                            header.tx_id,
706                            header.ordinal,
707                            header.dynamic_flags(),
708                            (bytes, handles),
709                        )?;
710                        Ok(ChannelRequest::_UnknownMethod {
711                            ordinal: header.ordinal,
712                            control_handle: ChannelControlHandle { inner: this.inner.clone() },
713                            method_type: fidl::MethodType::TwoWay,
714                        })
715                    }
716                    _ => Err(fidl::Error::UnknownOrdinal {
717                        ordinal: header.ordinal,
718                        protocol_name:
719                            <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
720                    }),
721                }))
722            },
723        )
724    }
725}
726
727#[derive(Debug)]
728pub enum ChannelRequest {
729    CreateChannel {
730        handles: [NewHandleId; 2],
731        responder: ChannelCreateChannelResponder,
732    },
733    ReadChannel {
734        handle: HandleId,
735        responder: ChannelReadChannelResponder,
736    },
737    WriteChannel {
738        handle: HandleId,
739        data: Vec<u8>,
740        handles: Handles,
741        responder: ChannelWriteChannelResponder,
742    },
743    ReadChannelStreamingStart {
744        handle: HandleId,
745        responder: ChannelReadChannelStreamingStartResponder,
746    },
747    ReadChannelStreamingStop {
748        handle: HandleId,
749        responder: ChannelReadChannelStreamingStopResponder,
750    },
751    /// An interaction was received which does not match any known method.
752    #[non_exhaustive]
753    _UnknownMethod {
754        /// Ordinal of the method that was called.
755        ordinal: u64,
756        control_handle: ChannelControlHandle,
757        method_type: fidl::MethodType,
758    },
759}
760
761impl ChannelRequest {
762    #[allow(irrefutable_let_patterns)]
763    pub fn into_create_channel(self) -> Option<([NewHandleId; 2], ChannelCreateChannelResponder)> {
764        if let ChannelRequest::CreateChannel { handles, responder } = self {
765            Some((handles, responder))
766        } else {
767            None
768        }
769    }
770
771    #[allow(irrefutable_let_patterns)]
772    pub fn into_read_channel(self) -> Option<(HandleId, ChannelReadChannelResponder)> {
773        if let ChannelRequest::ReadChannel { handle, responder } = self {
774            Some((handle, responder))
775        } else {
776            None
777        }
778    }
779
780    #[allow(irrefutable_let_patterns)]
781    pub fn into_write_channel(
782        self,
783    ) -> Option<(HandleId, Vec<u8>, Handles, ChannelWriteChannelResponder)> {
784        if let ChannelRequest::WriteChannel { handle, data, handles, responder } = self {
785            Some((handle, data, handles, responder))
786        } else {
787            None
788        }
789    }
790
791    #[allow(irrefutable_let_patterns)]
792    pub fn into_read_channel_streaming_start(
793        self,
794    ) -> Option<(HandleId, ChannelReadChannelStreamingStartResponder)> {
795        if let ChannelRequest::ReadChannelStreamingStart { handle, responder } = self {
796            Some((handle, responder))
797        } else {
798            None
799        }
800    }
801
802    #[allow(irrefutable_let_patterns)]
803    pub fn into_read_channel_streaming_stop(
804        self,
805    ) -> Option<(HandleId, ChannelReadChannelStreamingStopResponder)> {
806        if let ChannelRequest::ReadChannelStreamingStop { handle, responder } = self {
807            Some((handle, responder))
808        } else {
809            None
810        }
811    }
812
813    /// Name of the method defined in FIDL
814    pub fn method_name(&self) -> &'static str {
815        match *self {
816            ChannelRequest::CreateChannel { .. } => "create_channel",
817            ChannelRequest::ReadChannel { .. } => "read_channel",
818            ChannelRequest::WriteChannel { .. } => "write_channel",
819            ChannelRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
820            ChannelRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
821            ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
822                "unknown one-way method"
823            }
824            ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
825                "unknown two-way method"
826            }
827        }
828    }
829}
830
831#[derive(Debug, Clone)]
832pub struct ChannelControlHandle {
833    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
834}
835
836impl fidl::endpoints::ControlHandle for ChannelControlHandle {
837    fn shutdown(&self) {
838        self.inner.shutdown()
839    }
840    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
841        self.inner.shutdown_with_epitaph(status)
842    }
843
844    fn is_closed(&self) -> bool {
845        self.inner.channel().is_closed()
846    }
847    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
848        self.inner.channel().on_closed()
849    }
850
851    #[cfg(target_os = "fuchsia")]
852    fn signal_peer(
853        &self,
854        clear_mask: zx::Signals,
855        set_mask: zx::Signals,
856    ) -> Result<(), zx_status::Status> {
857        use fidl::Peered;
858        self.inner.channel().signal_peer(clear_mask, set_mask)
859    }
860}
861
862impl ChannelControlHandle {
863    pub fn send_on_channel_streaming_data(
864        &self,
865        mut handle: &HandleId,
866        mut channel_sent: &ChannelSent,
867    ) -> Result<(), fidl::Error> {
868        self.inner.send::<ChannelOnChannelStreamingDataRequest>(
869            (handle, channel_sent),
870            0,
871            0x7d4431805202dfe1,
872            fidl::encoding::DynamicFlags::FLEXIBLE,
873        )
874    }
875}
876
877#[must_use = "FIDL methods require a response to be sent"]
878#[derive(Debug)]
879pub struct ChannelCreateChannelResponder {
880    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
881    tx_id: u32,
882}
883
884/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
885/// if the responder is dropped without sending a response, so that the client
886/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
887impl std::ops::Drop for ChannelCreateChannelResponder {
888    fn drop(&mut self) {
889        self.control_handle.shutdown();
890        // Safety: drops once, never accessed again
891        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
892    }
893}
894
895impl fidl::endpoints::Responder for ChannelCreateChannelResponder {
896    type ControlHandle = ChannelControlHandle;
897
898    fn control_handle(&self) -> &ChannelControlHandle {
899        &self.control_handle
900    }
901
902    fn drop_without_shutdown(mut self) {
903        // Safety: drops once, never accessed again due to mem::forget
904        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
905        // Prevent Drop from running (which would shut down the channel)
906        std::mem::forget(self);
907    }
908}
909
910impl ChannelCreateChannelResponder {
911    /// Sends a response to the FIDL transaction.
912    ///
913    /// Sets the channel to shutdown if an error occurs.
914    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
915        let _result = self.send_raw(result);
916        if _result.is_err() {
917            self.control_handle.shutdown();
918        }
919        self.drop_without_shutdown();
920        _result
921    }
922
923    /// Similar to "send" but does not shutdown the channel if an error occurs.
924    pub fn send_no_shutdown_on_err(
925        self,
926        mut result: Result<(), &Error>,
927    ) -> Result<(), fidl::Error> {
928        let _result = self.send_raw(result);
929        self.drop_without_shutdown();
930        _result
931    }
932
933    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
934        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
935            fidl::encoding::EmptyStruct,
936            Error,
937        >>(
938            fidl::encoding::FlexibleResult::new(result),
939            self.tx_id,
940            0x182d38bfe88673b5,
941            fidl::encoding::DynamicFlags::FLEXIBLE,
942        )
943    }
944}
945
946#[must_use = "FIDL methods require a response to be sent"]
947#[derive(Debug)]
948pub struct ChannelReadChannelResponder {
949    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
950    tx_id: u32,
951}
952
953/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
954/// if the responder is dropped without sending a response, so that the client
955/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
956impl std::ops::Drop for ChannelReadChannelResponder {
957    fn drop(&mut self) {
958        self.control_handle.shutdown();
959        // Safety: drops once, never accessed again
960        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
961    }
962}
963
964impl fidl::endpoints::Responder for ChannelReadChannelResponder {
965    type ControlHandle = ChannelControlHandle;
966
967    fn control_handle(&self) -> &ChannelControlHandle {
968        &self.control_handle
969    }
970
971    fn drop_without_shutdown(mut self) {
972        // Safety: drops once, never accessed again due to mem::forget
973        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
974        // Prevent Drop from running (which would shut down the channel)
975        std::mem::forget(self);
976    }
977}
978
979impl ChannelReadChannelResponder {
980    /// Sends a response to the FIDL transaction.
981    ///
982    /// Sets the channel to shutdown if an error occurs.
983    pub fn send(
984        self,
985        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
986    ) -> Result<(), fidl::Error> {
987        let _result = self.send_raw(result);
988        if _result.is_err() {
989            self.control_handle.shutdown();
990        }
991        self.drop_without_shutdown();
992        _result
993    }
994
995    /// Similar to "send" but does not shutdown the channel if an error occurs.
996    pub fn send_no_shutdown_on_err(
997        self,
998        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
999    ) -> Result<(), fidl::Error> {
1000        let _result = self.send_raw(result);
1001        self.drop_without_shutdown();
1002        _result
1003    }
1004
1005    fn send_raw(
1006        &self,
1007        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
1008    ) -> Result<(), fidl::Error> {
1009        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
1010            fidl::encoding::FlexibleResult::new(result),
1011            self.tx_id,
1012            0x6ef47bf27bf7d050,
1013            fidl::encoding::DynamicFlags::FLEXIBLE,
1014        )
1015    }
1016}
1017
1018#[must_use = "FIDL methods require a response to be sent"]
1019#[derive(Debug)]
1020pub struct ChannelWriteChannelResponder {
1021    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1022    tx_id: u32,
1023}
1024
1025/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1026/// if the responder is dropped without sending a response, so that the client
1027/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1028impl std::ops::Drop for ChannelWriteChannelResponder {
1029    fn drop(&mut self) {
1030        self.control_handle.shutdown();
1031        // Safety: drops once, never accessed again
1032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1033    }
1034}
1035
1036impl fidl::endpoints::Responder for ChannelWriteChannelResponder {
1037    type ControlHandle = ChannelControlHandle;
1038
1039    fn control_handle(&self) -> &ChannelControlHandle {
1040        &self.control_handle
1041    }
1042
1043    fn drop_without_shutdown(mut self) {
1044        // Safety: drops once, never accessed again due to mem::forget
1045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1046        // Prevent Drop from running (which would shut down the channel)
1047        std::mem::forget(self);
1048    }
1049}
1050
1051impl ChannelWriteChannelResponder {
1052    /// Sends a response to the FIDL transaction.
1053    ///
1054    /// Sets the channel to shutdown if an error occurs.
1055    pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
1056        let _result = self.send_raw(result);
1057        if _result.is_err() {
1058            self.control_handle.shutdown();
1059        }
1060        self.drop_without_shutdown();
1061        _result
1062    }
1063
1064    /// Similar to "send" but does not shutdown the channel if an error occurs.
1065    pub fn send_no_shutdown_on_err(
1066        self,
1067        mut result: Result<(), &WriteChannelError>,
1068    ) -> Result<(), fidl::Error> {
1069        let _result = self.send_raw(result);
1070        self.drop_without_shutdown();
1071        _result
1072    }
1073
1074    fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
1075        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1076            fidl::encoding::EmptyStruct,
1077            WriteChannelError,
1078        >>(
1079            fidl::encoding::FlexibleResult::new(result),
1080            self.tx_id,
1081            0x75a2559b945d5eb5,
1082            fidl::encoding::DynamicFlags::FLEXIBLE,
1083        )
1084    }
1085}
1086
1087#[must_use = "FIDL methods require a response to be sent"]
1088#[derive(Debug)]
1089pub struct ChannelReadChannelStreamingStartResponder {
1090    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1091    tx_id: u32,
1092}
1093
1094/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1095/// if the responder is dropped without sending a response, so that the client
1096/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1097impl std::ops::Drop for ChannelReadChannelStreamingStartResponder {
1098    fn drop(&mut self) {
1099        self.control_handle.shutdown();
1100        // Safety: drops once, never accessed again
1101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1102    }
1103}
1104
1105impl fidl::endpoints::Responder for ChannelReadChannelStreamingStartResponder {
1106    type ControlHandle = ChannelControlHandle;
1107
1108    fn control_handle(&self) -> &ChannelControlHandle {
1109        &self.control_handle
1110    }
1111
1112    fn drop_without_shutdown(mut self) {
1113        // Safety: drops once, never accessed again due to mem::forget
1114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1115        // Prevent Drop from running (which would shut down the channel)
1116        std::mem::forget(self);
1117    }
1118}
1119
1120impl ChannelReadChannelStreamingStartResponder {
1121    /// Sends a response to the FIDL transaction.
1122    ///
1123    /// Sets the channel to shutdown if an error occurs.
1124    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1125        let _result = self.send_raw(result);
1126        if _result.is_err() {
1127            self.control_handle.shutdown();
1128        }
1129        self.drop_without_shutdown();
1130        _result
1131    }
1132
1133    /// Similar to "send" but does not shutdown the channel if an error occurs.
1134    pub fn send_no_shutdown_on_err(
1135        self,
1136        mut result: Result<(), &Error>,
1137    ) -> Result<(), fidl::Error> {
1138        let _result = self.send_raw(result);
1139        self.drop_without_shutdown();
1140        _result
1141    }
1142
1143    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1144        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1145            fidl::encoding::EmptyStruct,
1146            Error,
1147        >>(
1148            fidl::encoding::FlexibleResult::new(result),
1149            self.tx_id,
1150            0x3c73e85476a203df,
1151            fidl::encoding::DynamicFlags::FLEXIBLE,
1152        )
1153    }
1154}
1155
1156#[must_use = "FIDL methods require a response to be sent"]
1157#[derive(Debug)]
1158pub struct ChannelReadChannelStreamingStopResponder {
1159    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1160    tx_id: u32,
1161}
1162
1163/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1164/// if the responder is dropped without sending a response, so that the client
1165/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1166impl std::ops::Drop for ChannelReadChannelStreamingStopResponder {
1167    fn drop(&mut self) {
1168        self.control_handle.shutdown();
1169        // Safety: drops once, never accessed again
1170        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1171    }
1172}
1173
1174impl fidl::endpoints::Responder for ChannelReadChannelStreamingStopResponder {
1175    type ControlHandle = ChannelControlHandle;
1176
1177    fn control_handle(&self) -> &ChannelControlHandle {
1178        &self.control_handle
1179    }
1180
1181    fn drop_without_shutdown(mut self) {
1182        // Safety: drops once, never accessed again due to mem::forget
1183        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1184        // Prevent Drop from running (which would shut down the channel)
1185        std::mem::forget(self);
1186    }
1187}
1188
1189impl ChannelReadChannelStreamingStopResponder {
1190    /// Sends a response to the FIDL transaction.
1191    ///
1192    /// Sets the channel to shutdown if an error occurs.
1193    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1194        let _result = self.send_raw(result);
1195        if _result.is_err() {
1196            self.control_handle.shutdown();
1197        }
1198        self.drop_without_shutdown();
1199        _result
1200    }
1201
1202    /// Similar to "send" but does not shutdown the channel if an error occurs.
1203    pub fn send_no_shutdown_on_err(
1204        self,
1205        mut result: Result<(), &Error>,
1206    ) -> Result<(), fidl::Error> {
1207        let _result = self.send_raw(result);
1208        self.drop_without_shutdown();
1209        _result
1210    }
1211
1212    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1213        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1214            fidl::encoding::EmptyStruct,
1215            Error,
1216        >>(
1217            fidl::encoding::FlexibleResult::new(result),
1218            self.tx_id,
1219            0x56f21d6ed68186e0,
1220            fidl::encoding::DynamicFlags::FLEXIBLE,
1221        )
1222    }
1223}
1224
1225#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1226pub struct EventMarker;
1227
1228impl fidl::endpoints::ProtocolMarker for EventMarker {
1229    type Proxy = EventProxy;
1230    type RequestStream = EventRequestStream;
1231    #[cfg(target_os = "fuchsia")]
1232    type SynchronousProxy = EventSynchronousProxy;
1233
1234    const DEBUG_NAME: &'static str = "(anonymous) Event";
1235}
1236pub type EventCreateEventResult = Result<(), Error>;
1237
1238pub trait EventProxyInterface: Send + Sync {
1239    type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
1240        + Send;
1241    fn r#create_event(&self, handle: &NewHandleId) -> Self::CreateEventResponseFut;
1242}
1243#[derive(Debug)]
1244#[cfg(target_os = "fuchsia")]
1245pub struct EventSynchronousProxy {
1246    client: fidl::client::sync::Client,
1247}
1248
1249#[cfg(target_os = "fuchsia")]
1250impl fidl::endpoints::SynchronousProxy for EventSynchronousProxy {
1251    type Proxy = EventProxy;
1252    type Protocol = EventMarker;
1253
1254    fn from_channel(inner: fidl::Channel) -> Self {
1255        Self::new(inner)
1256    }
1257
1258    fn into_channel(self) -> fidl::Channel {
1259        self.client.into_channel()
1260    }
1261
1262    fn as_channel(&self) -> &fidl::Channel {
1263        self.client.as_channel()
1264    }
1265}
1266
1267#[cfg(target_os = "fuchsia")]
1268impl EventSynchronousProxy {
1269    pub fn new(channel: fidl::Channel) -> Self {
1270        let protocol_name = <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1271        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1272    }
1273
1274    pub fn into_channel(self) -> fidl::Channel {
1275        self.client.into_channel()
1276    }
1277
1278    /// Waits until an event arrives and returns it. It is safe for other
1279    /// threads to make concurrent requests while waiting for an event.
1280    pub fn wait_for_event(
1281        &self,
1282        deadline: zx::MonotonicInstant,
1283    ) -> Result<EventEvent, fidl::Error> {
1284        EventEvent::decode(self.client.wait_for_event(deadline)?)
1285    }
1286
1287    pub fn r#create_event(
1288        &self,
1289        mut handle: &NewHandleId,
1290        ___deadline: zx::MonotonicInstant,
1291    ) -> Result<EventCreateEventResult, fidl::Error> {
1292        let _response = self.client.send_query::<
1293            EventCreateEventRequest,
1294            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1295        >(
1296            (handle,),
1297            0x7b05b3f262635987,
1298            fidl::encoding::DynamicFlags::FLEXIBLE,
1299            ___deadline,
1300        )?
1301        .into_result::<EventMarker>("create_event")?;
1302        Ok(_response.map(|x| x))
1303    }
1304}
1305
1306#[cfg(target_os = "fuchsia")]
1307impl From<EventSynchronousProxy> for zx::Handle {
1308    fn from(value: EventSynchronousProxy) -> Self {
1309        value.into_channel().into()
1310    }
1311}
1312
1313#[cfg(target_os = "fuchsia")]
1314impl From<fidl::Channel> for EventSynchronousProxy {
1315    fn from(value: fidl::Channel) -> Self {
1316        Self::new(value)
1317    }
1318}
1319
1320#[derive(Debug, Clone)]
1321pub struct EventProxy {
1322    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1323}
1324
1325impl fidl::endpoints::Proxy for EventProxy {
1326    type Protocol = EventMarker;
1327
1328    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1329        Self::new(inner)
1330    }
1331
1332    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1333        self.client.into_channel().map_err(|client| Self { client })
1334    }
1335
1336    fn as_channel(&self) -> &::fidl::AsyncChannel {
1337        self.client.as_channel()
1338    }
1339}
1340
1341impl EventProxy {
1342    /// Create a new Proxy for fuchsia.fdomain/Event.
1343    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1344        let protocol_name = <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1345        Self { client: fidl::client::Client::new(channel, protocol_name) }
1346    }
1347
1348    /// Get a Stream of events from the remote end of the protocol.
1349    ///
1350    /// # Panics
1351    ///
1352    /// Panics if the event stream was already taken.
1353    pub fn take_event_stream(&self) -> EventEventStream {
1354        EventEventStream { event_receiver: self.client.take_event_receiver() }
1355    }
1356
1357    pub fn r#create_event(
1358        &self,
1359        mut handle: &NewHandleId,
1360    ) -> fidl::client::QueryResponseFut<
1361        EventCreateEventResult,
1362        fidl::encoding::DefaultFuchsiaResourceDialect,
1363    > {
1364        EventProxyInterface::r#create_event(self, handle)
1365    }
1366}
1367
1368impl EventProxyInterface for EventProxy {
1369    type CreateEventResponseFut = fidl::client::QueryResponseFut<
1370        EventCreateEventResult,
1371        fidl::encoding::DefaultFuchsiaResourceDialect,
1372    >;
1373    fn r#create_event(&self, mut handle: &NewHandleId) -> Self::CreateEventResponseFut {
1374        fn _decode(
1375            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1376        ) -> Result<EventCreateEventResult, fidl::Error> {
1377            let _response = fidl::client::decode_transaction_body::<
1378                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1379                fidl::encoding::DefaultFuchsiaResourceDialect,
1380                0x7b05b3f262635987,
1381            >(_buf?)?
1382            .into_result::<EventMarker>("create_event")?;
1383            Ok(_response.map(|x| x))
1384        }
1385        self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
1386            (handle,),
1387            0x7b05b3f262635987,
1388            fidl::encoding::DynamicFlags::FLEXIBLE,
1389            _decode,
1390        )
1391    }
1392}
1393
1394pub struct EventEventStream {
1395    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1396}
1397
1398impl std::marker::Unpin for EventEventStream {}
1399
1400impl futures::stream::FusedStream for EventEventStream {
1401    fn is_terminated(&self) -> bool {
1402        self.event_receiver.is_terminated()
1403    }
1404}
1405
1406impl futures::Stream for EventEventStream {
1407    type Item = Result<EventEvent, fidl::Error>;
1408
1409    fn poll_next(
1410        mut self: std::pin::Pin<&mut Self>,
1411        cx: &mut std::task::Context<'_>,
1412    ) -> std::task::Poll<Option<Self::Item>> {
1413        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1414            &mut self.event_receiver,
1415            cx
1416        )?) {
1417            Some(buf) => std::task::Poll::Ready(Some(EventEvent::decode(buf))),
1418            None => std::task::Poll::Ready(None),
1419        }
1420    }
1421}
1422
1423#[derive(Debug)]
1424pub enum EventEvent {
1425    #[non_exhaustive]
1426    _UnknownEvent {
1427        /// Ordinal of the event that was sent.
1428        ordinal: u64,
1429    },
1430}
1431
1432impl EventEvent {
1433    /// Decodes a message buffer as a [`EventEvent`].
1434    fn decode(
1435        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1436    ) -> Result<EventEvent, fidl::Error> {
1437        let (bytes, _handles) = buf.split_mut();
1438        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1439        debug_assert_eq!(tx_header.tx_id, 0);
1440        match tx_header.ordinal {
1441            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1442                Ok(EventEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1443            }
1444            _ => Err(fidl::Error::UnknownOrdinal {
1445                ordinal: tx_header.ordinal,
1446                protocol_name: <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1447            }),
1448        }
1449    }
1450}
1451
1452/// A Stream of incoming requests for fuchsia.fdomain/Event.
1453pub struct EventRequestStream {
1454    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1455    is_terminated: bool,
1456}
1457
1458impl std::marker::Unpin for EventRequestStream {}
1459
1460impl futures::stream::FusedStream for EventRequestStream {
1461    fn is_terminated(&self) -> bool {
1462        self.is_terminated
1463    }
1464}
1465
1466impl fidl::endpoints::RequestStream for EventRequestStream {
1467    type Protocol = EventMarker;
1468    type ControlHandle = EventControlHandle;
1469
1470    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1471        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1472    }
1473
1474    fn control_handle(&self) -> Self::ControlHandle {
1475        EventControlHandle { inner: self.inner.clone() }
1476    }
1477
1478    fn into_inner(
1479        self,
1480    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1481    {
1482        (self.inner, self.is_terminated)
1483    }
1484
1485    fn from_inner(
1486        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1487        is_terminated: bool,
1488    ) -> Self {
1489        Self { inner, is_terminated }
1490    }
1491}
1492
1493impl futures::Stream for EventRequestStream {
1494    type Item = Result<EventRequest, fidl::Error>;
1495
1496    fn poll_next(
1497        mut self: std::pin::Pin<&mut Self>,
1498        cx: &mut std::task::Context<'_>,
1499    ) -> std::task::Poll<Option<Self::Item>> {
1500        let this = &mut *self;
1501        if this.inner.check_shutdown(cx) {
1502            this.is_terminated = true;
1503            return std::task::Poll::Ready(None);
1504        }
1505        if this.is_terminated {
1506            panic!("polled EventRequestStream after completion");
1507        }
1508        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1509            |bytes, handles| {
1510                match this.inner.channel().read_etc(cx, bytes, handles) {
1511                    std::task::Poll::Ready(Ok(())) => {}
1512                    std::task::Poll::Pending => return std::task::Poll::Pending,
1513                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1514                        this.is_terminated = true;
1515                        return std::task::Poll::Ready(None);
1516                    }
1517                    std::task::Poll::Ready(Err(e)) => {
1518                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1519                            e.into(),
1520                        ))))
1521                    }
1522                }
1523
1524                // A message has been received from the channel
1525                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1526
1527                std::task::Poll::Ready(Some(match header.ordinal {
1528                    0x7b05b3f262635987 => {
1529                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1530                        let mut req = fidl::new_empty!(
1531                            EventCreateEventRequest,
1532                            fidl::encoding::DefaultFuchsiaResourceDialect
1533                        );
1534                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
1535                        let control_handle = EventControlHandle { inner: this.inner.clone() };
1536                        Ok(EventRequest::CreateEvent {
1537                            handle: req.handle,
1538
1539                            responder: EventCreateEventResponder {
1540                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1541                                tx_id: header.tx_id,
1542                            },
1543                        })
1544                    }
1545                    _ if header.tx_id == 0
1546                        && header
1547                            .dynamic_flags()
1548                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1549                    {
1550                        Ok(EventRequest::_UnknownMethod {
1551                            ordinal: header.ordinal,
1552                            control_handle: EventControlHandle { inner: this.inner.clone() },
1553                            method_type: fidl::MethodType::OneWay,
1554                        })
1555                    }
1556                    _ if header
1557                        .dynamic_flags()
1558                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1559                    {
1560                        this.inner.send_framework_err(
1561                            fidl::encoding::FrameworkErr::UnknownMethod,
1562                            header.tx_id,
1563                            header.ordinal,
1564                            header.dynamic_flags(),
1565                            (bytes, handles),
1566                        )?;
1567                        Ok(EventRequest::_UnknownMethod {
1568                            ordinal: header.ordinal,
1569                            control_handle: EventControlHandle { inner: this.inner.clone() },
1570                            method_type: fidl::MethodType::TwoWay,
1571                        })
1572                    }
1573                    _ => Err(fidl::Error::UnknownOrdinal {
1574                        ordinal: header.ordinal,
1575                        protocol_name: <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1576                    }),
1577                }))
1578            },
1579        )
1580    }
1581}
1582
1583#[derive(Debug)]
1584pub enum EventRequest {
1585    CreateEvent {
1586        handle: NewHandleId,
1587        responder: EventCreateEventResponder,
1588    },
1589    /// An interaction was received which does not match any known method.
1590    #[non_exhaustive]
1591    _UnknownMethod {
1592        /// Ordinal of the method that was called.
1593        ordinal: u64,
1594        control_handle: EventControlHandle,
1595        method_type: fidl::MethodType,
1596    },
1597}
1598
1599impl EventRequest {
1600    #[allow(irrefutable_let_patterns)]
1601    pub fn into_create_event(self) -> Option<(NewHandleId, EventCreateEventResponder)> {
1602        if let EventRequest::CreateEvent { handle, responder } = self {
1603            Some((handle, responder))
1604        } else {
1605            None
1606        }
1607    }
1608
1609    /// Name of the method defined in FIDL
1610    pub fn method_name(&self) -> &'static str {
1611        match *self {
1612            EventRequest::CreateEvent { .. } => "create_event",
1613            EventRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1614                "unknown one-way method"
1615            }
1616            EventRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1617                "unknown two-way method"
1618            }
1619        }
1620    }
1621}
1622
1623#[derive(Debug, Clone)]
1624pub struct EventControlHandle {
1625    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1626}
1627
1628impl fidl::endpoints::ControlHandle for EventControlHandle {
1629    fn shutdown(&self) {
1630        self.inner.shutdown()
1631    }
1632    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1633        self.inner.shutdown_with_epitaph(status)
1634    }
1635
1636    fn is_closed(&self) -> bool {
1637        self.inner.channel().is_closed()
1638    }
1639    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1640        self.inner.channel().on_closed()
1641    }
1642
1643    #[cfg(target_os = "fuchsia")]
1644    fn signal_peer(
1645        &self,
1646        clear_mask: zx::Signals,
1647        set_mask: zx::Signals,
1648    ) -> Result<(), zx_status::Status> {
1649        use fidl::Peered;
1650        self.inner.channel().signal_peer(clear_mask, set_mask)
1651    }
1652}
1653
1654impl EventControlHandle {}
1655
1656#[must_use = "FIDL methods require a response to be sent"]
1657#[derive(Debug)]
1658pub struct EventCreateEventResponder {
1659    control_handle: std::mem::ManuallyDrop<EventControlHandle>,
1660    tx_id: u32,
1661}
1662
1663/// Set the the channel to be shutdown (see [`EventControlHandle::shutdown`])
1664/// if the responder is dropped without sending a response, so that the client
1665/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1666impl std::ops::Drop for EventCreateEventResponder {
1667    fn drop(&mut self) {
1668        self.control_handle.shutdown();
1669        // Safety: drops once, never accessed again
1670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1671    }
1672}
1673
1674impl fidl::endpoints::Responder for EventCreateEventResponder {
1675    type ControlHandle = EventControlHandle;
1676
1677    fn control_handle(&self) -> &EventControlHandle {
1678        &self.control_handle
1679    }
1680
1681    fn drop_without_shutdown(mut self) {
1682        // Safety: drops once, never accessed again due to mem::forget
1683        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1684        // Prevent Drop from running (which would shut down the channel)
1685        std::mem::forget(self);
1686    }
1687}
1688
1689impl EventCreateEventResponder {
1690    /// Sends a response to the FIDL transaction.
1691    ///
1692    /// Sets the channel to shutdown if an error occurs.
1693    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1694        let _result = self.send_raw(result);
1695        if _result.is_err() {
1696            self.control_handle.shutdown();
1697        }
1698        self.drop_without_shutdown();
1699        _result
1700    }
1701
1702    /// Similar to "send" but does not shutdown the channel if an error occurs.
1703    pub fn send_no_shutdown_on_err(
1704        self,
1705        mut result: Result<(), &Error>,
1706    ) -> Result<(), fidl::Error> {
1707        let _result = self.send_raw(result);
1708        self.drop_without_shutdown();
1709        _result
1710    }
1711
1712    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1713        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1714            fidl::encoding::EmptyStruct,
1715            Error,
1716        >>(
1717            fidl::encoding::FlexibleResult::new(result),
1718            self.tx_id,
1719            0x7b05b3f262635987,
1720            fidl::encoding::DynamicFlags::FLEXIBLE,
1721        )
1722    }
1723}
1724
1725#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1726pub struct EventPairMarker;
1727
1728impl fidl::endpoints::ProtocolMarker for EventPairMarker {
1729    type Proxy = EventPairProxy;
1730    type RequestStream = EventPairRequestStream;
1731    #[cfg(target_os = "fuchsia")]
1732    type SynchronousProxy = EventPairSynchronousProxy;
1733
1734    const DEBUG_NAME: &'static str = "(anonymous) EventPair";
1735}
1736pub type EventPairCreateEventPairResult = Result<(), Error>;
1737
1738pub trait EventPairProxyInterface: Send + Sync {
1739    type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
1740        + Send;
1741    fn r#create_event_pair(&self, handles: &[NewHandleId; 2]) -> Self::CreateEventPairResponseFut;
1742}
1743#[derive(Debug)]
1744#[cfg(target_os = "fuchsia")]
1745pub struct EventPairSynchronousProxy {
1746    client: fidl::client::sync::Client,
1747}
1748
1749#[cfg(target_os = "fuchsia")]
1750impl fidl::endpoints::SynchronousProxy for EventPairSynchronousProxy {
1751    type Proxy = EventPairProxy;
1752    type Protocol = EventPairMarker;
1753
1754    fn from_channel(inner: fidl::Channel) -> Self {
1755        Self::new(inner)
1756    }
1757
1758    fn into_channel(self) -> fidl::Channel {
1759        self.client.into_channel()
1760    }
1761
1762    fn as_channel(&self) -> &fidl::Channel {
1763        self.client.as_channel()
1764    }
1765}
1766
1767#[cfg(target_os = "fuchsia")]
1768impl EventPairSynchronousProxy {
1769    pub fn new(channel: fidl::Channel) -> Self {
1770        let protocol_name = <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1771        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1772    }
1773
1774    pub fn into_channel(self) -> fidl::Channel {
1775        self.client.into_channel()
1776    }
1777
1778    /// Waits until an event arrives and returns it. It is safe for other
1779    /// threads to make concurrent requests while waiting for an event.
1780    pub fn wait_for_event(
1781        &self,
1782        deadline: zx::MonotonicInstant,
1783    ) -> Result<EventPairEvent, fidl::Error> {
1784        EventPairEvent::decode(self.client.wait_for_event(deadline)?)
1785    }
1786
1787    pub fn r#create_event_pair(
1788        &self,
1789        mut handles: &[NewHandleId; 2],
1790        ___deadline: zx::MonotonicInstant,
1791    ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
1792        let _response = self.client.send_query::<
1793            EventPairCreateEventPairRequest,
1794            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1795        >(
1796            (handles,),
1797            0x7aef61effa65656d,
1798            fidl::encoding::DynamicFlags::FLEXIBLE,
1799            ___deadline,
1800        )?
1801        .into_result::<EventPairMarker>("create_event_pair")?;
1802        Ok(_response.map(|x| x))
1803    }
1804}
1805
1806#[cfg(target_os = "fuchsia")]
1807impl From<EventPairSynchronousProxy> for zx::Handle {
1808    fn from(value: EventPairSynchronousProxy) -> Self {
1809        value.into_channel().into()
1810    }
1811}
1812
1813#[cfg(target_os = "fuchsia")]
1814impl From<fidl::Channel> for EventPairSynchronousProxy {
1815    fn from(value: fidl::Channel) -> Self {
1816        Self::new(value)
1817    }
1818}
1819
1820#[derive(Debug, Clone)]
1821pub struct EventPairProxy {
1822    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1823}
1824
1825impl fidl::endpoints::Proxy for EventPairProxy {
1826    type Protocol = EventPairMarker;
1827
1828    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1829        Self::new(inner)
1830    }
1831
1832    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1833        self.client.into_channel().map_err(|client| Self { client })
1834    }
1835
1836    fn as_channel(&self) -> &::fidl::AsyncChannel {
1837        self.client.as_channel()
1838    }
1839}
1840
1841impl EventPairProxy {
1842    /// Create a new Proxy for fuchsia.fdomain/EventPair.
1843    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1844        let protocol_name = <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1845        Self { client: fidl::client::Client::new(channel, protocol_name) }
1846    }
1847
1848    /// Get a Stream of events from the remote end of the protocol.
1849    ///
1850    /// # Panics
1851    ///
1852    /// Panics if the event stream was already taken.
1853    pub fn take_event_stream(&self) -> EventPairEventStream {
1854        EventPairEventStream { event_receiver: self.client.take_event_receiver() }
1855    }
1856
1857    pub fn r#create_event_pair(
1858        &self,
1859        mut handles: &[NewHandleId; 2],
1860    ) -> fidl::client::QueryResponseFut<
1861        EventPairCreateEventPairResult,
1862        fidl::encoding::DefaultFuchsiaResourceDialect,
1863    > {
1864        EventPairProxyInterface::r#create_event_pair(self, handles)
1865    }
1866}
1867
1868impl EventPairProxyInterface for EventPairProxy {
1869    type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
1870        EventPairCreateEventPairResult,
1871        fidl::encoding::DefaultFuchsiaResourceDialect,
1872    >;
1873    fn r#create_event_pair(
1874        &self,
1875        mut handles: &[NewHandleId; 2],
1876    ) -> Self::CreateEventPairResponseFut {
1877        fn _decode(
1878            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1879        ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
1880            let _response = fidl::client::decode_transaction_body::<
1881                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1882                fidl::encoding::DefaultFuchsiaResourceDialect,
1883                0x7aef61effa65656d,
1884            >(_buf?)?
1885            .into_result::<EventPairMarker>("create_event_pair")?;
1886            Ok(_response.map(|x| x))
1887        }
1888        self.client.send_query_and_decode::<
1889            EventPairCreateEventPairRequest,
1890            EventPairCreateEventPairResult,
1891        >(
1892            (handles,),
1893            0x7aef61effa65656d,
1894            fidl::encoding::DynamicFlags::FLEXIBLE,
1895            _decode,
1896        )
1897    }
1898}
1899
1900pub struct EventPairEventStream {
1901    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1902}
1903
1904impl std::marker::Unpin for EventPairEventStream {}
1905
1906impl futures::stream::FusedStream for EventPairEventStream {
1907    fn is_terminated(&self) -> bool {
1908        self.event_receiver.is_terminated()
1909    }
1910}
1911
1912impl futures::Stream for EventPairEventStream {
1913    type Item = Result<EventPairEvent, fidl::Error>;
1914
1915    fn poll_next(
1916        mut self: std::pin::Pin<&mut Self>,
1917        cx: &mut std::task::Context<'_>,
1918    ) -> std::task::Poll<Option<Self::Item>> {
1919        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1920            &mut self.event_receiver,
1921            cx
1922        )?) {
1923            Some(buf) => std::task::Poll::Ready(Some(EventPairEvent::decode(buf))),
1924            None => std::task::Poll::Ready(None),
1925        }
1926    }
1927}
1928
1929#[derive(Debug)]
1930pub enum EventPairEvent {
1931    #[non_exhaustive]
1932    _UnknownEvent {
1933        /// Ordinal of the event that was sent.
1934        ordinal: u64,
1935    },
1936}
1937
1938impl EventPairEvent {
1939    /// Decodes a message buffer as a [`EventPairEvent`].
1940    fn decode(
1941        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1942    ) -> Result<EventPairEvent, fidl::Error> {
1943        let (bytes, _handles) = buf.split_mut();
1944        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1945        debug_assert_eq!(tx_header.tx_id, 0);
1946        match tx_header.ordinal {
1947            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1948                Ok(EventPairEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1949            }
1950            _ => Err(fidl::Error::UnknownOrdinal {
1951                ordinal: tx_header.ordinal,
1952                protocol_name: <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1953            }),
1954        }
1955    }
1956}
1957
1958/// A Stream of incoming requests for fuchsia.fdomain/EventPair.
1959pub struct EventPairRequestStream {
1960    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1961    is_terminated: bool,
1962}
1963
1964impl std::marker::Unpin for EventPairRequestStream {}
1965
1966impl futures::stream::FusedStream for EventPairRequestStream {
1967    fn is_terminated(&self) -> bool {
1968        self.is_terminated
1969    }
1970}
1971
1972impl fidl::endpoints::RequestStream for EventPairRequestStream {
1973    type Protocol = EventPairMarker;
1974    type ControlHandle = EventPairControlHandle;
1975
1976    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1977        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1978    }
1979
1980    fn control_handle(&self) -> Self::ControlHandle {
1981        EventPairControlHandle { inner: self.inner.clone() }
1982    }
1983
1984    fn into_inner(
1985        self,
1986    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1987    {
1988        (self.inner, self.is_terminated)
1989    }
1990
1991    fn from_inner(
1992        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1993        is_terminated: bool,
1994    ) -> Self {
1995        Self { inner, is_terminated }
1996    }
1997}
1998
1999impl futures::Stream for EventPairRequestStream {
2000    type Item = Result<EventPairRequest, fidl::Error>;
2001
2002    fn poll_next(
2003        mut self: std::pin::Pin<&mut Self>,
2004        cx: &mut std::task::Context<'_>,
2005    ) -> std::task::Poll<Option<Self::Item>> {
2006        let this = &mut *self;
2007        if this.inner.check_shutdown(cx) {
2008            this.is_terminated = true;
2009            return std::task::Poll::Ready(None);
2010        }
2011        if this.is_terminated {
2012            panic!("polled EventPairRequestStream after completion");
2013        }
2014        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2015            |bytes, handles| {
2016                match this.inner.channel().read_etc(cx, bytes, handles) {
2017                    std::task::Poll::Ready(Ok(())) => {}
2018                    std::task::Poll::Pending => return std::task::Poll::Pending,
2019                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2020                        this.is_terminated = true;
2021                        return std::task::Poll::Ready(None);
2022                    }
2023                    std::task::Poll::Ready(Err(e)) => {
2024                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2025                            e.into(),
2026                        ))))
2027                    }
2028                }
2029
2030                // A message has been received from the channel
2031                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2032
2033                std::task::Poll::Ready(Some(match header.ordinal {
2034                    0x7aef61effa65656d => {
2035                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2036                        let mut req = fidl::new_empty!(
2037                            EventPairCreateEventPairRequest,
2038                            fidl::encoding::DefaultFuchsiaResourceDialect
2039                        );
2040                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
2041                        let control_handle = EventPairControlHandle { inner: this.inner.clone() };
2042                        Ok(EventPairRequest::CreateEventPair {
2043                            handles: req.handles,
2044
2045                            responder: EventPairCreateEventPairResponder {
2046                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2047                                tx_id: header.tx_id,
2048                            },
2049                        })
2050                    }
2051                    _ if header.tx_id == 0
2052                        && header
2053                            .dynamic_flags()
2054                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2055                    {
2056                        Ok(EventPairRequest::_UnknownMethod {
2057                            ordinal: header.ordinal,
2058                            control_handle: EventPairControlHandle { inner: this.inner.clone() },
2059                            method_type: fidl::MethodType::OneWay,
2060                        })
2061                    }
2062                    _ if header
2063                        .dynamic_flags()
2064                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2065                    {
2066                        this.inner.send_framework_err(
2067                            fidl::encoding::FrameworkErr::UnknownMethod,
2068                            header.tx_id,
2069                            header.ordinal,
2070                            header.dynamic_flags(),
2071                            (bytes, handles),
2072                        )?;
2073                        Ok(EventPairRequest::_UnknownMethod {
2074                            ordinal: header.ordinal,
2075                            control_handle: EventPairControlHandle { inner: this.inner.clone() },
2076                            method_type: fidl::MethodType::TwoWay,
2077                        })
2078                    }
2079                    _ => Err(fidl::Error::UnknownOrdinal {
2080                        ordinal: header.ordinal,
2081                        protocol_name:
2082                            <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2083                    }),
2084                }))
2085            },
2086        )
2087    }
2088}
2089
2090#[derive(Debug)]
2091pub enum EventPairRequest {
2092    CreateEventPair {
2093        handles: [NewHandleId; 2],
2094        responder: EventPairCreateEventPairResponder,
2095    },
2096    /// An interaction was received which does not match any known method.
2097    #[non_exhaustive]
2098    _UnknownMethod {
2099        /// Ordinal of the method that was called.
2100        ordinal: u64,
2101        control_handle: EventPairControlHandle,
2102        method_type: fidl::MethodType,
2103    },
2104}
2105
2106impl EventPairRequest {
2107    #[allow(irrefutable_let_patterns)]
2108    pub fn into_create_event_pair(
2109        self,
2110    ) -> Option<([NewHandleId; 2], EventPairCreateEventPairResponder)> {
2111        if let EventPairRequest::CreateEventPair { handles, responder } = self {
2112            Some((handles, responder))
2113        } else {
2114            None
2115        }
2116    }
2117
2118    /// Name of the method defined in FIDL
2119    pub fn method_name(&self) -> &'static str {
2120        match *self {
2121            EventPairRequest::CreateEventPair { .. } => "create_event_pair",
2122            EventPairRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2123                "unknown one-way method"
2124            }
2125            EventPairRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2126                "unknown two-way method"
2127            }
2128        }
2129    }
2130}
2131
2132#[derive(Debug, Clone)]
2133pub struct EventPairControlHandle {
2134    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2135}
2136
2137impl fidl::endpoints::ControlHandle for EventPairControlHandle {
2138    fn shutdown(&self) {
2139        self.inner.shutdown()
2140    }
2141    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2142        self.inner.shutdown_with_epitaph(status)
2143    }
2144
2145    fn is_closed(&self) -> bool {
2146        self.inner.channel().is_closed()
2147    }
2148    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2149        self.inner.channel().on_closed()
2150    }
2151
2152    #[cfg(target_os = "fuchsia")]
2153    fn signal_peer(
2154        &self,
2155        clear_mask: zx::Signals,
2156        set_mask: zx::Signals,
2157    ) -> Result<(), zx_status::Status> {
2158        use fidl::Peered;
2159        self.inner.channel().signal_peer(clear_mask, set_mask)
2160    }
2161}
2162
2163impl EventPairControlHandle {}
2164
2165#[must_use = "FIDL methods require a response to be sent"]
2166#[derive(Debug)]
2167pub struct EventPairCreateEventPairResponder {
2168    control_handle: std::mem::ManuallyDrop<EventPairControlHandle>,
2169    tx_id: u32,
2170}
2171
2172/// Set the the channel to be shutdown (see [`EventPairControlHandle::shutdown`])
2173/// if the responder is dropped without sending a response, so that the client
2174/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2175impl std::ops::Drop for EventPairCreateEventPairResponder {
2176    fn drop(&mut self) {
2177        self.control_handle.shutdown();
2178        // Safety: drops once, never accessed again
2179        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2180    }
2181}
2182
2183impl fidl::endpoints::Responder for EventPairCreateEventPairResponder {
2184    type ControlHandle = EventPairControlHandle;
2185
2186    fn control_handle(&self) -> &EventPairControlHandle {
2187        &self.control_handle
2188    }
2189
2190    fn drop_without_shutdown(mut self) {
2191        // Safety: drops once, never accessed again due to mem::forget
2192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2193        // Prevent Drop from running (which would shut down the channel)
2194        std::mem::forget(self);
2195    }
2196}
2197
2198impl EventPairCreateEventPairResponder {
2199    /// Sends a response to the FIDL transaction.
2200    ///
2201    /// Sets the channel to shutdown if an error occurs.
2202    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
2203        let _result = self.send_raw(result);
2204        if _result.is_err() {
2205            self.control_handle.shutdown();
2206        }
2207        self.drop_without_shutdown();
2208        _result
2209    }
2210
2211    /// Similar to "send" but does not shutdown the channel if an error occurs.
2212    pub fn send_no_shutdown_on_err(
2213        self,
2214        mut result: Result<(), &Error>,
2215    ) -> Result<(), fidl::Error> {
2216        let _result = self.send_raw(result);
2217        self.drop_without_shutdown();
2218        _result
2219    }
2220
2221    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
2222        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2223            fidl::encoding::EmptyStruct,
2224            Error,
2225        >>(
2226            fidl::encoding::FlexibleResult::new(result),
2227            self.tx_id,
2228            0x7aef61effa65656d,
2229            fidl::encoding::DynamicFlags::FLEXIBLE,
2230        )
2231    }
2232}
2233
2234#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2235pub struct FDomainMarker;
2236
2237impl fidl::endpoints::ProtocolMarker for FDomainMarker {
2238    type Proxy = FDomainProxy;
2239    type RequestStream = FDomainRequestStream;
2240    #[cfg(target_os = "fuchsia")]
2241    type SynchronousProxy = FDomainSynchronousProxy;
2242
2243    const DEBUG_NAME: &'static str = "(anonymous) FDomain";
2244}
2245pub type FDomainGetNamespaceResult = Result<(), Error>;
2246pub type FDomainCloseResult = Result<(), Error>;
2247pub type FDomainDuplicateResult = Result<(), Error>;
2248pub type FDomainReplaceResult = Result<(), Error>;
2249pub type FDomainSignalResult = Result<(), Error>;
2250pub type FDomainSignalPeerResult = Result<(), Error>;
2251pub type FDomainWaitForSignalsResult = Result<u32, Error>;
2252
2253pub trait FDomainProxyInterface: Send + Sync {
2254    type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
2255        + Send;
2256    fn r#create_channel(&self, handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut;
2257    type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
2258        + Send;
2259    fn r#read_channel(&self, handle: &HandleId) -> Self::ReadChannelResponseFut;
2260    type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
2261        + Send;
2262    fn r#write_channel(
2263        &self,
2264        handle: &HandleId,
2265        data: &[u8],
2266        handles: &Handles,
2267    ) -> Self::WriteChannelResponseFut;
2268    type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
2269        + Send;
2270    fn r#read_channel_streaming_start(
2271        &self,
2272        handle: &HandleId,
2273    ) -> Self::ReadChannelStreamingStartResponseFut;
2274    type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
2275        + Send;
2276    fn r#read_channel_streaming_stop(
2277        &self,
2278        handle: &HandleId,
2279    ) -> Self::ReadChannelStreamingStopResponseFut;
2280    type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
2281        + Send;
2282    fn r#create_event(&self, handle: &NewHandleId) -> Self::CreateEventResponseFut;
2283    type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
2284        + Send;
2285    fn r#create_event_pair(&self, handles: &[NewHandleId; 2]) -> Self::CreateEventPairResponseFut;
2286    type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
2287        + Send;
2288    fn r#create_socket(
2289        &self,
2290        options: SocketType,
2291        handles: &[NewHandleId; 2],
2292    ) -> Self::CreateSocketResponseFut;
2293    type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
2294        + Send;
2295    fn r#set_socket_disposition(
2296        &self,
2297        handle: &HandleId,
2298        disposition: SocketDisposition,
2299        disposition_peer: SocketDisposition,
2300    ) -> Self::SetSocketDispositionResponseFut;
2301    type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
2302        + Send;
2303    fn r#read_socket(&self, handle: &HandleId, max_bytes: u64) -> Self::ReadSocketResponseFut;
2304    type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
2305        + Send;
2306    fn r#write_socket(&self, handle: &HandleId, data: &[u8]) -> Self::WriteSocketResponseFut;
2307    type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
2308        + Send;
2309    fn r#read_socket_streaming_start(
2310        &self,
2311        handle: &HandleId,
2312    ) -> Self::ReadSocketStreamingStartResponseFut;
2313    type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
2314        + Send;
2315    fn r#read_socket_streaming_stop(
2316        &self,
2317        handle: &HandleId,
2318    ) -> Self::ReadSocketStreamingStopResponseFut;
2319    type GetNamespaceResponseFut: std::future::Future<Output = Result<FDomainGetNamespaceResult, fidl::Error>>
2320        + Send;
2321    fn r#get_namespace(&self, new_handle: &NewHandleId) -> Self::GetNamespaceResponseFut;
2322    type CloseResponseFut: std::future::Future<Output = Result<FDomainCloseResult, fidl::Error>>
2323        + Send;
2324    fn r#close(&self, handles: &[HandleId]) -> Self::CloseResponseFut;
2325    type DuplicateResponseFut: std::future::Future<Output = Result<FDomainDuplicateResult, fidl::Error>>
2326        + Send;
2327    fn r#duplicate(
2328        &self,
2329        handle: &HandleId,
2330        new_handle: &NewHandleId,
2331        rights: fidl::Rights,
2332    ) -> Self::DuplicateResponseFut;
2333    type ReplaceResponseFut: std::future::Future<Output = Result<FDomainReplaceResult, fidl::Error>>
2334        + Send;
2335    fn r#replace(
2336        &self,
2337        handle: &HandleId,
2338        new_handle: &NewHandleId,
2339        rights: fidl::Rights,
2340    ) -> Self::ReplaceResponseFut;
2341    type SignalResponseFut: std::future::Future<Output = Result<FDomainSignalResult, fidl::Error>>
2342        + Send;
2343    fn r#signal(&self, handle: &HandleId, set: u32, clear: u32) -> Self::SignalResponseFut;
2344    type SignalPeerResponseFut: std::future::Future<Output = Result<FDomainSignalPeerResult, fidl::Error>>
2345        + Send;
2346    fn r#signal_peer(&self, handle: &HandleId, set: u32, clear: u32)
2347        -> Self::SignalPeerResponseFut;
2348    type WaitForSignalsResponseFut: std::future::Future<Output = Result<FDomainWaitForSignalsResult, fidl::Error>>
2349        + Send;
2350    fn r#wait_for_signals(
2351        &self,
2352        handle: &HandleId,
2353        signals: u32,
2354    ) -> Self::WaitForSignalsResponseFut;
2355}
2356#[derive(Debug)]
2357#[cfg(target_os = "fuchsia")]
2358pub struct FDomainSynchronousProxy {
2359    client: fidl::client::sync::Client,
2360}
2361
2362#[cfg(target_os = "fuchsia")]
2363impl fidl::endpoints::SynchronousProxy for FDomainSynchronousProxy {
2364    type Proxy = FDomainProxy;
2365    type Protocol = FDomainMarker;
2366
2367    fn from_channel(inner: fidl::Channel) -> Self {
2368        Self::new(inner)
2369    }
2370
2371    fn into_channel(self) -> fidl::Channel {
2372        self.client.into_channel()
2373    }
2374
2375    fn as_channel(&self) -> &fidl::Channel {
2376        self.client.as_channel()
2377    }
2378}
2379
2380#[cfg(target_os = "fuchsia")]
2381impl FDomainSynchronousProxy {
2382    pub fn new(channel: fidl::Channel) -> Self {
2383        let protocol_name = <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2384        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2385    }
2386
2387    pub fn into_channel(self) -> fidl::Channel {
2388        self.client.into_channel()
2389    }
2390
2391    /// Waits until an event arrives and returns it. It is safe for other
2392    /// threads to make concurrent requests while waiting for an event.
2393    pub fn wait_for_event(
2394        &self,
2395        deadline: zx::MonotonicInstant,
2396    ) -> Result<FDomainEvent, fidl::Error> {
2397        FDomainEvent::decode(self.client.wait_for_event(deadline)?)
2398    }
2399
2400    pub fn r#create_channel(
2401        &self,
2402        mut handles: &[NewHandleId; 2],
2403        ___deadline: zx::MonotonicInstant,
2404    ) -> Result<ChannelCreateChannelResult, fidl::Error> {
2405        let _response = self.client.send_query::<
2406            ChannelCreateChannelRequest,
2407            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2408        >(
2409            (handles,),
2410            0x182d38bfe88673b5,
2411            fidl::encoding::DynamicFlags::FLEXIBLE,
2412            ___deadline,
2413        )?
2414        .into_result::<FDomainMarker>("create_channel")?;
2415        Ok(_response.map(|x| x))
2416    }
2417
2418    pub fn r#read_channel(
2419        &self,
2420        mut handle: &HandleId,
2421        ___deadline: zx::MonotonicInstant,
2422    ) -> Result<ChannelReadChannelResult, fidl::Error> {
2423        let _response = self.client.send_query::<
2424            ChannelReadChannelRequest,
2425            fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
2426        >(
2427            (handle,),
2428            0x6ef47bf27bf7d050,
2429            fidl::encoding::DynamicFlags::FLEXIBLE,
2430            ___deadline,
2431        )?
2432        .into_result::<FDomainMarker>("read_channel")?;
2433        Ok(_response.map(|x| (x.data, x.handles)))
2434    }
2435
2436    pub fn r#write_channel(
2437        &self,
2438        mut handle: &HandleId,
2439        mut data: &[u8],
2440        mut handles: &Handles,
2441        ___deadline: zx::MonotonicInstant,
2442    ) -> Result<ChannelWriteChannelResult, fidl::Error> {
2443        let _response = self.client.send_query::<
2444            ChannelWriteChannelRequest,
2445            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
2446        >(
2447            (handle, data, handles,),
2448            0x75a2559b945d5eb5,
2449            fidl::encoding::DynamicFlags::FLEXIBLE,
2450            ___deadline,
2451        )?
2452        .into_result::<FDomainMarker>("write_channel")?;
2453        Ok(_response.map(|x| x))
2454    }
2455
2456    pub fn r#read_channel_streaming_start(
2457        &self,
2458        mut handle: &HandleId,
2459        ___deadline: zx::MonotonicInstant,
2460    ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
2461        let _response = self.client.send_query::<
2462            ChannelReadChannelStreamingStartRequest,
2463            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2464        >(
2465            (handle,),
2466            0x3c73e85476a203df,
2467            fidl::encoding::DynamicFlags::FLEXIBLE,
2468            ___deadline,
2469        )?
2470        .into_result::<FDomainMarker>("read_channel_streaming_start")?;
2471        Ok(_response.map(|x| x))
2472    }
2473
2474    pub fn r#read_channel_streaming_stop(
2475        &self,
2476        mut handle: &HandleId,
2477        ___deadline: zx::MonotonicInstant,
2478    ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
2479        let _response = self.client.send_query::<
2480            ChannelReadChannelStreamingStopRequest,
2481            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2482        >(
2483            (handle,),
2484            0x56f21d6ed68186e0,
2485            fidl::encoding::DynamicFlags::FLEXIBLE,
2486            ___deadline,
2487        )?
2488        .into_result::<FDomainMarker>("read_channel_streaming_stop")?;
2489        Ok(_response.map(|x| x))
2490    }
2491
2492    pub fn r#create_event(
2493        &self,
2494        mut handle: &NewHandleId,
2495        ___deadline: zx::MonotonicInstant,
2496    ) -> Result<EventCreateEventResult, fidl::Error> {
2497        let _response = self.client.send_query::<
2498            EventCreateEventRequest,
2499            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2500        >(
2501            (handle,),
2502            0x7b05b3f262635987,
2503            fidl::encoding::DynamicFlags::FLEXIBLE,
2504            ___deadline,
2505        )?
2506        .into_result::<FDomainMarker>("create_event")?;
2507        Ok(_response.map(|x| x))
2508    }
2509
2510    pub fn r#create_event_pair(
2511        &self,
2512        mut handles: &[NewHandleId; 2],
2513        ___deadline: zx::MonotonicInstant,
2514    ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
2515        let _response = self.client.send_query::<
2516            EventPairCreateEventPairRequest,
2517            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2518        >(
2519            (handles,),
2520            0x7aef61effa65656d,
2521            fidl::encoding::DynamicFlags::FLEXIBLE,
2522            ___deadline,
2523        )?
2524        .into_result::<FDomainMarker>("create_event_pair")?;
2525        Ok(_response.map(|x| x))
2526    }
2527
2528    pub fn r#create_socket(
2529        &self,
2530        mut options: SocketType,
2531        mut handles: &[NewHandleId; 2],
2532        ___deadline: zx::MonotonicInstant,
2533    ) -> Result<SocketCreateSocketResult, fidl::Error> {
2534        let _response = self.client.send_query::<
2535            SocketCreateSocketRequest,
2536            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2537        >(
2538            (options, handles,),
2539            0x200bf0ea21932de0,
2540            fidl::encoding::DynamicFlags::FLEXIBLE,
2541            ___deadline,
2542        )?
2543        .into_result::<FDomainMarker>("create_socket")?;
2544        Ok(_response.map(|x| x))
2545    }
2546
2547    pub fn r#set_socket_disposition(
2548        &self,
2549        mut handle: &HandleId,
2550        mut disposition: SocketDisposition,
2551        mut disposition_peer: SocketDisposition,
2552        ___deadline: zx::MonotonicInstant,
2553    ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
2554        let _response = self.client.send_query::<
2555            SocketSetSocketDispositionRequest,
2556            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2557        >(
2558            (handle, disposition, disposition_peer,),
2559            0x60d3c7ccb17f9bdf,
2560            fidl::encoding::DynamicFlags::FLEXIBLE,
2561            ___deadline,
2562        )?
2563        .into_result::<FDomainMarker>("set_socket_disposition")?;
2564        Ok(_response.map(|x| x))
2565    }
2566
2567    pub fn r#read_socket(
2568        &self,
2569        mut handle: &HandleId,
2570        mut max_bytes: u64,
2571        ___deadline: zx::MonotonicInstant,
2572    ) -> Result<SocketReadSocketResult, fidl::Error> {
2573        let _response = self.client.send_query::<
2574            SocketReadSocketRequest,
2575            fidl::encoding::FlexibleResultType<SocketData, Error>,
2576        >(
2577            (handle, max_bytes,),
2578            0x1da8aabec249c02e,
2579            fidl::encoding::DynamicFlags::FLEXIBLE,
2580            ___deadline,
2581        )?
2582        .into_result::<FDomainMarker>("read_socket")?;
2583        Ok(_response.map(|x| (x.data, x.is_datagram)))
2584    }
2585
2586    pub fn r#write_socket(
2587        &self,
2588        mut handle: &HandleId,
2589        mut data: &[u8],
2590        ___deadline: zx::MonotonicInstant,
2591    ) -> Result<SocketWriteSocketResult, fidl::Error> {
2592        let _response = self.client.send_query::<
2593            SocketWriteSocketRequest,
2594            fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
2595        >(
2596            (handle, data,),
2597            0x5b541623cbbbf683,
2598            fidl::encoding::DynamicFlags::FLEXIBLE,
2599            ___deadline,
2600        )?
2601        .into_result::<FDomainMarker>("write_socket")?;
2602        Ok(_response.map(|x| x.wrote))
2603    }
2604
2605    pub fn r#read_socket_streaming_start(
2606        &self,
2607        mut handle: &HandleId,
2608        ___deadline: zx::MonotonicInstant,
2609    ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
2610        let _response = self.client.send_query::<
2611            SocketReadSocketStreamingStartRequest,
2612            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2613        >(
2614            (handle,),
2615            0x2a592748d5f33445,
2616            fidl::encoding::DynamicFlags::FLEXIBLE,
2617            ___deadline,
2618        )?
2619        .into_result::<FDomainMarker>("read_socket_streaming_start")?;
2620        Ok(_response.map(|x| x))
2621    }
2622
2623    pub fn r#read_socket_streaming_stop(
2624        &self,
2625        mut handle: &HandleId,
2626        ___deadline: zx::MonotonicInstant,
2627    ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
2628        let _response = self.client.send_query::<
2629            SocketReadSocketStreamingStopRequest,
2630            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2631        >(
2632            (handle,),
2633            0x53e5cade5f4d22e7,
2634            fidl::encoding::DynamicFlags::FLEXIBLE,
2635            ___deadline,
2636        )?
2637        .into_result::<FDomainMarker>("read_socket_streaming_stop")?;
2638        Ok(_response.map(|x| x))
2639    }
2640
2641    pub fn r#get_namespace(
2642        &self,
2643        mut new_handle: &NewHandleId,
2644        ___deadline: zx::MonotonicInstant,
2645    ) -> Result<FDomainGetNamespaceResult, fidl::Error> {
2646        let _response = self.client.send_query::<
2647            FDomainGetNamespaceRequest,
2648            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2649        >(
2650            (new_handle,),
2651            0x74f2e74d9f53e11e,
2652            fidl::encoding::DynamicFlags::FLEXIBLE,
2653            ___deadline,
2654        )?
2655        .into_result::<FDomainMarker>("get_namespace")?;
2656        Ok(_response.map(|x| x))
2657    }
2658
2659    pub fn r#close(
2660        &self,
2661        mut handles: &[HandleId],
2662        ___deadline: zx::MonotonicInstant,
2663    ) -> Result<FDomainCloseResult, fidl::Error> {
2664        let _response = self.client.send_query::<
2665            FDomainCloseRequest,
2666            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2667        >(
2668            (handles,),
2669            0x5ef8c24362964257,
2670            fidl::encoding::DynamicFlags::FLEXIBLE,
2671            ___deadline,
2672        )?
2673        .into_result::<FDomainMarker>("close")?;
2674        Ok(_response.map(|x| x))
2675    }
2676
2677    pub fn r#duplicate(
2678        &self,
2679        mut handle: &HandleId,
2680        mut new_handle: &NewHandleId,
2681        mut rights: fidl::Rights,
2682        ___deadline: zx::MonotonicInstant,
2683    ) -> Result<FDomainDuplicateResult, fidl::Error> {
2684        let _response = self.client.send_query::<
2685            FDomainDuplicateRequest,
2686            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2687        >(
2688            (handle, new_handle, rights,),
2689            0x7a85b94bd1777ab9,
2690            fidl::encoding::DynamicFlags::FLEXIBLE,
2691            ___deadline,
2692        )?
2693        .into_result::<FDomainMarker>("duplicate")?;
2694        Ok(_response.map(|x| x))
2695    }
2696
2697    pub fn r#replace(
2698        &self,
2699        mut handle: &HandleId,
2700        mut new_handle: &NewHandleId,
2701        mut rights: fidl::Rights,
2702        ___deadline: zx::MonotonicInstant,
2703    ) -> Result<FDomainReplaceResult, fidl::Error> {
2704        let _response = self.client.send_query::<
2705            FDomainReplaceRequest,
2706            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2707        >(
2708            (handle, new_handle, rights,),
2709            0x32fa64625a5bd3be,
2710            fidl::encoding::DynamicFlags::FLEXIBLE,
2711            ___deadline,
2712        )?
2713        .into_result::<FDomainMarker>("replace")?;
2714        Ok(_response.map(|x| x))
2715    }
2716
2717    pub fn r#signal(
2718        &self,
2719        mut handle: &HandleId,
2720        mut set: u32,
2721        mut clear: u32,
2722        ___deadline: zx::MonotonicInstant,
2723    ) -> Result<FDomainSignalResult, fidl::Error> {
2724        let _response = self.client.send_query::<
2725            FDomainSignalRequest,
2726            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2727        >(
2728            (handle, set, clear,),
2729            0xe8352fb978996d9,
2730            fidl::encoding::DynamicFlags::FLEXIBLE,
2731            ___deadline,
2732        )?
2733        .into_result::<FDomainMarker>("signal")?;
2734        Ok(_response.map(|x| x))
2735    }
2736
2737    pub fn r#signal_peer(
2738        &self,
2739        mut handle: &HandleId,
2740        mut set: u32,
2741        mut clear: u32,
2742        ___deadline: zx::MonotonicInstant,
2743    ) -> Result<FDomainSignalPeerResult, fidl::Error> {
2744        let _response = self.client.send_query::<
2745            FDomainSignalPeerRequest,
2746            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2747        >(
2748            (handle, set, clear,),
2749            0x7e84ec8ca7eabaf8,
2750            fidl::encoding::DynamicFlags::FLEXIBLE,
2751            ___deadline,
2752        )?
2753        .into_result::<FDomainMarker>("signal_peer")?;
2754        Ok(_response.map(|x| x))
2755    }
2756
2757    pub fn r#wait_for_signals(
2758        &self,
2759        mut handle: &HandleId,
2760        mut signals: u32,
2761        ___deadline: zx::MonotonicInstant,
2762    ) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
2763        let _response = self.client.send_query::<
2764            FDomainWaitForSignalsRequest,
2765            fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
2766        >(
2767            (handle, signals,),
2768            0x8f72d9b4b85c1eb,
2769            fidl::encoding::DynamicFlags::FLEXIBLE,
2770            ___deadline,
2771        )?
2772        .into_result::<FDomainMarker>("wait_for_signals")?;
2773        Ok(_response.map(|x| x.signals))
2774    }
2775}
2776
2777#[cfg(target_os = "fuchsia")]
2778impl From<FDomainSynchronousProxy> for zx::Handle {
2779    fn from(value: FDomainSynchronousProxy) -> Self {
2780        value.into_channel().into()
2781    }
2782}
2783
2784#[cfg(target_os = "fuchsia")]
2785impl From<fidl::Channel> for FDomainSynchronousProxy {
2786    fn from(value: fidl::Channel) -> Self {
2787        Self::new(value)
2788    }
2789}
2790
2791#[derive(Debug, Clone)]
2792pub struct FDomainProxy {
2793    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2794}
2795
2796impl fidl::endpoints::Proxy for FDomainProxy {
2797    type Protocol = FDomainMarker;
2798
2799    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2800        Self::new(inner)
2801    }
2802
2803    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2804        self.client.into_channel().map_err(|client| Self { client })
2805    }
2806
2807    fn as_channel(&self) -> &::fidl::AsyncChannel {
2808        self.client.as_channel()
2809    }
2810}
2811
2812impl FDomainProxy {
2813    /// Create a new Proxy for fuchsia.fdomain/FDomain.
2814    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2815        let protocol_name = <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2816        Self { client: fidl::client::Client::new(channel, protocol_name) }
2817    }
2818
2819    /// Get a Stream of events from the remote end of the protocol.
2820    ///
2821    /// # Panics
2822    ///
2823    /// Panics if the event stream was already taken.
2824    pub fn take_event_stream(&self) -> FDomainEventStream {
2825        FDomainEventStream { event_receiver: self.client.take_event_receiver() }
2826    }
2827
2828    pub fn r#create_channel(
2829        &self,
2830        mut handles: &[NewHandleId; 2],
2831    ) -> fidl::client::QueryResponseFut<
2832        ChannelCreateChannelResult,
2833        fidl::encoding::DefaultFuchsiaResourceDialect,
2834    > {
2835        FDomainProxyInterface::r#create_channel(self, handles)
2836    }
2837
2838    pub fn r#read_channel(
2839        &self,
2840        mut handle: &HandleId,
2841    ) -> fidl::client::QueryResponseFut<
2842        ChannelReadChannelResult,
2843        fidl::encoding::DefaultFuchsiaResourceDialect,
2844    > {
2845        FDomainProxyInterface::r#read_channel(self, handle)
2846    }
2847
2848    pub fn r#write_channel(
2849        &self,
2850        mut handle: &HandleId,
2851        mut data: &[u8],
2852        mut handles: &Handles,
2853    ) -> fidl::client::QueryResponseFut<
2854        ChannelWriteChannelResult,
2855        fidl::encoding::DefaultFuchsiaResourceDialect,
2856    > {
2857        FDomainProxyInterface::r#write_channel(self, handle, data, handles)
2858    }
2859
2860    pub fn r#read_channel_streaming_start(
2861        &self,
2862        mut handle: &HandleId,
2863    ) -> fidl::client::QueryResponseFut<
2864        ChannelReadChannelStreamingStartResult,
2865        fidl::encoding::DefaultFuchsiaResourceDialect,
2866    > {
2867        FDomainProxyInterface::r#read_channel_streaming_start(self, handle)
2868    }
2869
2870    pub fn r#read_channel_streaming_stop(
2871        &self,
2872        mut handle: &HandleId,
2873    ) -> fidl::client::QueryResponseFut<
2874        ChannelReadChannelStreamingStopResult,
2875        fidl::encoding::DefaultFuchsiaResourceDialect,
2876    > {
2877        FDomainProxyInterface::r#read_channel_streaming_stop(self, handle)
2878    }
2879
2880    pub fn r#create_event(
2881        &self,
2882        mut handle: &NewHandleId,
2883    ) -> fidl::client::QueryResponseFut<
2884        EventCreateEventResult,
2885        fidl::encoding::DefaultFuchsiaResourceDialect,
2886    > {
2887        FDomainProxyInterface::r#create_event(self, handle)
2888    }
2889
2890    pub fn r#create_event_pair(
2891        &self,
2892        mut handles: &[NewHandleId; 2],
2893    ) -> fidl::client::QueryResponseFut<
2894        EventPairCreateEventPairResult,
2895        fidl::encoding::DefaultFuchsiaResourceDialect,
2896    > {
2897        FDomainProxyInterface::r#create_event_pair(self, handles)
2898    }
2899
2900    pub fn r#create_socket(
2901        &self,
2902        mut options: SocketType,
2903        mut handles: &[NewHandleId; 2],
2904    ) -> fidl::client::QueryResponseFut<
2905        SocketCreateSocketResult,
2906        fidl::encoding::DefaultFuchsiaResourceDialect,
2907    > {
2908        FDomainProxyInterface::r#create_socket(self, options, handles)
2909    }
2910
2911    pub fn r#set_socket_disposition(
2912        &self,
2913        mut handle: &HandleId,
2914        mut disposition: SocketDisposition,
2915        mut disposition_peer: SocketDisposition,
2916    ) -> fidl::client::QueryResponseFut<
2917        SocketSetSocketDispositionResult,
2918        fidl::encoding::DefaultFuchsiaResourceDialect,
2919    > {
2920        FDomainProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
2921    }
2922
2923    pub fn r#read_socket(
2924        &self,
2925        mut handle: &HandleId,
2926        mut max_bytes: u64,
2927    ) -> fidl::client::QueryResponseFut<
2928        SocketReadSocketResult,
2929        fidl::encoding::DefaultFuchsiaResourceDialect,
2930    > {
2931        FDomainProxyInterface::r#read_socket(self, handle, max_bytes)
2932    }
2933
2934    pub fn r#write_socket(
2935        &self,
2936        mut handle: &HandleId,
2937        mut data: &[u8],
2938    ) -> fidl::client::QueryResponseFut<
2939        SocketWriteSocketResult,
2940        fidl::encoding::DefaultFuchsiaResourceDialect,
2941    > {
2942        FDomainProxyInterface::r#write_socket(self, handle, data)
2943    }
2944
2945    pub fn r#read_socket_streaming_start(
2946        &self,
2947        mut handle: &HandleId,
2948    ) -> fidl::client::QueryResponseFut<
2949        SocketReadSocketStreamingStartResult,
2950        fidl::encoding::DefaultFuchsiaResourceDialect,
2951    > {
2952        FDomainProxyInterface::r#read_socket_streaming_start(self, handle)
2953    }
2954
2955    pub fn r#read_socket_streaming_stop(
2956        &self,
2957        mut handle: &HandleId,
2958    ) -> fidl::client::QueryResponseFut<
2959        SocketReadSocketStreamingStopResult,
2960        fidl::encoding::DefaultFuchsiaResourceDialect,
2961    > {
2962        FDomainProxyInterface::r#read_socket_streaming_stop(self, handle)
2963    }
2964
2965    pub fn r#get_namespace(
2966        &self,
2967        mut new_handle: &NewHandleId,
2968    ) -> fidl::client::QueryResponseFut<
2969        FDomainGetNamespaceResult,
2970        fidl::encoding::DefaultFuchsiaResourceDialect,
2971    > {
2972        FDomainProxyInterface::r#get_namespace(self, new_handle)
2973    }
2974
2975    pub fn r#close(
2976        &self,
2977        mut handles: &[HandleId],
2978    ) -> fidl::client::QueryResponseFut<
2979        FDomainCloseResult,
2980        fidl::encoding::DefaultFuchsiaResourceDialect,
2981    > {
2982        FDomainProxyInterface::r#close(self, handles)
2983    }
2984
2985    pub fn r#duplicate(
2986        &self,
2987        mut handle: &HandleId,
2988        mut new_handle: &NewHandleId,
2989        mut rights: fidl::Rights,
2990    ) -> fidl::client::QueryResponseFut<
2991        FDomainDuplicateResult,
2992        fidl::encoding::DefaultFuchsiaResourceDialect,
2993    > {
2994        FDomainProxyInterface::r#duplicate(self, handle, new_handle, rights)
2995    }
2996
2997    pub fn r#replace(
2998        &self,
2999        mut handle: &HandleId,
3000        mut new_handle: &NewHandleId,
3001        mut rights: fidl::Rights,
3002    ) -> fidl::client::QueryResponseFut<
3003        FDomainReplaceResult,
3004        fidl::encoding::DefaultFuchsiaResourceDialect,
3005    > {
3006        FDomainProxyInterface::r#replace(self, handle, new_handle, rights)
3007    }
3008
3009    pub fn r#signal(
3010        &self,
3011        mut handle: &HandleId,
3012        mut set: u32,
3013        mut clear: u32,
3014    ) -> fidl::client::QueryResponseFut<
3015        FDomainSignalResult,
3016        fidl::encoding::DefaultFuchsiaResourceDialect,
3017    > {
3018        FDomainProxyInterface::r#signal(self, handle, set, clear)
3019    }
3020
3021    pub fn r#signal_peer(
3022        &self,
3023        mut handle: &HandleId,
3024        mut set: u32,
3025        mut clear: u32,
3026    ) -> fidl::client::QueryResponseFut<
3027        FDomainSignalPeerResult,
3028        fidl::encoding::DefaultFuchsiaResourceDialect,
3029    > {
3030        FDomainProxyInterface::r#signal_peer(self, handle, set, clear)
3031    }
3032
3033    pub fn r#wait_for_signals(
3034        &self,
3035        mut handle: &HandleId,
3036        mut signals: u32,
3037    ) -> fidl::client::QueryResponseFut<
3038        FDomainWaitForSignalsResult,
3039        fidl::encoding::DefaultFuchsiaResourceDialect,
3040    > {
3041        FDomainProxyInterface::r#wait_for_signals(self, handle, signals)
3042    }
3043}
3044
3045impl FDomainProxyInterface for FDomainProxy {
3046    type CreateChannelResponseFut = fidl::client::QueryResponseFut<
3047        ChannelCreateChannelResult,
3048        fidl::encoding::DefaultFuchsiaResourceDialect,
3049    >;
3050    fn r#create_channel(&self, mut handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut {
3051        fn _decode(
3052            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3053        ) -> Result<ChannelCreateChannelResult, fidl::Error> {
3054            let _response = fidl::client::decode_transaction_body::<
3055                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3056                fidl::encoding::DefaultFuchsiaResourceDialect,
3057                0x182d38bfe88673b5,
3058            >(_buf?)?
3059            .into_result::<FDomainMarker>("create_channel")?;
3060            Ok(_response.map(|x| x))
3061        }
3062        self.client
3063            .send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
3064                (handles,),
3065                0x182d38bfe88673b5,
3066                fidl::encoding::DynamicFlags::FLEXIBLE,
3067                _decode,
3068            )
3069    }
3070
3071    type ReadChannelResponseFut = fidl::client::QueryResponseFut<
3072        ChannelReadChannelResult,
3073        fidl::encoding::DefaultFuchsiaResourceDialect,
3074    >;
3075    fn r#read_channel(&self, mut handle: &HandleId) -> Self::ReadChannelResponseFut {
3076        fn _decode(
3077            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3078        ) -> Result<ChannelReadChannelResult, fidl::Error> {
3079            let _response = fidl::client::decode_transaction_body::<
3080                fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
3081                fidl::encoding::DefaultFuchsiaResourceDialect,
3082                0x6ef47bf27bf7d050,
3083            >(_buf?)?
3084            .into_result::<FDomainMarker>("read_channel")?;
3085            Ok(_response.map(|x| (x.data, x.handles)))
3086        }
3087        self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
3088            (handle,),
3089            0x6ef47bf27bf7d050,
3090            fidl::encoding::DynamicFlags::FLEXIBLE,
3091            _decode,
3092        )
3093    }
3094
3095    type WriteChannelResponseFut = fidl::client::QueryResponseFut<
3096        ChannelWriteChannelResult,
3097        fidl::encoding::DefaultFuchsiaResourceDialect,
3098    >;
3099    fn r#write_channel(
3100        &self,
3101        mut handle: &HandleId,
3102        mut data: &[u8],
3103        mut handles: &Handles,
3104    ) -> Self::WriteChannelResponseFut {
3105        fn _decode(
3106            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3107        ) -> Result<ChannelWriteChannelResult, fidl::Error> {
3108            let _response = fidl::client::decode_transaction_body::<
3109                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
3110                fidl::encoding::DefaultFuchsiaResourceDialect,
3111                0x75a2559b945d5eb5,
3112            >(_buf?)?
3113            .into_result::<FDomainMarker>("write_channel")?;
3114            Ok(_response.map(|x| x))
3115        }
3116        self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
3117            (handle, data, handles),
3118            0x75a2559b945d5eb5,
3119            fidl::encoding::DynamicFlags::FLEXIBLE,
3120            _decode,
3121        )
3122    }
3123
3124    type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
3125        ChannelReadChannelStreamingStartResult,
3126        fidl::encoding::DefaultFuchsiaResourceDialect,
3127    >;
3128    fn r#read_channel_streaming_start(
3129        &self,
3130        mut handle: &HandleId,
3131    ) -> Self::ReadChannelStreamingStartResponseFut {
3132        fn _decode(
3133            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3134        ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
3135            let _response = fidl::client::decode_transaction_body::<
3136                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3137                fidl::encoding::DefaultFuchsiaResourceDialect,
3138                0x3c73e85476a203df,
3139            >(_buf?)?
3140            .into_result::<FDomainMarker>("read_channel_streaming_start")?;
3141            Ok(_response.map(|x| x))
3142        }
3143        self.client.send_query_and_decode::<
3144            ChannelReadChannelStreamingStartRequest,
3145            ChannelReadChannelStreamingStartResult,
3146        >(
3147            (handle,),
3148            0x3c73e85476a203df,
3149            fidl::encoding::DynamicFlags::FLEXIBLE,
3150            _decode,
3151        )
3152    }
3153
3154    type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
3155        ChannelReadChannelStreamingStopResult,
3156        fidl::encoding::DefaultFuchsiaResourceDialect,
3157    >;
3158    fn r#read_channel_streaming_stop(
3159        &self,
3160        mut handle: &HandleId,
3161    ) -> Self::ReadChannelStreamingStopResponseFut {
3162        fn _decode(
3163            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3164        ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
3165            let _response = fidl::client::decode_transaction_body::<
3166                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3167                fidl::encoding::DefaultFuchsiaResourceDialect,
3168                0x56f21d6ed68186e0,
3169            >(_buf?)?
3170            .into_result::<FDomainMarker>("read_channel_streaming_stop")?;
3171            Ok(_response.map(|x| x))
3172        }
3173        self.client.send_query_and_decode::<
3174            ChannelReadChannelStreamingStopRequest,
3175            ChannelReadChannelStreamingStopResult,
3176        >(
3177            (handle,),
3178            0x56f21d6ed68186e0,
3179            fidl::encoding::DynamicFlags::FLEXIBLE,
3180            _decode,
3181        )
3182    }
3183
3184    type CreateEventResponseFut = fidl::client::QueryResponseFut<
3185        EventCreateEventResult,
3186        fidl::encoding::DefaultFuchsiaResourceDialect,
3187    >;
3188    fn r#create_event(&self, mut handle: &NewHandleId) -> Self::CreateEventResponseFut {
3189        fn _decode(
3190            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3191        ) -> Result<EventCreateEventResult, fidl::Error> {
3192            let _response = fidl::client::decode_transaction_body::<
3193                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3194                fidl::encoding::DefaultFuchsiaResourceDialect,
3195                0x7b05b3f262635987,
3196            >(_buf?)?
3197            .into_result::<FDomainMarker>("create_event")?;
3198            Ok(_response.map(|x| x))
3199        }
3200        self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
3201            (handle,),
3202            0x7b05b3f262635987,
3203            fidl::encoding::DynamicFlags::FLEXIBLE,
3204            _decode,
3205        )
3206    }
3207
3208    type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
3209        EventPairCreateEventPairResult,
3210        fidl::encoding::DefaultFuchsiaResourceDialect,
3211    >;
3212    fn r#create_event_pair(
3213        &self,
3214        mut handles: &[NewHandleId; 2],
3215    ) -> Self::CreateEventPairResponseFut {
3216        fn _decode(
3217            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3218        ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
3219            let _response = fidl::client::decode_transaction_body::<
3220                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3221                fidl::encoding::DefaultFuchsiaResourceDialect,
3222                0x7aef61effa65656d,
3223            >(_buf?)?
3224            .into_result::<FDomainMarker>("create_event_pair")?;
3225            Ok(_response.map(|x| x))
3226        }
3227        self.client.send_query_and_decode::<
3228            EventPairCreateEventPairRequest,
3229            EventPairCreateEventPairResult,
3230        >(
3231            (handles,),
3232            0x7aef61effa65656d,
3233            fidl::encoding::DynamicFlags::FLEXIBLE,
3234            _decode,
3235        )
3236    }
3237
3238    type CreateSocketResponseFut = fidl::client::QueryResponseFut<
3239        SocketCreateSocketResult,
3240        fidl::encoding::DefaultFuchsiaResourceDialect,
3241    >;
3242    fn r#create_socket(
3243        &self,
3244        mut options: SocketType,
3245        mut handles: &[NewHandleId; 2],
3246    ) -> Self::CreateSocketResponseFut {
3247        fn _decode(
3248            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3249        ) -> Result<SocketCreateSocketResult, fidl::Error> {
3250            let _response = fidl::client::decode_transaction_body::<
3251                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3252                fidl::encoding::DefaultFuchsiaResourceDialect,
3253                0x200bf0ea21932de0,
3254            >(_buf?)?
3255            .into_result::<FDomainMarker>("create_socket")?;
3256            Ok(_response.map(|x| x))
3257        }
3258        self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
3259            (options, handles),
3260            0x200bf0ea21932de0,
3261            fidl::encoding::DynamicFlags::FLEXIBLE,
3262            _decode,
3263        )
3264    }
3265
3266    type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
3267        SocketSetSocketDispositionResult,
3268        fidl::encoding::DefaultFuchsiaResourceDialect,
3269    >;
3270    fn r#set_socket_disposition(
3271        &self,
3272        mut handle: &HandleId,
3273        mut disposition: SocketDisposition,
3274        mut disposition_peer: SocketDisposition,
3275    ) -> Self::SetSocketDispositionResponseFut {
3276        fn _decode(
3277            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3278        ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
3279            let _response = fidl::client::decode_transaction_body::<
3280                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3281                fidl::encoding::DefaultFuchsiaResourceDialect,
3282                0x60d3c7ccb17f9bdf,
3283            >(_buf?)?
3284            .into_result::<FDomainMarker>("set_socket_disposition")?;
3285            Ok(_response.map(|x| x))
3286        }
3287        self.client.send_query_and_decode::<
3288            SocketSetSocketDispositionRequest,
3289            SocketSetSocketDispositionResult,
3290        >(
3291            (handle, disposition, disposition_peer,),
3292            0x60d3c7ccb17f9bdf,
3293            fidl::encoding::DynamicFlags::FLEXIBLE,
3294            _decode,
3295        )
3296    }
3297
3298    type ReadSocketResponseFut = fidl::client::QueryResponseFut<
3299        SocketReadSocketResult,
3300        fidl::encoding::DefaultFuchsiaResourceDialect,
3301    >;
3302    fn r#read_socket(
3303        &self,
3304        mut handle: &HandleId,
3305        mut max_bytes: u64,
3306    ) -> Self::ReadSocketResponseFut {
3307        fn _decode(
3308            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3309        ) -> Result<SocketReadSocketResult, fidl::Error> {
3310            let _response = fidl::client::decode_transaction_body::<
3311                fidl::encoding::FlexibleResultType<SocketData, Error>,
3312                fidl::encoding::DefaultFuchsiaResourceDialect,
3313                0x1da8aabec249c02e,
3314            >(_buf?)?
3315            .into_result::<FDomainMarker>("read_socket")?;
3316            Ok(_response.map(|x| (x.data, x.is_datagram)))
3317        }
3318        self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
3319            (handle, max_bytes),
3320            0x1da8aabec249c02e,
3321            fidl::encoding::DynamicFlags::FLEXIBLE,
3322            _decode,
3323        )
3324    }
3325
3326    type WriteSocketResponseFut = fidl::client::QueryResponseFut<
3327        SocketWriteSocketResult,
3328        fidl::encoding::DefaultFuchsiaResourceDialect,
3329    >;
3330    fn r#write_socket(
3331        &self,
3332        mut handle: &HandleId,
3333        mut data: &[u8],
3334    ) -> Self::WriteSocketResponseFut {
3335        fn _decode(
3336            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3337        ) -> Result<SocketWriteSocketResult, fidl::Error> {
3338            let _response = fidl::client::decode_transaction_body::<
3339                fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
3340                fidl::encoding::DefaultFuchsiaResourceDialect,
3341                0x5b541623cbbbf683,
3342            >(_buf?)?
3343            .into_result::<FDomainMarker>("write_socket")?;
3344            Ok(_response.map(|x| x.wrote))
3345        }
3346        self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
3347            (handle, data),
3348            0x5b541623cbbbf683,
3349            fidl::encoding::DynamicFlags::FLEXIBLE,
3350            _decode,
3351        )
3352    }
3353
3354    type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
3355        SocketReadSocketStreamingStartResult,
3356        fidl::encoding::DefaultFuchsiaResourceDialect,
3357    >;
3358    fn r#read_socket_streaming_start(
3359        &self,
3360        mut handle: &HandleId,
3361    ) -> Self::ReadSocketStreamingStartResponseFut {
3362        fn _decode(
3363            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3364        ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
3365            let _response = fidl::client::decode_transaction_body::<
3366                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3367                fidl::encoding::DefaultFuchsiaResourceDialect,
3368                0x2a592748d5f33445,
3369            >(_buf?)?
3370            .into_result::<FDomainMarker>("read_socket_streaming_start")?;
3371            Ok(_response.map(|x| x))
3372        }
3373        self.client.send_query_and_decode::<
3374            SocketReadSocketStreamingStartRequest,
3375            SocketReadSocketStreamingStartResult,
3376        >(
3377            (handle,),
3378            0x2a592748d5f33445,
3379            fidl::encoding::DynamicFlags::FLEXIBLE,
3380            _decode,
3381        )
3382    }
3383
3384    type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
3385        SocketReadSocketStreamingStopResult,
3386        fidl::encoding::DefaultFuchsiaResourceDialect,
3387    >;
3388    fn r#read_socket_streaming_stop(
3389        &self,
3390        mut handle: &HandleId,
3391    ) -> Self::ReadSocketStreamingStopResponseFut {
3392        fn _decode(
3393            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3394        ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
3395            let _response = fidl::client::decode_transaction_body::<
3396                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3397                fidl::encoding::DefaultFuchsiaResourceDialect,
3398                0x53e5cade5f4d22e7,
3399            >(_buf?)?
3400            .into_result::<FDomainMarker>("read_socket_streaming_stop")?;
3401            Ok(_response.map(|x| x))
3402        }
3403        self.client.send_query_and_decode::<
3404            SocketReadSocketStreamingStopRequest,
3405            SocketReadSocketStreamingStopResult,
3406        >(
3407            (handle,),
3408            0x53e5cade5f4d22e7,
3409            fidl::encoding::DynamicFlags::FLEXIBLE,
3410            _decode,
3411        )
3412    }
3413
3414    type GetNamespaceResponseFut = fidl::client::QueryResponseFut<
3415        FDomainGetNamespaceResult,
3416        fidl::encoding::DefaultFuchsiaResourceDialect,
3417    >;
3418    fn r#get_namespace(&self, mut new_handle: &NewHandleId) -> Self::GetNamespaceResponseFut {
3419        fn _decode(
3420            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3421        ) -> Result<FDomainGetNamespaceResult, fidl::Error> {
3422            let _response = fidl::client::decode_transaction_body::<
3423                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3424                fidl::encoding::DefaultFuchsiaResourceDialect,
3425                0x74f2e74d9f53e11e,
3426            >(_buf?)?
3427            .into_result::<FDomainMarker>("get_namespace")?;
3428            Ok(_response.map(|x| x))
3429        }
3430        self.client.send_query_and_decode::<FDomainGetNamespaceRequest, FDomainGetNamespaceResult>(
3431            (new_handle,),
3432            0x74f2e74d9f53e11e,
3433            fidl::encoding::DynamicFlags::FLEXIBLE,
3434            _decode,
3435        )
3436    }
3437
3438    type CloseResponseFut = fidl::client::QueryResponseFut<
3439        FDomainCloseResult,
3440        fidl::encoding::DefaultFuchsiaResourceDialect,
3441    >;
3442    fn r#close(&self, mut handles: &[HandleId]) -> Self::CloseResponseFut {
3443        fn _decode(
3444            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3445        ) -> Result<FDomainCloseResult, fidl::Error> {
3446            let _response = fidl::client::decode_transaction_body::<
3447                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3448                fidl::encoding::DefaultFuchsiaResourceDialect,
3449                0x5ef8c24362964257,
3450            >(_buf?)?
3451            .into_result::<FDomainMarker>("close")?;
3452            Ok(_response.map(|x| x))
3453        }
3454        self.client.send_query_and_decode::<FDomainCloseRequest, FDomainCloseResult>(
3455            (handles,),
3456            0x5ef8c24362964257,
3457            fidl::encoding::DynamicFlags::FLEXIBLE,
3458            _decode,
3459        )
3460    }
3461
3462    type DuplicateResponseFut = fidl::client::QueryResponseFut<
3463        FDomainDuplicateResult,
3464        fidl::encoding::DefaultFuchsiaResourceDialect,
3465    >;
3466    fn r#duplicate(
3467        &self,
3468        mut handle: &HandleId,
3469        mut new_handle: &NewHandleId,
3470        mut rights: fidl::Rights,
3471    ) -> Self::DuplicateResponseFut {
3472        fn _decode(
3473            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3474        ) -> Result<FDomainDuplicateResult, fidl::Error> {
3475            let _response = fidl::client::decode_transaction_body::<
3476                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3477                fidl::encoding::DefaultFuchsiaResourceDialect,
3478                0x7a85b94bd1777ab9,
3479            >(_buf?)?
3480            .into_result::<FDomainMarker>("duplicate")?;
3481            Ok(_response.map(|x| x))
3482        }
3483        self.client.send_query_and_decode::<FDomainDuplicateRequest, FDomainDuplicateResult>(
3484            (handle, new_handle, rights),
3485            0x7a85b94bd1777ab9,
3486            fidl::encoding::DynamicFlags::FLEXIBLE,
3487            _decode,
3488        )
3489    }
3490
3491    type ReplaceResponseFut = fidl::client::QueryResponseFut<
3492        FDomainReplaceResult,
3493        fidl::encoding::DefaultFuchsiaResourceDialect,
3494    >;
3495    fn r#replace(
3496        &self,
3497        mut handle: &HandleId,
3498        mut new_handle: &NewHandleId,
3499        mut rights: fidl::Rights,
3500    ) -> Self::ReplaceResponseFut {
3501        fn _decode(
3502            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3503        ) -> Result<FDomainReplaceResult, fidl::Error> {
3504            let _response = fidl::client::decode_transaction_body::<
3505                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3506                fidl::encoding::DefaultFuchsiaResourceDialect,
3507                0x32fa64625a5bd3be,
3508            >(_buf?)?
3509            .into_result::<FDomainMarker>("replace")?;
3510            Ok(_response.map(|x| x))
3511        }
3512        self.client.send_query_and_decode::<FDomainReplaceRequest, FDomainReplaceResult>(
3513            (handle, new_handle, rights),
3514            0x32fa64625a5bd3be,
3515            fidl::encoding::DynamicFlags::FLEXIBLE,
3516            _decode,
3517        )
3518    }
3519
3520    type SignalResponseFut = fidl::client::QueryResponseFut<
3521        FDomainSignalResult,
3522        fidl::encoding::DefaultFuchsiaResourceDialect,
3523    >;
3524    fn r#signal(
3525        &self,
3526        mut handle: &HandleId,
3527        mut set: u32,
3528        mut clear: u32,
3529    ) -> Self::SignalResponseFut {
3530        fn _decode(
3531            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3532        ) -> Result<FDomainSignalResult, fidl::Error> {
3533            let _response = fidl::client::decode_transaction_body::<
3534                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3535                fidl::encoding::DefaultFuchsiaResourceDialect,
3536                0xe8352fb978996d9,
3537            >(_buf?)?
3538            .into_result::<FDomainMarker>("signal")?;
3539            Ok(_response.map(|x| x))
3540        }
3541        self.client.send_query_and_decode::<FDomainSignalRequest, FDomainSignalResult>(
3542            (handle, set, clear),
3543            0xe8352fb978996d9,
3544            fidl::encoding::DynamicFlags::FLEXIBLE,
3545            _decode,
3546        )
3547    }
3548
3549    type SignalPeerResponseFut = fidl::client::QueryResponseFut<
3550        FDomainSignalPeerResult,
3551        fidl::encoding::DefaultFuchsiaResourceDialect,
3552    >;
3553    fn r#signal_peer(
3554        &self,
3555        mut handle: &HandleId,
3556        mut set: u32,
3557        mut clear: u32,
3558    ) -> Self::SignalPeerResponseFut {
3559        fn _decode(
3560            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3561        ) -> Result<FDomainSignalPeerResult, fidl::Error> {
3562            let _response = fidl::client::decode_transaction_body::<
3563                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3564                fidl::encoding::DefaultFuchsiaResourceDialect,
3565                0x7e84ec8ca7eabaf8,
3566            >(_buf?)?
3567            .into_result::<FDomainMarker>("signal_peer")?;
3568            Ok(_response.map(|x| x))
3569        }
3570        self.client.send_query_and_decode::<FDomainSignalPeerRequest, FDomainSignalPeerResult>(
3571            (handle, set, clear),
3572            0x7e84ec8ca7eabaf8,
3573            fidl::encoding::DynamicFlags::FLEXIBLE,
3574            _decode,
3575        )
3576    }
3577
3578    type WaitForSignalsResponseFut = fidl::client::QueryResponseFut<
3579        FDomainWaitForSignalsResult,
3580        fidl::encoding::DefaultFuchsiaResourceDialect,
3581    >;
3582    fn r#wait_for_signals(
3583        &self,
3584        mut handle: &HandleId,
3585        mut signals: u32,
3586    ) -> Self::WaitForSignalsResponseFut {
3587        fn _decode(
3588            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3589        ) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
3590            let _response = fidl::client::decode_transaction_body::<
3591                fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
3592                fidl::encoding::DefaultFuchsiaResourceDialect,
3593                0x8f72d9b4b85c1eb,
3594            >(_buf?)?
3595            .into_result::<FDomainMarker>("wait_for_signals")?;
3596            Ok(_response.map(|x| x.signals))
3597        }
3598        self.client
3599            .send_query_and_decode::<FDomainWaitForSignalsRequest, FDomainWaitForSignalsResult>(
3600                (handle, signals),
3601                0x8f72d9b4b85c1eb,
3602                fidl::encoding::DynamicFlags::FLEXIBLE,
3603                _decode,
3604            )
3605    }
3606}
3607
3608pub struct FDomainEventStream {
3609    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3610}
3611
3612impl std::marker::Unpin for FDomainEventStream {}
3613
3614impl futures::stream::FusedStream for FDomainEventStream {
3615    fn is_terminated(&self) -> bool {
3616        self.event_receiver.is_terminated()
3617    }
3618}
3619
3620impl futures::Stream for FDomainEventStream {
3621    type Item = Result<FDomainEvent, fidl::Error>;
3622
3623    fn poll_next(
3624        mut self: std::pin::Pin<&mut Self>,
3625        cx: &mut std::task::Context<'_>,
3626    ) -> std::task::Poll<Option<Self::Item>> {
3627        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3628            &mut self.event_receiver,
3629            cx
3630        )?) {
3631            Some(buf) => std::task::Poll::Ready(Some(FDomainEvent::decode(buf))),
3632            None => std::task::Poll::Ready(None),
3633        }
3634    }
3635}
3636
3637#[derive(Debug)]
3638pub enum FDomainEvent {
3639    OnChannelStreamingData {
3640        handle: HandleId,
3641        channel_sent: ChannelSent,
3642    },
3643    OnSocketStreamingData {
3644        handle: HandleId,
3645        socket_message: SocketMessage,
3646    },
3647    #[non_exhaustive]
3648    _UnknownEvent {
3649        /// Ordinal of the event that was sent.
3650        ordinal: u64,
3651    },
3652}
3653
3654impl FDomainEvent {
3655    #[allow(irrefutable_let_patterns)]
3656    pub fn into_on_channel_streaming_data(self) -> Option<(HandleId, ChannelSent)> {
3657        if let FDomainEvent::OnChannelStreamingData { handle, channel_sent } = self {
3658            Some((handle, channel_sent))
3659        } else {
3660            None
3661        }
3662    }
3663    #[allow(irrefutable_let_patterns)]
3664    pub fn into_on_socket_streaming_data(self) -> Option<(HandleId, SocketMessage)> {
3665        if let FDomainEvent::OnSocketStreamingData { handle, socket_message } = self {
3666            Some((handle, socket_message))
3667        } else {
3668            None
3669        }
3670    }
3671
3672    /// Decodes a message buffer as a [`FDomainEvent`].
3673    fn decode(
3674        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3675    ) -> Result<FDomainEvent, fidl::Error> {
3676        let (bytes, _handles) = buf.split_mut();
3677        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3678        debug_assert_eq!(tx_header.tx_id, 0);
3679        match tx_header.ordinal {
3680            0x7d4431805202dfe1 => {
3681                let mut out = fidl::new_empty!(
3682                    ChannelOnChannelStreamingDataRequest,
3683                    fidl::encoding::DefaultFuchsiaResourceDialect
3684                );
3685                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3686                Ok((FDomainEvent::OnChannelStreamingData {
3687                    handle: out.handle,
3688                    channel_sent: out.channel_sent,
3689                }))
3690            }
3691            0x998b5e66b3c80a2 => {
3692                let mut out = fidl::new_empty!(
3693                    SocketOnSocketStreamingDataRequest,
3694                    fidl::encoding::DefaultFuchsiaResourceDialect
3695                );
3696                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3697                Ok((FDomainEvent::OnSocketStreamingData {
3698                    handle: out.handle,
3699                    socket_message: out.socket_message,
3700                }))
3701            }
3702            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3703                Ok(FDomainEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3704            }
3705            _ => Err(fidl::Error::UnknownOrdinal {
3706                ordinal: tx_header.ordinal,
3707                protocol_name: <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3708            }),
3709        }
3710    }
3711}
3712
3713/// A Stream of incoming requests for fuchsia.fdomain/FDomain.
3714pub struct FDomainRequestStream {
3715    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3716    is_terminated: bool,
3717}
3718
3719impl std::marker::Unpin for FDomainRequestStream {}
3720
3721impl futures::stream::FusedStream for FDomainRequestStream {
3722    fn is_terminated(&self) -> bool {
3723        self.is_terminated
3724    }
3725}
3726
3727impl fidl::endpoints::RequestStream for FDomainRequestStream {
3728    type Protocol = FDomainMarker;
3729    type ControlHandle = FDomainControlHandle;
3730
3731    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3732        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3733    }
3734
3735    fn control_handle(&self) -> Self::ControlHandle {
3736        FDomainControlHandle { inner: self.inner.clone() }
3737    }
3738
3739    fn into_inner(
3740        self,
3741    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3742    {
3743        (self.inner, self.is_terminated)
3744    }
3745
3746    fn from_inner(
3747        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3748        is_terminated: bool,
3749    ) -> Self {
3750        Self { inner, is_terminated }
3751    }
3752}
3753
3754impl futures::Stream for FDomainRequestStream {
3755    type Item = Result<FDomainRequest, fidl::Error>;
3756
3757    fn poll_next(
3758        mut self: std::pin::Pin<&mut Self>,
3759        cx: &mut std::task::Context<'_>,
3760    ) -> std::task::Poll<Option<Self::Item>> {
3761        let this = &mut *self;
3762        if this.inner.check_shutdown(cx) {
3763            this.is_terminated = true;
3764            return std::task::Poll::Ready(None);
3765        }
3766        if this.is_terminated {
3767            panic!("polled FDomainRequestStream after completion");
3768        }
3769        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3770            |bytes, handles| {
3771                match this.inner.channel().read_etc(cx, bytes, handles) {
3772                    std::task::Poll::Ready(Ok(())) => {}
3773                    std::task::Poll::Pending => return std::task::Poll::Pending,
3774                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3775                        this.is_terminated = true;
3776                        return std::task::Poll::Ready(None);
3777                    }
3778                    std::task::Poll::Ready(Err(e)) => {
3779                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3780                            e.into(),
3781                        ))))
3782                    }
3783                }
3784
3785                // A message has been received from the channel
3786                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3787
3788                std::task::Poll::Ready(Some(match header.ordinal {
3789                    0x182d38bfe88673b5 => {
3790                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3791                        let mut req = fidl::new_empty!(
3792                            ChannelCreateChannelRequest,
3793                            fidl::encoding::DefaultFuchsiaResourceDialect
3794                        );
3795                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
3796                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3797                        Ok(FDomainRequest::CreateChannel {
3798                            handles: req.handles,
3799
3800                            responder: FDomainCreateChannelResponder {
3801                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3802                                tx_id: header.tx_id,
3803                            },
3804                        })
3805                    }
3806                    0x6ef47bf27bf7d050 => {
3807                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3808                        let mut req = fidl::new_empty!(
3809                            ChannelReadChannelRequest,
3810                            fidl::encoding::DefaultFuchsiaResourceDialect
3811                        );
3812                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
3813                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3814                        Ok(FDomainRequest::ReadChannel {
3815                            handle: req.handle,
3816
3817                            responder: FDomainReadChannelResponder {
3818                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3819                                tx_id: header.tx_id,
3820                            },
3821                        })
3822                    }
3823                    0x75a2559b945d5eb5 => {
3824                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3825                        let mut req = fidl::new_empty!(
3826                            ChannelWriteChannelRequest,
3827                            fidl::encoding::DefaultFuchsiaResourceDialect
3828                        );
3829                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
3830                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3831                        Ok(FDomainRequest::WriteChannel {
3832                            handle: req.handle,
3833                            data: req.data,
3834                            handles: req.handles,
3835
3836                            responder: FDomainWriteChannelResponder {
3837                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3838                                tx_id: header.tx_id,
3839                            },
3840                        })
3841                    }
3842                    0x3c73e85476a203df => {
3843                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3844                        let mut req = fidl::new_empty!(
3845                            ChannelReadChannelStreamingStartRequest,
3846                            fidl::encoding::DefaultFuchsiaResourceDialect
3847                        );
3848                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
3849                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3850                        Ok(FDomainRequest::ReadChannelStreamingStart {
3851                            handle: req.handle,
3852
3853                            responder: FDomainReadChannelStreamingStartResponder {
3854                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3855                                tx_id: header.tx_id,
3856                            },
3857                        })
3858                    }
3859                    0x56f21d6ed68186e0 => {
3860                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3861                        let mut req = fidl::new_empty!(
3862                            ChannelReadChannelStreamingStopRequest,
3863                            fidl::encoding::DefaultFuchsiaResourceDialect
3864                        );
3865                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
3866                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3867                        Ok(FDomainRequest::ReadChannelStreamingStop {
3868                            handle: req.handle,
3869
3870                            responder: FDomainReadChannelStreamingStopResponder {
3871                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3872                                tx_id: header.tx_id,
3873                            },
3874                        })
3875                    }
3876                    0x7b05b3f262635987 => {
3877                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3878                        let mut req = fidl::new_empty!(
3879                            EventCreateEventRequest,
3880                            fidl::encoding::DefaultFuchsiaResourceDialect
3881                        );
3882                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
3883                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3884                        Ok(FDomainRequest::CreateEvent {
3885                            handle: req.handle,
3886
3887                            responder: FDomainCreateEventResponder {
3888                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3889                                tx_id: header.tx_id,
3890                            },
3891                        })
3892                    }
3893                    0x7aef61effa65656d => {
3894                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3895                        let mut req = fidl::new_empty!(
3896                            EventPairCreateEventPairRequest,
3897                            fidl::encoding::DefaultFuchsiaResourceDialect
3898                        );
3899                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
3900                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3901                        Ok(FDomainRequest::CreateEventPair {
3902                            handles: req.handles,
3903
3904                            responder: FDomainCreateEventPairResponder {
3905                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3906                                tx_id: header.tx_id,
3907                            },
3908                        })
3909                    }
3910                    0x200bf0ea21932de0 => {
3911                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3912                        let mut req = fidl::new_empty!(
3913                            SocketCreateSocketRequest,
3914                            fidl::encoding::DefaultFuchsiaResourceDialect
3915                        );
3916                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
3917                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3918                        Ok(FDomainRequest::CreateSocket {
3919                            options: req.options,
3920                            handles: req.handles,
3921
3922                            responder: FDomainCreateSocketResponder {
3923                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3924                                tx_id: header.tx_id,
3925                            },
3926                        })
3927                    }
3928                    0x60d3c7ccb17f9bdf => {
3929                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3930                        let mut req = fidl::new_empty!(
3931                            SocketSetSocketDispositionRequest,
3932                            fidl::encoding::DefaultFuchsiaResourceDialect
3933                        );
3934                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
3935                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3936                        Ok(FDomainRequest::SetSocketDisposition {
3937                            handle: req.handle,
3938                            disposition: req.disposition,
3939                            disposition_peer: req.disposition_peer,
3940
3941                            responder: FDomainSetSocketDispositionResponder {
3942                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3943                                tx_id: header.tx_id,
3944                            },
3945                        })
3946                    }
3947                    0x1da8aabec249c02e => {
3948                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3949                        let mut req = fidl::new_empty!(
3950                            SocketReadSocketRequest,
3951                            fidl::encoding::DefaultFuchsiaResourceDialect
3952                        );
3953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
3954                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3955                        Ok(FDomainRequest::ReadSocket {
3956                            handle: req.handle,
3957                            max_bytes: req.max_bytes,
3958
3959                            responder: FDomainReadSocketResponder {
3960                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3961                                tx_id: header.tx_id,
3962                            },
3963                        })
3964                    }
3965                    0x5b541623cbbbf683 => {
3966                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3967                        let mut req = fidl::new_empty!(
3968                            SocketWriteSocketRequest,
3969                            fidl::encoding::DefaultFuchsiaResourceDialect
3970                        );
3971                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
3972                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3973                        Ok(FDomainRequest::WriteSocket {
3974                            handle: req.handle,
3975                            data: req.data,
3976
3977                            responder: FDomainWriteSocketResponder {
3978                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3979                                tx_id: header.tx_id,
3980                            },
3981                        })
3982                    }
3983                    0x2a592748d5f33445 => {
3984                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3985                        let mut req = fidl::new_empty!(
3986                            SocketReadSocketStreamingStartRequest,
3987                            fidl::encoding::DefaultFuchsiaResourceDialect
3988                        );
3989                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
3990                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3991                        Ok(FDomainRequest::ReadSocketStreamingStart {
3992                            handle: req.handle,
3993
3994                            responder: FDomainReadSocketStreamingStartResponder {
3995                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3996                                tx_id: header.tx_id,
3997                            },
3998                        })
3999                    }
4000                    0x53e5cade5f4d22e7 => {
4001                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4002                        let mut req = fidl::new_empty!(
4003                            SocketReadSocketStreamingStopRequest,
4004                            fidl::encoding::DefaultFuchsiaResourceDialect
4005                        );
4006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
4007                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4008                        Ok(FDomainRequest::ReadSocketStreamingStop {
4009                            handle: req.handle,
4010
4011                            responder: FDomainReadSocketStreamingStopResponder {
4012                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4013                                tx_id: header.tx_id,
4014                            },
4015                        })
4016                    }
4017                    0x74f2e74d9f53e11e => {
4018                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4019                        let mut req = fidl::new_empty!(
4020                            FDomainGetNamespaceRequest,
4021                            fidl::encoding::DefaultFuchsiaResourceDialect
4022                        );
4023                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainGetNamespaceRequest>(&header, _body_bytes, handles, &mut req)?;
4024                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4025                        Ok(FDomainRequest::GetNamespace {
4026                            new_handle: req.new_handle,
4027
4028                            responder: FDomainGetNamespaceResponder {
4029                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4030                                tx_id: header.tx_id,
4031                            },
4032                        })
4033                    }
4034                    0x5ef8c24362964257 => {
4035                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4036                        let mut req = fidl::new_empty!(
4037                            FDomainCloseRequest,
4038                            fidl::encoding::DefaultFuchsiaResourceDialect
4039                        );
4040                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainCloseRequest>(&header, _body_bytes, handles, &mut req)?;
4041                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4042                        Ok(FDomainRequest::Close {
4043                            handles: req.handles,
4044
4045                            responder: FDomainCloseResponder {
4046                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4047                                tx_id: header.tx_id,
4048                            },
4049                        })
4050                    }
4051                    0x7a85b94bd1777ab9 => {
4052                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4053                        let mut req = fidl::new_empty!(
4054                            FDomainDuplicateRequest,
4055                            fidl::encoding::DefaultFuchsiaResourceDialect
4056                        );
4057                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainDuplicateRequest>(&header, _body_bytes, handles, &mut req)?;
4058                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4059                        Ok(FDomainRequest::Duplicate {
4060                            handle: req.handle,
4061                            new_handle: req.new_handle,
4062                            rights: req.rights,
4063
4064                            responder: FDomainDuplicateResponder {
4065                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4066                                tx_id: header.tx_id,
4067                            },
4068                        })
4069                    }
4070                    0x32fa64625a5bd3be => {
4071                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4072                        let mut req = fidl::new_empty!(
4073                            FDomainReplaceRequest,
4074                            fidl::encoding::DefaultFuchsiaResourceDialect
4075                        );
4076                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
4077                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4078                        Ok(FDomainRequest::Replace {
4079                            handle: req.handle,
4080                            new_handle: req.new_handle,
4081                            rights: req.rights,
4082
4083                            responder: FDomainReplaceResponder {
4084                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4085                                tx_id: header.tx_id,
4086                            },
4087                        })
4088                    }
4089                    0xe8352fb978996d9 => {
4090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4091                        let mut req = fidl::new_empty!(
4092                            FDomainSignalRequest,
4093                            fidl::encoding::DefaultFuchsiaResourceDialect
4094                        );
4095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalRequest>(&header, _body_bytes, handles, &mut req)?;
4096                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4097                        Ok(FDomainRequest::Signal {
4098                            handle: req.handle,
4099                            set: req.set,
4100                            clear: req.clear,
4101
4102                            responder: FDomainSignalResponder {
4103                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4104                                tx_id: header.tx_id,
4105                            },
4106                        })
4107                    }
4108                    0x7e84ec8ca7eabaf8 => {
4109                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4110                        let mut req = fidl::new_empty!(
4111                            FDomainSignalPeerRequest,
4112                            fidl::encoding::DefaultFuchsiaResourceDialect
4113                        );
4114                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalPeerRequest>(&header, _body_bytes, handles, &mut req)?;
4115                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4116                        Ok(FDomainRequest::SignalPeer {
4117                            handle: req.handle,
4118                            set: req.set,
4119                            clear: req.clear,
4120
4121                            responder: FDomainSignalPeerResponder {
4122                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4123                                tx_id: header.tx_id,
4124                            },
4125                        })
4126                    }
4127                    0x8f72d9b4b85c1eb => {
4128                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4129                        let mut req = fidl::new_empty!(
4130                            FDomainWaitForSignalsRequest,
4131                            fidl::encoding::DefaultFuchsiaResourceDialect
4132                        );
4133                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainWaitForSignalsRequest>(&header, _body_bytes, handles, &mut req)?;
4134                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4135                        Ok(FDomainRequest::WaitForSignals {
4136                            handle: req.handle,
4137                            signals: req.signals,
4138
4139                            responder: FDomainWaitForSignalsResponder {
4140                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4141                                tx_id: header.tx_id,
4142                            },
4143                        })
4144                    }
4145                    _ if header.tx_id == 0
4146                        && header
4147                            .dynamic_flags()
4148                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4149                    {
4150                        Ok(FDomainRequest::_UnknownMethod {
4151                            ordinal: header.ordinal,
4152                            control_handle: FDomainControlHandle { inner: this.inner.clone() },
4153                            method_type: fidl::MethodType::OneWay,
4154                        })
4155                    }
4156                    _ if header
4157                        .dynamic_flags()
4158                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4159                    {
4160                        this.inner.send_framework_err(
4161                            fidl::encoding::FrameworkErr::UnknownMethod,
4162                            header.tx_id,
4163                            header.ordinal,
4164                            header.dynamic_flags(),
4165                            (bytes, handles),
4166                        )?;
4167                        Ok(FDomainRequest::_UnknownMethod {
4168                            ordinal: header.ordinal,
4169                            control_handle: FDomainControlHandle { inner: this.inner.clone() },
4170                            method_type: fidl::MethodType::TwoWay,
4171                        })
4172                    }
4173                    _ => Err(fidl::Error::UnknownOrdinal {
4174                        ordinal: header.ordinal,
4175                        protocol_name:
4176                            <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4177                    }),
4178                }))
4179            },
4180        )
4181    }
4182}
4183
4184#[derive(Debug)]
4185pub enum FDomainRequest {
4186    CreateChannel {
4187        handles: [NewHandleId; 2],
4188        responder: FDomainCreateChannelResponder,
4189    },
4190    ReadChannel {
4191        handle: HandleId,
4192        responder: FDomainReadChannelResponder,
4193    },
4194    WriteChannel {
4195        handle: HandleId,
4196        data: Vec<u8>,
4197        handles: Handles,
4198        responder: FDomainWriteChannelResponder,
4199    },
4200    ReadChannelStreamingStart {
4201        handle: HandleId,
4202        responder: FDomainReadChannelStreamingStartResponder,
4203    },
4204    ReadChannelStreamingStop {
4205        handle: HandleId,
4206        responder: FDomainReadChannelStreamingStopResponder,
4207    },
4208    CreateEvent {
4209        handle: NewHandleId,
4210        responder: FDomainCreateEventResponder,
4211    },
4212    CreateEventPair {
4213        handles: [NewHandleId; 2],
4214        responder: FDomainCreateEventPairResponder,
4215    },
4216    CreateSocket {
4217        options: SocketType,
4218        handles: [NewHandleId; 2],
4219        responder: FDomainCreateSocketResponder,
4220    },
4221    SetSocketDisposition {
4222        handle: HandleId,
4223        disposition: SocketDisposition,
4224        disposition_peer: SocketDisposition,
4225        responder: FDomainSetSocketDispositionResponder,
4226    },
4227    ReadSocket {
4228        handle: HandleId,
4229        max_bytes: u64,
4230        responder: FDomainReadSocketResponder,
4231    },
4232    WriteSocket {
4233        handle: HandleId,
4234        data: Vec<u8>,
4235        responder: FDomainWriteSocketResponder,
4236    },
4237    ReadSocketStreamingStart {
4238        handle: HandleId,
4239        responder: FDomainReadSocketStreamingStartResponder,
4240    },
4241    ReadSocketStreamingStop {
4242        handle: HandleId,
4243        responder: FDomainReadSocketStreamingStopResponder,
4244    },
4245    GetNamespace {
4246        new_handle: NewHandleId,
4247        responder: FDomainGetNamespaceResponder,
4248    },
4249    Close {
4250        handles: Vec<HandleId>,
4251        responder: FDomainCloseResponder,
4252    },
4253    Duplicate {
4254        handle: HandleId,
4255        new_handle: NewHandleId,
4256        rights: fidl::Rights,
4257        responder: FDomainDuplicateResponder,
4258    },
4259    Replace {
4260        handle: HandleId,
4261        new_handle: NewHandleId,
4262        rights: fidl::Rights,
4263        responder: FDomainReplaceResponder,
4264    },
4265    Signal {
4266        handle: HandleId,
4267        set: u32,
4268        clear: u32,
4269        responder: FDomainSignalResponder,
4270    },
4271    SignalPeer {
4272        handle: HandleId,
4273        set: u32,
4274        clear: u32,
4275        responder: FDomainSignalPeerResponder,
4276    },
4277    WaitForSignals {
4278        handle: HandleId,
4279        signals: u32,
4280        responder: FDomainWaitForSignalsResponder,
4281    },
4282    /// An interaction was received which does not match any known method.
4283    #[non_exhaustive]
4284    _UnknownMethod {
4285        /// Ordinal of the method that was called.
4286        ordinal: u64,
4287        control_handle: FDomainControlHandle,
4288        method_type: fidl::MethodType,
4289    },
4290}
4291
4292impl FDomainRequest {
4293    #[allow(irrefutable_let_patterns)]
4294    pub fn into_create_channel(self) -> Option<([NewHandleId; 2], FDomainCreateChannelResponder)> {
4295        if let FDomainRequest::CreateChannel { handles, responder } = self {
4296            Some((handles, responder))
4297        } else {
4298            None
4299        }
4300    }
4301
4302    #[allow(irrefutable_let_patterns)]
4303    pub fn into_read_channel(self) -> Option<(HandleId, FDomainReadChannelResponder)> {
4304        if let FDomainRequest::ReadChannel { handle, responder } = self {
4305            Some((handle, responder))
4306        } else {
4307            None
4308        }
4309    }
4310
4311    #[allow(irrefutable_let_patterns)]
4312    pub fn into_write_channel(
4313        self,
4314    ) -> Option<(HandleId, Vec<u8>, Handles, FDomainWriteChannelResponder)> {
4315        if let FDomainRequest::WriteChannel { handle, data, handles, responder } = self {
4316            Some((handle, data, handles, responder))
4317        } else {
4318            None
4319        }
4320    }
4321
4322    #[allow(irrefutable_let_patterns)]
4323    pub fn into_read_channel_streaming_start(
4324        self,
4325    ) -> Option<(HandleId, FDomainReadChannelStreamingStartResponder)> {
4326        if let FDomainRequest::ReadChannelStreamingStart { handle, responder } = self {
4327            Some((handle, responder))
4328        } else {
4329            None
4330        }
4331    }
4332
4333    #[allow(irrefutable_let_patterns)]
4334    pub fn into_read_channel_streaming_stop(
4335        self,
4336    ) -> Option<(HandleId, FDomainReadChannelStreamingStopResponder)> {
4337        if let FDomainRequest::ReadChannelStreamingStop { handle, responder } = self {
4338            Some((handle, responder))
4339        } else {
4340            None
4341        }
4342    }
4343
4344    #[allow(irrefutable_let_patterns)]
4345    pub fn into_create_event(self) -> Option<(NewHandleId, FDomainCreateEventResponder)> {
4346        if let FDomainRequest::CreateEvent { handle, responder } = self {
4347            Some((handle, responder))
4348        } else {
4349            None
4350        }
4351    }
4352
4353    #[allow(irrefutable_let_patterns)]
4354    pub fn into_create_event_pair(
4355        self,
4356    ) -> Option<([NewHandleId; 2], FDomainCreateEventPairResponder)> {
4357        if let FDomainRequest::CreateEventPair { handles, responder } = self {
4358            Some((handles, responder))
4359        } else {
4360            None
4361        }
4362    }
4363
4364    #[allow(irrefutable_let_patterns)]
4365    pub fn into_create_socket(
4366        self,
4367    ) -> Option<(SocketType, [NewHandleId; 2], FDomainCreateSocketResponder)> {
4368        if let FDomainRequest::CreateSocket { options, handles, responder } = self {
4369            Some((options, handles, responder))
4370        } else {
4371            None
4372        }
4373    }
4374
4375    #[allow(irrefutable_let_patterns)]
4376    pub fn into_set_socket_disposition(
4377        self,
4378    ) -> Option<(
4379        HandleId,
4380        SocketDisposition,
4381        SocketDisposition,
4382        FDomainSetSocketDispositionResponder,
4383    )> {
4384        if let FDomainRequest::SetSocketDisposition {
4385            handle,
4386            disposition,
4387            disposition_peer,
4388            responder,
4389        } = self
4390        {
4391            Some((handle, disposition, disposition_peer, responder))
4392        } else {
4393            None
4394        }
4395    }
4396
4397    #[allow(irrefutable_let_patterns)]
4398    pub fn into_read_socket(self) -> Option<(HandleId, u64, FDomainReadSocketResponder)> {
4399        if let FDomainRequest::ReadSocket { handle, max_bytes, responder } = self {
4400            Some((handle, max_bytes, responder))
4401        } else {
4402            None
4403        }
4404    }
4405
4406    #[allow(irrefutable_let_patterns)]
4407    pub fn into_write_socket(self) -> Option<(HandleId, Vec<u8>, FDomainWriteSocketResponder)> {
4408        if let FDomainRequest::WriteSocket { handle, data, responder } = self {
4409            Some((handle, data, responder))
4410        } else {
4411            None
4412        }
4413    }
4414
4415    #[allow(irrefutable_let_patterns)]
4416    pub fn into_read_socket_streaming_start(
4417        self,
4418    ) -> Option<(HandleId, FDomainReadSocketStreamingStartResponder)> {
4419        if let FDomainRequest::ReadSocketStreamingStart { handle, responder } = self {
4420            Some((handle, responder))
4421        } else {
4422            None
4423        }
4424    }
4425
4426    #[allow(irrefutable_let_patterns)]
4427    pub fn into_read_socket_streaming_stop(
4428        self,
4429    ) -> Option<(HandleId, FDomainReadSocketStreamingStopResponder)> {
4430        if let FDomainRequest::ReadSocketStreamingStop { handle, responder } = self {
4431            Some((handle, responder))
4432        } else {
4433            None
4434        }
4435    }
4436
4437    #[allow(irrefutable_let_patterns)]
4438    pub fn into_get_namespace(self) -> Option<(NewHandleId, FDomainGetNamespaceResponder)> {
4439        if let FDomainRequest::GetNamespace { new_handle, responder } = self {
4440            Some((new_handle, responder))
4441        } else {
4442            None
4443        }
4444    }
4445
4446    #[allow(irrefutable_let_patterns)]
4447    pub fn into_close(self) -> Option<(Vec<HandleId>, FDomainCloseResponder)> {
4448        if let FDomainRequest::Close { handles, responder } = self {
4449            Some((handles, responder))
4450        } else {
4451            None
4452        }
4453    }
4454
4455    #[allow(irrefutable_let_patterns)]
4456    pub fn into_duplicate(
4457        self,
4458    ) -> Option<(HandleId, NewHandleId, fidl::Rights, FDomainDuplicateResponder)> {
4459        if let FDomainRequest::Duplicate { handle, new_handle, rights, responder } = self {
4460            Some((handle, new_handle, rights, responder))
4461        } else {
4462            None
4463        }
4464    }
4465
4466    #[allow(irrefutable_let_patterns)]
4467    pub fn into_replace(
4468        self,
4469    ) -> Option<(HandleId, NewHandleId, fidl::Rights, FDomainReplaceResponder)> {
4470        if let FDomainRequest::Replace { handle, new_handle, rights, responder } = self {
4471            Some((handle, new_handle, rights, responder))
4472        } else {
4473            None
4474        }
4475    }
4476
4477    #[allow(irrefutable_let_patterns)]
4478    pub fn into_signal(self) -> Option<(HandleId, u32, u32, FDomainSignalResponder)> {
4479        if let FDomainRequest::Signal { handle, set, clear, responder } = self {
4480            Some((handle, set, clear, responder))
4481        } else {
4482            None
4483        }
4484    }
4485
4486    #[allow(irrefutable_let_patterns)]
4487    pub fn into_signal_peer(self) -> Option<(HandleId, u32, u32, FDomainSignalPeerResponder)> {
4488        if let FDomainRequest::SignalPeer { handle, set, clear, responder } = self {
4489            Some((handle, set, clear, responder))
4490        } else {
4491            None
4492        }
4493    }
4494
4495    #[allow(irrefutable_let_patterns)]
4496    pub fn into_wait_for_signals(self) -> Option<(HandleId, u32, FDomainWaitForSignalsResponder)> {
4497        if let FDomainRequest::WaitForSignals { handle, signals, responder } = self {
4498            Some((handle, signals, responder))
4499        } else {
4500            None
4501        }
4502    }
4503
4504    /// Name of the method defined in FIDL
4505    pub fn method_name(&self) -> &'static str {
4506        match *self {
4507            FDomainRequest::CreateChannel { .. } => "create_channel",
4508            FDomainRequest::ReadChannel { .. } => "read_channel",
4509            FDomainRequest::WriteChannel { .. } => "write_channel",
4510            FDomainRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
4511            FDomainRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
4512            FDomainRequest::CreateEvent { .. } => "create_event",
4513            FDomainRequest::CreateEventPair { .. } => "create_event_pair",
4514            FDomainRequest::CreateSocket { .. } => "create_socket",
4515            FDomainRequest::SetSocketDisposition { .. } => "set_socket_disposition",
4516            FDomainRequest::ReadSocket { .. } => "read_socket",
4517            FDomainRequest::WriteSocket { .. } => "write_socket",
4518            FDomainRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
4519            FDomainRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
4520            FDomainRequest::GetNamespace { .. } => "get_namespace",
4521            FDomainRequest::Close { .. } => "close",
4522            FDomainRequest::Duplicate { .. } => "duplicate",
4523            FDomainRequest::Replace { .. } => "replace",
4524            FDomainRequest::Signal { .. } => "signal",
4525            FDomainRequest::SignalPeer { .. } => "signal_peer",
4526            FDomainRequest::WaitForSignals { .. } => "wait_for_signals",
4527            FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4528                "unknown one-way method"
4529            }
4530            FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4531                "unknown two-way method"
4532            }
4533        }
4534    }
4535}
4536
4537#[derive(Debug, Clone)]
4538pub struct FDomainControlHandle {
4539    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4540}
4541
4542impl fidl::endpoints::ControlHandle for FDomainControlHandle {
4543    fn shutdown(&self) {
4544        self.inner.shutdown()
4545    }
4546    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4547        self.inner.shutdown_with_epitaph(status)
4548    }
4549
4550    fn is_closed(&self) -> bool {
4551        self.inner.channel().is_closed()
4552    }
4553    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4554        self.inner.channel().on_closed()
4555    }
4556
4557    #[cfg(target_os = "fuchsia")]
4558    fn signal_peer(
4559        &self,
4560        clear_mask: zx::Signals,
4561        set_mask: zx::Signals,
4562    ) -> Result<(), zx_status::Status> {
4563        use fidl::Peered;
4564        self.inner.channel().signal_peer(clear_mask, set_mask)
4565    }
4566}
4567
4568impl FDomainControlHandle {
4569    pub fn send_on_channel_streaming_data(
4570        &self,
4571        mut handle: &HandleId,
4572        mut channel_sent: &ChannelSent,
4573    ) -> Result<(), fidl::Error> {
4574        self.inner.send::<ChannelOnChannelStreamingDataRequest>(
4575            (handle, channel_sent),
4576            0,
4577            0x7d4431805202dfe1,
4578            fidl::encoding::DynamicFlags::FLEXIBLE,
4579        )
4580    }
4581
4582    pub fn send_on_socket_streaming_data(
4583        &self,
4584        mut handle: &HandleId,
4585        mut socket_message: &SocketMessage,
4586    ) -> Result<(), fidl::Error> {
4587        self.inner.send::<SocketOnSocketStreamingDataRequest>(
4588            (handle, socket_message),
4589            0,
4590            0x998b5e66b3c80a2,
4591            fidl::encoding::DynamicFlags::FLEXIBLE,
4592        )
4593    }
4594}
4595
4596#[must_use = "FIDL methods require a response to be sent"]
4597#[derive(Debug)]
4598pub struct FDomainCreateChannelResponder {
4599    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4600    tx_id: u32,
4601}
4602
4603/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4604/// if the responder is dropped without sending a response, so that the client
4605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4606impl std::ops::Drop for FDomainCreateChannelResponder {
4607    fn drop(&mut self) {
4608        self.control_handle.shutdown();
4609        // Safety: drops once, never accessed again
4610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4611    }
4612}
4613
4614impl fidl::endpoints::Responder for FDomainCreateChannelResponder {
4615    type ControlHandle = FDomainControlHandle;
4616
4617    fn control_handle(&self) -> &FDomainControlHandle {
4618        &self.control_handle
4619    }
4620
4621    fn drop_without_shutdown(mut self) {
4622        // Safety: drops once, never accessed again due to mem::forget
4623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4624        // Prevent Drop from running (which would shut down the channel)
4625        std::mem::forget(self);
4626    }
4627}
4628
4629impl FDomainCreateChannelResponder {
4630    /// Sends a response to the FIDL transaction.
4631    ///
4632    /// Sets the channel to shutdown if an error occurs.
4633    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4634        let _result = self.send_raw(result);
4635        if _result.is_err() {
4636            self.control_handle.shutdown();
4637        }
4638        self.drop_without_shutdown();
4639        _result
4640    }
4641
4642    /// Similar to "send" but does not shutdown the channel if an error occurs.
4643    pub fn send_no_shutdown_on_err(
4644        self,
4645        mut result: Result<(), &Error>,
4646    ) -> Result<(), fidl::Error> {
4647        let _result = self.send_raw(result);
4648        self.drop_without_shutdown();
4649        _result
4650    }
4651
4652    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4653        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4654            fidl::encoding::EmptyStruct,
4655            Error,
4656        >>(
4657            fidl::encoding::FlexibleResult::new(result),
4658            self.tx_id,
4659            0x182d38bfe88673b5,
4660            fidl::encoding::DynamicFlags::FLEXIBLE,
4661        )
4662    }
4663}
4664
4665#[must_use = "FIDL methods require a response to be sent"]
4666#[derive(Debug)]
4667pub struct FDomainReadChannelResponder {
4668    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4669    tx_id: u32,
4670}
4671
4672/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4673/// if the responder is dropped without sending a response, so that the client
4674/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4675impl std::ops::Drop for FDomainReadChannelResponder {
4676    fn drop(&mut self) {
4677        self.control_handle.shutdown();
4678        // Safety: drops once, never accessed again
4679        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4680    }
4681}
4682
4683impl fidl::endpoints::Responder for FDomainReadChannelResponder {
4684    type ControlHandle = FDomainControlHandle;
4685
4686    fn control_handle(&self) -> &FDomainControlHandle {
4687        &self.control_handle
4688    }
4689
4690    fn drop_without_shutdown(mut self) {
4691        // Safety: drops once, never accessed again due to mem::forget
4692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4693        // Prevent Drop from running (which would shut down the channel)
4694        std::mem::forget(self);
4695    }
4696}
4697
4698impl FDomainReadChannelResponder {
4699    /// Sends a response to the FIDL transaction.
4700    ///
4701    /// Sets the channel to shutdown if an error occurs.
4702    pub fn send(
4703        self,
4704        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
4705    ) -> Result<(), fidl::Error> {
4706        let _result = self.send_raw(result);
4707        if _result.is_err() {
4708            self.control_handle.shutdown();
4709        }
4710        self.drop_without_shutdown();
4711        _result
4712    }
4713
4714    /// Similar to "send" but does not shutdown the channel if an error occurs.
4715    pub fn send_no_shutdown_on_err(
4716        self,
4717        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
4718    ) -> Result<(), fidl::Error> {
4719        let _result = self.send_raw(result);
4720        self.drop_without_shutdown();
4721        _result
4722    }
4723
4724    fn send_raw(
4725        &self,
4726        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
4727    ) -> Result<(), fidl::Error> {
4728        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
4729            fidl::encoding::FlexibleResult::new(result),
4730            self.tx_id,
4731            0x6ef47bf27bf7d050,
4732            fidl::encoding::DynamicFlags::FLEXIBLE,
4733        )
4734    }
4735}
4736
4737#[must_use = "FIDL methods require a response to be sent"]
4738#[derive(Debug)]
4739pub struct FDomainWriteChannelResponder {
4740    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4741    tx_id: u32,
4742}
4743
4744/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4745/// if the responder is dropped without sending a response, so that the client
4746/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4747impl std::ops::Drop for FDomainWriteChannelResponder {
4748    fn drop(&mut self) {
4749        self.control_handle.shutdown();
4750        // Safety: drops once, never accessed again
4751        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4752    }
4753}
4754
4755impl fidl::endpoints::Responder for FDomainWriteChannelResponder {
4756    type ControlHandle = FDomainControlHandle;
4757
4758    fn control_handle(&self) -> &FDomainControlHandle {
4759        &self.control_handle
4760    }
4761
4762    fn drop_without_shutdown(mut self) {
4763        // Safety: drops once, never accessed again due to mem::forget
4764        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4765        // Prevent Drop from running (which would shut down the channel)
4766        std::mem::forget(self);
4767    }
4768}
4769
4770impl FDomainWriteChannelResponder {
4771    /// Sends a response to the FIDL transaction.
4772    ///
4773    /// Sets the channel to shutdown if an error occurs.
4774    pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
4775        let _result = self.send_raw(result);
4776        if _result.is_err() {
4777            self.control_handle.shutdown();
4778        }
4779        self.drop_without_shutdown();
4780        _result
4781    }
4782
4783    /// Similar to "send" but does not shutdown the channel if an error occurs.
4784    pub fn send_no_shutdown_on_err(
4785        self,
4786        mut result: Result<(), &WriteChannelError>,
4787    ) -> Result<(), fidl::Error> {
4788        let _result = self.send_raw(result);
4789        self.drop_without_shutdown();
4790        _result
4791    }
4792
4793    fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
4794        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4795            fidl::encoding::EmptyStruct,
4796            WriteChannelError,
4797        >>(
4798            fidl::encoding::FlexibleResult::new(result),
4799            self.tx_id,
4800            0x75a2559b945d5eb5,
4801            fidl::encoding::DynamicFlags::FLEXIBLE,
4802        )
4803    }
4804}
4805
4806#[must_use = "FIDL methods require a response to be sent"]
4807#[derive(Debug)]
4808pub struct FDomainReadChannelStreamingStartResponder {
4809    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4810    tx_id: u32,
4811}
4812
4813/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4814/// if the responder is dropped without sending a response, so that the client
4815/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4816impl std::ops::Drop for FDomainReadChannelStreamingStartResponder {
4817    fn drop(&mut self) {
4818        self.control_handle.shutdown();
4819        // Safety: drops once, never accessed again
4820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4821    }
4822}
4823
4824impl fidl::endpoints::Responder for FDomainReadChannelStreamingStartResponder {
4825    type ControlHandle = FDomainControlHandle;
4826
4827    fn control_handle(&self) -> &FDomainControlHandle {
4828        &self.control_handle
4829    }
4830
4831    fn drop_without_shutdown(mut self) {
4832        // Safety: drops once, never accessed again due to mem::forget
4833        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4834        // Prevent Drop from running (which would shut down the channel)
4835        std::mem::forget(self);
4836    }
4837}
4838
4839impl FDomainReadChannelStreamingStartResponder {
4840    /// Sends a response to the FIDL transaction.
4841    ///
4842    /// Sets the channel to shutdown if an error occurs.
4843    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4844        let _result = self.send_raw(result);
4845        if _result.is_err() {
4846            self.control_handle.shutdown();
4847        }
4848        self.drop_without_shutdown();
4849        _result
4850    }
4851
4852    /// Similar to "send" but does not shutdown the channel if an error occurs.
4853    pub fn send_no_shutdown_on_err(
4854        self,
4855        mut result: Result<(), &Error>,
4856    ) -> Result<(), fidl::Error> {
4857        let _result = self.send_raw(result);
4858        self.drop_without_shutdown();
4859        _result
4860    }
4861
4862    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4863        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4864            fidl::encoding::EmptyStruct,
4865            Error,
4866        >>(
4867            fidl::encoding::FlexibleResult::new(result),
4868            self.tx_id,
4869            0x3c73e85476a203df,
4870            fidl::encoding::DynamicFlags::FLEXIBLE,
4871        )
4872    }
4873}
4874
4875#[must_use = "FIDL methods require a response to be sent"]
4876#[derive(Debug)]
4877pub struct FDomainReadChannelStreamingStopResponder {
4878    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4879    tx_id: u32,
4880}
4881
4882/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4883/// if the responder is dropped without sending a response, so that the client
4884/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4885impl std::ops::Drop for FDomainReadChannelStreamingStopResponder {
4886    fn drop(&mut self) {
4887        self.control_handle.shutdown();
4888        // Safety: drops once, never accessed again
4889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4890    }
4891}
4892
4893impl fidl::endpoints::Responder for FDomainReadChannelStreamingStopResponder {
4894    type ControlHandle = FDomainControlHandle;
4895
4896    fn control_handle(&self) -> &FDomainControlHandle {
4897        &self.control_handle
4898    }
4899
4900    fn drop_without_shutdown(mut self) {
4901        // Safety: drops once, never accessed again due to mem::forget
4902        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4903        // Prevent Drop from running (which would shut down the channel)
4904        std::mem::forget(self);
4905    }
4906}
4907
4908impl FDomainReadChannelStreamingStopResponder {
4909    /// Sends a response to the FIDL transaction.
4910    ///
4911    /// Sets the channel to shutdown if an error occurs.
4912    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4913        let _result = self.send_raw(result);
4914        if _result.is_err() {
4915            self.control_handle.shutdown();
4916        }
4917        self.drop_without_shutdown();
4918        _result
4919    }
4920
4921    /// Similar to "send" but does not shutdown the channel if an error occurs.
4922    pub fn send_no_shutdown_on_err(
4923        self,
4924        mut result: Result<(), &Error>,
4925    ) -> Result<(), fidl::Error> {
4926        let _result = self.send_raw(result);
4927        self.drop_without_shutdown();
4928        _result
4929    }
4930
4931    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4932        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4933            fidl::encoding::EmptyStruct,
4934            Error,
4935        >>(
4936            fidl::encoding::FlexibleResult::new(result),
4937            self.tx_id,
4938            0x56f21d6ed68186e0,
4939            fidl::encoding::DynamicFlags::FLEXIBLE,
4940        )
4941    }
4942}
4943
4944#[must_use = "FIDL methods require a response to be sent"]
4945#[derive(Debug)]
4946pub struct FDomainCreateEventResponder {
4947    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4948    tx_id: u32,
4949}
4950
4951/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4952/// if the responder is dropped without sending a response, so that the client
4953/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4954impl std::ops::Drop for FDomainCreateEventResponder {
4955    fn drop(&mut self) {
4956        self.control_handle.shutdown();
4957        // Safety: drops once, never accessed again
4958        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4959    }
4960}
4961
4962impl fidl::endpoints::Responder for FDomainCreateEventResponder {
4963    type ControlHandle = FDomainControlHandle;
4964
4965    fn control_handle(&self) -> &FDomainControlHandle {
4966        &self.control_handle
4967    }
4968
4969    fn drop_without_shutdown(mut self) {
4970        // Safety: drops once, never accessed again due to mem::forget
4971        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4972        // Prevent Drop from running (which would shut down the channel)
4973        std::mem::forget(self);
4974    }
4975}
4976
4977impl FDomainCreateEventResponder {
4978    /// Sends a response to the FIDL transaction.
4979    ///
4980    /// Sets the channel to shutdown if an error occurs.
4981    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4982        let _result = self.send_raw(result);
4983        if _result.is_err() {
4984            self.control_handle.shutdown();
4985        }
4986        self.drop_without_shutdown();
4987        _result
4988    }
4989
4990    /// Similar to "send" but does not shutdown the channel if an error occurs.
4991    pub fn send_no_shutdown_on_err(
4992        self,
4993        mut result: Result<(), &Error>,
4994    ) -> Result<(), fidl::Error> {
4995        let _result = self.send_raw(result);
4996        self.drop_without_shutdown();
4997        _result
4998    }
4999
5000    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5001        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5002            fidl::encoding::EmptyStruct,
5003            Error,
5004        >>(
5005            fidl::encoding::FlexibleResult::new(result),
5006            self.tx_id,
5007            0x7b05b3f262635987,
5008            fidl::encoding::DynamicFlags::FLEXIBLE,
5009        )
5010    }
5011}
5012
5013#[must_use = "FIDL methods require a response to be sent"]
5014#[derive(Debug)]
5015pub struct FDomainCreateEventPairResponder {
5016    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5017    tx_id: u32,
5018}
5019
5020/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5021/// if the responder is dropped without sending a response, so that the client
5022/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5023impl std::ops::Drop for FDomainCreateEventPairResponder {
5024    fn drop(&mut self) {
5025        self.control_handle.shutdown();
5026        // Safety: drops once, never accessed again
5027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5028    }
5029}
5030
5031impl fidl::endpoints::Responder for FDomainCreateEventPairResponder {
5032    type ControlHandle = FDomainControlHandle;
5033
5034    fn control_handle(&self) -> &FDomainControlHandle {
5035        &self.control_handle
5036    }
5037
5038    fn drop_without_shutdown(mut self) {
5039        // Safety: drops once, never accessed again due to mem::forget
5040        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5041        // Prevent Drop from running (which would shut down the channel)
5042        std::mem::forget(self);
5043    }
5044}
5045
5046impl FDomainCreateEventPairResponder {
5047    /// Sends a response to the FIDL transaction.
5048    ///
5049    /// Sets the channel to shutdown if an error occurs.
5050    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5051        let _result = self.send_raw(result);
5052        if _result.is_err() {
5053            self.control_handle.shutdown();
5054        }
5055        self.drop_without_shutdown();
5056        _result
5057    }
5058
5059    /// Similar to "send" but does not shutdown the channel if an error occurs.
5060    pub fn send_no_shutdown_on_err(
5061        self,
5062        mut result: Result<(), &Error>,
5063    ) -> Result<(), fidl::Error> {
5064        let _result = self.send_raw(result);
5065        self.drop_without_shutdown();
5066        _result
5067    }
5068
5069    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5070        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5071            fidl::encoding::EmptyStruct,
5072            Error,
5073        >>(
5074            fidl::encoding::FlexibleResult::new(result),
5075            self.tx_id,
5076            0x7aef61effa65656d,
5077            fidl::encoding::DynamicFlags::FLEXIBLE,
5078        )
5079    }
5080}
5081
5082#[must_use = "FIDL methods require a response to be sent"]
5083#[derive(Debug)]
5084pub struct FDomainCreateSocketResponder {
5085    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5086    tx_id: u32,
5087}
5088
5089/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5090/// if the responder is dropped without sending a response, so that the client
5091/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5092impl std::ops::Drop for FDomainCreateSocketResponder {
5093    fn drop(&mut self) {
5094        self.control_handle.shutdown();
5095        // Safety: drops once, never accessed again
5096        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5097    }
5098}
5099
5100impl fidl::endpoints::Responder for FDomainCreateSocketResponder {
5101    type ControlHandle = FDomainControlHandle;
5102
5103    fn control_handle(&self) -> &FDomainControlHandle {
5104        &self.control_handle
5105    }
5106
5107    fn drop_without_shutdown(mut self) {
5108        // Safety: drops once, never accessed again due to mem::forget
5109        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5110        // Prevent Drop from running (which would shut down the channel)
5111        std::mem::forget(self);
5112    }
5113}
5114
5115impl FDomainCreateSocketResponder {
5116    /// Sends a response to the FIDL transaction.
5117    ///
5118    /// Sets the channel to shutdown if an error occurs.
5119    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5120        let _result = self.send_raw(result);
5121        if _result.is_err() {
5122            self.control_handle.shutdown();
5123        }
5124        self.drop_without_shutdown();
5125        _result
5126    }
5127
5128    /// Similar to "send" but does not shutdown the channel if an error occurs.
5129    pub fn send_no_shutdown_on_err(
5130        self,
5131        mut result: Result<(), &Error>,
5132    ) -> Result<(), fidl::Error> {
5133        let _result = self.send_raw(result);
5134        self.drop_without_shutdown();
5135        _result
5136    }
5137
5138    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5139        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5140            fidl::encoding::EmptyStruct,
5141            Error,
5142        >>(
5143            fidl::encoding::FlexibleResult::new(result),
5144            self.tx_id,
5145            0x200bf0ea21932de0,
5146            fidl::encoding::DynamicFlags::FLEXIBLE,
5147        )
5148    }
5149}
5150
5151#[must_use = "FIDL methods require a response to be sent"]
5152#[derive(Debug)]
5153pub struct FDomainSetSocketDispositionResponder {
5154    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5155    tx_id: u32,
5156}
5157
5158/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5159/// if the responder is dropped without sending a response, so that the client
5160/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5161impl std::ops::Drop for FDomainSetSocketDispositionResponder {
5162    fn drop(&mut self) {
5163        self.control_handle.shutdown();
5164        // Safety: drops once, never accessed again
5165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5166    }
5167}
5168
5169impl fidl::endpoints::Responder for FDomainSetSocketDispositionResponder {
5170    type ControlHandle = FDomainControlHandle;
5171
5172    fn control_handle(&self) -> &FDomainControlHandle {
5173        &self.control_handle
5174    }
5175
5176    fn drop_without_shutdown(mut self) {
5177        // Safety: drops once, never accessed again due to mem::forget
5178        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5179        // Prevent Drop from running (which would shut down the channel)
5180        std::mem::forget(self);
5181    }
5182}
5183
5184impl FDomainSetSocketDispositionResponder {
5185    /// Sends a response to the FIDL transaction.
5186    ///
5187    /// Sets the channel to shutdown if an error occurs.
5188    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5189        let _result = self.send_raw(result);
5190        if _result.is_err() {
5191            self.control_handle.shutdown();
5192        }
5193        self.drop_without_shutdown();
5194        _result
5195    }
5196
5197    /// Similar to "send" but does not shutdown the channel if an error occurs.
5198    pub fn send_no_shutdown_on_err(
5199        self,
5200        mut result: Result<(), &Error>,
5201    ) -> Result<(), fidl::Error> {
5202        let _result = self.send_raw(result);
5203        self.drop_without_shutdown();
5204        _result
5205    }
5206
5207    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5208        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5209            fidl::encoding::EmptyStruct,
5210            Error,
5211        >>(
5212            fidl::encoding::FlexibleResult::new(result),
5213            self.tx_id,
5214            0x60d3c7ccb17f9bdf,
5215            fidl::encoding::DynamicFlags::FLEXIBLE,
5216        )
5217    }
5218}
5219
5220#[must_use = "FIDL methods require a response to be sent"]
5221#[derive(Debug)]
5222pub struct FDomainReadSocketResponder {
5223    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5224    tx_id: u32,
5225}
5226
5227/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5228/// if the responder is dropped without sending a response, so that the client
5229/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5230impl std::ops::Drop for FDomainReadSocketResponder {
5231    fn drop(&mut self) {
5232        self.control_handle.shutdown();
5233        // Safety: drops once, never accessed again
5234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5235    }
5236}
5237
5238impl fidl::endpoints::Responder for FDomainReadSocketResponder {
5239    type ControlHandle = FDomainControlHandle;
5240
5241    fn control_handle(&self) -> &FDomainControlHandle {
5242        &self.control_handle
5243    }
5244
5245    fn drop_without_shutdown(mut self) {
5246        // Safety: drops once, never accessed again due to mem::forget
5247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5248        // Prevent Drop from running (which would shut down the channel)
5249        std::mem::forget(self);
5250    }
5251}
5252
5253impl FDomainReadSocketResponder {
5254    /// Sends a response to the FIDL transaction.
5255    ///
5256    /// Sets the channel to shutdown if an error occurs.
5257    pub fn send(self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
5258        let _result = self.send_raw(result);
5259        if _result.is_err() {
5260            self.control_handle.shutdown();
5261        }
5262        self.drop_without_shutdown();
5263        _result
5264    }
5265
5266    /// Similar to "send" but does not shutdown the channel if an error occurs.
5267    pub fn send_no_shutdown_on_err(
5268        self,
5269        mut result: Result<(&[u8], bool), &Error>,
5270    ) -> Result<(), fidl::Error> {
5271        let _result = self.send_raw(result);
5272        self.drop_without_shutdown();
5273        _result
5274    }
5275
5276    fn send_raw(&self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
5277        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<SocketData, Error>>(
5278            fidl::encoding::FlexibleResult::new(result),
5279            self.tx_id,
5280            0x1da8aabec249c02e,
5281            fidl::encoding::DynamicFlags::FLEXIBLE,
5282        )
5283    }
5284}
5285
5286#[must_use = "FIDL methods require a response to be sent"]
5287#[derive(Debug)]
5288pub struct FDomainWriteSocketResponder {
5289    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5290    tx_id: u32,
5291}
5292
5293/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5294/// if the responder is dropped without sending a response, so that the client
5295/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5296impl std::ops::Drop for FDomainWriteSocketResponder {
5297    fn drop(&mut self) {
5298        self.control_handle.shutdown();
5299        // Safety: drops once, never accessed again
5300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5301    }
5302}
5303
5304impl fidl::endpoints::Responder for FDomainWriteSocketResponder {
5305    type ControlHandle = FDomainControlHandle;
5306
5307    fn control_handle(&self) -> &FDomainControlHandle {
5308        &self.control_handle
5309    }
5310
5311    fn drop_without_shutdown(mut self) {
5312        // Safety: drops once, never accessed again due to mem::forget
5313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5314        // Prevent Drop from running (which would shut down the channel)
5315        std::mem::forget(self);
5316    }
5317}
5318
5319impl FDomainWriteSocketResponder {
5320    /// Sends a response to the FIDL transaction.
5321    ///
5322    /// Sets the channel to shutdown if an error occurs.
5323    pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
5324        let _result = self.send_raw(result);
5325        if _result.is_err() {
5326            self.control_handle.shutdown();
5327        }
5328        self.drop_without_shutdown();
5329        _result
5330    }
5331
5332    /// Similar to "send" but does not shutdown the channel if an error occurs.
5333    pub fn send_no_shutdown_on_err(
5334        self,
5335        mut result: Result<u64, &WriteSocketError>,
5336    ) -> Result<(), fidl::Error> {
5337        let _result = self.send_raw(result);
5338        self.drop_without_shutdown();
5339        _result
5340    }
5341
5342    fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
5343        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5344            SocketWriteSocketResponse,
5345            WriteSocketError,
5346        >>(
5347            fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
5348            self.tx_id,
5349            0x5b541623cbbbf683,
5350            fidl::encoding::DynamicFlags::FLEXIBLE,
5351        )
5352    }
5353}
5354
5355#[must_use = "FIDL methods require a response to be sent"]
5356#[derive(Debug)]
5357pub struct FDomainReadSocketStreamingStartResponder {
5358    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5359    tx_id: u32,
5360}
5361
5362/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5363/// if the responder is dropped without sending a response, so that the client
5364/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5365impl std::ops::Drop for FDomainReadSocketStreamingStartResponder {
5366    fn drop(&mut self) {
5367        self.control_handle.shutdown();
5368        // Safety: drops once, never accessed again
5369        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5370    }
5371}
5372
5373impl fidl::endpoints::Responder for FDomainReadSocketStreamingStartResponder {
5374    type ControlHandle = FDomainControlHandle;
5375
5376    fn control_handle(&self) -> &FDomainControlHandle {
5377        &self.control_handle
5378    }
5379
5380    fn drop_without_shutdown(mut self) {
5381        // Safety: drops once, never accessed again due to mem::forget
5382        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5383        // Prevent Drop from running (which would shut down the channel)
5384        std::mem::forget(self);
5385    }
5386}
5387
5388impl FDomainReadSocketStreamingStartResponder {
5389    /// Sends a response to the FIDL transaction.
5390    ///
5391    /// Sets the channel to shutdown if an error occurs.
5392    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5393        let _result = self.send_raw(result);
5394        if _result.is_err() {
5395            self.control_handle.shutdown();
5396        }
5397        self.drop_without_shutdown();
5398        _result
5399    }
5400
5401    /// Similar to "send" but does not shutdown the channel if an error occurs.
5402    pub fn send_no_shutdown_on_err(
5403        self,
5404        mut result: Result<(), &Error>,
5405    ) -> Result<(), fidl::Error> {
5406        let _result = self.send_raw(result);
5407        self.drop_without_shutdown();
5408        _result
5409    }
5410
5411    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5412        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5413            fidl::encoding::EmptyStruct,
5414            Error,
5415        >>(
5416            fidl::encoding::FlexibleResult::new(result),
5417            self.tx_id,
5418            0x2a592748d5f33445,
5419            fidl::encoding::DynamicFlags::FLEXIBLE,
5420        )
5421    }
5422}
5423
5424#[must_use = "FIDL methods require a response to be sent"]
5425#[derive(Debug)]
5426pub struct FDomainReadSocketStreamingStopResponder {
5427    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5428    tx_id: u32,
5429}
5430
5431/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5432/// if the responder is dropped without sending a response, so that the client
5433/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5434impl std::ops::Drop for FDomainReadSocketStreamingStopResponder {
5435    fn drop(&mut self) {
5436        self.control_handle.shutdown();
5437        // Safety: drops once, never accessed again
5438        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5439    }
5440}
5441
5442impl fidl::endpoints::Responder for FDomainReadSocketStreamingStopResponder {
5443    type ControlHandle = FDomainControlHandle;
5444
5445    fn control_handle(&self) -> &FDomainControlHandle {
5446        &self.control_handle
5447    }
5448
5449    fn drop_without_shutdown(mut self) {
5450        // Safety: drops once, never accessed again due to mem::forget
5451        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5452        // Prevent Drop from running (which would shut down the channel)
5453        std::mem::forget(self);
5454    }
5455}
5456
5457impl FDomainReadSocketStreamingStopResponder {
5458    /// Sends a response to the FIDL transaction.
5459    ///
5460    /// Sets the channel to shutdown if an error occurs.
5461    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5462        let _result = self.send_raw(result);
5463        if _result.is_err() {
5464            self.control_handle.shutdown();
5465        }
5466        self.drop_without_shutdown();
5467        _result
5468    }
5469
5470    /// Similar to "send" but does not shutdown the channel if an error occurs.
5471    pub fn send_no_shutdown_on_err(
5472        self,
5473        mut result: Result<(), &Error>,
5474    ) -> Result<(), fidl::Error> {
5475        let _result = self.send_raw(result);
5476        self.drop_without_shutdown();
5477        _result
5478    }
5479
5480    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5481        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5482            fidl::encoding::EmptyStruct,
5483            Error,
5484        >>(
5485            fidl::encoding::FlexibleResult::new(result),
5486            self.tx_id,
5487            0x53e5cade5f4d22e7,
5488            fidl::encoding::DynamicFlags::FLEXIBLE,
5489        )
5490    }
5491}
5492
5493#[must_use = "FIDL methods require a response to be sent"]
5494#[derive(Debug)]
5495pub struct FDomainGetNamespaceResponder {
5496    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5497    tx_id: u32,
5498}
5499
5500/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5501/// if the responder is dropped without sending a response, so that the client
5502/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5503impl std::ops::Drop for FDomainGetNamespaceResponder {
5504    fn drop(&mut self) {
5505        self.control_handle.shutdown();
5506        // Safety: drops once, never accessed again
5507        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5508    }
5509}
5510
5511impl fidl::endpoints::Responder for FDomainGetNamespaceResponder {
5512    type ControlHandle = FDomainControlHandle;
5513
5514    fn control_handle(&self) -> &FDomainControlHandle {
5515        &self.control_handle
5516    }
5517
5518    fn drop_without_shutdown(mut self) {
5519        // Safety: drops once, never accessed again due to mem::forget
5520        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5521        // Prevent Drop from running (which would shut down the channel)
5522        std::mem::forget(self);
5523    }
5524}
5525
5526impl FDomainGetNamespaceResponder {
5527    /// Sends a response to the FIDL transaction.
5528    ///
5529    /// Sets the channel to shutdown if an error occurs.
5530    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5531        let _result = self.send_raw(result);
5532        if _result.is_err() {
5533            self.control_handle.shutdown();
5534        }
5535        self.drop_without_shutdown();
5536        _result
5537    }
5538
5539    /// Similar to "send" but does not shutdown the channel if an error occurs.
5540    pub fn send_no_shutdown_on_err(
5541        self,
5542        mut result: Result<(), &Error>,
5543    ) -> Result<(), fidl::Error> {
5544        let _result = self.send_raw(result);
5545        self.drop_without_shutdown();
5546        _result
5547    }
5548
5549    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5550        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5551            fidl::encoding::EmptyStruct,
5552            Error,
5553        >>(
5554            fidl::encoding::FlexibleResult::new(result),
5555            self.tx_id,
5556            0x74f2e74d9f53e11e,
5557            fidl::encoding::DynamicFlags::FLEXIBLE,
5558        )
5559    }
5560}
5561
5562#[must_use = "FIDL methods require a response to be sent"]
5563#[derive(Debug)]
5564pub struct FDomainCloseResponder {
5565    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5566    tx_id: u32,
5567}
5568
5569/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5570/// if the responder is dropped without sending a response, so that the client
5571/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5572impl std::ops::Drop for FDomainCloseResponder {
5573    fn drop(&mut self) {
5574        self.control_handle.shutdown();
5575        // Safety: drops once, never accessed again
5576        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5577    }
5578}
5579
5580impl fidl::endpoints::Responder for FDomainCloseResponder {
5581    type ControlHandle = FDomainControlHandle;
5582
5583    fn control_handle(&self) -> &FDomainControlHandle {
5584        &self.control_handle
5585    }
5586
5587    fn drop_without_shutdown(mut self) {
5588        // Safety: drops once, never accessed again due to mem::forget
5589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5590        // Prevent Drop from running (which would shut down the channel)
5591        std::mem::forget(self);
5592    }
5593}
5594
5595impl FDomainCloseResponder {
5596    /// Sends a response to the FIDL transaction.
5597    ///
5598    /// Sets the channel to shutdown if an error occurs.
5599    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5600        let _result = self.send_raw(result);
5601        if _result.is_err() {
5602            self.control_handle.shutdown();
5603        }
5604        self.drop_without_shutdown();
5605        _result
5606    }
5607
5608    /// Similar to "send" but does not shutdown the channel if an error occurs.
5609    pub fn send_no_shutdown_on_err(
5610        self,
5611        mut result: Result<(), &Error>,
5612    ) -> Result<(), fidl::Error> {
5613        let _result = self.send_raw(result);
5614        self.drop_without_shutdown();
5615        _result
5616    }
5617
5618    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5619        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5620            fidl::encoding::EmptyStruct,
5621            Error,
5622        >>(
5623            fidl::encoding::FlexibleResult::new(result),
5624            self.tx_id,
5625            0x5ef8c24362964257,
5626            fidl::encoding::DynamicFlags::FLEXIBLE,
5627        )
5628    }
5629}
5630
5631#[must_use = "FIDL methods require a response to be sent"]
5632#[derive(Debug)]
5633pub struct FDomainDuplicateResponder {
5634    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5635    tx_id: u32,
5636}
5637
5638/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5639/// if the responder is dropped without sending a response, so that the client
5640/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5641impl std::ops::Drop for FDomainDuplicateResponder {
5642    fn drop(&mut self) {
5643        self.control_handle.shutdown();
5644        // Safety: drops once, never accessed again
5645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5646    }
5647}
5648
5649impl fidl::endpoints::Responder for FDomainDuplicateResponder {
5650    type ControlHandle = FDomainControlHandle;
5651
5652    fn control_handle(&self) -> &FDomainControlHandle {
5653        &self.control_handle
5654    }
5655
5656    fn drop_without_shutdown(mut self) {
5657        // Safety: drops once, never accessed again due to mem::forget
5658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5659        // Prevent Drop from running (which would shut down the channel)
5660        std::mem::forget(self);
5661    }
5662}
5663
5664impl FDomainDuplicateResponder {
5665    /// Sends a response to the FIDL transaction.
5666    ///
5667    /// Sets the channel to shutdown if an error occurs.
5668    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5669        let _result = self.send_raw(result);
5670        if _result.is_err() {
5671            self.control_handle.shutdown();
5672        }
5673        self.drop_without_shutdown();
5674        _result
5675    }
5676
5677    /// Similar to "send" but does not shutdown the channel if an error occurs.
5678    pub fn send_no_shutdown_on_err(
5679        self,
5680        mut result: Result<(), &Error>,
5681    ) -> Result<(), fidl::Error> {
5682        let _result = self.send_raw(result);
5683        self.drop_without_shutdown();
5684        _result
5685    }
5686
5687    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5688        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5689            fidl::encoding::EmptyStruct,
5690            Error,
5691        >>(
5692            fidl::encoding::FlexibleResult::new(result),
5693            self.tx_id,
5694            0x7a85b94bd1777ab9,
5695            fidl::encoding::DynamicFlags::FLEXIBLE,
5696        )
5697    }
5698}
5699
5700#[must_use = "FIDL methods require a response to be sent"]
5701#[derive(Debug)]
5702pub struct FDomainReplaceResponder {
5703    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5704    tx_id: u32,
5705}
5706
5707/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5708/// if the responder is dropped without sending a response, so that the client
5709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5710impl std::ops::Drop for FDomainReplaceResponder {
5711    fn drop(&mut self) {
5712        self.control_handle.shutdown();
5713        // Safety: drops once, never accessed again
5714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5715    }
5716}
5717
5718impl fidl::endpoints::Responder for FDomainReplaceResponder {
5719    type ControlHandle = FDomainControlHandle;
5720
5721    fn control_handle(&self) -> &FDomainControlHandle {
5722        &self.control_handle
5723    }
5724
5725    fn drop_without_shutdown(mut self) {
5726        // Safety: drops once, never accessed again due to mem::forget
5727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5728        // Prevent Drop from running (which would shut down the channel)
5729        std::mem::forget(self);
5730    }
5731}
5732
5733impl FDomainReplaceResponder {
5734    /// Sends a response to the FIDL transaction.
5735    ///
5736    /// Sets the channel to shutdown if an error occurs.
5737    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5738        let _result = self.send_raw(result);
5739        if _result.is_err() {
5740            self.control_handle.shutdown();
5741        }
5742        self.drop_without_shutdown();
5743        _result
5744    }
5745
5746    /// Similar to "send" but does not shutdown the channel if an error occurs.
5747    pub fn send_no_shutdown_on_err(
5748        self,
5749        mut result: Result<(), &Error>,
5750    ) -> Result<(), fidl::Error> {
5751        let _result = self.send_raw(result);
5752        self.drop_without_shutdown();
5753        _result
5754    }
5755
5756    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5757        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5758            fidl::encoding::EmptyStruct,
5759            Error,
5760        >>(
5761            fidl::encoding::FlexibleResult::new(result),
5762            self.tx_id,
5763            0x32fa64625a5bd3be,
5764            fidl::encoding::DynamicFlags::FLEXIBLE,
5765        )
5766    }
5767}
5768
5769#[must_use = "FIDL methods require a response to be sent"]
5770#[derive(Debug)]
5771pub struct FDomainSignalResponder {
5772    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5773    tx_id: u32,
5774}
5775
5776/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5777/// if the responder is dropped without sending a response, so that the client
5778/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5779impl std::ops::Drop for FDomainSignalResponder {
5780    fn drop(&mut self) {
5781        self.control_handle.shutdown();
5782        // Safety: drops once, never accessed again
5783        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5784    }
5785}
5786
5787impl fidl::endpoints::Responder for FDomainSignalResponder {
5788    type ControlHandle = FDomainControlHandle;
5789
5790    fn control_handle(&self) -> &FDomainControlHandle {
5791        &self.control_handle
5792    }
5793
5794    fn drop_without_shutdown(mut self) {
5795        // Safety: drops once, never accessed again due to mem::forget
5796        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5797        // Prevent Drop from running (which would shut down the channel)
5798        std::mem::forget(self);
5799    }
5800}
5801
5802impl FDomainSignalResponder {
5803    /// Sends a response to the FIDL transaction.
5804    ///
5805    /// Sets the channel to shutdown if an error occurs.
5806    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5807        let _result = self.send_raw(result);
5808        if _result.is_err() {
5809            self.control_handle.shutdown();
5810        }
5811        self.drop_without_shutdown();
5812        _result
5813    }
5814
5815    /// Similar to "send" but does not shutdown the channel if an error occurs.
5816    pub fn send_no_shutdown_on_err(
5817        self,
5818        mut result: Result<(), &Error>,
5819    ) -> Result<(), fidl::Error> {
5820        let _result = self.send_raw(result);
5821        self.drop_without_shutdown();
5822        _result
5823    }
5824
5825    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5826        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5827            fidl::encoding::EmptyStruct,
5828            Error,
5829        >>(
5830            fidl::encoding::FlexibleResult::new(result),
5831            self.tx_id,
5832            0xe8352fb978996d9,
5833            fidl::encoding::DynamicFlags::FLEXIBLE,
5834        )
5835    }
5836}
5837
5838#[must_use = "FIDL methods require a response to be sent"]
5839#[derive(Debug)]
5840pub struct FDomainSignalPeerResponder {
5841    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5842    tx_id: u32,
5843}
5844
5845/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5846/// if the responder is dropped without sending a response, so that the client
5847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5848impl std::ops::Drop for FDomainSignalPeerResponder {
5849    fn drop(&mut self) {
5850        self.control_handle.shutdown();
5851        // Safety: drops once, never accessed again
5852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5853    }
5854}
5855
5856impl fidl::endpoints::Responder for FDomainSignalPeerResponder {
5857    type ControlHandle = FDomainControlHandle;
5858
5859    fn control_handle(&self) -> &FDomainControlHandle {
5860        &self.control_handle
5861    }
5862
5863    fn drop_without_shutdown(mut self) {
5864        // Safety: drops once, never accessed again due to mem::forget
5865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5866        // Prevent Drop from running (which would shut down the channel)
5867        std::mem::forget(self);
5868    }
5869}
5870
5871impl FDomainSignalPeerResponder {
5872    /// Sends a response to the FIDL transaction.
5873    ///
5874    /// Sets the channel to shutdown if an error occurs.
5875    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5876        let _result = self.send_raw(result);
5877        if _result.is_err() {
5878            self.control_handle.shutdown();
5879        }
5880        self.drop_without_shutdown();
5881        _result
5882    }
5883
5884    /// Similar to "send" but does not shutdown the channel if an error occurs.
5885    pub fn send_no_shutdown_on_err(
5886        self,
5887        mut result: Result<(), &Error>,
5888    ) -> Result<(), fidl::Error> {
5889        let _result = self.send_raw(result);
5890        self.drop_without_shutdown();
5891        _result
5892    }
5893
5894    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5895        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5896            fidl::encoding::EmptyStruct,
5897            Error,
5898        >>(
5899            fidl::encoding::FlexibleResult::new(result),
5900            self.tx_id,
5901            0x7e84ec8ca7eabaf8,
5902            fidl::encoding::DynamicFlags::FLEXIBLE,
5903        )
5904    }
5905}
5906
5907#[must_use = "FIDL methods require a response to be sent"]
5908#[derive(Debug)]
5909pub struct FDomainWaitForSignalsResponder {
5910    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5911    tx_id: u32,
5912}
5913
5914/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5915/// if the responder is dropped without sending a response, so that the client
5916/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5917impl std::ops::Drop for FDomainWaitForSignalsResponder {
5918    fn drop(&mut self) {
5919        self.control_handle.shutdown();
5920        // Safety: drops once, never accessed again
5921        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5922    }
5923}
5924
5925impl fidl::endpoints::Responder for FDomainWaitForSignalsResponder {
5926    type ControlHandle = FDomainControlHandle;
5927
5928    fn control_handle(&self) -> &FDomainControlHandle {
5929        &self.control_handle
5930    }
5931
5932    fn drop_without_shutdown(mut self) {
5933        // Safety: drops once, never accessed again due to mem::forget
5934        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5935        // Prevent Drop from running (which would shut down the channel)
5936        std::mem::forget(self);
5937    }
5938}
5939
5940impl FDomainWaitForSignalsResponder {
5941    /// Sends a response to the FIDL transaction.
5942    ///
5943    /// Sets the channel to shutdown if an error occurs.
5944    pub fn send(self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
5945        let _result = self.send_raw(result);
5946        if _result.is_err() {
5947            self.control_handle.shutdown();
5948        }
5949        self.drop_without_shutdown();
5950        _result
5951    }
5952
5953    /// Similar to "send" but does not shutdown the channel if an error occurs.
5954    pub fn send_no_shutdown_on_err(
5955        self,
5956        mut result: Result<u32, &Error>,
5957    ) -> Result<(), fidl::Error> {
5958        let _result = self.send_raw(result);
5959        self.drop_without_shutdown();
5960        _result
5961    }
5962
5963    fn send_raw(&self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
5964        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5965            FDomainWaitForSignalsResponse,
5966            Error,
5967        >>(
5968            fidl::encoding::FlexibleResult::new(result.map(|signals| (signals,))),
5969            self.tx_id,
5970            0x8f72d9b4b85c1eb,
5971            fidl::encoding::DynamicFlags::FLEXIBLE,
5972        )
5973    }
5974}
5975
5976#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5977pub struct SocketMarker;
5978
5979impl fidl::endpoints::ProtocolMarker for SocketMarker {
5980    type Proxy = SocketProxy;
5981    type RequestStream = SocketRequestStream;
5982    #[cfg(target_os = "fuchsia")]
5983    type SynchronousProxy = SocketSynchronousProxy;
5984
5985    const DEBUG_NAME: &'static str = "(anonymous) Socket";
5986}
5987pub type SocketCreateSocketResult = Result<(), Error>;
5988pub type SocketSetSocketDispositionResult = Result<(), Error>;
5989pub type SocketReadSocketResult = Result<(Vec<u8>, bool), Error>;
5990pub type SocketWriteSocketResult = Result<u64, WriteSocketError>;
5991pub type SocketReadSocketStreamingStartResult = Result<(), Error>;
5992pub type SocketReadSocketStreamingStopResult = Result<(), Error>;
5993
5994pub trait SocketProxyInterface: Send + Sync {
5995    type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
5996        + Send;
5997    fn r#create_socket(
5998        &self,
5999        options: SocketType,
6000        handles: &[NewHandleId; 2],
6001    ) -> Self::CreateSocketResponseFut;
6002    type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
6003        + Send;
6004    fn r#set_socket_disposition(
6005        &self,
6006        handle: &HandleId,
6007        disposition: SocketDisposition,
6008        disposition_peer: SocketDisposition,
6009    ) -> Self::SetSocketDispositionResponseFut;
6010    type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
6011        + Send;
6012    fn r#read_socket(&self, handle: &HandleId, max_bytes: u64) -> Self::ReadSocketResponseFut;
6013    type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
6014        + Send;
6015    fn r#write_socket(&self, handle: &HandleId, data: &[u8]) -> Self::WriteSocketResponseFut;
6016    type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
6017        + Send;
6018    fn r#read_socket_streaming_start(
6019        &self,
6020        handle: &HandleId,
6021    ) -> Self::ReadSocketStreamingStartResponseFut;
6022    type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
6023        + Send;
6024    fn r#read_socket_streaming_stop(
6025        &self,
6026        handle: &HandleId,
6027    ) -> Self::ReadSocketStreamingStopResponseFut;
6028}
6029#[derive(Debug)]
6030#[cfg(target_os = "fuchsia")]
6031pub struct SocketSynchronousProxy {
6032    client: fidl::client::sync::Client,
6033}
6034
6035#[cfg(target_os = "fuchsia")]
6036impl fidl::endpoints::SynchronousProxy for SocketSynchronousProxy {
6037    type Proxy = SocketProxy;
6038    type Protocol = SocketMarker;
6039
6040    fn from_channel(inner: fidl::Channel) -> Self {
6041        Self::new(inner)
6042    }
6043
6044    fn into_channel(self) -> fidl::Channel {
6045        self.client.into_channel()
6046    }
6047
6048    fn as_channel(&self) -> &fidl::Channel {
6049        self.client.as_channel()
6050    }
6051}
6052
6053#[cfg(target_os = "fuchsia")]
6054impl SocketSynchronousProxy {
6055    pub fn new(channel: fidl::Channel) -> Self {
6056        let protocol_name = <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6057        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6058    }
6059
6060    pub fn into_channel(self) -> fidl::Channel {
6061        self.client.into_channel()
6062    }
6063
6064    /// Waits until an event arrives and returns it. It is safe for other
6065    /// threads to make concurrent requests while waiting for an event.
6066    pub fn wait_for_event(
6067        &self,
6068        deadline: zx::MonotonicInstant,
6069    ) -> Result<SocketEvent, fidl::Error> {
6070        SocketEvent::decode(self.client.wait_for_event(deadline)?)
6071    }
6072
6073    pub fn r#create_socket(
6074        &self,
6075        mut options: SocketType,
6076        mut handles: &[NewHandleId; 2],
6077        ___deadline: zx::MonotonicInstant,
6078    ) -> Result<SocketCreateSocketResult, fidl::Error> {
6079        let _response = self.client.send_query::<
6080            SocketCreateSocketRequest,
6081            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6082        >(
6083            (options, handles,),
6084            0x200bf0ea21932de0,
6085            fidl::encoding::DynamicFlags::FLEXIBLE,
6086            ___deadline,
6087        )?
6088        .into_result::<SocketMarker>("create_socket")?;
6089        Ok(_response.map(|x| x))
6090    }
6091
6092    pub fn r#set_socket_disposition(
6093        &self,
6094        mut handle: &HandleId,
6095        mut disposition: SocketDisposition,
6096        mut disposition_peer: SocketDisposition,
6097        ___deadline: zx::MonotonicInstant,
6098    ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
6099        let _response = self.client.send_query::<
6100            SocketSetSocketDispositionRequest,
6101            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6102        >(
6103            (handle, disposition, disposition_peer,),
6104            0x60d3c7ccb17f9bdf,
6105            fidl::encoding::DynamicFlags::FLEXIBLE,
6106            ___deadline,
6107        )?
6108        .into_result::<SocketMarker>("set_socket_disposition")?;
6109        Ok(_response.map(|x| x))
6110    }
6111
6112    pub fn r#read_socket(
6113        &self,
6114        mut handle: &HandleId,
6115        mut max_bytes: u64,
6116        ___deadline: zx::MonotonicInstant,
6117    ) -> Result<SocketReadSocketResult, fidl::Error> {
6118        let _response = self.client.send_query::<
6119            SocketReadSocketRequest,
6120            fidl::encoding::FlexibleResultType<SocketData, Error>,
6121        >(
6122            (handle, max_bytes,),
6123            0x1da8aabec249c02e,
6124            fidl::encoding::DynamicFlags::FLEXIBLE,
6125            ___deadline,
6126        )?
6127        .into_result::<SocketMarker>("read_socket")?;
6128        Ok(_response.map(|x| (x.data, x.is_datagram)))
6129    }
6130
6131    pub fn r#write_socket(
6132        &self,
6133        mut handle: &HandleId,
6134        mut data: &[u8],
6135        ___deadline: zx::MonotonicInstant,
6136    ) -> Result<SocketWriteSocketResult, fidl::Error> {
6137        let _response = self.client.send_query::<
6138            SocketWriteSocketRequest,
6139            fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
6140        >(
6141            (handle, data,),
6142            0x5b541623cbbbf683,
6143            fidl::encoding::DynamicFlags::FLEXIBLE,
6144            ___deadline,
6145        )?
6146        .into_result::<SocketMarker>("write_socket")?;
6147        Ok(_response.map(|x| x.wrote))
6148    }
6149
6150    pub fn r#read_socket_streaming_start(
6151        &self,
6152        mut handle: &HandleId,
6153        ___deadline: zx::MonotonicInstant,
6154    ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
6155        let _response = self.client.send_query::<
6156            SocketReadSocketStreamingStartRequest,
6157            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6158        >(
6159            (handle,),
6160            0x2a592748d5f33445,
6161            fidl::encoding::DynamicFlags::FLEXIBLE,
6162            ___deadline,
6163        )?
6164        .into_result::<SocketMarker>("read_socket_streaming_start")?;
6165        Ok(_response.map(|x| x))
6166    }
6167
6168    pub fn r#read_socket_streaming_stop(
6169        &self,
6170        mut handle: &HandleId,
6171        ___deadline: zx::MonotonicInstant,
6172    ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
6173        let _response = self.client.send_query::<
6174            SocketReadSocketStreamingStopRequest,
6175            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6176        >(
6177            (handle,),
6178            0x53e5cade5f4d22e7,
6179            fidl::encoding::DynamicFlags::FLEXIBLE,
6180            ___deadline,
6181        )?
6182        .into_result::<SocketMarker>("read_socket_streaming_stop")?;
6183        Ok(_response.map(|x| x))
6184    }
6185}
6186
6187#[cfg(target_os = "fuchsia")]
6188impl From<SocketSynchronousProxy> for zx::Handle {
6189    fn from(value: SocketSynchronousProxy) -> Self {
6190        value.into_channel().into()
6191    }
6192}
6193
6194#[cfg(target_os = "fuchsia")]
6195impl From<fidl::Channel> for SocketSynchronousProxy {
6196    fn from(value: fidl::Channel) -> Self {
6197        Self::new(value)
6198    }
6199}
6200
6201#[derive(Debug, Clone)]
6202pub struct SocketProxy {
6203    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6204}
6205
6206impl fidl::endpoints::Proxy for SocketProxy {
6207    type Protocol = SocketMarker;
6208
6209    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6210        Self::new(inner)
6211    }
6212
6213    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6214        self.client.into_channel().map_err(|client| Self { client })
6215    }
6216
6217    fn as_channel(&self) -> &::fidl::AsyncChannel {
6218        self.client.as_channel()
6219    }
6220}
6221
6222impl SocketProxy {
6223    /// Create a new Proxy for fuchsia.fdomain/Socket.
6224    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6225        let protocol_name = <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6226        Self { client: fidl::client::Client::new(channel, protocol_name) }
6227    }
6228
6229    /// Get a Stream of events from the remote end of the protocol.
6230    ///
6231    /// # Panics
6232    ///
6233    /// Panics if the event stream was already taken.
6234    pub fn take_event_stream(&self) -> SocketEventStream {
6235        SocketEventStream { event_receiver: self.client.take_event_receiver() }
6236    }
6237
6238    pub fn r#create_socket(
6239        &self,
6240        mut options: SocketType,
6241        mut handles: &[NewHandleId; 2],
6242    ) -> fidl::client::QueryResponseFut<
6243        SocketCreateSocketResult,
6244        fidl::encoding::DefaultFuchsiaResourceDialect,
6245    > {
6246        SocketProxyInterface::r#create_socket(self, options, handles)
6247    }
6248
6249    pub fn r#set_socket_disposition(
6250        &self,
6251        mut handle: &HandleId,
6252        mut disposition: SocketDisposition,
6253        mut disposition_peer: SocketDisposition,
6254    ) -> fidl::client::QueryResponseFut<
6255        SocketSetSocketDispositionResult,
6256        fidl::encoding::DefaultFuchsiaResourceDialect,
6257    > {
6258        SocketProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
6259    }
6260
6261    pub fn r#read_socket(
6262        &self,
6263        mut handle: &HandleId,
6264        mut max_bytes: u64,
6265    ) -> fidl::client::QueryResponseFut<
6266        SocketReadSocketResult,
6267        fidl::encoding::DefaultFuchsiaResourceDialect,
6268    > {
6269        SocketProxyInterface::r#read_socket(self, handle, max_bytes)
6270    }
6271
6272    pub fn r#write_socket(
6273        &self,
6274        mut handle: &HandleId,
6275        mut data: &[u8],
6276    ) -> fidl::client::QueryResponseFut<
6277        SocketWriteSocketResult,
6278        fidl::encoding::DefaultFuchsiaResourceDialect,
6279    > {
6280        SocketProxyInterface::r#write_socket(self, handle, data)
6281    }
6282
6283    pub fn r#read_socket_streaming_start(
6284        &self,
6285        mut handle: &HandleId,
6286    ) -> fidl::client::QueryResponseFut<
6287        SocketReadSocketStreamingStartResult,
6288        fidl::encoding::DefaultFuchsiaResourceDialect,
6289    > {
6290        SocketProxyInterface::r#read_socket_streaming_start(self, handle)
6291    }
6292
6293    pub fn r#read_socket_streaming_stop(
6294        &self,
6295        mut handle: &HandleId,
6296    ) -> fidl::client::QueryResponseFut<
6297        SocketReadSocketStreamingStopResult,
6298        fidl::encoding::DefaultFuchsiaResourceDialect,
6299    > {
6300        SocketProxyInterface::r#read_socket_streaming_stop(self, handle)
6301    }
6302}
6303
6304impl SocketProxyInterface for SocketProxy {
6305    type CreateSocketResponseFut = fidl::client::QueryResponseFut<
6306        SocketCreateSocketResult,
6307        fidl::encoding::DefaultFuchsiaResourceDialect,
6308    >;
6309    fn r#create_socket(
6310        &self,
6311        mut options: SocketType,
6312        mut handles: &[NewHandleId; 2],
6313    ) -> Self::CreateSocketResponseFut {
6314        fn _decode(
6315            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6316        ) -> Result<SocketCreateSocketResult, fidl::Error> {
6317            let _response = fidl::client::decode_transaction_body::<
6318                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6319                fidl::encoding::DefaultFuchsiaResourceDialect,
6320                0x200bf0ea21932de0,
6321            >(_buf?)?
6322            .into_result::<SocketMarker>("create_socket")?;
6323            Ok(_response.map(|x| x))
6324        }
6325        self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
6326            (options, handles),
6327            0x200bf0ea21932de0,
6328            fidl::encoding::DynamicFlags::FLEXIBLE,
6329            _decode,
6330        )
6331    }
6332
6333    type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
6334        SocketSetSocketDispositionResult,
6335        fidl::encoding::DefaultFuchsiaResourceDialect,
6336    >;
6337    fn r#set_socket_disposition(
6338        &self,
6339        mut handle: &HandleId,
6340        mut disposition: SocketDisposition,
6341        mut disposition_peer: SocketDisposition,
6342    ) -> Self::SetSocketDispositionResponseFut {
6343        fn _decode(
6344            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6345        ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
6346            let _response = fidl::client::decode_transaction_body::<
6347                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6348                fidl::encoding::DefaultFuchsiaResourceDialect,
6349                0x60d3c7ccb17f9bdf,
6350            >(_buf?)?
6351            .into_result::<SocketMarker>("set_socket_disposition")?;
6352            Ok(_response.map(|x| x))
6353        }
6354        self.client.send_query_and_decode::<
6355            SocketSetSocketDispositionRequest,
6356            SocketSetSocketDispositionResult,
6357        >(
6358            (handle, disposition, disposition_peer,),
6359            0x60d3c7ccb17f9bdf,
6360            fidl::encoding::DynamicFlags::FLEXIBLE,
6361            _decode,
6362        )
6363    }
6364
6365    type ReadSocketResponseFut = fidl::client::QueryResponseFut<
6366        SocketReadSocketResult,
6367        fidl::encoding::DefaultFuchsiaResourceDialect,
6368    >;
6369    fn r#read_socket(
6370        &self,
6371        mut handle: &HandleId,
6372        mut max_bytes: u64,
6373    ) -> Self::ReadSocketResponseFut {
6374        fn _decode(
6375            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6376        ) -> Result<SocketReadSocketResult, fidl::Error> {
6377            let _response = fidl::client::decode_transaction_body::<
6378                fidl::encoding::FlexibleResultType<SocketData, Error>,
6379                fidl::encoding::DefaultFuchsiaResourceDialect,
6380                0x1da8aabec249c02e,
6381            >(_buf?)?
6382            .into_result::<SocketMarker>("read_socket")?;
6383            Ok(_response.map(|x| (x.data, x.is_datagram)))
6384        }
6385        self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
6386            (handle, max_bytes),
6387            0x1da8aabec249c02e,
6388            fidl::encoding::DynamicFlags::FLEXIBLE,
6389            _decode,
6390        )
6391    }
6392
6393    type WriteSocketResponseFut = fidl::client::QueryResponseFut<
6394        SocketWriteSocketResult,
6395        fidl::encoding::DefaultFuchsiaResourceDialect,
6396    >;
6397    fn r#write_socket(
6398        &self,
6399        mut handle: &HandleId,
6400        mut data: &[u8],
6401    ) -> Self::WriteSocketResponseFut {
6402        fn _decode(
6403            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6404        ) -> Result<SocketWriteSocketResult, fidl::Error> {
6405            let _response = fidl::client::decode_transaction_body::<
6406                fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
6407                fidl::encoding::DefaultFuchsiaResourceDialect,
6408                0x5b541623cbbbf683,
6409            >(_buf?)?
6410            .into_result::<SocketMarker>("write_socket")?;
6411            Ok(_response.map(|x| x.wrote))
6412        }
6413        self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
6414            (handle, data),
6415            0x5b541623cbbbf683,
6416            fidl::encoding::DynamicFlags::FLEXIBLE,
6417            _decode,
6418        )
6419    }
6420
6421    type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
6422        SocketReadSocketStreamingStartResult,
6423        fidl::encoding::DefaultFuchsiaResourceDialect,
6424    >;
6425    fn r#read_socket_streaming_start(
6426        &self,
6427        mut handle: &HandleId,
6428    ) -> Self::ReadSocketStreamingStartResponseFut {
6429        fn _decode(
6430            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6431        ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
6432            let _response = fidl::client::decode_transaction_body::<
6433                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6434                fidl::encoding::DefaultFuchsiaResourceDialect,
6435                0x2a592748d5f33445,
6436            >(_buf?)?
6437            .into_result::<SocketMarker>("read_socket_streaming_start")?;
6438            Ok(_response.map(|x| x))
6439        }
6440        self.client.send_query_and_decode::<
6441            SocketReadSocketStreamingStartRequest,
6442            SocketReadSocketStreamingStartResult,
6443        >(
6444            (handle,),
6445            0x2a592748d5f33445,
6446            fidl::encoding::DynamicFlags::FLEXIBLE,
6447            _decode,
6448        )
6449    }
6450
6451    type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
6452        SocketReadSocketStreamingStopResult,
6453        fidl::encoding::DefaultFuchsiaResourceDialect,
6454    >;
6455    fn r#read_socket_streaming_stop(
6456        &self,
6457        mut handle: &HandleId,
6458    ) -> Self::ReadSocketStreamingStopResponseFut {
6459        fn _decode(
6460            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6461        ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
6462            let _response = fidl::client::decode_transaction_body::<
6463                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6464                fidl::encoding::DefaultFuchsiaResourceDialect,
6465                0x53e5cade5f4d22e7,
6466            >(_buf?)?
6467            .into_result::<SocketMarker>("read_socket_streaming_stop")?;
6468            Ok(_response.map(|x| x))
6469        }
6470        self.client.send_query_and_decode::<
6471            SocketReadSocketStreamingStopRequest,
6472            SocketReadSocketStreamingStopResult,
6473        >(
6474            (handle,),
6475            0x53e5cade5f4d22e7,
6476            fidl::encoding::DynamicFlags::FLEXIBLE,
6477            _decode,
6478        )
6479    }
6480}
6481
6482pub struct SocketEventStream {
6483    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6484}
6485
6486impl std::marker::Unpin for SocketEventStream {}
6487
6488impl futures::stream::FusedStream for SocketEventStream {
6489    fn is_terminated(&self) -> bool {
6490        self.event_receiver.is_terminated()
6491    }
6492}
6493
6494impl futures::Stream for SocketEventStream {
6495    type Item = Result<SocketEvent, fidl::Error>;
6496
6497    fn poll_next(
6498        mut self: std::pin::Pin<&mut Self>,
6499        cx: &mut std::task::Context<'_>,
6500    ) -> std::task::Poll<Option<Self::Item>> {
6501        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6502            &mut self.event_receiver,
6503            cx
6504        )?) {
6505            Some(buf) => std::task::Poll::Ready(Some(SocketEvent::decode(buf))),
6506            None => std::task::Poll::Ready(None),
6507        }
6508    }
6509}
6510
6511#[derive(Debug)]
6512pub enum SocketEvent {
6513    OnSocketStreamingData {
6514        handle: HandleId,
6515        socket_message: SocketMessage,
6516    },
6517    #[non_exhaustive]
6518    _UnknownEvent {
6519        /// Ordinal of the event that was sent.
6520        ordinal: u64,
6521    },
6522}
6523
6524impl SocketEvent {
6525    #[allow(irrefutable_let_patterns)]
6526    pub fn into_on_socket_streaming_data(self) -> Option<(HandleId, SocketMessage)> {
6527        if let SocketEvent::OnSocketStreamingData { handle, socket_message } = self {
6528            Some((handle, socket_message))
6529        } else {
6530            None
6531        }
6532    }
6533
6534    /// Decodes a message buffer as a [`SocketEvent`].
6535    fn decode(
6536        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6537    ) -> Result<SocketEvent, fidl::Error> {
6538        let (bytes, _handles) = buf.split_mut();
6539        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6540        debug_assert_eq!(tx_header.tx_id, 0);
6541        match tx_header.ordinal {
6542            0x998b5e66b3c80a2 => {
6543                let mut out = fidl::new_empty!(
6544                    SocketOnSocketStreamingDataRequest,
6545                    fidl::encoding::DefaultFuchsiaResourceDialect
6546                );
6547                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6548                Ok((SocketEvent::OnSocketStreamingData {
6549                    handle: out.handle,
6550                    socket_message: out.socket_message,
6551                }))
6552            }
6553            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6554                Ok(SocketEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6555            }
6556            _ => Err(fidl::Error::UnknownOrdinal {
6557                ordinal: tx_header.ordinal,
6558                protocol_name: <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6559            }),
6560        }
6561    }
6562}
6563
6564/// A Stream of incoming requests for fuchsia.fdomain/Socket.
6565pub struct SocketRequestStream {
6566    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6567    is_terminated: bool,
6568}
6569
6570impl std::marker::Unpin for SocketRequestStream {}
6571
6572impl futures::stream::FusedStream for SocketRequestStream {
6573    fn is_terminated(&self) -> bool {
6574        self.is_terminated
6575    }
6576}
6577
6578impl fidl::endpoints::RequestStream for SocketRequestStream {
6579    type Protocol = SocketMarker;
6580    type ControlHandle = SocketControlHandle;
6581
6582    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6583        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6584    }
6585
6586    fn control_handle(&self) -> Self::ControlHandle {
6587        SocketControlHandle { inner: self.inner.clone() }
6588    }
6589
6590    fn into_inner(
6591        self,
6592    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6593    {
6594        (self.inner, self.is_terminated)
6595    }
6596
6597    fn from_inner(
6598        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6599        is_terminated: bool,
6600    ) -> Self {
6601        Self { inner, is_terminated }
6602    }
6603}
6604
6605impl futures::Stream for SocketRequestStream {
6606    type Item = Result<SocketRequest, fidl::Error>;
6607
6608    fn poll_next(
6609        mut self: std::pin::Pin<&mut Self>,
6610        cx: &mut std::task::Context<'_>,
6611    ) -> std::task::Poll<Option<Self::Item>> {
6612        let this = &mut *self;
6613        if this.inner.check_shutdown(cx) {
6614            this.is_terminated = true;
6615            return std::task::Poll::Ready(None);
6616        }
6617        if this.is_terminated {
6618            panic!("polled SocketRequestStream after completion");
6619        }
6620        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6621            |bytes, handles| {
6622                match this.inner.channel().read_etc(cx, bytes, handles) {
6623                    std::task::Poll::Ready(Ok(())) => {}
6624                    std::task::Poll::Pending => return std::task::Poll::Pending,
6625                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6626                        this.is_terminated = true;
6627                        return std::task::Poll::Ready(None);
6628                    }
6629                    std::task::Poll::Ready(Err(e)) => {
6630                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6631                            e.into(),
6632                        ))))
6633                    }
6634                }
6635
6636                // A message has been received from the channel
6637                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6638
6639                std::task::Poll::Ready(Some(match header.ordinal {
6640                    0x200bf0ea21932de0 => {
6641                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6642                        let mut req = fidl::new_empty!(
6643                            SocketCreateSocketRequest,
6644                            fidl::encoding::DefaultFuchsiaResourceDialect
6645                        );
6646                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
6647                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6648                        Ok(SocketRequest::CreateSocket {
6649                            options: req.options,
6650                            handles: req.handles,
6651
6652                            responder: SocketCreateSocketResponder {
6653                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6654                                tx_id: header.tx_id,
6655                            },
6656                        })
6657                    }
6658                    0x60d3c7ccb17f9bdf => {
6659                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6660                        let mut req = fidl::new_empty!(
6661                            SocketSetSocketDispositionRequest,
6662                            fidl::encoding::DefaultFuchsiaResourceDialect
6663                        );
6664                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
6665                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6666                        Ok(SocketRequest::SetSocketDisposition {
6667                            handle: req.handle,
6668                            disposition: req.disposition,
6669                            disposition_peer: req.disposition_peer,
6670
6671                            responder: SocketSetSocketDispositionResponder {
6672                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6673                                tx_id: header.tx_id,
6674                            },
6675                        })
6676                    }
6677                    0x1da8aabec249c02e => {
6678                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6679                        let mut req = fidl::new_empty!(
6680                            SocketReadSocketRequest,
6681                            fidl::encoding::DefaultFuchsiaResourceDialect
6682                        );
6683                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
6684                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6685                        Ok(SocketRequest::ReadSocket {
6686                            handle: req.handle,
6687                            max_bytes: req.max_bytes,
6688
6689                            responder: SocketReadSocketResponder {
6690                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6691                                tx_id: header.tx_id,
6692                            },
6693                        })
6694                    }
6695                    0x5b541623cbbbf683 => {
6696                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6697                        let mut req = fidl::new_empty!(
6698                            SocketWriteSocketRequest,
6699                            fidl::encoding::DefaultFuchsiaResourceDialect
6700                        );
6701                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
6702                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6703                        Ok(SocketRequest::WriteSocket {
6704                            handle: req.handle,
6705                            data: req.data,
6706
6707                            responder: SocketWriteSocketResponder {
6708                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6709                                tx_id: header.tx_id,
6710                            },
6711                        })
6712                    }
6713                    0x2a592748d5f33445 => {
6714                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6715                        let mut req = fidl::new_empty!(
6716                            SocketReadSocketStreamingStartRequest,
6717                            fidl::encoding::DefaultFuchsiaResourceDialect
6718                        );
6719                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
6720                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6721                        Ok(SocketRequest::ReadSocketStreamingStart {
6722                            handle: req.handle,
6723
6724                            responder: SocketReadSocketStreamingStartResponder {
6725                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6726                                tx_id: header.tx_id,
6727                            },
6728                        })
6729                    }
6730                    0x53e5cade5f4d22e7 => {
6731                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6732                        let mut req = fidl::new_empty!(
6733                            SocketReadSocketStreamingStopRequest,
6734                            fidl::encoding::DefaultFuchsiaResourceDialect
6735                        );
6736                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
6737                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6738                        Ok(SocketRequest::ReadSocketStreamingStop {
6739                            handle: req.handle,
6740
6741                            responder: SocketReadSocketStreamingStopResponder {
6742                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6743                                tx_id: header.tx_id,
6744                            },
6745                        })
6746                    }
6747                    _ if header.tx_id == 0
6748                        && header
6749                            .dynamic_flags()
6750                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6751                    {
6752                        Ok(SocketRequest::_UnknownMethod {
6753                            ordinal: header.ordinal,
6754                            control_handle: SocketControlHandle { inner: this.inner.clone() },
6755                            method_type: fidl::MethodType::OneWay,
6756                        })
6757                    }
6758                    _ if header
6759                        .dynamic_flags()
6760                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6761                    {
6762                        this.inner.send_framework_err(
6763                            fidl::encoding::FrameworkErr::UnknownMethod,
6764                            header.tx_id,
6765                            header.ordinal,
6766                            header.dynamic_flags(),
6767                            (bytes, handles),
6768                        )?;
6769                        Ok(SocketRequest::_UnknownMethod {
6770                            ordinal: header.ordinal,
6771                            control_handle: SocketControlHandle { inner: this.inner.clone() },
6772                            method_type: fidl::MethodType::TwoWay,
6773                        })
6774                    }
6775                    _ => Err(fidl::Error::UnknownOrdinal {
6776                        ordinal: header.ordinal,
6777                        protocol_name:
6778                            <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6779                    }),
6780                }))
6781            },
6782        )
6783    }
6784}
6785
6786#[derive(Debug)]
6787pub enum SocketRequest {
6788    CreateSocket {
6789        options: SocketType,
6790        handles: [NewHandleId; 2],
6791        responder: SocketCreateSocketResponder,
6792    },
6793    SetSocketDisposition {
6794        handle: HandleId,
6795        disposition: SocketDisposition,
6796        disposition_peer: SocketDisposition,
6797        responder: SocketSetSocketDispositionResponder,
6798    },
6799    ReadSocket {
6800        handle: HandleId,
6801        max_bytes: u64,
6802        responder: SocketReadSocketResponder,
6803    },
6804    WriteSocket {
6805        handle: HandleId,
6806        data: Vec<u8>,
6807        responder: SocketWriteSocketResponder,
6808    },
6809    ReadSocketStreamingStart {
6810        handle: HandleId,
6811        responder: SocketReadSocketStreamingStartResponder,
6812    },
6813    ReadSocketStreamingStop {
6814        handle: HandleId,
6815        responder: SocketReadSocketStreamingStopResponder,
6816    },
6817    /// An interaction was received which does not match any known method.
6818    #[non_exhaustive]
6819    _UnknownMethod {
6820        /// Ordinal of the method that was called.
6821        ordinal: u64,
6822        control_handle: SocketControlHandle,
6823        method_type: fidl::MethodType,
6824    },
6825}
6826
6827impl SocketRequest {
6828    #[allow(irrefutable_let_patterns)]
6829    pub fn into_create_socket(
6830        self,
6831    ) -> Option<(SocketType, [NewHandleId; 2], SocketCreateSocketResponder)> {
6832        if let SocketRequest::CreateSocket { options, handles, responder } = self {
6833            Some((options, handles, responder))
6834        } else {
6835            None
6836        }
6837    }
6838
6839    #[allow(irrefutable_let_patterns)]
6840    pub fn into_set_socket_disposition(
6841        self,
6842    ) -> Option<(HandleId, SocketDisposition, SocketDisposition, SocketSetSocketDispositionResponder)>
6843    {
6844        if let SocketRequest::SetSocketDisposition {
6845            handle,
6846            disposition,
6847            disposition_peer,
6848            responder,
6849        } = self
6850        {
6851            Some((handle, disposition, disposition_peer, responder))
6852        } else {
6853            None
6854        }
6855    }
6856
6857    #[allow(irrefutable_let_patterns)]
6858    pub fn into_read_socket(self) -> Option<(HandleId, u64, SocketReadSocketResponder)> {
6859        if let SocketRequest::ReadSocket { handle, max_bytes, responder } = self {
6860            Some((handle, max_bytes, responder))
6861        } else {
6862            None
6863        }
6864    }
6865
6866    #[allow(irrefutable_let_patterns)]
6867    pub fn into_write_socket(self) -> Option<(HandleId, Vec<u8>, SocketWriteSocketResponder)> {
6868        if let SocketRequest::WriteSocket { handle, data, responder } = self {
6869            Some((handle, data, responder))
6870        } else {
6871            None
6872        }
6873    }
6874
6875    #[allow(irrefutable_let_patterns)]
6876    pub fn into_read_socket_streaming_start(
6877        self,
6878    ) -> Option<(HandleId, SocketReadSocketStreamingStartResponder)> {
6879        if let SocketRequest::ReadSocketStreamingStart { handle, responder } = self {
6880            Some((handle, responder))
6881        } else {
6882            None
6883        }
6884    }
6885
6886    #[allow(irrefutable_let_patterns)]
6887    pub fn into_read_socket_streaming_stop(
6888        self,
6889    ) -> Option<(HandleId, SocketReadSocketStreamingStopResponder)> {
6890        if let SocketRequest::ReadSocketStreamingStop { handle, responder } = self {
6891            Some((handle, responder))
6892        } else {
6893            None
6894        }
6895    }
6896
6897    /// Name of the method defined in FIDL
6898    pub fn method_name(&self) -> &'static str {
6899        match *self {
6900            SocketRequest::CreateSocket { .. } => "create_socket",
6901            SocketRequest::SetSocketDisposition { .. } => "set_socket_disposition",
6902            SocketRequest::ReadSocket { .. } => "read_socket",
6903            SocketRequest::WriteSocket { .. } => "write_socket",
6904            SocketRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
6905            SocketRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
6906            SocketRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
6907                "unknown one-way method"
6908            }
6909            SocketRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
6910                "unknown two-way method"
6911            }
6912        }
6913    }
6914}
6915
6916#[derive(Debug, Clone)]
6917pub struct SocketControlHandle {
6918    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6919}
6920
6921impl fidl::endpoints::ControlHandle for SocketControlHandle {
6922    fn shutdown(&self) {
6923        self.inner.shutdown()
6924    }
6925    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6926        self.inner.shutdown_with_epitaph(status)
6927    }
6928
6929    fn is_closed(&self) -> bool {
6930        self.inner.channel().is_closed()
6931    }
6932    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6933        self.inner.channel().on_closed()
6934    }
6935
6936    #[cfg(target_os = "fuchsia")]
6937    fn signal_peer(
6938        &self,
6939        clear_mask: zx::Signals,
6940        set_mask: zx::Signals,
6941    ) -> Result<(), zx_status::Status> {
6942        use fidl::Peered;
6943        self.inner.channel().signal_peer(clear_mask, set_mask)
6944    }
6945}
6946
6947impl SocketControlHandle {
6948    pub fn send_on_socket_streaming_data(
6949        &self,
6950        mut handle: &HandleId,
6951        mut socket_message: &SocketMessage,
6952    ) -> Result<(), fidl::Error> {
6953        self.inner.send::<SocketOnSocketStreamingDataRequest>(
6954            (handle, socket_message),
6955            0,
6956            0x998b5e66b3c80a2,
6957            fidl::encoding::DynamicFlags::FLEXIBLE,
6958        )
6959    }
6960}
6961
6962#[must_use = "FIDL methods require a response to be sent"]
6963#[derive(Debug)]
6964pub struct SocketCreateSocketResponder {
6965    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
6966    tx_id: u32,
6967}
6968
6969/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
6970/// if the responder is dropped without sending a response, so that the client
6971/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6972impl std::ops::Drop for SocketCreateSocketResponder {
6973    fn drop(&mut self) {
6974        self.control_handle.shutdown();
6975        // Safety: drops once, never accessed again
6976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6977    }
6978}
6979
6980impl fidl::endpoints::Responder for SocketCreateSocketResponder {
6981    type ControlHandle = SocketControlHandle;
6982
6983    fn control_handle(&self) -> &SocketControlHandle {
6984        &self.control_handle
6985    }
6986
6987    fn drop_without_shutdown(mut self) {
6988        // Safety: drops once, never accessed again due to mem::forget
6989        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6990        // Prevent Drop from running (which would shut down the channel)
6991        std::mem::forget(self);
6992    }
6993}
6994
6995impl SocketCreateSocketResponder {
6996    /// Sends a response to the FIDL transaction.
6997    ///
6998    /// Sets the channel to shutdown if an error occurs.
6999    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7000        let _result = self.send_raw(result);
7001        if _result.is_err() {
7002            self.control_handle.shutdown();
7003        }
7004        self.drop_without_shutdown();
7005        _result
7006    }
7007
7008    /// Similar to "send" but does not shutdown the channel if an error occurs.
7009    pub fn send_no_shutdown_on_err(
7010        self,
7011        mut result: Result<(), &Error>,
7012    ) -> Result<(), fidl::Error> {
7013        let _result = self.send_raw(result);
7014        self.drop_without_shutdown();
7015        _result
7016    }
7017
7018    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7019        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7020            fidl::encoding::EmptyStruct,
7021            Error,
7022        >>(
7023            fidl::encoding::FlexibleResult::new(result),
7024            self.tx_id,
7025            0x200bf0ea21932de0,
7026            fidl::encoding::DynamicFlags::FLEXIBLE,
7027        )
7028    }
7029}
7030
7031#[must_use = "FIDL methods require a response to be sent"]
7032#[derive(Debug)]
7033pub struct SocketSetSocketDispositionResponder {
7034    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7035    tx_id: u32,
7036}
7037
7038/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7039/// if the responder is dropped without sending a response, so that the client
7040/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7041impl std::ops::Drop for SocketSetSocketDispositionResponder {
7042    fn drop(&mut self) {
7043        self.control_handle.shutdown();
7044        // Safety: drops once, never accessed again
7045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7046    }
7047}
7048
7049impl fidl::endpoints::Responder for SocketSetSocketDispositionResponder {
7050    type ControlHandle = SocketControlHandle;
7051
7052    fn control_handle(&self) -> &SocketControlHandle {
7053        &self.control_handle
7054    }
7055
7056    fn drop_without_shutdown(mut self) {
7057        // Safety: drops once, never accessed again due to mem::forget
7058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7059        // Prevent Drop from running (which would shut down the channel)
7060        std::mem::forget(self);
7061    }
7062}
7063
7064impl SocketSetSocketDispositionResponder {
7065    /// Sends a response to the FIDL transaction.
7066    ///
7067    /// Sets the channel to shutdown if an error occurs.
7068    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7069        let _result = self.send_raw(result);
7070        if _result.is_err() {
7071            self.control_handle.shutdown();
7072        }
7073        self.drop_without_shutdown();
7074        _result
7075    }
7076
7077    /// Similar to "send" but does not shutdown the channel if an error occurs.
7078    pub fn send_no_shutdown_on_err(
7079        self,
7080        mut result: Result<(), &Error>,
7081    ) -> Result<(), fidl::Error> {
7082        let _result = self.send_raw(result);
7083        self.drop_without_shutdown();
7084        _result
7085    }
7086
7087    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7088        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7089            fidl::encoding::EmptyStruct,
7090            Error,
7091        >>(
7092            fidl::encoding::FlexibleResult::new(result),
7093            self.tx_id,
7094            0x60d3c7ccb17f9bdf,
7095            fidl::encoding::DynamicFlags::FLEXIBLE,
7096        )
7097    }
7098}
7099
7100#[must_use = "FIDL methods require a response to be sent"]
7101#[derive(Debug)]
7102pub struct SocketReadSocketResponder {
7103    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7104    tx_id: u32,
7105}
7106
7107/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7108/// if the responder is dropped without sending a response, so that the client
7109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7110impl std::ops::Drop for SocketReadSocketResponder {
7111    fn drop(&mut self) {
7112        self.control_handle.shutdown();
7113        // Safety: drops once, never accessed again
7114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7115    }
7116}
7117
7118impl fidl::endpoints::Responder for SocketReadSocketResponder {
7119    type ControlHandle = SocketControlHandle;
7120
7121    fn control_handle(&self) -> &SocketControlHandle {
7122        &self.control_handle
7123    }
7124
7125    fn drop_without_shutdown(mut self) {
7126        // Safety: drops once, never accessed again due to mem::forget
7127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7128        // Prevent Drop from running (which would shut down the channel)
7129        std::mem::forget(self);
7130    }
7131}
7132
7133impl SocketReadSocketResponder {
7134    /// Sends a response to the FIDL transaction.
7135    ///
7136    /// Sets the channel to shutdown if an error occurs.
7137    pub fn send(self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
7138        let _result = self.send_raw(result);
7139        if _result.is_err() {
7140            self.control_handle.shutdown();
7141        }
7142        self.drop_without_shutdown();
7143        _result
7144    }
7145
7146    /// Similar to "send" but does not shutdown the channel if an error occurs.
7147    pub fn send_no_shutdown_on_err(
7148        self,
7149        mut result: Result<(&[u8], bool), &Error>,
7150    ) -> Result<(), fidl::Error> {
7151        let _result = self.send_raw(result);
7152        self.drop_without_shutdown();
7153        _result
7154    }
7155
7156    fn send_raw(&self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
7157        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<SocketData, Error>>(
7158            fidl::encoding::FlexibleResult::new(result),
7159            self.tx_id,
7160            0x1da8aabec249c02e,
7161            fidl::encoding::DynamicFlags::FLEXIBLE,
7162        )
7163    }
7164}
7165
7166#[must_use = "FIDL methods require a response to be sent"]
7167#[derive(Debug)]
7168pub struct SocketWriteSocketResponder {
7169    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7170    tx_id: u32,
7171}
7172
7173/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7174/// if the responder is dropped without sending a response, so that the client
7175/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7176impl std::ops::Drop for SocketWriteSocketResponder {
7177    fn drop(&mut self) {
7178        self.control_handle.shutdown();
7179        // Safety: drops once, never accessed again
7180        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7181    }
7182}
7183
7184impl fidl::endpoints::Responder for SocketWriteSocketResponder {
7185    type ControlHandle = SocketControlHandle;
7186
7187    fn control_handle(&self) -> &SocketControlHandle {
7188        &self.control_handle
7189    }
7190
7191    fn drop_without_shutdown(mut self) {
7192        // Safety: drops once, never accessed again due to mem::forget
7193        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7194        // Prevent Drop from running (which would shut down the channel)
7195        std::mem::forget(self);
7196    }
7197}
7198
7199impl SocketWriteSocketResponder {
7200    /// Sends a response to the FIDL transaction.
7201    ///
7202    /// Sets the channel to shutdown if an error occurs.
7203    pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
7204        let _result = self.send_raw(result);
7205        if _result.is_err() {
7206            self.control_handle.shutdown();
7207        }
7208        self.drop_without_shutdown();
7209        _result
7210    }
7211
7212    /// Similar to "send" but does not shutdown the channel if an error occurs.
7213    pub fn send_no_shutdown_on_err(
7214        self,
7215        mut result: Result<u64, &WriteSocketError>,
7216    ) -> Result<(), fidl::Error> {
7217        let _result = self.send_raw(result);
7218        self.drop_without_shutdown();
7219        _result
7220    }
7221
7222    fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
7223        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7224            SocketWriteSocketResponse,
7225            WriteSocketError,
7226        >>(
7227            fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
7228            self.tx_id,
7229            0x5b541623cbbbf683,
7230            fidl::encoding::DynamicFlags::FLEXIBLE,
7231        )
7232    }
7233}
7234
7235#[must_use = "FIDL methods require a response to be sent"]
7236#[derive(Debug)]
7237pub struct SocketReadSocketStreamingStartResponder {
7238    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7239    tx_id: u32,
7240}
7241
7242/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7243/// if the responder is dropped without sending a response, so that the client
7244/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7245impl std::ops::Drop for SocketReadSocketStreamingStartResponder {
7246    fn drop(&mut self) {
7247        self.control_handle.shutdown();
7248        // Safety: drops once, never accessed again
7249        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7250    }
7251}
7252
7253impl fidl::endpoints::Responder for SocketReadSocketStreamingStartResponder {
7254    type ControlHandle = SocketControlHandle;
7255
7256    fn control_handle(&self) -> &SocketControlHandle {
7257        &self.control_handle
7258    }
7259
7260    fn drop_without_shutdown(mut self) {
7261        // Safety: drops once, never accessed again due to mem::forget
7262        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7263        // Prevent Drop from running (which would shut down the channel)
7264        std::mem::forget(self);
7265    }
7266}
7267
7268impl SocketReadSocketStreamingStartResponder {
7269    /// Sends a response to the FIDL transaction.
7270    ///
7271    /// Sets the channel to shutdown if an error occurs.
7272    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7273        let _result = self.send_raw(result);
7274        if _result.is_err() {
7275            self.control_handle.shutdown();
7276        }
7277        self.drop_without_shutdown();
7278        _result
7279    }
7280
7281    /// Similar to "send" but does not shutdown the channel if an error occurs.
7282    pub fn send_no_shutdown_on_err(
7283        self,
7284        mut result: Result<(), &Error>,
7285    ) -> Result<(), fidl::Error> {
7286        let _result = self.send_raw(result);
7287        self.drop_without_shutdown();
7288        _result
7289    }
7290
7291    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7292        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7293            fidl::encoding::EmptyStruct,
7294            Error,
7295        >>(
7296            fidl::encoding::FlexibleResult::new(result),
7297            self.tx_id,
7298            0x2a592748d5f33445,
7299            fidl::encoding::DynamicFlags::FLEXIBLE,
7300        )
7301    }
7302}
7303
7304#[must_use = "FIDL methods require a response to be sent"]
7305#[derive(Debug)]
7306pub struct SocketReadSocketStreamingStopResponder {
7307    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7308    tx_id: u32,
7309}
7310
7311/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7312/// if the responder is dropped without sending a response, so that the client
7313/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7314impl std::ops::Drop for SocketReadSocketStreamingStopResponder {
7315    fn drop(&mut self) {
7316        self.control_handle.shutdown();
7317        // Safety: drops once, never accessed again
7318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7319    }
7320}
7321
7322impl fidl::endpoints::Responder for SocketReadSocketStreamingStopResponder {
7323    type ControlHandle = SocketControlHandle;
7324
7325    fn control_handle(&self) -> &SocketControlHandle {
7326        &self.control_handle
7327    }
7328
7329    fn drop_without_shutdown(mut self) {
7330        // Safety: drops once, never accessed again due to mem::forget
7331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7332        // Prevent Drop from running (which would shut down the channel)
7333        std::mem::forget(self);
7334    }
7335}
7336
7337impl SocketReadSocketStreamingStopResponder {
7338    /// Sends a response to the FIDL transaction.
7339    ///
7340    /// Sets the channel to shutdown if an error occurs.
7341    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7342        let _result = self.send_raw(result);
7343        if _result.is_err() {
7344            self.control_handle.shutdown();
7345        }
7346        self.drop_without_shutdown();
7347        _result
7348    }
7349
7350    /// Similar to "send" but does not shutdown the channel if an error occurs.
7351    pub fn send_no_shutdown_on_err(
7352        self,
7353        mut result: Result<(), &Error>,
7354    ) -> Result<(), fidl::Error> {
7355        let _result = self.send_raw(result);
7356        self.drop_without_shutdown();
7357        _result
7358    }
7359
7360    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7361        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7362            fidl::encoding::EmptyStruct,
7363            Error,
7364        >>(
7365            fidl::encoding::FlexibleResult::new(result),
7366            self.tx_id,
7367            0x53e5cade5f4d22e7,
7368            fidl::encoding::DynamicFlags::FLEXIBLE,
7369        )
7370    }
7371}
7372
7373mod internal {
7374    use super::*;
7375}