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