fidl_fuchsia_fdomain/
fidl_fuchsia_fdomain.rs

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