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::NullableHandle {
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::NullableHandle {
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::NullableHandle {
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>;
2279pub type FDomainGetKoidResult = Result<u64, Error>;
2280
2281pub trait FDomainProxyInterface: Send + Sync {
2282    type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
2283        + Send;
2284    fn r#create_channel(&self, handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut;
2285    type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
2286        + Send;
2287    fn r#read_channel(&self, handle: &HandleId) -> Self::ReadChannelResponseFut;
2288    type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
2289        + Send;
2290    fn r#write_channel(
2291        &self,
2292        handle: &HandleId,
2293        data: &[u8],
2294        handles: &Handles,
2295    ) -> Self::WriteChannelResponseFut;
2296    type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
2297        + Send;
2298    fn r#read_channel_streaming_start(
2299        &self,
2300        handle: &HandleId,
2301    ) -> Self::ReadChannelStreamingStartResponseFut;
2302    type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
2303        + Send;
2304    fn r#read_channel_streaming_stop(
2305        &self,
2306        handle: &HandleId,
2307    ) -> Self::ReadChannelStreamingStopResponseFut;
2308    type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
2309        + Send;
2310    fn r#create_event(&self, handle: &NewHandleId) -> Self::CreateEventResponseFut;
2311    type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
2312        + Send;
2313    fn r#create_event_pair(&self, handles: &[NewHandleId; 2]) -> Self::CreateEventPairResponseFut;
2314    type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
2315        + Send;
2316    fn r#create_socket(
2317        &self,
2318        options: SocketType,
2319        handles: &[NewHandleId; 2],
2320    ) -> Self::CreateSocketResponseFut;
2321    type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
2322        + Send;
2323    fn r#set_socket_disposition(
2324        &self,
2325        handle: &HandleId,
2326        disposition: SocketDisposition,
2327        disposition_peer: SocketDisposition,
2328    ) -> Self::SetSocketDispositionResponseFut;
2329    type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
2330        + Send;
2331    fn r#read_socket(&self, handle: &HandleId, max_bytes: u64) -> Self::ReadSocketResponseFut;
2332    type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
2333        + Send;
2334    fn r#write_socket(&self, handle: &HandleId, data: &[u8]) -> Self::WriteSocketResponseFut;
2335    type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
2336        + Send;
2337    fn r#read_socket_streaming_start(
2338        &self,
2339        handle: &HandleId,
2340    ) -> Self::ReadSocketStreamingStartResponseFut;
2341    type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
2342        + Send;
2343    fn r#read_socket_streaming_stop(
2344        &self,
2345        handle: &HandleId,
2346    ) -> Self::ReadSocketStreamingStopResponseFut;
2347    type GetNamespaceResponseFut: std::future::Future<Output = Result<FDomainGetNamespaceResult, fidl::Error>>
2348        + Send;
2349    fn r#get_namespace(&self, new_handle: &NewHandleId) -> Self::GetNamespaceResponseFut;
2350    type CloseResponseFut: std::future::Future<Output = Result<FDomainCloseResult, fidl::Error>>
2351        + Send;
2352    fn r#close(&self, handles: &[HandleId]) -> Self::CloseResponseFut;
2353    type DuplicateResponseFut: std::future::Future<Output = Result<FDomainDuplicateResult, fidl::Error>>
2354        + Send;
2355    fn r#duplicate(
2356        &self,
2357        handle: &HandleId,
2358        new_handle: &NewHandleId,
2359        rights: fidl::Rights,
2360    ) -> Self::DuplicateResponseFut;
2361    type ReplaceResponseFut: std::future::Future<Output = Result<FDomainReplaceResult, fidl::Error>>
2362        + Send;
2363    fn r#replace(
2364        &self,
2365        handle: &HandleId,
2366        new_handle: &NewHandleId,
2367        rights: fidl::Rights,
2368    ) -> Self::ReplaceResponseFut;
2369    type SignalResponseFut: std::future::Future<Output = Result<FDomainSignalResult, fidl::Error>>
2370        + Send;
2371    fn r#signal(&self, handle: &HandleId, set: u32, clear: u32) -> Self::SignalResponseFut;
2372    type SignalPeerResponseFut: std::future::Future<Output = Result<FDomainSignalPeerResult, fidl::Error>>
2373        + Send;
2374    fn r#signal_peer(&self, handle: &HandleId, set: u32, clear: u32)
2375    -> Self::SignalPeerResponseFut;
2376    type WaitForSignalsResponseFut: std::future::Future<Output = Result<FDomainWaitForSignalsResult, fidl::Error>>
2377        + Send;
2378    fn r#wait_for_signals(
2379        &self,
2380        handle: &HandleId,
2381        signals: u32,
2382    ) -> Self::WaitForSignalsResponseFut;
2383    type GetKoidResponseFut: std::future::Future<Output = Result<FDomainGetKoidResult, fidl::Error>>
2384        + Send;
2385    fn r#get_koid(&self, handle: &HandleId) -> Self::GetKoidResponseFut;
2386}
2387#[derive(Debug)]
2388#[cfg(target_os = "fuchsia")]
2389pub struct FDomainSynchronousProxy {
2390    client: fidl::client::sync::Client,
2391}
2392
2393#[cfg(target_os = "fuchsia")]
2394impl fidl::endpoints::SynchronousProxy for FDomainSynchronousProxy {
2395    type Proxy = FDomainProxy;
2396    type Protocol = FDomainMarker;
2397
2398    fn from_channel(inner: fidl::Channel) -> Self {
2399        Self::new(inner)
2400    }
2401
2402    fn into_channel(self) -> fidl::Channel {
2403        self.client.into_channel()
2404    }
2405
2406    fn as_channel(&self) -> &fidl::Channel {
2407        self.client.as_channel()
2408    }
2409}
2410
2411#[cfg(target_os = "fuchsia")]
2412impl FDomainSynchronousProxy {
2413    pub fn new(channel: fidl::Channel) -> Self {
2414        let protocol_name = <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2415        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2416    }
2417
2418    pub fn into_channel(self) -> fidl::Channel {
2419        self.client.into_channel()
2420    }
2421
2422    /// Waits until an event arrives and returns it. It is safe for other
2423    /// threads to make concurrent requests while waiting for an event.
2424    pub fn wait_for_event(
2425        &self,
2426        deadline: zx::MonotonicInstant,
2427    ) -> Result<FDomainEvent, fidl::Error> {
2428        FDomainEvent::decode(self.client.wait_for_event(deadline)?)
2429    }
2430
2431    pub fn r#create_channel(
2432        &self,
2433        mut handles: &[NewHandleId; 2],
2434        ___deadline: zx::MonotonicInstant,
2435    ) -> Result<ChannelCreateChannelResult, fidl::Error> {
2436        let _response = self.client.send_query::<
2437            ChannelCreateChannelRequest,
2438            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2439        >(
2440            (handles,),
2441            0x182d38bfe88673b5,
2442            fidl::encoding::DynamicFlags::FLEXIBLE,
2443            ___deadline,
2444        )?
2445        .into_result::<FDomainMarker>("create_channel")?;
2446        Ok(_response.map(|x| x))
2447    }
2448
2449    pub fn r#read_channel(
2450        &self,
2451        mut handle: &HandleId,
2452        ___deadline: zx::MonotonicInstant,
2453    ) -> Result<ChannelReadChannelResult, fidl::Error> {
2454        let _response = self.client.send_query::<
2455            ChannelReadChannelRequest,
2456            fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
2457        >(
2458            (handle,),
2459            0x6ef47bf27bf7d050,
2460            fidl::encoding::DynamicFlags::FLEXIBLE,
2461            ___deadline,
2462        )?
2463        .into_result::<FDomainMarker>("read_channel")?;
2464        Ok(_response.map(|x| (x.data, x.handles)))
2465    }
2466
2467    pub fn r#write_channel(
2468        &self,
2469        mut handle: &HandleId,
2470        mut data: &[u8],
2471        mut handles: &Handles,
2472        ___deadline: zx::MonotonicInstant,
2473    ) -> Result<ChannelWriteChannelResult, fidl::Error> {
2474        let _response = self.client.send_query::<
2475            ChannelWriteChannelRequest,
2476            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
2477        >(
2478            (handle, data, handles,),
2479            0x75a2559b945d5eb5,
2480            fidl::encoding::DynamicFlags::FLEXIBLE,
2481            ___deadline,
2482        )?
2483        .into_result::<FDomainMarker>("write_channel")?;
2484        Ok(_response.map(|x| x))
2485    }
2486
2487    pub fn r#read_channel_streaming_start(
2488        &self,
2489        mut handle: &HandleId,
2490        ___deadline: zx::MonotonicInstant,
2491    ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
2492        let _response = self.client.send_query::<
2493            ChannelReadChannelStreamingStartRequest,
2494            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2495        >(
2496            (handle,),
2497            0x3c73e85476a203df,
2498            fidl::encoding::DynamicFlags::FLEXIBLE,
2499            ___deadline,
2500        )?
2501        .into_result::<FDomainMarker>("read_channel_streaming_start")?;
2502        Ok(_response.map(|x| x))
2503    }
2504
2505    pub fn r#read_channel_streaming_stop(
2506        &self,
2507        mut handle: &HandleId,
2508        ___deadline: zx::MonotonicInstant,
2509    ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
2510        let _response = self.client.send_query::<
2511            ChannelReadChannelStreamingStopRequest,
2512            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2513        >(
2514            (handle,),
2515            0x56f21d6ed68186e0,
2516            fidl::encoding::DynamicFlags::FLEXIBLE,
2517            ___deadline,
2518        )?
2519        .into_result::<FDomainMarker>("read_channel_streaming_stop")?;
2520        Ok(_response.map(|x| x))
2521    }
2522
2523    pub fn r#create_event(
2524        &self,
2525        mut handle: &NewHandleId,
2526        ___deadline: zx::MonotonicInstant,
2527    ) -> Result<EventCreateEventResult, fidl::Error> {
2528        let _response = self.client.send_query::<
2529            EventCreateEventRequest,
2530            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2531        >(
2532            (handle,),
2533            0x7b05b3f262635987,
2534            fidl::encoding::DynamicFlags::FLEXIBLE,
2535            ___deadline,
2536        )?
2537        .into_result::<FDomainMarker>("create_event")?;
2538        Ok(_response.map(|x| x))
2539    }
2540
2541    pub fn r#create_event_pair(
2542        &self,
2543        mut handles: &[NewHandleId; 2],
2544        ___deadline: zx::MonotonicInstant,
2545    ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
2546        let _response = self.client.send_query::<
2547            EventPairCreateEventPairRequest,
2548            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2549        >(
2550            (handles,),
2551            0x7aef61effa65656d,
2552            fidl::encoding::DynamicFlags::FLEXIBLE,
2553            ___deadline,
2554        )?
2555        .into_result::<FDomainMarker>("create_event_pair")?;
2556        Ok(_response.map(|x| x))
2557    }
2558
2559    pub fn r#create_socket(
2560        &self,
2561        mut options: SocketType,
2562        mut handles: &[NewHandleId; 2],
2563        ___deadline: zx::MonotonicInstant,
2564    ) -> Result<SocketCreateSocketResult, fidl::Error> {
2565        let _response = self.client.send_query::<
2566            SocketCreateSocketRequest,
2567            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2568        >(
2569            (options, handles,),
2570            0x200bf0ea21932de0,
2571            fidl::encoding::DynamicFlags::FLEXIBLE,
2572            ___deadline,
2573        )?
2574        .into_result::<FDomainMarker>("create_socket")?;
2575        Ok(_response.map(|x| x))
2576    }
2577
2578    pub fn r#set_socket_disposition(
2579        &self,
2580        mut handle: &HandleId,
2581        mut disposition: SocketDisposition,
2582        mut disposition_peer: SocketDisposition,
2583        ___deadline: zx::MonotonicInstant,
2584    ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
2585        let _response = self.client.send_query::<
2586            SocketSetSocketDispositionRequest,
2587            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2588        >(
2589            (handle, disposition, disposition_peer,),
2590            0x60d3c7ccb17f9bdf,
2591            fidl::encoding::DynamicFlags::FLEXIBLE,
2592            ___deadline,
2593        )?
2594        .into_result::<FDomainMarker>("set_socket_disposition")?;
2595        Ok(_response.map(|x| x))
2596    }
2597
2598    pub fn r#read_socket(
2599        &self,
2600        mut handle: &HandleId,
2601        mut max_bytes: u64,
2602        ___deadline: zx::MonotonicInstant,
2603    ) -> Result<SocketReadSocketResult, fidl::Error> {
2604        let _response = self.client.send_query::<
2605            SocketReadSocketRequest,
2606            fidl::encoding::FlexibleResultType<SocketData, Error>,
2607        >(
2608            (handle, max_bytes,),
2609            0x1da8aabec249c02e,
2610            fidl::encoding::DynamicFlags::FLEXIBLE,
2611            ___deadline,
2612        )?
2613        .into_result::<FDomainMarker>("read_socket")?;
2614        Ok(_response.map(|x| (x.data, x.is_datagram)))
2615    }
2616
2617    pub fn r#write_socket(
2618        &self,
2619        mut handle: &HandleId,
2620        mut data: &[u8],
2621        ___deadline: zx::MonotonicInstant,
2622    ) -> Result<SocketWriteSocketResult, fidl::Error> {
2623        let _response = self.client.send_query::<
2624            SocketWriteSocketRequest,
2625            fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
2626        >(
2627            (handle, data,),
2628            0x5b541623cbbbf683,
2629            fidl::encoding::DynamicFlags::FLEXIBLE,
2630            ___deadline,
2631        )?
2632        .into_result::<FDomainMarker>("write_socket")?;
2633        Ok(_response.map(|x| x.wrote))
2634    }
2635
2636    pub fn r#read_socket_streaming_start(
2637        &self,
2638        mut handle: &HandleId,
2639        ___deadline: zx::MonotonicInstant,
2640    ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
2641        let _response = self.client.send_query::<
2642            SocketReadSocketStreamingStartRequest,
2643            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2644        >(
2645            (handle,),
2646            0x2a592748d5f33445,
2647            fidl::encoding::DynamicFlags::FLEXIBLE,
2648            ___deadline,
2649        )?
2650        .into_result::<FDomainMarker>("read_socket_streaming_start")?;
2651        Ok(_response.map(|x| x))
2652    }
2653
2654    pub fn r#read_socket_streaming_stop(
2655        &self,
2656        mut handle: &HandleId,
2657        ___deadline: zx::MonotonicInstant,
2658    ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
2659        let _response = self.client.send_query::<
2660            SocketReadSocketStreamingStopRequest,
2661            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2662        >(
2663            (handle,),
2664            0x53e5cade5f4d22e7,
2665            fidl::encoding::DynamicFlags::FLEXIBLE,
2666            ___deadline,
2667        )?
2668        .into_result::<FDomainMarker>("read_socket_streaming_stop")?;
2669        Ok(_response.map(|x| x))
2670    }
2671
2672    pub fn r#get_namespace(
2673        &self,
2674        mut new_handle: &NewHandleId,
2675        ___deadline: zx::MonotonicInstant,
2676    ) -> Result<FDomainGetNamespaceResult, fidl::Error> {
2677        let _response = self.client.send_query::<
2678            FDomainGetNamespaceRequest,
2679            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2680        >(
2681            (new_handle,),
2682            0x74f2e74d9f53e11e,
2683            fidl::encoding::DynamicFlags::FLEXIBLE,
2684            ___deadline,
2685        )?
2686        .into_result::<FDomainMarker>("get_namespace")?;
2687        Ok(_response.map(|x| x))
2688    }
2689
2690    pub fn r#close(
2691        &self,
2692        mut handles: &[HandleId],
2693        ___deadline: zx::MonotonicInstant,
2694    ) -> Result<FDomainCloseResult, fidl::Error> {
2695        let _response = self.client.send_query::<
2696            FDomainCloseRequest,
2697            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2698        >(
2699            (handles,),
2700            0x5ef8c24362964257,
2701            fidl::encoding::DynamicFlags::FLEXIBLE,
2702            ___deadline,
2703        )?
2704        .into_result::<FDomainMarker>("close")?;
2705        Ok(_response.map(|x| x))
2706    }
2707
2708    pub fn r#duplicate(
2709        &self,
2710        mut handle: &HandleId,
2711        mut new_handle: &NewHandleId,
2712        mut rights: fidl::Rights,
2713        ___deadline: zx::MonotonicInstant,
2714    ) -> Result<FDomainDuplicateResult, fidl::Error> {
2715        let _response = self.client.send_query::<
2716            FDomainDuplicateRequest,
2717            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2718        >(
2719            (handle, new_handle, rights,),
2720            0x7a85b94bd1777ab9,
2721            fidl::encoding::DynamicFlags::FLEXIBLE,
2722            ___deadline,
2723        )?
2724        .into_result::<FDomainMarker>("duplicate")?;
2725        Ok(_response.map(|x| x))
2726    }
2727
2728    pub fn r#replace(
2729        &self,
2730        mut handle: &HandleId,
2731        mut new_handle: &NewHandleId,
2732        mut rights: fidl::Rights,
2733        ___deadline: zx::MonotonicInstant,
2734    ) -> Result<FDomainReplaceResult, fidl::Error> {
2735        let _response = self.client.send_query::<
2736            FDomainReplaceRequest,
2737            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2738        >(
2739            (handle, new_handle, rights,),
2740            0x32fa64625a5bd3be,
2741            fidl::encoding::DynamicFlags::FLEXIBLE,
2742            ___deadline,
2743        )?
2744        .into_result::<FDomainMarker>("replace")?;
2745        Ok(_response.map(|x| x))
2746    }
2747
2748    pub fn r#signal(
2749        &self,
2750        mut handle: &HandleId,
2751        mut set: u32,
2752        mut clear: u32,
2753        ___deadline: zx::MonotonicInstant,
2754    ) -> Result<FDomainSignalResult, fidl::Error> {
2755        let _response = self.client.send_query::<
2756            FDomainSignalRequest,
2757            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2758        >(
2759            (handle, set, clear,),
2760            0xe8352fb978996d9,
2761            fidl::encoding::DynamicFlags::FLEXIBLE,
2762            ___deadline,
2763        )?
2764        .into_result::<FDomainMarker>("signal")?;
2765        Ok(_response.map(|x| x))
2766    }
2767
2768    pub fn r#signal_peer(
2769        &self,
2770        mut handle: &HandleId,
2771        mut set: u32,
2772        mut clear: u32,
2773        ___deadline: zx::MonotonicInstant,
2774    ) -> Result<FDomainSignalPeerResult, fidl::Error> {
2775        let _response = self.client.send_query::<
2776            FDomainSignalPeerRequest,
2777            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2778        >(
2779            (handle, set, clear,),
2780            0x7e84ec8ca7eabaf8,
2781            fidl::encoding::DynamicFlags::FLEXIBLE,
2782            ___deadline,
2783        )?
2784        .into_result::<FDomainMarker>("signal_peer")?;
2785        Ok(_response.map(|x| x))
2786    }
2787
2788    pub fn r#wait_for_signals(
2789        &self,
2790        mut handle: &HandleId,
2791        mut signals: u32,
2792        ___deadline: zx::MonotonicInstant,
2793    ) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
2794        let _response = self.client.send_query::<
2795            FDomainWaitForSignalsRequest,
2796            fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
2797        >(
2798            (handle, signals,),
2799            0x8f72d9b4b85c1eb,
2800            fidl::encoding::DynamicFlags::FLEXIBLE,
2801            ___deadline,
2802        )?
2803        .into_result::<FDomainMarker>("wait_for_signals")?;
2804        Ok(_response.map(|x| x.signals))
2805    }
2806
2807    pub fn r#get_koid(
2808        &self,
2809        mut handle: &HandleId,
2810        ___deadline: zx::MonotonicInstant,
2811    ) -> Result<FDomainGetKoidResult, fidl::Error> {
2812        let _response = self.client.send_query::<
2813            FDomainGetKoidRequest,
2814            fidl::encoding::FlexibleResultType<FDomainGetKoidResponse, Error>,
2815        >(
2816            (handle,),
2817            0x437db979a63402c3,
2818            fidl::encoding::DynamicFlags::FLEXIBLE,
2819            ___deadline,
2820        )?
2821        .into_result::<FDomainMarker>("get_koid")?;
2822        Ok(_response.map(|x| x.koid))
2823    }
2824}
2825
2826#[cfg(target_os = "fuchsia")]
2827impl From<FDomainSynchronousProxy> for zx::NullableHandle {
2828    fn from(value: FDomainSynchronousProxy) -> Self {
2829        value.into_channel().into()
2830    }
2831}
2832
2833#[cfg(target_os = "fuchsia")]
2834impl From<fidl::Channel> for FDomainSynchronousProxy {
2835    fn from(value: fidl::Channel) -> Self {
2836        Self::new(value)
2837    }
2838}
2839
2840#[cfg(target_os = "fuchsia")]
2841impl fidl::endpoints::FromClient for FDomainSynchronousProxy {
2842    type Protocol = FDomainMarker;
2843
2844    fn from_client(value: fidl::endpoints::ClientEnd<FDomainMarker>) -> Self {
2845        Self::new(value.into_channel())
2846    }
2847}
2848
2849#[derive(Debug, Clone)]
2850pub struct FDomainProxy {
2851    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2852}
2853
2854impl fidl::endpoints::Proxy for FDomainProxy {
2855    type Protocol = FDomainMarker;
2856
2857    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2858        Self::new(inner)
2859    }
2860
2861    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2862        self.client.into_channel().map_err(|client| Self { client })
2863    }
2864
2865    fn as_channel(&self) -> &::fidl::AsyncChannel {
2866        self.client.as_channel()
2867    }
2868}
2869
2870impl FDomainProxy {
2871    /// Create a new Proxy for fuchsia.fdomain/FDomain.
2872    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2873        let protocol_name = <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2874        Self { client: fidl::client::Client::new(channel, protocol_name) }
2875    }
2876
2877    /// Get a Stream of events from the remote end of the protocol.
2878    ///
2879    /// # Panics
2880    ///
2881    /// Panics if the event stream was already taken.
2882    pub fn take_event_stream(&self) -> FDomainEventStream {
2883        FDomainEventStream { event_receiver: self.client.take_event_receiver() }
2884    }
2885
2886    pub fn r#create_channel(
2887        &self,
2888        mut handles: &[NewHandleId; 2],
2889    ) -> fidl::client::QueryResponseFut<
2890        ChannelCreateChannelResult,
2891        fidl::encoding::DefaultFuchsiaResourceDialect,
2892    > {
2893        FDomainProxyInterface::r#create_channel(self, handles)
2894    }
2895
2896    pub fn r#read_channel(
2897        &self,
2898        mut handle: &HandleId,
2899    ) -> fidl::client::QueryResponseFut<
2900        ChannelReadChannelResult,
2901        fidl::encoding::DefaultFuchsiaResourceDialect,
2902    > {
2903        FDomainProxyInterface::r#read_channel(self, handle)
2904    }
2905
2906    pub fn r#write_channel(
2907        &self,
2908        mut handle: &HandleId,
2909        mut data: &[u8],
2910        mut handles: &Handles,
2911    ) -> fidl::client::QueryResponseFut<
2912        ChannelWriteChannelResult,
2913        fidl::encoding::DefaultFuchsiaResourceDialect,
2914    > {
2915        FDomainProxyInterface::r#write_channel(self, handle, data, handles)
2916    }
2917
2918    pub fn r#read_channel_streaming_start(
2919        &self,
2920        mut handle: &HandleId,
2921    ) -> fidl::client::QueryResponseFut<
2922        ChannelReadChannelStreamingStartResult,
2923        fidl::encoding::DefaultFuchsiaResourceDialect,
2924    > {
2925        FDomainProxyInterface::r#read_channel_streaming_start(self, handle)
2926    }
2927
2928    pub fn r#read_channel_streaming_stop(
2929        &self,
2930        mut handle: &HandleId,
2931    ) -> fidl::client::QueryResponseFut<
2932        ChannelReadChannelStreamingStopResult,
2933        fidl::encoding::DefaultFuchsiaResourceDialect,
2934    > {
2935        FDomainProxyInterface::r#read_channel_streaming_stop(self, handle)
2936    }
2937
2938    pub fn r#create_event(
2939        &self,
2940        mut handle: &NewHandleId,
2941    ) -> fidl::client::QueryResponseFut<
2942        EventCreateEventResult,
2943        fidl::encoding::DefaultFuchsiaResourceDialect,
2944    > {
2945        FDomainProxyInterface::r#create_event(self, handle)
2946    }
2947
2948    pub fn r#create_event_pair(
2949        &self,
2950        mut handles: &[NewHandleId; 2],
2951    ) -> fidl::client::QueryResponseFut<
2952        EventPairCreateEventPairResult,
2953        fidl::encoding::DefaultFuchsiaResourceDialect,
2954    > {
2955        FDomainProxyInterface::r#create_event_pair(self, handles)
2956    }
2957
2958    pub fn r#create_socket(
2959        &self,
2960        mut options: SocketType,
2961        mut handles: &[NewHandleId; 2],
2962    ) -> fidl::client::QueryResponseFut<
2963        SocketCreateSocketResult,
2964        fidl::encoding::DefaultFuchsiaResourceDialect,
2965    > {
2966        FDomainProxyInterface::r#create_socket(self, options, handles)
2967    }
2968
2969    pub fn r#set_socket_disposition(
2970        &self,
2971        mut handle: &HandleId,
2972        mut disposition: SocketDisposition,
2973        mut disposition_peer: SocketDisposition,
2974    ) -> fidl::client::QueryResponseFut<
2975        SocketSetSocketDispositionResult,
2976        fidl::encoding::DefaultFuchsiaResourceDialect,
2977    > {
2978        FDomainProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
2979    }
2980
2981    pub fn r#read_socket(
2982        &self,
2983        mut handle: &HandleId,
2984        mut max_bytes: u64,
2985    ) -> fidl::client::QueryResponseFut<
2986        SocketReadSocketResult,
2987        fidl::encoding::DefaultFuchsiaResourceDialect,
2988    > {
2989        FDomainProxyInterface::r#read_socket(self, handle, max_bytes)
2990    }
2991
2992    pub fn r#write_socket(
2993        &self,
2994        mut handle: &HandleId,
2995        mut data: &[u8],
2996    ) -> fidl::client::QueryResponseFut<
2997        SocketWriteSocketResult,
2998        fidl::encoding::DefaultFuchsiaResourceDialect,
2999    > {
3000        FDomainProxyInterface::r#write_socket(self, handle, data)
3001    }
3002
3003    pub fn r#read_socket_streaming_start(
3004        &self,
3005        mut handle: &HandleId,
3006    ) -> fidl::client::QueryResponseFut<
3007        SocketReadSocketStreamingStartResult,
3008        fidl::encoding::DefaultFuchsiaResourceDialect,
3009    > {
3010        FDomainProxyInterface::r#read_socket_streaming_start(self, handle)
3011    }
3012
3013    pub fn r#read_socket_streaming_stop(
3014        &self,
3015        mut handle: &HandleId,
3016    ) -> fidl::client::QueryResponseFut<
3017        SocketReadSocketStreamingStopResult,
3018        fidl::encoding::DefaultFuchsiaResourceDialect,
3019    > {
3020        FDomainProxyInterface::r#read_socket_streaming_stop(self, handle)
3021    }
3022
3023    pub fn r#get_namespace(
3024        &self,
3025        mut new_handle: &NewHandleId,
3026    ) -> fidl::client::QueryResponseFut<
3027        FDomainGetNamespaceResult,
3028        fidl::encoding::DefaultFuchsiaResourceDialect,
3029    > {
3030        FDomainProxyInterface::r#get_namespace(self, new_handle)
3031    }
3032
3033    pub fn r#close(
3034        &self,
3035        mut handles: &[HandleId],
3036    ) -> fidl::client::QueryResponseFut<
3037        FDomainCloseResult,
3038        fidl::encoding::DefaultFuchsiaResourceDialect,
3039    > {
3040        FDomainProxyInterface::r#close(self, handles)
3041    }
3042
3043    pub fn r#duplicate(
3044        &self,
3045        mut handle: &HandleId,
3046        mut new_handle: &NewHandleId,
3047        mut rights: fidl::Rights,
3048    ) -> fidl::client::QueryResponseFut<
3049        FDomainDuplicateResult,
3050        fidl::encoding::DefaultFuchsiaResourceDialect,
3051    > {
3052        FDomainProxyInterface::r#duplicate(self, handle, new_handle, rights)
3053    }
3054
3055    pub fn r#replace(
3056        &self,
3057        mut handle: &HandleId,
3058        mut new_handle: &NewHandleId,
3059        mut rights: fidl::Rights,
3060    ) -> fidl::client::QueryResponseFut<
3061        FDomainReplaceResult,
3062        fidl::encoding::DefaultFuchsiaResourceDialect,
3063    > {
3064        FDomainProxyInterface::r#replace(self, handle, new_handle, rights)
3065    }
3066
3067    pub fn r#signal(
3068        &self,
3069        mut handle: &HandleId,
3070        mut set: u32,
3071        mut clear: u32,
3072    ) -> fidl::client::QueryResponseFut<
3073        FDomainSignalResult,
3074        fidl::encoding::DefaultFuchsiaResourceDialect,
3075    > {
3076        FDomainProxyInterface::r#signal(self, handle, set, clear)
3077    }
3078
3079    pub fn r#signal_peer(
3080        &self,
3081        mut handle: &HandleId,
3082        mut set: u32,
3083        mut clear: u32,
3084    ) -> fidl::client::QueryResponseFut<
3085        FDomainSignalPeerResult,
3086        fidl::encoding::DefaultFuchsiaResourceDialect,
3087    > {
3088        FDomainProxyInterface::r#signal_peer(self, handle, set, clear)
3089    }
3090
3091    pub fn r#wait_for_signals(
3092        &self,
3093        mut handle: &HandleId,
3094        mut signals: u32,
3095    ) -> fidl::client::QueryResponseFut<
3096        FDomainWaitForSignalsResult,
3097        fidl::encoding::DefaultFuchsiaResourceDialect,
3098    > {
3099        FDomainProxyInterface::r#wait_for_signals(self, handle, signals)
3100    }
3101
3102    pub fn r#get_koid(
3103        &self,
3104        mut handle: &HandleId,
3105    ) -> fidl::client::QueryResponseFut<
3106        FDomainGetKoidResult,
3107        fidl::encoding::DefaultFuchsiaResourceDialect,
3108    > {
3109        FDomainProxyInterface::r#get_koid(self, handle)
3110    }
3111}
3112
3113impl FDomainProxyInterface for FDomainProxy {
3114    type CreateChannelResponseFut = fidl::client::QueryResponseFut<
3115        ChannelCreateChannelResult,
3116        fidl::encoding::DefaultFuchsiaResourceDialect,
3117    >;
3118    fn r#create_channel(&self, mut handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut {
3119        fn _decode(
3120            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3121        ) -> Result<ChannelCreateChannelResult, fidl::Error> {
3122            let _response = fidl::client::decode_transaction_body::<
3123                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3124                fidl::encoding::DefaultFuchsiaResourceDialect,
3125                0x182d38bfe88673b5,
3126            >(_buf?)?
3127            .into_result::<FDomainMarker>("create_channel")?;
3128            Ok(_response.map(|x| x))
3129        }
3130        self.client
3131            .send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
3132                (handles,),
3133                0x182d38bfe88673b5,
3134                fidl::encoding::DynamicFlags::FLEXIBLE,
3135                _decode,
3136            )
3137    }
3138
3139    type ReadChannelResponseFut = fidl::client::QueryResponseFut<
3140        ChannelReadChannelResult,
3141        fidl::encoding::DefaultFuchsiaResourceDialect,
3142    >;
3143    fn r#read_channel(&self, mut handle: &HandleId) -> Self::ReadChannelResponseFut {
3144        fn _decode(
3145            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3146        ) -> Result<ChannelReadChannelResult, fidl::Error> {
3147            let _response = fidl::client::decode_transaction_body::<
3148                fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
3149                fidl::encoding::DefaultFuchsiaResourceDialect,
3150                0x6ef47bf27bf7d050,
3151            >(_buf?)?
3152            .into_result::<FDomainMarker>("read_channel")?;
3153            Ok(_response.map(|x| (x.data, x.handles)))
3154        }
3155        self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
3156            (handle,),
3157            0x6ef47bf27bf7d050,
3158            fidl::encoding::DynamicFlags::FLEXIBLE,
3159            _decode,
3160        )
3161    }
3162
3163    type WriteChannelResponseFut = fidl::client::QueryResponseFut<
3164        ChannelWriteChannelResult,
3165        fidl::encoding::DefaultFuchsiaResourceDialect,
3166    >;
3167    fn r#write_channel(
3168        &self,
3169        mut handle: &HandleId,
3170        mut data: &[u8],
3171        mut handles: &Handles,
3172    ) -> Self::WriteChannelResponseFut {
3173        fn _decode(
3174            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3175        ) -> Result<ChannelWriteChannelResult, fidl::Error> {
3176            let _response = fidl::client::decode_transaction_body::<
3177                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
3178                fidl::encoding::DefaultFuchsiaResourceDialect,
3179                0x75a2559b945d5eb5,
3180            >(_buf?)?
3181            .into_result::<FDomainMarker>("write_channel")?;
3182            Ok(_response.map(|x| x))
3183        }
3184        self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
3185            (handle, data, handles),
3186            0x75a2559b945d5eb5,
3187            fidl::encoding::DynamicFlags::FLEXIBLE,
3188            _decode,
3189        )
3190    }
3191
3192    type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
3193        ChannelReadChannelStreamingStartResult,
3194        fidl::encoding::DefaultFuchsiaResourceDialect,
3195    >;
3196    fn r#read_channel_streaming_start(
3197        &self,
3198        mut handle: &HandleId,
3199    ) -> Self::ReadChannelStreamingStartResponseFut {
3200        fn _decode(
3201            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3202        ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
3203            let _response = fidl::client::decode_transaction_body::<
3204                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3205                fidl::encoding::DefaultFuchsiaResourceDialect,
3206                0x3c73e85476a203df,
3207            >(_buf?)?
3208            .into_result::<FDomainMarker>("read_channel_streaming_start")?;
3209            Ok(_response.map(|x| x))
3210        }
3211        self.client.send_query_and_decode::<
3212            ChannelReadChannelStreamingStartRequest,
3213            ChannelReadChannelStreamingStartResult,
3214        >(
3215            (handle,),
3216            0x3c73e85476a203df,
3217            fidl::encoding::DynamicFlags::FLEXIBLE,
3218            _decode,
3219        )
3220    }
3221
3222    type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
3223        ChannelReadChannelStreamingStopResult,
3224        fidl::encoding::DefaultFuchsiaResourceDialect,
3225    >;
3226    fn r#read_channel_streaming_stop(
3227        &self,
3228        mut handle: &HandleId,
3229    ) -> Self::ReadChannelStreamingStopResponseFut {
3230        fn _decode(
3231            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3232        ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
3233            let _response = fidl::client::decode_transaction_body::<
3234                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3235                fidl::encoding::DefaultFuchsiaResourceDialect,
3236                0x56f21d6ed68186e0,
3237            >(_buf?)?
3238            .into_result::<FDomainMarker>("read_channel_streaming_stop")?;
3239            Ok(_response.map(|x| x))
3240        }
3241        self.client.send_query_and_decode::<
3242            ChannelReadChannelStreamingStopRequest,
3243            ChannelReadChannelStreamingStopResult,
3244        >(
3245            (handle,),
3246            0x56f21d6ed68186e0,
3247            fidl::encoding::DynamicFlags::FLEXIBLE,
3248            _decode,
3249        )
3250    }
3251
3252    type CreateEventResponseFut = fidl::client::QueryResponseFut<
3253        EventCreateEventResult,
3254        fidl::encoding::DefaultFuchsiaResourceDialect,
3255    >;
3256    fn r#create_event(&self, mut handle: &NewHandleId) -> Self::CreateEventResponseFut {
3257        fn _decode(
3258            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3259        ) -> Result<EventCreateEventResult, fidl::Error> {
3260            let _response = fidl::client::decode_transaction_body::<
3261                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3262                fidl::encoding::DefaultFuchsiaResourceDialect,
3263                0x7b05b3f262635987,
3264            >(_buf?)?
3265            .into_result::<FDomainMarker>("create_event")?;
3266            Ok(_response.map(|x| x))
3267        }
3268        self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
3269            (handle,),
3270            0x7b05b3f262635987,
3271            fidl::encoding::DynamicFlags::FLEXIBLE,
3272            _decode,
3273        )
3274    }
3275
3276    type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
3277        EventPairCreateEventPairResult,
3278        fidl::encoding::DefaultFuchsiaResourceDialect,
3279    >;
3280    fn r#create_event_pair(
3281        &self,
3282        mut handles: &[NewHandleId; 2],
3283    ) -> Self::CreateEventPairResponseFut {
3284        fn _decode(
3285            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3286        ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
3287            let _response = fidl::client::decode_transaction_body::<
3288                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3289                fidl::encoding::DefaultFuchsiaResourceDialect,
3290                0x7aef61effa65656d,
3291            >(_buf?)?
3292            .into_result::<FDomainMarker>("create_event_pair")?;
3293            Ok(_response.map(|x| x))
3294        }
3295        self.client.send_query_and_decode::<
3296            EventPairCreateEventPairRequest,
3297            EventPairCreateEventPairResult,
3298        >(
3299            (handles,),
3300            0x7aef61effa65656d,
3301            fidl::encoding::DynamicFlags::FLEXIBLE,
3302            _decode,
3303        )
3304    }
3305
3306    type CreateSocketResponseFut = fidl::client::QueryResponseFut<
3307        SocketCreateSocketResult,
3308        fidl::encoding::DefaultFuchsiaResourceDialect,
3309    >;
3310    fn r#create_socket(
3311        &self,
3312        mut options: SocketType,
3313        mut handles: &[NewHandleId; 2],
3314    ) -> Self::CreateSocketResponseFut {
3315        fn _decode(
3316            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3317        ) -> Result<SocketCreateSocketResult, fidl::Error> {
3318            let _response = fidl::client::decode_transaction_body::<
3319                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3320                fidl::encoding::DefaultFuchsiaResourceDialect,
3321                0x200bf0ea21932de0,
3322            >(_buf?)?
3323            .into_result::<FDomainMarker>("create_socket")?;
3324            Ok(_response.map(|x| x))
3325        }
3326        self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
3327            (options, handles),
3328            0x200bf0ea21932de0,
3329            fidl::encoding::DynamicFlags::FLEXIBLE,
3330            _decode,
3331        )
3332    }
3333
3334    type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
3335        SocketSetSocketDispositionResult,
3336        fidl::encoding::DefaultFuchsiaResourceDialect,
3337    >;
3338    fn r#set_socket_disposition(
3339        &self,
3340        mut handle: &HandleId,
3341        mut disposition: SocketDisposition,
3342        mut disposition_peer: SocketDisposition,
3343    ) -> Self::SetSocketDispositionResponseFut {
3344        fn _decode(
3345            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3346        ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
3347            let _response = fidl::client::decode_transaction_body::<
3348                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3349                fidl::encoding::DefaultFuchsiaResourceDialect,
3350                0x60d3c7ccb17f9bdf,
3351            >(_buf?)?
3352            .into_result::<FDomainMarker>("set_socket_disposition")?;
3353            Ok(_response.map(|x| x))
3354        }
3355        self.client.send_query_and_decode::<
3356            SocketSetSocketDispositionRequest,
3357            SocketSetSocketDispositionResult,
3358        >(
3359            (handle, disposition, disposition_peer,),
3360            0x60d3c7ccb17f9bdf,
3361            fidl::encoding::DynamicFlags::FLEXIBLE,
3362            _decode,
3363        )
3364    }
3365
3366    type ReadSocketResponseFut = fidl::client::QueryResponseFut<
3367        SocketReadSocketResult,
3368        fidl::encoding::DefaultFuchsiaResourceDialect,
3369    >;
3370    fn r#read_socket(
3371        &self,
3372        mut handle: &HandleId,
3373        mut max_bytes: u64,
3374    ) -> Self::ReadSocketResponseFut {
3375        fn _decode(
3376            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3377        ) -> Result<SocketReadSocketResult, fidl::Error> {
3378            let _response = fidl::client::decode_transaction_body::<
3379                fidl::encoding::FlexibleResultType<SocketData, Error>,
3380                fidl::encoding::DefaultFuchsiaResourceDialect,
3381                0x1da8aabec249c02e,
3382            >(_buf?)?
3383            .into_result::<FDomainMarker>("read_socket")?;
3384            Ok(_response.map(|x| (x.data, x.is_datagram)))
3385        }
3386        self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
3387            (handle, max_bytes),
3388            0x1da8aabec249c02e,
3389            fidl::encoding::DynamicFlags::FLEXIBLE,
3390            _decode,
3391        )
3392    }
3393
3394    type WriteSocketResponseFut = fidl::client::QueryResponseFut<
3395        SocketWriteSocketResult,
3396        fidl::encoding::DefaultFuchsiaResourceDialect,
3397    >;
3398    fn r#write_socket(
3399        &self,
3400        mut handle: &HandleId,
3401        mut data: &[u8],
3402    ) -> Self::WriteSocketResponseFut {
3403        fn _decode(
3404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3405        ) -> Result<SocketWriteSocketResult, fidl::Error> {
3406            let _response = fidl::client::decode_transaction_body::<
3407                fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
3408                fidl::encoding::DefaultFuchsiaResourceDialect,
3409                0x5b541623cbbbf683,
3410            >(_buf?)?
3411            .into_result::<FDomainMarker>("write_socket")?;
3412            Ok(_response.map(|x| x.wrote))
3413        }
3414        self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
3415            (handle, data),
3416            0x5b541623cbbbf683,
3417            fidl::encoding::DynamicFlags::FLEXIBLE,
3418            _decode,
3419        )
3420    }
3421
3422    type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
3423        SocketReadSocketStreamingStartResult,
3424        fidl::encoding::DefaultFuchsiaResourceDialect,
3425    >;
3426    fn r#read_socket_streaming_start(
3427        &self,
3428        mut handle: &HandleId,
3429    ) -> Self::ReadSocketStreamingStartResponseFut {
3430        fn _decode(
3431            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3432        ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
3433            let _response = fidl::client::decode_transaction_body::<
3434                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3435                fidl::encoding::DefaultFuchsiaResourceDialect,
3436                0x2a592748d5f33445,
3437            >(_buf?)?
3438            .into_result::<FDomainMarker>("read_socket_streaming_start")?;
3439            Ok(_response.map(|x| x))
3440        }
3441        self.client.send_query_and_decode::<
3442            SocketReadSocketStreamingStartRequest,
3443            SocketReadSocketStreamingStartResult,
3444        >(
3445            (handle,),
3446            0x2a592748d5f33445,
3447            fidl::encoding::DynamicFlags::FLEXIBLE,
3448            _decode,
3449        )
3450    }
3451
3452    type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
3453        SocketReadSocketStreamingStopResult,
3454        fidl::encoding::DefaultFuchsiaResourceDialect,
3455    >;
3456    fn r#read_socket_streaming_stop(
3457        &self,
3458        mut handle: &HandleId,
3459    ) -> Self::ReadSocketStreamingStopResponseFut {
3460        fn _decode(
3461            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3462        ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
3463            let _response = fidl::client::decode_transaction_body::<
3464                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3465                fidl::encoding::DefaultFuchsiaResourceDialect,
3466                0x53e5cade5f4d22e7,
3467            >(_buf?)?
3468            .into_result::<FDomainMarker>("read_socket_streaming_stop")?;
3469            Ok(_response.map(|x| x))
3470        }
3471        self.client.send_query_and_decode::<
3472            SocketReadSocketStreamingStopRequest,
3473            SocketReadSocketStreamingStopResult,
3474        >(
3475            (handle,),
3476            0x53e5cade5f4d22e7,
3477            fidl::encoding::DynamicFlags::FLEXIBLE,
3478            _decode,
3479        )
3480    }
3481
3482    type GetNamespaceResponseFut = fidl::client::QueryResponseFut<
3483        FDomainGetNamespaceResult,
3484        fidl::encoding::DefaultFuchsiaResourceDialect,
3485    >;
3486    fn r#get_namespace(&self, mut new_handle: &NewHandleId) -> Self::GetNamespaceResponseFut {
3487        fn _decode(
3488            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3489        ) -> Result<FDomainGetNamespaceResult, fidl::Error> {
3490            let _response = fidl::client::decode_transaction_body::<
3491                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3492                fidl::encoding::DefaultFuchsiaResourceDialect,
3493                0x74f2e74d9f53e11e,
3494            >(_buf?)?
3495            .into_result::<FDomainMarker>("get_namespace")?;
3496            Ok(_response.map(|x| x))
3497        }
3498        self.client.send_query_and_decode::<FDomainGetNamespaceRequest, FDomainGetNamespaceResult>(
3499            (new_handle,),
3500            0x74f2e74d9f53e11e,
3501            fidl::encoding::DynamicFlags::FLEXIBLE,
3502            _decode,
3503        )
3504    }
3505
3506    type CloseResponseFut = fidl::client::QueryResponseFut<
3507        FDomainCloseResult,
3508        fidl::encoding::DefaultFuchsiaResourceDialect,
3509    >;
3510    fn r#close(&self, mut handles: &[HandleId]) -> Self::CloseResponseFut {
3511        fn _decode(
3512            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3513        ) -> Result<FDomainCloseResult, fidl::Error> {
3514            let _response = fidl::client::decode_transaction_body::<
3515                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3516                fidl::encoding::DefaultFuchsiaResourceDialect,
3517                0x5ef8c24362964257,
3518            >(_buf?)?
3519            .into_result::<FDomainMarker>("close")?;
3520            Ok(_response.map(|x| x))
3521        }
3522        self.client.send_query_and_decode::<FDomainCloseRequest, FDomainCloseResult>(
3523            (handles,),
3524            0x5ef8c24362964257,
3525            fidl::encoding::DynamicFlags::FLEXIBLE,
3526            _decode,
3527        )
3528    }
3529
3530    type DuplicateResponseFut = fidl::client::QueryResponseFut<
3531        FDomainDuplicateResult,
3532        fidl::encoding::DefaultFuchsiaResourceDialect,
3533    >;
3534    fn r#duplicate(
3535        &self,
3536        mut handle: &HandleId,
3537        mut new_handle: &NewHandleId,
3538        mut rights: fidl::Rights,
3539    ) -> Self::DuplicateResponseFut {
3540        fn _decode(
3541            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3542        ) -> Result<FDomainDuplicateResult, fidl::Error> {
3543            let _response = fidl::client::decode_transaction_body::<
3544                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3545                fidl::encoding::DefaultFuchsiaResourceDialect,
3546                0x7a85b94bd1777ab9,
3547            >(_buf?)?
3548            .into_result::<FDomainMarker>("duplicate")?;
3549            Ok(_response.map(|x| x))
3550        }
3551        self.client.send_query_and_decode::<FDomainDuplicateRequest, FDomainDuplicateResult>(
3552            (handle, new_handle, rights),
3553            0x7a85b94bd1777ab9,
3554            fidl::encoding::DynamicFlags::FLEXIBLE,
3555            _decode,
3556        )
3557    }
3558
3559    type ReplaceResponseFut = fidl::client::QueryResponseFut<
3560        FDomainReplaceResult,
3561        fidl::encoding::DefaultFuchsiaResourceDialect,
3562    >;
3563    fn r#replace(
3564        &self,
3565        mut handle: &HandleId,
3566        mut new_handle: &NewHandleId,
3567        mut rights: fidl::Rights,
3568    ) -> Self::ReplaceResponseFut {
3569        fn _decode(
3570            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3571        ) -> Result<FDomainReplaceResult, fidl::Error> {
3572            let _response = fidl::client::decode_transaction_body::<
3573                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3574                fidl::encoding::DefaultFuchsiaResourceDialect,
3575                0x32fa64625a5bd3be,
3576            >(_buf?)?
3577            .into_result::<FDomainMarker>("replace")?;
3578            Ok(_response.map(|x| x))
3579        }
3580        self.client.send_query_and_decode::<FDomainReplaceRequest, FDomainReplaceResult>(
3581            (handle, new_handle, rights),
3582            0x32fa64625a5bd3be,
3583            fidl::encoding::DynamicFlags::FLEXIBLE,
3584            _decode,
3585        )
3586    }
3587
3588    type SignalResponseFut = fidl::client::QueryResponseFut<
3589        FDomainSignalResult,
3590        fidl::encoding::DefaultFuchsiaResourceDialect,
3591    >;
3592    fn r#signal(
3593        &self,
3594        mut handle: &HandleId,
3595        mut set: u32,
3596        mut clear: u32,
3597    ) -> Self::SignalResponseFut {
3598        fn _decode(
3599            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3600        ) -> Result<FDomainSignalResult, fidl::Error> {
3601            let _response = fidl::client::decode_transaction_body::<
3602                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3603                fidl::encoding::DefaultFuchsiaResourceDialect,
3604                0xe8352fb978996d9,
3605            >(_buf?)?
3606            .into_result::<FDomainMarker>("signal")?;
3607            Ok(_response.map(|x| x))
3608        }
3609        self.client.send_query_and_decode::<FDomainSignalRequest, FDomainSignalResult>(
3610            (handle, set, clear),
3611            0xe8352fb978996d9,
3612            fidl::encoding::DynamicFlags::FLEXIBLE,
3613            _decode,
3614        )
3615    }
3616
3617    type SignalPeerResponseFut = fidl::client::QueryResponseFut<
3618        FDomainSignalPeerResult,
3619        fidl::encoding::DefaultFuchsiaResourceDialect,
3620    >;
3621    fn r#signal_peer(
3622        &self,
3623        mut handle: &HandleId,
3624        mut set: u32,
3625        mut clear: u32,
3626    ) -> Self::SignalPeerResponseFut {
3627        fn _decode(
3628            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3629        ) -> Result<FDomainSignalPeerResult, fidl::Error> {
3630            let _response = fidl::client::decode_transaction_body::<
3631                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3632                fidl::encoding::DefaultFuchsiaResourceDialect,
3633                0x7e84ec8ca7eabaf8,
3634            >(_buf?)?
3635            .into_result::<FDomainMarker>("signal_peer")?;
3636            Ok(_response.map(|x| x))
3637        }
3638        self.client.send_query_and_decode::<FDomainSignalPeerRequest, FDomainSignalPeerResult>(
3639            (handle, set, clear),
3640            0x7e84ec8ca7eabaf8,
3641            fidl::encoding::DynamicFlags::FLEXIBLE,
3642            _decode,
3643        )
3644    }
3645
3646    type WaitForSignalsResponseFut = fidl::client::QueryResponseFut<
3647        FDomainWaitForSignalsResult,
3648        fidl::encoding::DefaultFuchsiaResourceDialect,
3649    >;
3650    fn r#wait_for_signals(
3651        &self,
3652        mut handle: &HandleId,
3653        mut signals: u32,
3654    ) -> Self::WaitForSignalsResponseFut {
3655        fn _decode(
3656            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3657        ) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
3658            let _response = fidl::client::decode_transaction_body::<
3659                fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
3660                fidl::encoding::DefaultFuchsiaResourceDialect,
3661                0x8f72d9b4b85c1eb,
3662            >(_buf?)?
3663            .into_result::<FDomainMarker>("wait_for_signals")?;
3664            Ok(_response.map(|x| x.signals))
3665        }
3666        self.client
3667            .send_query_and_decode::<FDomainWaitForSignalsRequest, FDomainWaitForSignalsResult>(
3668                (handle, signals),
3669                0x8f72d9b4b85c1eb,
3670                fidl::encoding::DynamicFlags::FLEXIBLE,
3671                _decode,
3672            )
3673    }
3674
3675    type GetKoidResponseFut = fidl::client::QueryResponseFut<
3676        FDomainGetKoidResult,
3677        fidl::encoding::DefaultFuchsiaResourceDialect,
3678    >;
3679    fn r#get_koid(&self, mut handle: &HandleId) -> Self::GetKoidResponseFut {
3680        fn _decode(
3681            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3682        ) -> Result<FDomainGetKoidResult, fidl::Error> {
3683            let _response = fidl::client::decode_transaction_body::<
3684                fidl::encoding::FlexibleResultType<FDomainGetKoidResponse, Error>,
3685                fidl::encoding::DefaultFuchsiaResourceDialect,
3686                0x437db979a63402c3,
3687            >(_buf?)?
3688            .into_result::<FDomainMarker>("get_koid")?;
3689            Ok(_response.map(|x| x.koid))
3690        }
3691        self.client.send_query_and_decode::<FDomainGetKoidRequest, FDomainGetKoidResult>(
3692            (handle,),
3693            0x437db979a63402c3,
3694            fidl::encoding::DynamicFlags::FLEXIBLE,
3695            _decode,
3696        )
3697    }
3698}
3699
3700pub struct FDomainEventStream {
3701    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3702}
3703
3704impl std::marker::Unpin for FDomainEventStream {}
3705
3706impl futures::stream::FusedStream for FDomainEventStream {
3707    fn is_terminated(&self) -> bool {
3708        self.event_receiver.is_terminated()
3709    }
3710}
3711
3712impl futures::Stream for FDomainEventStream {
3713    type Item = Result<FDomainEvent, fidl::Error>;
3714
3715    fn poll_next(
3716        mut self: std::pin::Pin<&mut Self>,
3717        cx: &mut std::task::Context<'_>,
3718    ) -> std::task::Poll<Option<Self::Item>> {
3719        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3720            &mut self.event_receiver,
3721            cx
3722        )?) {
3723            Some(buf) => std::task::Poll::Ready(Some(FDomainEvent::decode(buf))),
3724            None => std::task::Poll::Ready(None),
3725        }
3726    }
3727}
3728
3729#[derive(Debug)]
3730pub enum FDomainEvent {
3731    OnChannelStreamingData {
3732        handle: HandleId,
3733        channel_sent: ChannelSent,
3734    },
3735    OnSocketStreamingData {
3736        handle: HandleId,
3737        socket_message: SocketMessage,
3738    },
3739    #[non_exhaustive]
3740    _UnknownEvent {
3741        /// Ordinal of the event that was sent.
3742        ordinal: u64,
3743    },
3744}
3745
3746impl FDomainEvent {
3747    #[allow(irrefutable_let_patterns)]
3748    pub fn into_on_channel_streaming_data(self) -> Option<(HandleId, ChannelSent)> {
3749        if let FDomainEvent::OnChannelStreamingData { handle, channel_sent } = self {
3750            Some((handle, channel_sent))
3751        } else {
3752            None
3753        }
3754    }
3755    #[allow(irrefutable_let_patterns)]
3756    pub fn into_on_socket_streaming_data(self) -> Option<(HandleId, SocketMessage)> {
3757        if let FDomainEvent::OnSocketStreamingData { handle, socket_message } = self {
3758            Some((handle, socket_message))
3759        } else {
3760            None
3761        }
3762    }
3763
3764    /// Decodes a message buffer as a [`FDomainEvent`].
3765    fn decode(
3766        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3767    ) -> Result<FDomainEvent, fidl::Error> {
3768        let (bytes, _handles) = buf.split_mut();
3769        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3770        debug_assert_eq!(tx_header.tx_id, 0);
3771        match tx_header.ordinal {
3772            0x7d4431805202dfe1 => {
3773                let mut out = fidl::new_empty!(
3774                    ChannelOnChannelStreamingDataRequest,
3775                    fidl::encoding::DefaultFuchsiaResourceDialect
3776                );
3777                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3778                Ok((FDomainEvent::OnChannelStreamingData {
3779                    handle: out.handle,
3780                    channel_sent: out.channel_sent,
3781                }))
3782            }
3783            0x998b5e66b3c80a2 => {
3784                let mut out = fidl::new_empty!(
3785                    SocketOnSocketStreamingDataRequest,
3786                    fidl::encoding::DefaultFuchsiaResourceDialect
3787                );
3788                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3789                Ok((FDomainEvent::OnSocketStreamingData {
3790                    handle: out.handle,
3791                    socket_message: out.socket_message,
3792                }))
3793            }
3794            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3795                Ok(FDomainEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3796            }
3797            _ => Err(fidl::Error::UnknownOrdinal {
3798                ordinal: tx_header.ordinal,
3799                protocol_name: <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3800            }),
3801        }
3802    }
3803}
3804
3805/// A Stream of incoming requests for fuchsia.fdomain/FDomain.
3806pub struct FDomainRequestStream {
3807    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3808    is_terminated: bool,
3809}
3810
3811impl std::marker::Unpin for FDomainRequestStream {}
3812
3813impl futures::stream::FusedStream for FDomainRequestStream {
3814    fn is_terminated(&self) -> bool {
3815        self.is_terminated
3816    }
3817}
3818
3819impl fidl::endpoints::RequestStream for FDomainRequestStream {
3820    type Protocol = FDomainMarker;
3821    type ControlHandle = FDomainControlHandle;
3822
3823    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3824        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3825    }
3826
3827    fn control_handle(&self) -> Self::ControlHandle {
3828        FDomainControlHandle { inner: self.inner.clone() }
3829    }
3830
3831    fn into_inner(
3832        self,
3833    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3834    {
3835        (self.inner, self.is_terminated)
3836    }
3837
3838    fn from_inner(
3839        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3840        is_terminated: bool,
3841    ) -> Self {
3842        Self { inner, is_terminated }
3843    }
3844}
3845
3846impl futures::Stream for FDomainRequestStream {
3847    type Item = Result<FDomainRequest, fidl::Error>;
3848
3849    fn poll_next(
3850        mut self: std::pin::Pin<&mut Self>,
3851        cx: &mut std::task::Context<'_>,
3852    ) -> std::task::Poll<Option<Self::Item>> {
3853        let this = &mut *self;
3854        if this.inner.check_shutdown(cx) {
3855            this.is_terminated = true;
3856            return std::task::Poll::Ready(None);
3857        }
3858        if this.is_terminated {
3859            panic!("polled FDomainRequestStream after completion");
3860        }
3861        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3862            |bytes, handles| {
3863                match this.inner.channel().read_etc(cx, bytes, handles) {
3864                    std::task::Poll::Ready(Ok(())) => {}
3865                    std::task::Poll::Pending => return std::task::Poll::Pending,
3866                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3867                        this.is_terminated = true;
3868                        return std::task::Poll::Ready(None);
3869                    }
3870                    std::task::Poll::Ready(Err(e)) => {
3871                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3872                            e.into(),
3873                        ))));
3874                    }
3875                }
3876
3877                // A message has been received from the channel
3878                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3879
3880                std::task::Poll::Ready(Some(match header.ordinal {
3881                    0x182d38bfe88673b5 => {
3882                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3883                        let mut req = fidl::new_empty!(
3884                            ChannelCreateChannelRequest,
3885                            fidl::encoding::DefaultFuchsiaResourceDialect
3886                        );
3887                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
3888                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3889                        Ok(FDomainRequest::CreateChannel {
3890                            handles: req.handles,
3891
3892                            responder: FDomainCreateChannelResponder {
3893                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3894                                tx_id: header.tx_id,
3895                            },
3896                        })
3897                    }
3898                    0x6ef47bf27bf7d050 => {
3899                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3900                        let mut req = fidl::new_empty!(
3901                            ChannelReadChannelRequest,
3902                            fidl::encoding::DefaultFuchsiaResourceDialect
3903                        );
3904                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
3905                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3906                        Ok(FDomainRequest::ReadChannel {
3907                            handle: req.handle,
3908
3909                            responder: FDomainReadChannelResponder {
3910                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3911                                tx_id: header.tx_id,
3912                            },
3913                        })
3914                    }
3915                    0x75a2559b945d5eb5 => {
3916                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3917                        let mut req = fidl::new_empty!(
3918                            ChannelWriteChannelRequest,
3919                            fidl::encoding::DefaultFuchsiaResourceDialect
3920                        );
3921                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
3922                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3923                        Ok(FDomainRequest::WriteChannel {
3924                            handle: req.handle,
3925                            data: req.data,
3926                            handles: req.handles,
3927
3928                            responder: FDomainWriteChannelResponder {
3929                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3930                                tx_id: header.tx_id,
3931                            },
3932                        })
3933                    }
3934                    0x3c73e85476a203df => {
3935                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3936                        let mut req = fidl::new_empty!(
3937                            ChannelReadChannelStreamingStartRequest,
3938                            fidl::encoding::DefaultFuchsiaResourceDialect
3939                        );
3940                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
3941                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3942                        Ok(FDomainRequest::ReadChannelStreamingStart {
3943                            handle: req.handle,
3944
3945                            responder: FDomainReadChannelStreamingStartResponder {
3946                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3947                                tx_id: header.tx_id,
3948                            },
3949                        })
3950                    }
3951                    0x56f21d6ed68186e0 => {
3952                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3953                        let mut req = fidl::new_empty!(
3954                            ChannelReadChannelStreamingStopRequest,
3955                            fidl::encoding::DefaultFuchsiaResourceDialect
3956                        );
3957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
3958                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3959                        Ok(FDomainRequest::ReadChannelStreamingStop {
3960                            handle: req.handle,
3961
3962                            responder: FDomainReadChannelStreamingStopResponder {
3963                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3964                                tx_id: header.tx_id,
3965                            },
3966                        })
3967                    }
3968                    0x7b05b3f262635987 => {
3969                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3970                        let mut req = fidl::new_empty!(
3971                            EventCreateEventRequest,
3972                            fidl::encoding::DefaultFuchsiaResourceDialect
3973                        );
3974                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
3975                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3976                        Ok(FDomainRequest::CreateEvent {
3977                            handle: req.handle,
3978
3979                            responder: FDomainCreateEventResponder {
3980                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3981                                tx_id: header.tx_id,
3982                            },
3983                        })
3984                    }
3985                    0x7aef61effa65656d => {
3986                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3987                        let mut req = fidl::new_empty!(
3988                            EventPairCreateEventPairRequest,
3989                            fidl::encoding::DefaultFuchsiaResourceDialect
3990                        );
3991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
3992                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
3993                        Ok(FDomainRequest::CreateEventPair {
3994                            handles: req.handles,
3995
3996                            responder: FDomainCreateEventPairResponder {
3997                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3998                                tx_id: header.tx_id,
3999                            },
4000                        })
4001                    }
4002                    0x200bf0ea21932de0 => {
4003                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4004                        let mut req = fidl::new_empty!(
4005                            SocketCreateSocketRequest,
4006                            fidl::encoding::DefaultFuchsiaResourceDialect
4007                        );
4008                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
4009                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4010                        Ok(FDomainRequest::CreateSocket {
4011                            options: req.options,
4012                            handles: req.handles,
4013
4014                            responder: FDomainCreateSocketResponder {
4015                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4016                                tx_id: header.tx_id,
4017                            },
4018                        })
4019                    }
4020                    0x60d3c7ccb17f9bdf => {
4021                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4022                        let mut req = fidl::new_empty!(
4023                            SocketSetSocketDispositionRequest,
4024                            fidl::encoding::DefaultFuchsiaResourceDialect
4025                        );
4026                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
4027                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4028                        Ok(FDomainRequest::SetSocketDisposition {
4029                            handle: req.handle,
4030                            disposition: req.disposition,
4031                            disposition_peer: req.disposition_peer,
4032
4033                            responder: FDomainSetSocketDispositionResponder {
4034                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4035                                tx_id: header.tx_id,
4036                            },
4037                        })
4038                    }
4039                    0x1da8aabec249c02e => {
4040                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4041                        let mut req = fidl::new_empty!(
4042                            SocketReadSocketRequest,
4043                            fidl::encoding::DefaultFuchsiaResourceDialect
4044                        );
4045                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
4046                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4047                        Ok(FDomainRequest::ReadSocket {
4048                            handle: req.handle,
4049                            max_bytes: req.max_bytes,
4050
4051                            responder: FDomainReadSocketResponder {
4052                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4053                                tx_id: header.tx_id,
4054                            },
4055                        })
4056                    }
4057                    0x5b541623cbbbf683 => {
4058                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4059                        let mut req = fidl::new_empty!(
4060                            SocketWriteSocketRequest,
4061                            fidl::encoding::DefaultFuchsiaResourceDialect
4062                        );
4063                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
4064                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4065                        Ok(FDomainRequest::WriteSocket {
4066                            handle: req.handle,
4067                            data: req.data,
4068
4069                            responder: FDomainWriteSocketResponder {
4070                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4071                                tx_id: header.tx_id,
4072                            },
4073                        })
4074                    }
4075                    0x2a592748d5f33445 => {
4076                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4077                        let mut req = fidl::new_empty!(
4078                            SocketReadSocketStreamingStartRequest,
4079                            fidl::encoding::DefaultFuchsiaResourceDialect
4080                        );
4081                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
4082                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4083                        Ok(FDomainRequest::ReadSocketStreamingStart {
4084                            handle: req.handle,
4085
4086                            responder: FDomainReadSocketStreamingStartResponder {
4087                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4088                                tx_id: header.tx_id,
4089                            },
4090                        })
4091                    }
4092                    0x53e5cade5f4d22e7 => {
4093                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4094                        let mut req = fidl::new_empty!(
4095                            SocketReadSocketStreamingStopRequest,
4096                            fidl::encoding::DefaultFuchsiaResourceDialect
4097                        );
4098                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
4099                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4100                        Ok(FDomainRequest::ReadSocketStreamingStop {
4101                            handle: req.handle,
4102
4103                            responder: FDomainReadSocketStreamingStopResponder {
4104                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4105                                tx_id: header.tx_id,
4106                            },
4107                        })
4108                    }
4109                    0x74f2e74d9f53e11e => {
4110                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4111                        let mut req = fidl::new_empty!(
4112                            FDomainGetNamespaceRequest,
4113                            fidl::encoding::DefaultFuchsiaResourceDialect
4114                        );
4115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainGetNamespaceRequest>(&header, _body_bytes, handles, &mut req)?;
4116                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4117                        Ok(FDomainRequest::GetNamespace {
4118                            new_handle: req.new_handle,
4119
4120                            responder: FDomainGetNamespaceResponder {
4121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4122                                tx_id: header.tx_id,
4123                            },
4124                        })
4125                    }
4126                    0x5ef8c24362964257 => {
4127                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4128                        let mut req = fidl::new_empty!(
4129                            FDomainCloseRequest,
4130                            fidl::encoding::DefaultFuchsiaResourceDialect
4131                        );
4132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainCloseRequest>(&header, _body_bytes, handles, &mut req)?;
4133                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4134                        Ok(FDomainRequest::Close {
4135                            handles: req.handles,
4136
4137                            responder: FDomainCloseResponder {
4138                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4139                                tx_id: header.tx_id,
4140                            },
4141                        })
4142                    }
4143                    0x7a85b94bd1777ab9 => {
4144                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4145                        let mut req = fidl::new_empty!(
4146                            FDomainDuplicateRequest,
4147                            fidl::encoding::DefaultFuchsiaResourceDialect
4148                        );
4149                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainDuplicateRequest>(&header, _body_bytes, handles, &mut req)?;
4150                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4151                        Ok(FDomainRequest::Duplicate {
4152                            handle: req.handle,
4153                            new_handle: req.new_handle,
4154                            rights: req.rights,
4155
4156                            responder: FDomainDuplicateResponder {
4157                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4158                                tx_id: header.tx_id,
4159                            },
4160                        })
4161                    }
4162                    0x32fa64625a5bd3be => {
4163                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4164                        let mut req = fidl::new_empty!(
4165                            FDomainReplaceRequest,
4166                            fidl::encoding::DefaultFuchsiaResourceDialect
4167                        );
4168                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
4169                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4170                        Ok(FDomainRequest::Replace {
4171                            handle: req.handle,
4172                            new_handle: req.new_handle,
4173                            rights: req.rights,
4174
4175                            responder: FDomainReplaceResponder {
4176                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4177                                tx_id: header.tx_id,
4178                            },
4179                        })
4180                    }
4181                    0xe8352fb978996d9 => {
4182                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4183                        let mut req = fidl::new_empty!(
4184                            FDomainSignalRequest,
4185                            fidl::encoding::DefaultFuchsiaResourceDialect
4186                        );
4187                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalRequest>(&header, _body_bytes, handles, &mut req)?;
4188                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4189                        Ok(FDomainRequest::Signal {
4190                            handle: req.handle,
4191                            set: req.set,
4192                            clear: req.clear,
4193
4194                            responder: FDomainSignalResponder {
4195                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4196                                tx_id: header.tx_id,
4197                            },
4198                        })
4199                    }
4200                    0x7e84ec8ca7eabaf8 => {
4201                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4202                        let mut req = fidl::new_empty!(
4203                            FDomainSignalPeerRequest,
4204                            fidl::encoding::DefaultFuchsiaResourceDialect
4205                        );
4206                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalPeerRequest>(&header, _body_bytes, handles, &mut req)?;
4207                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4208                        Ok(FDomainRequest::SignalPeer {
4209                            handle: req.handle,
4210                            set: req.set,
4211                            clear: req.clear,
4212
4213                            responder: FDomainSignalPeerResponder {
4214                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4215                                tx_id: header.tx_id,
4216                            },
4217                        })
4218                    }
4219                    0x8f72d9b4b85c1eb => {
4220                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4221                        let mut req = fidl::new_empty!(
4222                            FDomainWaitForSignalsRequest,
4223                            fidl::encoding::DefaultFuchsiaResourceDialect
4224                        );
4225                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainWaitForSignalsRequest>(&header, _body_bytes, handles, &mut req)?;
4226                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4227                        Ok(FDomainRequest::WaitForSignals {
4228                            handle: req.handle,
4229                            signals: req.signals,
4230
4231                            responder: FDomainWaitForSignalsResponder {
4232                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4233                                tx_id: header.tx_id,
4234                            },
4235                        })
4236                    }
4237                    0x437db979a63402c3 => {
4238                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4239                        let mut req = fidl::new_empty!(
4240                            FDomainGetKoidRequest,
4241                            fidl::encoding::DefaultFuchsiaResourceDialect
4242                        );
4243                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainGetKoidRequest>(&header, _body_bytes, handles, &mut req)?;
4244                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4245                        Ok(FDomainRequest::GetKoid {
4246                            handle: req.handle,
4247
4248                            responder: FDomainGetKoidResponder {
4249                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4250                                tx_id: header.tx_id,
4251                            },
4252                        })
4253                    }
4254                    _ if header.tx_id == 0
4255                        && header
4256                            .dynamic_flags()
4257                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4258                    {
4259                        Ok(FDomainRequest::_UnknownMethod {
4260                            ordinal: header.ordinal,
4261                            control_handle: FDomainControlHandle { inner: this.inner.clone() },
4262                            method_type: fidl::MethodType::OneWay,
4263                        })
4264                    }
4265                    _ if header
4266                        .dynamic_flags()
4267                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4268                    {
4269                        this.inner.send_framework_err(
4270                            fidl::encoding::FrameworkErr::UnknownMethod,
4271                            header.tx_id,
4272                            header.ordinal,
4273                            header.dynamic_flags(),
4274                            (bytes, handles),
4275                        )?;
4276                        Ok(FDomainRequest::_UnknownMethod {
4277                            ordinal: header.ordinal,
4278                            control_handle: FDomainControlHandle { inner: this.inner.clone() },
4279                            method_type: fidl::MethodType::TwoWay,
4280                        })
4281                    }
4282                    _ => Err(fidl::Error::UnknownOrdinal {
4283                        ordinal: header.ordinal,
4284                        protocol_name:
4285                            <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4286                    }),
4287                }))
4288            },
4289        )
4290    }
4291}
4292
4293#[derive(Debug)]
4294pub enum FDomainRequest {
4295    CreateChannel {
4296        handles: [NewHandleId; 2],
4297        responder: FDomainCreateChannelResponder,
4298    },
4299    ReadChannel {
4300        handle: HandleId,
4301        responder: FDomainReadChannelResponder,
4302    },
4303    WriteChannel {
4304        handle: HandleId,
4305        data: Vec<u8>,
4306        handles: Handles,
4307        responder: FDomainWriteChannelResponder,
4308    },
4309    ReadChannelStreamingStart {
4310        handle: HandleId,
4311        responder: FDomainReadChannelStreamingStartResponder,
4312    },
4313    ReadChannelStreamingStop {
4314        handle: HandleId,
4315        responder: FDomainReadChannelStreamingStopResponder,
4316    },
4317    CreateEvent {
4318        handle: NewHandleId,
4319        responder: FDomainCreateEventResponder,
4320    },
4321    CreateEventPair {
4322        handles: [NewHandleId; 2],
4323        responder: FDomainCreateEventPairResponder,
4324    },
4325    CreateSocket {
4326        options: SocketType,
4327        handles: [NewHandleId; 2],
4328        responder: FDomainCreateSocketResponder,
4329    },
4330    SetSocketDisposition {
4331        handle: HandleId,
4332        disposition: SocketDisposition,
4333        disposition_peer: SocketDisposition,
4334        responder: FDomainSetSocketDispositionResponder,
4335    },
4336    ReadSocket {
4337        handle: HandleId,
4338        max_bytes: u64,
4339        responder: FDomainReadSocketResponder,
4340    },
4341    WriteSocket {
4342        handle: HandleId,
4343        data: Vec<u8>,
4344        responder: FDomainWriteSocketResponder,
4345    },
4346    ReadSocketStreamingStart {
4347        handle: HandleId,
4348        responder: FDomainReadSocketStreamingStartResponder,
4349    },
4350    ReadSocketStreamingStop {
4351        handle: HandleId,
4352        responder: FDomainReadSocketStreamingStopResponder,
4353    },
4354    GetNamespace {
4355        new_handle: NewHandleId,
4356        responder: FDomainGetNamespaceResponder,
4357    },
4358    Close {
4359        handles: Vec<HandleId>,
4360        responder: FDomainCloseResponder,
4361    },
4362    Duplicate {
4363        handle: HandleId,
4364        new_handle: NewHandleId,
4365        rights: fidl::Rights,
4366        responder: FDomainDuplicateResponder,
4367    },
4368    Replace {
4369        handle: HandleId,
4370        new_handle: NewHandleId,
4371        rights: fidl::Rights,
4372        responder: FDomainReplaceResponder,
4373    },
4374    Signal {
4375        handle: HandleId,
4376        set: u32,
4377        clear: u32,
4378        responder: FDomainSignalResponder,
4379    },
4380    SignalPeer {
4381        handle: HandleId,
4382        set: u32,
4383        clear: u32,
4384        responder: FDomainSignalPeerResponder,
4385    },
4386    WaitForSignals {
4387        handle: HandleId,
4388        signals: u32,
4389        responder: FDomainWaitForSignalsResponder,
4390    },
4391    GetKoid {
4392        handle: HandleId,
4393        responder: FDomainGetKoidResponder,
4394    },
4395    /// An interaction was received which does not match any known method.
4396    #[non_exhaustive]
4397    _UnknownMethod {
4398        /// Ordinal of the method that was called.
4399        ordinal: u64,
4400        control_handle: FDomainControlHandle,
4401        method_type: fidl::MethodType,
4402    },
4403}
4404
4405impl FDomainRequest {
4406    #[allow(irrefutable_let_patterns)]
4407    pub fn into_create_channel(self) -> Option<([NewHandleId; 2], FDomainCreateChannelResponder)> {
4408        if let FDomainRequest::CreateChannel { handles, responder } = self {
4409            Some((handles, responder))
4410        } else {
4411            None
4412        }
4413    }
4414
4415    #[allow(irrefutable_let_patterns)]
4416    pub fn into_read_channel(self) -> Option<(HandleId, FDomainReadChannelResponder)> {
4417        if let FDomainRequest::ReadChannel { handle, responder } = self {
4418            Some((handle, responder))
4419        } else {
4420            None
4421        }
4422    }
4423
4424    #[allow(irrefutable_let_patterns)]
4425    pub fn into_write_channel(
4426        self,
4427    ) -> Option<(HandleId, Vec<u8>, Handles, FDomainWriteChannelResponder)> {
4428        if let FDomainRequest::WriteChannel { handle, data, handles, responder } = self {
4429            Some((handle, data, handles, responder))
4430        } else {
4431            None
4432        }
4433    }
4434
4435    #[allow(irrefutable_let_patterns)]
4436    pub fn into_read_channel_streaming_start(
4437        self,
4438    ) -> Option<(HandleId, FDomainReadChannelStreamingStartResponder)> {
4439        if let FDomainRequest::ReadChannelStreamingStart { handle, responder } = self {
4440            Some((handle, responder))
4441        } else {
4442            None
4443        }
4444    }
4445
4446    #[allow(irrefutable_let_patterns)]
4447    pub fn into_read_channel_streaming_stop(
4448        self,
4449    ) -> Option<(HandleId, FDomainReadChannelStreamingStopResponder)> {
4450        if let FDomainRequest::ReadChannelStreamingStop { handle, responder } = self {
4451            Some((handle, responder))
4452        } else {
4453            None
4454        }
4455    }
4456
4457    #[allow(irrefutable_let_patterns)]
4458    pub fn into_create_event(self) -> Option<(NewHandleId, FDomainCreateEventResponder)> {
4459        if let FDomainRequest::CreateEvent { handle, responder } = self {
4460            Some((handle, responder))
4461        } else {
4462            None
4463        }
4464    }
4465
4466    #[allow(irrefutable_let_patterns)]
4467    pub fn into_create_event_pair(
4468        self,
4469    ) -> Option<([NewHandleId; 2], FDomainCreateEventPairResponder)> {
4470        if let FDomainRequest::CreateEventPair { handles, responder } = self {
4471            Some((handles, responder))
4472        } else {
4473            None
4474        }
4475    }
4476
4477    #[allow(irrefutable_let_patterns)]
4478    pub fn into_create_socket(
4479        self,
4480    ) -> Option<(SocketType, [NewHandleId; 2], FDomainCreateSocketResponder)> {
4481        if let FDomainRequest::CreateSocket { options, handles, responder } = self {
4482            Some((options, handles, responder))
4483        } else {
4484            None
4485        }
4486    }
4487
4488    #[allow(irrefutable_let_patterns)]
4489    pub fn into_set_socket_disposition(
4490        self,
4491    ) -> Option<(
4492        HandleId,
4493        SocketDisposition,
4494        SocketDisposition,
4495        FDomainSetSocketDispositionResponder,
4496    )> {
4497        if let FDomainRequest::SetSocketDisposition {
4498            handle,
4499            disposition,
4500            disposition_peer,
4501            responder,
4502        } = self
4503        {
4504            Some((handle, disposition, disposition_peer, responder))
4505        } else {
4506            None
4507        }
4508    }
4509
4510    #[allow(irrefutable_let_patterns)]
4511    pub fn into_read_socket(self) -> Option<(HandleId, u64, FDomainReadSocketResponder)> {
4512        if let FDomainRequest::ReadSocket { handle, max_bytes, responder } = self {
4513            Some((handle, max_bytes, responder))
4514        } else {
4515            None
4516        }
4517    }
4518
4519    #[allow(irrefutable_let_patterns)]
4520    pub fn into_write_socket(self) -> Option<(HandleId, Vec<u8>, FDomainWriteSocketResponder)> {
4521        if let FDomainRequest::WriteSocket { handle, data, responder } = self {
4522            Some((handle, data, responder))
4523        } else {
4524            None
4525        }
4526    }
4527
4528    #[allow(irrefutable_let_patterns)]
4529    pub fn into_read_socket_streaming_start(
4530        self,
4531    ) -> Option<(HandleId, FDomainReadSocketStreamingStartResponder)> {
4532        if let FDomainRequest::ReadSocketStreamingStart { handle, responder } = self {
4533            Some((handle, responder))
4534        } else {
4535            None
4536        }
4537    }
4538
4539    #[allow(irrefutable_let_patterns)]
4540    pub fn into_read_socket_streaming_stop(
4541        self,
4542    ) -> Option<(HandleId, FDomainReadSocketStreamingStopResponder)> {
4543        if let FDomainRequest::ReadSocketStreamingStop { handle, responder } = self {
4544            Some((handle, responder))
4545        } else {
4546            None
4547        }
4548    }
4549
4550    #[allow(irrefutable_let_patterns)]
4551    pub fn into_get_namespace(self) -> Option<(NewHandleId, FDomainGetNamespaceResponder)> {
4552        if let FDomainRequest::GetNamespace { new_handle, responder } = self {
4553            Some((new_handle, responder))
4554        } else {
4555            None
4556        }
4557    }
4558
4559    #[allow(irrefutable_let_patterns)]
4560    pub fn into_close(self) -> Option<(Vec<HandleId>, FDomainCloseResponder)> {
4561        if let FDomainRequest::Close { handles, responder } = self {
4562            Some((handles, responder))
4563        } else {
4564            None
4565        }
4566    }
4567
4568    #[allow(irrefutable_let_patterns)]
4569    pub fn into_duplicate(
4570        self,
4571    ) -> Option<(HandleId, NewHandleId, fidl::Rights, FDomainDuplicateResponder)> {
4572        if let FDomainRequest::Duplicate { handle, new_handle, rights, responder } = self {
4573            Some((handle, new_handle, rights, responder))
4574        } else {
4575            None
4576        }
4577    }
4578
4579    #[allow(irrefutable_let_patterns)]
4580    pub fn into_replace(
4581        self,
4582    ) -> Option<(HandleId, NewHandleId, fidl::Rights, FDomainReplaceResponder)> {
4583        if let FDomainRequest::Replace { handle, new_handle, rights, responder } = self {
4584            Some((handle, new_handle, rights, responder))
4585        } else {
4586            None
4587        }
4588    }
4589
4590    #[allow(irrefutable_let_patterns)]
4591    pub fn into_signal(self) -> Option<(HandleId, u32, u32, FDomainSignalResponder)> {
4592        if let FDomainRequest::Signal { handle, set, clear, responder } = self {
4593            Some((handle, set, clear, responder))
4594        } else {
4595            None
4596        }
4597    }
4598
4599    #[allow(irrefutable_let_patterns)]
4600    pub fn into_signal_peer(self) -> Option<(HandleId, u32, u32, FDomainSignalPeerResponder)> {
4601        if let FDomainRequest::SignalPeer { handle, set, clear, responder } = self {
4602            Some((handle, set, clear, responder))
4603        } else {
4604            None
4605        }
4606    }
4607
4608    #[allow(irrefutable_let_patterns)]
4609    pub fn into_wait_for_signals(self) -> Option<(HandleId, u32, FDomainWaitForSignalsResponder)> {
4610        if let FDomainRequest::WaitForSignals { handle, signals, responder } = self {
4611            Some((handle, signals, responder))
4612        } else {
4613            None
4614        }
4615    }
4616
4617    #[allow(irrefutable_let_patterns)]
4618    pub fn into_get_koid(self) -> Option<(HandleId, FDomainGetKoidResponder)> {
4619        if let FDomainRequest::GetKoid { handle, responder } = self {
4620            Some((handle, responder))
4621        } else {
4622            None
4623        }
4624    }
4625
4626    /// Name of the method defined in FIDL
4627    pub fn method_name(&self) -> &'static str {
4628        match *self {
4629            FDomainRequest::CreateChannel { .. } => "create_channel",
4630            FDomainRequest::ReadChannel { .. } => "read_channel",
4631            FDomainRequest::WriteChannel { .. } => "write_channel",
4632            FDomainRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
4633            FDomainRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
4634            FDomainRequest::CreateEvent { .. } => "create_event",
4635            FDomainRequest::CreateEventPair { .. } => "create_event_pair",
4636            FDomainRequest::CreateSocket { .. } => "create_socket",
4637            FDomainRequest::SetSocketDisposition { .. } => "set_socket_disposition",
4638            FDomainRequest::ReadSocket { .. } => "read_socket",
4639            FDomainRequest::WriteSocket { .. } => "write_socket",
4640            FDomainRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
4641            FDomainRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
4642            FDomainRequest::GetNamespace { .. } => "get_namespace",
4643            FDomainRequest::Close { .. } => "close",
4644            FDomainRequest::Duplicate { .. } => "duplicate",
4645            FDomainRequest::Replace { .. } => "replace",
4646            FDomainRequest::Signal { .. } => "signal",
4647            FDomainRequest::SignalPeer { .. } => "signal_peer",
4648            FDomainRequest::WaitForSignals { .. } => "wait_for_signals",
4649            FDomainRequest::GetKoid { .. } => "get_koid",
4650            FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4651                "unknown one-way method"
4652            }
4653            FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4654                "unknown two-way method"
4655            }
4656        }
4657    }
4658}
4659
4660#[derive(Debug, Clone)]
4661pub struct FDomainControlHandle {
4662    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4663}
4664
4665impl fidl::endpoints::ControlHandle for FDomainControlHandle {
4666    fn shutdown(&self) {
4667        self.inner.shutdown()
4668    }
4669    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4670        self.inner.shutdown_with_epitaph(status)
4671    }
4672
4673    fn is_closed(&self) -> bool {
4674        self.inner.channel().is_closed()
4675    }
4676    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4677        self.inner.channel().on_closed()
4678    }
4679
4680    #[cfg(target_os = "fuchsia")]
4681    fn signal_peer(
4682        &self,
4683        clear_mask: zx::Signals,
4684        set_mask: zx::Signals,
4685    ) -> Result<(), zx_status::Status> {
4686        use fidl::Peered;
4687        self.inner.channel().signal_peer(clear_mask, set_mask)
4688    }
4689}
4690
4691impl FDomainControlHandle {
4692    pub fn send_on_channel_streaming_data(
4693        &self,
4694        mut handle: &HandleId,
4695        mut channel_sent: &ChannelSent,
4696    ) -> Result<(), fidl::Error> {
4697        self.inner.send::<ChannelOnChannelStreamingDataRequest>(
4698            (handle, channel_sent),
4699            0,
4700            0x7d4431805202dfe1,
4701            fidl::encoding::DynamicFlags::FLEXIBLE,
4702        )
4703    }
4704
4705    pub fn send_on_socket_streaming_data(
4706        &self,
4707        mut handle: &HandleId,
4708        mut socket_message: &SocketMessage,
4709    ) -> Result<(), fidl::Error> {
4710        self.inner.send::<SocketOnSocketStreamingDataRequest>(
4711            (handle, socket_message),
4712            0,
4713            0x998b5e66b3c80a2,
4714            fidl::encoding::DynamicFlags::FLEXIBLE,
4715        )
4716    }
4717}
4718
4719#[must_use = "FIDL methods require a response to be sent"]
4720#[derive(Debug)]
4721pub struct FDomainCreateChannelResponder {
4722    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4723    tx_id: u32,
4724}
4725
4726/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4727/// if the responder is dropped without sending a response, so that the client
4728/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4729impl std::ops::Drop for FDomainCreateChannelResponder {
4730    fn drop(&mut self) {
4731        self.control_handle.shutdown();
4732        // Safety: drops once, never accessed again
4733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4734    }
4735}
4736
4737impl fidl::endpoints::Responder for FDomainCreateChannelResponder {
4738    type ControlHandle = FDomainControlHandle;
4739
4740    fn control_handle(&self) -> &FDomainControlHandle {
4741        &self.control_handle
4742    }
4743
4744    fn drop_without_shutdown(mut self) {
4745        // Safety: drops once, never accessed again due to mem::forget
4746        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4747        // Prevent Drop from running (which would shut down the channel)
4748        std::mem::forget(self);
4749    }
4750}
4751
4752impl FDomainCreateChannelResponder {
4753    /// Sends a response to the FIDL transaction.
4754    ///
4755    /// Sets the channel to shutdown if an error occurs.
4756    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4757        let _result = self.send_raw(result);
4758        if _result.is_err() {
4759            self.control_handle.shutdown();
4760        }
4761        self.drop_without_shutdown();
4762        _result
4763    }
4764
4765    /// Similar to "send" but does not shutdown the channel if an error occurs.
4766    pub fn send_no_shutdown_on_err(
4767        self,
4768        mut result: Result<(), &Error>,
4769    ) -> Result<(), fidl::Error> {
4770        let _result = self.send_raw(result);
4771        self.drop_without_shutdown();
4772        _result
4773    }
4774
4775    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4776        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4777            fidl::encoding::EmptyStruct,
4778            Error,
4779        >>(
4780            fidl::encoding::FlexibleResult::new(result),
4781            self.tx_id,
4782            0x182d38bfe88673b5,
4783            fidl::encoding::DynamicFlags::FLEXIBLE,
4784        )
4785    }
4786}
4787
4788#[must_use = "FIDL methods require a response to be sent"]
4789#[derive(Debug)]
4790pub struct FDomainReadChannelResponder {
4791    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4792    tx_id: u32,
4793}
4794
4795/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4796/// if the responder is dropped without sending a response, so that the client
4797/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4798impl std::ops::Drop for FDomainReadChannelResponder {
4799    fn drop(&mut self) {
4800        self.control_handle.shutdown();
4801        // Safety: drops once, never accessed again
4802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4803    }
4804}
4805
4806impl fidl::endpoints::Responder for FDomainReadChannelResponder {
4807    type ControlHandle = FDomainControlHandle;
4808
4809    fn control_handle(&self) -> &FDomainControlHandle {
4810        &self.control_handle
4811    }
4812
4813    fn drop_without_shutdown(mut self) {
4814        // Safety: drops once, never accessed again due to mem::forget
4815        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4816        // Prevent Drop from running (which would shut down the channel)
4817        std::mem::forget(self);
4818    }
4819}
4820
4821impl FDomainReadChannelResponder {
4822    /// Sends a response to the FIDL transaction.
4823    ///
4824    /// Sets the channel to shutdown if an error occurs.
4825    pub fn send(
4826        self,
4827        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
4828    ) -> Result<(), fidl::Error> {
4829        let _result = self.send_raw(result);
4830        if _result.is_err() {
4831            self.control_handle.shutdown();
4832        }
4833        self.drop_without_shutdown();
4834        _result
4835    }
4836
4837    /// Similar to "send" but does not shutdown the channel if an error occurs.
4838    pub fn send_no_shutdown_on_err(
4839        self,
4840        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
4841    ) -> Result<(), fidl::Error> {
4842        let _result = self.send_raw(result);
4843        self.drop_without_shutdown();
4844        _result
4845    }
4846
4847    fn send_raw(
4848        &self,
4849        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
4850    ) -> Result<(), fidl::Error> {
4851        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
4852            fidl::encoding::FlexibleResult::new(result),
4853            self.tx_id,
4854            0x6ef47bf27bf7d050,
4855            fidl::encoding::DynamicFlags::FLEXIBLE,
4856        )
4857    }
4858}
4859
4860#[must_use = "FIDL methods require a response to be sent"]
4861#[derive(Debug)]
4862pub struct FDomainWriteChannelResponder {
4863    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4864    tx_id: u32,
4865}
4866
4867/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4868/// if the responder is dropped without sending a response, so that the client
4869/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4870impl std::ops::Drop for FDomainWriteChannelResponder {
4871    fn drop(&mut self) {
4872        self.control_handle.shutdown();
4873        // Safety: drops once, never accessed again
4874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4875    }
4876}
4877
4878impl fidl::endpoints::Responder for FDomainWriteChannelResponder {
4879    type ControlHandle = FDomainControlHandle;
4880
4881    fn control_handle(&self) -> &FDomainControlHandle {
4882        &self.control_handle
4883    }
4884
4885    fn drop_without_shutdown(mut self) {
4886        // Safety: drops once, never accessed again due to mem::forget
4887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4888        // Prevent Drop from running (which would shut down the channel)
4889        std::mem::forget(self);
4890    }
4891}
4892
4893impl FDomainWriteChannelResponder {
4894    /// Sends a response to the FIDL transaction.
4895    ///
4896    /// Sets the channel to shutdown if an error occurs.
4897    pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
4898        let _result = self.send_raw(result);
4899        if _result.is_err() {
4900            self.control_handle.shutdown();
4901        }
4902        self.drop_without_shutdown();
4903        _result
4904    }
4905
4906    /// Similar to "send" but does not shutdown the channel if an error occurs.
4907    pub fn send_no_shutdown_on_err(
4908        self,
4909        mut result: Result<(), &WriteChannelError>,
4910    ) -> Result<(), fidl::Error> {
4911        let _result = self.send_raw(result);
4912        self.drop_without_shutdown();
4913        _result
4914    }
4915
4916    fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
4917        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4918            fidl::encoding::EmptyStruct,
4919            WriteChannelError,
4920        >>(
4921            fidl::encoding::FlexibleResult::new(result),
4922            self.tx_id,
4923            0x75a2559b945d5eb5,
4924            fidl::encoding::DynamicFlags::FLEXIBLE,
4925        )
4926    }
4927}
4928
4929#[must_use = "FIDL methods require a response to be sent"]
4930#[derive(Debug)]
4931pub struct FDomainReadChannelStreamingStartResponder {
4932    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
4933    tx_id: u32,
4934}
4935
4936/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
4937/// if the responder is dropped without sending a response, so that the client
4938/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4939impl std::ops::Drop for FDomainReadChannelStreamingStartResponder {
4940    fn drop(&mut self) {
4941        self.control_handle.shutdown();
4942        // Safety: drops once, never accessed again
4943        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4944    }
4945}
4946
4947impl fidl::endpoints::Responder for FDomainReadChannelStreamingStartResponder {
4948    type ControlHandle = FDomainControlHandle;
4949
4950    fn control_handle(&self) -> &FDomainControlHandle {
4951        &self.control_handle
4952    }
4953
4954    fn drop_without_shutdown(mut self) {
4955        // Safety: drops once, never accessed again due to mem::forget
4956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4957        // Prevent Drop from running (which would shut down the channel)
4958        std::mem::forget(self);
4959    }
4960}
4961
4962impl FDomainReadChannelStreamingStartResponder {
4963    /// Sends a response to the FIDL transaction.
4964    ///
4965    /// Sets the channel to shutdown if an error occurs.
4966    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4967        let _result = self.send_raw(result);
4968        if _result.is_err() {
4969            self.control_handle.shutdown();
4970        }
4971        self.drop_without_shutdown();
4972        _result
4973    }
4974
4975    /// Similar to "send" but does not shutdown the channel if an error occurs.
4976    pub fn send_no_shutdown_on_err(
4977        self,
4978        mut result: Result<(), &Error>,
4979    ) -> Result<(), fidl::Error> {
4980        let _result = self.send_raw(result);
4981        self.drop_without_shutdown();
4982        _result
4983    }
4984
4985    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
4986        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4987            fidl::encoding::EmptyStruct,
4988            Error,
4989        >>(
4990            fidl::encoding::FlexibleResult::new(result),
4991            self.tx_id,
4992            0x3c73e85476a203df,
4993            fidl::encoding::DynamicFlags::FLEXIBLE,
4994        )
4995    }
4996}
4997
4998#[must_use = "FIDL methods require a response to be sent"]
4999#[derive(Debug)]
5000pub struct FDomainReadChannelStreamingStopResponder {
5001    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5002    tx_id: u32,
5003}
5004
5005/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5006/// if the responder is dropped without sending a response, so that the client
5007/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5008impl std::ops::Drop for FDomainReadChannelStreamingStopResponder {
5009    fn drop(&mut self) {
5010        self.control_handle.shutdown();
5011        // Safety: drops once, never accessed again
5012        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5013    }
5014}
5015
5016impl fidl::endpoints::Responder for FDomainReadChannelStreamingStopResponder {
5017    type ControlHandle = FDomainControlHandle;
5018
5019    fn control_handle(&self) -> &FDomainControlHandle {
5020        &self.control_handle
5021    }
5022
5023    fn drop_without_shutdown(mut self) {
5024        // Safety: drops once, never accessed again due to mem::forget
5025        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5026        // Prevent Drop from running (which would shut down the channel)
5027        std::mem::forget(self);
5028    }
5029}
5030
5031impl FDomainReadChannelStreamingStopResponder {
5032    /// Sends a response to the FIDL transaction.
5033    ///
5034    /// Sets the channel to shutdown if an error occurs.
5035    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5036        let _result = self.send_raw(result);
5037        if _result.is_err() {
5038            self.control_handle.shutdown();
5039        }
5040        self.drop_without_shutdown();
5041        _result
5042    }
5043
5044    /// Similar to "send" but does not shutdown the channel if an error occurs.
5045    pub fn send_no_shutdown_on_err(
5046        self,
5047        mut result: Result<(), &Error>,
5048    ) -> Result<(), fidl::Error> {
5049        let _result = self.send_raw(result);
5050        self.drop_without_shutdown();
5051        _result
5052    }
5053
5054    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5055        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5056            fidl::encoding::EmptyStruct,
5057            Error,
5058        >>(
5059            fidl::encoding::FlexibleResult::new(result),
5060            self.tx_id,
5061            0x56f21d6ed68186e0,
5062            fidl::encoding::DynamicFlags::FLEXIBLE,
5063        )
5064    }
5065}
5066
5067#[must_use = "FIDL methods require a response to be sent"]
5068#[derive(Debug)]
5069pub struct FDomainCreateEventResponder {
5070    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5071    tx_id: u32,
5072}
5073
5074/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5075/// if the responder is dropped without sending a response, so that the client
5076/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5077impl std::ops::Drop for FDomainCreateEventResponder {
5078    fn drop(&mut self) {
5079        self.control_handle.shutdown();
5080        // Safety: drops once, never accessed again
5081        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5082    }
5083}
5084
5085impl fidl::endpoints::Responder for FDomainCreateEventResponder {
5086    type ControlHandle = FDomainControlHandle;
5087
5088    fn control_handle(&self) -> &FDomainControlHandle {
5089        &self.control_handle
5090    }
5091
5092    fn drop_without_shutdown(mut self) {
5093        // Safety: drops once, never accessed again due to mem::forget
5094        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5095        // Prevent Drop from running (which would shut down the channel)
5096        std::mem::forget(self);
5097    }
5098}
5099
5100impl FDomainCreateEventResponder {
5101    /// Sends a response to the FIDL transaction.
5102    ///
5103    /// Sets the channel to shutdown if an error occurs.
5104    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5105        let _result = self.send_raw(result);
5106        if _result.is_err() {
5107            self.control_handle.shutdown();
5108        }
5109        self.drop_without_shutdown();
5110        _result
5111    }
5112
5113    /// Similar to "send" but does not shutdown the channel if an error occurs.
5114    pub fn send_no_shutdown_on_err(
5115        self,
5116        mut result: Result<(), &Error>,
5117    ) -> Result<(), fidl::Error> {
5118        let _result = self.send_raw(result);
5119        self.drop_without_shutdown();
5120        _result
5121    }
5122
5123    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5124        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5125            fidl::encoding::EmptyStruct,
5126            Error,
5127        >>(
5128            fidl::encoding::FlexibleResult::new(result),
5129            self.tx_id,
5130            0x7b05b3f262635987,
5131            fidl::encoding::DynamicFlags::FLEXIBLE,
5132        )
5133    }
5134}
5135
5136#[must_use = "FIDL methods require a response to be sent"]
5137#[derive(Debug)]
5138pub struct FDomainCreateEventPairResponder {
5139    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5140    tx_id: u32,
5141}
5142
5143/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5144/// if the responder is dropped without sending a response, so that the client
5145/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5146impl std::ops::Drop for FDomainCreateEventPairResponder {
5147    fn drop(&mut self) {
5148        self.control_handle.shutdown();
5149        // Safety: drops once, never accessed again
5150        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5151    }
5152}
5153
5154impl fidl::endpoints::Responder for FDomainCreateEventPairResponder {
5155    type ControlHandle = FDomainControlHandle;
5156
5157    fn control_handle(&self) -> &FDomainControlHandle {
5158        &self.control_handle
5159    }
5160
5161    fn drop_without_shutdown(mut self) {
5162        // Safety: drops once, never accessed again due to mem::forget
5163        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5164        // Prevent Drop from running (which would shut down the channel)
5165        std::mem::forget(self);
5166    }
5167}
5168
5169impl FDomainCreateEventPairResponder {
5170    /// Sends a response to the FIDL transaction.
5171    ///
5172    /// Sets the channel to shutdown if an error occurs.
5173    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5174        let _result = self.send_raw(result);
5175        if _result.is_err() {
5176            self.control_handle.shutdown();
5177        }
5178        self.drop_without_shutdown();
5179        _result
5180    }
5181
5182    /// Similar to "send" but does not shutdown the channel if an error occurs.
5183    pub fn send_no_shutdown_on_err(
5184        self,
5185        mut result: Result<(), &Error>,
5186    ) -> Result<(), fidl::Error> {
5187        let _result = self.send_raw(result);
5188        self.drop_without_shutdown();
5189        _result
5190    }
5191
5192    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5193        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5194            fidl::encoding::EmptyStruct,
5195            Error,
5196        >>(
5197            fidl::encoding::FlexibleResult::new(result),
5198            self.tx_id,
5199            0x7aef61effa65656d,
5200            fidl::encoding::DynamicFlags::FLEXIBLE,
5201        )
5202    }
5203}
5204
5205#[must_use = "FIDL methods require a response to be sent"]
5206#[derive(Debug)]
5207pub struct FDomainCreateSocketResponder {
5208    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5209    tx_id: u32,
5210}
5211
5212/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5213/// if the responder is dropped without sending a response, so that the client
5214/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5215impl std::ops::Drop for FDomainCreateSocketResponder {
5216    fn drop(&mut self) {
5217        self.control_handle.shutdown();
5218        // Safety: drops once, never accessed again
5219        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5220    }
5221}
5222
5223impl fidl::endpoints::Responder for FDomainCreateSocketResponder {
5224    type ControlHandle = FDomainControlHandle;
5225
5226    fn control_handle(&self) -> &FDomainControlHandle {
5227        &self.control_handle
5228    }
5229
5230    fn drop_without_shutdown(mut self) {
5231        // Safety: drops once, never accessed again due to mem::forget
5232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5233        // Prevent Drop from running (which would shut down the channel)
5234        std::mem::forget(self);
5235    }
5236}
5237
5238impl FDomainCreateSocketResponder {
5239    /// Sends a response to the FIDL transaction.
5240    ///
5241    /// Sets the channel to shutdown if an error occurs.
5242    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5243        let _result = self.send_raw(result);
5244        if _result.is_err() {
5245            self.control_handle.shutdown();
5246        }
5247        self.drop_without_shutdown();
5248        _result
5249    }
5250
5251    /// Similar to "send" but does not shutdown the channel if an error occurs.
5252    pub fn send_no_shutdown_on_err(
5253        self,
5254        mut result: Result<(), &Error>,
5255    ) -> Result<(), fidl::Error> {
5256        let _result = self.send_raw(result);
5257        self.drop_without_shutdown();
5258        _result
5259    }
5260
5261    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5262        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5263            fidl::encoding::EmptyStruct,
5264            Error,
5265        >>(
5266            fidl::encoding::FlexibleResult::new(result),
5267            self.tx_id,
5268            0x200bf0ea21932de0,
5269            fidl::encoding::DynamicFlags::FLEXIBLE,
5270        )
5271    }
5272}
5273
5274#[must_use = "FIDL methods require a response to be sent"]
5275#[derive(Debug)]
5276pub struct FDomainSetSocketDispositionResponder {
5277    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5278    tx_id: u32,
5279}
5280
5281/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5282/// if the responder is dropped without sending a response, so that the client
5283/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5284impl std::ops::Drop for FDomainSetSocketDispositionResponder {
5285    fn drop(&mut self) {
5286        self.control_handle.shutdown();
5287        // Safety: drops once, never accessed again
5288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5289    }
5290}
5291
5292impl fidl::endpoints::Responder for FDomainSetSocketDispositionResponder {
5293    type ControlHandle = FDomainControlHandle;
5294
5295    fn control_handle(&self) -> &FDomainControlHandle {
5296        &self.control_handle
5297    }
5298
5299    fn drop_without_shutdown(mut self) {
5300        // Safety: drops once, never accessed again due to mem::forget
5301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5302        // Prevent Drop from running (which would shut down the channel)
5303        std::mem::forget(self);
5304    }
5305}
5306
5307impl FDomainSetSocketDispositionResponder {
5308    /// Sends a response to the FIDL transaction.
5309    ///
5310    /// Sets the channel to shutdown if an error occurs.
5311    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5312        let _result = self.send_raw(result);
5313        if _result.is_err() {
5314            self.control_handle.shutdown();
5315        }
5316        self.drop_without_shutdown();
5317        _result
5318    }
5319
5320    /// Similar to "send" but does not shutdown the channel if an error occurs.
5321    pub fn send_no_shutdown_on_err(
5322        self,
5323        mut result: Result<(), &Error>,
5324    ) -> Result<(), fidl::Error> {
5325        let _result = self.send_raw(result);
5326        self.drop_without_shutdown();
5327        _result
5328    }
5329
5330    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5331        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5332            fidl::encoding::EmptyStruct,
5333            Error,
5334        >>(
5335            fidl::encoding::FlexibleResult::new(result),
5336            self.tx_id,
5337            0x60d3c7ccb17f9bdf,
5338            fidl::encoding::DynamicFlags::FLEXIBLE,
5339        )
5340    }
5341}
5342
5343#[must_use = "FIDL methods require a response to be sent"]
5344#[derive(Debug)]
5345pub struct FDomainReadSocketResponder {
5346    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5347    tx_id: u32,
5348}
5349
5350/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5351/// if the responder is dropped without sending a response, so that the client
5352/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5353impl std::ops::Drop for FDomainReadSocketResponder {
5354    fn drop(&mut self) {
5355        self.control_handle.shutdown();
5356        // Safety: drops once, never accessed again
5357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5358    }
5359}
5360
5361impl fidl::endpoints::Responder for FDomainReadSocketResponder {
5362    type ControlHandle = FDomainControlHandle;
5363
5364    fn control_handle(&self) -> &FDomainControlHandle {
5365        &self.control_handle
5366    }
5367
5368    fn drop_without_shutdown(mut self) {
5369        // Safety: drops once, never accessed again due to mem::forget
5370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5371        // Prevent Drop from running (which would shut down the channel)
5372        std::mem::forget(self);
5373    }
5374}
5375
5376impl FDomainReadSocketResponder {
5377    /// Sends a response to the FIDL transaction.
5378    ///
5379    /// Sets the channel to shutdown if an error occurs.
5380    pub fn send(self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
5381        let _result = self.send_raw(result);
5382        if _result.is_err() {
5383            self.control_handle.shutdown();
5384        }
5385        self.drop_without_shutdown();
5386        _result
5387    }
5388
5389    /// Similar to "send" but does not shutdown the channel if an error occurs.
5390    pub fn send_no_shutdown_on_err(
5391        self,
5392        mut result: Result<(&[u8], bool), &Error>,
5393    ) -> Result<(), fidl::Error> {
5394        let _result = self.send_raw(result);
5395        self.drop_without_shutdown();
5396        _result
5397    }
5398
5399    fn send_raw(&self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
5400        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<SocketData, Error>>(
5401            fidl::encoding::FlexibleResult::new(result),
5402            self.tx_id,
5403            0x1da8aabec249c02e,
5404            fidl::encoding::DynamicFlags::FLEXIBLE,
5405        )
5406    }
5407}
5408
5409#[must_use = "FIDL methods require a response to be sent"]
5410#[derive(Debug)]
5411pub struct FDomainWriteSocketResponder {
5412    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5413    tx_id: u32,
5414}
5415
5416/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5417/// if the responder is dropped without sending a response, so that the client
5418/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5419impl std::ops::Drop for FDomainWriteSocketResponder {
5420    fn drop(&mut self) {
5421        self.control_handle.shutdown();
5422        // Safety: drops once, never accessed again
5423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5424    }
5425}
5426
5427impl fidl::endpoints::Responder for FDomainWriteSocketResponder {
5428    type ControlHandle = FDomainControlHandle;
5429
5430    fn control_handle(&self) -> &FDomainControlHandle {
5431        &self.control_handle
5432    }
5433
5434    fn drop_without_shutdown(mut self) {
5435        // Safety: drops once, never accessed again due to mem::forget
5436        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5437        // Prevent Drop from running (which would shut down the channel)
5438        std::mem::forget(self);
5439    }
5440}
5441
5442impl FDomainWriteSocketResponder {
5443    /// Sends a response to the FIDL transaction.
5444    ///
5445    /// Sets the channel to shutdown if an error occurs.
5446    pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
5447        let _result = self.send_raw(result);
5448        if _result.is_err() {
5449            self.control_handle.shutdown();
5450        }
5451        self.drop_without_shutdown();
5452        _result
5453    }
5454
5455    /// Similar to "send" but does not shutdown the channel if an error occurs.
5456    pub fn send_no_shutdown_on_err(
5457        self,
5458        mut result: Result<u64, &WriteSocketError>,
5459    ) -> Result<(), fidl::Error> {
5460        let _result = self.send_raw(result);
5461        self.drop_without_shutdown();
5462        _result
5463    }
5464
5465    fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
5466        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5467            SocketWriteSocketResponse,
5468            WriteSocketError,
5469        >>(
5470            fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
5471            self.tx_id,
5472            0x5b541623cbbbf683,
5473            fidl::encoding::DynamicFlags::FLEXIBLE,
5474        )
5475    }
5476}
5477
5478#[must_use = "FIDL methods require a response to be sent"]
5479#[derive(Debug)]
5480pub struct FDomainReadSocketStreamingStartResponder {
5481    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5482    tx_id: u32,
5483}
5484
5485/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5486/// if the responder is dropped without sending a response, so that the client
5487/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5488impl std::ops::Drop for FDomainReadSocketStreamingStartResponder {
5489    fn drop(&mut self) {
5490        self.control_handle.shutdown();
5491        // Safety: drops once, never accessed again
5492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5493    }
5494}
5495
5496impl fidl::endpoints::Responder for FDomainReadSocketStreamingStartResponder {
5497    type ControlHandle = FDomainControlHandle;
5498
5499    fn control_handle(&self) -> &FDomainControlHandle {
5500        &self.control_handle
5501    }
5502
5503    fn drop_without_shutdown(mut self) {
5504        // Safety: drops once, never accessed again due to mem::forget
5505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5506        // Prevent Drop from running (which would shut down the channel)
5507        std::mem::forget(self);
5508    }
5509}
5510
5511impl FDomainReadSocketStreamingStartResponder {
5512    /// Sends a response to the FIDL transaction.
5513    ///
5514    /// Sets the channel to shutdown if an error occurs.
5515    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5516        let _result = self.send_raw(result);
5517        if _result.is_err() {
5518            self.control_handle.shutdown();
5519        }
5520        self.drop_without_shutdown();
5521        _result
5522    }
5523
5524    /// Similar to "send" but does not shutdown the channel if an error occurs.
5525    pub fn send_no_shutdown_on_err(
5526        self,
5527        mut result: Result<(), &Error>,
5528    ) -> Result<(), fidl::Error> {
5529        let _result = self.send_raw(result);
5530        self.drop_without_shutdown();
5531        _result
5532    }
5533
5534    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5535        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5536            fidl::encoding::EmptyStruct,
5537            Error,
5538        >>(
5539            fidl::encoding::FlexibleResult::new(result),
5540            self.tx_id,
5541            0x2a592748d5f33445,
5542            fidl::encoding::DynamicFlags::FLEXIBLE,
5543        )
5544    }
5545}
5546
5547#[must_use = "FIDL methods require a response to be sent"]
5548#[derive(Debug)]
5549pub struct FDomainReadSocketStreamingStopResponder {
5550    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5551    tx_id: u32,
5552}
5553
5554/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5555/// if the responder is dropped without sending a response, so that the client
5556/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5557impl std::ops::Drop for FDomainReadSocketStreamingStopResponder {
5558    fn drop(&mut self) {
5559        self.control_handle.shutdown();
5560        // Safety: drops once, never accessed again
5561        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5562    }
5563}
5564
5565impl fidl::endpoints::Responder for FDomainReadSocketStreamingStopResponder {
5566    type ControlHandle = FDomainControlHandle;
5567
5568    fn control_handle(&self) -> &FDomainControlHandle {
5569        &self.control_handle
5570    }
5571
5572    fn drop_without_shutdown(mut self) {
5573        // Safety: drops once, never accessed again due to mem::forget
5574        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5575        // Prevent Drop from running (which would shut down the channel)
5576        std::mem::forget(self);
5577    }
5578}
5579
5580impl FDomainReadSocketStreamingStopResponder {
5581    /// Sends a response to the FIDL transaction.
5582    ///
5583    /// Sets the channel to shutdown if an error occurs.
5584    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5585        let _result = self.send_raw(result);
5586        if _result.is_err() {
5587            self.control_handle.shutdown();
5588        }
5589        self.drop_without_shutdown();
5590        _result
5591    }
5592
5593    /// Similar to "send" but does not shutdown the channel if an error occurs.
5594    pub fn send_no_shutdown_on_err(
5595        self,
5596        mut result: Result<(), &Error>,
5597    ) -> Result<(), fidl::Error> {
5598        let _result = self.send_raw(result);
5599        self.drop_without_shutdown();
5600        _result
5601    }
5602
5603    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5604        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5605            fidl::encoding::EmptyStruct,
5606            Error,
5607        >>(
5608            fidl::encoding::FlexibleResult::new(result),
5609            self.tx_id,
5610            0x53e5cade5f4d22e7,
5611            fidl::encoding::DynamicFlags::FLEXIBLE,
5612        )
5613    }
5614}
5615
5616#[must_use = "FIDL methods require a response to be sent"]
5617#[derive(Debug)]
5618pub struct FDomainGetNamespaceResponder {
5619    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5620    tx_id: u32,
5621}
5622
5623/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5624/// if the responder is dropped without sending a response, so that the client
5625/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5626impl std::ops::Drop for FDomainGetNamespaceResponder {
5627    fn drop(&mut self) {
5628        self.control_handle.shutdown();
5629        // Safety: drops once, never accessed again
5630        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5631    }
5632}
5633
5634impl fidl::endpoints::Responder for FDomainGetNamespaceResponder {
5635    type ControlHandle = FDomainControlHandle;
5636
5637    fn control_handle(&self) -> &FDomainControlHandle {
5638        &self.control_handle
5639    }
5640
5641    fn drop_without_shutdown(mut self) {
5642        // Safety: drops once, never accessed again due to mem::forget
5643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5644        // Prevent Drop from running (which would shut down the channel)
5645        std::mem::forget(self);
5646    }
5647}
5648
5649impl FDomainGetNamespaceResponder {
5650    /// Sends a response to the FIDL transaction.
5651    ///
5652    /// Sets the channel to shutdown if an error occurs.
5653    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5654        let _result = self.send_raw(result);
5655        if _result.is_err() {
5656            self.control_handle.shutdown();
5657        }
5658        self.drop_without_shutdown();
5659        _result
5660    }
5661
5662    /// Similar to "send" but does not shutdown the channel if an error occurs.
5663    pub fn send_no_shutdown_on_err(
5664        self,
5665        mut result: Result<(), &Error>,
5666    ) -> Result<(), fidl::Error> {
5667        let _result = self.send_raw(result);
5668        self.drop_without_shutdown();
5669        _result
5670    }
5671
5672    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5673        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5674            fidl::encoding::EmptyStruct,
5675            Error,
5676        >>(
5677            fidl::encoding::FlexibleResult::new(result),
5678            self.tx_id,
5679            0x74f2e74d9f53e11e,
5680            fidl::encoding::DynamicFlags::FLEXIBLE,
5681        )
5682    }
5683}
5684
5685#[must_use = "FIDL methods require a response to be sent"]
5686#[derive(Debug)]
5687pub struct FDomainCloseResponder {
5688    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5689    tx_id: u32,
5690}
5691
5692/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5693/// if the responder is dropped without sending a response, so that the client
5694/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5695impl std::ops::Drop for FDomainCloseResponder {
5696    fn drop(&mut self) {
5697        self.control_handle.shutdown();
5698        // Safety: drops once, never accessed again
5699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5700    }
5701}
5702
5703impl fidl::endpoints::Responder for FDomainCloseResponder {
5704    type ControlHandle = FDomainControlHandle;
5705
5706    fn control_handle(&self) -> &FDomainControlHandle {
5707        &self.control_handle
5708    }
5709
5710    fn drop_without_shutdown(mut self) {
5711        // Safety: drops once, never accessed again due to mem::forget
5712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5713        // Prevent Drop from running (which would shut down the channel)
5714        std::mem::forget(self);
5715    }
5716}
5717
5718impl FDomainCloseResponder {
5719    /// Sends a response to the FIDL transaction.
5720    ///
5721    /// Sets the channel to shutdown if an error occurs.
5722    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5723        let _result = self.send_raw(result);
5724        if _result.is_err() {
5725            self.control_handle.shutdown();
5726        }
5727        self.drop_without_shutdown();
5728        _result
5729    }
5730
5731    /// Similar to "send" but does not shutdown the channel if an error occurs.
5732    pub fn send_no_shutdown_on_err(
5733        self,
5734        mut result: Result<(), &Error>,
5735    ) -> Result<(), fidl::Error> {
5736        let _result = self.send_raw(result);
5737        self.drop_without_shutdown();
5738        _result
5739    }
5740
5741    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5742        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5743            fidl::encoding::EmptyStruct,
5744            Error,
5745        >>(
5746            fidl::encoding::FlexibleResult::new(result),
5747            self.tx_id,
5748            0x5ef8c24362964257,
5749            fidl::encoding::DynamicFlags::FLEXIBLE,
5750        )
5751    }
5752}
5753
5754#[must_use = "FIDL methods require a response to be sent"]
5755#[derive(Debug)]
5756pub struct FDomainDuplicateResponder {
5757    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5758    tx_id: u32,
5759}
5760
5761/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5762/// if the responder is dropped without sending a response, so that the client
5763/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5764impl std::ops::Drop for FDomainDuplicateResponder {
5765    fn drop(&mut self) {
5766        self.control_handle.shutdown();
5767        // Safety: drops once, never accessed again
5768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5769    }
5770}
5771
5772impl fidl::endpoints::Responder for FDomainDuplicateResponder {
5773    type ControlHandle = FDomainControlHandle;
5774
5775    fn control_handle(&self) -> &FDomainControlHandle {
5776        &self.control_handle
5777    }
5778
5779    fn drop_without_shutdown(mut self) {
5780        // Safety: drops once, never accessed again due to mem::forget
5781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5782        // Prevent Drop from running (which would shut down the channel)
5783        std::mem::forget(self);
5784    }
5785}
5786
5787impl FDomainDuplicateResponder {
5788    /// Sends a response to the FIDL transaction.
5789    ///
5790    /// Sets the channel to shutdown if an error occurs.
5791    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5792        let _result = self.send_raw(result);
5793        if _result.is_err() {
5794            self.control_handle.shutdown();
5795        }
5796        self.drop_without_shutdown();
5797        _result
5798    }
5799
5800    /// Similar to "send" but does not shutdown the channel if an error occurs.
5801    pub fn send_no_shutdown_on_err(
5802        self,
5803        mut result: Result<(), &Error>,
5804    ) -> Result<(), fidl::Error> {
5805        let _result = self.send_raw(result);
5806        self.drop_without_shutdown();
5807        _result
5808    }
5809
5810    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5811        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5812            fidl::encoding::EmptyStruct,
5813            Error,
5814        >>(
5815            fidl::encoding::FlexibleResult::new(result),
5816            self.tx_id,
5817            0x7a85b94bd1777ab9,
5818            fidl::encoding::DynamicFlags::FLEXIBLE,
5819        )
5820    }
5821}
5822
5823#[must_use = "FIDL methods require a response to be sent"]
5824#[derive(Debug)]
5825pub struct FDomainReplaceResponder {
5826    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5827    tx_id: u32,
5828}
5829
5830/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5831/// if the responder is dropped without sending a response, so that the client
5832/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5833impl std::ops::Drop for FDomainReplaceResponder {
5834    fn drop(&mut self) {
5835        self.control_handle.shutdown();
5836        // Safety: drops once, never accessed again
5837        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5838    }
5839}
5840
5841impl fidl::endpoints::Responder for FDomainReplaceResponder {
5842    type ControlHandle = FDomainControlHandle;
5843
5844    fn control_handle(&self) -> &FDomainControlHandle {
5845        &self.control_handle
5846    }
5847
5848    fn drop_without_shutdown(mut self) {
5849        // Safety: drops once, never accessed again due to mem::forget
5850        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5851        // Prevent Drop from running (which would shut down the channel)
5852        std::mem::forget(self);
5853    }
5854}
5855
5856impl FDomainReplaceResponder {
5857    /// Sends a response to the FIDL transaction.
5858    ///
5859    /// Sets the channel to shutdown if an error occurs.
5860    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5861        let _result = self.send_raw(result);
5862        if _result.is_err() {
5863            self.control_handle.shutdown();
5864        }
5865        self.drop_without_shutdown();
5866        _result
5867    }
5868
5869    /// Similar to "send" but does not shutdown the channel if an error occurs.
5870    pub fn send_no_shutdown_on_err(
5871        self,
5872        mut result: Result<(), &Error>,
5873    ) -> Result<(), fidl::Error> {
5874        let _result = self.send_raw(result);
5875        self.drop_without_shutdown();
5876        _result
5877    }
5878
5879    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5880        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5881            fidl::encoding::EmptyStruct,
5882            Error,
5883        >>(
5884            fidl::encoding::FlexibleResult::new(result),
5885            self.tx_id,
5886            0x32fa64625a5bd3be,
5887            fidl::encoding::DynamicFlags::FLEXIBLE,
5888        )
5889    }
5890}
5891
5892#[must_use = "FIDL methods require a response to be sent"]
5893#[derive(Debug)]
5894pub struct FDomainSignalResponder {
5895    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5896    tx_id: u32,
5897}
5898
5899/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5900/// if the responder is dropped without sending a response, so that the client
5901/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5902impl std::ops::Drop for FDomainSignalResponder {
5903    fn drop(&mut self) {
5904        self.control_handle.shutdown();
5905        // Safety: drops once, never accessed again
5906        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5907    }
5908}
5909
5910impl fidl::endpoints::Responder for FDomainSignalResponder {
5911    type ControlHandle = FDomainControlHandle;
5912
5913    fn control_handle(&self) -> &FDomainControlHandle {
5914        &self.control_handle
5915    }
5916
5917    fn drop_without_shutdown(mut self) {
5918        // Safety: drops once, never accessed again due to mem::forget
5919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5920        // Prevent Drop from running (which would shut down the channel)
5921        std::mem::forget(self);
5922    }
5923}
5924
5925impl FDomainSignalResponder {
5926    /// Sends a response to the FIDL transaction.
5927    ///
5928    /// Sets the channel to shutdown if an error occurs.
5929    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5930        let _result = self.send_raw(result);
5931        if _result.is_err() {
5932            self.control_handle.shutdown();
5933        }
5934        self.drop_without_shutdown();
5935        _result
5936    }
5937
5938    /// Similar to "send" but does not shutdown the channel if an error occurs.
5939    pub fn send_no_shutdown_on_err(
5940        self,
5941        mut result: Result<(), &Error>,
5942    ) -> Result<(), fidl::Error> {
5943        let _result = self.send_raw(result);
5944        self.drop_without_shutdown();
5945        _result
5946    }
5947
5948    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5949        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5950            fidl::encoding::EmptyStruct,
5951            Error,
5952        >>(
5953            fidl::encoding::FlexibleResult::new(result),
5954            self.tx_id,
5955            0xe8352fb978996d9,
5956            fidl::encoding::DynamicFlags::FLEXIBLE,
5957        )
5958    }
5959}
5960
5961#[must_use = "FIDL methods require a response to be sent"]
5962#[derive(Debug)]
5963pub struct FDomainSignalPeerResponder {
5964    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5965    tx_id: u32,
5966}
5967
5968/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5969/// if the responder is dropped without sending a response, so that the client
5970/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5971impl std::ops::Drop for FDomainSignalPeerResponder {
5972    fn drop(&mut self) {
5973        self.control_handle.shutdown();
5974        // Safety: drops once, never accessed again
5975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5976    }
5977}
5978
5979impl fidl::endpoints::Responder for FDomainSignalPeerResponder {
5980    type ControlHandle = FDomainControlHandle;
5981
5982    fn control_handle(&self) -> &FDomainControlHandle {
5983        &self.control_handle
5984    }
5985
5986    fn drop_without_shutdown(mut self) {
5987        // Safety: drops once, never accessed again due to mem::forget
5988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5989        // Prevent Drop from running (which would shut down the channel)
5990        std::mem::forget(self);
5991    }
5992}
5993
5994impl FDomainSignalPeerResponder {
5995    /// Sends a response to the FIDL transaction.
5996    ///
5997    /// Sets the channel to shutdown if an error occurs.
5998    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5999        let _result = self.send_raw(result);
6000        if _result.is_err() {
6001            self.control_handle.shutdown();
6002        }
6003        self.drop_without_shutdown();
6004        _result
6005    }
6006
6007    /// Similar to "send" but does not shutdown the channel if an error occurs.
6008    pub fn send_no_shutdown_on_err(
6009        self,
6010        mut result: Result<(), &Error>,
6011    ) -> Result<(), fidl::Error> {
6012        let _result = self.send_raw(result);
6013        self.drop_without_shutdown();
6014        _result
6015    }
6016
6017    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6018        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6019            fidl::encoding::EmptyStruct,
6020            Error,
6021        >>(
6022            fidl::encoding::FlexibleResult::new(result),
6023            self.tx_id,
6024            0x7e84ec8ca7eabaf8,
6025            fidl::encoding::DynamicFlags::FLEXIBLE,
6026        )
6027    }
6028}
6029
6030#[must_use = "FIDL methods require a response to be sent"]
6031#[derive(Debug)]
6032pub struct FDomainWaitForSignalsResponder {
6033    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6034    tx_id: u32,
6035}
6036
6037/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6038/// if the responder is dropped without sending a response, so that the client
6039/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6040impl std::ops::Drop for FDomainWaitForSignalsResponder {
6041    fn drop(&mut self) {
6042        self.control_handle.shutdown();
6043        // Safety: drops once, never accessed again
6044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6045    }
6046}
6047
6048impl fidl::endpoints::Responder for FDomainWaitForSignalsResponder {
6049    type ControlHandle = FDomainControlHandle;
6050
6051    fn control_handle(&self) -> &FDomainControlHandle {
6052        &self.control_handle
6053    }
6054
6055    fn drop_without_shutdown(mut self) {
6056        // Safety: drops once, never accessed again due to mem::forget
6057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6058        // Prevent Drop from running (which would shut down the channel)
6059        std::mem::forget(self);
6060    }
6061}
6062
6063impl FDomainWaitForSignalsResponder {
6064    /// Sends a response to the FIDL transaction.
6065    ///
6066    /// Sets the channel to shutdown if an error occurs.
6067    pub fn send(self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
6068        let _result = self.send_raw(result);
6069        if _result.is_err() {
6070            self.control_handle.shutdown();
6071        }
6072        self.drop_without_shutdown();
6073        _result
6074    }
6075
6076    /// Similar to "send" but does not shutdown the channel if an error occurs.
6077    pub fn send_no_shutdown_on_err(
6078        self,
6079        mut result: Result<u32, &Error>,
6080    ) -> Result<(), fidl::Error> {
6081        let _result = self.send_raw(result);
6082        self.drop_without_shutdown();
6083        _result
6084    }
6085
6086    fn send_raw(&self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
6087        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6088            FDomainWaitForSignalsResponse,
6089            Error,
6090        >>(
6091            fidl::encoding::FlexibleResult::new(result.map(|signals| (signals,))),
6092            self.tx_id,
6093            0x8f72d9b4b85c1eb,
6094            fidl::encoding::DynamicFlags::FLEXIBLE,
6095        )
6096    }
6097}
6098
6099#[must_use = "FIDL methods require a response to be sent"]
6100#[derive(Debug)]
6101pub struct FDomainGetKoidResponder {
6102    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6103    tx_id: u32,
6104}
6105
6106/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6107/// if the responder is dropped without sending a response, so that the client
6108/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6109impl std::ops::Drop for FDomainGetKoidResponder {
6110    fn drop(&mut self) {
6111        self.control_handle.shutdown();
6112        // Safety: drops once, never accessed again
6113        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6114    }
6115}
6116
6117impl fidl::endpoints::Responder for FDomainGetKoidResponder {
6118    type ControlHandle = FDomainControlHandle;
6119
6120    fn control_handle(&self) -> &FDomainControlHandle {
6121        &self.control_handle
6122    }
6123
6124    fn drop_without_shutdown(mut self) {
6125        // Safety: drops once, never accessed again due to mem::forget
6126        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6127        // Prevent Drop from running (which would shut down the channel)
6128        std::mem::forget(self);
6129    }
6130}
6131
6132impl FDomainGetKoidResponder {
6133    /// Sends a response to the FIDL transaction.
6134    ///
6135    /// Sets the channel to shutdown if an error occurs.
6136    pub fn send(self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
6137        let _result = self.send_raw(result);
6138        if _result.is_err() {
6139            self.control_handle.shutdown();
6140        }
6141        self.drop_without_shutdown();
6142        _result
6143    }
6144
6145    /// Similar to "send" but does not shutdown the channel if an error occurs.
6146    pub fn send_no_shutdown_on_err(
6147        self,
6148        mut result: Result<u64, &Error>,
6149    ) -> Result<(), fidl::Error> {
6150        let _result = self.send_raw(result);
6151        self.drop_without_shutdown();
6152        _result
6153    }
6154
6155    fn send_raw(&self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
6156        self.control_handle
6157            .inner
6158            .send::<fidl::encoding::FlexibleResultType<FDomainGetKoidResponse, Error>>(
6159                fidl::encoding::FlexibleResult::new(result.map(|koid| (koid,))),
6160                self.tx_id,
6161                0x437db979a63402c3,
6162                fidl::encoding::DynamicFlags::FLEXIBLE,
6163            )
6164    }
6165}
6166
6167#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6168pub struct SocketMarker;
6169
6170impl fidl::endpoints::ProtocolMarker for SocketMarker {
6171    type Proxy = SocketProxy;
6172    type RequestStream = SocketRequestStream;
6173    #[cfg(target_os = "fuchsia")]
6174    type SynchronousProxy = SocketSynchronousProxy;
6175
6176    const DEBUG_NAME: &'static str = "(anonymous) Socket";
6177}
6178pub type SocketCreateSocketResult = Result<(), Error>;
6179pub type SocketSetSocketDispositionResult = Result<(), Error>;
6180pub type SocketReadSocketResult = Result<(Vec<u8>, bool), Error>;
6181pub type SocketWriteSocketResult = Result<u64, WriteSocketError>;
6182pub type SocketReadSocketStreamingStartResult = Result<(), Error>;
6183pub type SocketReadSocketStreamingStopResult = Result<(), Error>;
6184
6185pub trait SocketProxyInterface: Send + Sync {
6186    type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
6187        + Send;
6188    fn r#create_socket(
6189        &self,
6190        options: SocketType,
6191        handles: &[NewHandleId; 2],
6192    ) -> Self::CreateSocketResponseFut;
6193    type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
6194        + Send;
6195    fn r#set_socket_disposition(
6196        &self,
6197        handle: &HandleId,
6198        disposition: SocketDisposition,
6199        disposition_peer: SocketDisposition,
6200    ) -> Self::SetSocketDispositionResponseFut;
6201    type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
6202        + Send;
6203    fn r#read_socket(&self, handle: &HandleId, max_bytes: u64) -> Self::ReadSocketResponseFut;
6204    type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
6205        + Send;
6206    fn r#write_socket(&self, handle: &HandleId, data: &[u8]) -> Self::WriteSocketResponseFut;
6207    type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
6208        + Send;
6209    fn r#read_socket_streaming_start(
6210        &self,
6211        handle: &HandleId,
6212    ) -> Self::ReadSocketStreamingStartResponseFut;
6213    type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
6214        + Send;
6215    fn r#read_socket_streaming_stop(
6216        &self,
6217        handle: &HandleId,
6218    ) -> Self::ReadSocketStreamingStopResponseFut;
6219}
6220#[derive(Debug)]
6221#[cfg(target_os = "fuchsia")]
6222pub struct SocketSynchronousProxy {
6223    client: fidl::client::sync::Client,
6224}
6225
6226#[cfg(target_os = "fuchsia")]
6227impl fidl::endpoints::SynchronousProxy for SocketSynchronousProxy {
6228    type Proxy = SocketProxy;
6229    type Protocol = SocketMarker;
6230
6231    fn from_channel(inner: fidl::Channel) -> Self {
6232        Self::new(inner)
6233    }
6234
6235    fn into_channel(self) -> fidl::Channel {
6236        self.client.into_channel()
6237    }
6238
6239    fn as_channel(&self) -> &fidl::Channel {
6240        self.client.as_channel()
6241    }
6242}
6243
6244#[cfg(target_os = "fuchsia")]
6245impl SocketSynchronousProxy {
6246    pub fn new(channel: fidl::Channel) -> Self {
6247        let protocol_name = <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6248        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6249    }
6250
6251    pub fn into_channel(self) -> fidl::Channel {
6252        self.client.into_channel()
6253    }
6254
6255    /// Waits until an event arrives and returns it. It is safe for other
6256    /// threads to make concurrent requests while waiting for an event.
6257    pub fn wait_for_event(
6258        &self,
6259        deadline: zx::MonotonicInstant,
6260    ) -> Result<SocketEvent, fidl::Error> {
6261        SocketEvent::decode(self.client.wait_for_event(deadline)?)
6262    }
6263
6264    pub fn r#create_socket(
6265        &self,
6266        mut options: SocketType,
6267        mut handles: &[NewHandleId; 2],
6268        ___deadline: zx::MonotonicInstant,
6269    ) -> Result<SocketCreateSocketResult, fidl::Error> {
6270        let _response = self.client.send_query::<
6271            SocketCreateSocketRequest,
6272            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6273        >(
6274            (options, handles,),
6275            0x200bf0ea21932de0,
6276            fidl::encoding::DynamicFlags::FLEXIBLE,
6277            ___deadline,
6278        )?
6279        .into_result::<SocketMarker>("create_socket")?;
6280        Ok(_response.map(|x| x))
6281    }
6282
6283    pub fn r#set_socket_disposition(
6284        &self,
6285        mut handle: &HandleId,
6286        mut disposition: SocketDisposition,
6287        mut disposition_peer: SocketDisposition,
6288        ___deadline: zx::MonotonicInstant,
6289    ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
6290        let _response = self.client.send_query::<
6291            SocketSetSocketDispositionRequest,
6292            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6293        >(
6294            (handle, disposition, disposition_peer,),
6295            0x60d3c7ccb17f9bdf,
6296            fidl::encoding::DynamicFlags::FLEXIBLE,
6297            ___deadline,
6298        )?
6299        .into_result::<SocketMarker>("set_socket_disposition")?;
6300        Ok(_response.map(|x| x))
6301    }
6302
6303    pub fn r#read_socket(
6304        &self,
6305        mut handle: &HandleId,
6306        mut max_bytes: u64,
6307        ___deadline: zx::MonotonicInstant,
6308    ) -> Result<SocketReadSocketResult, fidl::Error> {
6309        let _response = self.client.send_query::<
6310            SocketReadSocketRequest,
6311            fidl::encoding::FlexibleResultType<SocketData, Error>,
6312        >(
6313            (handle, max_bytes,),
6314            0x1da8aabec249c02e,
6315            fidl::encoding::DynamicFlags::FLEXIBLE,
6316            ___deadline,
6317        )?
6318        .into_result::<SocketMarker>("read_socket")?;
6319        Ok(_response.map(|x| (x.data, x.is_datagram)))
6320    }
6321
6322    pub fn r#write_socket(
6323        &self,
6324        mut handle: &HandleId,
6325        mut data: &[u8],
6326        ___deadline: zx::MonotonicInstant,
6327    ) -> Result<SocketWriteSocketResult, fidl::Error> {
6328        let _response = self.client.send_query::<
6329            SocketWriteSocketRequest,
6330            fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
6331        >(
6332            (handle, data,),
6333            0x5b541623cbbbf683,
6334            fidl::encoding::DynamicFlags::FLEXIBLE,
6335            ___deadline,
6336        )?
6337        .into_result::<SocketMarker>("write_socket")?;
6338        Ok(_response.map(|x| x.wrote))
6339    }
6340
6341    pub fn r#read_socket_streaming_start(
6342        &self,
6343        mut handle: &HandleId,
6344        ___deadline: zx::MonotonicInstant,
6345    ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
6346        let _response = self.client.send_query::<
6347            SocketReadSocketStreamingStartRequest,
6348            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6349        >(
6350            (handle,),
6351            0x2a592748d5f33445,
6352            fidl::encoding::DynamicFlags::FLEXIBLE,
6353            ___deadline,
6354        )?
6355        .into_result::<SocketMarker>("read_socket_streaming_start")?;
6356        Ok(_response.map(|x| x))
6357    }
6358
6359    pub fn r#read_socket_streaming_stop(
6360        &self,
6361        mut handle: &HandleId,
6362        ___deadline: zx::MonotonicInstant,
6363    ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
6364        let _response = self.client.send_query::<
6365            SocketReadSocketStreamingStopRequest,
6366            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6367        >(
6368            (handle,),
6369            0x53e5cade5f4d22e7,
6370            fidl::encoding::DynamicFlags::FLEXIBLE,
6371            ___deadline,
6372        )?
6373        .into_result::<SocketMarker>("read_socket_streaming_stop")?;
6374        Ok(_response.map(|x| x))
6375    }
6376}
6377
6378#[cfg(target_os = "fuchsia")]
6379impl From<SocketSynchronousProxy> for zx::NullableHandle {
6380    fn from(value: SocketSynchronousProxy) -> Self {
6381        value.into_channel().into()
6382    }
6383}
6384
6385#[cfg(target_os = "fuchsia")]
6386impl From<fidl::Channel> for SocketSynchronousProxy {
6387    fn from(value: fidl::Channel) -> Self {
6388        Self::new(value)
6389    }
6390}
6391
6392#[cfg(target_os = "fuchsia")]
6393impl fidl::endpoints::FromClient for SocketSynchronousProxy {
6394    type Protocol = SocketMarker;
6395
6396    fn from_client(value: fidl::endpoints::ClientEnd<SocketMarker>) -> Self {
6397        Self::new(value.into_channel())
6398    }
6399}
6400
6401#[derive(Debug, Clone)]
6402pub struct SocketProxy {
6403    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6404}
6405
6406impl fidl::endpoints::Proxy for SocketProxy {
6407    type Protocol = SocketMarker;
6408
6409    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6410        Self::new(inner)
6411    }
6412
6413    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6414        self.client.into_channel().map_err(|client| Self { client })
6415    }
6416
6417    fn as_channel(&self) -> &::fidl::AsyncChannel {
6418        self.client.as_channel()
6419    }
6420}
6421
6422impl SocketProxy {
6423    /// Create a new Proxy for fuchsia.fdomain/Socket.
6424    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6425        let protocol_name = <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6426        Self { client: fidl::client::Client::new(channel, protocol_name) }
6427    }
6428
6429    /// Get a Stream of events from the remote end of the protocol.
6430    ///
6431    /// # Panics
6432    ///
6433    /// Panics if the event stream was already taken.
6434    pub fn take_event_stream(&self) -> SocketEventStream {
6435        SocketEventStream { event_receiver: self.client.take_event_receiver() }
6436    }
6437
6438    pub fn r#create_socket(
6439        &self,
6440        mut options: SocketType,
6441        mut handles: &[NewHandleId; 2],
6442    ) -> fidl::client::QueryResponseFut<
6443        SocketCreateSocketResult,
6444        fidl::encoding::DefaultFuchsiaResourceDialect,
6445    > {
6446        SocketProxyInterface::r#create_socket(self, options, handles)
6447    }
6448
6449    pub fn r#set_socket_disposition(
6450        &self,
6451        mut handle: &HandleId,
6452        mut disposition: SocketDisposition,
6453        mut disposition_peer: SocketDisposition,
6454    ) -> fidl::client::QueryResponseFut<
6455        SocketSetSocketDispositionResult,
6456        fidl::encoding::DefaultFuchsiaResourceDialect,
6457    > {
6458        SocketProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
6459    }
6460
6461    pub fn r#read_socket(
6462        &self,
6463        mut handle: &HandleId,
6464        mut max_bytes: u64,
6465    ) -> fidl::client::QueryResponseFut<
6466        SocketReadSocketResult,
6467        fidl::encoding::DefaultFuchsiaResourceDialect,
6468    > {
6469        SocketProxyInterface::r#read_socket(self, handle, max_bytes)
6470    }
6471
6472    pub fn r#write_socket(
6473        &self,
6474        mut handle: &HandleId,
6475        mut data: &[u8],
6476    ) -> fidl::client::QueryResponseFut<
6477        SocketWriteSocketResult,
6478        fidl::encoding::DefaultFuchsiaResourceDialect,
6479    > {
6480        SocketProxyInterface::r#write_socket(self, handle, data)
6481    }
6482
6483    pub fn r#read_socket_streaming_start(
6484        &self,
6485        mut handle: &HandleId,
6486    ) -> fidl::client::QueryResponseFut<
6487        SocketReadSocketStreamingStartResult,
6488        fidl::encoding::DefaultFuchsiaResourceDialect,
6489    > {
6490        SocketProxyInterface::r#read_socket_streaming_start(self, handle)
6491    }
6492
6493    pub fn r#read_socket_streaming_stop(
6494        &self,
6495        mut handle: &HandleId,
6496    ) -> fidl::client::QueryResponseFut<
6497        SocketReadSocketStreamingStopResult,
6498        fidl::encoding::DefaultFuchsiaResourceDialect,
6499    > {
6500        SocketProxyInterface::r#read_socket_streaming_stop(self, handle)
6501    }
6502}
6503
6504impl SocketProxyInterface for SocketProxy {
6505    type CreateSocketResponseFut = fidl::client::QueryResponseFut<
6506        SocketCreateSocketResult,
6507        fidl::encoding::DefaultFuchsiaResourceDialect,
6508    >;
6509    fn r#create_socket(
6510        &self,
6511        mut options: SocketType,
6512        mut handles: &[NewHandleId; 2],
6513    ) -> Self::CreateSocketResponseFut {
6514        fn _decode(
6515            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6516        ) -> Result<SocketCreateSocketResult, fidl::Error> {
6517            let _response = fidl::client::decode_transaction_body::<
6518                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6519                fidl::encoding::DefaultFuchsiaResourceDialect,
6520                0x200bf0ea21932de0,
6521            >(_buf?)?
6522            .into_result::<SocketMarker>("create_socket")?;
6523            Ok(_response.map(|x| x))
6524        }
6525        self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
6526            (options, handles),
6527            0x200bf0ea21932de0,
6528            fidl::encoding::DynamicFlags::FLEXIBLE,
6529            _decode,
6530        )
6531    }
6532
6533    type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
6534        SocketSetSocketDispositionResult,
6535        fidl::encoding::DefaultFuchsiaResourceDialect,
6536    >;
6537    fn r#set_socket_disposition(
6538        &self,
6539        mut handle: &HandleId,
6540        mut disposition: SocketDisposition,
6541        mut disposition_peer: SocketDisposition,
6542    ) -> Self::SetSocketDispositionResponseFut {
6543        fn _decode(
6544            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6545        ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
6546            let _response = fidl::client::decode_transaction_body::<
6547                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6548                fidl::encoding::DefaultFuchsiaResourceDialect,
6549                0x60d3c7ccb17f9bdf,
6550            >(_buf?)?
6551            .into_result::<SocketMarker>("set_socket_disposition")?;
6552            Ok(_response.map(|x| x))
6553        }
6554        self.client.send_query_and_decode::<
6555            SocketSetSocketDispositionRequest,
6556            SocketSetSocketDispositionResult,
6557        >(
6558            (handle, disposition, disposition_peer,),
6559            0x60d3c7ccb17f9bdf,
6560            fidl::encoding::DynamicFlags::FLEXIBLE,
6561            _decode,
6562        )
6563    }
6564
6565    type ReadSocketResponseFut = fidl::client::QueryResponseFut<
6566        SocketReadSocketResult,
6567        fidl::encoding::DefaultFuchsiaResourceDialect,
6568    >;
6569    fn r#read_socket(
6570        &self,
6571        mut handle: &HandleId,
6572        mut max_bytes: u64,
6573    ) -> Self::ReadSocketResponseFut {
6574        fn _decode(
6575            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6576        ) -> Result<SocketReadSocketResult, fidl::Error> {
6577            let _response = fidl::client::decode_transaction_body::<
6578                fidl::encoding::FlexibleResultType<SocketData, Error>,
6579                fidl::encoding::DefaultFuchsiaResourceDialect,
6580                0x1da8aabec249c02e,
6581            >(_buf?)?
6582            .into_result::<SocketMarker>("read_socket")?;
6583            Ok(_response.map(|x| (x.data, x.is_datagram)))
6584        }
6585        self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
6586            (handle, max_bytes),
6587            0x1da8aabec249c02e,
6588            fidl::encoding::DynamicFlags::FLEXIBLE,
6589            _decode,
6590        )
6591    }
6592
6593    type WriteSocketResponseFut = fidl::client::QueryResponseFut<
6594        SocketWriteSocketResult,
6595        fidl::encoding::DefaultFuchsiaResourceDialect,
6596    >;
6597    fn r#write_socket(
6598        &self,
6599        mut handle: &HandleId,
6600        mut data: &[u8],
6601    ) -> Self::WriteSocketResponseFut {
6602        fn _decode(
6603            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6604        ) -> Result<SocketWriteSocketResult, fidl::Error> {
6605            let _response = fidl::client::decode_transaction_body::<
6606                fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
6607                fidl::encoding::DefaultFuchsiaResourceDialect,
6608                0x5b541623cbbbf683,
6609            >(_buf?)?
6610            .into_result::<SocketMarker>("write_socket")?;
6611            Ok(_response.map(|x| x.wrote))
6612        }
6613        self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
6614            (handle, data),
6615            0x5b541623cbbbf683,
6616            fidl::encoding::DynamicFlags::FLEXIBLE,
6617            _decode,
6618        )
6619    }
6620
6621    type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
6622        SocketReadSocketStreamingStartResult,
6623        fidl::encoding::DefaultFuchsiaResourceDialect,
6624    >;
6625    fn r#read_socket_streaming_start(
6626        &self,
6627        mut handle: &HandleId,
6628    ) -> Self::ReadSocketStreamingStartResponseFut {
6629        fn _decode(
6630            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6631        ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
6632            let _response = fidl::client::decode_transaction_body::<
6633                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6634                fidl::encoding::DefaultFuchsiaResourceDialect,
6635                0x2a592748d5f33445,
6636            >(_buf?)?
6637            .into_result::<SocketMarker>("read_socket_streaming_start")?;
6638            Ok(_response.map(|x| x))
6639        }
6640        self.client.send_query_and_decode::<
6641            SocketReadSocketStreamingStartRequest,
6642            SocketReadSocketStreamingStartResult,
6643        >(
6644            (handle,),
6645            0x2a592748d5f33445,
6646            fidl::encoding::DynamicFlags::FLEXIBLE,
6647            _decode,
6648        )
6649    }
6650
6651    type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
6652        SocketReadSocketStreamingStopResult,
6653        fidl::encoding::DefaultFuchsiaResourceDialect,
6654    >;
6655    fn r#read_socket_streaming_stop(
6656        &self,
6657        mut handle: &HandleId,
6658    ) -> Self::ReadSocketStreamingStopResponseFut {
6659        fn _decode(
6660            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6661        ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
6662            let _response = fidl::client::decode_transaction_body::<
6663                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
6664                fidl::encoding::DefaultFuchsiaResourceDialect,
6665                0x53e5cade5f4d22e7,
6666            >(_buf?)?
6667            .into_result::<SocketMarker>("read_socket_streaming_stop")?;
6668            Ok(_response.map(|x| x))
6669        }
6670        self.client.send_query_and_decode::<
6671            SocketReadSocketStreamingStopRequest,
6672            SocketReadSocketStreamingStopResult,
6673        >(
6674            (handle,),
6675            0x53e5cade5f4d22e7,
6676            fidl::encoding::DynamicFlags::FLEXIBLE,
6677            _decode,
6678        )
6679    }
6680}
6681
6682pub struct SocketEventStream {
6683    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6684}
6685
6686impl std::marker::Unpin for SocketEventStream {}
6687
6688impl futures::stream::FusedStream for SocketEventStream {
6689    fn is_terminated(&self) -> bool {
6690        self.event_receiver.is_terminated()
6691    }
6692}
6693
6694impl futures::Stream for SocketEventStream {
6695    type Item = Result<SocketEvent, fidl::Error>;
6696
6697    fn poll_next(
6698        mut self: std::pin::Pin<&mut Self>,
6699        cx: &mut std::task::Context<'_>,
6700    ) -> std::task::Poll<Option<Self::Item>> {
6701        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6702            &mut self.event_receiver,
6703            cx
6704        )?) {
6705            Some(buf) => std::task::Poll::Ready(Some(SocketEvent::decode(buf))),
6706            None => std::task::Poll::Ready(None),
6707        }
6708    }
6709}
6710
6711#[derive(Debug)]
6712pub enum SocketEvent {
6713    OnSocketStreamingData {
6714        handle: HandleId,
6715        socket_message: SocketMessage,
6716    },
6717    #[non_exhaustive]
6718    _UnknownEvent {
6719        /// Ordinal of the event that was sent.
6720        ordinal: u64,
6721    },
6722}
6723
6724impl SocketEvent {
6725    #[allow(irrefutable_let_patterns)]
6726    pub fn into_on_socket_streaming_data(self) -> Option<(HandleId, SocketMessage)> {
6727        if let SocketEvent::OnSocketStreamingData { handle, socket_message } = self {
6728            Some((handle, socket_message))
6729        } else {
6730            None
6731        }
6732    }
6733
6734    /// Decodes a message buffer as a [`SocketEvent`].
6735    fn decode(
6736        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6737    ) -> Result<SocketEvent, fidl::Error> {
6738        let (bytes, _handles) = buf.split_mut();
6739        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6740        debug_assert_eq!(tx_header.tx_id, 0);
6741        match tx_header.ordinal {
6742            0x998b5e66b3c80a2 => {
6743                let mut out = fidl::new_empty!(
6744                    SocketOnSocketStreamingDataRequest,
6745                    fidl::encoding::DefaultFuchsiaResourceDialect
6746                );
6747                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6748                Ok((SocketEvent::OnSocketStreamingData {
6749                    handle: out.handle,
6750                    socket_message: out.socket_message,
6751                }))
6752            }
6753            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6754                Ok(SocketEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6755            }
6756            _ => Err(fidl::Error::UnknownOrdinal {
6757                ordinal: tx_header.ordinal,
6758                protocol_name: <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6759            }),
6760        }
6761    }
6762}
6763
6764/// A Stream of incoming requests for fuchsia.fdomain/Socket.
6765pub struct SocketRequestStream {
6766    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6767    is_terminated: bool,
6768}
6769
6770impl std::marker::Unpin for SocketRequestStream {}
6771
6772impl futures::stream::FusedStream for SocketRequestStream {
6773    fn is_terminated(&self) -> bool {
6774        self.is_terminated
6775    }
6776}
6777
6778impl fidl::endpoints::RequestStream for SocketRequestStream {
6779    type Protocol = SocketMarker;
6780    type ControlHandle = SocketControlHandle;
6781
6782    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6783        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6784    }
6785
6786    fn control_handle(&self) -> Self::ControlHandle {
6787        SocketControlHandle { inner: self.inner.clone() }
6788    }
6789
6790    fn into_inner(
6791        self,
6792    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6793    {
6794        (self.inner, self.is_terminated)
6795    }
6796
6797    fn from_inner(
6798        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6799        is_terminated: bool,
6800    ) -> Self {
6801        Self { inner, is_terminated }
6802    }
6803}
6804
6805impl futures::Stream for SocketRequestStream {
6806    type Item = Result<SocketRequest, fidl::Error>;
6807
6808    fn poll_next(
6809        mut self: std::pin::Pin<&mut Self>,
6810        cx: &mut std::task::Context<'_>,
6811    ) -> std::task::Poll<Option<Self::Item>> {
6812        let this = &mut *self;
6813        if this.inner.check_shutdown(cx) {
6814            this.is_terminated = true;
6815            return std::task::Poll::Ready(None);
6816        }
6817        if this.is_terminated {
6818            panic!("polled SocketRequestStream after completion");
6819        }
6820        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6821            |bytes, handles| {
6822                match this.inner.channel().read_etc(cx, bytes, handles) {
6823                    std::task::Poll::Ready(Ok(())) => {}
6824                    std::task::Poll::Pending => return std::task::Poll::Pending,
6825                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6826                        this.is_terminated = true;
6827                        return std::task::Poll::Ready(None);
6828                    }
6829                    std::task::Poll::Ready(Err(e)) => {
6830                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6831                            e.into(),
6832                        ))));
6833                    }
6834                }
6835
6836                // A message has been received from the channel
6837                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6838
6839                std::task::Poll::Ready(Some(match header.ordinal {
6840                    0x200bf0ea21932de0 => {
6841                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6842                        let mut req = fidl::new_empty!(
6843                            SocketCreateSocketRequest,
6844                            fidl::encoding::DefaultFuchsiaResourceDialect
6845                        );
6846                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
6847                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6848                        Ok(SocketRequest::CreateSocket {
6849                            options: req.options,
6850                            handles: req.handles,
6851
6852                            responder: SocketCreateSocketResponder {
6853                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6854                                tx_id: header.tx_id,
6855                            },
6856                        })
6857                    }
6858                    0x60d3c7ccb17f9bdf => {
6859                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6860                        let mut req = fidl::new_empty!(
6861                            SocketSetSocketDispositionRequest,
6862                            fidl::encoding::DefaultFuchsiaResourceDialect
6863                        );
6864                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
6865                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6866                        Ok(SocketRequest::SetSocketDisposition {
6867                            handle: req.handle,
6868                            disposition: req.disposition,
6869                            disposition_peer: req.disposition_peer,
6870
6871                            responder: SocketSetSocketDispositionResponder {
6872                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6873                                tx_id: header.tx_id,
6874                            },
6875                        })
6876                    }
6877                    0x1da8aabec249c02e => {
6878                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6879                        let mut req = fidl::new_empty!(
6880                            SocketReadSocketRequest,
6881                            fidl::encoding::DefaultFuchsiaResourceDialect
6882                        );
6883                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
6884                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6885                        Ok(SocketRequest::ReadSocket {
6886                            handle: req.handle,
6887                            max_bytes: req.max_bytes,
6888
6889                            responder: SocketReadSocketResponder {
6890                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6891                                tx_id: header.tx_id,
6892                            },
6893                        })
6894                    }
6895                    0x5b541623cbbbf683 => {
6896                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6897                        let mut req = fidl::new_empty!(
6898                            SocketWriteSocketRequest,
6899                            fidl::encoding::DefaultFuchsiaResourceDialect
6900                        );
6901                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
6902                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6903                        Ok(SocketRequest::WriteSocket {
6904                            handle: req.handle,
6905                            data: req.data,
6906
6907                            responder: SocketWriteSocketResponder {
6908                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6909                                tx_id: header.tx_id,
6910                            },
6911                        })
6912                    }
6913                    0x2a592748d5f33445 => {
6914                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6915                        let mut req = fidl::new_empty!(
6916                            SocketReadSocketStreamingStartRequest,
6917                            fidl::encoding::DefaultFuchsiaResourceDialect
6918                        );
6919                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
6920                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6921                        Ok(SocketRequest::ReadSocketStreamingStart {
6922                            handle: req.handle,
6923
6924                            responder: SocketReadSocketStreamingStartResponder {
6925                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6926                                tx_id: header.tx_id,
6927                            },
6928                        })
6929                    }
6930                    0x53e5cade5f4d22e7 => {
6931                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6932                        let mut req = fidl::new_empty!(
6933                            SocketReadSocketStreamingStopRequest,
6934                            fidl::encoding::DefaultFuchsiaResourceDialect
6935                        );
6936                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
6937                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
6938                        Ok(SocketRequest::ReadSocketStreamingStop {
6939                            handle: req.handle,
6940
6941                            responder: SocketReadSocketStreamingStopResponder {
6942                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6943                                tx_id: header.tx_id,
6944                            },
6945                        })
6946                    }
6947                    _ if header.tx_id == 0
6948                        && header
6949                            .dynamic_flags()
6950                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6951                    {
6952                        Ok(SocketRequest::_UnknownMethod {
6953                            ordinal: header.ordinal,
6954                            control_handle: SocketControlHandle { inner: this.inner.clone() },
6955                            method_type: fidl::MethodType::OneWay,
6956                        })
6957                    }
6958                    _ if header
6959                        .dynamic_flags()
6960                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6961                    {
6962                        this.inner.send_framework_err(
6963                            fidl::encoding::FrameworkErr::UnknownMethod,
6964                            header.tx_id,
6965                            header.ordinal,
6966                            header.dynamic_flags(),
6967                            (bytes, handles),
6968                        )?;
6969                        Ok(SocketRequest::_UnknownMethod {
6970                            ordinal: header.ordinal,
6971                            control_handle: SocketControlHandle { inner: this.inner.clone() },
6972                            method_type: fidl::MethodType::TwoWay,
6973                        })
6974                    }
6975                    _ => Err(fidl::Error::UnknownOrdinal {
6976                        ordinal: header.ordinal,
6977                        protocol_name:
6978                            <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6979                    }),
6980                }))
6981            },
6982        )
6983    }
6984}
6985
6986#[derive(Debug)]
6987pub enum SocketRequest {
6988    CreateSocket {
6989        options: SocketType,
6990        handles: [NewHandleId; 2],
6991        responder: SocketCreateSocketResponder,
6992    },
6993    SetSocketDisposition {
6994        handle: HandleId,
6995        disposition: SocketDisposition,
6996        disposition_peer: SocketDisposition,
6997        responder: SocketSetSocketDispositionResponder,
6998    },
6999    ReadSocket {
7000        handle: HandleId,
7001        max_bytes: u64,
7002        responder: SocketReadSocketResponder,
7003    },
7004    WriteSocket {
7005        handle: HandleId,
7006        data: Vec<u8>,
7007        responder: SocketWriteSocketResponder,
7008    },
7009    ReadSocketStreamingStart {
7010        handle: HandleId,
7011        responder: SocketReadSocketStreamingStartResponder,
7012    },
7013    ReadSocketStreamingStop {
7014        handle: HandleId,
7015        responder: SocketReadSocketStreamingStopResponder,
7016    },
7017    /// An interaction was received which does not match any known method.
7018    #[non_exhaustive]
7019    _UnknownMethod {
7020        /// Ordinal of the method that was called.
7021        ordinal: u64,
7022        control_handle: SocketControlHandle,
7023        method_type: fidl::MethodType,
7024    },
7025}
7026
7027impl SocketRequest {
7028    #[allow(irrefutable_let_patterns)]
7029    pub fn into_create_socket(
7030        self,
7031    ) -> Option<(SocketType, [NewHandleId; 2], SocketCreateSocketResponder)> {
7032        if let SocketRequest::CreateSocket { options, handles, responder } = self {
7033            Some((options, handles, responder))
7034        } else {
7035            None
7036        }
7037    }
7038
7039    #[allow(irrefutable_let_patterns)]
7040    pub fn into_set_socket_disposition(
7041        self,
7042    ) -> Option<(HandleId, SocketDisposition, SocketDisposition, SocketSetSocketDispositionResponder)>
7043    {
7044        if let SocketRequest::SetSocketDisposition {
7045            handle,
7046            disposition,
7047            disposition_peer,
7048            responder,
7049        } = self
7050        {
7051            Some((handle, disposition, disposition_peer, responder))
7052        } else {
7053            None
7054        }
7055    }
7056
7057    #[allow(irrefutable_let_patterns)]
7058    pub fn into_read_socket(self) -> Option<(HandleId, u64, SocketReadSocketResponder)> {
7059        if let SocketRequest::ReadSocket { handle, max_bytes, responder } = self {
7060            Some((handle, max_bytes, responder))
7061        } else {
7062            None
7063        }
7064    }
7065
7066    #[allow(irrefutable_let_patterns)]
7067    pub fn into_write_socket(self) -> Option<(HandleId, Vec<u8>, SocketWriteSocketResponder)> {
7068        if let SocketRequest::WriteSocket { handle, data, responder } = self {
7069            Some((handle, data, responder))
7070        } else {
7071            None
7072        }
7073    }
7074
7075    #[allow(irrefutable_let_patterns)]
7076    pub fn into_read_socket_streaming_start(
7077        self,
7078    ) -> Option<(HandleId, SocketReadSocketStreamingStartResponder)> {
7079        if let SocketRequest::ReadSocketStreamingStart { handle, responder } = self {
7080            Some((handle, responder))
7081        } else {
7082            None
7083        }
7084    }
7085
7086    #[allow(irrefutable_let_patterns)]
7087    pub fn into_read_socket_streaming_stop(
7088        self,
7089    ) -> Option<(HandleId, SocketReadSocketStreamingStopResponder)> {
7090        if let SocketRequest::ReadSocketStreamingStop { handle, responder } = self {
7091            Some((handle, responder))
7092        } else {
7093            None
7094        }
7095    }
7096
7097    /// Name of the method defined in FIDL
7098    pub fn method_name(&self) -> &'static str {
7099        match *self {
7100            SocketRequest::CreateSocket { .. } => "create_socket",
7101            SocketRequest::SetSocketDisposition { .. } => "set_socket_disposition",
7102            SocketRequest::ReadSocket { .. } => "read_socket",
7103            SocketRequest::WriteSocket { .. } => "write_socket",
7104            SocketRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
7105            SocketRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
7106            SocketRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7107                "unknown one-way method"
7108            }
7109            SocketRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7110                "unknown two-way method"
7111            }
7112        }
7113    }
7114}
7115
7116#[derive(Debug, Clone)]
7117pub struct SocketControlHandle {
7118    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7119}
7120
7121impl fidl::endpoints::ControlHandle for SocketControlHandle {
7122    fn shutdown(&self) {
7123        self.inner.shutdown()
7124    }
7125    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7126        self.inner.shutdown_with_epitaph(status)
7127    }
7128
7129    fn is_closed(&self) -> bool {
7130        self.inner.channel().is_closed()
7131    }
7132    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7133        self.inner.channel().on_closed()
7134    }
7135
7136    #[cfg(target_os = "fuchsia")]
7137    fn signal_peer(
7138        &self,
7139        clear_mask: zx::Signals,
7140        set_mask: zx::Signals,
7141    ) -> Result<(), zx_status::Status> {
7142        use fidl::Peered;
7143        self.inner.channel().signal_peer(clear_mask, set_mask)
7144    }
7145}
7146
7147impl SocketControlHandle {
7148    pub fn send_on_socket_streaming_data(
7149        &self,
7150        mut handle: &HandleId,
7151        mut socket_message: &SocketMessage,
7152    ) -> Result<(), fidl::Error> {
7153        self.inner.send::<SocketOnSocketStreamingDataRequest>(
7154            (handle, socket_message),
7155            0,
7156            0x998b5e66b3c80a2,
7157            fidl::encoding::DynamicFlags::FLEXIBLE,
7158        )
7159    }
7160}
7161
7162#[must_use = "FIDL methods require a response to be sent"]
7163#[derive(Debug)]
7164pub struct SocketCreateSocketResponder {
7165    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7166    tx_id: u32,
7167}
7168
7169/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7170/// if the responder is dropped without sending a response, so that the client
7171/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7172impl std::ops::Drop for SocketCreateSocketResponder {
7173    fn drop(&mut self) {
7174        self.control_handle.shutdown();
7175        // Safety: drops once, never accessed again
7176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7177    }
7178}
7179
7180impl fidl::endpoints::Responder for SocketCreateSocketResponder {
7181    type ControlHandle = SocketControlHandle;
7182
7183    fn control_handle(&self) -> &SocketControlHandle {
7184        &self.control_handle
7185    }
7186
7187    fn drop_without_shutdown(mut self) {
7188        // Safety: drops once, never accessed again due to mem::forget
7189        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7190        // Prevent Drop from running (which would shut down the channel)
7191        std::mem::forget(self);
7192    }
7193}
7194
7195impl SocketCreateSocketResponder {
7196    /// Sends a response to the FIDL transaction.
7197    ///
7198    /// Sets the channel to shutdown if an error occurs.
7199    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7200        let _result = self.send_raw(result);
7201        if _result.is_err() {
7202            self.control_handle.shutdown();
7203        }
7204        self.drop_without_shutdown();
7205        _result
7206    }
7207
7208    /// Similar to "send" but does not shutdown the channel if an error occurs.
7209    pub fn send_no_shutdown_on_err(
7210        self,
7211        mut result: Result<(), &Error>,
7212    ) -> Result<(), fidl::Error> {
7213        let _result = self.send_raw(result);
7214        self.drop_without_shutdown();
7215        _result
7216    }
7217
7218    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7219        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7220            fidl::encoding::EmptyStruct,
7221            Error,
7222        >>(
7223            fidl::encoding::FlexibleResult::new(result),
7224            self.tx_id,
7225            0x200bf0ea21932de0,
7226            fidl::encoding::DynamicFlags::FLEXIBLE,
7227        )
7228    }
7229}
7230
7231#[must_use = "FIDL methods require a response to be sent"]
7232#[derive(Debug)]
7233pub struct SocketSetSocketDispositionResponder {
7234    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7235    tx_id: u32,
7236}
7237
7238/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7239/// if the responder is dropped without sending a response, so that the client
7240/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7241impl std::ops::Drop for SocketSetSocketDispositionResponder {
7242    fn drop(&mut self) {
7243        self.control_handle.shutdown();
7244        // Safety: drops once, never accessed again
7245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7246    }
7247}
7248
7249impl fidl::endpoints::Responder for SocketSetSocketDispositionResponder {
7250    type ControlHandle = SocketControlHandle;
7251
7252    fn control_handle(&self) -> &SocketControlHandle {
7253        &self.control_handle
7254    }
7255
7256    fn drop_without_shutdown(mut self) {
7257        // Safety: drops once, never accessed again due to mem::forget
7258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7259        // Prevent Drop from running (which would shut down the channel)
7260        std::mem::forget(self);
7261    }
7262}
7263
7264impl SocketSetSocketDispositionResponder {
7265    /// Sends a response to the FIDL transaction.
7266    ///
7267    /// Sets the channel to shutdown if an error occurs.
7268    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7269        let _result = self.send_raw(result);
7270        if _result.is_err() {
7271            self.control_handle.shutdown();
7272        }
7273        self.drop_without_shutdown();
7274        _result
7275    }
7276
7277    /// Similar to "send" but does not shutdown the channel if an error occurs.
7278    pub fn send_no_shutdown_on_err(
7279        self,
7280        mut result: Result<(), &Error>,
7281    ) -> Result<(), fidl::Error> {
7282        let _result = self.send_raw(result);
7283        self.drop_without_shutdown();
7284        _result
7285    }
7286
7287    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7288        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7289            fidl::encoding::EmptyStruct,
7290            Error,
7291        >>(
7292            fidl::encoding::FlexibleResult::new(result),
7293            self.tx_id,
7294            0x60d3c7ccb17f9bdf,
7295            fidl::encoding::DynamicFlags::FLEXIBLE,
7296        )
7297    }
7298}
7299
7300#[must_use = "FIDL methods require a response to be sent"]
7301#[derive(Debug)]
7302pub struct SocketReadSocketResponder {
7303    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7304    tx_id: u32,
7305}
7306
7307/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7308/// if the responder is dropped without sending a response, so that the client
7309/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7310impl std::ops::Drop for SocketReadSocketResponder {
7311    fn drop(&mut self) {
7312        self.control_handle.shutdown();
7313        // Safety: drops once, never accessed again
7314        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7315    }
7316}
7317
7318impl fidl::endpoints::Responder for SocketReadSocketResponder {
7319    type ControlHandle = SocketControlHandle;
7320
7321    fn control_handle(&self) -> &SocketControlHandle {
7322        &self.control_handle
7323    }
7324
7325    fn drop_without_shutdown(mut self) {
7326        // Safety: drops once, never accessed again due to mem::forget
7327        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7328        // Prevent Drop from running (which would shut down the channel)
7329        std::mem::forget(self);
7330    }
7331}
7332
7333impl SocketReadSocketResponder {
7334    /// Sends a response to the FIDL transaction.
7335    ///
7336    /// Sets the channel to shutdown if an error occurs.
7337    pub fn send(self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
7338        let _result = self.send_raw(result);
7339        if _result.is_err() {
7340            self.control_handle.shutdown();
7341        }
7342        self.drop_without_shutdown();
7343        _result
7344    }
7345
7346    /// Similar to "send" but does not shutdown the channel if an error occurs.
7347    pub fn send_no_shutdown_on_err(
7348        self,
7349        mut result: Result<(&[u8], bool), &Error>,
7350    ) -> Result<(), fidl::Error> {
7351        let _result = self.send_raw(result);
7352        self.drop_without_shutdown();
7353        _result
7354    }
7355
7356    fn send_raw(&self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
7357        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<SocketData, Error>>(
7358            fidl::encoding::FlexibleResult::new(result),
7359            self.tx_id,
7360            0x1da8aabec249c02e,
7361            fidl::encoding::DynamicFlags::FLEXIBLE,
7362        )
7363    }
7364}
7365
7366#[must_use = "FIDL methods require a response to be sent"]
7367#[derive(Debug)]
7368pub struct SocketWriteSocketResponder {
7369    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7370    tx_id: u32,
7371}
7372
7373/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7374/// if the responder is dropped without sending a response, so that the client
7375/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7376impl std::ops::Drop for SocketWriteSocketResponder {
7377    fn drop(&mut self) {
7378        self.control_handle.shutdown();
7379        // Safety: drops once, never accessed again
7380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7381    }
7382}
7383
7384impl fidl::endpoints::Responder for SocketWriteSocketResponder {
7385    type ControlHandle = SocketControlHandle;
7386
7387    fn control_handle(&self) -> &SocketControlHandle {
7388        &self.control_handle
7389    }
7390
7391    fn drop_without_shutdown(mut self) {
7392        // Safety: drops once, never accessed again due to mem::forget
7393        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7394        // Prevent Drop from running (which would shut down the channel)
7395        std::mem::forget(self);
7396    }
7397}
7398
7399impl SocketWriteSocketResponder {
7400    /// Sends a response to the FIDL transaction.
7401    ///
7402    /// Sets the channel to shutdown if an error occurs.
7403    pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
7404        let _result = self.send_raw(result);
7405        if _result.is_err() {
7406            self.control_handle.shutdown();
7407        }
7408        self.drop_without_shutdown();
7409        _result
7410    }
7411
7412    /// Similar to "send" but does not shutdown the channel if an error occurs.
7413    pub fn send_no_shutdown_on_err(
7414        self,
7415        mut result: Result<u64, &WriteSocketError>,
7416    ) -> Result<(), fidl::Error> {
7417        let _result = self.send_raw(result);
7418        self.drop_without_shutdown();
7419        _result
7420    }
7421
7422    fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
7423        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7424            SocketWriteSocketResponse,
7425            WriteSocketError,
7426        >>(
7427            fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
7428            self.tx_id,
7429            0x5b541623cbbbf683,
7430            fidl::encoding::DynamicFlags::FLEXIBLE,
7431        )
7432    }
7433}
7434
7435#[must_use = "FIDL methods require a response to be sent"]
7436#[derive(Debug)]
7437pub struct SocketReadSocketStreamingStartResponder {
7438    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7439    tx_id: u32,
7440}
7441
7442/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7443/// if the responder is dropped without sending a response, so that the client
7444/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7445impl std::ops::Drop for SocketReadSocketStreamingStartResponder {
7446    fn drop(&mut self) {
7447        self.control_handle.shutdown();
7448        // Safety: drops once, never accessed again
7449        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7450    }
7451}
7452
7453impl fidl::endpoints::Responder for SocketReadSocketStreamingStartResponder {
7454    type ControlHandle = SocketControlHandle;
7455
7456    fn control_handle(&self) -> &SocketControlHandle {
7457        &self.control_handle
7458    }
7459
7460    fn drop_without_shutdown(mut self) {
7461        // Safety: drops once, never accessed again due to mem::forget
7462        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7463        // Prevent Drop from running (which would shut down the channel)
7464        std::mem::forget(self);
7465    }
7466}
7467
7468impl SocketReadSocketStreamingStartResponder {
7469    /// Sends a response to the FIDL transaction.
7470    ///
7471    /// Sets the channel to shutdown if an error occurs.
7472    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7473        let _result = self.send_raw(result);
7474        if _result.is_err() {
7475            self.control_handle.shutdown();
7476        }
7477        self.drop_without_shutdown();
7478        _result
7479    }
7480
7481    /// Similar to "send" but does not shutdown the channel if an error occurs.
7482    pub fn send_no_shutdown_on_err(
7483        self,
7484        mut result: Result<(), &Error>,
7485    ) -> Result<(), fidl::Error> {
7486        let _result = self.send_raw(result);
7487        self.drop_without_shutdown();
7488        _result
7489    }
7490
7491    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7492        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7493            fidl::encoding::EmptyStruct,
7494            Error,
7495        >>(
7496            fidl::encoding::FlexibleResult::new(result),
7497            self.tx_id,
7498            0x2a592748d5f33445,
7499            fidl::encoding::DynamicFlags::FLEXIBLE,
7500        )
7501    }
7502}
7503
7504#[must_use = "FIDL methods require a response to be sent"]
7505#[derive(Debug)]
7506pub struct SocketReadSocketStreamingStopResponder {
7507    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
7508    tx_id: u32,
7509}
7510
7511/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
7512/// if the responder is dropped without sending a response, so that the client
7513/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7514impl std::ops::Drop for SocketReadSocketStreamingStopResponder {
7515    fn drop(&mut self) {
7516        self.control_handle.shutdown();
7517        // Safety: drops once, never accessed again
7518        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7519    }
7520}
7521
7522impl fidl::endpoints::Responder for SocketReadSocketStreamingStopResponder {
7523    type ControlHandle = SocketControlHandle;
7524
7525    fn control_handle(&self) -> &SocketControlHandle {
7526        &self.control_handle
7527    }
7528
7529    fn drop_without_shutdown(mut self) {
7530        // Safety: drops once, never accessed again due to mem::forget
7531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7532        // Prevent Drop from running (which would shut down the channel)
7533        std::mem::forget(self);
7534    }
7535}
7536
7537impl SocketReadSocketStreamingStopResponder {
7538    /// Sends a response to the FIDL transaction.
7539    ///
7540    /// Sets the channel to shutdown if an error occurs.
7541    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7542        let _result = self.send_raw(result);
7543        if _result.is_err() {
7544            self.control_handle.shutdown();
7545        }
7546        self.drop_without_shutdown();
7547        _result
7548    }
7549
7550    /// Similar to "send" but does not shutdown the channel if an error occurs.
7551    pub fn send_no_shutdown_on_err(
7552        self,
7553        mut result: Result<(), &Error>,
7554    ) -> Result<(), fidl::Error> {
7555        let _result = self.send_raw(result);
7556        self.drop_without_shutdown();
7557        _result
7558    }
7559
7560    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7561        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7562            fidl::encoding::EmptyStruct,
7563            Error,
7564        >>(
7565            fidl::encoding::FlexibleResult::new(result),
7566            self.tx_id,
7567            0x53e5cade5f4d22e7,
7568            fidl::encoding::DynamicFlags::FLEXIBLE,
7569        )
7570    }
7571}
7572
7573mod internal {
7574    use super::*;
7575}