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