Skip to main content

fidl_fuchsia_fdomain/
fidl_fuchsia_fdomain.rs

1// WARNING: This file is machine generated by fidlgen.
2
3// fidl_experiment = allow_arbitrary_error_types
4// fidl_experiment = no_resource_attribute
5
6#![warn(clippy::all)]
7#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
8
9use bitflags::bitflags;
10use fidl::client::QueryResponseFut;
11use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
12use fidl::endpoints::{ControlHandle as _, Responder as _};
13pub use fidl_fuchsia_fdomain_common::*;
14use futures::future::{self, MaybeDone, TryFutureExt};
15use zx_status;
16
17#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
18pub struct ChannelMarker;
19
20impl fidl::endpoints::ProtocolMarker for ChannelMarker {
21    type Proxy = ChannelProxy;
22    type RequestStream = ChannelRequestStream;
23    #[cfg(target_os = "fuchsia")]
24    type SynchronousProxy = ChannelSynchronousProxy;
25
26    const DEBUG_NAME: &'static str = "(anonymous) Channel";
27}
28pub type ChannelCreateChannelResult = Result<(), Error>;
29pub type ChannelReadChannelResult = Result<(Vec<u8>, Vec<HandleInfo>), Error>;
30pub type ChannelWriteChannelResult = Result<(), WriteChannelError>;
31pub type ChannelReadChannelStreamingStartResult = Result<(), Error>;
32pub type ChannelReadChannelStreamingStopResult = Result<(), Error>;
33
34pub trait ChannelProxyInterface: Send + Sync {
35    type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
36        + Send;
37    fn r#create_channel(&self, handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut;
38    type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
39        + Send;
40    fn r#read_channel(&self, handle: &HandleId) -> Self::ReadChannelResponseFut;
41    type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
42        + Send;
43    fn r#write_channel(
44        &self,
45        handle: &HandleId,
46        data: &[u8],
47        handles: &Handles,
48    ) -> Self::WriteChannelResponseFut;
49    type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
50        + Send;
51    fn r#read_channel_streaming_start(
52        &self,
53        handle: &HandleId,
54    ) -> Self::ReadChannelStreamingStartResponseFut;
55    type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
56        + Send;
57    fn r#read_channel_streaming_stop(
58        &self,
59        handle: &HandleId,
60    ) -> Self::ReadChannelStreamingStopResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct ChannelSynchronousProxy {
65    client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for ChannelSynchronousProxy {
70    type Proxy = ChannelProxy;
71    type Protocol = ChannelMarker;
72
73    fn from_channel(inner: fidl::Channel) -> Self {
74        Self::new(inner)
75    }
76
77    fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    fn as_channel(&self) -> &fidl::Channel {
82        self.client.as_channel()
83    }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl ChannelSynchronousProxy {
88    pub fn new(channel: fidl::Channel) -> Self {
89        Self { client: fidl::client::sync::Client::new(channel) }
90    }
91
92    pub fn into_channel(self) -> fidl::Channel {
93        self.client.into_channel()
94    }
95
96    /// Waits until an event arrives and returns it. It is safe for other
97    /// threads to make concurrent requests while waiting for an event.
98    pub fn wait_for_event(
99        &self,
100        deadline: zx::MonotonicInstant,
101    ) -> Result<ChannelEvent, fidl::Error> {
102        ChannelEvent::decode(self.client.wait_for_event::<ChannelMarker>(deadline)?)
103    }
104
105    /// Create a new channel in this FDomain and return both its ends.
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            ChannelMarker,
115        >(
116            (handles,),
117            0x182d38bfe88673b5,
118            fidl::encoding::DynamicFlags::FLEXIBLE,
119            ___deadline,
120        )?
121        .into_result::<ChannelMarker>("create_channel")?;
122        Ok(_response.map(|x| x))
123    }
124
125    /// Read a message from a channel. This method will fail if the channel is currently being read
126    /// using the streaming read functions.
127    ///
128    /// Note that this method is not like zx_channel_read in that it will not
129    /// return `SHOULD_WAIT` but will instead delay returning until there is data
130    /// to return.
131    pub fn r#read_channel(
132        &self,
133        mut handle: &HandleId,
134        ___deadline: zx::MonotonicInstant,
135    ) -> Result<ChannelReadChannelResult, fidl::Error> {
136        let _response = self.client.send_query::<
137            ChannelReadChannelRequest,
138            fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
139            ChannelMarker,
140        >(
141            (handle,),
142            0x6ef47bf27bf7d050,
143            fidl::encoding::DynamicFlags::FLEXIBLE,
144            ___deadline,
145        )?
146        .into_result::<ChannelMarker>("read_channel")?;
147        Ok(_response.map(|x| (x.data, x.handles)))
148    }
149
150    /// Write to a channel. Handles are always consumed.
151    pub fn r#write_channel(
152        &self,
153        mut handle: &HandleId,
154        mut data: &[u8],
155        mut handles: &Handles,
156        ___deadline: zx::MonotonicInstant,
157    ) -> Result<ChannelWriteChannelResult, fidl::Error> {
158        let _response = self.client.send_query::<
159            ChannelWriteChannelRequest,
160            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
161            ChannelMarker,
162        >(
163            (handle, data, handles,),
164            0x75a2559b945d5eb5,
165            fidl::encoding::DynamicFlags::FLEXIBLE,
166            ___deadline,
167        )?
168        .into_result::<ChannelMarker>("write_channel")?;
169        Ok(_response.map(|x| x))
170    }
171
172    /// Starts reading from the given channel. Data is returned via the `ChannelStreamingData` event.
173    /// That event will occur repeatedly until `ReadChannelStreamingStop` is called for the same handle
174    /// or the event indicates the handle is closed.
175    pub fn r#read_channel_streaming_start(
176        &self,
177        mut handle: &HandleId,
178        ___deadline: zx::MonotonicInstant,
179    ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
180        let _response = self.client.send_query::<
181            ChannelReadChannelStreamingStartRequest,
182            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
183            ChannelMarker,
184        >(
185            (handle,),
186            0x3c73e85476a203df,
187            fidl::encoding::DynamicFlags::FLEXIBLE,
188            ___deadline,
189        )?
190        .into_result::<ChannelMarker>("read_channel_streaming_start")?;
191        Ok(_response.map(|x| x))
192    }
193
194    /// Stop asynchronous reading from the given channel.
195    pub fn r#read_channel_streaming_stop(
196        &self,
197        mut handle: &HandleId,
198        ___deadline: zx::MonotonicInstant,
199    ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
200        let _response = self.client.send_query::<
201            ChannelReadChannelStreamingStopRequest,
202            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
203            ChannelMarker,
204        >(
205            (handle,),
206            0x56f21d6ed68186e0,
207            fidl::encoding::DynamicFlags::FLEXIBLE,
208            ___deadline,
209        )?
210        .into_result::<ChannelMarker>("read_channel_streaming_stop")?;
211        Ok(_response.map(|x| x))
212    }
213}
214
215#[cfg(target_os = "fuchsia")]
216impl From<ChannelSynchronousProxy> for zx::NullableHandle {
217    fn from(value: ChannelSynchronousProxy) -> Self {
218        value.into_channel().into()
219    }
220}
221
222#[cfg(target_os = "fuchsia")]
223impl From<fidl::Channel> for ChannelSynchronousProxy {
224    fn from(value: fidl::Channel) -> Self {
225        Self::new(value)
226    }
227}
228
229#[cfg(target_os = "fuchsia")]
230impl fidl::endpoints::FromClient for ChannelSynchronousProxy {
231    type Protocol = ChannelMarker;
232
233    fn from_client(value: fidl::endpoints::ClientEnd<ChannelMarker>) -> Self {
234        Self::new(value.into_channel())
235    }
236}
237
238#[derive(Debug, Clone)]
239pub struct ChannelProxy {
240    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
241}
242
243impl fidl::endpoints::Proxy for ChannelProxy {
244    type Protocol = ChannelMarker;
245
246    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
247        Self::new(inner)
248    }
249
250    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
251        self.client.into_channel().map_err(|client| Self { client })
252    }
253
254    fn as_channel(&self) -> &::fidl::AsyncChannel {
255        self.client.as_channel()
256    }
257}
258
259impl ChannelProxy {
260    /// Create a new Proxy for fuchsia.fdomain/Channel.
261    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
262        let protocol_name = <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
263        Self { client: fidl::client::Client::new(channel, protocol_name) }
264    }
265
266    /// Get a Stream of events from the remote end of the protocol.
267    ///
268    /// # Panics
269    ///
270    /// Panics if the event stream was already taken.
271    pub fn take_event_stream(&self) -> ChannelEventStream {
272        ChannelEventStream { event_receiver: self.client.take_event_receiver() }
273    }
274
275    /// Create a new channel in this FDomain and return both its ends.
276    pub fn r#create_channel(
277        &self,
278        mut handles: &[NewHandleId; 2],
279    ) -> fidl::client::QueryResponseFut<
280        ChannelCreateChannelResult,
281        fidl::encoding::DefaultFuchsiaResourceDialect,
282    > {
283        ChannelProxyInterface::r#create_channel(self, handles)
284    }
285
286    /// Read a message from a channel. This method will fail if the channel is currently being read
287    /// using the streaming read functions.
288    ///
289    /// Note that this method is not like zx_channel_read in that it will not
290    /// return `SHOULD_WAIT` but will instead delay returning until there is data
291    /// to return.
292    pub fn r#read_channel(
293        &self,
294        mut handle: &HandleId,
295    ) -> fidl::client::QueryResponseFut<
296        ChannelReadChannelResult,
297        fidl::encoding::DefaultFuchsiaResourceDialect,
298    > {
299        ChannelProxyInterface::r#read_channel(self, handle)
300    }
301
302    /// Write to a channel. Handles are always consumed.
303    pub fn r#write_channel(
304        &self,
305        mut handle: &HandleId,
306        mut data: &[u8],
307        mut handles: &Handles,
308    ) -> fidl::client::QueryResponseFut<
309        ChannelWriteChannelResult,
310        fidl::encoding::DefaultFuchsiaResourceDialect,
311    > {
312        ChannelProxyInterface::r#write_channel(self, handle, data, handles)
313    }
314
315    /// Starts reading from the given channel. Data is returned via the `ChannelStreamingData` event.
316    /// That event will occur repeatedly until `ReadChannelStreamingStop` is called for the same handle
317    /// or the event indicates the handle is closed.
318    pub fn r#read_channel_streaming_start(
319        &self,
320        mut handle: &HandleId,
321    ) -> fidl::client::QueryResponseFut<
322        ChannelReadChannelStreamingStartResult,
323        fidl::encoding::DefaultFuchsiaResourceDialect,
324    > {
325        ChannelProxyInterface::r#read_channel_streaming_start(self, handle)
326    }
327
328    /// Stop asynchronous reading from the given channel.
329    pub fn r#read_channel_streaming_stop(
330        &self,
331        mut handle: &HandleId,
332    ) -> fidl::client::QueryResponseFut<
333        ChannelReadChannelStreamingStopResult,
334        fidl::encoding::DefaultFuchsiaResourceDialect,
335    > {
336        ChannelProxyInterface::r#read_channel_streaming_stop(self, handle)
337    }
338}
339
340impl ChannelProxyInterface for ChannelProxy {
341    type CreateChannelResponseFut = fidl::client::QueryResponseFut<
342        ChannelCreateChannelResult,
343        fidl::encoding::DefaultFuchsiaResourceDialect,
344    >;
345    fn r#create_channel(&self, mut handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut {
346        fn _decode(
347            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
348        ) -> Result<ChannelCreateChannelResult, fidl::Error> {
349            let _response = fidl::client::decode_transaction_body::<
350                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
351                fidl::encoding::DefaultFuchsiaResourceDialect,
352                0x182d38bfe88673b5,
353            >(_buf?)?
354            .into_result::<ChannelMarker>("create_channel")?;
355            Ok(_response.map(|x| x))
356        }
357        self.client
358            .send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
359                (handles,),
360                0x182d38bfe88673b5,
361                fidl::encoding::DynamicFlags::FLEXIBLE,
362                _decode,
363            )
364    }
365
366    type ReadChannelResponseFut = fidl::client::QueryResponseFut<
367        ChannelReadChannelResult,
368        fidl::encoding::DefaultFuchsiaResourceDialect,
369    >;
370    fn r#read_channel(&self, mut handle: &HandleId) -> Self::ReadChannelResponseFut {
371        fn _decode(
372            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
373        ) -> Result<ChannelReadChannelResult, fidl::Error> {
374            let _response = fidl::client::decode_transaction_body::<
375                fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
376                fidl::encoding::DefaultFuchsiaResourceDialect,
377                0x6ef47bf27bf7d050,
378            >(_buf?)?
379            .into_result::<ChannelMarker>("read_channel")?;
380            Ok(_response.map(|x| (x.data, x.handles)))
381        }
382        self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
383            (handle,),
384            0x6ef47bf27bf7d050,
385            fidl::encoding::DynamicFlags::FLEXIBLE,
386            _decode,
387        )
388    }
389
390    type WriteChannelResponseFut = fidl::client::QueryResponseFut<
391        ChannelWriteChannelResult,
392        fidl::encoding::DefaultFuchsiaResourceDialect,
393    >;
394    fn r#write_channel(
395        &self,
396        mut handle: &HandleId,
397        mut data: &[u8],
398        mut handles: &Handles,
399    ) -> Self::WriteChannelResponseFut {
400        fn _decode(
401            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
402        ) -> Result<ChannelWriteChannelResult, fidl::Error> {
403            let _response = fidl::client::decode_transaction_body::<
404                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
405                fidl::encoding::DefaultFuchsiaResourceDialect,
406                0x75a2559b945d5eb5,
407            >(_buf?)?
408            .into_result::<ChannelMarker>("write_channel")?;
409            Ok(_response.map(|x| x))
410        }
411        self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
412            (handle, data, handles),
413            0x75a2559b945d5eb5,
414            fidl::encoding::DynamicFlags::FLEXIBLE,
415            _decode,
416        )
417    }
418
419    type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
420        ChannelReadChannelStreamingStartResult,
421        fidl::encoding::DefaultFuchsiaResourceDialect,
422    >;
423    fn r#read_channel_streaming_start(
424        &self,
425        mut handle: &HandleId,
426    ) -> Self::ReadChannelStreamingStartResponseFut {
427        fn _decode(
428            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
429        ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
430            let _response = fidl::client::decode_transaction_body::<
431                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
432                fidl::encoding::DefaultFuchsiaResourceDialect,
433                0x3c73e85476a203df,
434            >(_buf?)?
435            .into_result::<ChannelMarker>("read_channel_streaming_start")?;
436            Ok(_response.map(|x| x))
437        }
438        self.client.send_query_and_decode::<
439            ChannelReadChannelStreamingStartRequest,
440            ChannelReadChannelStreamingStartResult,
441        >(
442            (handle,),
443            0x3c73e85476a203df,
444            fidl::encoding::DynamicFlags::FLEXIBLE,
445            _decode,
446        )
447    }
448
449    type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
450        ChannelReadChannelStreamingStopResult,
451        fidl::encoding::DefaultFuchsiaResourceDialect,
452    >;
453    fn r#read_channel_streaming_stop(
454        &self,
455        mut handle: &HandleId,
456    ) -> Self::ReadChannelStreamingStopResponseFut {
457        fn _decode(
458            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
459        ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
460            let _response = fidl::client::decode_transaction_body::<
461                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
462                fidl::encoding::DefaultFuchsiaResourceDialect,
463                0x56f21d6ed68186e0,
464            >(_buf?)?
465            .into_result::<ChannelMarker>("read_channel_streaming_stop")?;
466            Ok(_response.map(|x| x))
467        }
468        self.client.send_query_and_decode::<
469            ChannelReadChannelStreamingStopRequest,
470            ChannelReadChannelStreamingStopResult,
471        >(
472            (handle,),
473            0x56f21d6ed68186e0,
474            fidl::encoding::DynamicFlags::FLEXIBLE,
475            _decode,
476        )
477    }
478}
479
480pub struct ChannelEventStream {
481    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
482}
483
484impl std::marker::Unpin for ChannelEventStream {}
485
486impl futures::stream::FusedStream for ChannelEventStream {
487    fn is_terminated(&self) -> bool {
488        self.event_receiver.is_terminated()
489    }
490}
491
492impl futures::Stream for ChannelEventStream {
493    type Item = Result<ChannelEvent, fidl::Error>;
494
495    fn poll_next(
496        mut self: std::pin::Pin<&mut Self>,
497        cx: &mut std::task::Context<'_>,
498    ) -> std::task::Poll<Option<Self::Item>> {
499        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
500            &mut self.event_receiver,
501            cx
502        )?) {
503            Some(buf) => std::task::Poll::Ready(Some(ChannelEvent::decode(buf))),
504            None => std::task::Poll::Ready(None),
505        }
506    }
507}
508
509#[derive(Debug)]
510pub enum ChannelEvent {
511    OnChannelStreamingData {
512        handle: HandleId,
513        channel_sent: ChannelSent,
514    },
515    #[non_exhaustive]
516    _UnknownEvent {
517        /// Ordinal of the event that was sent.
518        ordinal: u64,
519    },
520}
521
522impl ChannelEvent {
523    #[allow(irrefutable_let_patterns)]
524    pub fn into_on_channel_streaming_data(self) -> Option<(HandleId, ChannelSent)> {
525        if let ChannelEvent::OnChannelStreamingData { handle, channel_sent } = self {
526            Some((handle, channel_sent))
527        } else {
528            None
529        }
530    }
531
532    /// Decodes a message buffer as a [`ChannelEvent`].
533    fn decode(
534        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
535    ) -> Result<ChannelEvent, fidl::Error> {
536        let (bytes, _handles) = buf.split_mut();
537        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
538        debug_assert_eq!(tx_header.tx_id, 0);
539        match tx_header.ordinal {
540            0x7d4431805202dfe1 => {
541                let mut out = fidl::new_empty!(
542                    ChannelOnChannelStreamingDataRequest,
543                    fidl::encoding::DefaultFuchsiaResourceDialect
544                );
545                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
546                Ok((ChannelEvent::OnChannelStreamingData {
547                    handle: out.handle,
548                    channel_sent: out.channel_sent,
549                }))
550            }
551            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
552                Ok(ChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
553            }
554            _ => Err(fidl::Error::UnknownOrdinal {
555                ordinal: tx_header.ordinal,
556                protocol_name: <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
557            }),
558        }
559    }
560}
561
562/// A Stream of incoming requests for fuchsia.fdomain/Channel.
563pub struct ChannelRequestStream {
564    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
565    is_terminated: bool,
566}
567
568impl std::marker::Unpin for ChannelRequestStream {}
569
570impl futures::stream::FusedStream for ChannelRequestStream {
571    fn is_terminated(&self) -> bool {
572        self.is_terminated
573    }
574}
575
576impl fidl::endpoints::RequestStream for ChannelRequestStream {
577    type Protocol = ChannelMarker;
578    type ControlHandle = ChannelControlHandle;
579
580    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
581        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
582    }
583
584    fn control_handle(&self) -> Self::ControlHandle {
585        ChannelControlHandle { inner: self.inner.clone() }
586    }
587
588    fn into_inner(
589        self,
590    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
591    {
592        (self.inner, self.is_terminated)
593    }
594
595    fn from_inner(
596        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
597        is_terminated: bool,
598    ) -> Self {
599        Self { inner, is_terminated }
600    }
601}
602
603impl futures::Stream for ChannelRequestStream {
604    type Item = Result<ChannelRequest, fidl::Error>;
605
606    fn poll_next(
607        mut self: std::pin::Pin<&mut Self>,
608        cx: &mut std::task::Context<'_>,
609    ) -> std::task::Poll<Option<Self::Item>> {
610        let this = &mut *self;
611        if this.inner.check_shutdown(cx) {
612            this.is_terminated = true;
613            return std::task::Poll::Ready(None);
614        }
615        if this.is_terminated {
616            panic!("polled ChannelRequestStream after completion");
617        }
618        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
619            |bytes, handles| {
620                match this.inner.channel().read_etc(cx, bytes, handles) {
621                    std::task::Poll::Ready(Ok(())) => {}
622                    std::task::Poll::Pending => return std::task::Poll::Pending,
623                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
624                        this.is_terminated = true;
625                        return std::task::Poll::Ready(None);
626                    }
627                    std::task::Poll::Ready(Err(e)) => {
628                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
629                            e.into(),
630                        ))));
631                    }
632                }
633
634                // A message has been received from the channel
635                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
636
637                std::task::Poll::Ready(Some(match header.ordinal {
638                    0x182d38bfe88673b5 => {
639                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
640                        let mut req = fidl::new_empty!(
641                            ChannelCreateChannelRequest,
642                            fidl::encoding::DefaultFuchsiaResourceDialect
643                        );
644                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
645                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
646                        Ok(ChannelRequest::CreateChannel {
647                            handles: req.handles,
648
649                            responder: ChannelCreateChannelResponder {
650                                control_handle: std::mem::ManuallyDrop::new(control_handle),
651                                tx_id: header.tx_id,
652                            },
653                        })
654                    }
655                    0x6ef47bf27bf7d050 => {
656                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
657                        let mut req = fidl::new_empty!(
658                            ChannelReadChannelRequest,
659                            fidl::encoding::DefaultFuchsiaResourceDialect
660                        );
661                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
662                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
663                        Ok(ChannelRequest::ReadChannel {
664                            handle: req.handle,
665
666                            responder: ChannelReadChannelResponder {
667                                control_handle: std::mem::ManuallyDrop::new(control_handle),
668                                tx_id: header.tx_id,
669                            },
670                        })
671                    }
672                    0x75a2559b945d5eb5 => {
673                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
674                        let mut req = fidl::new_empty!(
675                            ChannelWriteChannelRequest,
676                            fidl::encoding::DefaultFuchsiaResourceDialect
677                        );
678                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
679                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
680                        Ok(ChannelRequest::WriteChannel {
681                            handle: req.handle,
682                            data: req.data,
683                            handles: req.handles,
684
685                            responder: ChannelWriteChannelResponder {
686                                control_handle: std::mem::ManuallyDrop::new(control_handle),
687                                tx_id: header.tx_id,
688                            },
689                        })
690                    }
691                    0x3c73e85476a203df => {
692                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
693                        let mut req = fidl::new_empty!(
694                            ChannelReadChannelStreamingStartRequest,
695                            fidl::encoding::DefaultFuchsiaResourceDialect
696                        );
697                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
698                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
699                        Ok(ChannelRequest::ReadChannelStreamingStart {
700                            handle: req.handle,
701
702                            responder: ChannelReadChannelStreamingStartResponder {
703                                control_handle: std::mem::ManuallyDrop::new(control_handle),
704                                tx_id: header.tx_id,
705                            },
706                        })
707                    }
708                    0x56f21d6ed68186e0 => {
709                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
710                        let mut req = fidl::new_empty!(
711                            ChannelReadChannelStreamingStopRequest,
712                            fidl::encoding::DefaultFuchsiaResourceDialect
713                        );
714                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
715                        let control_handle = ChannelControlHandle { inner: this.inner.clone() };
716                        Ok(ChannelRequest::ReadChannelStreamingStop {
717                            handle: req.handle,
718
719                            responder: ChannelReadChannelStreamingStopResponder {
720                                control_handle: std::mem::ManuallyDrop::new(control_handle),
721                                tx_id: header.tx_id,
722                            },
723                        })
724                    }
725                    _ if header.tx_id == 0
726                        && header
727                            .dynamic_flags()
728                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
729                    {
730                        Ok(ChannelRequest::_UnknownMethod {
731                            ordinal: header.ordinal,
732                            control_handle: ChannelControlHandle { inner: this.inner.clone() },
733                            method_type: fidl::MethodType::OneWay,
734                        })
735                    }
736                    _ if header
737                        .dynamic_flags()
738                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
739                    {
740                        this.inner.send_framework_err(
741                            fidl::encoding::FrameworkErr::UnknownMethod,
742                            header.tx_id,
743                            header.ordinal,
744                            header.dynamic_flags(),
745                            (bytes, handles),
746                        )?;
747                        Ok(ChannelRequest::_UnknownMethod {
748                            ordinal: header.ordinal,
749                            control_handle: ChannelControlHandle { inner: this.inner.clone() },
750                            method_type: fidl::MethodType::TwoWay,
751                        })
752                    }
753                    _ => Err(fidl::Error::UnknownOrdinal {
754                        ordinal: header.ordinal,
755                        protocol_name:
756                            <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
757                    }),
758                }))
759            },
760        )
761    }
762}
763
764/// FDomain operations on Channels.
765#[derive(Debug)]
766pub enum ChannelRequest {
767    /// Create a new channel in this FDomain and return both its ends.
768    CreateChannel { handles: [NewHandleId; 2], responder: ChannelCreateChannelResponder },
769    /// Read a message from a channel. This method will fail if the channel is currently being read
770    /// using the streaming read functions.
771    ///
772    /// Note that this method is not like zx_channel_read in that it will not
773    /// return `SHOULD_WAIT` but will instead delay returning until there is data
774    /// to return.
775    ReadChannel { handle: HandleId, responder: ChannelReadChannelResponder },
776    /// Write to a channel. Handles are always consumed.
777    WriteChannel {
778        handle: HandleId,
779        data: Vec<u8>,
780        handles: Handles,
781        responder: ChannelWriteChannelResponder,
782    },
783    /// Starts reading from the given channel. Data is returned via the `ChannelStreamingData` event.
784    /// That event will occur repeatedly until `ReadChannelStreamingStop` is called for the same handle
785    /// or the event indicates the handle is closed.
786    ReadChannelStreamingStart {
787        handle: HandleId,
788        responder: ChannelReadChannelStreamingStartResponder,
789    },
790    /// Stop asynchronous reading from the given channel.
791    ReadChannelStreamingStop {
792        handle: HandleId,
793        responder: ChannelReadChannelStreamingStopResponder,
794    },
795    /// An interaction was received which does not match any known method.
796    #[non_exhaustive]
797    _UnknownMethod {
798        /// Ordinal of the method that was called.
799        ordinal: u64,
800        control_handle: ChannelControlHandle,
801        method_type: fidl::MethodType,
802    },
803}
804
805impl ChannelRequest {
806    #[allow(irrefutable_let_patterns)]
807    pub fn into_create_channel(self) -> Option<([NewHandleId; 2], ChannelCreateChannelResponder)> {
808        if let ChannelRequest::CreateChannel { handles, responder } = self {
809            Some((handles, responder))
810        } else {
811            None
812        }
813    }
814
815    #[allow(irrefutable_let_patterns)]
816    pub fn into_read_channel(self) -> Option<(HandleId, ChannelReadChannelResponder)> {
817        if let ChannelRequest::ReadChannel { handle, responder } = self {
818            Some((handle, responder))
819        } else {
820            None
821        }
822    }
823
824    #[allow(irrefutable_let_patterns)]
825    pub fn into_write_channel(
826        self,
827    ) -> Option<(HandleId, Vec<u8>, Handles, ChannelWriteChannelResponder)> {
828        if let ChannelRequest::WriteChannel { handle, data, handles, responder } = self {
829            Some((handle, data, handles, responder))
830        } else {
831            None
832        }
833    }
834
835    #[allow(irrefutable_let_patterns)]
836    pub fn into_read_channel_streaming_start(
837        self,
838    ) -> Option<(HandleId, ChannelReadChannelStreamingStartResponder)> {
839        if let ChannelRequest::ReadChannelStreamingStart { handle, responder } = self {
840            Some((handle, responder))
841        } else {
842            None
843        }
844    }
845
846    #[allow(irrefutable_let_patterns)]
847    pub fn into_read_channel_streaming_stop(
848        self,
849    ) -> Option<(HandleId, ChannelReadChannelStreamingStopResponder)> {
850        if let ChannelRequest::ReadChannelStreamingStop { handle, responder } = self {
851            Some((handle, responder))
852        } else {
853            None
854        }
855    }
856
857    /// Name of the method defined in FIDL
858    pub fn method_name(&self) -> &'static str {
859        match *self {
860            ChannelRequest::CreateChannel { .. } => "create_channel",
861            ChannelRequest::ReadChannel { .. } => "read_channel",
862            ChannelRequest::WriteChannel { .. } => "write_channel",
863            ChannelRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
864            ChannelRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
865            ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
866                "unknown one-way method"
867            }
868            ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
869                "unknown two-way method"
870            }
871        }
872    }
873}
874
875#[derive(Debug, Clone)]
876pub struct ChannelControlHandle {
877    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
878}
879
880impl ChannelControlHandle {
881    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
882        self.inner.shutdown_with_epitaph(status.into())
883    }
884}
885
886impl fidl::endpoints::ControlHandle for ChannelControlHandle {
887    fn shutdown(&self) {
888        self.inner.shutdown()
889    }
890
891    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
892        self.inner.shutdown_with_epitaph(status)
893    }
894
895    fn is_closed(&self) -> bool {
896        self.inner.channel().is_closed()
897    }
898    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
899        self.inner.channel().on_closed()
900    }
901
902    #[cfg(target_os = "fuchsia")]
903    fn signal_peer(
904        &self,
905        clear_mask: zx::Signals,
906        set_mask: zx::Signals,
907    ) -> Result<(), zx_status::Status> {
908        use fidl::Peered;
909        self.inner.channel().signal_peer(clear_mask, set_mask)
910    }
911}
912
913impl ChannelControlHandle {
914    pub fn send_on_channel_streaming_data(
915        &self,
916        mut handle: &HandleId,
917        mut channel_sent: &ChannelSent,
918    ) -> Result<(), fidl::Error> {
919        self.inner.send::<ChannelOnChannelStreamingDataRequest>(
920            (handle, channel_sent),
921            0,
922            0x7d4431805202dfe1,
923            fidl::encoding::DynamicFlags::FLEXIBLE,
924        )
925    }
926}
927
928#[must_use = "FIDL methods require a response to be sent"]
929#[derive(Debug)]
930pub struct ChannelCreateChannelResponder {
931    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
932    tx_id: u32,
933}
934
935/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
936/// if the responder is dropped without sending a response, so that the client
937/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
938impl std::ops::Drop for ChannelCreateChannelResponder {
939    fn drop(&mut self) {
940        self.control_handle.shutdown();
941        // Safety: drops once, never accessed again
942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
943    }
944}
945
946impl fidl::endpoints::Responder for ChannelCreateChannelResponder {
947    type ControlHandle = ChannelControlHandle;
948
949    fn control_handle(&self) -> &ChannelControlHandle {
950        &self.control_handle
951    }
952
953    fn drop_without_shutdown(mut self) {
954        // Safety: drops once, never accessed again due to mem::forget
955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
956        // Prevent Drop from running (which would shut down the channel)
957        std::mem::forget(self);
958    }
959}
960
961impl ChannelCreateChannelResponder {
962    /// Sends a response to the FIDL transaction.
963    ///
964    /// Sets the channel to shutdown if an error occurs.
965    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
966        let _result = self.send_raw(result);
967        if _result.is_err() {
968            self.control_handle.shutdown();
969        }
970        self.drop_without_shutdown();
971        _result
972    }
973
974    /// Similar to "send" but does not shutdown the channel if an error occurs.
975    pub fn send_no_shutdown_on_err(
976        self,
977        mut result: Result<(), &Error>,
978    ) -> Result<(), fidl::Error> {
979        let _result = self.send_raw(result);
980        self.drop_without_shutdown();
981        _result
982    }
983
984    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
985        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
986            fidl::encoding::EmptyStruct,
987            Error,
988        >>(
989            fidl::encoding::FlexibleResult::new(result),
990            self.tx_id,
991            0x182d38bfe88673b5,
992            fidl::encoding::DynamicFlags::FLEXIBLE,
993        )
994    }
995}
996
997#[must_use = "FIDL methods require a response to be sent"]
998#[derive(Debug)]
999pub struct ChannelReadChannelResponder {
1000    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1001    tx_id: u32,
1002}
1003
1004/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1005/// if the responder is dropped without sending a response, so that the client
1006/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1007impl std::ops::Drop for ChannelReadChannelResponder {
1008    fn drop(&mut self) {
1009        self.control_handle.shutdown();
1010        // Safety: drops once, never accessed again
1011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012    }
1013}
1014
1015impl fidl::endpoints::Responder for ChannelReadChannelResponder {
1016    type ControlHandle = ChannelControlHandle;
1017
1018    fn control_handle(&self) -> &ChannelControlHandle {
1019        &self.control_handle
1020    }
1021
1022    fn drop_without_shutdown(mut self) {
1023        // Safety: drops once, never accessed again due to mem::forget
1024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025        // Prevent Drop from running (which would shut down the channel)
1026        std::mem::forget(self);
1027    }
1028}
1029
1030impl ChannelReadChannelResponder {
1031    /// Sends a response to the FIDL transaction.
1032    ///
1033    /// Sets the channel to shutdown if an error occurs.
1034    pub fn send(
1035        self,
1036        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
1037    ) -> Result<(), fidl::Error> {
1038        let _result = self.send_raw(result);
1039        if _result.is_err() {
1040            self.control_handle.shutdown();
1041        }
1042        self.drop_without_shutdown();
1043        _result
1044    }
1045
1046    /// Similar to "send" but does not shutdown the channel if an error occurs.
1047    pub fn send_no_shutdown_on_err(
1048        self,
1049        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
1050    ) -> Result<(), fidl::Error> {
1051        let _result = self.send_raw(result);
1052        self.drop_without_shutdown();
1053        _result
1054    }
1055
1056    fn send_raw(
1057        &self,
1058        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
1059    ) -> Result<(), fidl::Error> {
1060        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
1061            fidl::encoding::FlexibleResult::new(result),
1062            self.tx_id,
1063            0x6ef47bf27bf7d050,
1064            fidl::encoding::DynamicFlags::FLEXIBLE,
1065        )
1066    }
1067}
1068
1069#[must_use = "FIDL methods require a response to be sent"]
1070#[derive(Debug)]
1071pub struct ChannelWriteChannelResponder {
1072    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1073    tx_id: u32,
1074}
1075
1076/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1077/// if the responder is dropped without sending a response, so that the client
1078/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1079impl std::ops::Drop for ChannelWriteChannelResponder {
1080    fn drop(&mut self) {
1081        self.control_handle.shutdown();
1082        // Safety: drops once, never accessed again
1083        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1084    }
1085}
1086
1087impl fidl::endpoints::Responder for ChannelWriteChannelResponder {
1088    type ControlHandle = ChannelControlHandle;
1089
1090    fn control_handle(&self) -> &ChannelControlHandle {
1091        &self.control_handle
1092    }
1093
1094    fn drop_without_shutdown(mut self) {
1095        // Safety: drops once, never accessed again due to mem::forget
1096        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1097        // Prevent Drop from running (which would shut down the channel)
1098        std::mem::forget(self);
1099    }
1100}
1101
1102impl ChannelWriteChannelResponder {
1103    /// Sends a response to the FIDL transaction.
1104    ///
1105    /// Sets the channel to shutdown if an error occurs.
1106    pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
1107        let _result = self.send_raw(result);
1108        if _result.is_err() {
1109            self.control_handle.shutdown();
1110        }
1111        self.drop_without_shutdown();
1112        _result
1113    }
1114
1115    /// Similar to "send" but does not shutdown the channel if an error occurs.
1116    pub fn send_no_shutdown_on_err(
1117        self,
1118        mut result: Result<(), &WriteChannelError>,
1119    ) -> Result<(), fidl::Error> {
1120        let _result = self.send_raw(result);
1121        self.drop_without_shutdown();
1122        _result
1123    }
1124
1125    fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
1126        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1127            fidl::encoding::EmptyStruct,
1128            WriteChannelError,
1129        >>(
1130            fidl::encoding::FlexibleResult::new(result),
1131            self.tx_id,
1132            0x75a2559b945d5eb5,
1133            fidl::encoding::DynamicFlags::FLEXIBLE,
1134        )
1135    }
1136}
1137
1138#[must_use = "FIDL methods require a response to be sent"]
1139#[derive(Debug)]
1140pub struct ChannelReadChannelStreamingStartResponder {
1141    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1142    tx_id: u32,
1143}
1144
1145/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1146/// if the responder is dropped without sending a response, so that the client
1147/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1148impl std::ops::Drop for ChannelReadChannelStreamingStartResponder {
1149    fn drop(&mut self) {
1150        self.control_handle.shutdown();
1151        // Safety: drops once, never accessed again
1152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1153    }
1154}
1155
1156impl fidl::endpoints::Responder for ChannelReadChannelStreamingStartResponder {
1157    type ControlHandle = ChannelControlHandle;
1158
1159    fn control_handle(&self) -> &ChannelControlHandle {
1160        &self.control_handle
1161    }
1162
1163    fn drop_without_shutdown(mut self) {
1164        // Safety: drops once, never accessed again due to mem::forget
1165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1166        // Prevent Drop from running (which would shut down the channel)
1167        std::mem::forget(self);
1168    }
1169}
1170
1171impl ChannelReadChannelStreamingStartResponder {
1172    /// Sends a response to the FIDL transaction.
1173    ///
1174    /// Sets the channel to shutdown if an error occurs.
1175    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1176        let _result = self.send_raw(result);
1177        if _result.is_err() {
1178            self.control_handle.shutdown();
1179        }
1180        self.drop_without_shutdown();
1181        _result
1182    }
1183
1184    /// Similar to "send" but does not shutdown the channel if an error occurs.
1185    pub fn send_no_shutdown_on_err(
1186        self,
1187        mut result: Result<(), &Error>,
1188    ) -> Result<(), fidl::Error> {
1189        let _result = self.send_raw(result);
1190        self.drop_without_shutdown();
1191        _result
1192    }
1193
1194    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1195        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1196            fidl::encoding::EmptyStruct,
1197            Error,
1198        >>(
1199            fidl::encoding::FlexibleResult::new(result),
1200            self.tx_id,
1201            0x3c73e85476a203df,
1202            fidl::encoding::DynamicFlags::FLEXIBLE,
1203        )
1204    }
1205}
1206
1207#[must_use = "FIDL methods require a response to be sent"]
1208#[derive(Debug)]
1209pub struct ChannelReadChannelStreamingStopResponder {
1210    control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
1211    tx_id: u32,
1212}
1213
1214/// Set the the channel to be shutdown (see [`ChannelControlHandle::shutdown`])
1215/// if the responder is dropped without sending a response, so that the client
1216/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1217impl std::ops::Drop for ChannelReadChannelStreamingStopResponder {
1218    fn drop(&mut self) {
1219        self.control_handle.shutdown();
1220        // Safety: drops once, never accessed again
1221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1222    }
1223}
1224
1225impl fidl::endpoints::Responder for ChannelReadChannelStreamingStopResponder {
1226    type ControlHandle = ChannelControlHandle;
1227
1228    fn control_handle(&self) -> &ChannelControlHandle {
1229        &self.control_handle
1230    }
1231
1232    fn drop_without_shutdown(mut self) {
1233        // Safety: drops once, never accessed again due to mem::forget
1234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1235        // Prevent Drop from running (which would shut down the channel)
1236        std::mem::forget(self);
1237    }
1238}
1239
1240impl ChannelReadChannelStreamingStopResponder {
1241    /// Sends a response to the FIDL transaction.
1242    ///
1243    /// Sets the channel to shutdown if an error occurs.
1244    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1245        let _result = self.send_raw(result);
1246        if _result.is_err() {
1247            self.control_handle.shutdown();
1248        }
1249        self.drop_without_shutdown();
1250        _result
1251    }
1252
1253    /// Similar to "send" but does not shutdown the channel if an error occurs.
1254    pub fn send_no_shutdown_on_err(
1255        self,
1256        mut result: Result<(), &Error>,
1257    ) -> Result<(), fidl::Error> {
1258        let _result = self.send_raw(result);
1259        self.drop_without_shutdown();
1260        _result
1261    }
1262
1263    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1264        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1265            fidl::encoding::EmptyStruct,
1266            Error,
1267        >>(
1268            fidl::encoding::FlexibleResult::new(result),
1269            self.tx_id,
1270            0x56f21d6ed68186e0,
1271            fidl::encoding::DynamicFlags::FLEXIBLE,
1272        )
1273    }
1274}
1275
1276#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1277pub struct EventMarker;
1278
1279impl fidl::endpoints::ProtocolMarker for EventMarker {
1280    type Proxy = EventProxy;
1281    type RequestStream = EventRequestStream;
1282    #[cfg(target_os = "fuchsia")]
1283    type SynchronousProxy = EventSynchronousProxy;
1284
1285    const DEBUG_NAME: &'static str = "(anonymous) Event";
1286}
1287pub type EventCreateEventResult = Result<(), Error>;
1288
1289pub trait EventProxyInterface: Send + Sync {
1290    type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
1291        + Send;
1292    fn r#create_event(&self, handle: &NewHandleId) -> Self::CreateEventResponseFut;
1293}
1294#[derive(Debug)]
1295#[cfg(target_os = "fuchsia")]
1296pub struct EventSynchronousProxy {
1297    client: fidl::client::sync::Client,
1298}
1299
1300#[cfg(target_os = "fuchsia")]
1301impl fidl::endpoints::SynchronousProxy for EventSynchronousProxy {
1302    type Proxy = EventProxy;
1303    type Protocol = EventMarker;
1304
1305    fn from_channel(inner: fidl::Channel) -> Self {
1306        Self::new(inner)
1307    }
1308
1309    fn into_channel(self) -> fidl::Channel {
1310        self.client.into_channel()
1311    }
1312
1313    fn as_channel(&self) -> &fidl::Channel {
1314        self.client.as_channel()
1315    }
1316}
1317
1318#[cfg(target_os = "fuchsia")]
1319impl EventSynchronousProxy {
1320    pub fn new(channel: fidl::Channel) -> Self {
1321        Self { client: fidl::client::sync::Client::new(channel) }
1322    }
1323
1324    pub fn into_channel(self) -> fidl::Channel {
1325        self.client.into_channel()
1326    }
1327
1328    /// Waits until an event arrives and returns it. It is safe for other
1329    /// threads to make concurrent requests while waiting for an event.
1330    pub fn wait_for_event(
1331        &self,
1332        deadline: zx::MonotonicInstant,
1333    ) -> Result<EventEvent, fidl::Error> {
1334        EventEvent::decode(self.client.wait_for_event::<EventMarker>(deadline)?)
1335    }
1336
1337    /// Create a new event in this FDomain and return it.
1338    pub fn r#create_event(
1339        &self,
1340        mut handle: &NewHandleId,
1341        ___deadline: zx::MonotonicInstant,
1342    ) -> Result<EventCreateEventResult, fidl::Error> {
1343        let _response = self.client.send_query::<
1344            EventCreateEventRequest,
1345            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1346            EventMarker,
1347        >(
1348            (handle,),
1349            0x7b05b3f262635987,
1350            fidl::encoding::DynamicFlags::FLEXIBLE,
1351            ___deadline,
1352        )?
1353        .into_result::<EventMarker>("create_event")?;
1354        Ok(_response.map(|x| x))
1355    }
1356}
1357
1358#[cfg(target_os = "fuchsia")]
1359impl From<EventSynchronousProxy> for zx::NullableHandle {
1360    fn from(value: EventSynchronousProxy) -> Self {
1361        value.into_channel().into()
1362    }
1363}
1364
1365#[cfg(target_os = "fuchsia")]
1366impl From<fidl::Channel> for EventSynchronousProxy {
1367    fn from(value: fidl::Channel) -> Self {
1368        Self::new(value)
1369    }
1370}
1371
1372#[cfg(target_os = "fuchsia")]
1373impl fidl::endpoints::FromClient for EventSynchronousProxy {
1374    type Protocol = EventMarker;
1375
1376    fn from_client(value: fidl::endpoints::ClientEnd<EventMarker>) -> Self {
1377        Self::new(value.into_channel())
1378    }
1379}
1380
1381#[derive(Debug, Clone)]
1382pub struct EventProxy {
1383    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1384}
1385
1386impl fidl::endpoints::Proxy for EventProxy {
1387    type Protocol = EventMarker;
1388
1389    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1390        Self::new(inner)
1391    }
1392
1393    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1394        self.client.into_channel().map_err(|client| Self { client })
1395    }
1396
1397    fn as_channel(&self) -> &::fidl::AsyncChannel {
1398        self.client.as_channel()
1399    }
1400}
1401
1402impl EventProxy {
1403    /// Create a new Proxy for fuchsia.fdomain/Event.
1404    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1405        let protocol_name = <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1406        Self { client: fidl::client::Client::new(channel, protocol_name) }
1407    }
1408
1409    /// Get a Stream of events from the remote end of the protocol.
1410    ///
1411    /// # Panics
1412    ///
1413    /// Panics if the event stream was already taken.
1414    pub fn take_event_stream(&self) -> EventEventStream {
1415        EventEventStream { event_receiver: self.client.take_event_receiver() }
1416    }
1417
1418    /// Create a new event in this FDomain and return it.
1419    pub fn r#create_event(
1420        &self,
1421        mut handle: &NewHandleId,
1422    ) -> fidl::client::QueryResponseFut<
1423        EventCreateEventResult,
1424        fidl::encoding::DefaultFuchsiaResourceDialect,
1425    > {
1426        EventProxyInterface::r#create_event(self, handle)
1427    }
1428}
1429
1430impl EventProxyInterface for EventProxy {
1431    type CreateEventResponseFut = fidl::client::QueryResponseFut<
1432        EventCreateEventResult,
1433        fidl::encoding::DefaultFuchsiaResourceDialect,
1434    >;
1435    fn r#create_event(&self, mut handle: &NewHandleId) -> Self::CreateEventResponseFut {
1436        fn _decode(
1437            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1438        ) -> Result<EventCreateEventResult, fidl::Error> {
1439            let _response = fidl::client::decode_transaction_body::<
1440                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1441                fidl::encoding::DefaultFuchsiaResourceDialect,
1442                0x7b05b3f262635987,
1443            >(_buf?)?
1444            .into_result::<EventMarker>("create_event")?;
1445            Ok(_response.map(|x| x))
1446        }
1447        self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
1448            (handle,),
1449            0x7b05b3f262635987,
1450            fidl::encoding::DynamicFlags::FLEXIBLE,
1451            _decode,
1452        )
1453    }
1454}
1455
1456pub struct EventEventStream {
1457    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1458}
1459
1460impl std::marker::Unpin for EventEventStream {}
1461
1462impl futures::stream::FusedStream for EventEventStream {
1463    fn is_terminated(&self) -> bool {
1464        self.event_receiver.is_terminated()
1465    }
1466}
1467
1468impl futures::Stream for EventEventStream {
1469    type Item = Result<EventEvent, fidl::Error>;
1470
1471    fn poll_next(
1472        mut self: std::pin::Pin<&mut Self>,
1473        cx: &mut std::task::Context<'_>,
1474    ) -> std::task::Poll<Option<Self::Item>> {
1475        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1476            &mut self.event_receiver,
1477            cx
1478        )?) {
1479            Some(buf) => std::task::Poll::Ready(Some(EventEvent::decode(buf))),
1480            None => std::task::Poll::Ready(None),
1481        }
1482    }
1483}
1484
1485#[derive(Debug)]
1486pub enum EventEvent {
1487    #[non_exhaustive]
1488    _UnknownEvent {
1489        /// Ordinal of the event that was sent.
1490        ordinal: u64,
1491    },
1492}
1493
1494impl EventEvent {
1495    /// Decodes a message buffer as a [`EventEvent`].
1496    fn decode(
1497        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1498    ) -> Result<EventEvent, fidl::Error> {
1499        let (bytes, _handles) = buf.split_mut();
1500        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1501        debug_assert_eq!(tx_header.tx_id, 0);
1502        match tx_header.ordinal {
1503            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1504                Ok(EventEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1505            }
1506            _ => Err(fidl::Error::UnknownOrdinal {
1507                ordinal: tx_header.ordinal,
1508                protocol_name: <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1509            }),
1510        }
1511    }
1512}
1513
1514/// A Stream of incoming requests for fuchsia.fdomain/Event.
1515pub struct EventRequestStream {
1516    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1517    is_terminated: bool,
1518}
1519
1520impl std::marker::Unpin for EventRequestStream {}
1521
1522impl futures::stream::FusedStream for EventRequestStream {
1523    fn is_terminated(&self) -> bool {
1524        self.is_terminated
1525    }
1526}
1527
1528impl fidl::endpoints::RequestStream for EventRequestStream {
1529    type Protocol = EventMarker;
1530    type ControlHandle = EventControlHandle;
1531
1532    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1533        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1534    }
1535
1536    fn control_handle(&self) -> Self::ControlHandle {
1537        EventControlHandle { inner: self.inner.clone() }
1538    }
1539
1540    fn into_inner(
1541        self,
1542    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1543    {
1544        (self.inner, self.is_terminated)
1545    }
1546
1547    fn from_inner(
1548        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1549        is_terminated: bool,
1550    ) -> Self {
1551        Self { inner, is_terminated }
1552    }
1553}
1554
1555impl futures::Stream for EventRequestStream {
1556    type Item = Result<EventRequest, fidl::Error>;
1557
1558    fn poll_next(
1559        mut self: std::pin::Pin<&mut Self>,
1560        cx: &mut std::task::Context<'_>,
1561    ) -> std::task::Poll<Option<Self::Item>> {
1562        let this = &mut *self;
1563        if this.inner.check_shutdown(cx) {
1564            this.is_terminated = true;
1565            return std::task::Poll::Ready(None);
1566        }
1567        if this.is_terminated {
1568            panic!("polled EventRequestStream after completion");
1569        }
1570        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1571            |bytes, handles| {
1572                match this.inner.channel().read_etc(cx, bytes, handles) {
1573                    std::task::Poll::Ready(Ok(())) => {}
1574                    std::task::Poll::Pending => return std::task::Poll::Pending,
1575                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1576                        this.is_terminated = true;
1577                        return std::task::Poll::Ready(None);
1578                    }
1579                    std::task::Poll::Ready(Err(e)) => {
1580                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1581                            e.into(),
1582                        ))));
1583                    }
1584                }
1585
1586                // A message has been received from the channel
1587                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1588
1589                std::task::Poll::Ready(Some(match header.ordinal {
1590                    0x7b05b3f262635987 => {
1591                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1592                        let mut req = fidl::new_empty!(
1593                            EventCreateEventRequest,
1594                            fidl::encoding::DefaultFuchsiaResourceDialect
1595                        );
1596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
1597                        let control_handle = EventControlHandle { inner: this.inner.clone() };
1598                        Ok(EventRequest::CreateEvent {
1599                            handle: req.handle,
1600
1601                            responder: EventCreateEventResponder {
1602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1603                                tx_id: header.tx_id,
1604                            },
1605                        })
1606                    }
1607                    _ if header.tx_id == 0
1608                        && header
1609                            .dynamic_flags()
1610                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1611                    {
1612                        Ok(EventRequest::_UnknownMethod {
1613                            ordinal: header.ordinal,
1614                            control_handle: EventControlHandle { inner: this.inner.clone() },
1615                            method_type: fidl::MethodType::OneWay,
1616                        })
1617                    }
1618                    _ if header
1619                        .dynamic_flags()
1620                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1621                    {
1622                        this.inner.send_framework_err(
1623                            fidl::encoding::FrameworkErr::UnknownMethod,
1624                            header.tx_id,
1625                            header.ordinal,
1626                            header.dynamic_flags(),
1627                            (bytes, handles),
1628                        )?;
1629                        Ok(EventRequest::_UnknownMethod {
1630                            ordinal: header.ordinal,
1631                            control_handle: EventControlHandle { inner: this.inner.clone() },
1632                            method_type: fidl::MethodType::TwoWay,
1633                        })
1634                    }
1635                    _ => Err(fidl::Error::UnknownOrdinal {
1636                        ordinal: header.ordinal,
1637                        protocol_name: <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1638                    }),
1639                }))
1640            },
1641        )
1642    }
1643}
1644
1645/// FDomain operations on Events.
1646#[derive(Debug)]
1647pub enum EventRequest {
1648    /// Create a new event in this FDomain and return it.
1649    CreateEvent { handle: NewHandleId, responder: EventCreateEventResponder },
1650    /// An interaction was received which does not match any known method.
1651    #[non_exhaustive]
1652    _UnknownMethod {
1653        /// Ordinal of the method that was called.
1654        ordinal: u64,
1655        control_handle: EventControlHandle,
1656        method_type: fidl::MethodType,
1657    },
1658}
1659
1660impl EventRequest {
1661    #[allow(irrefutable_let_patterns)]
1662    pub fn into_create_event(self) -> Option<(NewHandleId, EventCreateEventResponder)> {
1663        if let EventRequest::CreateEvent { handle, responder } = self {
1664            Some((handle, responder))
1665        } else {
1666            None
1667        }
1668    }
1669
1670    /// Name of the method defined in FIDL
1671    pub fn method_name(&self) -> &'static str {
1672        match *self {
1673            EventRequest::CreateEvent { .. } => "create_event",
1674            EventRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1675                "unknown one-way method"
1676            }
1677            EventRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1678                "unknown two-way method"
1679            }
1680        }
1681    }
1682}
1683
1684#[derive(Debug, Clone)]
1685pub struct EventControlHandle {
1686    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1687}
1688
1689impl EventControlHandle {
1690    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1691        self.inner.shutdown_with_epitaph(status.into())
1692    }
1693}
1694
1695impl fidl::endpoints::ControlHandle for EventControlHandle {
1696    fn shutdown(&self) {
1697        self.inner.shutdown()
1698    }
1699
1700    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1701        self.inner.shutdown_with_epitaph(status)
1702    }
1703
1704    fn is_closed(&self) -> bool {
1705        self.inner.channel().is_closed()
1706    }
1707    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1708        self.inner.channel().on_closed()
1709    }
1710
1711    #[cfg(target_os = "fuchsia")]
1712    fn signal_peer(
1713        &self,
1714        clear_mask: zx::Signals,
1715        set_mask: zx::Signals,
1716    ) -> Result<(), zx_status::Status> {
1717        use fidl::Peered;
1718        self.inner.channel().signal_peer(clear_mask, set_mask)
1719    }
1720}
1721
1722impl EventControlHandle {}
1723
1724#[must_use = "FIDL methods require a response to be sent"]
1725#[derive(Debug)]
1726pub struct EventCreateEventResponder {
1727    control_handle: std::mem::ManuallyDrop<EventControlHandle>,
1728    tx_id: u32,
1729}
1730
1731/// Set the the channel to be shutdown (see [`EventControlHandle::shutdown`])
1732/// if the responder is dropped without sending a response, so that the client
1733/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1734impl std::ops::Drop for EventCreateEventResponder {
1735    fn drop(&mut self) {
1736        self.control_handle.shutdown();
1737        // Safety: drops once, never accessed again
1738        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1739    }
1740}
1741
1742impl fidl::endpoints::Responder for EventCreateEventResponder {
1743    type ControlHandle = EventControlHandle;
1744
1745    fn control_handle(&self) -> &EventControlHandle {
1746        &self.control_handle
1747    }
1748
1749    fn drop_without_shutdown(mut self) {
1750        // Safety: drops once, never accessed again due to mem::forget
1751        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1752        // Prevent Drop from running (which would shut down the channel)
1753        std::mem::forget(self);
1754    }
1755}
1756
1757impl EventCreateEventResponder {
1758    /// Sends a response to the FIDL transaction.
1759    ///
1760    /// Sets the channel to shutdown if an error occurs.
1761    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1762        let _result = self.send_raw(result);
1763        if _result.is_err() {
1764            self.control_handle.shutdown();
1765        }
1766        self.drop_without_shutdown();
1767        _result
1768    }
1769
1770    /// Similar to "send" but does not shutdown the channel if an error occurs.
1771    pub fn send_no_shutdown_on_err(
1772        self,
1773        mut result: Result<(), &Error>,
1774    ) -> Result<(), fidl::Error> {
1775        let _result = self.send_raw(result);
1776        self.drop_without_shutdown();
1777        _result
1778    }
1779
1780    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
1781        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1782            fidl::encoding::EmptyStruct,
1783            Error,
1784        >>(
1785            fidl::encoding::FlexibleResult::new(result),
1786            self.tx_id,
1787            0x7b05b3f262635987,
1788            fidl::encoding::DynamicFlags::FLEXIBLE,
1789        )
1790    }
1791}
1792
1793#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1794pub struct EventPairMarker;
1795
1796impl fidl::endpoints::ProtocolMarker for EventPairMarker {
1797    type Proxy = EventPairProxy;
1798    type RequestStream = EventPairRequestStream;
1799    #[cfg(target_os = "fuchsia")]
1800    type SynchronousProxy = EventPairSynchronousProxy;
1801
1802    const DEBUG_NAME: &'static str = "(anonymous) EventPair";
1803}
1804pub type EventPairCreateEventPairResult = Result<(), Error>;
1805
1806pub trait EventPairProxyInterface: Send + Sync {
1807    type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
1808        + Send;
1809    fn r#create_event_pair(&self, handles: &[NewHandleId; 2]) -> Self::CreateEventPairResponseFut;
1810}
1811#[derive(Debug)]
1812#[cfg(target_os = "fuchsia")]
1813pub struct EventPairSynchronousProxy {
1814    client: fidl::client::sync::Client,
1815}
1816
1817#[cfg(target_os = "fuchsia")]
1818impl fidl::endpoints::SynchronousProxy for EventPairSynchronousProxy {
1819    type Proxy = EventPairProxy;
1820    type Protocol = EventPairMarker;
1821
1822    fn from_channel(inner: fidl::Channel) -> Self {
1823        Self::new(inner)
1824    }
1825
1826    fn into_channel(self) -> fidl::Channel {
1827        self.client.into_channel()
1828    }
1829
1830    fn as_channel(&self) -> &fidl::Channel {
1831        self.client.as_channel()
1832    }
1833}
1834
1835#[cfg(target_os = "fuchsia")]
1836impl EventPairSynchronousProxy {
1837    pub fn new(channel: fidl::Channel) -> Self {
1838        Self { client: fidl::client::sync::Client::new(channel) }
1839    }
1840
1841    pub fn into_channel(self) -> fidl::Channel {
1842        self.client.into_channel()
1843    }
1844
1845    /// Waits until an event arrives and returns it. It is safe for other
1846    /// threads to make concurrent requests while waiting for an event.
1847    pub fn wait_for_event(
1848        &self,
1849        deadline: zx::MonotonicInstant,
1850    ) -> Result<EventPairEvent, fidl::Error> {
1851        EventPairEvent::decode(self.client.wait_for_event::<EventPairMarker>(deadline)?)
1852    }
1853
1854    /// Create a new event pair in this FDomain and return both its ends.
1855    pub fn r#create_event_pair(
1856        &self,
1857        mut handles: &[NewHandleId; 2],
1858        ___deadline: zx::MonotonicInstant,
1859    ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
1860        let _response = self.client.send_query::<
1861            EventPairCreateEventPairRequest,
1862            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1863            EventPairMarker,
1864        >(
1865            (handles,),
1866            0x7aef61effa65656d,
1867            fidl::encoding::DynamicFlags::FLEXIBLE,
1868            ___deadline,
1869        )?
1870        .into_result::<EventPairMarker>("create_event_pair")?;
1871        Ok(_response.map(|x| x))
1872    }
1873}
1874
1875#[cfg(target_os = "fuchsia")]
1876impl From<EventPairSynchronousProxy> for zx::NullableHandle {
1877    fn from(value: EventPairSynchronousProxy) -> Self {
1878        value.into_channel().into()
1879    }
1880}
1881
1882#[cfg(target_os = "fuchsia")]
1883impl From<fidl::Channel> for EventPairSynchronousProxy {
1884    fn from(value: fidl::Channel) -> Self {
1885        Self::new(value)
1886    }
1887}
1888
1889#[cfg(target_os = "fuchsia")]
1890impl fidl::endpoints::FromClient for EventPairSynchronousProxy {
1891    type Protocol = EventPairMarker;
1892
1893    fn from_client(value: fidl::endpoints::ClientEnd<EventPairMarker>) -> Self {
1894        Self::new(value.into_channel())
1895    }
1896}
1897
1898#[derive(Debug, Clone)]
1899pub struct EventPairProxy {
1900    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1901}
1902
1903impl fidl::endpoints::Proxy for EventPairProxy {
1904    type Protocol = EventPairMarker;
1905
1906    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1907        Self::new(inner)
1908    }
1909
1910    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1911        self.client.into_channel().map_err(|client| Self { client })
1912    }
1913
1914    fn as_channel(&self) -> &::fidl::AsyncChannel {
1915        self.client.as_channel()
1916    }
1917}
1918
1919impl EventPairProxy {
1920    /// Create a new Proxy for fuchsia.fdomain/EventPair.
1921    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1922        let protocol_name = <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1923        Self { client: fidl::client::Client::new(channel, protocol_name) }
1924    }
1925
1926    /// Get a Stream of events from the remote end of the protocol.
1927    ///
1928    /// # Panics
1929    ///
1930    /// Panics if the event stream was already taken.
1931    pub fn take_event_stream(&self) -> EventPairEventStream {
1932        EventPairEventStream { event_receiver: self.client.take_event_receiver() }
1933    }
1934
1935    /// Create a new event pair in this FDomain and return both its ends.
1936    pub fn r#create_event_pair(
1937        &self,
1938        mut handles: &[NewHandleId; 2],
1939    ) -> fidl::client::QueryResponseFut<
1940        EventPairCreateEventPairResult,
1941        fidl::encoding::DefaultFuchsiaResourceDialect,
1942    > {
1943        EventPairProxyInterface::r#create_event_pair(self, handles)
1944    }
1945}
1946
1947impl EventPairProxyInterface for EventPairProxy {
1948    type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
1949        EventPairCreateEventPairResult,
1950        fidl::encoding::DefaultFuchsiaResourceDialect,
1951    >;
1952    fn r#create_event_pair(
1953        &self,
1954        mut handles: &[NewHandleId; 2],
1955    ) -> Self::CreateEventPairResponseFut {
1956        fn _decode(
1957            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1958        ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
1959            let _response = fidl::client::decode_transaction_body::<
1960                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1961                fidl::encoding::DefaultFuchsiaResourceDialect,
1962                0x7aef61effa65656d,
1963            >(_buf?)?
1964            .into_result::<EventPairMarker>("create_event_pair")?;
1965            Ok(_response.map(|x| x))
1966        }
1967        self.client.send_query_and_decode::<
1968            EventPairCreateEventPairRequest,
1969            EventPairCreateEventPairResult,
1970        >(
1971            (handles,),
1972            0x7aef61effa65656d,
1973            fidl::encoding::DynamicFlags::FLEXIBLE,
1974            _decode,
1975        )
1976    }
1977}
1978
1979pub struct EventPairEventStream {
1980    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1981}
1982
1983impl std::marker::Unpin for EventPairEventStream {}
1984
1985impl futures::stream::FusedStream for EventPairEventStream {
1986    fn is_terminated(&self) -> bool {
1987        self.event_receiver.is_terminated()
1988    }
1989}
1990
1991impl futures::Stream for EventPairEventStream {
1992    type Item = Result<EventPairEvent, fidl::Error>;
1993
1994    fn poll_next(
1995        mut self: std::pin::Pin<&mut Self>,
1996        cx: &mut std::task::Context<'_>,
1997    ) -> std::task::Poll<Option<Self::Item>> {
1998        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1999            &mut self.event_receiver,
2000            cx
2001        )?) {
2002            Some(buf) => std::task::Poll::Ready(Some(EventPairEvent::decode(buf))),
2003            None => std::task::Poll::Ready(None),
2004        }
2005    }
2006}
2007
2008#[derive(Debug)]
2009pub enum EventPairEvent {
2010    #[non_exhaustive]
2011    _UnknownEvent {
2012        /// Ordinal of the event that was sent.
2013        ordinal: u64,
2014    },
2015}
2016
2017impl EventPairEvent {
2018    /// Decodes a message buffer as a [`EventPairEvent`].
2019    fn decode(
2020        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2021    ) -> Result<EventPairEvent, fidl::Error> {
2022        let (bytes, _handles) = buf.split_mut();
2023        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2024        debug_assert_eq!(tx_header.tx_id, 0);
2025        match tx_header.ordinal {
2026            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2027                Ok(EventPairEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2028            }
2029            _ => Err(fidl::Error::UnknownOrdinal {
2030                ordinal: tx_header.ordinal,
2031                protocol_name: <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2032            }),
2033        }
2034    }
2035}
2036
2037/// A Stream of incoming requests for fuchsia.fdomain/EventPair.
2038pub struct EventPairRequestStream {
2039    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2040    is_terminated: bool,
2041}
2042
2043impl std::marker::Unpin for EventPairRequestStream {}
2044
2045impl futures::stream::FusedStream for EventPairRequestStream {
2046    fn is_terminated(&self) -> bool {
2047        self.is_terminated
2048    }
2049}
2050
2051impl fidl::endpoints::RequestStream for EventPairRequestStream {
2052    type Protocol = EventPairMarker;
2053    type ControlHandle = EventPairControlHandle;
2054
2055    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2056        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2057    }
2058
2059    fn control_handle(&self) -> Self::ControlHandle {
2060        EventPairControlHandle { inner: self.inner.clone() }
2061    }
2062
2063    fn into_inner(
2064        self,
2065    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2066    {
2067        (self.inner, self.is_terminated)
2068    }
2069
2070    fn from_inner(
2071        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2072        is_terminated: bool,
2073    ) -> Self {
2074        Self { inner, is_terminated }
2075    }
2076}
2077
2078impl futures::Stream for EventPairRequestStream {
2079    type Item = Result<EventPairRequest, fidl::Error>;
2080
2081    fn poll_next(
2082        mut self: std::pin::Pin<&mut Self>,
2083        cx: &mut std::task::Context<'_>,
2084    ) -> std::task::Poll<Option<Self::Item>> {
2085        let this = &mut *self;
2086        if this.inner.check_shutdown(cx) {
2087            this.is_terminated = true;
2088            return std::task::Poll::Ready(None);
2089        }
2090        if this.is_terminated {
2091            panic!("polled EventPairRequestStream after completion");
2092        }
2093        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2094            |bytes, handles| {
2095                match this.inner.channel().read_etc(cx, bytes, handles) {
2096                    std::task::Poll::Ready(Ok(())) => {}
2097                    std::task::Poll::Pending => return std::task::Poll::Pending,
2098                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2099                        this.is_terminated = true;
2100                        return std::task::Poll::Ready(None);
2101                    }
2102                    std::task::Poll::Ready(Err(e)) => {
2103                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2104                            e.into(),
2105                        ))));
2106                    }
2107                }
2108
2109                // A message has been received from the channel
2110                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2111
2112                std::task::Poll::Ready(Some(match header.ordinal {
2113                    0x7aef61effa65656d => {
2114                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2115                        let mut req = fidl::new_empty!(
2116                            EventPairCreateEventPairRequest,
2117                            fidl::encoding::DefaultFuchsiaResourceDialect
2118                        );
2119                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
2120                        let control_handle = EventPairControlHandle { inner: this.inner.clone() };
2121                        Ok(EventPairRequest::CreateEventPair {
2122                            handles: req.handles,
2123
2124                            responder: EventPairCreateEventPairResponder {
2125                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2126                                tx_id: header.tx_id,
2127                            },
2128                        })
2129                    }
2130                    _ if header.tx_id == 0
2131                        && header
2132                            .dynamic_flags()
2133                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2134                    {
2135                        Ok(EventPairRequest::_UnknownMethod {
2136                            ordinal: header.ordinal,
2137                            control_handle: EventPairControlHandle { inner: this.inner.clone() },
2138                            method_type: fidl::MethodType::OneWay,
2139                        })
2140                    }
2141                    _ if header
2142                        .dynamic_flags()
2143                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2144                    {
2145                        this.inner.send_framework_err(
2146                            fidl::encoding::FrameworkErr::UnknownMethod,
2147                            header.tx_id,
2148                            header.ordinal,
2149                            header.dynamic_flags(),
2150                            (bytes, handles),
2151                        )?;
2152                        Ok(EventPairRequest::_UnknownMethod {
2153                            ordinal: header.ordinal,
2154                            control_handle: EventPairControlHandle { inner: this.inner.clone() },
2155                            method_type: fidl::MethodType::TwoWay,
2156                        })
2157                    }
2158                    _ => Err(fidl::Error::UnknownOrdinal {
2159                        ordinal: header.ordinal,
2160                        protocol_name:
2161                            <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2162                    }),
2163                }))
2164            },
2165        )
2166    }
2167}
2168
2169/// FDomain operations on EventPairs.
2170#[derive(Debug)]
2171pub enum EventPairRequest {
2172    /// Create a new event pair in this FDomain and return both its ends.
2173    CreateEventPair { handles: [NewHandleId; 2], responder: EventPairCreateEventPairResponder },
2174    /// An interaction was received which does not match any known method.
2175    #[non_exhaustive]
2176    _UnknownMethod {
2177        /// Ordinal of the method that was called.
2178        ordinal: u64,
2179        control_handle: EventPairControlHandle,
2180        method_type: fidl::MethodType,
2181    },
2182}
2183
2184impl EventPairRequest {
2185    #[allow(irrefutable_let_patterns)]
2186    pub fn into_create_event_pair(
2187        self,
2188    ) -> Option<([NewHandleId; 2], EventPairCreateEventPairResponder)> {
2189        if let EventPairRequest::CreateEventPair { handles, responder } = self {
2190            Some((handles, responder))
2191        } else {
2192            None
2193        }
2194    }
2195
2196    /// Name of the method defined in FIDL
2197    pub fn method_name(&self) -> &'static str {
2198        match *self {
2199            EventPairRequest::CreateEventPair { .. } => "create_event_pair",
2200            EventPairRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2201                "unknown one-way method"
2202            }
2203            EventPairRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2204                "unknown two-way method"
2205            }
2206        }
2207    }
2208}
2209
2210#[derive(Debug, Clone)]
2211pub struct EventPairControlHandle {
2212    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2213}
2214
2215impl EventPairControlHandle {
2216    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2217        self.inner.shutdown_with_epitaph(status.into())
2218    }
2219}
2220
2221impl fidl::endpoints::ControlHandle for EventPairControlHandle {
2222    fn shutdown(&self) {
2223        self.inner.shutdown()
2224    }
2225
2226    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2227        self.inner.shutdown_with_epitaph(status)
2228    }
2229
2230    fn is_closed(&self) -> bool {
2231        self.inner.channel().is_closed()
2232    }
2233    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2234        self.inner.channel().on_closed()
2235    }
2236
2237    #[cfg(target_os = "fuchsia")]
2238    fn signal_peer(
2239        &self,
2240        clear_mask: zx::Signals,
2241        set_mask: zx::Signals,
2242    ) -> Result<(), zx_status::Status> {
2243        use fidl::Peered;
2244        self.inner.channel().signal_peer(clear_mask, set_mask)
2245    }
2246}
2247
2248impl EventPairControlHandle {}
2249
2250#[must_use = "FIDL methods require a response to be sent"]
2251#[derive(Debug)]
2252pub struct EventPairCreateEventPairResponder {
2253    control_handle: std::mem::ManuallyDrop<EventPairControlHandle>,
2254    tx_id: u32,
2255}
2256
2257/// Set the the channel to be shutdown (see [`EventPairControlHandle::shutdown`])
2258/// if the responder is dropped without sending a response, so that the client
2259/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2260impl std::ops::Drop for EventPairCreateEventPairResponder {
2261    fn drop(&mut self) {
2262        self.control_handle.shutdown();
2263        // Safety: drops once, never accessed again
2264        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2265    }
2266}
2267
2268impl fidl::endpoints::Responder for EventPairCreateEventPairResponder {
2269    type ControlHandle = EventPairControlHandle;
2270
2271    fn control_handle(&self) -> &EventPairControlHandle {
2272        &self.control_handle
2273    }
2274
2275    fn drop_without_shutdown(mut self) {
2276        // Safety: drops once, never accessed again due to mem::forget
2277        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2278        // Prevent Drop from running (which would shut down the channel)
2279        std::mem::forget(self);
2280    }
2281}
2282
2283impl EventPairCreateEventPairResponder {
2284    /// Sends a response to the FIDL transaction.
2285    ///
2286    /// Sets the channel to shutdown if an error occurs.
2287    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
2288        let _result = self.send_raw(result);
2289        if _result.is_err() {
2290            self.control_handle.shutdown();
2291        }
2292        self.drop_without_shutdown();
2293        _result
2294    }
2295
2296    /// Similar to "send" but does not shutdown the channel if an error occurs.
2297    pub fn send_no_shutdown_on_err(
2298        self,
2299        mut result: Result<(), &Error>,
2300    ) -> Result<(), fidl::Error> {
2301        let _result = self.send_raw(result);
2302        self.drop_without_shutdown();
2303        _result
2304    }
2305
2306    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
2307        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2308            fidl::encoding::EmptyStruct,
2309            Error,
2310        >>(
2311            fidl::encoding::FlexibleResult::new(result),
2312            self.tx_id,
2313            0x7aef61effa65656d,
2314            fidl::encoding::DynamicFlags::FLEXIBLE,
2315        )
2316    }
2317}
2318
2319#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2320pub struct FDomainMarker;
2321
2322impl fidl::endpoints::ProtocolMarker for FDomainMarker {
2323    type Proxy = FDomainProxy;
2324    type RequestStream = FDomainRequestStream;
2325    #[cfg(target_os = "fuchsia")]
2326    type SynchronousProxy = FDomainSynchronousProxy;
2327
2328    const DEBUG_NAME: &'static str = "(anonymous) FDomain";
2329}
2330pub type FDomainGetNamespaceResult = Result<(), Error>;
2331pub type FDomainCloseResult = Result<(), Error>;
2332pub type FDomainDuplicateResult = Result<(), Error>;
2333pub type FDomainReplaceResult = Result<(), Error>;
2334pub type FDomainSignalResult = Result<(), Error>;
2335pub type FDomainSignalPeerResult = Result<(), Error>;
2336pub type FDomainWaitForSignalsResult = Result<u32, Error>;
2337pub type FDomainGetKoidResult = Result<u64, Error>;
2338
2339pub trait FDomainProxyInterface: Send + Sync {
2340    type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
2341        + Send;
2342    fn r#create_channel(&self, handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut;
2343    type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
2344        + Send;
2345    fn r#read_channel(&self, handle: &HandleId) -> Self::ReadChannelResponseFut;
2346    type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
2347        + Send;
2348    fn r#write_channel(
2349        &self,
2350        handle: &HandleId,
2351        data: &[u8],
2352        handles: &Handles,
2353    ) -> Self::WriteChannelResponseFut;
2354    type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
2355        + Send;
2356    fn r#read_channel_streaming_start(
2357        &self,
2358        handle: &HandleId,
2359    ) -> Self::ReadChannelStreamingStartResponseFut;
2360    type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
2361        + Send;
2362    fn r#read_channel_streaming_stop(
2363        &self,
2364        handle: &HandleId,
2365    ) -> Self::ReadChannelStreamingStopResponseFut;
2366    type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
2367        + Send;
2368    fn r#create_event(&self, handle: &NewHandleId) -> Self::CreateEventResponseFut;
2369    type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
2370        + Send;
2371    fn r#create_event_pair(&self, handles: &[NewHandleId; 2]) -> Self::CreateEventPairResponseFut;
2372    type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
2373        + Send;
2374    fn r#create_socket(
2375        &self,
2376        options: SocketType,
2377        handles: &[NewHandleId; 2],
2378    ) -> Self::CreateSocketResponseFut;
2379    type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
2380        + Send;
2381    fn r#set_socket_disposition(
2382        &self,
2383        handle: &HandleId,
2384        disposition: SocketDisposition,
2385        disposition_peer: SocketDisposition,
2386    ) -> Self::SetSocketDispositionResponseFut;
2387    type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
2388        + Send;
2389    fn r#read_socket(&self, handle: &HandleId, max_bytes: u64) -> Self::ReadSocketResponseFut;
2390    type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
2391        + Send;
2392    fn r#write_socket(&self, handle: &HandleId, data: &[u8]) -> Self::WriteSocketResponseFut;
2393    type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
2394        + Send;
2395    fn r#read_socket_streaming_start(
2396        &self,
2397        handle: &HandleId,
2398    ) -> Self::ReadSocketStreamingStartResponseFut;
2399    type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
2400        + Send;
2401    fn r#read_socket_streaming_stop(
2402        &self,
2403        handle: &HandleId,
2404    ) -> Self::ReadSocketStreamingStopResponseFut;
2405    type CreateVmoResponseFut: std::future::Future<Output = Result<VmoCreateVmoResult, fidl::Error>>
2406        + Send;
2407    fn r#create_vmo(
2408        &self,
2409        size: u64,
2410        options: VmoOptions,
2411        handle: &NewHandleId,
2412    ) -> Self::CreateVmoResponseFut;
2413    type ReadVmoResponseFut: std::future::Future<Output = Result<VmoReadVmoResult, fidl::Error>>
2414        + Send;
2415    fn r#read_vmo(&self, handle: &HandleId, offset: u64, size: u64) -> Self::ReadVmoResponseFut;
2416    type WriteVmoResponseFut: std::future::Future<Output = Result<VmoWriteVmoResult, fidl::Error>>
2417        + Send;
2418    fn r#write_vmo(&self, handle: &HandleId, offset: u64, data: &[u8])
2419    -> Self::WriteVmoResponseFut;
2420    type GetVmoSizeResponseFut: std::future::Future<Output = Result<VmoGetVmoSizeResult, fidl::Error>>
2421        + Send;
2422    fn r#get_vmo_size(&self, handle: &HandleId) -> Self::GetVmoSizeResponseFut;
2423    type SetVmoSizeResponseFut: std::future::Future<Output = Result<VmoSetVmoSizeResult, fidl::Error>>
2424        + Send;
2425    fn r#set_vmo_size(&self, handle: &HandleId, size: u64) -> Self::SetVmoSizeResponseFut;
2426    type GetVmoStreamSizeResponseFut: std::future::Future<Output = Result<VmoGetVmoStreamSizeResult, fidl::Error>>
2427        + Send;
2428    fn r#get_vmo_stream_size(&self, handle: &HandleId) -> Self::GetVmoStreamSizeResponseFut;
2429    type SetVmoStreamSizeResponseFut: std::future::Future<Output = Result<VmoSetVmoStreamSizeResult, fidl::Error>>
2430        + Send;
2431    fn r#set_vmo_stream_size(
2432        &self,
2433        handle: &HandleId,
2434        size: u64,
2435    ) -> Self::SetVmoStreamSizeResponseFut;
2436    type GetNamespaceResponseFut: std::future::Future<Output = Result<FDomainGetNamespaceResult, fidl::Error>>
2437        + Send;
2438    fn r#get_namespace(&self, new_handle: &NewHandleId) -> Self::GetNamespaceResponseFut;
2439    type CloseResponseFut: std::future::Future<Output = Result<FDomainCloseResult, fidl::Error>>
2440        + Send;
2441    fn r#close(&self, handles: &[HandleId]) -> Self::CloseResponseFut;
2442    type DuplicateResponseFut: std::future::Future<Output = Result<FDomainDuplicateResult, fidl::Error>>
2443        + Send;
2444    fn r#duplicate(
2445        &self,
2446        handle: &HandleId,
2447        new_handle: &NewHandleId,
2448        rights: fidl::Rights,
2449    ) -> Self::DuplicateResponseFut;
2450    type ReplaceResponseFut: std::future::Future<Output = Result<FDomainReplaceResult, fidl::Error>>
2451        + Send;
2452    fn r#replace(
2453        &self,
2454        handle: &HandleId,
2455        new_handle: &NewHandleId,
2456        rights: fidl::Rights,
2457    ) -> Self::ReplaceResponseFut;
2458    type SignalResponseFut: std::future::Future<Output = Result<FDomainSignalResult, fidl::Error>>
2459        + Send;
2460    fn r#signal(&self, handle: &HandleId, set: u32, clear: u32) -> Self::SignalResponseFut;
2461    type SignalPeerResponseFut: std::future::Future<Output = Result<FDomainSignalPeerResult, fidl::Error>>
2462        + Send;
2463    fn r#signal_peer(&self, handle: &HandleId, set: u32, clear: u32)
2464    -> Self::SignalPeerResponseFut;
2465    type WaitForSignalsResponseFut: std::future::Future<Output = Result<FDomainWaitForSignalsResult, fidl::Error>>
2466        + Send;
2467    fn r#wait_for_signals(
2468        &self,
2469        handle: &HandleId,
2470        signals: u32,
2471    ) -> Self::WaitForSignalsResponseFut;
2472    type GetKoidResponseFut: std::future::Future<Output = Result<FDomainGetKoidResult, fidl::Error>>
2473        + Send;
2474    fn r#get_koid(&self, handle: &HandleId) -> Self::GetKoidResponseFut;
2475}
2476#[derive(Debug)]
2477#[cfg(target_os = "fuchsia")]
2478pub struct FDomainSynchronousProxy {
2479    client: fidl::client::sync::Client,
2480}
2481
2482#[cfg(target_os = "fuchsia")]
2483impl fidl::endpoints::SynchronousProxy for FDomainSynchronousProxy {
2484    type Proxy = FDomainProxy;
2485    type Protocol = FDomainMarker;
2486
2487    fn from_channel(inner: fidl::Channel) -> Self {
2488        Self::new(inner)
2489    }
2490
2491    fn into_channel(self) -> fidl::Channel {
2492        self.client.into_channel()
2493    }
2494
2495    fn as_channel(&self) -> &fidl::Channel {
2496        self.client.as_channel()
2497    }
2498}
2499
2500#[cfg(target_os = "fuchsia")]
2501impl FDomainSynchronousProxy {
2502    pub fn new(channel: fidl::Channel) -> Self {
2503        Self { client: fidl::client::sync::Client::new(channel) }
2504    }
2505
2506    pub fn into_channel(self) -> fidl::Channel {
2507        self.client.into_channel()
2508    }
2509
2510    /// Waits until an event arrives and returns it. It is safe for other
2511    /// threads to make concurrent requests while waiting for an event.
2512    pub fn wait_for_event(
2513        &self,
2514        deadline: zx::MonotonicInstant,
2515    ) -> Result<FDomainEvent, fidl::Error> {
2516        FDomainEvent::decode(self.client.wait_for_event::<FDomainMarker>(deadline)?)
2517    }
2518
2519    /// Create a new channel in this FDomain and return both its ends.
2520    pub fn r#create_channel(
2521        &self,
2522        mut handles: &[NewHandleId; 2],
2523        ___deadline: zx::MonotonicInstant,
2524    ) -> Result<ChannelCreateChannelResult, fidl::Error> {
2525        let _response = self.client.send_query::<
2526            ChannelCreateChannelRequest,
2527            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2528            FDomainMarker,
2529        >(
2530            (handles,),
2531            0x182d38bfe88673b5,
2532            fidl::encoding::DynamicFlags::FLEXIBLE,
2533            ___deadline,
2534        )?
2535        .into_result::<FDomainMarker>("create_channel")?;
2536        Ok(_response.map(|x| x))
2537    }
2538
2539    /// Read a message from a channel. This method will fail if the channel is currently being read
2540    /// using the streaming read functions.
2541    ///
2542    /// Note that this method is not like zx_channel_read in that it will not
2543    /// return `SHOULD_WAIT` but will instead delay returning until there is data
2544    /// to return.
2545    pub fn r#read_channel(
2546        &self,
2547        mut handle: &HandleId,
2548        ___deadline: zx::MonotonicInstant,
2549    ) -> Result<ChannelReadChannelResult, fidl::Error> {
2550        let _response = self.client.send_query::<
2551            ChannelReadChannelRequest,
2552            fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
2553            FDomainMarker,
2554        >(
2555            (handle,),
2556            0x6ef47bf27bf7d050,
2557            fidl::encoding::DynamicFlags::FLEXIBLE,
2558            ___deadline,
2559        )?
2560        .into_result::<FDomainMarker>("read_channel")?;
2561        Ok(_response.map(|x| (x.data, x.handles)))
2562    }
2563
2564    /// Write to a channel. Handles are always consumed.
2565    pub fn r#write_channel(
2566        &self,
2567        mut handle: &HandleId,
2568        mut data: &[u8],
2569        mut handles: &Handles,
2570        ___deadline: zx::MonotonicInstant,
2571    ) -> Result<ChannelWriteChannelResult, fidl::Error> {
2572        let _response = self.client.send_query::<
2573            ChannelWriteChannelRequest,
2574            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
2575            FDomainMarker,
2576        >(
2577            (handle, data, handles,),
2578            0x75a2559b945d5eb5,
2579            fidl::encoding::DynamicFlags::FLEXIBLE,
2580            ___deadline,
2581        )?
2582        .into_result::<FDomainMarker>("write_channel")?;
2583        Ok(_response.map(|x| x))
2584    }
2585
2586    /// Starts reading from the given channel. Data is returned via the `ChannelStreamingData` event.
2587    /// That event will occur repeatedly until `ReadChannelStreamingStop` is called for the same handle
2588    /// or the event indicates the handle is closed.
2589    pub fn r#read_channel_streaming_start(
2590        &self,
2591        mut handle: &HandleId,
2592        ___deadline: zx::MonotonicInstant,
2593    ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
2594        let _response = self.client.send_query::<
2595            ChannelReadChannelStreamingStartRequest,
2596            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2597            FDomainMarker,
2598        >(
2599            (handle,),
2600            0x3c73e85476a203df,
2601            fidl::encoding::DynamicFlags::FLEXIBLE,
2602            ___deadline,
2603        )?
2604        .into_result::<FDomainMarker>("read_channel_streaming_start")?;
2605        Ok(_response.map(|x| x))
2606    }
2607
2608    /// Stop asynchronous reading from the given channel.
2609    pub fn r#read_channel_streaming_stop(
2610        &self,
2611        mut handle: &HandleId,
2612        ___deadline: zx::MonotonicInstant,
2613    ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
2614        let _response = self.client.send_query::<
2615            ChannelReadChannelStreamingStopRequest,
2616            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2617            FDomainMarker,
2618        >(
2619            (handle,),
2620            0x56f21d6ed68186e0,
2621            fidl::encoding::DynamicFlags::FLEXIBLE,
2622            ___deadline,
2623        )?
2624        .into_result::<FDomainMarker>("read_channel_streaming_stop")?;
2625        Ok(_response.map(|x| x))
2626    }
2627
2628    /// Create a new event in this FDomain and return it.
2629    pub fn r#create_event(
2630        &self,
2631        mut handle: &NewHandleId,
2632        ___deadline: zx::MonotonicInstant,
2633    ) -> Result<EventCreateEventResult, fidl::Error> {
2634        let _response = self.client.send_query::<
2635            EventCreateEventRequest,
2636            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2637            FDomainMarker,
2638        >(
2639            (handle,),
2640            0x7b05b3f262635987,
2641            fidl::encoding::DynamicFlags::FLEXIBLE,
2642            ___deadline,
2643        )?
2644        .into_result::<FDomainMarker>("create_event")?;
2645        Ok(_response.map(|x| x))
2646    }
2647
2648    /// Create a new event pair in this FDomain and return both its ends.
2649    pub fn r#create_event_pair(
2650        &self,
2651        mut handles: &[NewHandleId; 2],
2652        ___deadline: zx::MonotonicInstant,
2653    ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
2654        let _response = self.client.send_query::<
2655            EventPairCreateEventPairRequest,
2656            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2657            FDomainMarker,
2658        >(
2659            (handles,),
2660            0x7aef61effa65656d,
2661            fidl::encoding::DynamicFlags::FLEXIBLE,
2662            ___deadline,
2663        )?
2664        .into_result::<FDomainMarker>("create_event_pair")?;
2665        Ok(_response.map(|x| x))
2666    }
2667
2668    /// Create a new socket in this FDomain and return both its ends.
2669    pub fn r#create_socket(
2670        &self,
2671        mut options: SocketType,
2672        mut handles: &[NewHandleId; 2],
2673        ___deadline: zx::MonotonicInstant,
2674    ) -> Result<SocketCreateSocketResult, fidl::Error> {
2675        let _response = self.client.send_query::<
2676            SocketCreateSocketRequest,
2677            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2678            FDomainMarker,
2679        >(
2680            (options, handles,),
2681            0x200bf0ea21932de0,
2682            fidl::encoding::DynamicFlags::FLEXIBLE,
2683            ___deadline,
2684        )?
2685        .into_result::<FDomainMarker>("create_socket")?;
2686        Ok(_response.map(|x| x))
2687    }
2688
2689    /// Set the disposition of a given socket.
2690    pub fn r#set_socket_disposition(
2691        &self,
2692        mut handle: &HandleId,
2693        mut disposition: SocketDisposition,
2694        mut disposition_peer: SocketDisposition,
2695        ___deadline: zx::MonotonicInstant,
2696    ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
2697        let _response = self.client.send_query::<
2698            SocketSetSocketDispositionRequest,
2699            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2700            FDomainMarker,
2701        >(
2702            (handle, disposition, disposition_peer,),
2703            0x60d3c7ccb17f9bdf,
2704            fidl::encoding::DynamicFlags::FLEXIBLE,
2705            ___deadline,
2706        )?
2707        .into_result::<FDomainMarker>("set_socket_disposition")?;
2708        Ok(_response.map(|x| x))
2709    }
2710
2711    /// Read data from a socket. This method will fail if the socket is currently being read
2712    /// asynchronously.
2713    pub fn r#read_socket(
2714        &self,
2715        mut handle: &HandleId,
2716        mut max_bytes: u64,
2717        ___deadline: zx::MonotonicInstant,
2718    ) -> Result<SocketReadSocketResult, fidl::Error> {
2719        let _response = self.client.send_query::<
2720            SocketReadSocketRequest,
2721            fidl::encoding::FlexibleResultType<SocketData, Error>,
2722            FDomainMarker,
2723        >(
2724            (handle, max_bytes,),
2725            0x1da8aabec249c02e,
2726            fidl::encoding::DynamicFlags::FLEXIBLE,
2727            ___deadline,
2728        )?
2729        .into_result::<FDomainMarker>("read_socket")?;
2730        Ok(_response.map(|x| (x.data, x.is_datagram)))
2731    }
2732
2733    /// Write to a socket. This will attempt to write all the data passed, and
2734    /// will block and retry whenever it is safe (e.g. it should never return
2735    /// SHOULD_WAIT). The `WriteSocketError` contains a `wrote` parameter to
2736    /// indicate if some bytes were written successfully before the failure
2737    /// occurred.
2738    pub fn r#write_socket(
2739        &self,
2740        mut handle: &HandleId,
2741        mut data: &[u8],
2742        ___deadline: zx::MonotonicInstant,
2743    ) -> Result<SocketWriteSocketResult, fidl::Error> {
2744        let _response = self.client.send_query::<
2745            SocketWriteSocketRequest,
2746            fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
2747            FDomainMarker,
2748        >(
2749            (handle, data,),
2750            0x5b541623cbbbf683,
2751            fidl::encoding::DynamicFlags::FLEXIBLE,
2752            ___deadline,
2753        )?
2754        .into_result::<FDomainMarker>("write_socket")?;
2755        Ok(_response.map(|x| x.wrote))
2756    }
2757
2758    /// Starts reading from the given socket. Data is returned via the `SocketStreamingData` event. That
2759    /// event will occur repeatedly until `ReadSocketStreamingStop` is called for the same handle or the
2760    /// event indicates the handle is closed.
2761    pub fn r#read_socket_streaming_start(
2762        &self,
2763        mut handle: &HandleId,
2764        ___deadline: zx::MonotonicInstant,
2765    ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
2766        let _response = self.client.send_query::<
2767            SocketReadSocketStreamingStartRequest,
2768            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2769            FDomainMarker,
2770        >(
2771            (handle,),
2772            0x2a592748d5f33445,
2773            fidl::encoding::DynamicFlags::FLEXIBLE,
2774            ___deadline,
2775        )?
2776        .into_result::<FDomainMarker>("read_socket_streaming_start")?;
2777        Ok(_response.map(|x| x))
2778    }
2779
2780    /// Stop asynchronous reading from the given socket.
2781    pub fn r#read_socket_streaming_stop(
2782        &self,
2783        mut handle: &HandleId,
2784        ___deadline: zx::MonotonicInstant,
2785    ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
2786        let _response = self.client.send_query::<
2787            SocketReadSocketStreamingStopRequest,
2788            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2789            FDomainMarker,
2790        >(
2791            (handle,),
2792            0x53e5cade5f4d22e7,
2793            fidl::encoding::DynamicFlags::FLEXIBLE,
2794            ___deadline,
2795        )?
2796        .into_result::<FDomainMarker>("read_socket_streaming_stop")?;
2797        Ok(_response.map(|x| x))
2798    }
2799
2800    /// Create a new VMO in this FDomain.
2801    pub fn r#create_vmo(
2802        &self,
2803        mut size: u64,
2804        mut options: VmoOptions,
2805        mut handle: &NewHandleId,
2806        ___deadline: zx::MonotonicInstant,
2807    ) -> Result<VmoCreateVmoResult, fidl::Error> {
2808        let _response = self.client.send_query::<
2809            VmoCreateVmoRequest,
2810            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2811            FDomainMarker,
2812        >(
2813            (size, options, handle,),
2814            0x392dcaac1ddd8868,
2815            fidl::encoding::DynamicFlags::FLEXIBLE,
2816            ___deadline,
2817        )?
2818        .into_result::<FDomainMarker>("create_vmo")?;
2819        Ok(_response.map(|x| x))
2820    }
2821
2822    /// Read data from a VMO.
2823    pub fn r#read_vmo(
2824        &self,
2825        mut handle: &HandleId,
2826        mut offset: u64,
2827        mut size: u64,
2828        ___deadline: zx::MonotonicInstant,
2829    ) -> Result<VmoReadVmoResult, fidl::Error> {
2830        let _response = self.client.send_query::<
2831            VmoReadVmoRequest,
2832            fidl::encoding::FlexibleResultType<VmoReadVmoResponse, Error>,
2833            FDomainMarker,
2834        >(
2835            (handle, offset, size,),
2836            0x62690ec76b0f2fe6,
2837            fidl::encoding::DynamicFlags::FLEXIBLE,
2838            ___deadline,
2839        )?
2840        .into_result::<FDomainMarker>("read_vmo")?;
2841        Ok(_response.map(|x| x.data))
2842    }
2843
2844    /// Write data to a VMO.
2845    pub fn r#write_vmo(
2846        &self,
2847        mut handle: &HandleId,
2848        mut offset: u64,
2849        mut data: &[u8],
2850        ___deadline: zx::MonotonicInstant,
2851    ) -> Result<VmoWriteVmoResult, fidl::Error> {
2852        let _response = self.client.send_query::<
2853            VmoWriteVmoRequest,
2854            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2855            FDomainMarker,
2856        >(
2857            (handle, offset, data,),
2858            0x2f6ac299380e486e,
2859            fidl::encoding::DynamicFlags::FLEXIBLE,
2860            ___deadline,
2861        )?
2862        .into_result::<FDomainMarker>("write_vmo")?;
2863        Ok(_response.map(|x| x))
2864    }
2865
2866    /// Get the size of a VMO in bytes.
2867    pub fn r#get_vmo_size(
2868        &self,
2869        mut handle: &HandleId,
2870        ___deadline: zx::MonotonicInstant,
2871    ) -> Result<VmoGetVmoSizeResult, fidl::Error> {
2872        let _response = self.client.send_query::<
2873            VmoGetVmoSizeRequest,
2874            fidl::encoding::FlexibleResultType<VmoGetVmoSizeResponse, Error>,
2875            FDomainMarker,
2876        >(
2877            (handle,),
2878            0x717f9f3a9ff6906e,
2879            fidl::encoding::DynamicFlags::FLEXIBLE,
2880            ___deadline,
2881        )?
2882        .into_result::<FDomainMarker>("get_vmo_size")?;
2883        Ok(_response.map(|x| x.size))
2884    }
2885
2886    /// Set the size of a VMO in bytes.
2887    pub fn r#set_vmo_size(
2888        &self,
2889        mut handle: &HandleId,
2890        mut size: u64,
2891        ___deadline: zx::MonotonicInstant,
2892    ) -> Result<VmoSetVmoSizeResult, fidl::Error> {
2893        let _response = self.client.send_query::<
2894            VmoSetVmoSizeRequest,
2895            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2896            FDomainMarker,
2897        >(
2898            (handle, size,),
2899            0x7f6f77ac37afe38b,
2900            fidl::encoding::DynamicFlags::FLEXIBLE,
2901            ___deadline,
2902        )?
2903        .into_result::<FDomainMarker>("set_vmo_size")?;
2904        Ok(_response.map(|x| x))
2905    }
2906
2907    /// Get the stream size of a VMO in bytes.
2908    pub fn r#get_vmo_stream_size(
2909        &self,
2910        mut handle: &HandleId,
2911        ___deadline: zx::MonotonicInstant,
2912    ) -> Result<VmoGetVmoStreamSizeResult, fidl::Error> {
2913        let _response = self.client.send_query::<
2914            VmoGetVmoStreamSizeRequest,
2915            fidl::encoding::FlexibleResultType<VmoGetVmoStreamSizeResponse, Error>,
2916            FDomainMarker,
2917        >(
2918            (handle,),
2919            0x54020f4280cb038,
2920            fidl::encoding::DynamicFlags::FLEXIBLE,
2921            ___deadline,
2922        )?
2923        .into_result::<FDomainMarker>("get_vmo_stream_size")?;
2924        Ok(_response.map(|x| x.size))
2925    }
2926
2927    /// Set the stream size of a VMO in bytes.
2928    pub fn r#set_vmo_stream_size(
2929        &self,
2930        mut handle: &HandleId,
2931        mut size: u64,
2932        ___deadline: zx::MonotonicInstant,
2933    ) -> Result<VmoSetVmoStreamSizeResult, fidl::Error> {
2934        let _response = self.client.send_query::<
2935            VmoSetVmoStreamSizeRequest,
2936            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2937            FDomainMarker,
2938        >(
2939            (handle, size,),
2940            0x3bdb108fb18002eb,
2941            fidl::encoding::DynamicFlags::FLEXIBLE,
2942            ___deadline,
2943        )?
2944        .into_result::<FDomainMarker>("set_vmo_stream_size")?;
2945        Ok(_response.map(|x| x))
2946    }
2947
2948    /// Adds a new channel handle to this namespace which points to a
2949    /// fuchsia.io.Directory. Can be used to "bootstrap" the FDomain.
2950    pub fn r#get_namespace(
2951        &self,
2952        mut new_handle: &NewHandleId,
2953        ___deadline: zx::MonotonicInstant,
2954    ) -> Result<FDomainGetNamespaceResult, fidl::Error> {
2955        let _response = self.client.send_query::<
2956            FDomainGetNamespaceRequest,
2957            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2958            FDomainMarker,
2959        >(
2960            (new_handle,),
2961            0x74f2e74d9f53e11e,
2962            fidl::encoding::DynamicFlags::FLEXIBLE,
2963            ___deadline,
2964        )?
2965        .into_result::<FDomainMarker>("get_namespace")?;
2966        Ok(_response.map(|x| x))
2967    }
2968
2969    /// Close one or more handles.
2970    pub fn r#close(
2971        &self,
2972        mut handles: &[HandleId],
2973        ___deadline: zx::MonotonicInstant,
2974    ) -> Result<FDomainCloseResult, fidl::Error> {
2975        let _response = self.client.send_query::<
2976            FDomainCloseRequest,
2977            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2978            FDomainMarker,
2979        >(
2980            (handles,),
2981            0x5ef8c24362964257,
2982            fidl::encoding::DynamicFlags::FLEXIBLE,
2983            ___deadline,
2984        )?
2985        .into_result::<FDomainMarker>("close")?;
2986        Ok(_response.map(|x| x))
2987    }
2988
2989    /// Duplicate a handle.
2990    pub fn r#duplicate(
2991        &self,
2992        mut handle: &HandleId,
2993        mut new_handle: &NewHandleId,
2994        mut rights: fidl::Rights,
2995        ___deadline: zx::MonotonicInstant,
2996    ) -> Result<FDomainDuplicateResult, fidl::Error> {
2997        let _response = self.client.send_query::<
2998            FDomainDuplicateRequest,
2999            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3000            FDomainMarker,
3001        >(
3002            (handle, new_handle, rights,),
3003            0x7a85b94bd1777ab9,
3004            fidl::encoding::DynamicFlags::FLEXIBLE,
3005            ___deadline,
3006        )?
3007        .into_result::<FDomainMarker>("duplicate")?;
3008        Ok(_response.map(|x| x))
3009    }
3010
3011    /// Close a handle and replace it with a new one with possibly different
3012    /// rights.
3013    pub fn r#replace(
3014        &self,
3015        mut handle: &HandleId,
3016        mut new_handle: &NewHandleId,
3017        mut rights: fidl::Rights,
3018        ___deadline: zx::MonotonicInstant,
3019    ) -> Result<FDomainReplaceResult, fidl::Error> {
3020        let _response = self.client.send_query::<
3021            FDomainReplaceRequest,
3022            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3023            FDomainMarker,
3024        >(
3025            (handle, new_handle, rights,),
3026            0x32fa64625a5bd3be,
3027            fidl::encoding::DynamicFlags::FLEXIBLE,
3028            ___deadline,
3029        )?
3030        .into_result::<FDomainMarker>("replace")?;
3031        Ok(_response.map(|x| x))
3032    }
3033
3034    /// Set or clear signals on a handle.
3035    pub fn r#signal(
3036        &self,
3037        mut handle: &HandleId,
3038        mut set: u32,
3039        mut clear: u32,
3040        ___deadline: zx::MonotonicInstant,
3041    ) -> Result<FDomainSignalResult, fidl::Error> {
3042        let _response = self.client.send_query::<
3043            FDomainSignalRequest,
3044            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3045            FDomainMarker,
3046        >(
3047            (handle, set, clear,),
3048            0xe8352fb978996d9,
3049            fidl::encoding::DynamicFlags::FLEXIBLE,
3050            ___deadline,
3051        )?
3052        .into_result::<FDomainMarker>("signal")?;
3053        Ok(_response.map(|x| x))
3054    }
3055
3056    /// Set or clear signals on a handle's peer.
3057    pub fn r#signal_peer(
3058        &self,
3059        mut handle: &HandleId,
3060        mut set: u32,
3061        mut clear: u32,
3062        ___deadline: zx::MonotonicInstant,
3063    ) -> Result<FDomainSignalPeerResult, fidl::Error> {
3064        let _response = self.client.send_query::<
3065            FDomainSignalPeerRequest,
3066            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3067            FDomainMarker,
3068        >(
3069            (handle, set, clear,),
3070            0x7e84ec8ca7eabaf8,
3071            fidl::encoding::DynamicFlags::FLEXIBLE,
3072            ___deadline,
3073        )?
3074        .into_result::<FDomainMarker>("signal_peer")?;
3075        Ok(_response.map(|x| x))
3076    }
3077
3078    /// Wait for signals from the given handle. Reply will be returned when one
3079    /// of the given signals is asserted.
3080    pub fn r#wait_for_signals(
3081        &self,
3082        mut handle: &HandleId,
3083        mut signals: u32,
3084        ___deadline: zx::MonotonicInstant,
3085    ) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
3086        let _response = self.client.send_query::<
3087            FDomainWaitForSignalsRequest,
3088            fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
3089            FDomainMarker,
3090        >(
3091            (handle, signals,),
3092            0x8f72d9b4b85c1eb,
3093            fidl::encoding::DynamicFlags::FLEXIBLE,
3094            ___deadline,
3095        )?
3096        .into_result::<FDomainMarker>("wait_for_signals")?;
3097        Ok(_response.map(|x| x.signals))
3098    }
3099
3100    /// Return the kernel object ID (koid) of the handle.
3101    pub fn r#get_koid(
3102        &self,
3103        mut handle: &HandleId,
3104        ___deadline: zx::MonotonicInstant,
3105    ) -> Result<FDomainGetKoidResult, fidl::Error> {
3106        let _response = self.client.send_query::<
3107            FDomainGetKoidRequest,
3108            fidl::encoding::FlexibleResultType<FDomainGetKoidResponse, Error>,
3109            FDomainMarker,
3110        >(
3111            (handle,),
3112            0x437db979a63402c3,
3113            fidl::encoding::DynamicFlags::FLEXIBLE,
3114            ___deadline,
3115        )?
3116        .into_result::<FDomainMarker>("get_koid")?;
3117        Ok(_response.map(|x| x.koid))
3118    }
3119}
3120
3121#[cfg(target_os = "fuchsia")]
3122impl From<FDomainSynchronousProxy> for zx::NullableHandle {
3123    fn from(value: FDomainSynchronousProxy) -> Self {
3124        value.into_channel().into()
3125    }
3126}
3127
3128#[cfg(target_os = "fuchsia")]
3129impl From<fidl::Channel> for FDomainSynchronousProxy {
3130    fn from(value: fidl::Channel) -> Self {
3131        Self::new(value)
3132    }
3133}
3134
3135#[cfg(target_os = "fuchsia")]
3136impl fidl::endpoints::FromClient for FDomainSynchronousProxy {
3137    type Protocol = FDomainMarker;
3138
3139    fn from_client(value: fidl::endpoints::ClientEnd<FDomainMarker>) -> Self {
3140        Self::new(value.into_channel())
3141    }
3142}
3143
3144#[derive(Debug, Clone)]
3145pub struct FDomainProxy {
3146    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3147}
3148
3149impl fidl::endpoints::Proxy for FDomainProxy {
3150    type Protocol = FDomainMarker;
3151
3152    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3153        Self::new(inner)
3154    }
3155
3156    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3157        self.client.into_channel().map_err(|client| Self { client })
3158    }
3159
3160    fn as_channel(&self) -> &::fidl::AsyncChannel {
3161        self.client.as_channel()
3162    }
3163}
3164
3165impl FDomainProxy {
3166    /// Create a new Proxy for fuchsia.fdomain/FDomain.
3167    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3168        let protocol_name = <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3169        Self { client: fidl::client::Client::new(channel, protocol_name) }
3170    }
3171
3172    /// Get a Stream of events from the remote end of the protocol.
3173    ///
3174    /// # Panics
3175    ///
3176    /// Panics if the event stream was already taken.
3177    pub fn take_event_stream(&self) -> FDomainEventStream {
3178        FDomainEventStream { event_receiver: self.client.take_event_receiver() }
3179    }
3180
3181    /// Create a new channel in this FDomain and return both its ends.
3182    pub fn r#create_channel(
3183        &self,
3184        mut handles: &[NewHandleId; 2],
3185    ) -> fidl::client::QueryResponseFut<
3186        ChannelCreateChannelResult,
3187        fidl::encoding::DefaultFuchsiaResourceDialect,
3188    > {
3189        FDomainProxyInterface::r#create_channel(self, handles)
3190    }
3191
3192    /// Read a message from a channel. This method will fail if the channel is currently being read
3193    /// using the streaming read functions.
3194    ///
3195    /// Note that this method is not like zx_channel_read in that it will not
3196    /// return `SHOULD_WAIT` but will instead delay returning until there is data
3197    /// to return.
3198    pub fn r#read_channel(
3199        &self,
3200        mut handle: &HandleId,
3201    ) -> fidl::client::QueryResponseFut<
3202        ChannelReadChannelResult,
3203        fidl::encoding::DefaultFuchsiaResourceDialect,
3204    > {
3205        FDomainProxyInterface::r#read_channel(self, handle)
3206    }
3207
3208    /// Write to a channel. Handles are always consumed.
3209    pub fn r#write_channel(
3210        &self,
3211        mut handle: &HandleId,
3212        mut data: &[u8],
3213        mut handles: &Handles,
3214    ) -> fidl::client::QueryResponseFut<
3215        ChannelWriteChannelResult,
3216        fidl::encoding::DefaultFuchsiaResourceDialect,
3217    > {
3218        FDomainProxyInterface::r#write_channel(self, handle, data, handles)
3219    }
3220
3221    /// Starts reading from the given channel. Data is returned via the `ChannelStreamingData` event.
3222    /// That event will occur repeatedly until `ReadChannelStreamingStop` is called for the same handle
3223    /// or the event indicates the handle is closed.
3224    pub fn r#read_channel_streaming_start(
3225        &self,
3226        mut handle: &HandleId,
3227    ) -> fidl::client::QueryResponseFut<
3228        ChannelReadChannelStreamingStartResult,
3229        fidl::encoding::DefaultFuchsiaResourceDialect,
3230    > {
3231        FDomainProxyInterface::r#read_channel_streaming_start(self, handle)
3232    }
3233
3234    /// Stop asynchronous reading from the given channel.
3235    pub fn r#read_channel_streaming_stop(
3236        &self,
3237        mut handle: &HandleId,
3238    ) -> fidl::client::QueryResponseFut<
3239        ChannelReadChannelStreamingStopResult,
3240        fidl::encoding::DefaultFuchsiaResourceDialect,
3241    > {
3242        FDomainProxyInterface::r#read_channel_streaming_stop(self, handle)
3243    }
3244
3245    /// Create a new event in this FDomain and return it.
3246    pub fn r#create_event(
3247        &self,
3248        mut handle: &NewHandleId,
3249    ) -> fidl::client::QueryResponseFut<
3250        EventCreateEventResult,
3251        fidl::encoding::DefaultFuchsiaResourceDialect,
3252    > {
3253        FDomainProxyInterface::r#create_event(self, handle)
3254    }
3255
3256    /// Create a new event pair in this FDomain and return both its ends.
3257    pub fn r#create_event_pair(
3258        &self,
3259        mut handles: &[NewHandleId; 2],
3260    ) -> fidl::client::QueryResponseFut<
3261        EventPairCreateEventPairResult,
3262        fidl::encoding::DefaultFuchsiaResourceDialect,
3263    > {
3264        FDomainProxyInterface::r#create_event_pair(self, handles)
3265    }
3266
3267    /// Create a new socket in this FDomain and return both its ends.
3268    pub fn r#create_socket(
3269        &self,
3270        mut options: SocketType,
3271        mut handles: &[NewHandleId; 2],
3272    ) -> fidl::client::QueryResponseFut<
3273        SocketCreateSocketResult,
3274        fidl::encoding::DefaultFuchsiaResourceDialect,
3275    > {
3276        FDomainProxyInterface::r#create_socket(self, options, handles)
3277    }
3278
3279    /// Set the disposition of a given socket.
3280    pub fn r#set_socket_disposition(
3281        &self,
3282        mut handle: &HandleId,
3283        mut disposition: SocketDisposition,
3284        mut disposition_peer: SocketDisposition,
3285    ) -> fidl::client::QueryResponseFut<
3286        SocketSetSocketDispositionResult,
3287        fidl::encoding::DefaultFuchsiaResourceDialect,
3288    > {
3289        FDomainProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
3290    }
3291
3292    /// Read data from a socket. This method will fail if the socket is currently being read
3293    /// asynchronously.
3294    pub fn r#read_socket(
3295        &self,
3296        mut handle: &HandleId,
3297        mut max_bytes: u64,
3298    ) -> fidl::client::QueryResponseFut<
3299        SocketReadSocketResult,
3300        fidl::encoding::DefaultFuchsiaResourceDialect,
3301    > {
3302        FDomainProxyInterface::r#read_socket(self, handle, max_bytes)
3303    }
3304
3305    /// Write to a socket. This will attempt to write all the data passed, and
3306    /// will block and retry whenever it is safe (e.g. it should never return
3307    /// SHOULD_WAIT). The `WriteSocketError` contains a `wrote` parameter to
3308    /// indicate if some bytes were written successfully before the failure
3309    /// occurred.
3310    pub fn r#write_socket(
3311        &self,
3312        mut handle: &HandleId,
3313        mut data: &[u8],
3314    ) -> fidl::client::QueryResponseFut<
3315        SocketWriteSocketResult,
3316        fidl::encoding::DefaultFuchsiaResourceDialect,
3317    > {
3318        FDomainProxyInterface::r#write_socket(self, handle, data)
3319    }
3320
3321    /// Starts reading from the given socket. Data is returned via the `SocketStreamingData` event. That
3322    /// event will occur repeatedly until `ReadSocketStreamingStop` is called for the same handle or the
3323    /// event indicates the handle is closed.
3324    pub fn r#read_socket_streaming_start(
3325        &self,
3326        mut handle: &HandleId,
3327    ) -> fidl::client::QueryResponseFut<
3328        SocketReadSocketStreamingStartResult,
3329        fidl::encoding::DefaultFuchsiaResourceDialect,
3330    > {
3331        FDomainProxyInterface::r#read_socket_streaming_start(self, handle)
3332    }
3333
3334    /// Stop asynchronous reading from the given socket.
3335    pub fn r#read_socket_streaming_stop(
3336        &self,
3337        mut handle: &HandleId,
3338    ) -> fidl::client::QueryResponseFut<
3339        SocketReadSocketStreamingStopResult,
3340        fidl::encoding::DefaultFuchsiaResourceDialect,
3341    > {
3342        FDomainProxyInterface::r#read_socket_streaming_stop(self, handle)
3343    }
3344
3345    /// Create a new VMO in this FDomain.
3346    pub fn r#create_vmo(
3347        &self,
3348        mut size: u64,
3349        mut options: VmoOptions,
3350        mut handle: &NewHandleId,
3351    ) -> fidl::client::QueryResponseFut<
3352        VmoCreateVmoResult,
3353        fidl::encoding::DefaultFuchsiaResourceDialect,
3354    > {
3355        FDomainProxyInterface::r#create_vmo(self, size, options, handle)
3356    }
3357
3358    /// Read data from a VMO.
3359    pub fn r#read_vmo(
3360        &self,
3361        mut handle: &HandleId,
3362        mut offset: u64,
3363        mut size: u64,
3364    ) -> fidl::client::QueryResponseFut<
3365        VmoReadVmoResult,
3366        fidl::encoding::DefaultFuchsiaResourceDialect,
3367    > {
3368        FDomainProxyInterface::r#read_vmo(self, handle, offset, size)
3369    }
3370
3371    /// Write data to a VMO.
3372    pub fn r#write_vmo(
3373        &self,
3374        mut handle: &HandleId,
3375        mut offset: u64,
3376        mut data: &[u8],
3377    ) -> fidl::client::QueryResponseFut<
3378        VmoWriteVmoResult,
3379        fidl::encoding::DefaultFuchsiaResourceDialect,
3380    > {
3381        FDomainProxyInterface::r#write_vmo(self, handle, offset, data)
3382    }
3383
3384    /// Get the size of a VMO in bytes.
3385    pub fn r#get_vmo_size(
3386        &self,
3387        mut handle: &HandleId,
3388    ) -> fidl::client::QueryResponseFut<
3389        VmoGetVmoSizeResult,
3390        fidl::encoding::DefaultFuchsiaResourceDialect,
3391    > {
3392        FDomainProxyInterface::r#get_vmo_size(self, handle)
3393    }
3394
3395    /// Set the size of a VMO in bytes.
3396    pub fn r#set_vmo_size(
3397        &self,
3398        mut handle: &HandleId,
3399        mut size: u64,
3400    ) -> fidl::client::QueryResponseFut<
3401        VmoSetVmoSizeResult,
3402        fidl::encoding::DefaultFuchsiaResourceDialect,
3403    > {
3404        FDomainProxyInterface::r#set_vmo_size(self, handle, size)
3405    }
3406
3407    /// Get the stream size of a VMO in bytes.
3408    pub fn r#get_vmo_stream_size(
3409        &self,
3410        mut handle: &HandleId,
3411    ) -> fidl::client::QueryResponseFut<
3412        VmoGetVmoStreamSizeResult,
3413        fidl::encoding::DefaultFuchsiaResourceDialect,
3414    > {
3415        FDomainProxyInterface::r#get_vmo_stream_size(self, handle)
3416    }
3417
3418    /// Set the stream size of a VMO in bytes.
3419    pub fn r#set_vmo_stream_size(
3420        &self,
3421        mut handle: &HandleId,
3422        mut size: u64,
3423    ) -> fidl::client::QueryResponseFut<
3424        VmoSetVmoStreamSizeResult,
3425        fidl::encoding::DefaultFuchsiaResourceDialect,
3426    > {
3427        FDomainProxyInterface::r#set_vmo_stream_size(self, handle, size)
3428    }
3429
3430    /// Adds a new channel handle to this namespace which points to a
3431    /// fuchsia.io.Directory. Can be used to "bootstrap" the FDomain.
3432    pub fn r#get_namespace(
3433        &self,
3434        mut new_handle: &NewHandleId,
3435    ) -> fidl::client::QueryResponseFut<
3436        FDomainGetNamespaceResult,
3437        fidl::encoding::DefaultFuchsiaResourceDialect,
3438    > {
3439        FDomainProxyInterface::r#get_namespace(self, new_handle)
3440    }
3441
3442    /// Close one or more handles.
3443    pub fn r#close(
3444        &self,
3445        mut handles: &[HandleId],
3446    ) -> fidl::client::QueryResponseFut<
3447        FDomainCloseResult,
3448        fidl::encoding::DefaultFuchsiaResourceDialect,
3449    > {
3450        FDomainProxyInterface::r#close(self, handles)
3451    }
3452
3453    /// Duplicate a handle.
3454    pub fn r#duplicate(
3455        &self,
3456        mut handle: &HandleId,
3457        mut new_handle: &NewHandleId,
3458        mut rights: fidl::Rights,
3459    ) -> fidl::client::QueryResponseFut<
3460        FDomainDuplicateResult,
3461        fidl::encoding::DefaultFuchsiaResourceDialect,
3462    > {
3463        FDomainProxyInterface::r#duplicate(self, handle, new_handle, rights)
3464    }
3465
3466    /// Close a handle and replace it with a new one with possibly different
3467    /// rights.
3468    pub fn r#replace(
3469        &self,
3470        mut handle: &HandleId,
3471        mut new_handle: &NewHandleId,
3472        mut rights: fidl::Rights,
3473    ) -> fidl::client::QueryResponseFut<
3474        FDomainReplaceResult,
3475        fidl::encoding::DefaultFuchsiaResourceDialect,
3476    > {
3477        FDomainProxyInterface::r#replace(self, handle, new_handle, rights)
3478    }
3479
3480    /// Set or clear signals on a handle.
3481    pub fn r#signal(
3482        &self,
3483        mut handle: &HandleId,
3484        mut set: u32,
3485        mut clear: u32,
3486    ) -> fidl::client::QueryResponseFut<
3487        FDomainSignalResult,
3488        fidl::encoding::DefaultFuchsiaResourceDialect,
3489    > {
3490        FDomainProxyInterface::r#signal(self, handle, set, clear)
3491    }
3492
3493    /// Set or clear signals on a handle's peer.
3494    pub fn r#signal_peer(
3495        &self,
3496        mut handle: &HandleId,
3497        mut set: u32,
3498        mut clear: u32,
3499    ) -> fidl::client::QueryResponseFut<
3500        FDomainSignalPeerResult,
3501        fidl::encoding::DefaultFuchsiaResourceDialect,
3502    > {
3503        FDomainProxyInterface::r#signal_peer(self, handle, set, clear)
3504    }
3505
3506    /// Wait for signals from the given handle. Reply will be returned when one
3507    /// of the given signals is asserted.
3508    pub fn r#wait_for_signals(
3509        &self,
3510        mut handle: &HandleId,
3511        mut signals: u32,
3512    ) -> fidl::client::QueryResponseFut<
3513        FDomainWaitForSignalsResult,
3514        fidl::encoding::DefaultFuchsiaResourceDialect,
3515    > {
3516        FDomainProxyInterface::r#wait_for_signals(self, handle, signals)
3517    }
3518
3519    /// Return the kernel object ID (koid) of the handle.
3520    pub fn r#get_koid(
3521        &self,
3522        mut handle: &HandleId,
3523    ) -> fidl::client::QueryResponseFut<
3524        FDomainGetKoidResult,
3525        fidl::encoding::DefaultFuchsiaResourceDialect,
3526    > {
3527        FDomainProxyInterface::r#get_koid(self, handle)
3528    }
3529}
3530
3531impl FDomainProxyInterface for FDomainProxy {
3532    type CreateChannelResponseFut = fidl::client::QueryResponseFut<
3533        ChannelCreateChannelResult,
3534        fidl::encoding::DefaultFuchsiaResourceDialect,
3535    >;
3536    fn r#create_channel(&self, mut handles: &[NewHandleId; 2]) -> Self::CreateChannelResponseFut {
3537        fn _decode(
3538            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3539        ) -> Result<ChannelCreateChannelResult, fidl::Error> {
3540            let _response = fidl::client::decode_transaction_body::<
3541                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3542                fidl::encoding::DefaultFuchsiaResourceDialect,
3543                0x182d38bfe88673b5,
3544            >(_buf?)?
3545            .into_result::<FDomainMarker>("create_channel")?;
3546            Ok(_response.map(|x| x))
3547        }
3548        self.client
3549            .send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
3550                (handles,),
3551                0x182d38bfe88673b5,
3552                fidl::encoding::DynamicFlags::FLEXIBLE,
3553                _decode,
3554            )
3555    }
3556
3557    type ReadChannelResponseFut = fidl::client::QueryResponseFut<
3558        ChannelReadChannelResult,
3559        fidl::encoding::DefaultFuchsiaResourceDialect,
3560    >;
3561    fn r#read_channel(&self, mut handle: &HandleId) -> Self::ReadChannelResponseFut {
3562        fn _decode(
3563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3564        ) -> Result<ChannelReadChannelResult, fidl::Error> {
3565            let _response = fidl::client::decode_transaction_body::<
3566                fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
3567                fidl::encoding::DefaultFuchsiaResourceDialect,
3568                0x6ef47bf27bf7d050,
3569            >(_buf?)?
3570            .into_result::<FDomainMarker>("read_channel")?;
3571            Ok(_response.map(|x| (x.data, x.handles)))
3572        }
3573        self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
3574            (handle,),
3575            0x6ef47bf27bf7d050,
3576            fidl::encoding::DynamicFlags::FLEXIBLE,
3577            _decode,
3578        )
3579    }
3580
3581    type WriteChannelResponseFut = fidl::client::QueryResponseFut<
3582        ChannelWriteChannelResult,
3583        fidl::encoding::DefaultFuchsiaResourceDialect,
3584    >;
3585    fn r#write_channel(
3586        &self,
3587        mut handle: &HandleId,
3588        mut data: &[u8],
3589        mut handles: &Handles,
3590    ) -> Self::WriteChannelResponseFut {
3591        fn _decode(
3592            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3593        ) -> Result<ChannelWriteChannelResult, fidl::Error> {
3594            let _response = fidl::client::decode_transaction_body::<
3595                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
3596                fidl::encoding::DefaultFuchsiaResourceDialect,
3597                0x75a2559b945d5eb5,
3598            >(_buf?)?
3599            .into_result::<FDomainMarker>("write_channel")?;
3600            Ok(_response.map(|x| x))
3601        }
3602        self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
3603            (handle, data, handles),
3604            0x75a2559b945d5eb5,
3605            fidl::encoding::DynamicFlags::FLEXIBLE,
3606            _decode,
3607        )
3608    }
3609
3610    type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
3611        ChannelReadChannelStreamingStartResult,
3612        fidl::encoding::DefaultFuchsiaResourceDialect,
3613    >;
3614    fn r#read_channel_streaming_start(
3615        &self,
3616        mut handle: &HandleId,
3617    ) -> Self::ReadChannelStreamingStartResponseFut {
3618        fn _decode(
3619            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3620        ) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
3621            let _response = fidl::client::decode_transaction_body::<
3622                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3623                fidl::encoding::DefaultFuchsiaResourceDialect,
3624                0x3c73e85476a203df,
3625            >(_buf?)?
3626            .into_result::<FDomainMarker>("read_channel_streaming_start")?;
3627            Ok(_response.map(|x| x))
3628        }
3629        self.client.send_query_and_decode::<
3630            ChannelReadChannelStreamingStartRequest,
3631            ChannelReadChannelStreamingStartResult,
3632        >(
3633            (handle,),
3634            0x3c73e85476a203df,
3635            fidl::encoding::DynamicFlags::FLEXIBLE,
3636            _decode,
3637        )
3638    }
3639
3640    type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
3641        ChannelReadChannelStreamingStopResult,
3642        fidl::encoding::DefaultFuchsiaResourceDialect,
3643    >;
3644    fn r#read_channel_streaming_stop(
3645        &self,
3646        mut handle: &HandleId,
3647    ) -> Self::ReadChannelStreamingStopResponseFut {
3648        fn _decode(
3649            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3650        ) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
3651            let _response = fidl::client::decode_transaction_body::<
3652                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3653                fidl::encoding::DefaultFuchsiaResourceDialect,
3654                0x56f21d6ed68186e0,
3655            >(_buf?)?
3656            .into_result::<FDomainMarker>("read_channel_streaming_stop")?;
3657            Ok(_response.map(|x| x))
3658        }
3659        self.client.send_query_and_decode::<
3660            ChannelReadChannelStreamingStopRequest,
3661            ChannelReadChannelStreamingStopResult,
3662        >(
3663            (handle,),
3664            0x56f21d6ed68186e0,
3665            fidl::encoding::DynamicFlags::FLEXIBLE,
3666            _decode,
3667        )
3668    }
3669
3670    type CreateEventResponseFut = fidl::client::QueryResponseFut<
3671        EventCreateEventResult,
3672        fidl::encoding::DefaultFuchsiaResourceDialect,
3673    >;
3674    fn r#create_event(&self, mut handle: &NewHandleId) -> Self::CreateEventResponseFut {
3675        fn _decode(
3676            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3677        ) -> Result<EventCreateEventResult, fidl::Error> {
3678            let _response = fidl::client::decode_transaction_body::<
3679                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3680                fidl::encoding::DefaultFuchsiaResourceDialect,
3681                0x7b05b3f262635987,
3682            >(_buf?)?
3683            .into_result::<FDomainMarker>("create_event")?;
3684            Ok(_response.map(|x| x))
3685        }
3686        self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
3687            (handle,),
3688            0x7b05b3f262635987,
3689            fidl::encoding::DynamicFlags::FLEXIBLE,
3690            _decode,
3691        )
3692    }
3693
3694    type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
3695        EventPairCreateEventPairResult,
3696        fidl::encoding::DefaultFuchsiaResourceDialect,
3697    >;
3698    fn r#create_event_pair(
3699        &self,
3700        mut handles: &[NewHandleId; 2],
3701    ) -> Self::CreateEventPairResponseFut {
3702        fn _decode(
3703            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3704        ) -> Result<EventPairCreateEventPairResult, fidl::Error> {
3705            let _response = fidl::client::decode_transaction_body::<
3706                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3707                fidl::encoding::DefaultFuchsiaResourceDialect,
3708                0x7aef61effa65656d,
3709            >(_buf?)?
3710            .into_result::<FDomainMarker>("create_event_pair")?;
3711            Ok(_response.map(|x| x))
3712        }
3713        self.client.send_query_and_decode::<
3714            EventPairCreateEventPairRequest,
3715            EventPairCreateEventPairResult,
3716        >(
3717            (handles,),
3718            0x7aef61effa65656d,
3719            fidl::encoding::DynamicFlags::FLEXIBLE,
3720            _decode,
3721        )
3722    }
3723
3724    type CreateSocketResponseFut = fidl::client::QueryResponseFut<
3725        SocketCreateSocketResult,
3726        fidl::encoding::DefaultFuchsiaResourceDialect,
3727    >;
3728    fn r#create_socket(
3729        &self,
3730        mut options: SocketType,
3731        mut handles: &[NewHandleId; 2],
3732    ) -> Self::CreateSocketResponseFut {
3733        fn _decode(
3734            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3735        ) -> Result<SocketCreateSocketResult, fidl::Error> {
3736            let _response = fidl::client::decode_transaction_body::<
3737                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3738                fidl::encoding::DefaultFuchsiaResourceDialect,
3739                0x200bf0ea21932de0,
3740            >(_buf?)?
3741            .into_result::<FDomainMarker>("create_socket")?;
3742            Ok(_response.map(|x| x))
3743        }
3744        self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
3745            (options, handles),
3746            0x200bf0ea21932de0,
3747            fidl::encoding::DynamicFlags::FLEXIBLE,
3748            _decode,
3749        )
3750    }
3751
3752    type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
3753        SocketSetSocketDispositionResult,
3754        fidl::encoding::DefaultFuchsiaResourceDialect,
3755    >;
3756    fn r#set_socket_disposition(
3757        &self,
3758        mut handle: &HandleId,
3759        mut disposition: SocketDisposition,
3760        mut disposition_peer: SocketDisposition,
3761    ) -> Self::SetSocketDispositionResponseFut {
3762        fn _decode(
3763            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3764        ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
3765            let _response = fidl::client::decode_transaction_body::<
3766                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3767                fidl::encoding::DefaultFuchsiaResourceDialect,
3768                0x60d3c7ccb17f9bdf,
3769            >(_buf?)?
3770            .into_result::<FDomainMarker>("set_socket_disposition")?;
3771            Ok(_response.map(|x| x))
3772        }
3773        self.client.send_query_and_decode::<
3774            SocketSetSocketDispositionRequest,
3775            SocketSetSocketDispositionResult,
3776        >(
3777            (handle, disposition, disposition_peer,),
3778            0x60d3c7ccb17f9bdf,
3779            fidl::encoding::DynamicFlags::FLEXIBLE,
3780            _decode,
3781        )
3782    }
3783
3784    type ReadSocketResponseFut = fidl::client::QueryResponseFut<
3785        SocketReadSocketResult,
3786        fidl::encoding::DefaultFuchsiaResourceDialect,
3787    >;
3788    fn r#read_socket(
3789        &self,
3790        mut handle: &HandleId,
3791        mut max_bytes: u64,
3792    ) -> Self::ReadSocketResponseFut {
3793        fn _decode(
3794            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3795        ) -> Result<SocketReadSocketResult, fidl::Error> {
3796            let _response = fidl::client::decode_transaction_body::<
3797                fidl::encoding::FlexibleResultType<SocketData, Error>,
3798                fidl::encoding::DefaultFuchsiaResourceDialect,
3799                0x1da8aabec249c02e,
3800            >(_buf?)?
3801            .into_result::<FDomainMarker>("read_socket")?;
3802            Ok(_response.map(|x| (x.data, x.is_datagram)))
3803        }
3804        self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
3805            (handle, max_bytes),
3806            0x1da8aabec249c02e,
3807            fidl::encoding::DynamicFlags::FLEXIBLE,
3808            _decode,
3809        )
3810    }
3811
3812    type WriteSocketResponseFut = fidl::client::QueryResponseFut<
3813        SocketWriteSocketResult,
3814        fidl::encoding::DefaultFuchsiaResourceDialect,
3815    >;
3816    fn r#write_socket(
3817        &self,
3818        mut handle: &HandleId,
3819        mut data: &[u8],
3820    ) -> Self::WriteSocketResponseFut {
3821        fn _decode(
3822            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3823        ) -> Result<SocketWriteSocketResult, fidl::Error> {
3824            let _response = fidl::client::decode_transaction_body::<
3825                fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
3826                fidl::encoding::DefaultFuchsiaResourceDialect,
3827                0x5b541623cbbbf683,
3828            >(_buf?)?
3829            .into_result::<FDomainMarker>("write_socket")?;
3830            Ok(_response.map(|x| x.wrote))
3831        }
3832        self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
3833            (handle, data),
3834            0x5b541623cbbbf683,
3835            fidl::encoding::DynamicFlags::FLEXIBLE,
3836            _decode,
3837        )
3838    }
3839
3840    type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
3841        SocketReadSocketStreamingStartResult,
3842        fidl::encoding::DefaultFuchsiaResourceDialect,
3843    >;
3844    fn r#read_socket_streaming_start(
3845        &self,
3846        mut handle: &HandleId,
3847    ) -> Self::ReadSocketStreamingStartResponseFut {
3848        fn _decode(
3849            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3850        ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
3851            let _response = fidl::client::decode_transaction_body::<
3852                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3853                fidl::encoding::DefaultFuchsiaResourceDialect,
3854                0x2a592748d5f33445,
3855            >(_buf?)?
3856            .into_result::<FDomainMarker>("read_socket_streaming_start")?;
3857            Ok(_response.map(|x| x))
3858        }
3859        self.client.send_query_and_decode::<
3860            SocketReadSocketStreamingStartRequest,
3861            SocketReadSocketStreamingStartResult,
3862        >(
3863            (handle,),
3864            0x2a592748d5f33445,
3865            fidl::encoding::DynamicFlags::FLEXIBLE,
3866            _decode,
3867        )
3868    }
3869
3870    type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
3871        SocketReadSocketStreamingStopResult,
3872        fidl::encoding::DefaultFuchsiaResourceDialect,
3873    >;
3874    fn r#read_socket_streaming_stop(
3875        &self,
3876        mut handle: &HandleId,
3877    ) -> Self::ReadSocketStreamingStopResponseFut {
3878        fn _decode(
3879            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3880        ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
3881            let _response = fidl::client::decode_transaction_body::<
3882                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3883                fidl::encoding::DefaultFuchsiaResourceDialect,
3884                0x53e5cade5f4d22e7,
3885            >(_buf?)?
3886            .into_result::<FDomainMarker>("read_socket_streaming_stop")?;
3887            Ok(_response.map(|x| x))
3888        }
3889        self.client.send_query_and_decode::<
3890            SocketReadSocketStreamingStopRequest,
3891            SocketReadSocketStreamingStopResult,
3892        >(
3893            (handle,),
3894            0x53e5cade5f4d22e7,
3895            fidl::encoding::DynamicFlags::FLEXIBLE,
3896            _decode,
3897        )
3898    }
3899
3900    type CreateVmoResponseFut = fidl::client::QueryResponseFut<
3901        VmoCreateVmoResult,
3902        fidl::encoding::DefaultFuchsiaResourceDialect,
3903    >;
3904    fn r#create_vmo(
3905        &self,
3906        mut size: u64,
3907        mut options: VmoOptions,
3908        mut handle: &NewHandleId,
3909    ) -> Self::CreateVmoResponseFut {
3910        fn _decode(
3911            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3912        ) -> Result<VmoCreateVmoResult, fidl::Error> {
3913            let _response = fidl::client::decode_transaction_body::<
3914                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3915                fidl::encoding::DefaultFuchsiaResourceDialect,
3916                0x392dcaac1ddd8868,
3917            >(_buf?)?
3918            .into_result::<FDomainMarker>("create_vmo")?;
3919            Ok(_response.map(|x| x))
3920        }
3921        self.client.send_query_and_decode::<VmoCreateVmoRequest, VmoCreateVmoResult>(
3922            (size, options, handle),
3923            0x392dcaac1ddd8868,
3924            fidl::encoding::DynamicFlags::FLEXIBLE,
3925            _decode,
3926        )
3927    }
3928
3929    type ReadVmoResponseFut = fidl::client::QueryResponseFut<
3930        VmoReadVmoResult,
3931        fidl::encoding::DefaultFuchsiaResourceDialect,
3932    >;
3933    fn r#read_vmo(
3934        &self,
3935        mut handle: &HandleId,
3936        mut offset: u64,
3937        mut size: u64,
3938    ) -> Self::ReadVmoResponseFut {
3939        fn _decode(
3940            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3941        ) -> Result<VmoReadVmoResult, fidl::Error> {
3942            let _response = fidl::client::decode_transaction_body::<
3943                fidl::encoding::FlexibleResultType<VmoReadVmoResponse, Error>,
3944                fidl::encoding::DefaultFuchsiaResourceDialect,
3945                0x62690ec76b0f2fe6,
3946            >(_buf?)?
3947            .into_result::<FDomainMarker>("read_vmo")?;
3948            Ok(_response.map(|x| x.data))
3949        }
3950        self.client.send_query_and_decode::<VmoReadVmoRequest, VmoReadVmoResult>(
3951            (handle, offset, size),
3952            0x62690ec76b0f2fe6,
3953            fidl::encoding::DynamicFlags::FLEXIBLE,
3954            _decode,
3955        )
3956    }
3957
3958    type WriteVmoResponseFut = fidl::client::QueryResponseFut<
3959        VmoWriteVmoResult,
3960        fidl::encoding::DefaultFuchsiaResourceDialect,
3961    >;
3962    fn r#write_vmo(
3963        &self,
3964        mut handle: &HandleId,
3965        mut offset: u64,
3966        mut data: &[u8],
3967    ) -> Self::WriteVmoResponseFut {
3968        fn _decode(
3969            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3970        ) -> Result<VmoWriteVmoResult, fidl::Error> {
3971            let _response = fidl::client::decode_transaction_body::<
3972                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
3973                fidl::encoding::DefaultFuchsiaResourceDialect,
3974                0x2f6ac299380e486e,
3975            >(_buf?)?
3976            .into_result::<FDomainMarker>("write_vmo")?;
3977            Ok(_response.map(|x| x))
3978        }
3979        self.client.send_query_and_decode::<VmoWriteVmoRequest, VmoWriteVmoResult>(
3980            (handle, offset, data),
3981            0x2f6ac299380e486e,
3982            fidl::encoding::DynamicFlags::FLEXIBLE,
3983            _decode,
3984        )
3985    }
3986
3987    type GetVmoSizeResponseFut = fidl::client::QueryResponseFut<
3988        VmoGetVmoSizeResult,
3989        fidl::encoding::DefaultFuchsiaResourceDialect,
3990    >;
3991    fn r#get_vmo_size(&self, mut handle: &HandleId) -> Self::GetVmoSizeResponseFut {
3992        fn _decode(
3993            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3994        ) -> Result<VmoGetVmoSizeResult, fidl::Error> {
3995            let _response = fidl::client::decode_transaction_body::<
3996                fidl::encoding::FlexibleResultType<VmoGetVmoSizeResponse, Error>,
3997                fidl::encoding::DefaultFuchsiaResourceDialect,
3998                0x717f9f3a9ff6906e,
3999            >(_buf?)?
4000            .into_result::<FDomainMarker>("get_vmo_size")?;
4001            Ok(_response.map(|x| x.size))
4002        }
4003        self.client.send_query_and_decode::<VmoGetVmoSizeRequest, VmoGetVmoSizeResult>(
4004            (handle,),
4005            0x717f9f3a9ff6906e,
4006            fidl::encoding::DynamicFlags::FLEXIBLE,
4007            _decode,
4008        )
4009    }
4010
4011    type SetVmoSizeResponseFut = fidl::client::QueryResponseFut<
4012        VmoSetVmoSizeResult,
4013        fidl::encoding::DefaultFuchsiaResourceDialect,
4014    >;
4015    fn r#set_vmo_size(&self, mut handle: &HandleId, mut size: u64) -> Self::SetVmoSizeResponseFut {
4016        fn _decode(
4017            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4018        ) -> Result<VmoSetVmoSizeResult, fidl::Error> {
4019            let _response = fidl::client::decode_transaction_body::<
4020                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4021                fidl::encoding::DefaultFuchsiaResourceDialect,
4022                0x7f6f77ac37afe38b,
4023            >(_buf?)?
4024            .into_result::<FDomainMarker>("set_vmo_size")?;
4025            Ok(_response.map(|x| x))
4026        }
4027        self.client.send_query_and_decode::<VmoSetVmoSizeRequest, VmoSetVmoSizeResult>(
4028            (handle, size),
4029            0x7f6f77ac37afe38b,
4030            fidl::encoding::DynamicFlags::FLEXIBLE,
4031            _decode,
4032        )
4033    }
4034
4035    type GetVmoStreamSizeResponseFut = fidl::client::QueryResponseFut<
4036        VmoGetVmoStreamSizeResult,
4037        fidl::encoding::DefaultFuchsiaResourceDialect,
4038    >;
4039    fn r#get_vmo_stream_size(&self, mut handle: &HandleId) -> Self::GetVmoStreamSizeResponseFut {
4040        fn _decode(
4041            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4042        ) -> Result<VmoGetVmoStreamSizeResult, fidl::Error> {
4043            let _response = fidl::client::decode_transaction_body::<
4044                fidl::encoding::FlexibleResultType<VmoGetVmoStreamSizeResponse, Error>,
4045                fidl::encoding::DefaultFuchsiaResourceDialect,
4046                0x54020f4280cb038,
4047            >(_buf?)?
4048            .into_result::<FDomainMarker>("get_vmo_stream_size")?;
4049            Ok(_response.map(|x| x.size))
4050        }
4051        self.client.send_query_and_decode::<VmoGetVmoStreamSizeRequest, VmoGetVmoStreamSizeResult>(
4052            (handle,),
4053            0x54020f4280cb038,
4054            fidl::encoding::DynamicFlags::FLEXIBLE,
4055            _decode,
4056        )
4057    }
4058
4059    type SetVmoStreamSizeResponseFut = fidl::client::QueryResponseFut<
4060        VmoSetVmoStreamSizeResult,
4061        fidl::encoding::DefaultFuchsiaResourceDialect,
4062    >;
4063    fn r#set_vmo_stream_size(
4064        &self,
4065        mut handle: &HandleId,
4066        mut size: u64,
4067    ) -> Self::SetVmoStreamSizeResponseFut {
4068        fn _decode(
4069            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4070        ) -> Result<VmoSetVmoStreamSizeResult, fidl::Error> {
4071            let _response = fidl::client::decode_transaction_body::<
4072                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4073                fidl::encoding::DefaultFuchsiaResourceDialect,
4074                0x3bdb108fb18002eb,
4075            >(_buf?)?
4076            .into_result::<FDomainMarker>("set_vmo_stream_size")?;
4077            Ok(_response.map(|x| x))
4078        }
4079        self.client.send_query_and_decode::<VmoSetVmoStreamSizeRequest, VmoSetVmoStreamSizeResult>(
4080            (handle, size),
4081            0x3bdb108fb18002eb,
4082            fidl::encoding::DynamicFlags::FLEXIBLE,
4083            _decode,
4084        )
4085    }
4086
4087    type GetNamespaceResponseFut = fidl::client::QueryResponseFut<
4088        FDomainGetNamespaceResult,
4089        fidl::encoding::DefaultFuchsiaResourceDialect,
4090    >;
4091    fn r#get_namespace(&self, mut new_handle: &NewHandleId) -> Self::GetNamespaceResponseFut {
4092        fn _decode(
4093            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4094        ) -> Result<FDomainGetNamespaceResult, fidl::Error> {
4095            let _response = fidl::client::decode_transaction_body::<
4096                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4097                fidl::encoding::DefaultFuchsiaResourceDialect,
4098                0x74f2e74d9f53e11e,
4099            >(_buf?)?
4100            .into_result::<FDomainMarker>("get_namespace")?;
4101            Ok(_response.map(|x| x))
4102        }
4103        self.client.send_query_and_decode::<FDomainGetNamespaceRequest, FDomainGetNamespaceResult>(
4104            (new_handle,),
4105            0x74f2e74d9f53e11e,
4106            fidl::encoding::DynamicFlags::FLEXIBLE,
4107            _decode,
4108        )
4109    }
4110
4111    type CloseResponseFut = fidl::client::QueryResponseFut<
4112        FDomainCloseResult,
4113        fidl::encoding::DefaultFuchsiaResourceDialect,
4114    >;
4115    fn r#close(&self, mut handles: &[HandleId]) -> Self::CloseResponseFut {
4116        fn _decode(
4117            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4118        ) -> Result<FDomainCloseResult, fidl::Error> {
4119            let _response = fidl::client::decode_transaction_body::<
4120                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4121                fidl::encoding::DefaultFuchsiaResourceDialect,
4122                0x5ef8c24362964257,
4123            >(_buf?)?
4124            .into_result::<FDomainMarker>("close")?;
4125            Ok(_response.map(|x| x))
4126        }
4127        self.client.send_query_and_decode::<FDomainCloseRequest, FDomainCloseResult>(
4128            (handles,),
4129            0x5ef8c24362964257,
4130            fidl::encoding::DynamicFlags::FLEXIBLE,
4131            _decode,
4132        )
4133    }
4134
4135    type DuplicateResponseFut = fidl::client::QueryResponseFut<
4136        FDomainDuplicateResult,
4137        fidl::encoding::DefaultFuchsiaResourceDialect,
4138    >;
4139    fn r#duplicate(
4140        &self,
4141        mut handle: &HandleId,
4142        mut new_handle: &NewHandleId,
4143        mut rights: fidl::Rights,
4144    ) -> Self::DuplicateResponseFut {
4145        fn _decode(
4146            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4147        ) -> Result<FDomainDuplicateResult, fidl::Error> {
4148            let _response = fidl::client::decode_transaction_body::<
4149                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4150                fidl::encoding::DefaultFuchsiaResourceDialect,
4151                0x7a85b94bd1777ab9,
4152            >(_buf?)?
4153            .into_result::<FDomainMarker>("duplicate")?;
4154            Ok(_response.map(|x| x))
4155        }
4156        self.client.send_query_and_decode::<FDomainDuplicateRequest, FDomainDuplicateResult>(
4157            (handle, new_handle, rights),
4158            0x7a85b94bd1777ab9,
4159            fidl::encoding::DynamicFlags::FLEXIBLE,
4160            _decode,
4161        )
4162    }
4163
4164    type ReplaceResponseFut = fidl::client::QueryResponseFut<
4165        FDomainReplaceResult,
4166        fidl::encoding::DefaultFuchsiaResourceDialect,
4167    >;
4168    fn r#replace(
4169        &self,
4170        mut handle: &HandleId,
4171        mut new_handle: &NewHandleId,
4172        mut rights: fidl::Rights,
4173    ) -> Self::ReplaceResponseFut {
4174        fn _decode(
4175            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4176        ) -> Result<FDomainReplaceResult, fidl::Error> {
4177            let _response = fidl::client::decode_transaction_body::<
4178                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4179                fidl::encoding::DefaultFuchsiaResourceDialect,
4180                0x32fa64625a5bd3be,
4181            >(_buf?)?
4182            .into_result::<FDomainMarker>("replace")?;
4183            Ok(_response.map(|x| x))
4184        }
4185        self.client.send_query_and_decode::<FDomainReplaceRequest, FDomainReplaceResult>(
4186            (handle, new_handle, rights),
4187            0x32fa64625a5bd3be,
4188            fidl::encoding::DynamicFlags::FLEXIBLE,
4189            _decode,
4190        )
4191    }
4192
4193    type SignalResponseFut = fidl::client::QueryResponseFut<
4194        FDomainSignalResult,
4195        fidl::encoding::DefaultFuchsiaResourceDialect,
4196    >;
4197    fn r#signal(
4198        &self,
4199        mut handle: &HandleId,
4200        mut set: u32,
4201        mut clear: u32,
4202    ) -> Self::SignalResponseFut {
4203        fn _decode(
4204            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4205        ) -> Result<FDomainSignalResult, fidl::Error> {
4206            let _response = fidl::client::decode_transaction_body::<
4207                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4208                fidl::encoding::DefaultFuchsiaResourceDialect,
4209                0xe8352fb978996d9,
4210            >(_buf?)?
4211            .into_result::<FDomainMarker>("signal")?;
4212            Ok(_response.map(|x| x))
4213        }
4214        self.client.send_query_and_decode::<FDomainSignalRequest, FDomainSignalResult>(
4215            (handle, set, clear),
4216            0xe8352fb978996d9,
4217            fidl::encoding::DynamicFlags::FLEXIBLE,
4218            _decode,
4219        )
4220    }
4221
4222    type SignalPeerResponseFut = fidl::client::QueryResponseFut<
4223        FDomainSignalPeerResult,
4224        fidl::encoding::DefaultFuchsiaResourceDialect,
4225    >;
4226    fn r#signal_peer(
4227        &self,
4228        mut handle: &HandleId,
4229        mut set: u32,
4230        mut clear: u32,
4231    ) -> Self::SignalPeerResponseFut {
4232        fn _decode(
4233            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4234        ) -> Result<FDomainSignalPeerResult, fidl::Error> {
4235            let _response = fidl::client::decode_transaction_body::<
4236                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
4237                fidl::encoding::DefaultFuchsiaResourceDialect,
4238                0x7e84ec8ca7eabaf8,
4239            >(_buf?)?
4240            .into_result::<FDomainMarker>("signal_peer")?;
4241            Ok(_response.map(|x| x))
4242        }
4243        self.client.send_query_and_decode::<FDomainSignalPeerRequest, FDomainSignalPeerResult>(
4244            (handle, set, clear),
4245            0x7e84ec8ca7eabaf8,
4246            fidl::encoding::DynamicFlags::FLEXIBLE,
4247            _decode,
4248        )
4249    }
4250
4251    type WaitForSignalsResponseFut = fidl::client::QueryResponseFut<
4252        FDomainWaitForSignalsResult,
4253        fidl::encoding::DefaultFuchsiaResourceDialect,
4254    >;
4255    fn r#wait_for_signals(
4256        &self,
4257        mut handle: &HandleId,
4258        mut signals: u32,
4259    ) -> Self::WaitForSignalsResponseFut {
4260        fn _decode(
4261            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4262        ) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
4263            let _response = fidl::client::decode_transaction_body::<
4264                fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
4265                fidl::encoding::DefaultFuchsiaResourceDialect,
4266                0x8f72d9b4b85c1eb,
4267            >(_buf?)?
4268            .into_result::<FDomainMarker>("wait_for_signals")?;
4269            Ok(_response.map(|x| x.signals))
4270        }
4271        self.client
4272            .send_query_and_decode::<FDomainWaitForSignalsRequest, FDomainWaitForSignalsResult>(
4273                (handle, signals),
4274                0x8f72d9b4b85c1eb,
4275                fidl::encoding::DynamicFlags::FLEXIBLE,
4276                _decode,
4277            )
4278    }
4279
4280    type GetKoidResponseFut = fidl::client::QueryResponseFut<
4281        FDomainGetKoidResult,
4282        fidl::encoding::DefaultFuchsiaResourceDialect,
4283    >;
4284    fn r#get_koid(&self, mut handle: &HandleId) -> Self::GetKoidResponseFut {
4285        fn _decode(
4286            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4287        ) -> Result<FDomainGetKoidResult, fidl::Error> {
4288            let _response = fidl::client::decode_transaction_body::<
4289                fidl::encoding::FlexibleResultType<FDomainGetKoidResponse, Error>,
4290                fidl::encoding::DefaultFuchsiaResourceDialect,
4291                0x437db979a63402c3,
4292            >(_buf?)?
4293            .into_result::<FDomainMarker>("get_koid")?;
4294            Ok(_response.map(|x| x.koid))
4295        }
4296        self.client.send_query_and_decode::<FDomainGetKoidRequest, FDomainGetKoidResult>(
4297            (handle,),
4298            0x437db979a63402c3,
4299            fidl::encoding::DynamicFlags::FLEXIBLE,
4300            _decode,
4301        )
4302    }
4303}
4304
4305pub struct FDomainEventStream {
4306    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4307}
4308
4309impl std::marker::Unpin for FDomainEventStream {}
4310
4311impl futures::stream::FusedStream for FDomainEventStream {
4312    fn is_terminated(&self) -> bool {
4313        self.event_receiver.is_terminated()
4314    }
4315}
4316
4317impl futures::Stream for FDomainEventStream {
4318    type Item = Result<FDomainEvent, fidl::Error>;
4319
4320    fn poll_next(
4321        mut self: std::pin::Pin<&mut Self>,
4322        cx: &mut std::task::Context<'_>,
4323    ) -> std::task::Poll<Option<Self::Item>> {
4324        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4325            &mut self.event_receiver,
4326            cx
4327        )?) {
4328            Some(buf) => std::task::Poll::Ready(Some(FDomainEvent::decode(buf))),
4329            None => std::task::Poll::Ready(None),
4330        }
4331    }
4332}
4333
4334#[derive(Debug)]
4335pub enum FDomainEvent {
4336    OnChannelStreamingData {
4337        handle: HandleId,
4338        channel_sent: ChannelSent,
4339    },
4340    OnSocketStreamingData {
4341        handle: HandleId,
4342        socket_message: SocketMessage,
4343    },
4344    #[non_exhaustive]
4345    _UnknownEvent {
4346        /// Ordinal of the event that was sent.
4347        ordinal: u64,
4348    },
4349}
4350
4351impl FDomainEvent {
4352    #[allow(irrefutable_let_patterns)]
4353    pub fn into_on_channel_streaming_data(self) -> Option<(HandleId, ChannelSent)> {
4354        if let FDomainEvent::OnChannelStreamingData { handle, channel_sent } = self {
4355            Some((handle, channel_sent))
4356        } else {
4357            None
4358        }
4359    }
4360    #[allow(irrefutable_let_patterns)]
4361    pub fn into_on_socket_streaming_data(self) -> Option<(HandleId, SocketMessage)> {
4362        if let FDomainEvent::OnSocketStreamingData { handle, socket_message } = self {
4363            Some((handle, socket_message))
4364        } else {
4365            None
4366        }
4367    }
4368
4369    /// Decodes a message buffer as a [`FDomainEvent`].
4370    fn decode(
4371        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4372    ) -> Result<FDomainEvent, fidl::Error> {
4373        let (bytes, _handles) = buf.split_mut();
4374        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4375        debug_assert_eq!(tx_header.tx_id, 0);
4376        match tx_header.ordinal {
4377            0x7d4431805202dfe1 => {
4378                let mut out = fidl::new_empty!(
4379                    ChannelOnChannelStreamingDataRequest,
4380                    fidl::encoding::DefaultFuchsiaResourceDialect
4381                );
4382                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4383                Ok((FDomainEvent::OnChannelStreamingData {
4384                    handle: out.handle,
4385                    channel_sent: out.channel_sent,
4386                }))
4387            }
4388            0x998b5e66b3c80a2 => {
4389                let mut out = fidl::new_empty!(
4390                    SocketOnSocketStreamingDataRequest,
4391                    fidl::encoding::DefaultFuchsiaResourceDialect
4392                );
4393                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4394                Ok((FDomainEvent::OnSocketStreamingData {
4395                    handle: out.handle,
4396                    socket_message: out.socket_message,
4397                }))
4398            }
4399            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4400                Ok(FDomainEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4401            }
4402            _ => Err(fidl::Error::UnknownOrdinal {
4403                ordinal: tx_header.ordinal,
4404                protocol_name: <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4405            }),
4406        }
4407    }
4408}
4409
4410/// A Stream of incoming requests for fuchsia.fdomain/FDomain.
4411pub struct FDomainRequestStream {
4412    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4413    is_terminated: bool,
4414}
4415
4416impl std::marker::Unpin for FDomainRequestStream {}
4417
4418impl futures::stream::FusedStream for FDomainRequestStream {
4419    fn is_terminated(&self) -> bool {
4420        self.is_terminated
4421    }
4422}
4423
4424impl fidl::endpoints::RequestStream for FDomainRequestStream {
4425    type Protocol = FDomainMarker;
4426    type ControlHandle = FDomainControlHandle;
4427
4428    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4429        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4430    }
4431
4432    fn control_handle(&self) -> Self::ControlHandle {
4433        FDomainControlHandle { inner: self.inner.clone() }
4434    }
4435
4436    fn into_inner(
4437        self,
4438    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4439    {
4440        (self.inner, self.is_terminated)
4441    }
4442
4443    fn from_inner(
4444        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4445        is_terminated: bool,
4446    ) -> Self {
4447        Self { inner, is_terminated }
4448    }
4449}
4450
4451impl futures::Stream for FDomainRequestStream {
4452    type Item = Result<FDomainRequest, fidl::Error>;
4453
4454    fn poll_next(
4455        mut self: std::pin::Pin<&mut Self>,
4456        cx: &mut std::task::Context<'_>,
4457    ) -> std::task::Poll<Option<Self::Item>> {
4458        let this = &mut *self;
4459        if this.inner.check_shutdown(cx) {
4460            this.is_terminated = true;
4461            return std::task::Poll::Ready(None);
4462        }
4463        if this.is_terminated {
4464            panic!("polled FDomainRequestStream after completion");
4465        }
4466        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4467            |bytes, handles| {
4468                match this.inner.channel().read_etc(cx, bytes, handles) {
4469                    std::task::Poll::Ready(Ok(())) => {}
4470                    std::task::Poll::Pending => return std::task::Poll::Pending,
4471                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4472                        this.is_terminated = true;
4473                        return std::task::Poll::Ready(None);
4474                    }
4475                    std::task::Poll::Ready(Err(e)) => {
4476                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4477                            e.into(),
4478                        ))));
4479                    }
4480                }
4481
4482                // A message has been received from the channel
4483                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4484
4485                std::task::Poll::Ready(Some(match header.ordinal {
4486                    0x182d38bfe88673b5 => {
4487                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4488                        let mut req = fidl::new_empty!(
4489                            ChannelCreateChannelRequest,
4490                            fidl::encoding::DefaultFuchsiaResourceDialect
4491                        );
4492                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
4493                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4494                        Ok(FDomainRequest::CreateChannel {
4495                            handles: req.handles,
4496
4497                            responder: FDomainCreateChannelResponder {
4498                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4499                                tx_id: header.tx_id,
4500                            },
4501                        })
4502                    }
4503                    0x6ef47bf27bf7d050 => {
4504                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4505                        let mut req = fidl::new_empty!(
4506                            ChannelReadChannelRequest,
4507                            fidl::encoding::DefaultFuchsiaResourceDialect
4508                        );
4509                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
4510                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4511                        Ok(FDomainRequest::ReadChannel {
4512                            handle: req.handle,
4513
4514                            responder: FDomainReadChannelResponder {
4515                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4516                                tx_id: header.tx_id,
4517                            },
4518                        })
4519                    }
4520                    0x75a2559b945d5eb5 => {
4521                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4522                        let mut req = fidl::new_empty!(
4523                            ChannelWriteChannelRequest,
4524                            fidl::encoding::DefaultFuchsiaResourceDialect
4525                        );
4526                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
4527                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4528                        Ok(FDomainRequest::WriteChannel {
4529                            handle: req.handle,
4530                            data: req.data,
4531                            handles: req.handles,
4532
4533                            responder: FDomainWriteChannelResponder {
4534                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4535                                tx_id: header.tx_id,
4536                            },
4537                        })
4538                    }
4539                    0x3c73e85476a203df => {
4540                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4541                        let mut req = fidl::new_empty!(
4542                            ChannelReadChannelStreamingStartRequest,
4543                            fidl::encoding::DefaultFuchsiaResourceDialect
4544                        );
4545                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
4546                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4547                        Ok(FDomainRequest::ReadChannelStreamingStart {
4548                            handle: req.handle,
4549
4550                            responder: FDomainReadChannelStreamingStartResponder {
4551                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4552                                tx_id: header.tx_id,
4553                            },
4554                        })
4555                    }
4556                    0x56f21d6ed68186e0 => {
4557                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4558                        let mut req = fidl::new_empty!(
4559                            ChannelReadChannelStreamingStopRequest,
4560                            fidl::encoding::DefaultFuchsiaResourceDialect
4561                        );
4562                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
4563                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4564                        Ok(FDomainRequest::ReadChannelStreamingStop {
4565                            handle: req.handle,
4566
4567                            responder: FDomainReadChannelStreamingStopResponder {
4568                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4569                                tx_id: header.tx_id,
4570                            },
4571                        })
4572                    }
4573                    0x7b05b3f262635987 => {
4574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4575                        let mut req = fidl::new_empty!(
4576                            EventCreateEventRequest,
4577                            fidl::encoding::DefaultFuchsiaResourceDialect
4578                        );
4579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
4580                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4581                        Ok(FDomainRequest::CreateEvent {
4582                            handle: req.handle,
4583
4584                            responder: FDomainCreateEventResponder {
4585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4586                                tx_id: header.tx_id,
4587                            },
4588                        })
4589                    }
4590                    0x7aef61effa65656d => {
4591                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4592                        let mut req = fidl::new_empty!(
4593                            EventPairCreateEventPairRequest,
4594                            fidl::encoding::DefaultFuchsiaResourceDialect
4595                        );
4596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
4597                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4598                        Ok(FDomainRequest::CreateEventPair {
4599                            handles: req.handles,
4600
4601                            responder: FDomainCreateEventPairResponder {
4602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4603                                tx_id: header.tx_id,
4604                            },
4605                        })
4606                    }
4607                    0x200bf0ea21932de0 => {
4608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4609                        let mut req = fidl::new_empty!(
4610                            SocketCreateSocketRequest,
4611                            fidl::encoding::DefaultFuchsiaResourceDialect
4612                        );
4613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
4614                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4615                        Ok(FDomainRequest::CreateSocket {
4616                            options: req.options,
4617                            handles: req.handles,
4618
4619                            responder: FDomainCreateSocketResponder {
4620                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4621                                tx_id: header.tx_id,
4622                            },
4623                        })
4624                    }
4625                    0x60d3c7ccb17f9bdf => {
4626                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4627                        let mut req = fidl::new_empty!(
4628                            SocketSetSocketDispositionRequest,
4629                            fidl::encoding::DefaultFuchsiaResourceDialect
4630                        );
4631                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
4632                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4633                        Ok(FDomainRequest::SetSocketDisposition {
4634                            handle: req.handle,
4635                            disposition: req.disposition,
4636                            disposition_peer: req.disposition_peer,
4637
4638                            responder: FDomainSetSocketDispositionResponder {
4639                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4640                                tx_id: header.tx_id,
4641                            },
4642                        })
4643                    }
4644                    0x1da8aabec249c02e => {
4645                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4646                        let mut req = fidl::new_empty!(
4647                            SocketReadSocketRequest,
4648                            fidl::encoding::DefaultFuchsiaResourceDialect
4649                        );
4650                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
4651                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4652                        Ok(FDomainRequest::ReadSocket {
4653                            handle: req.handle,
4654                            max_bytes: req.max_bytes,
4655
4656                            responder: FDomainReadSocketResponder {
4657                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4658                                tx_id: header.tx_id,
4659                            },
4660                        })
4661                    }
4662                    0x5b541623cbbbf683 => {
4663                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4664                        let mut req = fidl::new_empty!(
4665                            SocketWriteSocketRequest,
4666                            fidl::encoding::DefaultFuchsiaResourceDialect
4667                        );
4668                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
4669                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4670                        Ok(FDomainRequest::WriteSocket {
4671                            handle: req.handle,
4672                            data: req.data,
4673
4674                            responder: FDomainWriteSocketResponder {
4675                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4676                                tx_id: header.tx_id,
4677                            },
4678                        })
4679                    }
4680                    0x2a592748d5f33445 => {
4681                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4682                        let mut req = fidl::new_empty!(
4683                            SocketReadSocketStreamingStartRequest,
4684                            fidl::encoding::DefaultFuchsiaResourceDialect
4685                        );
4686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
4687                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4688                        Ok(FDomainRequest::ReadSocketStreamingStart {
4689                            handle: req.handle,
4690
4691                            responder: FDomainReadSocketStreamingStartResponder {
4692                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4693                                tx_id: header.tx_id,
4694                            },
4695                        })
4696                    }
4697                    0x53e5cade5f4d22e7 => {
4698                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4699                        let mut req = fidl::new_empty!(
4700                            SocketReadSocketStreamingStopRequest,
4701                            fidl::encoding::DefaultFuchsiaResourceDialect
4702                        );
4703                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
4704                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4705                        Ok(FDomainRequest::ReadSocketStreamingStop {
4706                            handle: req.handle,
4707
4708                            responder: FDomainReadSocketStreamingStopResponder {
4709                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4710                                tx_id: header.tx_id,
4711                            },
4712                        })
4713                    }
4714                    0x392dcaac1ddd8868 => {
4715                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4716                        let mut req = fidl::new_empty!(
4717                            VmoCreateVmoRequest,
4718                            fidl::encoding::DefaultFuchsiaResourceDialect
4719                        );
4720                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoCreateVmoRequest>(&header, _body_bytes, handles, &mut req)?;
4721                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4722                        Ok(FDomainRequest::CreateVmo {
4723                            size: req.size,
4724                            options: req.options,
4725                            handle: req.handle,
4726
4727                            responder: FDomainCreateVmoResponder {
4728                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4729                                tx_id: header.tx_id,
4730                            },
4731                        })
4732                    }
4733                    0x62690ec76b0f2fe6 => {
4734                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4735                        let mut req = fidl::new_empty!(
4736                            VmoReadVmoRequest,
4737                            fidl::encoding::DefaultFuchsiaResourceDialect
4738                        );
4739                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoReadVmoRequest>(&header, _body_bytes, handles, &mut req)?;
4740                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4741                        Ok(FDomainRequest::ReadVmo {
4742                            handle: req.handle,
4743                            offset: req.offset,
4744                            size: req.size,
4745
4746                            responder: FDomainReadVmoResponder {
4747                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4748                                tx_id: header.tx_id,
4749                            },
4750                        })
4751                    }
4752                    0x2f6ac299380e486e => {
4753                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4754                        let mut req = fidl::new_empty!(
4755                            VmoWriteVmoRequest,
4756                            fidl::encoding::DefaultFuchsiaResourceDialect
4757                        );
4758                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoWriteVmoRequest>(&header, _body_bytes, handles, &mut req)?;
4759                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4760                        Ok(FDomainRequest::WriteVmo {
4761                            handle: req.handle,
4762                            offset: req.offset,
4763                            data: req.data,
4764
4765                            responder: FDomainWriteVmoResponder {
4766                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4767                                tx_id: header.tx_id,
4768                            },
4769                        })
4770                    }
4771                    0x717f9f3a9ff6906e => {
4772                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4773                        let mut req = fidl::new_empty!(
4774                            VmoGetVmoSizeRequest,
4775                            fidl::encoding::DefaultFuchsiaResourceDialect
4776                        );
4777                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoGetVmoSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4778                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4779                        Ok(FDomainRequest::GetVmoSize {
4780                            handle: req.handle,
4781
4782                            responder: FDomainGetVmoSizeResponder {
4783                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4784                                tx_id: header.tx_id,
4785                            },
4786                        })
4787                    }
4788                    0x7f6f77ac37afe38b => {
4789                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4790                        let mut req = fidl::new_empty!(
4791                            VmoSetVmoSizeRequest,
4792                            fidl::encoding::DefaultFuchsiaResourceDialect
4793                        );
4794                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoSetVmoSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4795                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4796                        Ok(FDomainRequest::SetVmoSize {
4797                            handle: req.handle,
4798                            size: req.size,
4799
4800                            responder: FDomainSetVmoSizeResponder {
4801                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4802                                tx_id: header.tx_id,
4803                            },
4804                        })
4805                    }
4806                    0x54020f4280cb038 => {
4807                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4808                        let mut req = fidl::new_empty!(
4809                            VmoGetVmoStreamSizeRequest,
4810                            fidl::encoding::DefaultFuchsiaResourceDialect
4811                        );
4812                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoGetVmoStreamSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4813                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4814                        Ok(FDomainRequest::GetVmoStreamSize {
4815                            handle: req.handle,
4816
4817                            responder: FDomainGetVmoStreamSizeResponder {
4818                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4819                                tx_id: header.tx_id,
4820                            },
4821                        })
4822                    }
4823                    0x3bdb108fb18002eb => {
4824                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4825                        let mut req = fidl::new_empty!(
4826                            VmoSetVmoStreamSizeRequest,
4827                            fidl::encoding::DefaultFuchsiaResourceDialect
4828                        );
4829                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoSetVmoStreamSizeRequest>(&header, _body_bytes, handles, &mut req)?;
4830                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4831                        Ok(FDomainRequest::SetVmoStreamSize {
4832                            handle: req.handle,
4833                            size: req.size,
4834
4835                            responder: FDomainSetVmoStreamSizeResponder {
4836                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4837                                tx_id: header.tx_id,
4838                            },
4839                        })
4840                    }
4841                    0x74f2e74d9f53e11e => {
4842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4843                        let mut req = fidl::new_empty!(
4844                            FDomainGetNamespaceRequest,
4845                            fidl::encoding::DefaultFuchsiaResourceDialect
4846                        );
4847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainGetNamespaceRequest>(&header, _body_bytes, handles, &mut req)?;
4848                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4849                        Ok(FDomainRequest::GetNamespace {
4850                            new_handle: req.new_handle,
4851
4852                            responder: FDomainGetNamespaceResponder {
4853                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4854                                tx_id: header.tx_id,
4855                            },
4856                        })
4857                    }
4858                    0x5ef8c24362964257 => {
4859                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4860                        let mut req = fidl::new_empty!(
4861                            FDomainCloseRequest,
4862                            fidl::encoding::DefaultFuchsiaResourceDialect
4863                        );
4864                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainCloseRequest>(&header, _body_bytes, handles, &mut req)?;
4865                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4866                        Ok(FDomainRequest::Close {
4867                            handles: req.handles,
4868
4869                            responder: FDomainCloseResponder {
4870                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4871                                tx_id: header.tx_id,
4872                            },
4873                        })
4874                    }
4875                    0x7a85b94bd1777ab9 => {
4876                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4877                        let mut req = fidl::new_empty!(
4878                            FDomainDuplicateRequest,
4879                            fidl::encoding::DefaultFuchsiaResourceDialect
4880                        );
4881                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainDuplicateRequest>(&header, _body_bytes, handles, &mut req)?;
4882                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4883                        Ok(FDomainRequest::Duplicate {
4884                            handle: req.handle,
4885                            new_handle: req.new_handle,
4886                            rights: req.rights,
4887
4888                            responder: FDomainDuplicateResponder {
4889                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4890                                tx_id: header.tx_id,
4891                            },
4892                        })
4893                    }
4894                    0x32fa64625a5bd3be => {
4895                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4896                        let mut req = fidl::new_empty!(
4897                            FDomainReplaceRequest,
4898                            fidl::encoding::DefaultFuchsiaResourceDialect
4899                        );
4900                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
4901                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4902                        Ok(FDomainRequest::Replace {
4903                            handle: req.handle,
4904                            new_handle: req.new_handle,
4905                            rights: req.rights,
4906
4907                            responder: FDomainReplaceResponder {
4908                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4909                                tx_id: header.tx_id,
4910                            },
4911                        })
4912                    }
4913                    0xe8352fb978996d9 => {
4914                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4915                        let mut req = fidl::new_empty!(
4916                            FDomainSignalRequest,
4917                            fidl::encoding::DefaultFuchsiaResourceDialect
4918                        );
4919                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalRequest>(&header, _body_bytes, handles, &mut req)?;
4920                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4921                        Ok(FDomainRequest::Signal {
4922                            handle: req.handle,
4923                            set: req.set,
4924                            clear: req.clear,
4925
4926                            responder: FDomainSignalResponder {
4927                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4928                                tx_id: header.tx_id,
4929                            },
4930                        })
4931                    }
4932                    0x7e84ec8ca7eabaf8 => {
4933                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4934                        let mut req = fidl::new_empty!(
4935                            FDomainSignalPeerRequest,
4936                            fidl::encoding::DefaultFuchsiaResourceDialect
4937                        );
4938                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalPeerRequest>(&header, _body_bytes, handles, &mut req)?;
4939                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4940                        Ok(FDomainRequest::SignalPeer {
4941                            handle: req.handle,
4942                            set: req.set,
4943                            clear: req.clear,
4944
4945                            responder: FDomainSignalPeerResponder {
4946                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4947                                tx_id: header.tx_id,
4948                            },
4949                        })
4950                    }
4951                    0x8f72d9b4b85c1eb => {
4952                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4953                        let mut req = fidl::new_empty!(
4954                            FDomainWaitForSignalsRequest,
4955                            fidl::encoding::DefaultFuchsiaResourceDialect
4956                        );
4957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainWaitForSignalsRequest>(&header, _body_bytes, handles, &mut req)?;
4958                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4959                        Ok(FDomainRequest::WaitForSignals {
4960                            handle: req.handle,
4961                            signals: req.signals,
4962
4963                            responder: FDomainWaitForSignalsResponder {
4964                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4965                                tx_id: header.tx_id,
4966                            },
4967                        })
4968                    }
4969                    0x437db979a63402c3 => {
4970                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4971                        let mut req = fidl::new_empty!(
4972                            FDomainGetKoidRequest,
4973                            fidl::encoding::DefaultFuchsiaResourceDialect
4974                        );
4975                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainGetKoidRequest>(&header, _body_bytes, handles, &mut req)?;
4976                        let control_handle = FDomainControlHandle { inner: this.inner.clone() };
4977                        Ok(FDomainRequest::GetKoid {
4978                            handle: req.handle,
4979
4980                            responder: FDomainGetKoidResponder {
4981                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4982                                tx_id: header.tx_id,
4983                            },
4984                        })
4985                    }
4986                    _ if header.tx_id == 0
4987                        && header
4988                            .dynamic_flags()
4989                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4990                    {
4991                        Ok(FDomainRequest::_UnknownMethod {
4992                            ordinal: header.ordinal,
4993                            control_handle: FDomainControlHandle { inner: this.inner.clone() },
4994                            method_type: fidl::MethodType::OneWay,
4995                        })
4996                    }
4997                    _ if header
4998                        .dynamic_flags()
4999                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5000                    {
5001                        this.inner.send_framework_err(
5002                            fidl::encoding::FrameworkErr::UnknownMethod,
5003                            header.tx_id,
5004                            header.ordinal,
5005                            header.dynamic_flags(),
5006                            (bytes, handles),
5007                        )?;
5008                        Ok(FDomainRequest::_UnknownMethod {
5009                            ordinal: header.ordinal,
5010                            control_handle: FDomainControlHandle { inner: this.inner.clone() },
5011                            method_type: fidl::MethodType::TwoWay,
5012                        })
5013                    }
5014                    _ => Err(fidl::Error::UnknownOrdinal {
5015                        ordinal: header.ordinal,
5016                        protocol_name:
5017                            <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5018                    }),
5019                }))
5020            },
5021        )
5022    }
5023}
5024
5025/// The FDomain control protocol.
5026///
5027/// This protocol is designed to be used over a network or other non-channel
5028/// transport.
5029#[derive(Debug)]
5030pub enum FDomainRequest {
5031    /// Create a new channel in this FDomain and return both its ends.
5032    CreateChannel { handles: [NewHandleId; 2], responder: FDomainCreateChannelResponder },
5033    /// Read a message from a channel. This method will fail if the channel is currently being read
5034    /// using the streaming read functions.
5035    ///
5036    /// Note that this method is not like zx_channel_read in that it will not
5037    /// return `SHOULD_WAIT` but will instead delay returning until there is data
5038    /// to return.
5039    ReadChannel { handle: HandleId, responder: FDomainReadChannelResponder },
5040    /// Write to a channel. Handles are always consumed.
5041    WriteChannel {
5042        handle: HandleId,
5043        data: Vec<u8>,
5044        handles: Handles,
5045        responder: FDomainWriteChannelResponder,
5046    },
5047    /// Starts reading from the given channel. Data is returned via the `ChannelStreamingData` event.
5048    /// That event will occur repeatedly until `ReadChannelStreamingStop` is called for the same handle
5049    /// or the event indicates the handle is closed.
5050    ReadChannelStreamingStart {
5051        handle: HandleId,
5052        responder: FDomainReadChannelStreamingStartResponder,
5053    },
5054    /// Stop asynchronous reading from the given channel.
5055    ReadChannelStreamingStop {
5056        handle: HandleId,
5057        responder: FDomainReadChannelStreamingStopResponder,
5058    },
5059    /// Create a new event in this FDomain and return it.
5060    CreateEvent { handle: NewHandleId, responder: FDomainCreateEventResponder },
5061    /// Create a new event pair in this FDomain and return both its ends.
5062    CreateEventPair { handles: [NewHandleId; 2], responder: FDomainCreateEventPairResponder },
5063    /// Create a new socket in this FDomain and return both its ends.
5064    CreateSocket {
5065        options: SocketType,
5066        handles: [NewHandleId; 2],
5067        responder: FDomainCreateSocketResponder,
5068    },
5069    /// Set the disposition of a given socket.
5070    SetSocketDisposition {
5071        handle: HandleId,
5072        disposition: SocketDisposition,
5073        disposition_peer: SocketDisposition,
5074        responder: FDomainSetSocketDispositionResponder,
5075    },
5076    /// Read data from a socket. This method will fail if the socket is currently being read
5077    /// asynchronously.
5078    ReadSocket { handle: HandleId, max_bytes: u64, responder: FDomainReadSocketResponder },
5079    /// Write to a socket. This will attempt to write all the data passed, and
5080    /// will block and retry whenever it is safe (e.g. it should never return
5081    /// SHOULD_WAIT). The `WriteSocketError` contains a `wrote` parameter to
5082    /// indicate if some bytes were written successfully before the failure
5083    /// occurred.
5084    WriteSocket { handle: HandleId, data: Vec<u8>, responder: FDomainWriteSocketResponder },
5085    /// Starts reading from the given socket. Data is returned via the `SocketStreamingData` event. That
5086    /// event will occur repeatedly until `ReadSocketStreamingStop` is called for the same handle or the
5087    /// event indicates the handle is closed.
5088    ReadSocketStreamingStart {
5089        handle: HandleId,
5090        responder: FDomainReadSocketStreamingStartResponder,
5091    },
5092    /// Stop asynchronous reading from the given socket.
5093    ReadSocketStreamingStop { handle: HandleId, responder: FDomainReadSocketStreamingStopResponder },
5094    /// Create a new VMO in this FDomain.
5095    CreateVmo {
5096        size: u64,
5097        options: VmoOptions,
5098        handle: NewHandleId,
5099        responder: FDomainCreateVmoResponder,
5100    },
5101    /// Read data from a VMO.
5102    ReadVmo { handle: HandleId, offset: u64, size: u64, responder: FDomainReadVmoResponder },
5103    /// Write data to a VMO.
5104    WriteVmo { handle: HandleId, offset: u64, data: Vec<u8>, responder: FDomainWriteVmoResponder },
5105    /// Get the size of a VMO in bytes.
5106    GetVmoSize { handle: HandleId, responder: FDomainGetVmoSizeResponder },
5107    /// Set the size of a VMO in bytes.
5108    SetVmoSize { handle: HandleId, size: u64, responder: FDomainSetVmoSizeResponder },
5109    /// Get the stream size of a VMO in bytes.
5110    GetVmoStreamSize { handle: HandleId, responder: FDomainGetVmoStreamSizeResponder },
5111    /// Set the stream size of a VMO in bytes.
5112    SetVmoStreamSize { handle: HandleId, size: u64, responder: FDomainSetVmoStreamSizeResponder },
5113    /// Adds a new channel handle to this namespace which points to a
5114    /// fuchsia.io.Directory. Can be used to "bootstrap" the FDomain.
5115    GetNamespace { new_handle: NewHandleId, responder: FDomainGetNamespaceResponder },
5116    /// Close one or more handles.
5117    Close { handles: Vec<HandleId>, responder: FDomainCloseResponder },
5118    /// Duplicate a handle.
5119    Duplicate {
5120        handle: HandleId,
5121        new_handle: NewHandleId,
5122        rights: fidl::Rights,
5123        responder: FDomainDuplicateResponder,
5124    },
5125    /// Close a handle and replace it with a new one with possibly different
5126    /// rights.
5127    Replace {
5128        handle: HandleId,
5129        new_handle: NewHandleId,
5130        rights: fidl::Rights,
5131        responder: FDomainReplaceResponder,
5132    },
5133    /// Set or clear signals on a handle.
5134    Signal { handle: HandleId, set: u32, clear: u32, responder: FDomainSignalResponder },
5135    /// Set or clear signals on a handle's peer.
5136    SignalPeer { handle: HandleId, set: u32, clear: u32, responder: FDomainSignalPeerResponder },
5137    /// Wait for signals from the given handle. Reply will be returned when one
5138    /// of the given signals is asserted.
5139    WaitForSignals { handle: HandleId, signals: u32, responder: FDomainWaitForSignalsResponder },
5140    /// Return the kernel object ID (koid) of the handle.
5141    GetKoid { handle: HandleId, responder: FDomainGetKoidResponder },
5142    /// An interaction was received which does not match any known method.
5143    #[non_exhaustive]
5144    _UnknownMethod {
5145        /// Ordinal of the method that was called.
5146        ordinal: u64,
5147        control_handle: FDomainControlHandle,
5148        method_type: fidl::MethodType,
5149    },
5150}
5151
5152impl FDomainRequest {
5153    #[allow(irrefutable_let_patterns)]
5154    pub fn into_create_channel(self) -> Option<([NewHandleId; 2], FDomainCreateChannelResponder)> {
5155        if let FDomainRequest::CreateChannel { handles, responder } = self {
5156            Some((handles, responder))
5157        } else {
5158            None
5159        }
5160    }
5161
5162    #[allow(irrefutable_let_patterns)]
5163    pub fn into_read_channel(self) -> Option<(HandleId, FDomainReadChannelResponder)> {
5164        if let FDomainRequest::ReadChannel { handle, responder } = self {
5165            Some((handle, responder))
5166        } else {
5167            None
5168        }
5169    }
5170
5171    #[allow(irrefutable_let_patterns)]
5172    pub fn into_write_channel(
5173        self,
5174    ) -> Option<(HandleId, Vec<u8>, Handles, FDomainWriteChannelResponder)> {
5175        if let FDomainRequest::WriteChannel { handle, data, handles, responder } = self {
5176            Some((handle, data, handles, responder))
5177        } else {
5178            None
5179        }
5180    }
5181
5182    #[allow(irrefutable_let_patterns)]
5183    pub fn into_read_channel_streaming_start(
5184        self,
5185    ) -> Option<(HandleId, FDomainReadChannelStreamingStartResponder)> {
5186        if let FDomainRequest::ReadChannelStreamingStart { handle, responder } = self {
5187            Some((handle, responder))
5188        } else {
5189            None
5190        }
5191    }
5192
5193    #[allow(irrefutable_let_patterns)]
5194    pub fn into_read_channel_streaming_stop(
5195        self,
5196    ) -> Option<(HandleId, FDomainReadChannelStreamingStopResponder)> {
5197        if let FDomainRequest::ReadChannelStreamingStop { handle, responder } = self {
5198            Some((handle, responder))
5199        } else {
5200            None
5201        }
5202    }
5203
5204    #[allow(irrefutable_let_patterns)]
5205    pub fn into_create_event(self) -> Option<(NewHandleId, FDomainCreateEventResponder)> {
5206        if let FDomainRequest::CreateEvent { handle, responder } = self {
5207            Some((handle, responder))
5208        } else {
5209            None
5210        }
5211    }
5212
5213    #[allow(irrefutable_let_patterns)]
5214    pub fn into_create_event_pair(
5215        self,
5216    ) -> Option<([NewHandleId; 2], FDomainCreateEventPairResponder)> {
5217        if let FDomainRequest::CreateEventPair { handles, responder } = self {
5218            Some((handles, responder))
5219        } else {
5220            None
5221        }
5222    }
5223
5224    #[allow(irrefutable_let_patterns)]
5225    pub fn into_create_socket(
5226        self,
5227    ) -> Option<(SocketType, [NewHandleId; 2], FDomainCreateSocketResponder)> {
5228        if let FDomainRequest::CreateSocket { options, handles, responder } = self {
5229            Some((options, handles, responder))
5230        } else {
5231            None
5232        }
5233    }
5234
5235    #[allow(irrefutable_let_patterns)]
5236    pub fn into_set_socket_disposition(
5237        self,
5238    ) -> Option<(
5239        HandleId,
5240        SocketDisposition,
5241        SocketDisposition,
5242        FDomainSetSocketDispositionResponder,
5243    )> {
5244        if let FDomainRequest::SetSocketDisposition {
5245            handle,
5246            disposition,
5247            disposition_peer,
5248            responder,
5249        } = self
5250        {
5251            Some((handle, disposition, disposition_peer, responder))
5252        } else {
5253            None
5254        }
5255    }
5256
5257    #[allow(irrefutable_let_patterns)]
5258    pub fn into_read_socket(self) -> Option<(HandleId, u64, FDomainReadSocketResponder)> {
5259        if let FDomainRequest::ReadSocket { handle, max_bytes, responder } = self {
5260            Some((handle, max_bytes, responder))
5261        } else {
5262            None
5263        }
5264    }
5265
5266    #[allow(irrefutable_let_patterns)]
5267    pub fn into_write_socket(self) -> Option<(HandleId, Vec<u8>, FDomainWriteSocketResponder)> {
5268        if let FDomainRequest::WriteSocket { handle, data, responder } = self {
5269            Some((handle, data, responder))
5270        } else {
5271            None
5272        }
5273    }
5274
5275    #[allow(irrefutable_let_patterns)]
5276    pub fn into_read_socket_streaming_start(
5277        self,
5278    ) -> Option<(HandleId, FDomainReadSocketStreamingStartResponder)> {
5279        if let FDomainRequest::ReadSocketStreamingStart { handle, responder } = self {
5280            Some((handle, responder))
5281        } else {
5282            None
5283        }
5284    }
5285
5286    #[allow(irrefutable_let_patterns)]
5287    pub fn into_read_socket_streaming_stop(
5288        self,
5289    ) -> Option<(HandleId, FDomainReadSocketStreamingStopResponder)> {
5290        if let FDomainRequest::ReadSocketStreamingStop { handle, responder } = self {
5291            Some((handle, responder))
5292        } else {
5293            None
5294        }
5295    }
5296
5297    #[allow(irrefutable_let_patterns)]
5298    pub fn into_create_vmo(
5299        self,
5300    ) -> Option<(u64, VmoOptions, NewHandleId, FDomainCreateVmoResponder)> {
5301        if let FDomainRequest::CreateVmo { size, options, handle, responder } = self {
5302            Some((size, options, handle, responder))
5303        } else {
5304            None
5305        }
5306    }
5307
5308    #[allow(irrefutable_let_patterns)]
5309    pub fn into_read_vmo(self) -> Option<(HandleId, u64, u64, FDomainReadVmoResponder)> {
5310        if let FDomainRequest::ReadVmo { handle, offset, size, responder } = self {
5311            Some((handle, offset, size, responder))
5312        } else {
5313            None
5314        }
5315    }
5316
5317    #[allow(irrefutable_let_patterns)]
5318    pub fn into_write_vmo(self) -> Option<(HandleId, u64, Vec<u8>, FDomainWriteVmoResponder)> {
5319        if let FDomainRequest::WriteVmo { handle, offset, data, responder } = self {
5320            Some((handle, offset, data, responder))
5321        } else {
5322            None
5323        }
5324    }
5325
5326    #[allow(irrefutable_let_patterns)]
5327    pub fn into_get_vmo_size(self) -> Option<(HandleId, FDomainGetVmoSizeResponder)> {
5328        if let FDomainRequest::GetVmoSize { handle, responder } = self {
5329            Some((handle, responder))
5330        } else {
5331            None
5332        }
5333    }
5334
5335    #[allow(irrefutable_let_patterns)]
5336    pub fn into_set_vmo_size(self) -> Option<(HandleId, u64, FDomainSetVmoSizeResponder)> {
5337        if let FDomainRequest::SetVmoSize { handle, size, responder } = self {
5338            Some((handle, size, responder))
5339        } else {
5340            None
5341        }
5342    }
5343
5344    #[allow(irrefutable_let_patterns)]
5345    pub fn into_get_vmo_stream_size(self) -> Option<(HandleId, FDomainGetVmoStreamSizeResponder)> {
5346        if let FDomainRequest::GetVmoStreamSize { handle, responder } = self {
5347            Some((handle, responder))
5348        } else {
5349            None
5350        }
5351    }
5352
5353    #[allow(irrefutable_let_patterns)]
5354    pub fn into_set_vmo_stream_size(
5355        self,
5356    ) -> Option<(HandleId, u64, FDomainSetVmoStreamSizeResponder)> {
5357        if let FDomainRequest::SetVmoStreamSize { handle, size, responder } = self {
5358            Some((handle, size, responder))
5359        } else {
5360            None
5361        }
5362    }
5363
5364    #[allow(irrefutable_let_patterns)]
5365    pub fn into_get_namespace(self) -> Option<(NewHandleId, FDomainGetNamespaceResponder)> {
5366        if let FDomainRequest::GetNamespace { new_handle, responder } = self {
5367            Some((new_handle, responder))
5368        } else {
5369            None
5370        }
5371    }
5372
5373    #[allow(irrefutable_let_patterns)]
5374    pub fn into_close(self) -> Option<(Vec<HandleId>, FDomainCloseResponder)> {
5375        if let FDomainRequest::Close { handles, responder } = self {
5376            Some((handles, responder))
5377        } else {
5378            None
5379        }
5380    }
5381
5382    #[allow(irrefutable_let_patterns)]
5383    pub fn into_duplicate(
5384        self,
5385    ) -> Option<(HandleId, NewHandleId, fidl::Rights, FDomainDuplicateResponder)> {
5386        if let FDomainRequest::Duplicate { handle, new_handle, rights, responder } = self {
5387            Some((handle, new_handle, rights, responder))
5388        } else {
5389            None
5390        }
5391    }
5392
5393    #[allow(irrefutable_let_patterns)]
5394    pub fn into_replace(
5395        self,
5396    ) -> Option<(HandleId, NewHandleId, fidl::Rights, FDomainReplaceResponder)> {
5397        if let FDomainRequest::Replace { handle, new_handle, rights, responder } = self {
5398            Some((handle, new_handle, rights, responder))
5399        } else {
5400            None
5401        }
5402    }
5403
5404    #[allow(irrefutable_let_patterns)]
5405    pub fn into_signal(self) -> Option<(HandleId, u32, u32, FDomainSignalResponder)> {
5406        if let FDomainRequest::Signal { handle, set, clear, responder } = self {
5407            Some((handle, set, clear, responder))
5408        } else {
5409            None
5410        }
5411    }
5412
5413    #[allow(irrefutable_let_patterns)]
5414    pub fn into_signal_peer(self) -> Option<(HandleId, u32, u32, FDomainSignalPeerResponder)> {
5415        if let FDomainRequest::SignalPeer { handle, set, clear, responder } = self {
5416            Some((handle, set, clear, responder))
5417        } else {
5418            None
5419        }
5420    }
5421
5422    #[allow(irrefutable_let_patterns)]
5423    pub fn into_wait_for_signals(self) -> Option<(HandleId, u32, FDomainWaitForSignalsResponder)> {
5424        if let FDomainRequest::WaitForSignals { handle, signals, responder } = self {
5425            Some((handle, signals, responder))
5426        } else {
5427            None
5428        }
5429    }
5430
5431    #[allow(irrefutable_let_patterns)]
5432    pub fn into_get_koid(self) -> Option<(HandleId, FDomainGetKoidResponder)> {
5433        if let FDomainRequest::GetKoid { handle, responder } = self {
5434            Some((handle, responder))
5435        } else {
5436            None
5437        }
5438    }
5439
5440    /// Name of the method defined in FIDL
5441    pub fn method_name(&self) -> &'static str {
5442        match *self {
5443            FDomainRequest::CreateChannel { .. } => "create_channel",
5444            FDomainRequest::ReadChannel { .. } => "read_channel",
5445            FDomainRequest::WriteChannel { .. } => "write_channel",
5446            FDomainRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
5447            FDomainRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
5448            FDomainRequest::CreateEvent { .. } => "create_event",
5449            FDomainRequest::CreateEventPair { .. } => "create_event_pair",
5450            FDomainRequest::CreateSocket { .. } => "create_socket",
5451            FDomainRequest::SetSocketDisposition { .. } => "set_socket_disposition",
5452            FDomainRequest::ReadSocket { .. } => "read_socket",
5453            FDomainRequest::WriteSocket { .. } => "write_socket",
5454            FDomainRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
5455            FDomainRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
5456            FDomainRequest::CreateVmo { .. } => "create_vmo",
5457            FDomainRequest::ReadVmo { .. } => "read_vmo",
5458            FDomainRequest::WriteVmo { .. } => "write_vmo",
5459            FDomainRequest::GetVmoSize { .. } => "get_vmo_size",
5460            FDomainRequest::SetVmoSize { .. } => "set_vmo_size",
5461            FDomainRequest::GetVmoStreamSize { .. } => "get_vmo_stream_size",
5462            FDomainRequest::SetVmoStreamSize { .. } => "set_vmo_stream_size",
5463            FDomainRequest::GetNamespace { .. } => "get_namespace",
5464            FDomainRequest::Close { .. } => "close",
5465            FDomainRequest::Duplicate { .. } => "duplicate",
5466            FDomainRequest::Replace { .. } => "replace",
5467            FDomainRequest::Signal { .. } => "signal",
5468            FDomainRequest::SignalPeer { .. } => "signal_peer",
5469            FDomainRequest::WaitForSignals { .. } => "wait_for_signals",
5470            FDomainRequest::GetKoid { .. } => "get_koid",
5471            FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
5472                "unknown one-way method"
5473            }
5474            FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
5475                "unknown two-way method"
5476            }
5477        }
5478    }
5479}
5480
5481#[derive(Debug, Clone)]
5482pub struct FDomainControlHandle {
5483    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5484}
5485
5486impl FDomainControlHandle {
5487    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5488        self.inner.shutdown_with_epitaph(status.into())
5489    }
5490}
5491
5492impl fidl::endpoints::ControlHandle for FDomainControlHandle {
5493    fn shutdown(&self) {
5494        self.inner.shutdown()
5495    }
5496
5497    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5498        self.inner.shutdown_with_epitaph(status)
5499    }
5500
5501    fn is_closed(&self) -> bool {
5502        self.inner.channel().is_closed()
5503    }
5504    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5505        self.inner.channel().on_closed()
5506    }
5507
5508    #[cfg(target_os = "fuchsia")]
5509    fn signal_peer(
5510        &self,
5511        clear_mask: zx::Signals,
5512        set_mask: zx::Signals,
5513    ) -> Result<(), zx_status::Status> {
5514        use fidl::Peered;
5515        self.inner.channel().signal_peer(clear_mask, set_mask)
5516    }
5517}
5518
5519impl FDomainControlHandle {
5520    pub fn send_on_channel_streaming_data(
5521        &self,
5522        mut handle: &HandleId,
5523        mut channel_sent: &ChannelSent,
5524    ) -> Result<(), fidl::Error> {
5525        self.inner.send::<ChannelOnChannelStreamingDataRequest>(
5526            (handle, channel_sent),
5527            0,
5528            0x7d4431805202dfe1,
5529            fidl::encoding::DynamicFlags::FLEXIBLE,
5530        )
5531    }
5532
5533    pub fn send_on_socket_streaming_data(
5534        &self,
5535        mut handle: &HandleId,
5536        mut socket_message: &SocketMessage,
5537    ) -> Result<(), fidl::Error> {
5538        self.inner.send::<SocketOnSocketStreamingDataRequest>(
5539            (handle, socket_message),
5540            0,
5541            0x998b5e66b3c80a2,
5542            fidl::encoding::DynamicFlags::FLEXIBLE,
5543        )
5544    }
5545}
5546
5547#[must_use = "FIDL methods require a response to be sent"]
5548#[derive(Debug)]
5549pub struct FDomainCreateChannelResponder {
5550    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5551    tx_id: u32,
5552}
5553
5554/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5555/// if the responder is dropped without sending a response, so that the client
5556/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5557impl std::ops::Drop for FDomainCreateChannelResponder {
5558    fn drop(&mut self) {
5559        self.control_handle.shutdown();
5560        // Safety: drops once, never accessed again
5561        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5562    }
5563}
5564
5565impl fidl::endpoints::Responder for FDomainCreateChannelResponder {
5566    type ControlHandle = FDomainControlHandle;
5567
5568    fn control_handle(&self) -> &FDomainControlHandle {
5569        &self.control_handle
5570    }
5571
5572    fn drop_without_shutdown(mut self) {
5573        // Safety: drops once, never accessed again due to mem::forget
5574        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5575        // Prevent Drop from running (which would shut down the channel)
5576        std::mem::forget(self);
5577    }
5578}
5579
5580impl FDomainCreateChannelResponder {
5581    /// Sends a response to the FIDL transaction.
5582    ///
5583    /// Sets the channel to shutdown if an error occurs.
5584    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5585        let _result = self.send_raw(result);
5586        if _result.is_err() {
5587            self.control_handle.shutdown();
5588        }
5589        self.drop_without_shutdown();
5590        _result
5591    }
5592
5593    /// Similar to "send" but does not shutdown the channel if an error occurs.
5594    pub fn send_no_shutdown_on_err(
5595        self,
5596        mut result: Result<(), &Error>,
5597    ) -> Result<(), fidl::Error> {
5598        let _result = self.send_raw(result);
5599        self.drop_without_shutdown();
5600        _result
5601    }
5602
5603    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5604        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5605            fidl::encoding::EmptyStruct,
5606            Error,
5607        >>(
5608            fidl::encoding::FlexibleResult::new(result),
5609            self.tx_id,
5610            0x182d38bfe88673b5,
5611            fidl::encoding::DynamicFlags::FLEXIBLE,
5612        )
5613    }
5614}
5615
5616#[must_use = "FIDL methods require a response to be sent"]
5617#[derive(Debug)]
5618pub struct FDomainReadChannelResponder {
5619    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5620    tx_id: u32,
5621}
5622
5623/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5624/// if the responder is dropped without sending a response, so that the client
5625/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5626impl std::ops::Drop for FDomainReadChannelResponder {
5627    fn drop(&mut self) {
5628        self.control_handle.shutdown();
5629        // Safety: drops once, never accessed again
5630        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5631    }
5632}
5633
5634impl fidl::endpoints::Responder for FDomainReadChannelResponder {
5635    type ControlHandle = FDomainControlHandle;
5636
5637    fn control_handle(&self) -> &FDomainControlHandle {
5638        &self.control_handle
5639    }
5640
5641    fn drop_without_shutdown(mut self) {
5642        // Safety: drops once, never accessed again due to mem::forget
5643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5644        // Prevent Drop from running (which would shut down the channel)
5645        std::mem::forget(self);
5646    }
5647}
5648
5649impl FDomainReadChannelResponder {
5650    /// Sends a response to the FIDL transaction.
5651    ///
5652    /// Sets the channel to shutdown if an error occurs.
5653    pub fn send(
5654        self,
5655        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
5656    ) -> Result<(), fidl::Error> {
5657        let _result = self.send_raw(result);
5658        if _result.is_err() {
5659            self.control_handle.shutdown();
5660        }
5661        self.drop_without_shutdown();
5662        _result
5663    }
5664
5665    /// Similar to "send" but does not shutdown the channel if an error occurs.
5666    pub fn send_no_shutdown_on_err(
5667        self,
5668        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
5669    ) -> Result<(), fidl::Error> {
5670        let _result = self.send_raw(result);
5671        self.drop_without_shutdown();
5672        _result
5673    }
5674
5675    fn send_raw(
5676        &self,
5677        mut result: Result<(&[u8], &[HandleInfo]), &Error>,
5678    ) -> Result<(), fidl::Error> {
5679        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
5680            fidl::encoding::FlexibleResult::new(result),
5681            self.tx_id,
5682            0x6ef47bf27bf7d050,
5683            fidl::encoding::DynamicFlags::FLEXIBLE,
5684        )
5685    }
5686}
5687
5688#[must_use = "FIDL methods require a response to be sent"]
5689#[derive(Debug)]
5690pub struct FDomainWriteChannelResponder {
5691    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5692    tx_id: u32,
5693}
5694
5695/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5696/// if the responder is dropped without sending a response, so that the client
5697/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5698impl std::ops::Drop for FDomainWriteChannelResponder {
5699    fn drop(&mut self) {
5700        self.control_handle.shutdown();
5701        // Safety: drops once, never accessed again
5702        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5703    }
5704}
5705
5706impl fidl::endpoints::Responder for FDomainWriteChannelResponder {
5707    type ControlHandle = FDomainControlHandle;
5708
5709    fn control_handle(&self) -> &FDomainControlHandle {
5710        &self.control_handle
5711    }
5712
5713    fn drop_without_shutdown(mut self) {
5714        // Safety: drops once, never accessed again due to mem::forget
5715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5716        // Prevent Drop from running (which would shut down the channel)
5717        std::mem::forget(self);
5718    }
5719}
5720
5721impl FDomainWriteChannelResponder {
5722    /// Sends a response to the FIDL transaction.
5723    ///
5724    /// Sets the channel to shutdown if an error occurs.
5725    pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
5726        let _result = self.send_raw(result);
5727        if _result.is_err() {
5728            self.control_handle.shutdown();
5729        }
5730        self.drop_without_shutdown();
5731        _result
5732    }
5733
5734    /// Similar to "send" but does not shutdown the channel if an error occurs.
5735    pub fn send_no_shutdown_on_err(
5736        self,
5737        mut result: Result<(), &WriteChannelError>,
5738    ) -> Result<(), fidl::Error> {
5739        let _result = self.send_raw(result);
5740        self.drop_without_shutdown();
5741        _result
5742    }
5743
5744    fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
5745        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5746            fidl::encoding::EmptyStruct,
5747            WriteChannelError,
5748        >>(
5749            fidl::encoding::FlexibleResult::new(result),
5750            self.tx_id,
5751            0x75a2559b945d5eb5,
5752            fidl::encoding::DynamicFlags::FLEXIBLE,
5753        )
5754    }
5755}
5756
5757#[must_use = "FIDL methods require a response to be sent"]
5758#[derive(Debug)]
5759pub struct FDomainReadChannelStreamingStartResponder {
5760    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5761    tx_id: u32,
5762}
5763
5764/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5765/// if the responder is dropped without sending a response, so that the client
5766/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5767impl std::ops::Drop for FDomainReadChannelStreamingStartResponder {
5768    fn drop(&mut self) {
5769        self.control_handle.shutdown();
5770        // Safety: drops once, never accessed again
5771        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5772    }
5773}
5774
5775impl fidl::endpoints::Responder for FDomainReadChannelStreamingStartResponder {
5776    type ControlHandle = FDomainControlHandle;
5777
5778    fn control_handle(&self) -> &FDomainControlHandle {
5779        &self.control_handle
5780    }
5781
5782    fn drop_without_shutdown(mut self) {
5783        // Safety: drops once, never accessed again due to mem::forget
5784        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5785        // Prevent Drop from running (which would shut down the channel)
5786        std::mem::forget(self);
5787    }
5788}
5789
5790impl FDomainReadChannelStreamingStartResponder {
5791    /// Sends a response to the FIDL transaction.
5792    ///
5793    /// Sets the channel to shutdown if an error occurs.
5794    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5795        let _result = self.send_raw(result);
5796        if _result.is_err() {
5797            self.control_handle.shutdown();
5798        }
5799        self.drop_without_shutdown();
5800        _result
5801    }
5802
5803    /// Similar to "send" but does not shutdown the channel if an error occurs.
5804    pub fn send_no_shutdown_on_err(
5805        self,
5806        mut result: Result<(), &Error>,
5807    ) -> Result<(), fidl::Error> {
5808        let _result = self.send_raw(result);
5809        self.drop_without_shutdown();
5810        _result
5811    }
5812
5813    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5814        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5815            fidl::encoding::EmptyStruct,
5816            Error,
5817        >>(
5818            fidl::encoding::FlexibleResult::new(result),
5819            self.tx_id,
5820            0x3c73e85476a203df,
5821            fidl::encoding::DynamicFlags::FLEXIBLE,
5822        )
5823    }
5824}
5825
5826#[must_use = "FIDL methods require a response to be sent"]
5827#[derive(Debug)]
5828pub struct FDomainReadChannelStreamingStopResponder {
5829    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5830    tx_id: u32,
5831}
5832
5833/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5834/// if the responder is dropped without sending a response, so that the client
5835/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5836impl std::ops::Drop for FDomainReadChannelStreamingStopResponder {
5837    fn drop(&mut self) {
5838        self.control_handle.shutdown();
5839        // Safety: drops once, never accessed again
5840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5841    }
5842}
5843
5844impl fidl::endpoints::Responder for FDomainReadChannelStreamingStopResponder {
5845    type ControlHandle = FDomainControlHandle;
5846
5847    fn control_handle(&self) -> &FDomainControlHandle {
5848        &self.control_handle
5849    }
5850
5851    fn drop_without_shutdown(mut self) {
5852        // Safety: drops once, never accessed again due to mem::forget
5853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5854        // Prevent Drop from running (which would shut down the channel)
5855        std::mem::forget(self);
5856    }
5857}
5858
5859impl FDomainReadChannelStreamingStopResponder {
5860    /// Sends a response to the FIDL transaction.
5861    ///
5862    /// Sets the channel to shutdown if an error occurs.
5863    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5864        let _result = self.send_raw(result);
5865        if _result.is_err() {
5866            self.control_handle.shutdown();
5867        }
5868        self.drop_without_shutdown();
5869        _result
5870    }
5871
5872    /// Similar to "send" but does not shutdown the channel if an error occurs.
5873    pub fn send_no_shutdown_on_err(
5874        self,
5875        mut result: Result<(), &Error>,
5876    ) -> Result<(), fidl::Error> {
5877        let _result = self.send_raw(result);
5878        self.drop_without_shutdown();
5879        _result
5880    }
5881
5882    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5883        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5884            fidl::encoding::EmptyStruct,
5885            Error,
5886        >>(
5887            fidl::encoding::FlexibleResult::new(result),
5888            self.tx_id,
5889            0x56f21d6ed68186e0,
5890            fidl::encoding::DynamicFlags::FLEXIBLE,
5891        )
5892    }
5893}
5894
5895#[must_use = "FIDL methods require a response to be sent"]
5896#[derive(Debug)]
5897pub struct FDomainCreateEventResponder {
5898    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5899    tx_id: u32,
5900}
5901
5902/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5903/// if the responder is dropped without sending a response, so that the client
5904/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5905impl std::ops::Drop for FDomainCreateEventResponder {
5906    fn drop(&mut self) {
5907        self.control_handle.shutdown();
5908        // Safety: drops once, never accessed again
5909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5910    }
5911}
5912
5913impl fidl::endpoints::Responder for FDomainCreateEventResponder {
5914    type ControlHandle = FDomainControlHandle;
5915
5916    fn control_handle(&self) -> &FDomainControlHandle {
5917        &self.control_handle
5918    }
5919
5920    fn drop_without_shutdown(mut self) {
5921        // Safety: drops once, never accessed again due to mem::forget
5922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5923        // Prevent Drop from running (which would shut down the channel)
5924        std::mem::forget(self);
5925    }
5926}
5927
5928impl FDomainCreateEventResponder {
5929    /// Sends a response to the FIDL transaction.
5930    ///
5931    /// Sets the channel to shutdown if an error occurs.
5932    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5933        let _result = self.send_raw(result);
5934        if _result.is_err() {
5935            self.control_handle.shutdown();
5936        }
5937        self.drop_without_shutdown();
5938        _result
5939    }
5940
5941    /// Similar to "send" but does not shutdown the channel if an error occurs.
5942    pub fn send_no_shutdown_on_err(
5943        self,
5944        mut result: Result<(), &Error>,
5945    ) -> Result<(), fidl::Error> {
5946        let _result = self.send_raw(result);
5947        self.drop_without_shutdown();
5948        _result
5949    }
5950
5951    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
5952        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5953            fidl::encoding::EmptyStruct,
5954            Error,
5955        >>(
5956            fidl::encoding::FlexibleResult::new(result),
5957            self.tx_id,
5958            0x7b05b3f262635987,
5959            fidl::encoding::DynamicFlags::FLEXIBLE,
5960        )
5961    }
5962}
5963
5964#[must_use = "FIDL methods require a response to be sent"]
5965#[derive(Debug)]
5966pub struct FDomainCreateEventPairResponder {
5967    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
5968    tx_id: u32,
5969}
5970
5971/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
5972/// if the responder is dropped without sending a response, so that the client
5973/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5974impl std::ops::Drop for FDomainCreateEventPairResponder {
5975    fn drop(&mut self) {
5976        self.control_handle.shutdown();
5977        // Safety: drops once, never accessed again
5978        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5979    }
5980}
5981
5982impl fidl::endpoints::Responder for FDomainCreateEventPairResponder {
5983    type ControlHandle = FDomainControlHandle;
5984
5985    fn control_handle(&self) -> &FDomainControlHandle {
5986        &self.control_handle
5987    }
5988
5989    fn drop_without_shutdown(mut self) {
5990        // Safety: drops once, never accessed again due to mem::forget
5991        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5992        // Prevent Drop from running (which would shut down the channel)
5993        std::mem::forget(self);
5994    }
5995}
5996
5997impl FDomainCreateEventPairResponder {
5998    /// Sends a response to the FIDL transaction.
5999    ///
6000    /// Sets the channel to shutdown if an error occurs.
6001    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6002        let _result = self.send_raw(result);
6003        if _result.is_err() {
6004            self.control_handle.shutdown();
6005        }
6006        self.drop_without_shutdown();
6007        _result
6008    }
6009
6010    /// Similar to "send" but does not shutdown the channel if an error occurs.
6011    pub fn send_no_shutdown_on_err(
6012        self,
6013        mut result: Result<(), &Error>,
6014    ) -> Result<(), fidl::Error> {
6015        let _result = self.send_raw(result);
6016        self.drop_without_shutdown();
6017        _result
6018    }
6019
6020    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6021        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6022            fidl::encoding::EmptyStruct,
6023            Error,
6024        >>(
6025            fidl::encoding::FlexibleResult::new(result),
6026            self.tx_id,
6027            0x7aef61effa65656d,
6028            fidl::encoding::DynamicFlags::FLEXIBLE,
6029        )
6030    }
6031}
6032
6033#[must_use = "FIDL methods require a response to be sent"]
6034#[derive(Debug)]
6035pub struct FDomainCreateSocketResponder {
6036    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6037    tx_id: u32,
6038}
6039
6040/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6041/// if the responder is dropped without sending a response, so that the client
6042/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6043impl std::ops::Drop for FDomainCreateSocketResponder {
6044    fn drop(&mut self) {
6045        self.control_handle.shutdown();
6046        // Safety: drops once, never accessed again
6047        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6048    }
6049}
6050
6051impl fidl::endpoints::Responder for FDomainCreateSocketResponder {
6052    type ControlHandle = FDomainControlHandle;
6053
6054    fn control_handle(&self) -> &FDomainControlHandle {
6055        &self.control_handle
6056    }
6057
6058    fn drop_without_shutdown(mut self) {
6059        // Safety: drops once, never accessed again due to mem::forget
6060        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6061        // Prevent Drop from running (which would shut down the channel)
6062        std::mem::forget(self);
6063    }
6064}
6065
6066impl FDomainCreateSocketResponder {
6067    /// Sends a response to the FIDL transaction.
6068    ///
6069    /// Sets the channel to shutdown if an error occurs.
6070    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6071        let _result = self.send_raw(result);
6072        if _result.is_err() {
6073            self.control_handle.shutdown();
6074        }
6075        self.drop_without_shutdown();
6076        _result
6077    }
6078
6079    /// Similar to "send" but does not shutdown the channel if an error occurs.
6080    pub fn send_no_shutdown_on_err(
6081        self,
6082        mut result: Result<(), &Error>,
6083    ) -> Result<(), fidl::Error> {
6084        let _result = self.send_raw(result);
6085        self.drop_without_shutdown();
6086        _result
6087    }
6088
6089    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6090        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6091            fidl::encoding::EmptyStruct,
6092            Error,
6093        >>(
6094            fidl::encoding::FlexibleResult::new(result),
6095            self.tx_id,
6096            0x200bf0ea21932de0,
6097            fidl::encoding::DynamicFlags::FLEXIBLE,
6098        )
6099    }
6100}
6101
6102#[must_use = "FIDL methods require a response to be sent"]
6103#[derive(Debug)]
6104pub struct FDomainSetSocketDispositionResponder {
6105    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6106    tx_id: u32,
6107}
6108
6109/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6110/// if the responder is dropped without sending a response, so that the client
6111/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6112impl std::ops::Drop for FDomainSetSocketDispositionResponder {
6113    fn drop(&mut self) {
6114        self.control_handle.shutdown();
6115        // Safety: drops once, never accessed again
6116        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6117    }
6118}
6119
6120impl fidl::endpoints::Responder for FDomainSetSocketDispositionResponder {
6121    type ControlHandle = FDomainControlHandle;
6122
6123    fn control_handle(&self) -> &FDomainControlHandle {
6124        &self.control_handle
6125    }
6126
6127    fn drop_without_shutdown(mut self) {
6128        // Safety: drops once, never accessed again due to mem::forget
6129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6130        // Prevent Drop from running (which would shut down the channel)
6131        std::mem::forget(self);
6132    }
6133}
6134
6135impl FDomainSetSocketDispositionResponder {
6136    /// Sends a response to the FIDL transaction.
6137    ///
6138    /// Sets the channel to shutdown if an error occurs.
6139    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6140        let _result = self.send_raw(result);
6141        if _result.is_err() {
6142            self.control_handle.shutdown();
6143        }
6144        self.drop_without_shutdown();
6145        _result
6146    }
6147
6148    /// Similar to "send" but does not shutdown the channel if an error occurs.
6149    pub fn send_no_shutdown_on_err(
6150        self,
6151        mut result: Result<(), &Error>,
6152    ) -> Result<(), fidl::Error> {
6153        let _result = self.send_raw(result);
6154        self.drop_without_shutdown();
6155        _result
6156    }
6157
6158    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6159        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6160            fidl::encoding::EmptyStruct,
6161            Error,
6162        >>(
6163            fidl::encoding::FlexibleResult::new(result),
6164            self.tx_id,
6165            0x60d3c7ccb17f9bdf,
6166            fidl::encoding::DynamicFlags::FLEXIBLE,
6167        )
6168    }
6169}
6170
6171#[must_use = "FIDL methods require a response to be sent"]
6172#[derive(Debug)]
6173pub struct FDomainReadSocketResponder {
6174    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6175    tx_id: u32,
6176}
6177
6178/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6179/// if the responder is dropped without sending a response, so that the client
6180/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6181impl std::ops::Drop for FDomainReadSocketResponder {
6182    fn drop(&mut self) {
6183        self.control_handle.shutdown();
6184        // Safety: drops once, never accessed again
6185        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6186    }
6187}
6188
6189impl fidl::endpoints::Responder for FDomainReadSocketResponder {
6190    type ControlHandle = FDomainControlHandle;
6191
6192    fn control_handle(&self) -> &FDomainControlHandle {
6193        &self.control_handle
6194    }
6195
6196    fn drop_without_shutdown(mut self) {
6197        // Safety: drops once, never accessed again due to mem::forget
6198        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6199        // Prevent Drop from running (which would shut down the channel)
6200        std::mem::forget(self);
6201    }
6202}
6203
6204impl FDomainReadSocketResponder {
6205    /// Sends a response to the FIDL transaction.
6206    ///
6207    /// Sets the channel to shutdown if an error occurs.
6208    pub fn send(self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
6209        let _result = self.send_raw(result);
6210        if _result.is_err() {
6211            self.control_handle.shutdown();
6212        }
6213        self.drop_without_shutdown();
6214        _result
6215    }
6216
6217    /// Similar to "send" but does not shutdown the channel if an error occurs.
6218    pub fn send_no_shutdown_on_err(
6219        self,
6220        mut result: Result<(&[u8], bool), &Error>,
6221    ) -> Result<(), fidl::Error> {
6222        let _result = self.send_raw(result);
6223        self.drop_without_shutdown();
6224        _result
6225    }
6226
6227    fn send_raw(&self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
6228        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<SocketData, Error>>(
6229            fidl::encoding::FlexibleResult::new(result),
6230            self.tx_id,
6231            0x1da8aabec249c02e,
6232            fidl::encoding::DynamicFlags::FLEXIBLE,
6233        )
6234    }
6235}
6236
6237#[must_use = "FIDL methods require a response to be sent"]
6238#[derive(Debug)]
6239pub struct FDomainWriteSocketResponder {
6240    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6241    tx_id: u32,
6242}
6243
6244/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6245/// if the responder is dropped without sending a response, so that the client
6246/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6247impl std::ops::Drop for FDomainWriteSocketResponder {
6248    fn drop(&mut self) {
6249        self.control_handle.shutdown();
6250        // Safety: drops once, never accessed again
6251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6252    }
6253}
6254
6255impl fidl::endpoints::Responder for FDomainWriteSocketResponder {
6256    type ControlHandle = FDomainControlHandle;
6257
6258    fn control_handle(&self) -> &FDomainControlHandle {
6259        &self.control_handle
6260    }
6261
6262    fn drop_without_shutdown(mut self) {
6263        // Safety: drops once, never accessed again due to mem::forget
6264        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6265        // Prevent Drop from running (which would shut down the channel)
6266        std::mem::forget(self);
6267    }
6268}
6269
6270impl FDomainWriteSocketResponder {
6271    /// Sends a response to the FIDL transaction.
6272    ///
6273    /// Sets the channel to shutdown if an error occurs.
6274    pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
6275        let _result = self.send_raw(result);
6276        if _result.is_err() {
6277            self.control_handle.shutdown();
6278        }
6279        self.drop_without_shutdown();
6280        _result
6281    }
6282
6283    /// Similar to "send" but does not shutdown the channel if an error occurs.
6284    pub fn send_no_shutdown_on_err(
6285        self,
6286        mut result: Result<u64, &WriteSocketError>,
6287    ) -> Result<(), fidl::Error> {
6288        let _result = self.send_raw(result);
6289        self.drop_without_shutdown();
6290        _result
6291    }
6292
6293    fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
6294        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6295            SocketWriteSocketResponse,
6296            WriteSocketError,
6297        >>(
6298            fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
6299            self.tx_id,
6300            0x5b541623cbbbf683,
6301            fidl::encoding::DynamicFlags::FLEXIBLE,
6302        )
6303    }
6304}
6305
6306#[must_use = "FIDL methods require a response to be sent"]
6307#[derive(Debug)]
6308pub struct FDomainReadSocketStreamingStartResponder {
6309    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6310    tx_id: u32,
6311}
6312
6313/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6314/// if the responder is dropped without sending a response, so that the client
6315/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6316impl std::ops::Drop for FDomainReadSocketStreamingStartResponder {
6317    fn drop(&mut self) {
6318        self.control_handle.shutdown();
6319        // Safety: drops once, never accessed again
6320        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6321    }
6322}
6323
6324impl fidl::endpoints::Responder for FDomainReadSocketStreamingStartResponder {
6325    type ControlHandle = FDomainControlHandle;
6326
6327    fn control_handle(&self) -> &FDomainControlHandle {
6328        &self.control_handle
6329    }
6330
6331    fn drop_without_shutdown(mut self) {
6332        // Safety: drops once, never accessed again due to mem::forget
6333        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6334        // Prevent Drop from running (which would shut down the channel)
6335        std::mem::forget(self);
6336    }
6337}
6338
6339impl FDomainReadSocketStreamingStartResponder {
6340    /// Sends a response to the FIDL transaction.
6341    ///
6342    /// Sets the channel to shutdown if an error occurs.
6343    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6344        let _result = self.send_raw(result);
6345        if _result.is_err() {
6346            self.control_handle.shutdown();
6347        }
6348        self.drop_without_shutdown();
6349        _result
6350    }
6351
6352    /// Similar to "send" but does not shutdown the channel if an error occurs.
6353    pub fn send_no_shutdown_on_err(
6354        self,
6355        mut result: Result<(), &Error>,
6356    ) -> Result<(), fidl::Error> {
6357        let _result = self.send_raw(result);
6358        self.drop_without_shutdown();
6359        _result
6360    }
6361
6362    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6363        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6364            fidl::encoding::EmptyStruct,
6365            Error,
6366        >>(
6367            fidl::encoding::FlexibleResult::new(result),
6368            self.tx_id,
6369            0x2a592748d5f33445,
6370            fidl::encoding::DynamicFlags::FLEXIBLE,
6371        )
6372    }
6373}
6374
6375#[must_use = "FIDL methods require a response to be sent"]
6376#[derive(Debug)]
6377pub struct FDomainReadSocketStreamingStopResponder {
6378    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6379    tx_id: u32,
6380}
6381
6382/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6383/// if the responder is dropped without sending a response, so that the client
6384/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6385impl std::ops::Drop for FDomainReadSocketStreamingStopResponder {
6386    fn drop(&mut self) {
6387        self.control_handle.shutdown();
6388        // Safety: drops once, never accessed again
6389        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6390    }
6391}
6392
6393impl fidl::endpoints::Responder for FDomainReadSocketStreamingStopResponder {
6394    type ControlHandle = FDomainControlHandle;
6395
6396    fn control_handle(&self) -> &FDomainControlHandle {
6397        &self.control_handle
6398    }
6399
6400    fn drop_without_shutdown(mut self) {
6401        // Safety: drops once, never accessed again due to mem::forget
6402        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6403        // Prevent Drop from running (which would shut down the channel)
6404        std::mem::forget(self);
6405    }
6406}
6407
6408impl FDomainReadSocketStreamingStopResponder {
6409    /// Sends a response to the FIDL transaction.
6410    ///
6411    /// Sets the channel to shutdown if an error occurs.
6412    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6413        let _result = self.send_raw(result);
6414        if _result.is_err() {
6415            self.control_handle.shutdown();
6416        }
6417        self.drop_without_shutdown();
6418        _result
6419    }
6420
6421    /// Similar to "send" but does not shutdown the channel if an error occurs.
6422    pub fn send_no_shutdown_on_err(
6423        self,
6424        mut result: Result<(), &Error>,
6425    ) -> Result<(), fidl::Error> {
6426        let _result = self.send_raw(result);
6427        self.drop_without_shutdown();
6428        _result
6429    }
6430
6431    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6432        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6433            fidl::encoding::EmptyStruct,
6434            Error,
6435        >>(
6436            fidl::encoding::FlexibleResult::new(result),
6437            self.tx_id,
6438            0x53e5cade5f4d22e7,
6439            fidl::encoding::DynamicFlags::FLEXIBLE,
6440        )
6441    }
6442}
6443
6444#[must_use = "FIDL methods require a response to be sent"]
6445#[derive(Debug)]
6446pub struct FDomainCreateVmoResponder {
6447    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6448    tx_id: u32,
6449}
6450
6451/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6452/// if the responder is dropped without sending a response, so that the client
6453/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6454impl std::ops::Drop for FDomainCreateVmoResponder {
6455    fn drop(&mut self) {
6456        self.control_handle.shutdown();
6457        // Safety: drops once, never accessed again
6458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6459    }
6460}
6461
6462impl fidl::endpoints::Responder for FDomainCreateVmoResponder {
6463    type ControlHandle = FDomainControlHandle;
6464
6465    fn control_handle(&self) -> &FDomainControlHandle {
6466        &self.control_handle
6467    }
6468
6469    fn drop_without_shutdown(mut self) {
6470        // Safety: drops once, never accessed again due to mem::forget
6471        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6472        // Prevent Drop from running (which would shut down the channel)
6473        std::mem::forget(self);
6474    }
6475}
6476
6477impl FDomainCreateVmoResponder {
6478    /// Sends a response to the FIDL transaction.
6479    ///
6480    /// Sets the channel to shutdown if an error occurs.
6481    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6482        let _result = self.send_raw(result);
6483        if _result.is_err() {
6484            self.control_handle.shutdown();
6485        }
6486        self.drop_without_shutdown();
6487        _result
6488    }
6489
6490    /// Similar to "send" but does not shutdown the channel if an error occurs.
6491    pub fn send_no_shutdown_on_err(
6492        self,
6493        mut result: Result<(), &Error>,
6494    ) -> Result<(), fidl::Error> {
6495        let _result = self.send_raw(result);
6496        self.drop_without_shutdown();
6497        _result
6498    }
6499
6500    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6501        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6502            fidl::encoding::EmptyStruct,
6503            Error,
6504        >>(
6505            fidl::encoding::FlexibleResult::new(result),
6506            self.tx_id,
6507            0x392dcaac1ddd8868,
6508            fidl::encoding::DynamicFlags::FLEXIBLE,
6509        )
6510    }
6511}
6512
6513#[must_use = "FIDL methods require a response to be sent"]
6514#[derive(Debug)]
6515pub struct FDomainReadVmoResponder {
6516    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6517    tx_id: u32,
6518}
6519
6520/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6521/// if the responder is dropped without sending a response, so that the client
6522/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6523impl std::ops::Drop for FDomainReadVmoResponder {
6524    fn drop(&mut self) {
6525        self.control_handle.shutdown();
6526        // Safety: drops once, never accessed again
6527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6528    }
6529}
6530
6531impl fidl::endpoints::Responder for FDomainReadVmoResponder {
6532    type ControlHandle = FDomainControlHandle;
6533
6534    fn control_handle(&self) -> &FDomainControlHandle {
6535        &self.control_handle
6536    }
6537
6538    fn drop_without_shutdown(mut self) {
6539        // Safety: drops once, never accessed again due to mem::forget
6540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6541        // Prevent Drop from running (which would shut down the channel)
6542        std::mem::forget(self);
6543    }
6544}
6545
6546impl FDomainReadVmoResponder {
6547    /// Sends a response to the FIDL transaction.
6548    ///
6549    /// Sets the channel to shutdown if an error occurs.
6550    pub fn send(self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
6551        let _result = self.send_raw(result);
6552        if _result.is_err() {
6553            self.control_handle.shutdown();
6554        }
6555        self.drop_without_shutdown();
6556        _result
6557    }
6558
6559    /// Similar to "send" but does not shutdown the channel if an error occurs.
6560    pub fn send_no_shutdown_on_err(
6561        self,
6562        mut result: Result<&[u8], &Error>,
6563    ) -> Result<(), fidl::Error> {
6564        let _result = self.send_raw(result);
6565        self.drop_without_shutdown();
6566        _result
6567    }
6568
6569    fn send_raw(&self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
6570        self.control_handle
6571            .inner
6572            .send::<fidl::encoding::FlexibleResultType<VmoReadVmoResponse, Error>>(
6573                fidl::encoding::FlexibleResult::new(result.map(|data| (data,))),
6574                self.tx_id,
6575                0x62690ec76b0f2fe6,
6576                fidl::encoding::DynamicFlags::FLEXIBLE,
6577            )
6578    }
6579}
6580
6581#[must_use = "FIDL methods require a response to be sent"]
6582#[derive(Debug)]
6583pub struct FDomainWriteVmoResponder {
6584    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6585    tx_id: u32,
6586}
6587
6588/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6589/// if the responder is dropped without sending a response, so that the client
6590/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6591impl std::ops::Drop for FDomainWriteVmoResponder {
6592    fn drop(&mut self) {
6593        self.control_handle.shutdown();
6594        // Safety: drops once, never accessed again
6595        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6596    }
6597}
6598
6599impl fidl::endpoints::Responder for FDomainWriteVmoResponder {
6600    type ControlHandle = FDomainControlHandle;
6601
6602    fn control_handle(&self) -> &FDomainControlHandle {
6603        &self.control_handle
6604    }
6605
6606    fn drop_without_shutdown(mut self) {
6607        // Safety: drops once, never accessed again due to mem::forget
6608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6609        // Prevent Drop from running (which would shut down the channel)
6610        std::mem::forget(self);
6611    }
6612}
6613
6614impl FDomainWriteVmoResponder {
6615    /// Sends a response to the FIDL transaction.
6616    ///
6617    /// Sets the channel to shutdown if an error occurs.
6618    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6619        let _result = self.send_raw(result);
6620        if _result.is_err() {
6621            self.control_handle.shutdown();
6622        }
6623        self.drop_without_shutdown();
6624        _result
6625    }
6626
6627    /// Similar to "send" but does not shutdown the channel if an error occurs.
6628    pub fn send_no_shutdown_on_err(
6629        self,
6630        mut result: Result<(), &Error>,
6631    ) -> Result<(), fidl::Error> {
6632        let _result = self.send_raw(result);
6633        self.drop_without_shutdown();
6634        _result
6635    }
6636
6637    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6638        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6639            fidl::encoding::EmptyStruct,
6640            Error,
6641        >>(
6642            fidl::encoding::FlexibleResult::new(result),
6643            self.tx_id,
6644            0x2f6ac299380e486e,
6645            fidl::encoding::DynamicFlags::FLEXIBLE,
6646        )
6647    }
6648}
6649
6650#[must_use = "FIDL methods require a response to be sent"]
6651#[derive(Debug)]
6652pub struct FDomainGetVmoSizeResponder {
6653    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6654    tx_id: u32,
6655}
6656
6657/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6658/// if the responder is dropped without sending a response, so that the client
6659/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6660impl std::ops::Drop for FDomainGetVmoSizeResponder {
6661    fn drop(&mut self) {
6662        self.control_handle.shutdown();
6663        // Safety: drops once, never accessed again
6664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6665    }
6666}
6667
6668impl fidl::endpoints::Responder for FDomainGetVmoSizeResponder {
6669    type ControlHandle = FDomainControlHandle;
6670
6671    fn control_handle(&self) -> &FDomainControlHandle {
6672        &self.control_handle
6673    }
6674
6675    fn drop_without_shutdown(mut self) {
6676        // Safety: drops once, never accessed again due to mem::forget
6677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6678        // Prevent Drop from running (which would shut down the channel)
6679        std::mem::forget(self);
6680    }
6681}
6682
6683impl FDomainGetVmoSizeResponder {
6684    /// Sends a response to the FIDL transaction.
6685    ///
6686    /// Sets the channel to shutdown if an error occurs.
6687    pub fn send(self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
6688        let _result = self.send_raw(result);
6689        if _result.is_err() {
6690            self.control_handle.shutdown();
6691        }
6692        self.drop_without_shutdown();
6693        _result
6694    }
6695
6696    /// Similar to "send" but does not shutdown the channel if an error occurs.
6697    pub fn send_no_shutdown_on_err(
6698        self,
6699        mut result: Result<u64, &Error>,
6700    ) -> Result<(), fidl::Error> {
6701        let _result = self.send_raw(result);
6702        self.drop_without_shutdown();
6703        _result
6704    }
6705
6706    fn send_raw(&self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
6707        self.control_handle
6708            .inner
6709            .send::<fidl::encoding::FlexibleResultType<VmoGetVmoSizeResponse, Error>>(
6710                fidl::encoding::FlexibleResult::new(result.map(|size| (size,))),
6711                self.tx_id,
6712                0x717f9f3a9ff6906e,
6713                fidl::encoding::DynamicFlags::FLEXIBLE,
6714            )
6715    }
6716}
6717
6718#[must_use = "FIDL methods require a response to be sent"]
6719#[derive(Debug)]
6720pub struct FDomainSetVmoSizeResponder {
6721    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6722    tx_id: u32,
6723}
6724
6725/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6726/// if the responder is dropped without sending a response, so that the client
6727/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6728impl std::ops::Drop for FDomainSetVmoSizeResponder {
6729    fn drop(&mut self) {
6730        self.control_handle.shutdown();
6731        // Safety: drops once, never accessed again
6732        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6733    }
6734}
6735
6736impl fidl::endpoints::Responder for FDomainSetVmoSizeResponder {
6737    type ControlHandle = FDomainControlHandle;
6738
6739    fn control_handle(&self) -> &FDomainControlHandle {
6740        &self.control_handle
6741    }
6742
6743    fn drop_without_shutdown(mut self) {
6744        // Safety: drops once, never accessed again due to mem::forget
6745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6746        // Prevent Drop from running (which would shut down the channel)
6747        std::mem::forget(self);
6748    }
6749}
6750
6751impl FDomainSetVmoSizeResponder {
6752    /// Sends a response to the FIDL transaction.
6753    ///
6754    /// Sets the channel to shutdown if an error occurs.
6755    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6756        let _result = self.send_raw(result);
6757        if _result.is_err() {
6758            self.control_handle.shutdown();
6759        }
6760        self.drop_without_shutdown();
6761        _result
6762    }
6763
6764    /// Similar to "send" but does not shutdown the channel if an error occurs.
6765    pub fn send_no_shutdown_on_err(
6766        self,
6767        mut result: Result<(), &Error>,
6768    ) -> Result<(), fidl::Error> {
6769        let _result = self.send_raw(result);
6770        self.drop_without_shutdown();
6771        _result
6772    }
6773
6774    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6775        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6776            fidl::encoding::EmptyStruct,
6777            Error,
6778        >>(
6779            fidl::encoding::FlexibleResult::new(result),
6780            self.tx_id,
6781            0x7f6f77ac37afe38b,
6782            fidl::encoding::DynamicFlags::FLEXIBLE,
6783        )
6784    }
6785}
6786
6787#[must_use = "FIDL methods require a response to be sent"]
6788#[derive(Debug)]
6789pub struct FDomainGetVmoStreamSizeResponder {
6790    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6791    tx_id: u32,
6792}
6793
6794/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6795/// if the responder is dropped without sending a response, so that the client
6796/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6797impl std::ops::Drop for FDomainGetVmoStreamSizeResponder {
6798    fn drop(&mut self) {
6799        self.control_handle.shutdown();
6800        // Safety: drops once, never accessed again
6801        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6802    }
6803}
6804
6805impl fidl::endpoints::Responder for FDomainGetVmoStreamSizeResponder {
6806    type ControlHandle = FDomainControlHandle;
6807
6808    fn control_handle(&self) -> &FDomainControlHandle {
6809        &self.control_handle
6810    }
6811
6812    fn drop_without_shutdown(mut self) {
6813        // Safety: drops once, never accessed again due to mem::forget
6814        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6815        // Prevent Drop from running (which would shut down the channel)
6816        std::mem::forget(self);
6817    }
6818}
6819
6820impl FDomainGetVmoStreamSizeResponder {
6821    /// Sends a response to the FIDL transaction.
6822    ///
6823    /// Sets the channel to shutdown if an error occurs.
6824    pub fn send(self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
6825        let _result = self.send_raw(result);
6826        if _result.is_err() {
6827            self.control_handle.shutdown();
6828        }
6829        self.drop_without_shutdown();
6830        _result
6831    }
6832
6833    /// Similar to "send" but does not shutdown the channel if an error occurs.
6834    pub fn send_no_shutdown_on_err(
6835        self,
6836        mut result: Result<u64, &Error>,
6837    ) -> Result<(), fidl::Error> {
6838        let _result = self.send_raw(result);
6839        self.drop_without_shutdown();
6840        _result
6841    }
6842
6843    fn send_raw(&self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
6844        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6845            VmoGetVmoStreamSizeResponse,
6846            Error,
6847        >>(
6848            fidl::encoding::FlexibleResult::new(result.map(|size| (size,))),
6849            self.tx_id,
6850            0x54020f4280cb038,
6851            fidl::encoding::DynamicFlags::FLEXIBLE,
6852        )
6853    }
6854}
6855
6856#[must_use = "FIDL methods require a response to be sent"]
6857#[derive(Debug)]
6858pub struct FDomainSetVmoStreamSizeResponder {
6859    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6860    tx_id: u32,
6861}
6862
6863/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6864/// if the responder is dropped without sending a response, so that the client
6865/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6866impl std::ops::Drop for FDomainSetVmoStreamSizeResponder {
6867    fn drop(&mut self) {
6868        self.control_handle.shutdown();
6869        // Safety: drops once, never accessed again
6870        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6871    }
6872}
6873
6874impl fidl::endpoints::Responder for FDomainSetVmoStreamSizeResponder {
6875    type ControlHandle = FDomainControlHandle;
6876
6877    fn control_handle(&self) -> &FDomainControlHandle {
6878        &self.control_handle
6879    }
6880
6881    fn drop_without_shutdown(mut self) {
6882        // Safety: drops once, never accessed again due to mem::forget
6883        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6884        // Prevent Drop from running (which would shut down the channel)
6885        std::mem::forget(self);
6886    }
6887}
6888
6889impl FDomainSetVmoStreamSizeResponder {
6890    /// Sends a response to the FIDL transaction.
6891    ///
6892    /// Sets the channel to shutdown if an error occurs.
6893    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6894        let _result = self.send_raw(result);
6895        if _result.is_err() {
6896            self.control_handle.shutdown();
6897        }
6898        self.drop_without_shutdown();
6899        _result
6900    }
6901
6902    /// Similar to "send" but does not shutdown the channel if an error occurs.
6903    pub fn send_no_shutdown_on_err(
6904        self,
6905        mut result: Result<(), &Error>,
6906    ) -> Result<(), fidl::Error> {
6907        let _result = self.send_raw(result);
6908        self.drop_without_shutdown();
6909        _result
6910    }
6911
6912    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6913        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6914            fidl::encoding::EmptyStruct,
6915            Error,
6916        >>(
6917            fidl::encoding::FlexibleResult::new(result),
6918            self.tx_id,
6919            0x3bdb108fb18002eb,
6920            fidl::encoding::DynamicFlags::FLEXIBLE,
6921        )
6922    }
6923}
6924
6925#[must_use = "FIDL methods require a response to be sent"]
6926#[derive(Debug)]
6927pub struct FDomainGetNamespaceResponder {
6928    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6929    tx_id: u32,
6930}
6931
6932/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
6933/// if the responder is dropped without sending a response, so that the client
6934/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6935impl std::ops::Drop for FDomainGetNamespaceResponder {
6936    fn drop(&mut self) {
6937        self.control_handle.shutdown();
6938        // Safety: drops once, never accessed again
6939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6940    }
6941}
6942
6943impl fidl::endpoints::Responder for FDomainGetNamespaceResponder {
6944    type ControlHandle = FDomainControlHandle;
6945
6946    fn control_handle(&self) -> &FDomainControlHandle {
6947        &self.control_handle
6948    }
6949
6950    fn drop_without_shutdown(mut self) {
6951        // Safety: drops once, never accessed again due to mem::forget
6952        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6953        // Prevent Drop from running (which would shut down the channel)
6954        std::mem::forget(self);
6955    }
6956}
6957
6958impl FDomainGetNamespaceResponder {
6959    /// Sends a response to the FIDL transaction.
6960    ///
6961    /// Sets the channel to shutdown if an error occurs.
6962    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6963        let _result = self.send_raw(result);
6964        if _result.is_err() {
6965            self.control_handle.shutdown();
6966        }
6967        self.drop_without_shutdown();
6968        _result
6969    }
6970
6971    /// Similar to "send" but does not shutdown the channel if an error occurs.
6972    pub fn send_no_shutdown_on_err(
6973        self,
6974        mut result: Result<(), &Error>,
6975    ) -> Result<(), fidl::Error> {
6976        let _result = self.send_raw(result);
6977        self.drop_without_shutdown();
6978        _result
6979    }
6980
6981    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
6982        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6983            fidl::encoding::EmptyStruct,
6984            Error,
6985        >>(
6986            fidl::encoding::FlexibleResult::new(result),
6987            self.tx_id,
6988            0x74f2e74d9f53e11e,
6989            fidl::encoding::DynamicFlags::FLEXIBLE,
6990        )
6991    }
6992}
6993
6994#[must_use = "FIDL methods require a response to be sent"]
6995#[derive(Debug)]
6996pub struct FDomainCloseResponder {
6997    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
6998    tx_id: u32,
6999}
7000
7001/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7002/// if the responder is dropped without sending a response, so that the client
7003/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7004impl std::ops::Drop for FDomainCloseResponder {
7005    fn drop(&mut self) {
7006        self.control_handle.shutdown();
7007        // Safety: drops once, never accessed again
7008        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7009    }
7010}
7011
7012impl fidl::endpoints::Responder for FDomainCloseResponder {
7013    type ControlHandle = FDomainControlHandle;
7014
7015    fn control_handle(&self) -> &FDomainControlHandle {
7016        &self.control_handle
7017    }
7018
7019    fn drop_without_shutdown(mut self) {
7020        // Safety: drops once, never accessed again due to mem::forget
7021        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7022        // Prevent Drop from running (which would shut down the channel)
7023        std::mem::forget(self);
7024    }
7025}
7026
7027impl FDomainCloseResponder {
7028    /// Sends a response to the FIDL transaction.
7029    ///
7030    /// Sets the channel to shutdown if an error occurs.
7031    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7032        let _result = self.send_raw(result);
7033        if _result.is_err() {
7034            self.control_handle.shutdown();
7035        }
7036        self.drop_without_shutdown();
7037        _result
7038    }
7039
7040    /// Similar to "send" but does not shutdown the channel if an error occurs.
7041    pub fn send_no_shutdown_on_err(
7042        self,
7043        mut result: Result<(), &Error>,
7044    ) -> Result<(), fidl::Error> {
7045        let _result = self.send_raw(result);
7046        self.drop_without_shutdown();
7047        _result
7048    }
7049
7050    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7051        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7052            fidl::encoding::EmptyStruct,
7053            Error,
7054        >>(
7055            fidl::encoding::FlexibleResult::new(result),
7056            self.tx_id,
7057            0x5ef8c24362964257,
7058            fidl::encoding::DynamicFlags::FLEXIBLE,
7059        )
7060    }
7061}
7062
7063#[must_use = "FIDL methods require a response to be sent"]
7064#[derive(Debug)]
7065pub struct FDomainDuplicateResponder {
7066    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
7067    tx_id: u32,
7068}
7069
7070/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7071/// if the responder is dropped without sending a response, so that the client
7072/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7073impl std::ops::Drop for FDomainDuplicateResponder {
7074    fn drop(&mut self) {
7075        self.control_handle.shutdown();
7076        // Safety: drops once, never accessed again
7077        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7078    }
7079}
7080
7081impl fidl::endpoints::Responder for FDomainDuplicateResponder {
7082    type ControlHandle = FDomainControlHandle;
7083
7084    fn control_handle(&self) -> &FDomainControlHandle {
7085        &self.control_handle
7086    }
7087
7088    fn drop_without_shutdown(mut self) {
7089        // Safety: drops once, never accessed again due to mem::forget
7090        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7091        // Prevent Drop from running (which would shut down the channel)
7092        std::mem::forget(self);
7093    }
7094}
7095
7096impl FDomainDuplicateResponder {
7097    /// Sends a response to the FIDL transaction.
7098    ///
7099    /// Sets the channel to shutdown if an error occurs.
7100    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7101        let _result = self.send_raw(result);
7102        if _result.is_err() {
7103            self.control_handle.shutdown();
7104        }
7105        self.drop_without_shutdown();
7106        _result
7107    }
7108
7109    /// Similar to "send" but does not shutdown the channel if an error occurs.
7110    pub fn send_no_shutdown_on_err(
7111        self,
7112        mut result: Result<(), &Error>,
7113    ) -> Result<(), fidl::Error> {
7114        let _result = self.send_raw(result);
7115        self.drop_without_shutdown();
7116        _result
7117    }
7118
7119    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7120        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7121            fidl::encoding::EmptyStruct,
7122            Error,
7123        >>(
7124            fidl::encoding::FlexibleResult::new(result),
7125            self.tx_id,
7126            0x7a85b94bd1777ab9,
7127            fidl::encoding::DynamicFlags::FLEXIBLE,
7128        )
7129    }
7130}
7131
7132#[must_use = "FIDL methods require a response to be sent"]
7133#[derive(Debug)]
7134pub struct FDomainReplaceResponder {
7135    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
7136    tx_id: u32,
7137}
7138
7139/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7140/// if the responder is dropped without sending a response, so that the client
7141/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7142impl std::ops::Drop for FDomainReplaceResponder {
7143    fn drop(&mut self) {
7144        self.control_handle.shutdown();
7145        // Safety: drops once, never accessed again
7146        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7147    }
7148}
7149
7150impl fidl::endpoints::Responder for FDomainReplaceResponder {
7151    type ControlHandle = FDomainControlHandle;
7152
7153    fn control_handle(&self) -> &FDomainControlHandle {
7154        &self.control_handle
7155    }
7156
7157    fn drop_without_shutdown(mut self) {
7158        // Safety: drops once, never accessed again due to mem::forget
7159        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7160        // Prevent Drop from running (which would shut down the channel)
7161        std::mem::forget(self);
7162    }
7163}
7164
7165impl FDomainReplaceResponder {
7166    /// Sends a response to the FIDL transaction.
7167    ///
7168    /// Sets the channel to shutdown if an error occurs.
7169    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7170        let _result = self.send_raw(result);
7171        if _result.is_err() {
7172            self.control_handle.shutdown();
7173        }
7174        self.drop_without_shutdown();
7175        _result
7176    }
7177
7178    /// Similar to "send" but does not shutdown the channel if an error occurs.
7179    pub fn send_no_shutdown_on_err(
7180        self,
7181        mut result: Result<(), &Error>,
7182    ) -> Result<(), fidl::Error> {
7183        let _result = self.send_raw(result);
7184        self.drop_without_shutdown();
7185        _result
7186    }
7187
7188    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7189        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7190            fidl::encoding::EmptyStruct,
7191            Error,
7192        >>(
7193            fidl::encoding::FlexibleResult::new(result),
7194            self.tx_id,
7195            0x32fa64625a5bd3be,
7196            fidl::encoding::DynamicFlags::FLEXIBLE,
7197        )
7198    }
7199}
7200
7201#[must_use = "FIDL methods require a response to be sent"]
7202#[derive(Debug)]
7203pub struct FDomainSignalResponder {
7204    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
7205    tx_id: u32,
7206}
7207
7208/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7209/// if the responder is dropped without sending a response, so that the client
7210/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7211impl std::ops::Drop for FDomainSignalResponder {
7212    fn drop(&mut self) {
7213        self.control_handle.shutdown();
7214        // Safety: drops once, never accessed again
7215        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7216    }
7217}
7218
7219impl fidl::endpoints::Responder for FDomainSignalResponder {
7220    type ControlHandle = FDomainControlHandle;
7221
7222    fn control_handle(&self) -> &FDomainControlHandle {
7223        &self.control_handle
7224    }
7225
7226    fn drop_without_shutdown(mut self) {
7227        // Safety: drops once, never accessed again due to mem::forget
7228        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7229        // Prevent Drop from running (which would shut down the channel)
7230        std::mem::forget(self);
7231    }
7232}
7233
7234impl FDomainSignalResponder {
7235    /// Sends a response to the FIDL transaction.
7236    ///
7237    /// Sets the channel to shutdown if an error occurs.
7238    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7239        let _result = self.send_raw(result);
7240        if _result.is_err() {
7241            self.control_handle.shutdown();
7242        }
7243        self.drop_without_shutdown();
7244        _result
7245    }
7246
7247    /// Similar to "send" but does not shutdown the channel if an error occurs.
7248    pub fn send_no_shutdown_on_err(
7249        self,
7250        mut result: Result<(), &Error>,
7251    ) -> Result<(), fidl::Error> {
7252        let _result = self.send_raw(result);
7253        self.drop_without_shutdown();
7254        _result
7255    }
7256
7257    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7258        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7259            fidl::encoding::EmptyStruct,
7260            Error,
7261        >>(
7262            fidl::encoding::FlexibleResult::new(result),
7263            self.tx_id,
7264            0xe8352fb978996d9,
7265            fidl::encoding::DynamicFlags::FLEXIBLE,
7266        )
7267    }
7268}
7269
7270#[must_use = "FIDL methods require a response to be sent"]
7271#[derive(Debug)]
7272pub struct FDomainSignalPeerResponder {
7273    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
7274    tx_id: u32,
7275}
7276
7277/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7278/// if the responder is dropped without sending a response, so that the client
7279/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7280impl std::ops::Drop for FDomainSignalPeerResponder {
7281    fn drop(&mut self) {
7282        self.control_handle.shutdown();
7283        // Safety: drops once, never accessed again
7284        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7285    }
7286}
7287
7288impl fidl::endpoints::Responder for FDomainSignalPeerResponder {
7289    type ControlHandle = FDomainControlHandle;
7290
7291    fn control_handle(&self) -> &FDomainControlHandle {
7292        &self.control_handle
7293    }
7294
7295    fn drop_without_shutdown(mut self) {
7296        // Safety: drops once, never accessed again due to mem::forget
7297        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7298        // Prevent Drop from running (which would shut down the channel)
7299        std::mem::forget(self);
7300    }
7301}
7302
7303impl FDomainSignalPeerResponder {
7304    /// Sends a response to the FIDL transaction.
7305    ///
7306    /// Sets the channel to shutdown if an error occurs.
7307    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7308        let _result = self.send_raw(result);
7309        if _result.is_err() {
7310            self.control_handle.shutdown();
7311        }
7312        self.drop_without_shutdown();
7313        _result
7314    }
7315
7316    /// Similar to "send" but does not shutdown the channel if an error occurs.
7317    pub fn send_no_shutdown_on_err(
7318        self,
7319        mut result: Result<(), &Error>,
7320    ) -> Result<(), fidl::Error> {
7321        let _result = self.send_raw(result);
7322        self.drop_without_shutdown();
7323        _result
7324    }
7325
7326    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
7327        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7328            fidl::encoding::EmptyStruct,
7329            Error,
7330        >>(
7331            fidl::encoding::FlexibleResult::new(result),
7332            self.tx_id,
7333            0x7e84ec8ca7eabaf8,
7334            fidl::encoding::DynamicFlags::FLEXIBLE,
7335        )
7336    }
7337}
7338
7339#[must_use = "FIDL methods require a response to be sent"]
7340#[derive(Debug)]
7341pub struct FDomainWaitForSignalsResponder {
7342    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
7343    tx_id: u32,
7344}
7345
7346/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7347/// if the responder is dropped without sending a response, so that the client
7348/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7349impl std::ops::Drop for FDomainWaitForSignalsResponder {
7350    fn drop(&mut self) {
7351        self.control_handle.shutdown();
7352        // Safety: drops once, never accessed again
7353        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7354    }
7355}
7356
7357impl fidl::endpoints::Responder for FDomainWaitForSignalsResponder {
7358    type ControlHandle = FDomainControlHandle;
7359
7360    fn control_handle(&self) -> &FDomainControlHandle {
7361        &self.control_handle
7362    }
7363
7364    fn drop_without_shutdown(mut self) {
7365        // Safety: drops once, never accessed again due to mem::forget
7366        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7367        // Prevent Drop from running (which would shut down the channel)
7368        std::mem::forget(self);
7369    }
7370}
7371
7372impl FDomainWaitForSignalsResponder {
7373    /// Sends a response to the FIDL transaction.
7374    ///
7375    /// Sets the channel to shutdown if an error occurs.
7376    pub fn send(self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
7377        let _result = self.send_raw(result);
7378        if _result.is_err() {
7379            self.control_handle.shutdown();
7380        }
7381        self.drop_without_shutdown();
7382        _result
7383    }
7384
7385    /// Similar to "send" but does not shutdown the channel if an error occurs.
7386    pub fn send_no_shutdown_on_err(
7387        self,
7388        mut result: Result<u32, &Error>,
7389    ) -> Result<(), fidl::Error> {
7390        let _result = self.send_raw(result);
7391        self.drop_without_shutdown();
7392        _result
7393    }
7394
7395    fn send_raw(&self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
7396        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7397            FDomainWaitForSignalsResponse,
7398            Error,
7399        >>(
7400            fidl::encoding::FlexibleResult::new(result.map(|signals| (signals,))),
7401            self.tx_id,
7402            0x8f72d9b4b85c1eb,
7403            fidl::encoding::DynamicFlags::FLEXIBLE,
7404        )
7405    }
7406}
7407
7408#[must_use = "FIDL methods require a response to be sent"]
7409#[derive(Debug)]
7410pub struct FDomainGetKoidResponder {
7411    control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
7412    tx_id: u32,
7413}
7414
7415/// Set the the channel to be shutdown (see [`FDomainControlHandle::shutdown`])
7416/// if the responder is dropped without sending a response, so that the client
7417/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7418impl std::ops::Drop for FDomainGetKoidResponder {
7419    fn drop(&mut self) {
7420        self.control_handle.shutdown();
7421        // Safety: drops once, never accessed again
7422        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7423    }
7424}
7425
7426impl fidl::endpoints::Responder for FDomainGetKoidResponder {
7427    type ControlHandle = FDomainControlHandle;
7428
7429    fn control_handle(&self) -> &FDomainControlHandle {
7430        &self.control_handle
7431    }
7432
7433    fn drop_without_shutdown(mut self) {
7434        // Safety: drops once, never accessed again due to mem::forget
7435        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7436        // Prevent Drop from running (which would shut down the channel)
7437        std::mem::forget(self);
7438    }
7439}
7440
7441impl FDomainGetKoidResponder {
7442    /// Sends a response to the FIDL transaction.
7443    ///
7444    /// Sets the channel to shutdown if an error occurs.
7445    pub fn send(self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
7446        let _result = self.send_raw(result);
7447        if _result.is_err() {
7448            self.control_handle.shutdown();
7449        }
7450        self.drop_without_shutdown();
7451        _result
7452    }
7453
7454    /// Similar to "send" but does not shutdown the channel if an error occurs.
7455    pub fn send_no_shutdown_on_err(
7456        self,
7457        mut result: Result<u64, &Error>,
7458    ) -> Result<(), fidl::Error> {
7459        let _result = self.send_raw(result);
7460        self.drop_without_shutdown();
7461        _result
7462    }
7463
7464    fn send_raw(&self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
7465        self.control_handle
7466            .inner
7467            .send::<fidl::encoding::FlexibleResultType<FDomainGetKoidResponse, Error>>(
7468                fidl::encoding::FlexibleResult::new(result.map(|koid| (koid,))),
7469                self.tx_id,
7470                0x437db979a63402c3,
7471                fidl::encoding::DynamicFlags::FLEXIBLE,
7472            )
7473    }
7474}
7475
7476#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7477pub struct SocketMarker;
7478
7479impl fidl::endpoints::ProtocolMarker for SocketMarker {
7480    type Proxy = SocketProxy;
7481    type RequestStream = SocketRequestStream;
7482    #[cfg(target_os = "fuchsia")]
7483    type SynchronousProxy = SocketSynchronousProxy;
7484
7485    const DEBUG_NAME: &'static str = "(anonymous) Socket";
7486}
7487pub type SocketCreateSocketResult = Result<(), Error>;
7488pub type SocketSetSocketDispositionResult = Result<(), Error>;
7489pub type SocketReadSocketResult = Result<(Vec<u8>, bool), Error>;
7490pub type SocketWriteSocketResult = Result<u64, WriteSocketError>;
7491pub type SocketReadSocketStreamingStartResult = Result<(), Error>;
7492pub type SocketReadSocketStreamingStopResult = Result<(), Error>;
7493
7494pub trait SocketProxyInterface: Send + Sync {
7495    type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
7496        + Send;
7497    fn r#create_socket(
7498        &self,
7499        options: SocketType,
7500        handles: &[NewHandleId; 2],
7501    ) -> Self::CreateSocketResponseFut;
7502    type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
7503        + Send;
7504    fn r#set_socket_disposition(
7505        &self,
7506        handle: &HandleId,
7507        disposition: SocketDisposition,
7508        disposition_peer: SocketDisposition,
7509    ) -> Self::SetSocketDispositionResponseFut;
7510    type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
7511        + Send;
7512    fn r#read_socket(&self, handle: &HandleId, max_bytes: u64) -> Self::ReadSocketResponseFut;
7513    type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
7514        + Send;
7515    fn r#write_socket(&self, handle: &HandleId, data: &[u8]) -> Self::WriteSocketResponseFut;
7516    type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
7517        + Send;
7518    fn r#read_socket_streaming_start(
7519        &self,
7520        handle: &HandleId,
7521    ) -> Self::ReadSocketStreamingStartResponseFut;
7522    type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
7523        + Send;
7524    fn r#read_socket_streaming_stop(
7525        &self,
7526        handle: &HandleId,
7527    ) -> Self::ReadSocketStreamingStopResponseFut;
7528}
7529#[derive(Debug)]
7530#[cfg(target_os = "fuchsia")]
7531pub struct SocketSynchronousProxy {
7532    client: fidl::client::sync::Client,
7533}
7534
7535#[cfg(target_os = "fuchsia")]
7536impl fidl::endpoints::SynchronousProxy for SocketSynchronousProxy {
7537    type Proxy = SocketProxy;
7538    type Protocol = SocketMarker;
7539
7540    fn from_channel(inner: fidl::Channel) -> Self {
7541        Self::new(inner)
7542    }
7543
7544    fn into_channel(self) -> fidl::Channel {
7545        self.client.into_channel()
7546    }
7547
7548    fn as_channel(&self) -> &fidl::Channel {
7549        self.client.as_channel()
7550    }
7551}
7552
7553#[cfg(target_os = "fuchsia")]
7554impl SocketSynchronousProxy {
7555    pub fn new(channel: fidl::Channel) -> Self {
7556        Self { client: fidl::client::sync::Client::new(channel) }
7557    }
7558
7559    pub fn into_channel(self) -> fidl::Channel {
7560        self.client.into_channel()
7561    }
7562
7563    /// Waits until an event arrives and returns it. It is safe for other
7564    /// threads to make concurrent requests while waiting for an event.
7565    pub fn wait_for_event(
7566        &self,
7567        deadline: zx::MonotonicInstant,
7568    ) -> Result<SocketEvent, fidl::Error> {
7569        SocketEvent::decode(self.client.wait_for_event::<SocketMarker>(deadline)?)
7570    }
7571
7572    /// Create a new socket in this FDomain and return both its ends.
7573    pub fn r#create_socket(
7574        &self,
7575        mut options: SocketType,
7576        mut handles: &[NewHandleId; 2],
7577        ___deadline: zx::MonotonicInstant,
7578    ) -> Result<SocketCreateSocketResult, fidl::Error> {
7579        let _response = self.client.send_query::<
7580            SocketCreateSocketRequest,
7581            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7582            SocketMarker,
7583        >(
7584            (options, handles,),
7585            0x200bf0ea21932de0,
7586            fidl::encoding::DynamicFlags::FLEXIBLE,
7587            ___deadline,
7588        )?
7589        .into_result::<SocketMarker>("create_socket")?;
7590        Ok(_response.map(|x| x))
7591    }
7592
7593    /// Set the disposition of a given socket.
7594    pub fn r#set_socket_disposition(
7595        &self,
7596        mut handle: &HandleId,
7597        mut disposition: SocketDisposition,
7598        mut disposition_peer: SocketDisposition,
7599        ___deadline: zx::MonotonicInstant,
7600    ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
7601        let _response = self.client.send_query::<
7602            SocketSetSocketDispositionRequest,
7603            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7604            SocketMarker,
7605        >(
7606            (handle, disposition, disposition_peer,),
7607            0x60d3c7ccb17f9bdf,
7608            fidl::encoding::DynamicFlags::FLEXIBLE,
7609            ___deadline,
7610        )?
7611        .into_result::<SocketMarker>("set_socket_disposition")?;
7612        Ok(_response.map(|x| x))
7613    }
7614
7615    /// Read data from a socket. This method will fail if the socket is currently being read
7616    /// asynchronously.
7617    pub fn r#read_socket(
7618        &self,
7619        mut handle: &HandleId,
7620        mut max_bytes: u64,
7621        ___deadline: zx::MonotonicInstant,
7622    ) -> Result<SocketReadSocketResult, fidl::Error> {
7623        let _response = self.client.send_query::<
7624            SocketReadSocketRequest,
7625            fidl::encoding::FlexibleResultType<SocketData, Error>,
7626            SocketMarker,
7627        >(
7628            (handle, max_bytes,),
7629            0x1da8aabec249c02e,
7630            fidl::encoding::DynamicFlags::FLEXIBLE,
7631            ___deadline,
7632        )?
7633        .into_result::<SocketMarker>("read_socket")?;
7634        Ok(_response.map(|x| (x.data, x.is_datagram)))
7635    }
7636
7637    /// Write to a socket. This will attempt to write all the data passed, and
7638    /// will block and retry whenever it is safe (e.g. it should never return
7639    /// SHOULD_WAIT). The `WriteSocketError` contains a `wrote` parameter to
7640    /// indicate if some bytes were written successfully before the failure
7641    /// occurred.
7642    pub fn r#write_socket(
7643        &self,
7644        mut handle: &HandleId,
7645        mut data: &[u8],
7646        ___deadline: zx::MonotonicInstant,
7647    ) -> Result<SocketWriteSocketResult, fidl::Error> {
7648        let _response = self.client.send_query::<
7649            SocketWriteSocketRequest,
7650            fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
7651            SocketMarker,
7652        >(
7653            (handle, data,),
7654            0x5b541623cbbbf683,
7655            fidl::encoding::DynamicFlags::FLEXIBLE,
7656            ___deadline,
7657        )?
7658        .into_result::<SocketMarker>("write_socket")?;
7659        Ok(_response.map(|x| x.wrote))
7660    }
7661
7662    /// Starts reading from the given socket. Data is returned via the `SocketStreamingData` event. That
7663    /// event will occur repeatedly until `ReadSocketStreamingStop` is called for the same handle or the
7664    /// event indicates the handle is closed.
7665    pub fn r#read_socket_streaming_start(
7666        &self,
7667        mut handle: &HandleId,
7668        ___deadline: zx::MonotonicInstant,
7669    ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
7670        let _response = self.client.send_query::<
7671            SocketReadSocketStreamingStartRequest,
7672            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7673            SocketMarker,
7674        >(
7675            (handle,),
7676            0x2a592748d5f33445,
7677            fidl::encoding::DynamicFlags::FLEXIBLE,
7678            ___deadline,
7679        )?
7680        .into_result::<SocketMarker>("read_socket_streaming_start")?;
7681        Ok(_response.map(|x| x))
7682    }
7683
7684    /// Stop asynchronous reading from the given socket.
7685    pub fn r#read_socket_streaming_stop(
7686        &self,
7687        mut handle: &HandleId,
7688        ___deadline: zx::MonotonicInstant,
7689    ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
7690        let _response = self.client.send_query::<
7691            SocketReadSocketStreamingStopRequest,
7692            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7693            SocketMarker,
7694        >(
7695            (handle,),
7696            0x53e5cade5f4d22e7,
7697            fidl::encoding::DynamicFlags::FLEXIBLE,
7698            ___deadline,
7699        )?
7700        .into_result::<SocketMarker>("read_socket_streaming_stop")?;
7701        Ok(_response.map(|x| x))
7702    }
7703}
7704
7705#[cfg(target_os = "fuchsia")]
7706impl From<SocketSynchronousProxy> for zx::NullableHandle {
7707    fn from(value: SocketSynchronousProxy) -> Self {
7708        value.into_channel().into()
7709    }
7710}
7711
7712#[cfg(target_os = "fuchsia")]
7713impl From<fidl::Channel> for SocketSynchronousProxy {
7714    fn from(value: fidl::Channel) -> Self {
7715        Self::new(value)
7716    }
7717}
7718
7719#[cfg(target_os = "fuchsia")]
7720impl fidl::endpoints::FromClient for SocketSynchronousProxy {
7721    type Protocol = SocketMarker;
7722
7723    fn from_client(value: fidl::endpoints::ClientEnd<SocketMarker>) -> Self {
7724        Self::new(value.into_channel())
7725    }
7726}
7727
7728#[derive(Debug, Clone)]
7729pub struct SocketProxy {
7730    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7731}
7732
7733impl fidl::endpoints::Proxy for SocketProxy {
7734    type Protocol = SocketMarker;
7735
7736    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7737        Self::new(inner)
7738    }
7739
7740    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7741        self.client.into_channel().map_err(|client| Self { client })
7742    }
7743
7744    fn as_channel(&self) -> &::fidl::AsyncChannel {
7745        self.client.as_channel()
7746    }
7747}
7748
7749impl SocketProxy {
7750    /// Create a new Proxy for fuchsia.fdomain/Socket.
7751    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7752        let protocol_name = <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7753        Self { client: fidl::client::Client::new(channel, protocol_name) }
7754    }
7755
7756    /// Get a Stream of events from the remote end of the protocol.
7757    ///
7758    /// # Panics
7759    ///
7760    /// Panics if the event stream was already taken.
7761    pub fn take_event_stream(&self) -> SocketEventStream {
7762        SocketEventStream { event_receiver: self.client.take_event_receiver() }
7763    }
7764
7765    /// Create a new socket in this FDomain and return both its ends.
7766    pub fn r#create_socket(
7767        &self,
7768        mut options: SocketType,
7769        mut handles: &[NewHandleId; 2],
7770    ) -> fidl::client::QueryResponseFut<
7771        SocketCreateSocketResult,
7772        fidl::encoding::DefaultFuchsiaResourceDialect,
7773    > {
7774        SocketProxyInterface::r#create_socket(self, options, handles)
7775    }
7776
7777    /// Set the disposition of a given socket.
7778    pub fn r#set_socket_disposition(
7779        &self,
7780        mut handle: &HandleId,
7781        mut disposition: SocketDisposition,
7782        mut disposition_peer: SocketDisposition,
7783    ) -> fidl::client::QueryResponseFut<
7784        SocketSetSocketDispositionResult,
7785        fidl::encoding::DefaultFuchsiaResourceDialect,
7786    > {
7787        SocketProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
7788    }
7789
7790    /// Read data from a socket. This method will fail if the socket is currently being read
7791    /// asynchronously.
7792    pub fn r#read_socket(
7793        &self,
7794        mut handle: &HandleId,
7795        mut max_bytes: u64,
7796    ) -> fidl::client::QueryResponseFut<
7797        SocketReadSocketResult,
7798        fidl::encoding::DefaultFuchsiaResourceDialect,
7799    > {
7800        SocketProxyInterface::r#read_socket(self, handle, max_bytes)
7801    }
7802
7803    /// Write to a socket. This will attempt to write all the data passed, and
7804    /// will block and retry whenever it is safe (e.g. it should never return
7805    /// SHOULD_WAIT). The `WriteSocketError` contains a `wrote` parameter to
7806    /// indicate if some bytes were written successfully before the failure
7807    /// occurred.
7808    pub fn r#write_socket(
7809        &self,
7810        mut handle: &HandleId,
7811        mut data: &[u8],
7812    ) -> fidl::client::QueryResponseFut<
7813        SocketWriteSocketResult,
7814        fidl::encoding::DefaultFuchsiaResourceDialect,
7815    > {
7816        SocketProxyInterface::r#write_socket(self, handle, data)
7817    }
7818
7819    /// Starts reading from the given socket. Data is returned via the `SocketStreamingData` event. That
7820    /// event will occur repeatedly until `ReadSocketStreamingStop` is called for the same handle or the
7821    /// event indicates the handle is closed.
7822    pub fn r#read_socket_streaming_start(
7823        &self,
7824        mut handle: &HandleId,
7825    ) -> fidl::client::QueryResponseFut<
7826        SocketReadSocketStreamingStartResult,
7827        fidl::encoding::DefaultFuchsiaResourceDialect,
7828    > {
7829        SocketProxyInterface::r#read_socket_streaming_start(self, handle)
7830    }
7831
7832    /// Stop asynchronous reading from the given socket.
7833    pub fn r#read_socket_streaming_stop(
7834        &self,
7835        mut handle: &HandleId,
7836    ) -> fidl::client::QueryResponseFut<
7837        SocketReadSocketStreamingStopResult,
7838        fidl::encoding::DefaultFuchsiaResourceDialect,
7839    > {
7840        SocketProxyInterface::r#read_socket_streaming_stop(self, handle)
7841    }
7842}
7843
7844impl SocketProxyInterface for SocketProxy {
7845    type CreateSocketResponseFut = fidl::client::QueryResponseFut<
7846        SocketCreateSocketResult,
7847        fidl::encoding::DefaultFuchsiaResourceDialect,
7848    >;
7849    fn r#create_socket(
7850        &self,
7851        mut options: SocketType,
7852        mut handles: &[NewHandleId; 2],
7853    ) -> Self::CreateSocketResponseFut {
7854        fn _decode(
7855            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7856        ) -> Result<SocketCreateSocketResult, fidl::Error> {
7857            let _response = fidl::client::decode_transaction_body::<
7858                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7859                fidl::encoding::DefaultFuchsiaResourceDialect,
7860                0x200bf0ea21932de0,
7861            >(_buf?)?
7862            .into_result::<SocketMarker>("create_socket")?;
7863            Ok(_response.map(|x| x))
7864        }
7865        self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
7866            (options, handles),
7867            0x200bf0ea21932de0,
7868            fidl::encoding::DynamicFlags::FLEXIBLE,
7869            _decode,
7870        )
7871    }
7872
7873    type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
7874        SocketSetSocketDispositionResult,
7875        fidl::encoding::DefaultFuchsiaResourceDialect,
7876    >;
7877    fn r#set_socket_disposition(
7878        &self,
7879        mut handle: &HandleId,
7880        mut disposition: SocketDisposition,
7881        mut disposition_peer: SocketDisposition,
7882    ) -> Self::SetSocketDispositionResponseFut {
7883        fn _decode(
7884            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7885        ) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
7886            let _response = fidl::client::decode_transaction_body::<
7887                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7888                fidl::encoding::DefaultFuchsiaResourceDialect,
7889                0x60d3c7ccb17f9bdf,
7890            >(_buf?)?
7891            .into_result::<SocketMarker>("set_socket_disposition")?;
7892            Ok(_response.map(|x| x))
7893        }
7894        self.client.send_query_and_decode::<
7895            SocketSetSocketDispositionRequest,
7896            SocketSetSocketDispositionResult,
7897        >(
7898            (handle, disposition, disposition_peer,),
7899            0x60d3c7ccb17f9bdf,
7900            fidl::encoding::DynamicFlags::FLEXIBLE,
7901            _decode,
7902        )
7903    }
7904
7905    type ReadSocketResponseFut = fidl::client::QueryResponseFut<
7906        SocketReadSocketResult,
7907        fidl::encoding::DefaultFuchsiaResourceDialect,
7908    >;
7909    fn r#read_socket(
7910        &self,
7911        mut handle: &HandleId,
7912        mut max_bytes: u64,
7913    ) -> Self::ReadSocketResponseFut {
7914        fn _decode(
7915            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7916        ) -> Result<SocketReadSocketResult, fidl::Error> {
7917            let _response = fidl::client::decode_transaction_body::<
7918                fidl::encoding::FlexibleResultType<SocketData, Error>,
7919                fidl::encoding::DefaultFuchsiaResourceDialect,
7920                0x1da8aabec249c02e,
7921            >(_buf?)?
7922            .into_result::<SocketMarker>("read_socket")?;
7923            Ok(_response.map(|x| (x.data, x.is_datagram)))
7924        }
7925        self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
7926            (handle, max_bytes),
7927            0x1da8aabec249c02e,
7928            fidl::encoding::DynamicFlags::FLEXIBLE,
7929            _decode,
7930        )
7931    }
7932
7933    type WriteSocketResponseFut = fidl::client::QueryResponseFut<
7934        SocketWriteSocketResult,
7935        fidl::encoding::DefaultFuchsiaResourceDialect,
7936    >;
7937    fn r#write_socket(
7938        &self,
7939        mut handle: &HandleId,
7940        mut data: &[u8],
7941    ) -> Self::WriteSocketResponseFut {
7942        fn _decode(
7943            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7944        ) -> Result<SocketWriteSocketResult, fidl::Error> {
7945            let _response = fidl::client::decode_transaction_body::<
7946                fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
7947                fidl::encoding::DefaultFuchsiaResourceDialect,
7948                0x5b541623cbbbf683,
7949            >(_buf?)?
7950            .into_result::<SocketMarker>("write_socket")?;
7951            Ok(_response.map(|x| x.wrote))
7952        }
7953        self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
7954            (handle, data),
7955            0x5b541623cbbbf683,
7956            fidl::encoding::DynamicFlags::FLEXIBLE,
7957            _decode,
7958        )
7959    }
7960
7961    type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
7962        SocketReadSocketStreamingStartResult,
7963        fidl::encoding::DefaultFuchsiaResourceDialect,
7964    >;
7965    fn r#read_socket_streaming_start(
7966        &self,
7967        mut handle: &HandleId,
7968    ) -> Self::ReadSocketStreamingStartResponseFut {
7969        fn _decode(
7970            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7971        ) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
7972            let _response = fidl::client::decode_transaction_body::<
7973                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
7974                fidl::encoding::DefaultFuchsiaResourceDialect,
7975                0x2a592748d5f33445,
7976            >(_buf?)?
7977            .into_result::<SocketMarker>("read_socket_streaming_start")?;
7978            Ok(_response.map(|x| x))
7979        }
7980        self.client.send_query_and_decode::<
7981            SocketReadSocketStreamingStartRequest,
7982            SocketReadSocketStreamingStartResult,
7983        >(
7984            (handle,),
7985            0x2a592748d5f33445,
7986            fidl::encoding::DynamicFlags::FLEXIBLE,
7987            _decode,
7988        )
7989    }
7990
7991    type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
7992        SocketReadSocketStreamingStopResult,
7993        fidl::encoding::DefaultFuchsiaResourceDialect,
7994    >;
7995    fn r#read_socket_streaming_stop(
7996        &self,
7997        mut handle: &HandleId,
7998    ) -> Self::ReadSocketStreamingStopResponseFut {
7999        fn _decode(
8000            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8001        ) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
8002            let _response = fidl::client::decode_transaction_body::<
8003                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
8004                fidl::encoding::DefaultFuchsiaResourceDialect,
8005                0x53e5cade5f4d22e7,
8006            >(_buf?)?
8007            .into_result::<SocketMarker>("read_socket_streaming_stop")?;
8008            Ok(_response.map(|x| x))
8009        }
8010        self.client.send_query_and_decode::<
8011            SocketReadSocketStreamingStopRequest,
8012            SocketReadSocketStreamingStopResult,
8013        >(
8014            (handle,),
8015            0x53e5cade5f4d22e7,
8016            fidl::encoding::DynamicFlags::FLEXIBLE,
8017            _decode,
8018        )
8019    }
8020}
8021
8022pub struct SocketEventStream {
8023    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8024}
8025
8026impl std::marker::Unpin for SocketEventStream {}
8027
8028impl futures::stream::FusedStream for SocketEventStream {
8029    fn is_terminated(&self) -> bool {
8030        self.event_receiver.is_terminated()
8031    }
8032}
8033
8034impl futures::Stream for SocketEventStream {
8035    type Item = Result<SocketEvent, fidl::Error>;
8036
8037    fn poll_next(
8038        mut self: std::pin::Pin<&mut Self>,
8039        cx: &mut std::task::Context<'_>,
8040    ) -> std::task::Poll<Option<Self::Item>> {
8041        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8042            &mut self.event_receiver,
8043            cx
8044        )?) {
8045            Some(buf) => std::task::Poll::Ready(Some(SocketEvent::decode(buf))),
8046            None => std::task::Poll::Ready(None),
8047        }
8048    }
8049}
8050
8051#[derive(Debug)]
8052pub enum SocketEvent {
8053    OnSocketStreamingData {
8054        handle: HandleId,
8055        socket_message: SocketMessage,
8056    },
8057    #[non_exhaustive]
8058    _UnknownEvent {
8059        /// Ordinal of the event that was sent.
8060        ordinal: u64,
8061    },
8062}
8063
8064impl SocketEvent {
8065    #[allow(irrefutable_let_patterns)]
8066    pub fn into_on_socket_streaming_data(self) -> Option<(HandleId, SocketMessage)> {
8067        if let SocketEvent::OnSocketStreamingData { handle, socket_message } = self {
8068            Some((handle, socket_message))
8069        } else {
8070            None
8071        }
8072    }
8073
8074    /// Decodes a message buffer as a [`SocketEvent`].
8075    fn decode(
8076        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8077    ) -> Result<SocketEvent, fidl::Error> {
8078        let (bytes, _handles) = buf.split_mut();
8079        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8080        debug_assert_eq!(tx_header.tx_id, 0);
8081        match tx_header.ordinal {
8082            0x998b5e66b3c80a2 => {
8083                let mut out = fidl::new_empty!(
8084                    SocketOnSocketStreamingDataRequest,
8085                    fidl::encoding::DefaultFuchsiaResourceDialect
8086                );
8087                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8088                Ok((SocketEvent::OnSocketStreamingData {
8089                    handle: out.handle,
8090                    socket_message: out.socket_message,
8091                }))
8092            }
8093            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8094                Ok(SocketEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8095            }
8096            _ => Err(fidl::Error::UnknownOrdinal {
8097                ordinal: tx_header.ordinal,
8098                protocol_name: <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8099            }),
8100        }
8101    }
8102}
8103
8104/// A Stream of incoming requests for fuchsia.fdomain/Socket.
8105pub struct SocketRequestStream {
8106    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8107    is_terminated: bool,
8108}
8109
8110impl std::marker::Unpin for SocketRequestStream {}
8111
8112impl futures::stream::FusedStream for SocketRequestStream {
8113    fn is_terminated(&self) -> bool {
8114        self.is_terminated
8115    }
8116}
8117
8118impl fidl::endpoints::RequestStream for SocketRequestStream {
8119    type Protocol = SocketMarker;
8120    type ControlHandle = SocketControlHandle;
8121
8122    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8123        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8124    }
8125
8126    fn control_handle(&self) -> Self::ControlHandle {
8127        SocketControlHandle { inner: self.inner.clone() }
8128    }
8129
8130    fn into_inner(
8131        self,
8132    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8133    {
8134        (self.inner, self.is_terminated)
8135    }
8136
8137    fn from_inner(
8138        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8139        is_terminated: bool,
8140    ) -> Self {
8141        Self { inner, is_terminated }
8142    }
8143}
8144
8145impl futures::Stream for SocketRequestStream {
8146    type Item = Result<SocketRequest, fidl::Error>;
8147
8148    fn poll_next(
8149        mut self: std::pin::Pin<&mut Self>,
8150        cx: &mut std::task::Context<'_>,
8151    ) -> std::task::Poll<Option<Self::Item>> {
8152        let this = &mut *self;
8153        if this.inner.check_shutdown(cx) {
8154            this.is_terminated = true;
8155            return std::task::Poll::Ready(None);
8156        }
8157        if this.is_terminated {
8158            panic!("polled SocketRequestStream after completion");
8159        }
8160        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8161            |bytes, handles| {
8162                match this.inner.channel().read_etc(cx, bytes, handles) {
8163                    std::task::Poll::Ready(Ok(())) => {}
8164                    std::task::Poll::Pending => return std::task::Poll::Pending,
8165                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8166                        this.is_terminated = true;
8167                        return std::task::Poll::Ready(None);
8168                    }
8169                    std::task::Poll::Ready(Err(e)) => {
8170                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8171                            e.into(),
8172                        ))));
8173                    }
8174                }
8175
8176                // A message has been received from the channel
8177                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8178
8179                std::task::Poll::Ready(Some(match header.ordinal {
8180                    0x200bf0ea21932de0 => {
8181                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8182                        let mut req = fidl::new_empty!(
8183                            SocketCreateSocketRequest,
8184                            fidl::encoding::DefaultFuchsiaResourceDialect
8185                        );
8186                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
8187                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
8188                        Ok(SocketRequest::CreateSocket {
8189                            options: req.options,
8190                            handles: req.handles,
8191
8192                            responder: SocketCreateSocketResponder {
8193                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8194                                tx_id: header.tx_id,
8195                            },
8196                        })
8197                    }
8198                    0x60d3c7ccb17f9bdf => {
8199                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8200                        let mut req = fidl::new_empty!(
8201                            SocketSetSocketDispositionRequest,
8202                            fidl::encoding::DefaultFuchsiaResourceDialect
8203                        );
8204                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
8205                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
8206                        Ok(SocketRequest::SetSocketDisposition {
8207                            handle: req.handle,
8208                            disposition: req.disposition,
8209                            disposition_peer: req.disposition_peer,
8210
8211                            responder: SocketSetSocketDispositionResponder {
8212                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8213                                tx_id: header.tx_id,
8214                            },
8215                        })
8216                    }
8217                    0x1da8aabec249c02e => {
8218                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8219                        let mut req = fidl::new_empty!(
8220                            SocketReadSocketRequest,
8221                            fidl::encoding::DefaultFuchsiaResourceDialect
8222                        );
8223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
8224                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
8225                        Ok(SocketRequest::ReadSocket {
8226                            handle: req.handle,
8227                            max_bytes: req.max_bytes,
8228
8229                            responder: SocketReadSocketResponder {
8230                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8231                                tx_id: header.tx_id,
8232                            },
8233                        })
8234                    }
8235                    0x5b541623cbbbf683 => {
8236                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8237                        let mut req = fidl::new_empty!(
8238                            SocketWriteSocketRequest,
8239                            fidl::encoding::DefaultFuchsiaResourceDialect
8240                        );
8241                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
8242                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
8243                        Ok(SocketRequest::WriteSocket {
8244                            handle: req.handle,
8245                            data: req.data,
8246
8247                            responder: SocketWriteSocketResponder {
8248                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8249                                tx_id: header.tx_id,
8250                            },
8251                        })
8252                    }
8253                    0x2a592748d5f33445 => {
8254                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8255                        let mut req = fidl::new_empty!(
8256                            SocketReadSocketStreamingStartRequest,
8257                            fidl::encoding::DefaultFuchsiaResourceDialect
8258                        );
8259                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
8260                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
8261                        Ok(SocketRequest::ReadSocketStreamingStart {
8262                            handle: req.handle,
8263
8264                            responder: SocketReadSocketStreamingStartResponder {
8265                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8266                                tx_id: header.tx_id,
8267                            },
8268                        })
8269                    }
8270                    0x53e5cade5f4d22e7 => {
8271                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8272                        let mut req = fidl::new_empty!(
8273                            SocketReadSocketStreamingStopRequest,
8274                            fidl::encoding::DefaultFuchsiaResourceDialect
8275                        );
8276                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
8277                        let control_handle = SocketControlHandle { inner: this.inner.clone() };
8278                        Ok(SocketRequest::ReadSocketStreamingStop {
8279                            handle: req.handle,
8280
8281                            responder: SocketReadSocketStreamingStopResponder {
8282                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8283                                tx_id: header.tx_id,
8284                            },
8285                        })
8286                    }
8287                    _ if header.tx_id == 0
8288                        && header
8289                            .dynamic_flags()
8290                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8291                    {
8292                        Ok(SocketRequest::_UnknownMethod {
8293                            ordinal: header.ordinal,
8294                            control_handle: SocketControlHandle { inner: this.inner.clone() },
8295                            method_type: fidl::MethodType::OneWay,
8296                        })
8297                    }
8298                    _ if header
8299                        .dynamic_flags()
8300                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8301                    {
8302                        this.inner.send_framework_err(
8303                            fidl::encoding::FrameworkErr::UnknownMethod,
8304                            header.tx_id,
8305                            header.ordinal,
8306                            header.dynamic_flags(),
8307                            (bytes, handles),
8308                        )?;
8309                        Ok(SocketRequest::_UnknownMethod {
8310                            ordinal: header.ordinal,
8311                            control_handle: SocketControlHandle { inner: this.inner.clone() },
8312                            method_type: fidl::MethodType::TwoWay,
8313                        })
8314                    }
8315                    _ => Err(fidl::Error::UnknownOrdinal {
8316                        ordinal: header.ordinal,
8317                        protocol_name:
8318                            <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8319                    }),
8320                }))
8321            },
8322        )
8323    }
8324}
8325
8326/// FDomain operations on sockets
8327#[derive(Debug)]
8328pub enum SocketRequest {
8329    /// Create a new socket in this FDomain and return both its ends.
8330    CreateSocket {
8331        options: SocketType,
8332        handles: [NewHandleId; 2],
8333        responder: SocketCreateSocketResponder,
8334    },
8335    /// Set the disposition of a given socket.
8336    SetSocketDisposition {
8337        handle: HandleId,
8338        disposition: SocketDisposition,
8339        disposition_peer: SocketDisposition,
8340        responder: SocketSetSocketDispositionResponder,
8341    },
8342    /// Read data from a socket. This method will fail if the socket is currently being read
8343    /// asynchronously.
8344    ReadSocket { handle: HandleId, max_bytes: u64, responder: SocketReadSocketResponder },
8345    /// Write to a socket. This will attempt to write all the data passed, and
8346    /// will block and retry whenever it is safe (e.g. it should never return
8347    /// SHOULD_WAIT). The `WriteSocketError` contains a `wrote` parameter to
8348    /// indicate if some bytes were written successfully before the failure
8349    /// occurred.
8350    WriteSocket { handle: HandleId, data: Vec<u8>, responder: SocketWriteSocketResponder },
8351    /// Starts reading from the given socket. Data is returned via the `SocketStreamingData` event. That
8352    /// event will occur repeatedly until `ReadSocketStreamingStop` is called for the same handle or the
8353    /// event indicates the handle is closed.
8354    ReadSocketStreamingStart {
8355        handle: HandleId,
8356        responder: SocketReadSocketStreamingStartResponder,
8357    },
8358    /// Stop asynchronous reading from the given socket.
8359    ReadSocketStreamingStop { handle: HandleId, responder: SocketReadSocketStreamingStopResponder },
8360    /// An interaction was received which does not match any known method.
8361    #[non_exhaustive]
8362    _UnknownMethod {
8363        /// Ordinal of the method that was called.
8364        ordinal: u64,
8365        control_handle: SocketControlHandle,
8366        method_type: fidl::MethodType,
8367    },
8368}
8369
8370impl SocketRequest {
8371    #[allow(irrefutable_let_patterns)]
8372    pub fn into_create_socket(
8373        self,
8374    ) -> Option<(SocketType, [NewHandleId; 2], SocketCreateSocketResponder)> {
8375        if let SocketRequest::CreateSocket { options, handles, responder } = self {
8376            Some((options, handles, responder))
8377        } else {
8378            None
8379        }
8380    }
8381
8382    #[allow(irrefutable_let_patterns)]
8383    pub fn into_set_socket_disposition(
8384        self,
8385    ) -> Option<(HandleId, SocketDisposition, SocketDisposition, SocketSetSocketDispositionResponder)>
8386    {
8387        if let SocketRequest::SetSocketDisposition {
8388            handle,
8389            disposition,
8390            disposition_peer,
8391            responder,
8392        } = self
8393        {
8394            Some((handle, disposition, disposition_peer, responder))
8395        } else {
8396            None
8397        }
8398    }
8399
8400    #[allow(irrefutable_let_patterns)]
8401    pub fn into_read_socket(self) -> Option<(HandleId, u64, SocketReadSocketResponder)> {
8402        if let SocketRequest::ReadSocket { handle, max_bytes, responder } = self {
8403            Some((handle, max_bytes, responder))
8404        } else {
8405            None
8406        }
8407    }
8408
8409    #[allow(irrefutable_let_patterns)]
8410    pub fn into_write_socket(self) -> Option<(HandleId, Vec<u8>, SocketWriteSocketResponder)> {
8411        if let SocketRequest::WriteSocket { handle, data, responder } = self {
8412            Some((handle, data, responder))
8413        } else {
8414            None
8415        }
8416    }
8417
8418    #[allow(irrefutable_let_patterns)]
8419    pub fn into_read_socket_streaming_start(
8420        self,
8421    ) -> Option<(HandleId, SocketReadSocketStreamingStartResponder)> {
8422        if let SocketRequest::ReadSocketStreamingStart { handle, responder } = self {
8423            Some((handle, responder))
8424        } else {
8425            None
8426        }
8427    }
8428
8429    #[allow(irrefutable_let_patterns)]
8430    pub fn into_read_socket_streaming_stop(
8431        self,
8432    ) -> Option<(HandleId, SocketReadSocketStreamingStopResponder)> {
8433        if let SocketRequest::ReadSocketStreamingStop { handle, responder } = self {
8434            Some((handle, responder))
8435        } else {
8436            None
8437        }
8438    }
8439
8440    /// Name of the method defined in FIDL
8441    pub fn method_name(&self) -> &'static str {
8442        match *self {
8443            SocketRequest::CreateSocket { .. } => "create_socket",
8444            SocketRequest::SetSocketDisposition { .. } => "set_socket_disposition",
8445            SocketRequest::ReadSocket { .. } => "read_socket",
8446            SocketRequest::WriteSocket { .. } => "write_socket",
8447            SocketRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
8448            SocketRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
8449            SocketRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
8450                "unknown one-way method"
8451            }
8452            SocketRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
8453                "unknown two-way method"
8454            }
8455        }
8456    }
8457}
8458
8459#[derive(Debug, Clone)]
8460pub struct SocketControlHandle {
8461    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8462}
8463
8464impl SocketControlHandle {
8465    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8466        self.inner.shutdown_with_epitaph(status.into())
8467    }
8468}
8469
8470impl fidl::endpoints::ControlHandle for SocketControlHandle {
8471    fn shutdown(&self) {
8472        self.inner.shutdown()
8473    }
8474
8475    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8476        self.inner.shutdown_with_epitaph(status)
8477    }
8478
8479    fn is_closed(&self) -> bool {
8480        self.inner.channel().is_closed()
8481    }
8482    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8483        self.inner.channel().on_closed()
8484    }
8485
8486    #[cfg(target_os = "fuchsia")]
8487    fn signal_peer(
8488        &self,
8489        clear_mask: zx::Signals,
8490        set_mask: zx::Signals,
8491    ) -> Result<(), zx_status::Status> {
8492        use fidl::Peered;
8493        self.inner.channel().signal_peer(clear_mask, set_mask)
8494    }
8495}
8496
8497impl SocketControlHandle {
8498    pub fn send_on_socket_streaming_data(
8499        &self,
8500        mut handle: &HandleId,
8501        mut socket_message: &SocketMessage,
8502    ) -> Result<(), fidl::Error> {
8503        self.inner.send::<SocketOnSocketStreamingDataRequest>(
8504            (handle, socket_message),
8505            0,
8506            0x998b5e66b3c80a2,
8507            fidl::encoding::DynamicFlags::FLEXIBLE,
8508        )
8509    }
8510}
8511
8512#[must_use = "FIDL methods require a response to be sent"]
8513#[derive(Debug)]
8514pub struct SocketCreateSocketResponder {
8515    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
8516    tx_id: u32,
8517}
8518
8519/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
8520/// if the responder is dropped without sending a response, so that the client
8521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8522impl std::ops::Drop for SocketCreateSocketResponder {
8523    fn drop(&mut self) {
8524        self.control_handle.shutdown();
8525        // Safety: drops once, never accessed again
8526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8527    }
8528}
8529
8530impl fidl::endpoints::Responder for SocketCreateSocketResponder {
8531    type ControlHandle = SocketControlHandle;
8532
8533    fn control_handle(&self) -> &SocketControlHandle {
8534        &self.control_handle
8535    }
8536
8537    fn drop_without_shutdown(mut self) {
8538        // Safety: drops once, never accessed again due to mem::forget
8539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8540        // Prevent Drop from running (which would shut down the channel)
8541        std::mem::forget(self);
8542    }
8543}
8544
8545impl SocketCreateSocketResponder {
8546    /// Sends a response to the FIDL transaction.
8547    ///
8548    /// Sets the channel to shutdown if an error occurs.
8549    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8550        let _result = self.send_raw(result);
8551        if _result.is_err() {
8552            self.control_handle.shutdown();
8553        }
8554        self.drop_without_shutdown();
8555        _result
8556    }
8557
8558    /// Similar to "send" but does not shutdown the channel if an error occurs.
8559    pub fn send_no_shutdown_on_err(
8560        self,
8561        mut result: Result<(), &Error>,
8562    ) -> Result<(), fidl::Error> {
8563        let _result = self.send_raw(result);
8564        self.drop_without_shutdown();
8565        _result
8566    }
8567
8568    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8569        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8570            fidl::encoding::EmptyStruct,
8571            Error,
8572        >>(
8573            fidl::encoding::FlexibleResult::new(result),
8574            self.tx_id,
8575            0x200bf0ea21932de0,
8576            fidl::encoding::DynamicFlags::FLEXIBLE,
8577        )
8578    }
8579}
8580
8581#[must_use = "FIDL methods require a response to be sent"]
8582#[derive(Debug)]
8583pub struct SocketSetSocketDispositionResponder {
8584    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
8585    tx_id: u32,
8586}
8587
8588/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
8589/// if the responder is dropped without sending a response, so that the client
8590/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8591impl std::ops::Drop for SocketSetSocketDispositionResponder {
8592    fn drop(&mut self) {
8593        self.control_handle.shutdown();
8594        // Safety: drops once, never accessed again
8595        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8596    }
8597}
8598
8599impl fidl::endpoints::Responder for SocketSetSocketDispositionResponder {
8600    type ControlHandle = SocketControlHandle;
8601
8602    fn control_handle(&self) -> &SocketControlHandle {
8603        &self.control_handle
8604    }
8605
8606    fn drop_without_shutdown(mut self) {
8607        // Safety: drops once, never accessed again due to mem::forget
8608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8609        // Prevent Drop from running (which would shut down the channel)
8610        std::mem::forget(self);
8611    }
8612}
8613
8614impl SocketSetSocketDispositionResponder {
8615    /// Sends a response to the FIDL transaction.
8616    ///
8617    /// Sets the channel to shutdown if an error occurs.
8618    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8619        let _result = self.send_raw(result);
8620        if _result.is_err() {
8621            self.control_handle.shutdown();
8622        }
8623        self.drop_without_shutdown();
8624        _result
8625    }
8626
8627    /// Similar to "send" but does not shutdown the channel if an error occurs.
8628    pub fn send_no_shutdown_on_err(
8629        self,
8630        mut result: Result<(), &Error>,
8631    ) -> Result<(), fidl::Error> {
8632        let _result = self.send_raw(result);
8633        self.drop_without_shutdown();
8634        _result
8635    }
8636
8637    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8638        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8639            fidl::encoding::EmptyStruct,
8640            Error,
8641        >>(
8642            fidl::encoding::FlexibleResult::new(result),
8643            self.tx_id,
8644            0x60d3c7ccb17f9bdf,
8645            fidl::encoding::DynamicFlags::FLEXIBLE,
8646        )
8647    }
8648}
8649
8650#[must_use = "FIDL methods require a response to be sent"]
8651#[derive(Debug)]
8652pub struct SocketReadSocketResponder {
8653    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
8654    tx_id: u32,
8655}
8656
8657/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
8658/// if the responder is dropped without sending a response, so that the client
8659/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8660impl std::ops::Drop for SocketReadSocketResponder {
8661    fn drop(&mut self) {
8662        self.control_handle.shutdown();
8663        // Safety: drops once, never accessed again
8664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8665    }
8666}
8667
8668impl fidl::endpoints::Responder for SocketReadSocketResponder {
8669    type ControlHandle = SocketControlHandle;
8670
8671    fn control_handle(&self) -> &SocketControlHandle {
8672        &self.control_handle
8673    }
8674
8675    fn drop_without_shutdown(mut self) {
8676        // Safety: drops once, never accessed again due to mem::forget
8677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8678        // Prevent Drop from running (which would shut down the channel)
8679        std::mem::forget(self);
8680    }
8681}
8682
8683impl SocketReadSocketResponder {
8684    /// Sends a response to the FIDL transaction.
8685    ///
8686    /// Sets the channel to shutdown if an error occurs.
8687    pub fn send(self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
8688        let _result = self.send_raw(result);
8689        if _result.is_err() {
8690            self.control_handle.shutdown();
8691        }
8692        self.drop_without_shutdown();
8693        _result
8694    }
8695
8696    /// Similar to "send" but does not shutdown the channel if an error occurs.
8697    pub fn send_no_shutdown_on_err(
8698        self,
8699        mut result: Result<(&[u8], bool), &Error>,
8700    ) -> Result<(), fidl::Error> {
8701        let _result = self.send_raw(result);
8702        self.drop_without_shutdown();
8703        _result
8704    }
8705
8706    fn send_raw(&self, mut result: Result<(&[u8], bool), &Error>) -> Result<(), fidl::Error> {
8707        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<SocketData, Error>>(
8708            fidl::encoding::FlexibleResult::new(result),
8709            self.tx_id,
8710            0x1da8aabec249c02e,
8711            fidl::encoding::DynamicFlags::FLEXIBLE,
8712        )
8713    }
8714}
8715
8716#[must_use = "FIDL methods require a response to be sent"]
8717#[derive(Debug)]
8718pub struct SocketWriteSocketResponder {
8719    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
8720    tx_id: u32,
8721}
8722
8723/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
8724/// if the responder is dropped without sending a response, so that the client
8725/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8726impl std::ops::Drop for SocketWriteSocketResponder {
8727    fn drop(&mut self) {
8728        self.control_handle.shutdown();
8729        // Safety: drops once, never accessed again
8730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8731    }
8732}
8733
8734impl fidl::endpoints::Responder for SocketWriteSocketResponder {
8735    type ControlHandle = SocketControlHandle;
8736
8737    fn control_handle(&self) -> &SocketControlHandle {
8738        &self.control_handle
8739    }
8740
8741    fn drop_without_shutdown(mut self) {
8742        // Safety: drops once, never accessed again due to mem::forget
8743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8744        // Prevent Drop from running (which would shut down the channel)
8745        std::mem::forget(self);
8746    }
8747}
8748
8749impl SocketWriteSocketResponder {
8750    /// Sends a response to the FIDL transaction.
8751    ///
8752    /// Sets the channel to shutdown if an error occurs.
8753    pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
8754        let _result = self.send_raw(result);
8755        if _result.is_err() {
8756            self.control_handle.shutdown();
8757        }
8758        self.drop_without_shutdown();
8759        _result
8760    }
8761
8762    /// Similar to "send" but does not shutdown the channel if an error occurs.
8763    pub fn send_no_shutdown_on_err(
8764        self,
8765        mut result: Result<u64, &WriteSocketError>,
8766    ) -> Result<(), fidl::Error> {
8767        let _result = self.send_raw(result);
8768        self.drop_without_shutdown();
8769        _result
8770    }
8771
8772    fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
8773        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8774            SocketWriteSocketResponse,
8775            WriteSocketError,
8776        >>(
8777            fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
8778            self.tx_id,
8779            0x5b541623cbbbf683,
8780            fidl::encoding::DynamicFlags::FLEXIBLE,
8781        )
8782    }
8783}
8784
8785#[must_use = "FIDL methods require a response to be sent"]
8786#[derive(Debug)]
8787pub struct SocketReadSocketStreamingStartResponder {
8788    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
8789    tx_id: u32,
8790}
8791
8792/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
8793/// if the responder is dropped without sending a response, so that the client
8794/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8795impl std::ops::Drop for SocketReadSocketStreamingStartResponder {
8796    fn drop(&mut self) {
8797        self.control_handle.shutdown();
8798        // Safety: drops once, never accessed again
8799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8800    }
8801}
8802
8803impl fidl::endpoints::Responder for SocketReadSocketStreamingStartResponder {
8804    type ControlHandle = SocketControlHandle;
8805
8806    fn control_handle(&self) -> &SocketControlHandle {
8807        &self.control_handle
8808    }
8809
8810    fn drop_without_shutdown(mut self) {
8811        // Safety: drops once, never accessed again due to mem::forget
8812        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8813        // Prevent Drop from running (which would shut down the channel)
8814        std::mem::forget(self);
8815    }
8816}
8817
8818impl SocketReadSocketStreamingStartResponder {
8819    /// Sends a response to the FIDL transaction.
8820    ///
8821    /// Sets the channel to shutdown if an error occurs.
8822    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8823        let _result = self.send_raw(result);
8824        if _result.is_err() {
8825            self.control_handle.shutdown();
8826        }
8827        self.drop_without_shutdown();
8828        _result
8829    }
8830
8831    /// Similar to "send" but does not shutdown the channel if an error occurs.
8832    pub fn send_no_shutdown_on_err(
8833        self,
8834        mut result: Result<(), &Error>,
8835    ) -> Result<(), fidl::Error> {
8836        let _result = self.send_raw(result);
8837        self.drop_without_shutdown();
8838        _result
8839    }
8840
8841    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8842        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8843            fidl::encoding::EmptyStruct,
8844            Error,
8845        >>(
8846            fidl::encoding::FlexibleResult::new(result),
8847            self.tx_id,
8848            0x2a592748d5f33445,
8849            fidl::encoding::DynamicFlags::FLEXIBLE,
8850        )
8851    }
8852}
8853
8854#[must_use = "FIDL methods require a response to be sent"]
8855#[derive(Debug)]
8856pub struct SocketReadSocketStreamingStopResponder {
8857    control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
8858    tx_id: u32,
8859}
8860
8861/// Set the the channel to be shutdown (see [`SocketControlHandle::shutdown`])
8862/// if the responder is dropped without sending a response, so that the client
8863/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8864impl std::ops::Drop for SocketReadSocketStreamingStopResponder {
8865    fn drop(&mut self) {
8866        self.control_handle.shutdown();
8867        // Safety: drops once, never accessed again
8868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8869    }
8870}
8871
8872impl fidl::endpoints::Responder for SocketReadSocketStreamingStopResponder {
8873    type ControlHandle = SocketControlHandle;
8874
8875    fn control_handle(&self) -> &SocketControlHandle {
8876        &self.control_handle
8877    }
8878
8879    fn drop_without_shutdown(mut self) {
8880        // Safety: drops once, never accessed again due to mem::forget
8881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8882        // Prevent Drop from running (which would shut down the channel)
8883        std::mem::forget(self);
8884    }
8885}
8886
8887impl SocketReadSocketStreamingStopResponder {
8888    /// Sends a response to the FIDL transaction.
8889    ///
8890    /// Sets the channel to shutdown if an error occurs.
8891    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8892        let _result = self.send_raw(result);
8893        if _result.is_err() {
8894            self.control_handle.shutdown();
8895        }
8896        self.drop_without_shutdown();
8897        _result
8898    }
8899
8900    /// Similar to "send" but does not shutdown the channel if an error occurs.
8901    pub fn send_no_shutdown_on_err(
8902        self,
8903        mut result: Result<(), &Error>,
8904    ) -> Result<(), fidl::Error> {
8905        let _result = self.send_raw(result);
8906        self.drop_without_shutdown();
8907        _result
8908    }
8909
8910    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
8911        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8912            fidl::encoding::EmptyStruct,
8913            Error,
8914        >>(
8915            fidl::encoding::FlexibleResult::new(result),
8916            self.tx_id,
8917            0x53e5cade5f4d22e7,
8918            fidl::encoding::DynamicFlags::FLEXIBLE,
8919        )
8920    }
8921}
8922
8923#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8924pub struct VmoMarker;
8925
8926impl fidl::endpoints::ProtocolMarker for VmoMarker {
8927    type Proxy = VmoProxy;
8928    type RequestStream = VmoRequestStream;
8929    #[cfg(target_os = "fuchsia")]
8930    type SynchronousProxy = VmoSynchronousProxy;
8931
8932    const DEBUG_NAME: &'static str = "(anonymous) Vmo";
8933}
8934pub type VmoCreateVmoResult = Result<(), Error>;
8935pub type VmoReadVmoResult = Result<Vec<u8>, Error>;
8936pub type VmoWriteVmoResult = Result<(), Error>;
8937pub type VmoGetVmoSizeResult = Result<u64, Error>;
8938pub type VmoSetVmoSizeResult = Result<(), Error>;
8939pub type VmoGetVmoStreamSizeResult = Result<u64, Error>;
8940pub type VmoSetVmoStreamSizeResult = Result<(), Error>;
8941
8942pub trait VmoProxyInterface: Send + Sync {
8943    type CreateVmoResponseFut: std::future::Future<Output = Result<VmoCreateVmoResult, fidl::Error>>
8944        + Send;
8945    fn r#create_vmo(
8946        &self,
8947        size: u64,
8948        options: VmoOptions,
8949        handle: &NewHandleId,
8950    ) -> Self::CreateVmoResponseFut;
8951    type ReadVmoResponseFut: std::future::Future<Output = Result<VmoReadVmoResult, fidl::Error>>
8952        + Send;
8953    fn r#read_vmo(&self, handle: &HandleId, offset: u64, size: u64) -> Self::ReadVmoResponseFut;
8954    type WriteVmoResponseFut: std::future::Future<Output = Result<VmoWriteVmoResult, fidl::Error>>
8955        + Send;
8956    fn r#write_vmo(&self, handle: &HandleId, offset: u64, data: &[u8])
8957    -> Self::WriteVmoResponseFut;
8958    type GetVmoSizeResponseFut: std::future::Future<Output = Result<VmoGetVmoSizeResult, fidl::Error>>
8959        + Send;
8960    fn r#get_vmo_size(&self, handle: &HandleId) -> Self::GetVmoSizeResponseFut;
8961    type SetVmoSizeResponseFut: std::future::Future<Output = Result<VmoSetVmoSizeResult, fidl::Error>>
8962        + Send;
8963    fn r#set_vmo_size(&self, handle: &HandleId, size: u64) -> Self::SetVmoSizeResponseFut;
8964    type GetVmoStreamSizeResponseFut: std::future::Future<Output = Result<VmoGetVmoStreamSizeResult, fidl::Error>>
8965        + Send;
8966    fn r#get_vmo_stream_size(&self, handle: &HandleId) -> Self::GetVmoStreamSizeResponseFut;
8967    type SetVmoStreamSizeResponseFut: std::future::Future<Output = Result<VmoSetVmoStreamSizeResult, fidl::Error>>
8968        + Send;
8969    fn r#set_vmo_stream_size(
8970        &self,
8971        handle: &HandleId,
8972        size: u64,
8973    ) -> Self::SetVmoStreamSizeResponseFut;
8974}
8975#[derive(Debug)]
8976#[cfg(target_os = "fuchsia")]
8977pub struct VmoSynchronousProxy {
8978    client: fidl::client::sync::Client,
8979}
8980
8981#[cfg(target_os = "fuchsia")]
8982impl fidl::endpoints::SynchronousProxy for VmoSynchronousProxy {
8983    type Proxy = VmoProxy;
8984    type Protocol = VmoMarker;
8985
8986    fn from_channel(inner: fidl::Channel) -> Self {
8987        Self::new(inner)
8988    }
8989
8990    fn into_channel(self) -> fidl::Channel {
8991        self.client.into_channel()
8992    }
8993
8994    fn as_channel(&self) -> &fidl::Channel {
8995        self.client.as_channel()
8996    }
8997}
8998
8999#[cfg(target_os = "fuchsia")]
9000impl VmoSynchronousProxy {
9001    pub fn new(channel: fidl::Channel) -> Self {
9002        Self { client: fidl::client::sync::Client::new(channel) }
9003    }
9004
9005    pub fn into_channel(self) -> fidl::Channel {
9006        self.client.into_channel()
9007    }
9008
9009    /// Waits until an event arrives and returns it. It is safe for other
9010    /// threads to make concurrent requests while waiting for an event.
9011    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<VmoEvent, fidl::Error> {
9012        VmoEvent::decode(self.client.wait_for_event::<VmoMarker>(deadline)?)
9013    }
9014
9015    /// Create a new VMO in this FDomain.
9016    pub fn r#create_vmo(
9017        &self,
9018        mut size: u64,
9019        mut options: VmoOptions,
9020        mut handle: &NewHandleId,
9021        ___deadline: zx::MonotonicInstant,
9022    ) -> Result<VmoCreateVmoResult, fidl::Error> {
9023        let _response = self.client.send_query::<
9024            VmoCreateVmoRequest,
9025            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9026            VmoMarker,
9027        >(
9028            (size, options, handle,),
9029            0x392dcaac1ddd8868,
9030            fidl::encoding::DynamicFlags::FLEXIBLE,
9031            ___deadline,
9032        )?
9033        .into_result::<VmoMarker>("create_vmo")?;
9034        Ok(_response.map(|x| x))
9035    }
9036
9037    /// Read data from a VMO.
9038    pub fn r#read_vmo(
9039        &self,
9040        mut handle: &HandleId,
9041        mut offset: u64,
9042        mut size: u64,
9043        ___deadline: zx::MonotonicInstant,
9044    ) -> Result<VmoReadVmoResult, fidl::Error> {
9045        let _response = self.client.send_query::<
9046            VmoReadVmoRequest,
9047            fidl::encoding::FlexibleResultType<VmoReadVmoResponse, Error>,
9048            VmoMarker,
9049        >(
9050            (handle, offset, size,),
9051            0x62690ec76b0f2fe6,
9052            fidl::encoding::DynamicFlags::FLEXIBLE,
9053            ___deadline,
9054        )?
9055        .into_result::<VmoMarker>("read_vmo")?;
9056        Ok(_response.map(|x| x.data))
9057    }
9058
9059    /// Write data to a VMO.
9060    pub fn r#write_vmo(
9061        &self,
9062        mut handle: &HandleId,
9063        mut offset: u64,
9064        mut data: &[u8],
9065        ___deadline: zx::MonotonicInstant,
9066    ) -> Result<VmoWriteVmoResult, fidl::Error> {
9067        let _response = self.client.send_query::<
9068            VmoWriteVmoRequest,
9069            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9070            VmoMarker,
9071        >(
9072            (handle, offset, data,),
9073            0x2f6ac299380e486e,
9074            fidl::encoding::DynamicFlags::FLEXIBLE,
9075            ___deadline,
9076        )?
9077        .into_result::<VmoMarker>("write_vmo")?;
9078        Ok(_response.map(|x| x))
9079    }
9080
9081    /// Get the size of a VMO in bytes.
9082    pub fn r#get_vmo_size(
9083        &self,
9084        mut handle: &HandleId,
9085        ___deadline: zx::MonotonicInstant,
9086    ) -> Result<VmoGetVmoSizeResult, fidl::Error> {
9087        let _response = self.client.send_query::<
9088            VmoGetVmoSizeRequest,
9089            fidl::encoding::FlexibleResultType<VmoGetVmoSizeResponse, Error>,
9090            VmoMarker,
9091        >(
9092            (handle,),
9093            0x717f9f3a9ff6906e,
9094            fidl::encoding::DynamicFlags::FLEXIBLE,
9095            ___deadline,
9096        )?
9097        .into_result::<VmoMarker>("get_vmo_size")?;
9098        Ok(_response.map(|x| x.size))
9099    }
9100
9101    /// Set the size of a VMO in bytes.
9102    pub fn r#set_vmo_size(
9103        &self,
9104        mut handle: &HandleId,
9105        mut size: u64,
9106        ___deadline: zx::MonotonicInstant,
9107    ) -> Result<VmoSetVmoSizeResult, fidl::Error> {
9108        let _response = self.client.send_query::<
9109            VmoSetVmoSizeRequest,
9110            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9111            VmoMarker,
9112        >(
9113            (handle, size,),
9114            0x7f6f77ac37afe38b,
9115            fidl::encoding::DynamicFlags::FLEXIBLE,
9116            ___deadline,
9117        )?
9118        .into_result::<VmoMarker>("set_vmo_size")?;
9119        Ok(_response.map(|x| x))
9120    }
9121
9122    /// Get the stream size of a VMO in bytes.
9123    pub fn r#get_vmo_stream_size(
9124        &self,
9125        mut handle: &HandleId,
9126        ___deadline: zx::MonotonicInstant,
9127    ) -> Result<VmoGetVmoStreamSizeResult, fidl::Error> {
9128        let _response = self.client.send_query::<
9129            VmoGetVmoStreamSizeRequest,
9130            fidl::encoding::FlexibleResultType<VmoGetVmoStreamSizeResponse, Error>,
9131            VmoMarker,
9132        >(
9133            (handle,),
9134            0x54020f4280cb038,
9135            fidl::encoding::DynamicFlags::FLEXIBLE,
9136            ___deadline,
9137        )?
9138        .into_result::<VmoMarker>("get_vmo_stream_size")?;
9139        Ok(_response.map(|x| x.size))
9140    }
9141
9142    /// Set the stream size of a VMO in bytes.
9143    pub fn r#set_vmo_stream_size(
9144        &self,
9145        mut handle: &HandleId,
9146        mut size: u64,
9147        ___deadline: zx::MonotonicInstant,
9148    ) -> Result<VmoSetVmoStreamSizeResult, fidl::Error> {
9149        let _response = self.client.send_query::<
9150            VmoSetVmoStreamSizeRequest,
9151            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9152            VmoMarker,
9153        >(
9154            (handle, size,),
9155            0x3bdb108fb18002eb,
9156            fidl::encoding::DynamicFlags::FLEXIBLE,
9157            ___deadline,
9158        )?
9159        .into_result::<VmoMarker>("set_vmo_stream_size")?;
9160        Ok(_response.map(|x| x))
9161    }
9162}
9163
9164#[cfg(target_os = "fuchsia")]
9165impl From<VmoSynchronousProxy> for zx::NullableHandle {
9166    fn from(value: VmoSynchronousProxy) -> Self {
9167        value.into_channel().into()
9168    }
9169}
9170
9171#[cfg(target_os = "fuchsia")]
9172impl From<fidl::Channel> for VmoSynchronousProxy {
9173    fn from(value: fidl::Channel) -> Self {
9174        Self::new(value)
9175    }
9176}
9177
9178#[cfg(target_os = "fuchsia")]
9179impl fidl::endpoints::FromClient for VmoSynchronousProxy {
9180    type Protocol = VmoMarker;
9181
9182    fn from_client(value: fidl::endpoints::ClientEnd<VmoMarker>) -> Self {
9183        Self::new(value.into_channel())
9184    }
9185}
9186
9187#[derive(Debug, Clone)]
9188pub struct VmoProxy {
9189    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9190}
9191
9192impl fidl::endpoints::Proxy for VmoProxy {
9193    type Protocol = VmoMarker;
9194
9195    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9196        Self::new(inner)
9197    }
9198
9199    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9200        self.client.into_channel().map_err(|client| Self { client })
9201    }
9202
9203    fn as_channel(&self) -> &::fidl::AsyncChannel {
9204        self.client.as_channel()
9205    }
9206}
9207
9208impl VmoProxy {
9209    /// Create a new Proxy for fuchsia.fdomain/Vmo.
9210    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9211        let protocol_name = <VmoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9212        Self { client: fidl::client::Client::new(channel, protocol_name) }
9213    }
9214
9215    /// Get a Stream of events from the remote end of the protocol.
9216    ///
9217    /// # Panics
9218    ///
9219    /// Panics if the event stream was already taken.
9220    pub fn take_event_stream(&self) -> VmoEventStream {
9221        VmoEventStream { event_receiver: self.client.take_event_receiver() }
9222    }
9223
9224    /// Create a new VMO in this FDomain.
9225    pub fn r#create_vmo(
9226        &self,
9227        mut size: u64,
9228        mut options: VmoOptions,
9229        mut handle: &NewHandleId,
9230    ) -> fidl::client::QueryResponseFut<
9231        VmoCreateVmoResult,
9232        fidl::encoding::DefaultFuchsiaResourceDialect,
9233    > {
9234        VmoProxyInterface::r#create_vmo(self, size, options, handle)
9235    }
9236
9237    /// Read data from a VMO.
9238    pub fn r#read_vmo(
9239        &self,
9240        mut handle: &HandleId,
9241        mut offset: u64,
9242        mut size: u64,
9243    ) -> fidl::client::QueryResponseFut<
9244        VmoReadVmoResult,
9245        fidl::encoding::DefaultFuchsiaResourceDialect,
9246    > {
9247        VmoProxyInterface::r#read_vmo(self, handle, offset, size)
9248    }
9249
9250    /// Write data to a VMO.
9251    pub fn r#write_vmo(
9252        &self,
9253        mut handle: &HandleId,
9254        mut offset: u64,
9255        mut data: &[u8],
9256    ) -> fidl::client::QueryResponseFut<
9257        VmoWriteVmoResult,
9258        fidl::encoding::DefaultFuchsiaResourceDialect,
9259    > {
9260        VmoProxyInterface::r#write_vmo(self, handle, offset, data)
9261    }
9262
9263    /// Get the size of a VMO in bytes.
9264    pub fn r#get_vmo_size(
9265        &self,
9266        mut handle: &HandleId,
9267    ) -> fidl::client::QueryResponseFut<
9268        VmoGetVmoSizeResult,
9269        fidl::encoding::DefaultFuchsiaResourceDialect,
9270    > {
9271        VmoProxyInterface::r#get_vmo_size(self, handle)
9272    }
9273
9274    /// Set the size of a VMO in bytes.
9275    pub fn r#set_vmo_size(
9276        &self,
9277        mut handle: &HandleId,
9278        mut size: u64,
9279    ) -> fidl::client::QueryResponseFut<
9280        VmoSetVmoSizeResult,
9281        fidl::encoding::DefaultFuchsiaResourceDialect,
9282    > {
9283        VmoProxyInterface::r#set_vmo_size(self, handle, size)
9284    }
9285
9286    /// Get the stream size of a VMO in bytes.
9287    pub fn r#get_vmo_stream_size(
9288        &self,
9289        mut handle: &HandleId,
9290    ) -> fidl::client::QueryResponseFut<
9291        VmoGetVmoStreamSizeResult,
9292        fidl::encoding::DefaultFuchsiaResourceDialect,
9293    > {
9294        VmoProxyInterface::r#get_vmo_stream_size(self, handle)
9295    }
9296
9297    /// Set the stream size of a VMO in bytes.
9298    pub fn r#set_vmo_stream_size(
9299        &self,
9300        mut handle: &HandleId,
9301        mut size: u64,
9302    ) -> fidl::client::QueryResponseFut<
9303        VmoSetVmoStreamSizeResult,
9304        fidl::encoding::DefaultFuchsiaResourceDialect,
9305    > {
9306        VmoProxyInterface::r#set_vmo_stream_size(self, handle, size)
9307    }
9308}
9309
9310impl VmoProxyInterface for VmoProxy {
9311    type CreateVmoResponseFut = fidl::client::QueryResponseFut<
9312        VmoCreateVmoResult,
9313        fidl::encoding::DefaultFuchsiaResourceDialect,
9314    >;
9315    fn r#create_vmo(
9316        &self,
9317        mut size: u64,
9318        mut options: VmoOptions,
9319        mut handle: &NewHandleId,
9320    ) -> Self::CreateVmoResponseFut {
9321        fn _decode(
9322            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9323        ) -> Result<VmoCreateVmoResult, fidl::Error> {
9324            let _response = fidl::client::decode_transaction_body::<
9325                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9326                fidl::encoding::DefaultFuchsiaResourceDialect,
9327                0x392dcaac1ddd8868,
9328            >(_buf?)?
9329            .into_result::<VmoMarker>("create_vmo")?;
9330            Ok(_response.map(|x| x))
9331        }
9332        self.client.send_query_and_decode::<VmoCreateVmoRequest, VmoCreateVmoResult>(
9333            (size, options, handle),
9334            0x392dcaac1ddd8868,
9335            fidl::encoding::DynamicFlags::FLEXIBLE,
9336            _decode,
9337        )
9338    }
9339
9340    type ReadVmoResponseFut = fidl::client::QueryResponseFut<
9341        VmoReadVmoResult,
9342        fidl::encoding::DefaultFuchsiaResourceDialect,
9343    >;
9344    fn r#read_vmo(
9345        &self,
9346        mut handle: &HandleId,
9347        mut offset: u64,
9348        mut size: u64,
9349    ) -> Self::ReadVmoResponseFut {
9350        fn _decode(
9351            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9352        ) -> Result<VmoReadVmoResult, fidl::Error> {
9353            let _response = fidl::client::decode_transaction_body::<
9354                fidl::encoding::FlexibleResultType<VmoReadVmoResponse, Error>,
9355                fidl::encoding::DefaultFuchsiaResourceDialect,
9356                0x62690ec76b0f2fe6,
9357            >(_buf?)?
9358            .into_result::<VmoMarker>("read_vmo")?;
9359            Ok(_response.map(|x| x.data))
9360        }
9361        self.client.send_query_and_decode::<VmoReadVmoRequest, VmoReadVmoResult>(
9362            (handle, offset, size),
9363            0x62690ec76b0f2fe6,
9364            fidl::encoding::DynamicFlags::FLEXIBLE,
9365            _decode,
9366        )
9367    }
9368
9369    type WriteVmoResponseFut = fidl::client::QueryResponseFut<
9370        VmoWriteVmoResult,
9371        fidl::encoding::DefaultFuchsiaResourceDialect,
9372    >;
9373    fn r#write_vmo(
9374        &self,
9375        mut handle: &HandleId,
9376        mut offset: u64,
9377        mut data: &[u8],
9378    ) -> Self::WriteVmoResponseFut {
9379        fn _decode(
9380            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9381        ) -> Result<VmoWriteVmoResult, fidl::Error> {
9382            let _response = fidl::client::decode_transaction_body::<
9383                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9384                fidl::encoding::DefaultFuchsiaResourceDialect,
9385                0x2f6ac299380e486e,
9386            >(_buf?)?
9387            .into_result::<VmoMarker>("write_vmo")?;
9388            Ok(_response.map(|x| x))
9389        }
9390        self.client.send_query_and_decode::<VmoWriteVmoRequest, VmoWriteVmoResult>(
9391            (handle, offset, data),
9392            0x2f6ac299380e486e,
9393            fidl::encoding::DynamicFlags::FLEXIBLE,
9394            _decode,
9395        )
9396    }
9397
9398    type GetVmoSizeResponseFut = fidl::client::QueryResponseFut<
9399        VmoGetVmoSizeResult,
9400        fidl::encoding::DefaultFuchsiaResourceDialect,
9401    >;
9402    fn r#get_vmo_size(&self, mut handle: &HandleId) -> Self::GetVmoSizeResponseFut {
9403        fn _decode(
9404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9405        ) -> Result<VmoGetVmoSizeResult, fidl::Error> {
9406            let _response = fidl::client::decode_transaction_body::<
9407                fidl::encoding::FlexibleResultType<VmoGetVmoSizeResponse, Error>,
9408                fidl::encoding::DefaultFuchsiaResourceDialect,
9409                0x717f9f3a9ff6906e,
9410            >(_buf?)?
9411            .into_result::<VmoMarker>("get_vmo_size")?;
9412            Ok(_response.map(|x| x.size))
9413        }
9414        self.client.send_query_and_decode::<VmoGetVmoSizeRequest, VmoGetVmoSizeResult>(
9415            (handle,),
9416            0x717f9f3a9ff6906e,
9417            fidl::encoding::DynamicFlags::FLEXIBLE,
9418            _decode,
9419        )
9420    }
9421
9422    type SetVmoSizeResponseFut = fidl::client::QueryResponseFut<
9423        VmoSetVmoSizeResult,
9424        fidl::encoding::DefaultFuchsiaResourceDialect,
9425    >;
9426    fn r#set_vmo_size(&self, mut handle: &HandleId, mut size: u64) -> Self::SetVmoSizeResponseFut {
9427        fn _decode(
9428            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9429        ) -> Result<VmoSetVmoSizeResult, fidl::Error> {
9430            let _response = fidl::client::decode_transaction_body::<
9431                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9432                fidl::encoding::DefaultFuchsiaResourceDialect,
9433                0x7f6f77ac37afe38b,
9434            >(_buf?)?
9435            .into_result::<VmoMarker>("set_vmo_size")?;
9436            Ok(_response.map(|x| x))
9437        }
9438        self.client.send_query_and_decode::<VmoSetVmoSizeRequest, VmoSetVmoSizeResult>(
9439            (handle, size),
9440            0x7f6f77ac37afe38b,
9441            fidl::encoding::DynamicFlags::FLEXIBLE,
9442            _decode,
9443        )
9444    }
9445
9446    type GetVmoStreamSizeResponseFut = fidl::client::QueryResponseFut<
9447        VmoGetVmoStreamSizeResult,
9448        fidl::encoding::DefaultFuchsiaResourceDialect,
9449    >;
9450    fn r#get_vmo_stream_size(&self, mut handle: &HandleId) -> Self::GetVmoStreamSizeResponseFut {
9451        fn _decode(
9452            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9453        ) -> Result<VmoGetVmoStreamSizeResult, fidl::Error> {
9454            let _response = fidl::client::decode_transaction_body::<
9455                fidl::encoding::FlexibleResultType<VmoGetVmoStreamSizeResponse, Error>,
9456                fidl::encoding::DefaultFuchsiaResourceDialect,
9457                0x54020f4280cb038,
9458            >(_buf?)?
9459            .into_result::<VmoMarker>("get_vmo_stream_size")?;
9460            Ok(_response.map(|x| x.size))
9461        }
9462        self.client.send_query_and_decode::<VmoGetVmoStreamSizeRequest, VmoGetVmoStreamSizeResult>(
9463            (handle,),
9464            0x54020f4280cb038,
9465            fidl::encoding::DynamicFlags::FLEXIBLE,
9466            _decode,
9467        )
9468    }
9469
9470    type SetVmoStreamSizeResponseFut = fidl::client::QueryResponseFut<
9471        VmoSetVmoStreamSizeResult,
9472        fidl::encoding::DefaultFuchsiaResourceDialect,
9473    >;
9474    fn r#set_vmo_stream_size(
9475        &self,
9476        mut handle: &HandleId,
9477        mut size: u64,
9478    ) -> Self::SetVmoStreamSizeResponseFut {
9479        fn _decode(
9480            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9481        ) -> Result<VmoSetVmoStreamSizeResult, fidl::Error> {
9482            let _response = fidl::client::decode_transaction_body::<
9483                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
9484                fidl::encoding::DefaultFuchsiaResourceDialect,
9485                0x3bdb108fb18002eb,
9486            >(_buf?)?
9487            .into_result::<VmoMarker>("set_vmo_stream_size")?;
9488            Ok(_response.map(|x| x))
9489        }
9490        self.client.send_query_and_decode::<VmoSetVmoStreamSizeRequest, VmoSetVmoStreamSizeResult>(
9491            (handle, size),
9492            0x3bdb108fb18002eb,
9493            fidl::encoding::DynamicFlags::FLEXIBLE,
9494            _decode,
9495        )
9496    }
9497}
9498
9499pub struct VmoEventStream {
9500    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9501}
9502
9503impl std::marker::Unpin for VmoEventStream {}
9504
9505impl futures::stream::FusedStream for VmoEventStream {
9506    fn is_terminated(&self) -> bool {
9507        self.event_receiver.is_terminated()
9508    }
9509}
9510
9511impl futures::Stream for VmoEventStream {
9512    type Item = Result<VmoEvent, fidl::Error>;
9513
9514    fn poll_next(
9515        mut self: std::pin::Pin<&mut Self>,
9516        cx: &mut std::task::Context<'_>,
9517    ) -> std::task::Poll<Option<Self::Item>> {
9518        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9519            &mut self.event_receiver,
9520            cx
9521        )?) {
9522            Some(buf) => std::task::Poll::Ready(Some(VmoEvent::decode(buf))),
9523            None => std::task::Poll::Ready(None),
9524        }
9525    }
9526}
9527
9528#[derive(Debug)]
9529pub enum VmoEvent {
9530    #[non_exhaustive]
9531    _UnknownEvent {
9532        /// Ordinal of the event that was sent.
9533        ordinal: u64,
9534    },
9535}
9536
9537impl VmoEvent {
9538    /// Decodes a message buffer as a [`VmoEvent`].
9539    fn decode(
9540        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9541    ) -> Result<VmoEvent, fidl::Error> {
9542        let (bytes, _handles) = buf.split_mut();
9543        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9544        debug_assert_eq!(tx_header.tx_id, 0);
9545        match tx_header.ordinal {
9546            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9547                Ok(VmoEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9548            }
9549            _ => Err(fidl::Error::UnknownOrdinal {
9550                ordinal: tx_header.ordinal,
9551                protocol_name: <VmoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9552            }),
9553        }
9554    }
9555}
9556
9557/// A Stream of incoming requests for fuchsia.fdomain/Vmo.
9558pub struct VmoRequestStream {
9559    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9560    is_terminated: bool,
9561}
9562
9563impl std::marker::Unpin for VmoRequestStream {}
9564
9565impl futures::stream::FusedStream for VmoRequestStream {
9566    fn is_terminated(&self) -> bool {
9567        self.is_terminated
9568    }
9569}
9570
9571impl fidl::endpoints::RequestStream for VmoRequestStream {
9572    type Protocol = VmoMarker;
9573    type ControlHandle = VmoControlHandle;
9574
9575    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9576        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9577    }
9578
9579    fn control_handle(&self) -> Self::ControlHandle {
9580        VmoControlHandle { inner: self.inner.clone() }
9581    }
9582
9583    fn into_inner(
9584        self,
9585    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9586    {
9587        (self.inner, self.is_terminated)
9588    }
9589
9590    fn from_inner(
9591        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9592        is_terminated: bool,
9593    ) -> Self {
9594        Self { inner, is_terminated }
9595    }
9596}
9597
9598impl futures::Stream for VmoRequestStream {
9599    type Item = Result<VmoRequest, fidl::Error>;
9600
9601    fn poll_next(
9602        mut self: std::pin::Pin<&mut Self>,
9603        cx: &mut std::task::Context<'_>,
9604    ) -> std::task::Poll<Option<Self::Item>> {
9605        let this = &mut *self;
9606        if this.inner.check_shutdown(cx) {
9607            this.is_terminated = true;
9608            return std::task::Poll::Ready(None);
9609        }
9610        if this.is_terminated {
9611            panic!("polled VmoRequestStream after completion");
9612        }
9613        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9614            |bytes, handles| {
9615                match this.inner.channel().read_etc(cx, bytes, handles) {
9616                    std::task::Poll::Ready(Ok(())) => {}
9617                    std::task::Poll::Pending => return std::task::Poll::Pending,
9618                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9619                        this.is_terminated = true;
9620                        return std::task::Poll::Ready(None);
9621                    }
9622                    std::task::Poll::Ready(Err(e)) => {
9623                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9624                            e.into(),
9625                        ))));
9626                    }
9627                }
9628
9629                // A message has been received from the channel
9630                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9631
9632                std::task::Poll::Ready(Some(match header.ordinal {
9633                    0x392dcaac1ddd8868 => {
9634                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9635                        let mut req = fidl::new_empty!(
9636                            VmoCreateVmoRequest,
9637                            fidl::encoding::DefaultFuchsiaResourceDialect
9638                        );
9639                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoCreateVmoRequest>(&header, _body_bytes, handles, &mut req)?;
9640                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9641                        Ok(VmoRequest::CreateVmo {
9642                            size: req.size,
9643                            options: req.options,
9644                            handle: req.handle,
9645
9646                            responder: VmoCreateVmoResponder {
9647                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9648                                tx_id: header.tx_id,
9649                            },
9650                        })
9651                    }
9652                    0x62690ec76b0f2fe6 => {
9653                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9654                        let mut req = fidl::new_empty!(
9655                            VmoReadVmoRequest,
9656                            fidl::encoding::DefaultFuchsiaResourceDialect
9657                        );
9658                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoReadVmoRequest>(&header, _body_bytes, handles, &mut req)?;
9659                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9660                        Ok(VmoRequest::ReadVmo {
9661                            handle: req.handle,
9662                            offset: req.offset,
9663                            size: req.size,
9664
9665                            responder: VmoReadVmoResponder {
9666                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9667                                tx_id: header.tx_id,
9668                            },
9669                        })
9670                    }
9671                    0x2f6ac299380e486e => {
9672                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9673                        let mut req = fidl::new_empty!(
9674                            VmoWriteVmoRequest,
9675                            fidl::encoding::DefaultFuchsiaResourceDialect
9676                        );
9677                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoWriteVmoRequest>(&header, _body_bytes, handles, &mut req)?;
9678                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9679                        Ok(VmoRequest::WriteVmo {
9680                            handle: req.handle,
9681                            offset: req.offset,
9682                            data: req.data,
9683
9684                            responder: VmoWriteVmoResponder {
9685                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9686                                tx_id: header.tx_id,
9687                            },
9688                        })
9689                    }
9690                    0x717f9f3a9ff6906e => {
9691                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9692                        let mut req = fidl::new_empty!(
9693                            VmoGetVmoSizeRequest,
9694                            fidl::encoding::DefaultFuchsiaResourceDialect
9695                        );
9696                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoGetVmoSizeRequest>(&header, _body_bytes, handles, &mut req)?;
9697                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9698                        Ok(VmoRequest::GetVmoSize {
9699                            handle: req.handle,
9700
9701                            responder: VmoGetVmoSizeResponder {
9702                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9703                                tx_id: header.tx_id,
9704                            },
9705                        })
9706                    }
9707                    0x7f6f77ac37afe38b => {
9708                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9709                        let mut req = fidl::new_empty!(
9710                            VmoSetVmoSizeRequest,
9711                            fidl::encoding::DefaultFuchsiaResourceDialect
9712                        );
9713                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoSetVmoSizeRequest>(&header, _body_bytes, handles, &mut req)?;
9714                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9715                        Ok(VmoRequest::SetVmoSize {
9716                            handle: req.handle,
9717                            size: req.size,
9718
9719                            responder: VmoSetVmoSizeResponder {
9720                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9721                                tx_id: header.tx_id,
9722                            },
9723                        })
9724                    }
9725                    0x54020f4280cb038 => {
9726                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9727                        let mut req = fidl::new_empty!(
9728                            VmoGetVmoStreamSizeRequest,
9729                            fidl::encoding::DefaultFuchsiaResourceDialect
9730                        );
9731                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoGetVmoStreamSizeRequest>(&header, _body_bytes, handles, &mut req)?;
9732                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9733                        Ok(VmoRequest::GetVmoStreamSize {
9734                            handle: req.handle,
9735
9736                            responder: VmoGetVmoStreamSizeResponder {
9737                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9738                                tx_id: header.tx_id,
9739                            },
9740                        })
9741                    }
9742                    0x3bdb108fb18002eb => {
9743                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9744                        let mut req = fidl::new_empty!(
9745                            VmoSetVmoStreamSizeRequest,
9746                            fidl::encoding::DefaultFuchsiaResourceDialect
9747                        );
9748                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VmoSetVmoStreamSizeRequest>(&header, _body_bytes, handles, &mut req)?;
9749                        let control_handle = VmoControlHandle { inner: this.inner.clone() };
9750                        Ok(VmoRequest::SetVmoStreamSize {
9751                            handle: req.handle,
9752                            size: req.size,
9753
9754                            responder: VmoSetVmoStreamSizeResponder {
9755                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9756                                tx_id: header.tx_id,
9757                            },
9758                        })
9759                    }
9760                    _ if header.tx_id == 0
9761                        && header
9762                            .dynamic_flags()
9763                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9764                    {
9765                        Ok(VmoRequest::_UnknownMethod {
9766                            ordinal: header.ordinal,
9767                            control_handle: VmoControlHandle { inner: this.inner.clone() },
9768                            method_type: fidl::MethodType::OneWay,
9769                        })
9770                    }
9771                    _ if header
9772                        .dynamic_flags()
9773                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9774                    {
9775                        this.inner.send_framework_err(
9776                            fidl::encoding::FrameworkErr::UnknownMethod,
9777                            header.tx_id,
9778                            header.ordinal,
9779                            header.dynamic_flags(),
9780                            (bytes, handles),
9781                        )?;
9782                        Ok(VmoRequest::_UnknownMethod {
9783                            ordinal: header.ordinal,
9784                            control_handle: VmoControlHandle { inner: this.inner.clone() },
9785                            method_type: fidl::MethodType::TwoWay,
9786                        })
9787                    }
9788                    _ => Err(fidl::Error::UnknownOrdinal {
9789                        ordinal: header.ordinal,
9790                        protocol_name: <VmoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9791                    }),
9792                }))
9793            },
9794        )
9795    }
9796}
9797
9798/// FDomain operations on VMOs (Virtual Memory Objects).
9799#[derive(Debug)]
9800pub enum VmoRequest {
9801    /// Create a new VMO in this FDomain.
9802    CreateVmo {
9803        size: u64,
9804        options: VmoOptions,
9805        handle: NewHandleId,
9806        responder: VmoCreateVmoResponder,
9807    },
9808    /// Read data from a VMO.
9809    ReadVmo { handle: HandleId, offset: u64, size: u64, responder: VmoReadVmoResponder },
9810    /// Write data to a VMO.
9811    WriteVmo { handle: HandleId, offset: u64, data: Vec<u8>, responder: VmoWriteVmoResponder },
9812    /// Get the size of a VMO in bytes.
9813    GetVmoSize { handle: HandleId, responder: VmoGetVmoSizeResponder },
9814    /// Set the size of a VMO in bytes.
9815    SetVmoSize { handle: HandleId, size: u64, responder: VmoSetVmoSizeResponder },
9816    /// Get the stream size of a VMO in bytes.
9817    GetVmoStreamSize { handle: HandleId, responder: VmoGetVmoStreamSizeResponder },
9818    /// Set the stream size of a VMO in bytes.
9819    SetVmoStreamSize { handle: HandleId, size: u64, responder: VmoSetVmoStreamSizeResponder },
9820    /// An interaction was received which does not match any known method.
9821    #[non_exhaustive]
9822    _UnknownMethod {
9823        /// Ordinal of the method that was called.
9824        ordinal: u64,
9825        control_handle: VmoControlHandle,
9826        method_type: fidl::MethodType,
9827    },
9828}
9829
9830impl VmoRequest {
9831    #[allow(irrefutable_let_patterns)]
9832    pub fn into_create_vmo(self) -> Option<(u64, VmoOptions, NewHandleId, VmoCreateVmoResponder)> {
9833        if let VmoRequest::CreateVmo { size, options, handle, responder } = self {
9834            Some((size, options, handle, responder))
9835        } else {
9836            None
9837        }
9838    }
9839
9840    #[allow(irrefutable_let_patterns)]
9841    pub fn into_read_vmo(self) -> Option<(HandleId, u64, u64, VmoReadVmoResponder)> {
9842        if let VmoRequest::ReadVmo { handle, offset, size, responder } = self {
9843            Some((handle, offset, size, responder))
9844        } else {
9845            None
9846        }
9847    }
9848
9849    #[allow(irrefutable_let_patterns)]
9850    pub fn into_write_vmo(self) -> Option<(HandleId, u64, Vec<u8>, VmoWriteVmoResponder)> {
9851        if let VmoRequest::WriteVmo { handle, offset, data, responder } = self {
9852            Some((handle, offset, data, responder))
9853        } else {
9854            None
9855        }
9856    }
9857
9858    #[allow(irrefutable_let_patterns)]
9859    pub fn into_get_vmo_size(self) -> Option<(HandleId, VmoGetVmoSizeResponder)> {
9860        if let VmoRequest::GetVmoSize { handle, responder } = self {
9861            Some((handle, responder))
9862        } else {
9863            None
9864        }
9865    }
9866
9867    #[allow(irrefutable_let_patterns)]
9868    pub fn into_set_vmo_size(self) -> Option<(HandleId, u64, VmoSetVmoSizeResponder)> {
9869        if let VmoRequest::SetVmoSize { handle, size, responder } = self {
9870            Some((handle, size, responder))
9871        } else {
9872            None
9873        }
9874    }
9875
9876    #[allow(irrefutable_let_patterns)]
9877    pub fn into_get_vmo_stream_size(self) -> Option<(HandleId, VmoGetVmoStreamSizeResponder)> {
9878        if let VmoRequest::GetVmoStreamSize { handle, responder } = self {
9879            Some((handle, responder))
9880        } else {
9881            None
9882        }
9883    }
9884
9885    #[allow(irrefutable_let_patterns)]
9886    pub fn into_set_vmo_stream_size(self) -> Option<(HandleId, u64, VmoSetVmoStreamSizeResponder)> {
9887        if let VmoRequest::SetVmoStreamSize { handle, size, responder } = self {
9888            Some((handle, size, responder))
9889        } else {
9890            None
9891        }
9892    }
9893
9894    /// Name of the method defined in FIDL
9895    pub fn method_name(&self) -> &'static str {
9896        match *self {
9897            VmoRequest::CreateVmo { .. } => "create_vmo",
9898            VmoRequest::ReadVmo { .. } => "read_vmo",
9899            VmoRequest::WriteVmo { .. } => "write_vmo",
9900            VmoRequest::GetVmoSize { .. } => "get_vmo_size",
9901            VmoRequest::SetVmoSize { .. } => "set_vmo_size",
9902            VmoRequest::GetVmoStreamSize { .. } => "get_vmo_stream_size",
9903            VmoRequest::SetVmoStreamSize { .. } => "set_vmo_stream_size",
9904            VmoRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
9905                "unknown one-way method"
9906            }
9907            VmoRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
9908                "unknown two-way method"
9909            }
9910        }
9911    }
9912}
9913
9914#[derive(Debug, Clone)]
9915pub struct VmoControlHandle {
9916    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9917}
9918
9919impl VmoControlHandle {
9920    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9921        self.inner.shutdown_with_epitaph(status.into())
9922    }
9923}
9924
9925impl fidl::endpoints::ControlHandle for VmoControlHandle {
9926    fn shutdown(&self) {
9927        self.inner.shutdown()
9928    }
9929
9930    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9931        self.inner.shutdown_with_epitaph(status)
9932    }
9933
9934    fn is_closed(&self) -> bool {
9935        self.inner.channel().is_closed()
9936    }
9937    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9938        self.inner.channel().on_closed()
9939    }
9940
9941    #[cfg(target_os = "fuchsia")]
9942    fn signal_peer(
9943        &self,
9944        clear_mask: zx::Signals,
9945        set_mask: zx::Signals,
9946    ) -> Result<(), zx_status::Status> {
9947        use fidl::Peered;
9948        self.inner.channel().signal_peer(clear_mask, set_mask)
9949    }
9950}
9951
9952impl VmoControlHandle {}
9953
9954#[must_use = "FIDL methods require a response to be sent"]
9955#[derive(Debug)]
9956pub struct VmoCreateVmoResponder {
9957    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
9958    tx_id: u32,
9959}
9960
9961/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
9962/// if the responder is dropped without sending a response, so that the client
9963/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9964impl std::ops::Drop for VmoCreateVmoResponder {
9965    fn drop(&mut self) {
9966        self.control_handle.shutdown();
9967        // Safety: drops once, never accessed again
9968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9969    }
9970}
9971
9972impl fidl::endpoints::Responder for VmoCreateVmoResponder {
9973    type ControlHandle = VmoControlHandle;
9974
9975    fn control_handle(&self) -> &VmoControlHandle {
9976        &self.control_handle
9977    }
9978
9979    fn drop_without_shutdown(mut self) {
9980        // Safety: drops once, never accessed again due to mem::forget
9981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9982        // Prevent Drop from running (which would shut down the channel)
9983        std::mem::forget(self);
9984    }
9985}
9986
9987impl VmoCreateVmoResponder {
9988    /// Sends a response to the FIDL transaction.
9989    ///
9990    /// Sets the channel to shutdown if an error occurs.
9991    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
9992        let _result = self.send_raw(result);
9993        if _result.is_err() {
9994            self.control_handle.shutdown();
9995        }
9996        self.drop_without_shutdown();
9997        _result
9998    }
9999
10000    /// Similar to "send" but does not shutdown the channel if an error occurs.
10001    pub fn send_no_shutdown_on_err(
10002        self,
10003        mut result: Result<(), &Error>,
10004    ) -> Result<(), fidl::Error> {
10005        let _result = self.send_raw(result);
10006        self.drop_without_shutdown();
10007        _result
10008    }
10009
10010    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10011        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
10012            fidl::encoding::EmptyStruct,
10013            Error,
10014        >>(
10015            fidl::encoding::FlexibleResult::new(result),
10016            self.tx_id,
10017            0x392dcaac1ddd8868,
10018            fidl::encoding::DynamicFlags::FLEXIBLE,
10019        )
10020    }
10021}
10022
10023#[must_use = "FIDL methods require a response to be sent"]
10024#[derive(Debug)]
10025pub struct VmoReadVmoResponder {
10026    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
10027    tx_id: u32,
10028}
10029
10030/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
10031/// if the responder is dropped without sending a response, so that the client
10032/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10033impl std::ops::Drop for VmoReadVmoResponder {
10034    fn drop(&mut self) {
10035        self.control_handle.shutdown();
10036        // Safety: drops once, never accessed again
10037        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10038    }
10039}
10040
10041impl fidl::endpoints::Responder for VmoReadVmoResponder {
10042    type ControlHandle = VmoControlHandle;
10043
10044    fn control_handle(&self) -> &VmoControlHandle {
10045        &self.control_handle
10046    }
10047
10048    fn drop_without_shutdown(mut self) {
10049        // Safety: drops once, never accessed again due to mem::forget
10050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10051        // Prevent Drop from running (which would shut down the channel)
10052        std::mem::forget(self);
10053    }
10054}
10055
10056impl VmoReadVmoResponder {
10057    /// Sends a response to the FIDL transaction.
10058    ///
10059    /// Sets the channel to shutdown if an error occurs.
10060    pub fn send(self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
10061        let _result = self.send_raw(result);
10062        if _result.is_err() {
10063            self.control_handle.shutdown();
10064        }
10065        self.drop_without_shutdown();
10066        _result
10067    }
10068
10069    /// Similar to "send" but does not shutdown the channel if an error occurs.
10070    pub fn send_no_shutdown_on_err(
10071        self,
10072        mut result: Result<&[u8], &Error>,
10073    ) -> Result<(), fidl::Error> {
10074        let _result = self.send_raw(result);
10075        self.drop_without_shutdown();
10076        _result
10077    }
10078
10079    fn send_raw(&self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
10080        self.control_handle
10081            .inner
10082            .send::<fidl::encoding::FlexibleResultType<VmoReadVmoResponse, Error>>(
10083                fidl::encoding::FlexibleResult::new(result.map(|data| (data,))),
10084                self.tx_id,
10085                0x62690ec76b0f2fe6,
10086                fidl::encoding::DynamicFlags::FLEXIBLE,
10087            )
10088    }
10089}
10090
10091#[must_use = "FIDL methods require a response to be sent"]
10092#[derive(Debug)]
10093pub struct VmoWriteVmoResponder {
10094    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
10095    tx_id: u32,
10096}
10097
10098/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
10099/// if the responder is dropped without sending a response, so that the client
10100/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10101impl std::ops::Drop for VmoWriteVmoResponder {
10102    fn drop(&mut self) {
10103        self.control_handle.shutdown();
10104        // Safety: drops once, never accessed again
10105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10106    }
10107}
10108
10109impl fidl::endpoints::Responder for VmoWriteVmoResponder {
10110    type ControlHandle = VmoControlHandle;
10111
10112    fn control_handle(&self) -> &VmoControlHandle {
10113        &self.control_handle
10114    }
10115
10116    fn drop_without_shutdown(mut self) {
10117        // Safety: drops once, never accessed again due to mem::forget
10118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10119        // Prevent Drop from running (which would shut down the channel)
10120        std::mem::forget(self);
10121    }
10122}
10123
10124impl VmoWriteVmoResponder {
10125    /// Sends a response to the FIDL transaction.
10126    ///
10127    /// Sets the channel to shutdown if an error occurs.
10128    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10129        let _result = self.send_raw(result);
10130        if _result.is_err() {
10131            self.control_handle.shutdown();
10132        }
10133        self.drop_without_shutdown();
10134        _result
10135    }
10136
10137    /// Similar to "send" but does not shutdown the channel if an error occurs.
10138    pub fn send_no_shutdown_on_err(
10139        self,
10140        mut result: Result<(), &Error>,
10141    ) -> Result<(), fidl::Error> {
10142        let _result = self.send_raw(result);
10143        self.drop_without_shutdown();
10144        _result
10145    }
10146
10147    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10148        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
10149            fidl::encoding::EmptyStruct,
10150            Error,
10151        >>(
10152            fidl::encoding::FlexibleResult::new(result),
10153            self.tx_id,
10154            0x2f6ac299380e486e,
10155            fidl::encoding::DynamicFlags::FLEXIBLE,
10156        )
10157    }
10158}
10159
10160#[must_use = "FIDL methods require a response to be sent"]
10161#[derive(Debug)]
10162pub struct VmoGetVmoSizeResponder {
10163    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
10164    tx_id: u32,
10165}
10166
10167/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
10168/// if the responder is dropped without sending a response, so that the client
10169/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10170impl std::ops::Drop for VmoGetVmoSizeResponder {
10171    fn drop(&mut self) {
10172        self.control_handle.shutdown();
10173        // Safety: drops once, never accessed again
10174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10175    }
10176}
10177
10178impl fidl::endpoints::Responder for VmoGetVmoSizeResponder {
10179    type ControlHandle = VmoControlHandle;
10180
10181    fn control_handle(&self) -> &VmoControlHandle {
10182        &self.control_handle
10183    }
10184
10185    fn drop_without_shutdown(mut self) {
10186        // Safety: drops once, never accessed again due to mem::forget
10187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10188        // Prevent Drop from running (which would shut down the channel)
10189        std::mem::forget(self);
10190    }
10191}
10192
10193impl VmoGetVmoSizeResponder {
10194    /// Sends a response to the FIDL transaction.
10195    ///
10196    /// Sets the channel to shutdown if an error occurs.
10197    pub fn send(self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
10198        let _result = self.send_raw(result);
10199        if _result.is_err() {
10200            self.control_handle.shutdown();
10201        }
10202        self.drop_without_shutdown();
10203        _result
10204    }
10205
10206    /// Similar to "send" but does not shutdown the channel if an error occurs.
10207    pub fn send_no_shutdown_on_err(
10208        self,
10209        mut result: Result<u64, &Error>,
10210    ) -> Result<(), fidl::Error> {
10211        let _result = self.send_raw(result);
10212        self.drop_without_shutdown();
10213        _result
10214    }
10215
10216    fn send_raw(&self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
10217        self.control_handle
10218            .inner
10219            .send::<fidl::encoding::FlexibleResultType<VmoGetVmoSizeResponse, Error>>(
10220                fidl::encoding::FlexibleResult::new(result.map(|size| (size,))),
10221                self.tx_id,
10222                0x717f9f3a9ff6906e,
10223                fidl::encoding::DynamicFlags::FLEXIBLE,
10224            )
10225    }
10226}
10227
10228#[must_use = "FIDL methods require a response to be sent"]
10229#[derive(Debug)]
10230pub struct VmoSetVmoSizeResponder {
10231    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
10232    tx_id: u32,
10233}
10234
10235/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
10236/// if the responder is dropped without sending a response, so that the client
10237/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10238impl std::ops::Drop for VmoSetVmoSizeResponder {
10239    fn drop(&mut self) {
10240        self.control_handle.shutdown();
10241        // Safety: drops once, never accessed again
10242        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10243    }
10244}
10245
10246impl fidl::endpoints::Responder for VmoSetVmoSizeResponder {
10247    type ControlHandle = VmoControlHandle;
10248
10249    fn control_handle(&self) -> &VmoControlHandle {
10250        &self.control_handle
10251    }
10252
10253    fn drop_without_shutdown(mut self) {
10254        // Safety: drops once, never accessed again due to mem::forget
10255        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10256        // Prevent Drop from running (which would shut down the channel)
10257        std::mem::forget(self);
10258    }
10259}
10260
10261impl VmoSetVmoSizeResponder {
10262    /// Sends a response to the FIDL transaction.
10263    ///
10264    /// Sets the channel to shutdown if an error occurs.
10265    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10266        let _result = self.send_raw(result);
10267        if _result.is_err() {
10268            self.control_handle.shutdown();
10269        }
10270        self.drop_without_shutdown();
10271        _result
10272    }
10273
10274    /// Similar to "send" but does not shutdown the channel if an error occurs.
10275    pub fn send_no_shutdown_on_err(
10276        self,
10277        mut result: Result<(), &Error>,
10278    ) -> Result<(), fidl::Error> {
10279        let _result = self.send_raw(result);
10280        self.drop_without_shutdown();
10281        _result
10282    }
10283
10284    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10285        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
10286            fidl::encoding::EmptyStruct,
10287            Error,
10288        >>(
10289            fidl::encoding::FlexibleResult::new(result),
10290            self.tx_id,
10291            0x7f6f77ac37afe38b,
10292            fidl::encoding::DynamicFlags::FLEXIBLE,
10293        )
10294    }
10295}
10296
10297#[must_use = "FIDL methods require a response to be sent"]
10298#[derive(Debug)]
10299pub struct VmoGetVmoStreamSizeResponder {
10300    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
10301    tx_id: u32,
10302}
10303
10304/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
10305/// if the responder is dropped without sending a response, so that the client
10306/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10307impl std::ops::Drop for VmoGetVmoStreamSizeResponder {
10308    fn drop(&mut self) {
10309        self.control_handle.shutdown();
10310        // Safety: drops once, never accessed again
10311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10312    }
10313}
10314
10315impl fidl::endpoints::Responder for VmoGetVmoStreamSizeResponder {
10316    type ControlHandle = VmoControlHandle;
10317
10318    fn control_handle(&self) -> &VmoControlHandle {
10319        &self.control_handle
10320    }
10321
10322    fn drop_without_shutdown(mut self) {
10323        // Safety: drops once, never accessed again due to mem::forget
10324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10325        // Prevent Drop from running (which would shut down the channel)
10326        std::mem::forget(self);
10327    }
10328}
10329
10330impl VmoGetVmoStreamSizeResponder {
10331    /// Sends a response to the FIDL transaction.
10332    ///
10333    /// Sets the channel to shutdown if an error occurs.
10334    pub fn send(self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
10335        let _result = self.send_raw(result);
10336        if _result.is_err() {
10337            self.control_handle.shutdown();
10338        }
10339        self.drop_without_shutdown();
10340        _result
10341    }
10342
10343    /// Similar to "send" but does not shutdown the channel if an error occurs.
10344    pub fn send_no_shutdown_on_err(
10345        self,
10346        mut result: Result<u64, &Error>,
10347    ) -> Result<(), fidl::Error> {
10348        let _result = self.send_raw(result);
10349        self.drop_without_shutdown();
10350        _result
10351    }
10352
10353    fn send_raw(&self, mut result: Result<u64, &Error>) -> Result<(), fidl::Error> {
10354        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
10355            VmoGetVmoStreamSizeResponse,
10356            Error,
10357        >>(
10358            fidl::encoding::FlexibleResult::new(result.map(|size| (size,))),
10359            self.tx_id,
10360            0x54020f4280cb038,
10361            fidl::encoding::DynamicFlags::FLEXIBLE,
10362        )
10363    }
10364}
10365
10366#[must_use = "FIDL methods require a response to be sent"]
10367#[derive(Debug)]
10368pub struct VmoSetVmoStreamSizeResponder {
10369    control_handle: std::mem::ManuallyDrop<VmoControlHandle>,
10370    tx_id: u32,
10371}
10372
10373/// Set the the channel to be shutdown (see [`VmoControlHandle::shutdown`])
10374/// if the responder is dropped without sending a response, so that the client
10375/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10376impl std::ops::Drop for VmoSetVmoStreamSizeResponder {
10377    fn drop(&mut self) {
10378        self.control_handle.shutdown();
10379        // Safety: drops once, never accessed again
10380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10381    }
10382}
10383
10384impl fidl::endpoints::Responder for VmoSetVmoStreamSizeResponder {
10385    type ControlHandle = VmoControlHandle;
10386
10387    fn control_handle(&self) -> &VmoControlHandle {
10388        &self.control_handle
10389    }
10390
10391    fn drop_without_shutdown(mut self) {
10392        // Safety: drops once, never accessed again due to mem::forget
10393        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10394        // Prevent Drop from running (which would shut down the channel)
10395        std::mem::forget(self);
10396    }
10397}
10398
10399impl VmoSetVmoStreamSizeResponder {
10400    /// Sends a response to the FIDL transaction.
10401    ///
10402    /// Sets the channel to shutdown if an error occurs.
10403    pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10404        let _result = self.send_raw(result);
10405        if _result.is_err() {
10406            self.control_handle.shutdown();
10407        }
10408        self.drop_without_shutdown();
10409        _result
10410    }
10411
10412    /// Similar to "send" but does not shutdown the channel if an error occurs.
10413    pub fn send_no_shutdown_on_err(
10414        self,
10415        mut result: Result<(), &Error>,
10416    ) -> Result<(), fidl::Error> {
10417        let _result = self.send_raw(result);
10418        self.drop_without_shutdown();
10419        _result
10420    }
10421
10422    fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
10423        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
10424            fidl::encoding::EmptyStruct,
10425            Error,
10426        >>(
10427            fidl::encoding::FlexibleResult::new(result),
10428            self.tx_id,
10429            0x3bdb108fb18002eb,
10430            fidl::encoding::DynamicFlags::FLEXIBLE,
10431        )
10432    }
10433}
10434
10435mod internal {
10436    use super::*;
10437}