Skip to main content

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