fidl_fuchsia_fdomain/
fidl_fuchsia_fdomain.rs

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