fidl_test_external/
fidl_test_external.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_test_external__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct EchoHandleProtocolEchoHandleRequestReducedRightsRequest {
16    pub h: fidl::Event,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for EchoHandleProtocolEchoHandleRequestReducedRightsRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct EchoHandleProtocolEchoHandleRequestReducedRightsResponse {
26    pub h: fidl::Event,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for EchoHandleProtocolEchoHandleRequestReducedRightsResponse
31{
32}
33
34#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest {
36    pub h: fidl::Event,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40    for EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest
41{
42}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse {
46    pub h: fidl::Event,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
50    for EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse
51{
52}
53
54#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct EchoHandleProtocolEchoHandleRequestSameRightsRequest {
56    pub h: fidl::Event,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
60    for EchoHandleProtocolEchoHandleRequestSameRightsRequest
61{
62}
63
64#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct EchoHandleProtocolEchoHandleRequestSameRightsResponse {
66    pub h: fidl::Event,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
70    for EchoHandleProtocolEchoHandleRequestSameRightsResponse
71{
72}
73
74#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75pub struct EchoHandleProtocolEchoHandleResponseReducedRightsRequest {
76    pub h: fidl::Event,
77}
78
79impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
80    for EchoHandleProtocolEchoHandleResponseReducedRightsRequest
81{
82}
83
84#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct EchoHandleProtocolEchoHandleResponseReducedRightsResponse {
86    pub h: fidl::Event,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
90    for EchoHandleProtocolEchoHandleResponseReducedRightsResponse
91{
92}
93
94#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
95pub struct EchoHandleProtocolEchoHandleResponseSameRightsRequest {
96    pub h: fidl::Event,
97}
98
99impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
100    for EchoHandleProtocolEchoHandleResponseSameRightsRequest
101{
102}
103
104#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct EchoHandleProtocolEchoHandleResponseSameRightsResponse {
106    pub h: fidl::Event,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
110    for EchoHandleProtocolEchoHandleResponseSameRightsResponse
111{
112}
113
114#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
115pub struct ErrorSyntaxProtocolTestErrorSyntaxResponse {
116    pub h: fidl::Event,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
120    for ErrorSyntaxProtocolTestErrorSyntaxResponse
121{
122}
123
124#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
125pub struct PushEventProtocolPushEventReducedRightsRequest {
126    pub h: fidl::Event,
127}
128
129impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
130    for PushEventProtocolPushEventReducedRightsRequest
131{
132}
133
134#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
135pub struct PushEventProtocolPushEventSameRightsRequest {
136    pub h: fidl::Event,
137}
138
139impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
140    for PushEventProtocolPushEventSameRightsRequest
141{
142}
143
144#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
145pub struct SendHandleProtocolSendHandleReducedRightsRequest {
146    pub h: fidl::Event,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
150    for SendHandleProtocolSendHandleReducedRightsRequest
151{
152}
153
154#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
155pub struct SendHandleProtocolSendHandleSameRightsRequest {
156    pub h: fidl::Event,
157}
158
159impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
160    for SendHandleProtocolSendHandleSameRightsRequest
161{
162}
163
164#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
165pub struct StructWithHandles {
166    pub v: Vec<fidl::Channel>,
167}
168
169impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StructWithHandles {}
170
171#[derive(Debug, Default, PartialEq)]
172pub struct ResourceRecord {
173    pub name: Option<String>,
174    pub age: Option<u8>,
175    #[doc(hidden)]
176    pub __source_breaking: fidl::marker::SourceBreaking,
177}
178
179impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ResourceRecord {}
180
181#[derive(Debug)]
182pub enum FlexibleResourceThing {
183    Number(u32),
184    Name(String),
185    #[doc(hidden)]
186    __SourceBreaking {
187        unknown_ordinal: u64,
188    },
189}
190
191/// Pattern that matches an unknown `FlexibleResourceThing` member.
192#[macro_export]
193macro_rules! FlexibleResourceThingUnknown {
194    () => {
195        _
196    };
197}
198
199// Custom PartialEq so that unknown variants are not equal to themselves.
200impl PartialEq for FlexibleResourceThing {
201    fn eq(&self, other: &Self) -> bool {
202        match (self, other) {
203            (Self::Number(x), Self::Number(y)) => *x == *y,
204            (Self::Name(x), Self::Name(y)) => *x == *y,
205            _ => false,
206        }
207    }
208}
209
210impl FlexibleResourceThing {
211    #[inline]
212    pub fn ordinal(&self) -> u64 {
213        match *self {
214            Self::Number(_) => 1,
215            Self::Name(_) => 2,
216            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
217        }
218    }
219
220    #[inline]
221    pub fn unknown_variant_for_testing() -> Self {
222        Self::__SourceBreaking { unknown_ordinal: 0 }
223    }
224
225    #[inline]
226    pub fn is_unknown(&self) -> bool {
227        match self {
228            Self::__SourceBreaking { .. } => true,
229            _ => false,
230        }
231    }
232}
233
234impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FlexibleResourceThing {}
235
236#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
237pub enum StrictResourceThing {
238    Number(u32),
239    Name(String),
240}
241
242impl StrictResourceThing {
243    #[inline]
244    pub fn ordinal(&self) -> u64 {
245        match *self {
246            Self::Number(_) => 1,
247            Self::Name(_) => 2,
248        }
249    }
250}
251
252impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StrictResourceThing {}
253
254#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
255pub struct EchoHandleProtocolMarker;
256
257impl fidl::endpoints::ProtocolMarker for EchoHandleProtocolMarker {
258    type Proxy = EchoHandleProtocolProxy;
259    type RequestStream = EchoHandleProtocolRequestStream;
260    #[cfg(target_os = "fuchsia")]
261    type SynchronousProxy = EchoHandleProtocolSynchronousProxy;
262
263    const DEBUG_NAME: &'static str = "(anonymous) EchoHandleProtocol";
264}
265
266pub trait EchoHandleProtocolProxyInterface: Send + Sync {
267    type EchoHandleRequestResponseReducedRightsResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
268        + Send;
269    fn r#echo_handle_request_response_reduced_rights(
270        &self,
271        h: fidl::Event,
272    ) -> Self::EchoHandleRequestResponseReducedRightsResponseFut;
273    type EchoHandleRequestReducedRightsResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
274        + Send;
275    fn r#echo_handle_request_reduced_rights(
276        &self,
277        h: fidl::Event,
278    ) -> Self::EchoHandleRequestReducedRightsResponseFut;
279    type EchoHandleRequestSameRightsResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
280        + Send;
281    fn r#echo_handle_request_same_rights(
282        &self,
283        h: fidl::Event,
284    ) -> Self::EchoHandleRequestSameRightsResponseFut;
285    type EchoHandleResponseReducedRightsResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
286        + Send;
287    fn r#echo_handle_response_reduced_rights(
288        &self,
289        h: fidl::Event,
290    ) -> Self::EchoHandleResponseReducedRightsResponseFut;
291    type EchoHandleResponseSameRightsResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
292        + Send;
293    fn r#echo_handle_response_same_rights(
294        &self,
295        h: fidl::Event,
296    ) -> Self::EchoHandleResponseSameRightsResponseFut;
297}
298#[derive(Debug)]
299#[cfg(target_os = "fuchsia")]
300pub struct EchoHandleProtocolSynchronousProxy {
301    client: fidl::client::sync::Client,
302}
303
304#[cfg(target_os = "fuchsia")]
305impl fidl::endpoints::SynchronousProxy for EchoHandleProtocolSynchronousProxy {
306    type Proxy = EchoHandleProtocolProxy;
307    type Protocol = EchoHandleProtocolMarker;
308
309    fn from_channel(inner: fidl::Channel) -> Self {
310        Self::new(inner)
311    }
312
313    fn into_channel(self) -> fidl::Channel {
314        self.client.into_channel()
315    }
316
317    fn as_channel(&self) -> &fidl::Channel {
318        self.client.as_channel()
319    }
320}
321
322#[cfg(target_os = "fuchsia")]
323impl EchoHandleProtocolSynchronousProxy {
324    pub fn new(channel: fidl::Channel) -> Self {
325        let protocol_name =
326            <EchoHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
327        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
328    }
329
330    pub fn into_channel(self) -> fidl::Channel {
331        self.client.into_channel()
332    }
333
334    /// Waits until an event arrives and returns it. It is safe for other
335    /// threads to make concurrent requests while waiting for an event.
336    pub fn wait_for_event(
337        &self,
338        deadline: zx::MonotonicInstant,
339    ) -> Result<EchoHandleProtocolEvent, fidl::Error> {
340        EchoHandleProtocolEvent::decode(self.client.wait_for_event(deadline)?)
341    }
342
343    pub fn r#echo_handle_request_response_reduced_rights(
344        &self,
345        mut h: fidl::Event,
346        ___deadline: zx::MonotonicInstant,
347    ) -> Result<fidl::Event, fidl::Error> {
348        let _response = self.client.send_query::<
349            EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest,
350            EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse,
351        >(
352            (h,),
353            0x5c6c0f3032f3bcc6,
354            fidl::encoding::DynamicFlags::empty(),
355            ___deadline,
356        )?;
357        Ok(_response.h)
358    }
359
360    pub fn r#echo_handle_request_reduced_rights(
361        &self,
362        mut h: fidl::Event,
363        ___deadline: zx::MonotonicInstant,
364    ) -> Result<fidl::Event, fidl::Error> {
365        let _response = self.client.send_query::<
366            EchoHandleProtocolEchoHandleRequestReducedRightsRequest,
367            EchoHandleProtocolEchoHandleRequestReducedRightsResponse,
368        >(
369            (h,),
370            0x6f73455d31eb2f42,
371            fidl::encoding::DynamicFlags::empty(),
372            ___deadline,
373        )?;
374        Ok(_response.h)
375    }
376
377    pub fn r#echo_handle_request_same_rights(
378        &self,
379        mut h: fidl::Event,
380        ___deadline: zx::MonotonicInstant,
381    ) -> Result<fidl::Event, fidl::Error> {
382        let _response = self.client.send_query::<
383            EchoHandleProtocolEchoHandleRequestSameRightsRequest,
384            EchoHandleProtocolEchoHandleRequestSameRightsResponse,
385        >(
386            (h,),
387            0x7bd6b869de1eb0b7,
388            fidl::encoding::DynamicFlags::empty(),
389            ___deadline,
390        )?;
391        Ok(_response.h)
392    }
393
394    pub fn r#echo_handle_response_reduced_rights(
395        &self,
396        mut h: fidl::Event,
397        ___deadline: zx::MonotonicInstant,
398    ) -> Result<fidl::Event, fidl::Error> {
399        let _response = self.client.send_query::<
400            EchoHandleProtocolEchoHandleResponseReducedRightsRequest,
401            EchoHandleProtocolEchoHandleResponseReducedRightsResponse,
402        >(
403            (h,),
404            0x458d1c6d39e34f1e,
405            fidl::encoding::DynamicFlags::empty(),
406            ___deadline,
407        )?;
408        Ok(_response.h)
409    }
410
411    pub fn r#echo_handle_response_same_rights(
412        &self,
413        mut h: fidl::Event,
414        ___deadline: zx::MonotonicInstant,
415    ) -> Result<fidl::Event, fidl::Error> {
416        let _response = self.client.send_query::<
417            EchoHandleProtocolEchoHandleResponseSameRightsRequest,
418            EchoHandleProtocolEchoHandleResponseSameRightsResponse,
419        >(
420            (h,),
421            0x57334c827816fe5,
422            fidl::encoding::DynamicFlags::empty(),
423            ___deadline,
424        )?;
425        Ok(_response.h)
426    }
427}
428
429#[cfg(target_os = "fuchsia")]
430impl From<EchoHandleProtocolSynchronousProxy> for zx::Handle {
431    fn from(value: EchoHandleProtocolSynchronousProxy) -> Self {
432        value.into_channel().into()
433    }
434}
435
436#[cfg(target_os = "fuchsia")]
437impl From<fidl::Channel> for EchoHandleProtocolSynchronousProxy {
438    fn from(value: fidl::Channel) -> Self {
439        Self::new(value)
440    }
441}
442
443#[cfg(target_os = "fuchsia")]
444impl fidl::endpoints::FromClient for EchoHandleProtocolSynchronousProxy {
445    type Protocol = EchoHandleProtocolMarker;
446
447    fn from_client(value: fidl::endpoints::ClientEnd<EchoHandleProtocolMarker>) -> Self {
448        Self::new(value.into_channel())
449    }
450}
451
452#[derive(Debug, Clone)]
453pub struct EchoHandleProtocolProxy {
454    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
455}
456
457impl fidl::endpoints::Proxy for EchoHandleProtocolProxy {
458    type Protocol = EchoHandleProtocolMarker;
459
460    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
461        Self::new(inner)
462    }
463
464    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
465        self.client.into_channel().map_err(|client| Self { client })
466    }
467
468    fn as_channel(&self) -> &::fidl::AsyncChannel {
469        self.client.as_channel()
470    }
471}
472
473impl EchoHandleProtocolProxy {
474    /// Create a new Proxy for test.external/EchoHandleProtocol.
475    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
476        let protocol_name =
477            <EchoHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
478        Self { client: fidl::client::Client::new(channel, protocol_name) }
479    }
480
481    /// Get a Stream of events from the remote end of the protocol.
482    ///
483    /// # Panics
484    ///
485    /// Panics if the event stream was already taken.
486    pub fn take_event_stream(&self) -> EchoHandleProtocolEventStream {
487        EchoHandleProtocolEventStream { event_receiver: self.client.take_event_receiver() }
488    }
489
490    pub fn r#echo_handle_request_response_reduced_rights(
491        &self,
492        mut h: fidl::Event,
493    ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
494    {
495        EchoHandleProtocolProxyInterface::r#echo_handle_request_response_reduced_rights(self, h)
496    }
497
498    pub fn r#echo_handle_request_reduced_rights(
499        &self,
500        mut h: fidl::Event,
501    ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
502    {
503        EchoHandleProtocolProxyInterface::r#echo_handle_request_reduced_rights(self, h)
504    }
505
506    pub fn r#echo_handle_request_same_rights(
507        &self,
508        mut h: fidl::Event,
509    ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
510    {
511        EchoHandleProtocolProxyInterface::r#echo_handle_request_same_rights(self, h)
512    }
513
514    pub fn r#echo_handle_response_reduced_rights(
515        &self,
516        mut h: fidl::Event,
517    ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
518    {
519        EchoHandleProtocolProxyInterface::r#echo_handle_response_reduced_rights(self, h)
520    }
521
522    pub fn r#echo_handle_response_same_rights(
523        &self,
524        mut h: fidl::Event,
525    ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
526    {
527        EchoHandleProtocolProxyInterface::r#echo_handle_response_same_rights(self, h)
528    }
529}
530
531impl EchoHandleProtocolProxyInterface for EchoHandleProtocolProxy {
532    type EchoHandleRequestResponseReducedRightsResponseFut =
533        fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
534    fn r#echo_handle_request_response_reduced_rights(
535        &self,
536        mut h: fidl::Event,
537    ) -> Self::EchoHandleRequestResponseReducedRightsResponseFut {
538        fn _decode(
539            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
540        ) -> Result<fidl::Event, fidl::Error> {
541            let _response = fidl::client::decode_transaction_body::<
542                EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse,
543                fidl::encoding::DefaultFuchsiaResourceDialect,
544                0x5c6c0f3032f3bcc6,
545            >(_buf?)?;
546            Ok(_response.h)
547        }
548        self.client.send_query_and_decode::<
549            EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest,
550            fidl::Event,
551        >(
552            (h,),
553            0x5c6c0f3032f3bcc6,
554            fidl::encoding::DynamicFlags::empty(),
555            _decode,
556        )
557    }
558
559    type EchoHandleRequestReducedRightsResponseFut =
560        fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
561    fn r#echo_handle_request_reduced_rights(
562        &self,
563        mut h: fidl::Event,
564    ) -> Self::EchoHandleRequestReducedRightsResponseFut {
565        fn _decode(
566            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
567        ) -> Result<fidl::Event, fidl::Error> {
568            let _response = fidl::client::decode_transaction_body::<
569                EchoHandleProtocolEchoHandleRequestReducedRightsResponse,
570                fidl::encoding::DefaultFuchsiaResourceDialect,
571                0x6f73455d31eb2f42,
572            >(_buf?)?;
573            Ok(_response.h)
574        }
575        self.client.send_query_and_decode::<
576            EchoHandleProtocolEchoHandleRequestReducedRightsRequest,
577            fidl::Event,
578        >(
579            (h,),
580            0x6f73455d31eb2f42,
581            fidl::encoding::DynamicFlags::empty(),
582            _decode,
583        )
584    }
585
586    type EchoHandleRequestSameRightsResponseFut =
587        fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
588    fn r#echo_handle_request_same_rights(
589        &self,
590        mut h: fidl::Event,
591    ) -> Self::EchoHandleRequestSameRightsResponseFut {
592        fn _decode(
593            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
594        ) -> Result<fidl::Event, fidl::Error> {
595            let _response = fidl::client::decode_transaction_body::<
596                EchoHandleProtocolEchoHandleRequestSameRightsResponse,
597                fidl::encoding::DefaultFuchsiaResourceDialect,
598                0x7bd6b869de1eb0b7,
599            >(_buf?)?;
600            Ok(_response.h)
601        }
602        self.client.send_query_and_decode::<
603            EchoHandleProtocolEchoHandleRequestSameRightsRequest,
604            fidl::Event,
605        >(
606            (h,),
607            0x7bd6b869de1eb0b7,
608            fidl::encoding::DynamicFlags::empty(),
609            _decode,
610        )
611    }
612
613    type EchoHandleResponseReducedRightsResponseFut =
614        fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
615    fn r#echo_handle_response_reduced_rights(
616        &self,
617        mut h: fidl::Event,
618    ) -> Self::EchoHandleResponseReducedRightsResponseFut {
619        fn _decode(
620            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
621        ) -> Result<fidl::Event, fidl::Error> {
622            let _response = fidl::client::decode_transaction_body::<
623                EchoHandleProtocolEchoHandleResponseReducedRightsResponse,
624                fidl::encoding::DefaultFuchsiaResourceDialect,
625                0x458d1c6d39e34f1e,
626            >(_buf?)?;
627            Ok(_response.h)
628        }
629        self.client.send_query_and_decode::<
630            EchoHandleProtocolEchoHandleResponseReducedRightsRequest,
631            fidl::Event,
632        >(
633            (h,),
634            0x458d1c6d39e34f1e,
635            fidl::encoding::DynamicFlags::empty(),
636            _decode,
637        )
638    }
639
640    type EchoHandleResponseSameRightsResponseFut =
641        fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
642    fn r#echo_handle_response_same_rights(
643        &self,
644        mut h: fidl::Event,
645    ) -> Self::EchoHandleResponseSameRightsResponseFut {
646        fn _decode(
647            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
648        ) -> Result<fidl::Event, fidl::Error> {
649            let _response = fidl::client::decode_transaction_body::<
650                EchoHandleProtocolEchoHandleResponseSameRightsResponse,
651                fidl::encoding::DefaultFuchsiaResourceDialect,
652                0x57334c827816fe5,
653            >(_buf?)?;
654            Ok(_response.h)
655        }
656        self.client.send_query_and_decode::<
657            EchoHandleProtocolEchoHandleResponseSameRightsRequest,
658            fidl::Event,
659        >(
660            (h,),
661            0x57334c827816fe5,
662            fidl::encoding::DynamicFlags::empty(),
663            _decode,
664        )
665    }
666}
667
668pub struct EchoHandleProtocolEventStream {
669    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
670}
671
672impl std::marker::Unpin for EchoHandleProtocolEventStream {}
673
674impl futures::stream::FusedStream for EchoHandleProtocolEventStream {
675    fn is_terminated(&self) -> bool {
676        self.event_receiver.is_terminated()
677    }
678}
679
680impl futures::Stream for EchoHandleProtocolEventStream {
681    type Item = Result<EchoHandleProtocolEvent, fidl::Error>;
682
683    fn poll_next(
684        mut self: std::pin::Pin<&mut Self>,
685        cx: &mut std::task::Context<'_>,
686    ) -> std::task::Poll<Option<Self::Item>> {
687        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
688            &mut self.event_receiver,
689            cx
690        )?) {
691            Some(buf) => std::task::Poll::Ready(Some(EchoHandleProtocolEvent::decode(buf))),
692            None => std::task::Poll::Ready(None),
693        }
694    }
695}
696
697#[derive(Debug)]
698pub enum EchoHandleProtocolEvent {}
699
700impl EchoHandleProtocolEvent {
701    /// Decodes a message buffer as a [`EchoHandleProtocolEvent`].
702    fn decode(
703        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
704    ) -> Result<EchoHandleProtocolEvent, fidl::Error> {
705        let (bytes, _handles) = buf.split_mut();
706        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
707        debug_assert_eq!(tx_header.tx_id, 0);
708        match tx_header.ordinal {
709            _ => Err(fidl::Error::UnknownOrdinal {
710                ordinal: tx_header.ordinal,
711                protocol_name:
712                    <EchoHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
713            }),
714        }
715    }
716}
717
718/// A Stream of incoming requests for test.external/EchoHandleProtocol.
719pub struct EchoHandleProtocolRequestStream {
720    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
721    is_terminated: bool,
722}
723
724impl std::marker::Unpin for EchoHandleProtocolRequestStream {}
725
726impl futures::stream::FusedStream for EchoHandleProtocolRequestStream {
727    fn is_terminated(&self) -> bool {
728        self.is_terminated
729    }
730}
731
732impl fidl::endpoints::RequestStream for EchoHandleProtocolRequestStream {
733    type Protocol = EchoHandleProtocolMarker;
734    type ControlHandle = EchoHandleProtocolControlHandle;
735
736    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
737        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
738    }
739
740    fn control_handle(&self) -> Self::ControlHandle {
741        EchoHandleProtocolControlHandle { inner: self.inner.clone() }
742    }
743
744    fn into_inner(
745        self,
746    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
747    {
748        (self.inner, self.is_terminated)
749    }
750
751    fn from_inner(
752        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
753        is_terminated: bool,
754    ) -> Self {
755        Self { inner, is_terminated }
756    }
757}
758
759impl futures::Stream for EchoHandleProtocolRequestStream {
760    type Item = Result<EchoHandleProtocolRequest, fidl::Error>;
761
762    fn poll_next(
763        mut self: std::pin::Pin<&mut Self>,
764        cx: &mut std::task::Context<'_>,
765    ) -> std::task::Poll<Option<Self::Item>> {
766        let this = &mut *self;
767        if this.inner.check_shutdown(cx) {
768            this.is_terminated = true;
769            return std::task::Poll::Ready(None);
770        }
771        if this.is_terminated {
772            panic!("polled EchoHandleProtocolRequestStream after completion");
773        }
774        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
775            |bytes, handles| {
776                match this.inner.channel().read_etc(cx, bytes, handles) {
777                    std::task::Poll::Ready(Ok(())) => {}
778                    std::task::Poll::Pending => return std::task::Poll::Pending,
779                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
780                        this.is_terminated = true;
781                        return std::task::Poll::Ready(None);
782                    }
783                    std::task::Poll::Ready(Err(e)) => {
784                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
785                            e.into(),
786                        ))))
787                    }
788                }
789
790                // A message has been received from the channel
791                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
792
793                std::task::Poll::Ready(Some(match header.ordinal {
794                0x5c6c0f3032f3bcc6 => {
795                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
796                    let mut req = fidl::new_empty!(EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
797                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest>(&header, _body_bytes, handles, &mut req)?;
798                    let control_handle = EchoHandleProtocolControlHandle {
799                        inner: this.inner.clone(),
800                    };
801                    Ok(EchoHandleProtocolRequest::EchoHandleRequestResponseReducedRights {h: req.h,
802
803                        responder: EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder {
804                            control_handle: std::mem::ManuallyDrop::new(control_handle),
805                            tx_id: header.tx_id,
806                        },
807                    })
808                }
809                0x6f73455d31eb2f42 => {
810                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
811                    let mut req = fidl::new_empty!(EchoHandleProtocolEchoHandleRequestReducedRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
812                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EchoHandleProtocolEchoHandleRequestReducedRightsRequest>(&header, _body_bytes, handles, &mut req)?;
813                    let control_handle = EchoHandleProtocolControlHandle {
814                        inner: this.inner.clone(),
815                    };
816                    Ok(EchoHandleProtocolRequest::EchoHandleRequestReducedRights {h: req.h,
817
818                        responder: EchoHandleProtocolEchoHandleRequestReducedRightsResponder {
819                            control_handle: std::mem::ManuallyDrop::new(control_handle),
820                            tx_id: header.tx_id,
821                        },
822                    })
823                }
824                0x7bd6b869de1eb0b7 => {
825                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
826                    let mut req = fidl::new_empty!(EchoHandleProtocolEchoHandleRequestSameRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
827                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EchoHandleProtocolEchoHandleRequestSameRightsRequest>(&header, _body_bytes, handles, &mut req)?;
828                    let control_handle = EchoHandleProtocolControlHandle {
829                        inner: this.inner.clone(),
830                    };
831                    Ok(EchoHandleProtocolRequest::EchoHandleRequestSameRights {h: req.h,
832
833                        responder: EchoHandleProtocolEchoHandleRequestSameRightsResponder {
834                            control_handle: std::mem::ManuallyDrop::new(control_handle),
835                            tx_id: header.tx_id,
836                        },
837                    })
838                }
839                0x458d1c6d39e34f1e => {
840                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
841                    let mut req = fidl::new_empty!(EchoHandleProtocolEchoHandleResponseReducedRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
842                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EchoHandleProtocolEchoHandleResponseReducedRightsRequest>(&header, _body_bytes, handles, &mut req)?;
843                    let control_handle = EchoHandleProtocolControlHandle {
844                        inner: this.inner.clone(),
845                    };
846                    Ok(EchoHandleProtocolRequest::EchoHandleResponseReducedRights {h: req.h,
847
848                        responder: EchoHandleProtocolEchoHandleResponseReducedRightsResponder {
849                            control_handle: std::mem::ManuallyDrop::new(control_handle),
850                            tx_id: header.tx_id,
851                        },
852                    })
853                }
854                0x57334c827816fe5 => {
855                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
856                    let mut req = fidl::new_empty!(EchoHandleProtocolEchoHandleResponseSameRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
857                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EchoHandleProtocolEchoHandleResponseSameRightsRequest>(&header, _body_bytes, handles, &mut req)?;
858                    let control_handle = EchoHandleProtocolControlHandle {
859                        inner: this.inner.clone(),
860                    };
861                    Ok(EchoHandleProtocolRequest::EchoHandleResponseSameRights {h: req.h,
862
863                        responder: EchoHandleProtocolEchoHandleResponseSameRightsResponder {
864                            control_handle: std::mem::ManuallyDrop::new(control_handle),
865                            tx_id: header.tx_id,
866                        },
867                    })
868                }
869                _ => Err(fidl::Error::UnknownOrdinal {
870                    ordinal: header.ordinal,
871                    protocol_name: <EchoHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
872                }),
873            }))
874            },
875        )
876    }
877}
878
879#[derive(Debug)]
880pub enum EchoHandleProtocolRequest {
881    EchoHandleRequestResponseReducedRights {
882        h: fidl::Event,
883        responder: EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder,
884    },
885    EchoHandleRequestReducedRights {
886        h: fidl::Event,
887        responder: EchoHandleProtocolEchoHandleRequestReducedRightsResponder,
888    },
889    EchoHandleRequestSameRights {
890        h: fidl::Event,
891        responder: EchoHandleProtocolEchoHandleRequestSameRightsResponder,
892    },
893    EchoHandleResponseReducedRights {
894        h: fidl::Event,
895        responder: EchoHandleProtocolEchoHandleResponseReducedRightsResponder,
896    },
897    EchoHandleResponseSameRights {
898        h: fidl::Event,
899        responder: EchoHandleProtocolEchoHandleResponseSameRightsResponder,
900    },
901}
902
903impl EchoHandleProtocolRequest {
904    #[allow(irrefutable_let_patterns)]
905    pub fn into_echo_handle_request_response_reduced_rights(
906        self,
907    ) -> Option<(fidl::Event, EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder)>
908    {
909        if let EchoHandleProtocolRequest::EchoHandleRequestResponseReducedRights { h, responder } =
910            self
911        {
912            Some((h, responder))
913        } else {
914            None
915        }
916    }
917
918    #[allow(irrefutable_let_patterns)]
919    pub fn into_echo_handle_request_reduced_rights(
920        self,
921    ) -> Option<(fidl::Event, EchoHandleProtocolEchoHandleRequestReducedRightsResponder)> {
922        if let EchoHandleProtocolRequest::EchoHandleRequestReducedRights { h, responder } = self {
923            Some((h, responder))
924        } else {
925            None
926        }
927    }
928
929    #[allow(irrefutable_let_patterns)]
930    pub fn into_echo_handle_request_same_rights(
931        self,
932    ) -> Option<(fidl::Event, EchoHandleProtocolEchoHandleRequestSameRightsResponder)> {
933        if let EchoHandleProtocolRequest::EchoHandleRequestSameRights { h, responder } = self {
934            Some((h, responder))
935        } else {
936            None
937        }
938    }
939
940    #[allow(irrefutable_let_patterns)]
941    pub fn into_echo_handle_response_reduced_rights(
942        self,
943    ) -> Option<(fidl::Event, EchoHandleProtocolEchoHandleResponseReducedRightsResponder)> {
944        if let EchoHandleProtocolRequest::EchoHandleResponseReducedRights { h, responder } = self {
945            Some((h, responder))
946        } else {
947            None
948        }
949    }
950
951    #[allow(irrefutable_let_patterns)]
952    pub fn into_echo_handle_response_same_rights(
953        self,
954    ) -> Option<(fidl::Event, EchoHandleProtocolEchoHandleResponseSameRightsResponder)> {
955        if let EchoHandleProtocolRequest::EchoHandleResponseSameRights { h, responder } = self {
956            Some((h, responder))
957        } else {
958            None
959        }
960    }
961
962    /// Name of the method defined in FIDL
963    pub fn method_name(&self) -> &'static str {
964        match *self {
965            EchoHandleProtocolRequest::EchoHandleRequestResponseReducedRights { .. } => {
966                "echo_handle_request_response_reduced_rights"
967            }
968            EchoHandleProtocolRequest::EchoHandleRequestReducedRights { .. } => {
969                "echo_handle_request_reduced_rights"
970            }
971            EchoHandleProtocolRequest::EchoHandleRequestSameRights { .. } => {
972                "echo_handle_request_same_rights"
973            }
974            EchoHandleProtocolRequest::EchoHandleResponseReducedRights { .. } => {
975                "echo_handle_response_reduced_rights"
976            }
977            EchoHandleProtocolRequest::EchoHandleResponseSameRights { .. } => {
978                "echo_handle_response_same_rights"
979            }
980        }
981    }
982}
983
984#[derive(Debug, Clone)]
985pub struct EchoHandleProtocolControlHandle {
986    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
987}
988
989impl fidl::endpoints::ControlHandle for EchoHandleProtocolControlHandle {
990    fn shutdown(&self) {
991        self.inner.shutdown()
992    }
993    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
994        self.inner.shutdown_with_epitaph(status)
995    }
996
997    fn is_closed(&self) -> bool {
998        self.inner.channel().is_closed()
999    }
1000    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1001        self.inner.channel().on_closed()
1002    }
1003
1004    #[cfg(target_os = "fuchsia")]
1005    fn signal_peer(
1006        &self,
1007        clear_mask: zx::Signals,
1008        set_mask: zx::Signals,
1009    ) -> Result<(), zx_status::Status> {
1010        use fidl::Peered;
1011        self.inner.channel().signal_peer(clear_mask, set_mask)
1012    }
1013}
1014
1015impl EchoHandleProtocolControlHandle {}
1016
1017#[must_use = "FIDL methods require a response to be sent"]
1018#[derive(Debug)]
1019pub struct EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder {
1020    control_handle: std::mem::ManuallyDrop<EchoHandleProtocolControlHandle>,
1021    tx_id: u32,
1022}
1023
1024/// Set the the channel to be shutdown (see [`EchoHandleProtocolControlHandle::shutdown`])
1025/// if the responder is dropped without sending a response, so that the client
1026/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1027impl std::ops::Drop for EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder {
1028    fn drop(&mut self) {
1029        self.control_handle.shutdown();
1030        // Safety: drops once, never accessed again
1031        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1032    }
1033}
1034
1035impl fidl::endpoints::Responder
1036    for EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder
1037{
1038    type ControlHandle = EchoHandleProtocolControlHandle;
1039
1040    fn control_handle(&self) -> &EchoHandleProtocolControlHandle {
1041        &self.control_handle
1042    }
1043
1044    fn drop_without_shutdown(mut self) {
1045        // Safety: drops once, never accessed again due to mem::forget
1046        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1047        // Prevent Drop from running (which would shut down the channel)
1048        std::mem::forget(self);
1049    }
1050}
1051
1052impl EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponder {
1053    /// Sends a response to the FIDL transaction.
1054    ///
1055    /// Sets the channel to shutdown if an error occurs.
1056    pub fn send(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1057        let _result = self.send_raw(h);
1058        if _result.is_err() {
1059            self.control_handle.shutdown();
1060        }
1061        self.drop_without_shutdown();
1062        _result
1063    }
1064
1065    /// Similar to "send" but does not shutdown the channel if an error occurs.
1066    pub fn send_no_shutdown_on_err(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1067        let _result = self.send_raw(h);
1068        self.drop_without_shutdown();
1069        _result
1070    }
1071
1072    fn send_raw(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1073        self.control_handle
1074            .inner
1075            .send::<EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse>(
1076                (h,),
1077                self.tx_id,
1078                0x5c6c0f3032f3bcc6,
1079                fidl::encoding::DynamicFlags::empty(),
1080            )
1081    }
1082}
1083
1084#[must_use = "FIDL methods require a response to be sent"]
1085#[derive(Debug)]
1086pub struct EchoHandleProtocolEchoHandleRequestReducedRightsResponder {
1087    control_handle: std::mem::ManuallyDrop<EchoHandleProtocolControlHandle>,
1088    tx_id: u32,
1089}
1090
1091/// Set the the channel to be shutdown (see [`EchoHandleProtocolControlHandle::shutdown`])
1092/// if the responder is dropped without sending a response, so that the client
1093/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1094impl std::ops::Drop for EchoHandleProtocolEchoHandleRequestReducedRightsResponder {
1095    fn drop(&mut self) {
1096        self.control_handle.shutdown();
1097        // Safety: drops once, never accessed again
1098        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1099    }
1100}
1101
1102impl fidl::endpoints::Responder for EchoHandleProtocolEchoHandleRequestReducedRightsResponder {
1103    type ControlHandle = EchoHandleProtocolControlHandle;
1104
1105    fn control_handle(&self) -> &EchoHandleProtocolControlHandle {
1106        &self.control_handle
1107    }
1108
1109    fn drop_without_shutdown(mut self) {
1110        // Safety: drops once, never accessed again due to mem::forget
1111        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1112        // Prevent Drop from running (which would shut down the channel)
1113        std::mem::forget(self);
1114    }
1115}
1116
1117impl EchoHandleProtocolEchoHandleRequestReducedRightsResponder {
1118    /// Sends a response to the FIDL transaction.
1119    ///
1120    /// Sets the channel to shutdown if an error occurs.
1121    pub fn send(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1122        let _result = self.send_raw(h);
1123        if _result.is_err() {
1124            self.control_handle.shutdown();
1125        }
1126        self.drop_without_shutdown();
1127        _result
1128    }
1129
1130    /// Similar to "send" but does not shutdown the channel if an error occurs.
1131    pub fn send_no_shutdown_on_err(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1132        let _result = self.send_raw(h);
1133        self.drop_without_shutdown();
1134        _result
1135    }
1136
1137    fn send_raw(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1138        self.control_handle.inner.send::<EchoHandleProtocolEchoHandleRequestReducedRightsResponse>(
1139            (h,),
1140            self.tx_id,
1141            0x6f73455d31eb2f42,
1142            fidl::encoding::DynamicFlags::empty(),
1143        )
1144    }
1145}
1146
1147#[must_use = "FIDL methods require a response to be sent"]
1148#[derive(Debug)]
1149pub struct EchoHandleProtocolEchoHandleRequestSameRightsResponder {
1150    control_handle: std::mem::ManuallyDrop<EchoHandleProtocolControlHandle>,
1151    tx_id: u32,
1152}
1153
1154/// Set the the channel to be shutdown (see [`EchoHandleProtocolControlHandle::shutdown`])
1155/// if the responder is dropped without sending a response, so that the client
1156/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1157impl std::ops::Drop for EchoHandleProtocolEchoHandleRequestSameRightsResponder {
1158    fn drop(&mut self) {
1159        self.control_handle.shutdown();
1160        // Safety: drops once, never accessed again
1161        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1162    }
1163}
1164
1165impl fidl::endpoints::Responder for EchoHandleProtocolEchoHandleRequestSameRightsResponder {
1166    type ControlHandle = EchoHandleProtocolControlHandle;
1167
1168    fn control_handle(&self) -> &EchoHandleProtocolControlHandle {
1169        &self.control_handle
1170    }
1171
1172    fn drop_without_shutdown(mut self) {
1173        // Safety: drops once, never accessed again due to mem::forget
1174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1175        // Prevent Drop from running (which would shut down the channel)
1176        std::mem::forget(self);
1177    }
1178}
1179
1180impl EchoHandleProtocolEchoHandleRequestSameRightsResponder {
1181    /// Sends a response to the FIDL transaction.
1182    ///
1183    /// Sets the channel to shutdown if an error occurs.
1184    pub fn send(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1185        let _result = self.send_raw(h);
1186        if _result.is_err() {
1187            self.control_handle.shutdown();
1188        }
1189        self.drop_without_shutdown();
1190        _result
1191    }
1192
1193    /// Similar to "send" but does not shutdown the channel if an error occurs.
1194    pub fn send_no_shutdown_on_err(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1195        let _result = self.send_raw(h);
1196        self.drop_without_shutdown();
1197        _result
1198    }
1199
1200    fn send_raw(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1201        self.control_handle.inner.send::<EchoHandleProtocolEchoHandleRequestSameRightsResponse>(
1202            (h,),
1203            self.tx_id,
1204            0x7bd6b869de1eb0b7,
1205            fidl::encoding::DynamicFlags::empty(),
1206        )
1207    }
1208}
1209
1210#[must_use = "FIDL methods require a response to be sent"]
1211#[derive(Debug)]
1212pub struct EchoHandleProtocolEchoHandleResponseReducedRightsResponder {
1213    control_handle: std::mem::ManuallyDrop<EchoHandleProtocolControlHandle>,
1214    tx_id: u32,
1215}
1216
1217/// Set the the channel to be shutdown (see [`EchoHandleProtocolControlHandle::shutdown`])
1218/// if the responder is dropped without sending a response, so that the client
1219/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1220impl std::ops::Drop for EchoHandleProtocolEchoHandleResponseReducedRightsResponder {
1221    fn drop(&mut self) {
1222        self.control_handle.shutdown();
1223        // Safety: drops once, never accessed again
1224        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1225    }
1226}
1227
1228impl fidl::endpoints::Responder for EchoHandleProtocolEchoHandleResponseReducedRightsResponder {
1229    type ControlHandle = EchoHandleProtocolControlHandle;
1230
1231    fn control_handle(&self) -> &EchoHandleProtocolControlHandle {
1232        &self.control_handle
1233    }
1234
1235    fn drop_without_shutdown(mut self) {
1236        // Safety: drops once, never accessed again due to mem::forget
1237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1238        // Prevent Drop from running (which would shut down the channel)
1239        std::mem::forget(self);
1240    }
1241}
1242
1243impl EchoHandleProtocolEchoHandleResponseReducedRightsResponder {
1244    /// Sends a response to the FIDL transaction.
1245    ///
1246    /// Sets the channel to shutdown if an error occurs.
1247    pub fn send(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1248        let _result = self.send_raw(h);
1249        if _result.is_err() {
1250            self.control_handle.shutdown();
1251        }
1252        self.drop_without_shutdown();
1253        _result
1254    }
1255
1256    /// Similar to "send" but does not shutdown the channel if an error occurs.
1257    pub fn send_no_shutdown_on_err(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1258        let _result = self.send_raw(h);
1259        self.drop_without_shutdown();
1260        _result
1261    }
1262
1263    fn send_raw(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1264        self.control_handle.inner.send::<EchoHandleProtocolEchoHandleResponseReducedRightsResponse>(
1265            (h,),
1266            self.tx_id,
1267            0x458d1c6d39e34f1e,
1268            fidl::encoding::DynamicFlags::empty(),
1269        )
1270    }
1271}
1272
1273#[must_use = "FIDL methods require a response to be sent"]
1274#[derive(Debug)]
1275pub struct EchoHandleProtocolEchoHandleResponseSameRightsResponder {
1276    control_handle: std::mem::ManuallyDrop<EchoHandleProtocolControlHandle>,
1277    tx_id: u32,
1278}
1279
1280/// Set the the channel to be shutdown (see [`EchoHandleProtocolControlHandle::shutdown`])
1281/// if the responder is dropped without sending a response, so that the client
1282/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1283impl std::ops::Drop for EchoHandleProtocolEchoHandleResponseSameRightsResponder {
1284    fn drop(&mut self) {
1285        self.control_handle.shutdown();
1286        // Safety: drops once, never accessed again
1287        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1288    }
1289}
1290
1291impl fidl::endpoints::Responder for EchoHandleProtocolEchoHandleResponseSameRightsResponder {
1292    type ControlHandle = EchoHandleProtocolControlHandle;
1293
1294    fn control_handle(&self) -> &EchoHandleProtocolControlHandle {
1295        &self.control_handle
1296    }
1297
1298    fn drop_without_shutdown(mut self) {
1299        // Safety: drops once, never accessed again due to mem::forget
1300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1301        // Prevent Drop from running (which would shut down the channel)
1302        std::mem::forget(self);
1303    }
1304}
1305
1306impl EchoHandleProtocolEchoHandleResponseSameRightsResponder {
1307    /// Sends a response to the FIDL transaction.
1308    ///
1309    /// Sets the channel to shutdown if an error occurs.
1310    pub fn send(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1311        let _result = self.send_raw(h);
1312        if _result.is_err() {
1313            self.control_handle.shutdown();
1314        }
1315        self.drop_without_shutdown();
1316        _result
1317    }
1318
1319    /// Similar to "send" but does not shutdown the channel if an error occurs.
1320    pub fn send_no_shutdown_on_err(self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1321        let _result = self.send_raw(h);
1322        self.drop_without_shutdown();
1323        _result
1324    }
1325
1326    fn send_raw(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
1327        self.control_handle.inner.send::<EchoHandleProtocolEchoHandleResponseSameRightsResponse>(
1328            (h,),
1329            self.tx_id,
1330            0x57334c827816fe5,
1331            fidl::encoding::DynamicFlags::empty(),
1332        )
1333    }
1334}
1335
1336#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1337pub struct ErrorSyntaxProtocolMarker;
1338
1339impl fidl::endpoints::ProtocolMarker for ErrorSyntaxProtocolMarker {
1340    type Proxy = ErrorSyntaxProtocolProxy;
1341    type RequestStream = ErrorSyntaxProtocolRequestStream;
1342    #[cfg(target_os = "fuchsia")]
1343    type SynchronousProxy = ErrorSyntaxProtocolSynchronousProxy;
1344
1345    const DEBUG_NAME: &'static str = "(anonymous) ErrorSyntaxProtocol";
1346}
1347pub type ErrorSyntaxProtocolTestErrorSyntaxResult = Result<fidl::Event, u32>;
1348
1349pub trait ErrorSyntaxProtocolProxyInterface: Send + Sync {
1350    type TestErrorSyntaxResponseFut: std::future::Future<Output = Result<ErrorSyntaxProtocolTestErrorSyntaxResult, fidl::Error>>
1351        + Send;
1352    fn r#test_error_syntax(&self) -> Self::TestErrorSyntaxResponseFut;
1353}
1354#[derive(Debug)]
1355#[cfg(target_os = "fuchsia")]
1356pub struct ErrorSyntaxProtocolSynchronousProxy {
1357    client: fidl::client::sync::Client,
1358}
1359
1360#[cfg(target_os = "fuchsia")]
1361impl fidl::endpoints::SynchronousProxy for ErrorSyntaxProtocolSynchronousProxy {
1362    type Proxy = ErrorSyntaxProtocolProxy;
1363    type Protocol = ErrorSyntaxProtocolMarker;
1364
1365    fn from_channel(inner: fidl::Channel) -> Self {
1366        Self::new(inner)
1367    }
1368
1369    fn into_channel(self) -> fidl::Channel {
1370        self.client.into_channel()
1371    }
1372
1373    fn as_channel(&self) -> &fidl::Channel {
1374        self.client.as_channel()
1375    }
1376}
1377
1378#[cfg(target_os = "fuchsia")]
1379impl ErrorSyntaxProtocolSynchronousProxy {
1380    pub fn new(channel: fidl::Channel) -> Self {
1381        let protocol_name =
1382            <ErrorSyntaxProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1383        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1384    }
1385
1386    pub fn into_channel(self) -> fidl::Channel {
1387        self.client.into_channel()
1388    }
1389
1390    /// Waits until an event arrives and returns it. It is safe for other
1391    /// threads to make concurrent requests while waiting for an event.
1392    pub fn wait_for_event(
1393        &self,
1394        deadline: zx::MonotonicInstant,
1395    ) -> Result<ErrorSyntaxProtocolEvent, fidl::Error> {
1396        ErrorSyntaxProtocolEvent::decode(self.client.wait_for_event(deadline)?)
1397    }
1398
1399    pub fn r#test_error_syntax(
1400        &self,
1401        ___deadline: zx::MonotonicInstant,
1402    ) -> Result<ErrorSyntaxProtocolTestErrorSyntaxResult, fidl::Error> {
1403        let _response =
1404            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1405                ErrorSyntaxProtocolTestErrorSyntaxResponse,
1406                u32,
1407            >>(
1408                (),
1409                0x3fcbffd51b21cd91,
1410                fidl::encoding::DynamicFlags::empty(),
1411                ___deadline,
1412            )?;
1413        Ok(_response.map(|x| x.h))
1414    }
1415}
1416
1417#[cfg(target_os = "fuchsia")]
1418impl From<ErrorSyntaxProtocolSynchronousProxy> for zx::Handle {
1419    fn from(value: ErrorSyntaxProtocolSynchronousProxy) -> Self {
1420        value.into_channel().into()
1421    }
1422}
1423
1424#[cfg(target_os = "fuchsia")]
1425impl From<fidl::Channel> for ErrorSyntaxProtocolSynchronousProxy {
1426    fn from(value: fidl::Channel) -> Self {
1427        Self::new(value)
1428    }
1429}
1430
1431#[cfg(target_os = "fuchsia")]
1432impl fidl::endpoints::FromClient for ErrorSyntaxProtocolSynchronousProxy {
1433    type Protocol = ErrorSyntaxProtocolMarker;
1434
1435    fn from_client(value: fidl::endpoints::ClientEnd<ErrorSyntaxProtocolMarker>) -> Self {
1436        Self::new(value.into_channel())
1437    }
1438}
1439
1440#[derive(Debug, Clone)]
1441pub struct ErrorSyntaxProtocolProxy {
1442    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1443}
1444
1445impl fidl::endpoints::Proxy for ErrorSyntaxProtocolProxy {
1446    type Protocol = ErrorSyntaxProtocolMarker;
1447
1448    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1449        Self::new(inner)
1450    }
1451
1452    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1453        self.client.into_channel().map_err(|client| Self { client })
1454    }
1455
1456    fn as_channel(&self) -> &::fidl::AsyncChannel {
1457        self.client.as_channel()
1458    }
1459}
1460
1461impl ErrorSyntaxProtocolProxy {
1462    /// Create a new Proxy for test.external/ErrorSyntaxProtocol.
1463    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1464        let protocol_name =
1465            <ErrorSyntaxProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1466        Self { client: fidl::client::Client::new(channel, protocol_name) }
1467    }
1468
1469    /// Get a Stream of events from the remote end of the protocol.
1470    ///
1471    /// # Panics
1472    ///
1473    /// Panics if the event stream was already taken.
1474    pub fn take_event_stream(&self) -> ErrorSyntaxProtocolEventStream {
1475        ErrorSyntaxProtocolEventStream { event_receiver: self.client.take_event_receiver() }
1476    }
1477
1478    pub fn r#test_error_syntax(
1479        &self,
1480    ) -> fidl::client::QueryResponseFut<
1481        ErrorSyntaxProtocolTestErrorSyntaxResult,
1482        fidl::encoding::DefaultFuchsiaResourceDialect,
1483    > {
1484        ErrorSyntaxProtocolProxyInterface::r#test_error_syntax(self)
1485    }
1486}
1487
1488impl ErrorSyntaxProtocolProxyInterface for ErrorSyntaxProtocolProxy {
1489    type TestErrorSyntaxResponseFut = fidl::client::QueryResponseFut<
1490        ErrorSyntaxProtocolTestErrorSyntaxResult,
1491        fidl::encoding::DefaultFuchsiaResourceDialect,
1492    >;
1493    fn r#test_error_syntax(&self) -> Self::TestErrorSyntaxResponseFut {
1494        fn _decode(
1495            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1496        ) -> Result<ErrorSyntaxProtocolTestErrorSyntaxResult, fidl::Error> {
1497            let _response = fidl::client::decode_transaction_body::<
1498                fidl::encoding::ResultType<ErrorSyntaxProtocolTestErrorSyntaxResponse, u32>,
1499                fidl::encoding::DefaultFuchsiaResourceDialect,
1500                0x3fcbffd51b21cd91,
1501            >(_buf?)?;
1502            Ok(_response.map(|x| x.h))
1503        }
1504        self.client.send_query_and_decode::<
1505            fidl::encoding::EmptyPayload,
1506            ErrorSyntaxProtocolTestErrorSyntaxResult,
1507        >(
1508            (),
1509            0x3fcbffd51b21cd91,
1510            fidl::encoding::DynamicFlags::empty(),
1511            _decode,
1512        )
1513    }
1514}
1515
1516pub struct ErrorSyntaxProtocolEventStream {
1517    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1518}
1519
1520impl std::marker::Unpin for ErrorSyntaxProtocolEventStream {}
1521
1522impl futures::stream::FusedStream for ErrorSyntaxProtocolEventStream {
1523    fn is_terminated(&self) -> bool {
1524        self.event_receiver.is_terminated()
1525    }
1526}
1527
1528impl futures::Stream for ErrorSyntaxProtocolEventStream {
1529    type Item = Result<ErrorSyntaxProtocolEvent, fidl::Error>;
1530
1531    fn poll_next(
1532        mut self: std::pin::Pin<&mut Self>,
1533        cx: &mut std::task::Context<'_>,
1534    ) -> std::task::Poll<Option<Self::Item>> {
1535        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1536            &mut self.event_receiver,
1537            cx
1538        )?) {
1539            Some(buf) => std::task::Poll::Ready(Some(ErrorSyntaxProtocolEvent::decode(buf))),
1540            None => std::task::Poll::Ready(None),
1541        }
1542    }
1543}
1544
1545#[derive(Debug)]
1546pub enum ErrorSyntaxProtocolEvent {}
1547
1548impl ErrorSyntaxProtocolEvent {
1549    /// Decodes a message buffer as a [`ErrorSyntaxProtocolEvent`].
1550    fn decode(
1551        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1552    ) -> Result<ErrorSyntaxProtocolEvent, fidl::Error> {
1553        let (bytes, _handles) = buf.split_mut();
1554        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1555        debug_assert_eq!(tx_header.tx_id, 0);
1556        match tx_header.ordinal {
1557            _ => Err(fidl::Error::UnknownOrdinal {
1558                ordinal: tx_header.ordinal,
1559                protocol_name:
1560                    <ErrorSyntaxProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1561            }),
1562        }
1563    }
1564}
1565
1566/// A Stream of incoming requests for test.external/ErrorSyntaxProtocol.
1567pub struct ErrorSyntaxProtocolRequestStream {
1568    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1569    is_terminated: bool,
1570}
1571
1572impl std::marker::Unpin for ErrorSyntaxProtocolRequestStream {}
1573
1574impl futures::stream::FusedStream for ErrorSyntaxProtocolRequestStream {
1575    fn is_terminated(&self) -> bool {
1576        self.is_terminated
1577    }
1578}
1579
1580impl fidl::endpoints::RequestStream for ErrorSyntaxProtocolRequestStream {
1581    type Protocol = ErrorSyntaxProtocolMarker;
1582    type ControlHandle = ErrorSyntaxProtocolControlHandle;
1583
1584    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1585        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1586    }
1587
1588    fn control_handle(&self) -> Self::ControlHandle {
1589        ErrorSyntaxProtocolControlHandle { inner: self.inner.clone() }
1590    }
1591
1592    fn into_inner(
1593        self,
1594    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1595    {
1596        (self.inner, self.is_terminated)
1597    }
1598
1599    fn from_inner(
1600        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1601        is_terminated: bool,
1602    ) -> Self {
1603        Self { inner, is_terminated }
1604    }
1605}
1606
1607impl futures::Stream for ErrorSyntaxProtocolRequestStream {
1608    type Item = Result<ErrorSyntaxProtocolRequest, fidl::Error>;
1609
1610    fn poll_next(
1611        mut self: std::pin::Pin<&mut Self>,
1612        cx: &mut std::task::Context<'_>,
1613    ) -> std::task::Poll<Option<Self::Item>> {
1614        let this = &mut *self;
1615        if this.inner.check_shutdown(cx) {
1616            this.is_terminated = true;
1617            return std::task::Poll::Ready(None);
1618        }
1619        if this.is_terminated {
1620            panic!("polled ErrorSyntaxProtocolRequestStream after completion");
1621        }
1622        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1623            |bytes, handles| {
1624                match this.inner.channel().read_etc(cx, bytes, handles) {
1625                    std::task::Poll::Ready(Ok(())) => {}
1626                    std::task::Poll::Pending => return std::task::Poll::Pending,
1627                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1628                        this.is_terminated = true;
1629                        return std::task::Poll::Ready(None);
1630                    }
1631                    std::task::Poll::Ready(Err(e)) => {
1632                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1633                            e.into(),
1634                        ))))
1635                    }
1636                }
1637
1638                // A message has been received from the channel
1639                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1640
1641                std::task::Poll::Ready(Some(match header.ordinal {
1642                0x3fcbffd51b21cd91 => {
1643                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1644                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1645                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1646                    let control_handle = ErrorSyntaxProtocolControlHandle {
1647                        inner: this.inner.clone(),
1648                    };
1649                    Ok(ErrorSyntaxProtocolRequest::TestErrorSyntax {
1650                        responder: ErrorSyntaxProtocolTestErrorSyntaxResponder {
1651                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1652                            tx_id: header.tx_id,
1653                        },
1654                    })
1655                }
1656                _ => Err(fidl::Error::UnknownOrdinal {
1657                    ordinal: header.ordinal,
1658                    protocol_name: <ErrorSyntaxProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1659                }),
1660            }))
1661            },
1662        )
1663    }
1664}
1665
1666#[derive(Debug)]
1667pub enum ErrorSyntaxProtocolRequest {
1668    TestErrorSyntax { responder: ErrorSyntaxProtocolTestErrorSyntaxResponder },
1669}
1670
1671impl ErrorSyntaxProtocolRequest {
1672    #[allow(irrefutable_let_patterns)]
1673    pub fn into_test_error_syntax(self) -> Option<(ErrorSyntaxProtocolTestErrorSyntaxResponder)> {
1674        if let ErrorSyntaxProtocolRequest::TestErrorSyntax { responder } = self {
1675            Some((responder))
1676        } else {
1677            None
1678        }
1679    }
1680
1681    /// Name of the method defined in FIDL
1682    pub fn method_name(&self) -> &'static str {
1683        match *self {
1684            ErrorSyntaxProtocolRequest::TestErrorSyntax { .. } => "test_error_syntax",
1685        }
1686    }
1687}
1688
1689#[derive(Debug, Clone)]
1690pub struct ErrorSyntaxProtocolControlHandle {
1691    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1692}
1693
1694impl fidl::endpoints::ControlHandle for ErrorSyntaxProtocolControlHandle {
1695    fn shutdown(&self) {
1696        self.inner.shutdown()
1697    }
1698    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1699        self.inner.shutdown_with_epitaph(status)
1700    }
1701
1702    fn is_closed(&self) -> bool {
1703        self.inner.channel().is_closed()
1704    }
1705    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1706        self.inner.channel().on_closed()
1707    }
1708
1709    #[cfg(target_os = "fuchsia")]
1710    fn signal_peer(
1711        &self,
1712        clear_mask: zx::Signals,
1713        set_mask: zx::Signals,
1714    ) -> Result<(), zx_status::Status> {
1715        use fidl::Peered;
1716        self.inner.channel().signal_peer(clear_mask, set_mask)
1717    }
1718}
1719
1720impl ErrorSyntaxProtocolControlHandle {}
1721
1722#[must_use = "FIDL methods require a response to be sent"]
1723#[derive(Debug)]
1724pub struct ErrorSyntaxProtocolTestErrorSyntaxResponder {
1725    control_handle: std::mem::ManuallyDrop<ErrorSyntaxProtocolControlHandle>,
1726    tx_id: u32,
1727}
1728
1729/// Set the the channel to be shutdown (see [`ErrorSyntaxProtocolControlHandle::shutdown`])
1730/// if the responder is dropped without sending a response, so that the client
1731/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1732impl std::ops::Drop for ErrorSyntaxProtocolTestErrorSyntaxResponder {
1733    fn drop(&mut self) {
1734        self.control_handle.shutdown();
1735        // Safety: drops once, never accessed again
1736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1737    }
1738}
1739
1740impl fidl::endpoints::Responder for ErrorSyntaxProtocolTestErrorSyntaxResponder {
1741    type ControlHandle = ErrorSyntaxProtocolControlHandle;
1742
1743    fn control_handle(&self) -> &ErrorSyntaxProtocolControlHandle {
1744        &self.control_handle
1745    }
1746
1747    fn drop_without_shutdown(mut self) {
1748        // Safety: drops once, never accessed again due to mem::forget
1749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1750        // Prevent Drop from running (which would shut down the channel)
1751        std::mem::forget(self);
1752    }
1753}
1754
1755impl ErrorSyntaxProtocolTestErrorSyntaxResponder {
1756    /// Sends a response to the FIDL transaction.
1757    ///
1758    /// Sets the channel to shutdown if an error occurs.
1759    pub fn send(self, mut result: Result<fidl::Event, u32>) -> Result<(), fidl::Error> {
1760        let _result = self.send_raw(result);
1761        if _result.is_err() {
1762            self.control_handle.shutdown();
1763        }
1764        self.drop_without_shutdown();
1765        _result
1766    }
1767
1768    /// Similar to "send" but does not shutdown the channel if an error occurs.
1769    pub fn send_no_shutdown_on_err(
1770        self,
1771        mut result: Result<fidl::Event, u32>,
1772    ) -> Result<(), fidl::Error> {
1773        let _result = self.send_raw(result);
1774        self.drop_without_shutdown();
1775        _result
1776    }
1777
1778    fn send_raw(&self, mut result: Result<fidl::Event, u32>) -> Result<(), fidl::Error> {
1779        self.control_handle.inner.send::<fidl::encoding::ResultType<
1780            ErrorSyntaxProtocolTestErrorSyntaxResponse,
1781            u32,
1782        >>(
1783            result.map(|h| (h,)),
1784            self.tx_id,
1785            0x3fcbffd51b21cd91,
1786            fidl::encoding::DynamicFlags::empty(),
1787        )
1788    }
1789}
1790
1791#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1792pub struct PushEventProtocolMarker;
1793
1794impl fidl::endpoints::ProtocolMarker for PushEventProtocolMarker {
1795    type Proxy = PushEventProtocolProxy;
1796    type RequestStream = PushEventProtocolRequestStream;
1797    #[cfg(target_os = "fuchsia")]
1798    type SynchronousProxy = PushEventProtocolSynchronousProxy;
1799
1800    const DEBUG_NAME: &'static str = "(anonymous) PushEventProtocol";
1801}
1802
1803pub trait PushEventProtocolProxyInterface: Send + Sync {}
1804#[derive(Debug)]
1805#[cfg(target_os = "fuchsia")]
1806pub struct PushEventProtocolSynchronousProxy {
1807    client: fidl::client::sync::Client,
1808}
1809
1810#[cfg(target_os = "fuchsia")]
1811impl fidl::endpoints::SynchronousProxy for PushEventProtocolSynchronousProxy {
1812    type Proxy = PushEventProtocolProxy;
1813    type Protocol = PushEventProtocolMarker;
1814
1815    fn from_channel(inner: fidl::Channel) -> Self {
1816        Self::new(inner)
1817    }
1818
1819    fn into_channel(self) -> fidl::Channel {
1820        self.client.into_channel()
1821    }
1822
1823    fn as_channel(&self) -> &fidl::Channel {
1824        self.client.as_channel()
1825    }
1826}
1827
1828#[cfg(target_os = "fuchsia")]
1829impl PushEventProtocolSynchronousProxy {
1830    pub fn new(channel: fidl::Channel) -> Self {
1831        let protocol_name =
1832            <PushEventProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1833        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1834    }
1835
1836    pub fn into_channel(self) -> fidl::Channel {
1837        self.client.into_channel()
1838    }
1839
1840    /// Waits until an event arrives and returns it. It is safe for other
1841    /// threads to make concurrent requests while waiting for an event.
1842    pub fn wait_for_event(
1843        &self,
1844        deadline: zx::MonotonicInstant,
1845    ) -> Result<PushEventProtocolEvent, fidl::Error> {
1846        PushEventProtocolEvent::decode(self.client.wait_for_event(deadline)?)
1847    }
1848}
1849
1850#[cfg(target_os = "fuchsia")]
1851impl From<PushEventProtocolSynchronousProxy> for zx::Handle {
1852    fn from(value: PushEventProtocolSynchronousProxy) -> Self {
1853        value.into_channel().into()
1854    }
1855}
1856
1857#[cfg(target_os = "fuchsia")]
1858impl From<fidl::Channel> for PushEventProtocolSynchronousProxy {
1859    fn from(value: fidl::Channel) -> Self {
1860        Self::new(value)
1861    }
1862}
1863
1864#[cfg(target_os = "fuchsia")]
1865impl fidl::endpoints::FromClient for PushEventProtocolSynchronousProxy {
1866    type Protocol = PushEventProtocolMarker;
1867
1868    fn from_client(value: fidl::endpoints::ClientEnd<PushEventProtocolMarker>) -> Self {
1869        Self::new(value.into_channel())
1870    }
1871}
1872
1873#[derive(Debug, Clone)]
1874pub struct PushEventProtocolProxy {
1875    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1876}
1877
1878impl fidl::endpoints::Proxy for PushEventProtocolProxy {
1879    type Protocol = PushEventProtocolMarker;
1880
1881    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1882        Self::new(inner)
1883    }
1884
1885    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1886        self.client.into_channel().map_err(|client| Self { client })
1887    }
1888
1889    fn as_channel(&self) -> &::fidl::AsyncChannel {
1890        self.client.as_channel()
1891    }
1892}
1893
1894impl PushEventProtocolProxy {
1895    /// Create a new Proxy for test.external/PushEventProtocol.
1896    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1897        let protocol_name =
1898            <PushEventProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1899        Self { client: fidl::client::Client::new(channel, protocol_name) }
1900    }
1901
1902    /// Get a Stream of events from the remote end of the protocol.
1903    ///
1904    /// # Panics
1905    ///
1906    /// Panics if the event stream was already taken.
1907    pub fn take_event_stream(&self) -> PushEventProtocolEventStream {
1908        PushEventProtocolEventStream { event_receiver: self.client.take_event_receiver() }
1909    }
1910}
1911
1912impl PushEventProtocolProxyInterface for PushEventProtocolProxy {}
1913
1914pub struct PushEventProtocolEventStream {
1915    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1916}
1917
1918impl std::marker::Unpin for PushEventProtocolEventStream {}
1919
1920impl futures::stream::FusedStream for PushEventProtocolEventStream {
1921    fn is_terminated(&self) -> bool {
1922        self.event_receiver.is_terminated()
1923    }
1924}
1925
1926impl futures::Stream for PushEventProtocolEventStream {
1927    type Item = Result<PushEventProtocolEvent, fidl::Error>;
1928
1929    fn poll_next(
1930        mut self: std::pin::Pin<&mut Self>,
1931        cx: &mut std::task::Context<'_>,
1932    ) -> std::task::Poll<Option<Self::Item>> {
1933        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1934            &mut self.event_receiver,
1935            cx
1936        )?) {
1937            Some(buf) => std::task::Poll::Ready(Some(PushEventProtocolEvent::decode(buf))),
1938            None => std::task::Poll::Ready(None),
1939        }
1940    }
1941}
1942
1943#[derive(Debug)]
1944pub enum PushEventProtocolEvent {
1945    PushEventReducedRights { h: fidl::Event },
1946    PushEventSameRights { h: fidl::Event },
1947}
1948
1949impl PushEventProtocolEvent {
1950    #[allow(irrefutable_let_patterns)]
1951    pub fn into_push_event_reduced_rights(self) -> Option<fidl::Event> {
1952        if let PushEventProtocolEvent::PushEventReducedRights { h } = self {
1953            Some((h))
1954        } else {
1955            None
1956        }
1957    }
1958    #[allow(irrefutable_let_patterns)]
1959    pub fn into_push_event_same_rights(self) -> Option<fidl::Event> {
1960        if let PushEventProtocolEvent::PushEventSameRights { h } = self {
1961            Some((h))
1962        } else {
1963            None
1964        }
1965    }
1966
1967    /// Decodes a message buffer as a [`PushEventProtocolEvent`].
1968    fn decode(
1969        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1970    ) -> Result<PushEventProtocolEvent, fidl::Error> {
1971        let (bytes, _handles) = buf.split_mut();
1972        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1973        debug_assert_eq!(tx_header.tx_id, 0);
1974        match tx_header.ordinal {
1975            0x6f5a2e2e57c07079 => {
1976                let mut out = fidl::new_empty!(
1977                    PushEventProtocolPushEventReducedRightsRequest,
1978                    fidl::encoding::DefaultFuchsiaResourceDialect
1979                );
1980                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PushEventProtocolPushEventReducedRightsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1981                Ok((PushEventProtocolEvent::PushEventReducedRights { h: out.h }))
1982            }
1983            0x4fca4ce8755a1967 => {
1984                let mut out = fidl::new_empty!(
1985                    PushEventProtocolPushEventSameRightsRequest,
1986                    fidl::encoding::DefaultFuchsiaResourceDialect
1987                );
1988                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PushEventProtocolPushEventSameRightsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1989                Ok((PushEventProtocolEvent::PushEventSameRights { h: out.h }))
1990            }
1991            _ => Err(fidl::Error::UnknownOrdinal {
1992                ordinal: tx_header.ordinal,
1993                protocol_name:
1994                    <PushEventProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1995            }),
1996        }
1997    }
1998}
1999
2000/// A Stream of incoming requests for test.external/PushEventProtocol.
2001pub struct PushEventProtocolRequestStream {
2002    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2003    is_terminated: bool,
2004}
2005
2006impl std::marker::Unpin for PushEventProtocolRequestStream {}
2007
2008impl futures::stream::FusedStream for PushEventProtocolRequestStream {
2009    fn is_terminated(&self) -> bool {
2010        self.is_terminated
2011    }
2012}
2013
2014impl fidl::endpoints::RequestStream for PushEventProtocolRequestStream {
2015    type Protocol = PushEventProtocolMarker;
2016    type ControlHandle = PushEventProtocolControlHandle;
2017
2018    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2019        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2020    }
2021
2022    fn control_handle(&self) -> Self::ControlHandle {
2023        PushEventProtocolControlHandle { inner: self.inner.clone() }
2024    }
2025
2026    fn into_inner(
2027        self,
2028    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2029    {
2030        (self.inner, self.is_terminated)
2031    }
2032
2033    fn from_inner(
2034        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2035        is_terminated: bool,
2036    ) -> Self {
2037        Self { inner, is_terminated }
2038    }
2039}
2040
2041impl futures::Stream for PushEventProtocolRequestStream {
2042    type Item = Result<PushEventProtocolRequest, fidl::Error>;
2043
2044    fn poll_next(
2045        mut self: std::pin::Pin<&mut Self>,
2046        cx: &mut std::task::Context<'_>,
2047    ) -> std::task::Poll<Option<Self::Item>> {
2048        let this = &mut *self;
2049        if this.inner.check_shutdown(cx) {
2050            this.is_terminated = true;
2051            return std::task::Poll::Ready(None);
2052        }
2053        if this.is_terminated {
2054            panic!("polled PushEventProtocolRequestStream after completion");
2055        }
2056        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2057            |bytes, handles| {
2058                match this.inner.channel().read_etc(cx, bytes, handles) {
2059                    std::task::Poll::Ready(Ok(())) => {}
2060                    std::task::Poll::Pending => return std::task::Poll::Pending,
2061                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2062                        this.is_terminated = true;
2063                        return std::task::Poll::Ready(None);
2064                    }
2065                    std::task::Poll::Ready(Err(e)) => {
2066                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2067                            e.into(),
2068                        ))))
2069                    }
2070                }
2071
2072                // A message has been received from the channel
2073                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2074
2075                std::task::Poll::Ready(Some(match header.ordinal {
2076                    _ => Err(fidl::Error::UnknownOrdinal {
2077                        ordinal: header.ordinal,
2078                        protocol_name:
2079                            <PushEventProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2080                    }),
2081                }))
2082            },
2083        )
2084    }
2085}
2086
2087#[derive(Debug)]
2088pub enum PushEventProtocolRequest {}
2089
2090impl PushEventProtocolRequest {
2091    /// Name of the method defined in FIDL
2092    pub fn method_name(&self) -> &'static str {
2093        match *self {}
2094    }
2095}
2096
2097#[derive(Debug, Clone)]
2098pub struct PushEventProtocolControlHandle {
2099    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2100}
2101
2102impl fidl::endpoints::ControlHandle for PushEventProtocolControlHandle {
2103    fn shutdown(&self) {
2104        self.inner.shutdown()
2105    }
2106    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2107        self.inner.shutdown_with_epitaph(status)
2108    }
2109
2110    fn is_closed(&self) -> bool {
2111        self.inner.channel().is_closed()
2112    }
2113    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2114        self.inner.channel().on_closed()
2115    }
2116
2117    #[cfg(target_os = "fuchsia")]
2118    fn signal_peer(
2119        &self,
2120        clear_mask: zx::Signals,
2121        set_mask: zx::Signals,
2122    ) -> Result<(), zx_status::Status> {
2123        use fidl::Peered;
2124        self.inner.channel().signal_peer(clear_mask, set_mask)
2125    }
2126}
2127
2128impl PushEventProtocolControlHandle {
2129    pub fn send_push_event_reduced_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2130        self.inner.send::<PushEventProtocolPushEventReducedRightsRequest>(
2131            (h,),
2132            0,
2133            0x6f5a2e2e57c07079,
2134            fidl::encoding::DynamicFlags::empty(),
2135        )
2136    }
2137
2138    pub fn send_push_event_same_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2139        self.inner.send::<PushEventProtocolPushEventSameRightsRequest>(
2140            (h,),
2141            0,
2142            0x4fca4ce8755a1967,
2143            fidl::encoding::DynamicFlags::empty(),
2144        )
2145    }
2146}
2147
2148#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2149pub struct SendHandleProtocolMarker;
2150
2151impl fidl::endpoints::ProtocolMarker for SendHandleProtocolMarker {
2152    type Proxy = SendHandleProtocolProxy;
2153    type RequestStream = SendHandleProtocolRequestStream;
2154    #[cfg(target_os = "fuchsia")]
2155    type SynchronousProxy = SendHandleProtocolSynchronousProxy;
2156
2157    const DEBUG_NAME: &'static str = "(anonymous) SendHandleProtocol";
2158}
2159
2160pub trait SendHandleProtocolProxyInterface: Send + Sync {
2161    fn r#send_handle_reduced_rights(&self, h: fidl::Event) -> Result<(), fidl::Error>;
2162    fn r#send_handle_same_rights(&self, h: fidl::Event) -> Result<(), fidl::Error>;
2163}
2164#[derive(Debug)]
2165#[cfg(target_os = "fuchsia")]
2166pub struct SendHandleProtocolSynchronousProxy {
2167    client: fidl::client::sync::Client,
2168}
2169
2170#[cfg(target_os = "fuchsia")]
2171impl fidl::endpoints::SynchronousProxy for SendHandleProtocolSynchronousProxy {
2172    type Proxy = SendHandleProtocolProxy;
2173    type Protocol = SendHandleProtocolMarker;
2174
2175    fn from_channel(inner: fidl::Channel) -> Self {
2176        Self::new(inner)
2177    }
2178
2179    fn into_channel(self) -> fidl::Channel {
2180        self.client.into_channel()
2181    }
2182
2183    fn as_channel(&self) -> &fidl::Channel {
2184        self.client.as_channel()
2185    }
2186}
2187
2188#[cfg(target_os = "fuchsia")]
2189impl SendHandleProtocolSynchronousProxy {
2190    pub fn new(channel: fidl::Channel) -> Self {
2191        let protocol_name =
2192            <SendHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2193        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2194    }
2195
2196    pub fn into_channel(self) -> fidl::Channel {
2197        self.client.into_channel()
2198    }
2199
2200    /// Waits until an event arrives and returns it. It is safe for other
2201    /// threads to make concurrent requests while waiting for an event.
2202    pub fn wait_for_event(
2203        &self,
2204        deadline: zx::MonotonicInstant,
2205    ) -> Result<SendHandleProtocolEvent, fidl::Error> {
2206        SendHandleProtocolEvent::decode(self.client.wait_for_event(deadline)?)
2207    }
2208
2209    pub fn r#send_handle_reduced_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2210        self.client.send::<SendHandleProtocolSendHandleReducedRightsRequest>(
2211            (h,),
2212            0x7675407e0eb5f825,
2213            fidl::encoding::DynamicFlags::empty(),
2214        )
2215    }
2216
2217    pub fn r#send_handle_same_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2218        self.client.send::<SendHandleProtocolSendHandleSameRightsRequest>(
2219            (h,),
2220            0x1d43414e5560333a,
2221            fidl::encoding::DynamicFlags::empty(),
2222        )
2223    }
2224}
2225
2226#[cfg(target_os = "fuchsia")]
2227impl From<SendHandleProtocolSynchronousProxy> for zx::Handle {
2228    fn from(value: SendHandleProtocolSynchronousProxy) -> Self {
2229        value.into_channel().into()
2230    }
2231}
2232
2233#[cfg(target_os = "fuchsia")]
2234impl From<fidl::Channel> for SendHandleProtocolSynchronousProxy {
2235    fn from(value: fidl::Channel) -> Self {
2236        Self::new(value)
2237    }
2238}
2239
2240#[cfg(target_os = "fuchsia")]
2241impl fidl::endpoints::FromClient for SendHandleProtocolSynchronousProxy {
2242    type Protocol = SendHandleProtocolMarker;
2243
2244    fn from_client(value: fidl::endpoints::ClientEnd<SendHandleProtocolMarker>) -> Self {
2245        Self::new(value.into_channel())
2246    }
2247}
2248
2249#[derive(Debug, Clone)]
2250pub struct SendHandleProtocolProxy {
2251    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2252}
2253
2254impl fidl::endpoints::Proxy for SendHandleProtocolProxy {
2255    type Protocol = SendHandleProtocolMarker;
2256
2257    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2258        Self::new(inner)
2259    }
2260
2261    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2262        self.client.into_channel().map_err(|client| Self { client })
2263    }
2264
2265    fn as_channel(&self) -> &::fidl::AsyncChannel {
2266        self.client.as_channel()
2267    }
2268}
2269
2270impl SendHandleProtocolProxy {
2271    /// Create a new Proxy for test.external/SendHandleProtocol.
2272    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2273        let protocol_name =
2274            <SendHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2275        Self { client: fidl::client::Client::new(channel, protocol_name) }
2276    }
2277
2278    /// Get a Stream of events from the remote end of the protocol.
2279    ///
2280    /// # Panics
2281    ///
2282    /// Panics if the event stream was already taken.
2283    pub fn take_event_stream(&self) -> SendHandleProtocolEventStream {
2284        SendHandleProtocolEventStream { event_receiver: self.client.take_event_receiver() }
2285    }
2286
2287    pub fn r#send_handle_reduced_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2288        SendHandleProtocolProxyInterface::r#send_handle_reduced_rights(self, h)
2289    }
2290
2291    pub fn r#send_handle_same_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2292        SendHandleProtocolProxyInterface::r#send_handle_same_rights(self, h)
2293    }
2294}
2295
2296impl SendHandleProtocolProxyInterface for SendHandleProtocolProxy {
2297    fn r#send_handle_reduced_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2298        self.client.send::<SendHandleProtocolSendHandleReducedRightsRequest>(
2299            (h,),
2300            0x7675407e0eb5f825,
2301            fidl::encoding::DynamicFlags::empty(),
2302        )
2303    }
2304
2305    fn r#send_handle_same_rights(&self, mut h: fidl::Event) -> Result<(), fidl::Error> {
2306        self.client.send::<SendHandleProtocolSendHandleSameRightsRequest>(
2307            (h,),
2308            0x1d43414e5560333a,
2309            fidl::encoding::DynamicFlags::empty(),
2310        )
2311    }
2312}
2313
2314pub struct SendHandleProtocolEventStream {
2315    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2316}
2317
2318impl std::marker::Unpin for SendHandleProtocolEventStream {}
2319
2320impl futures::stream::FusedStream for SendHandleProtocolEventStream {
2321    fn is_terminated(&self) -> bool {
2322        self.event_receiver.is_terminated()
2323    }
2324}
2325
2326impl futures::Stream for SendHandleProtocolEventStream {
2327    type Item = Result<SendHandleProtocolEvent, fidl::Error>;
2328
2329    fn poll_next(
2330        mut self: std::pin::Pin<&mut Self>,
2331        cx: &mut std::task::Context<'_>,
2332    ) -> std::task::Poll<Option<Self::Item>> {
2333        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2334            &mut self.event_receiver,
2335            cx
2336        )?) {
2337            Some(buf) => std::task::Poll::Ready(Some(SendHandleProtocolEvent::decode(buf))),
2338            None => std::task::Poll::Ready(None),
2339        }
2340    }
2341}
2342
2343#[derive(Debug)]
2344pub enum SendHandleProtocolEvent {}
2345
2346impl SendHandleProtocolEvent {
2347    /// Decodes a message buffer as a [`SendHandleProtocolEvent`].
2348    fn decode(
2349        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2350    ) -> Result<SendHandleProtocolEvent, fidl::Error> {
2351        let (bytes, _handles) = buf.split_mut();
2352        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2353        debug_assert_eq!(tx_header.tx_id, 0);
2354        match tx_header.ordinal {
2355            _ => Err(fidl::Error::UnknownOrdinal {
2356                ordinal: tx_header.ordinal,
2357                protocol_name:
2358                    <SendHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2359            }),
2360        }
2361    }
2362}
2363
2364/// A Stream of incoming requests for test.external/SendHandleProtocol.
2365pub struct SendHandleProtocolRequestStream {
2366    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2367    is_terminated: bool,
2368}
2369
2370impl std::marker::Unpin for SendHandleProtocolRequestStream {}
2371
2372impl futures::stream::FusedStream for SendHandleProtocolRequestStream {
2373    fn is_terminated(&self) -> bool {
2374        self.is_terminated
2375    }
2376}
2377
2378impl fidl::endpoints::RequestStream for SendHandleProtocolRequestStream {
2379    type Protocol = SendHandleProtocolMarker;
2380    type ControlHandle = SendHandleProtocolControlHandle;
2381
2382    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2383        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2384    }
2385
2386    fn control_handle(&self) -> Self::ControlHandle {
2387        SendHandleProtocolControlHandle { inner: self.inner.clone() }
2388    }
2389
2390    fn into_inner(
2391        self,
2392    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2393    {
2394        (self.inner, self.is_terminated)
2395    }
2396
2397    fn from_inner(
2398        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2399        is_terminated: bool,
2400    ) -> Self {
2401        Self { inner, is_terminated }
2402    }
2403}
2404
2405impl futures::Stream for SendHandleProtocolRequestStream {
2406    type Item = Result<SendHandleProtocolRequest, fidl::Error>;
2407
2408    fn poll_next(
2409        mut self: std::pin::Pin<&mut Self>,
2410        cx: &mut std::task::Context<'_>,
2411    ) -> std::task::Poll<Option<Self::Item>> {
2412        let this = &mut *self;
2413        if this.inner.check_shutdown(cx) {
2414            this.is_terminated = true;
2415            return std::task::Poll::Ready(None);
2416        }
2417        if this.is_terminated {
2418            panic!("polled SendHandleProtocolRequestStream after completion");
2419        }
2420        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2421            |bytes, handles| {
2422                match this.inner.channel().read_etc(cx, bytes, handles) {
2423                    std::task::Poll::Ready(Ok(())) => {}
2424                    std::task::Poll::Pending => return std::task::Poll::Pending,
2425                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2426                        this.is_terminated = true;
2427                        return std::task::Poll::Ready(None);
2428                    }
2429                    std::task::Poll::Ready(Err(e)) => {
2430                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2431                            e.into(),
2432                        ))))
2433                    }
2434                }
2435
2436                // A message has been received from the channel
2437                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2438
2439                std::task::Poll::Ready(Some(match header.ordinal {
2440                0x7675407e0eb5f825 => {
2441                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2442                    let mut req = fidl::new_empty!(SendHandleProtocolSendHandleReducedRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2443                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SendHandleProtocolSendHandleReducedRightsRequest>(&header, _body_bytes, handles, &mut req)?;
2444                    let control_handle = SendHandleProtocolControlHandle {
2445                        inner: this.inner.clone(),
2446                    };
2447                    Ok(SendHandleProtocolRequest::SendHandleReducedRights {h: req.h,
2448
2449                        control_handle,
2450                    })
2451                }
2452                0x1d43414e5560333a => {
2453                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2454                    let mut req = fidl::new_empty!(SendHandleProtocolSendHandleSameRightsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2455                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SendHandleProtocolSendHandleSameRightsRequest>(&header, _body_bytes, handles, &mut req)?;
2456                    let control_handle = SendHandleProtocolControlHandle {
2457                        inner: this.inner.clone(),
2458                    };
2459                    Ok(SendHandleProtocolRequest::SendHandleSameRights {h: req.h,
2460
2461                        control_handle,
2462                    })
2463                }
2464                _ => Err(fidl::Error::UnknownOrdinal {
2465                    ordinal: header.ordinal,
2466                    protocol_name: <SendHandleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2467                }),
2468            }))
2469            },
2470        )
2471    }
2472}
2473
2474#[derive(Debug)]
2475pub enum SendHandleProtocolRequest {
2476    SendHandleReducedRights { h: fidl::Event, control_handle: SendHandleProtocolControlHandle },
2477    SendHandleSameRights { h: fidl::Event, control_handle: SendHandleProtocolControlHandle },
2478}
2479
2480impl SendHandleProtocolRequest {
2481    #[allow(irrefutable_let_patterns)]
2482    pub fn into_send_handle_reduced_rights(
2483        self,
2484    ) -> Option<(fidl::Event, SendHandleProtocolControlHandle)> {
2485        if let SendHandleProtocolRequest::SendHandleReducedRights { h, control_handle } = self {
2486            Some((h, control_handle))
2487        } else {
2488            None
2489        }
2490    }
2491
2492    #[allow(irrefutable_let_patterns)]
2493    pub fn into_send_handle_same_rights(
2494        self,
2495    ) -> Option<(fidl::Event, SendHandleProtocolControlHandle)> {
2496        if let SendHandleProtocolRequest::SendHandleSameRights { h, control_handle } = self {
2497            Some((h, control_handle))
2498        } else {
2499            None
2500        }
2501    }
2502
2503    /// Name of the method defined in FIDL
2504    pub fn method_name(&self) -> &'static str {
2505        match *self {
2506            SendHandleProtocolRequest::SendHandleReducedRights { .. } => {
2507                "send_handle_reduced_rights"
2508            }
2509            SendHandleProtocolRequest::SendHandleSameRights { .. } => "send_handle_same_rights",
2510        }
2511    }
2512}
2513
2514#[derive(Debug, Clone)]
2515pub struct SendHandleProtocolControlHandle {
2516    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2517}
2518
2519impl fidl::endpoints::ControlHandle for SendHandleProtocolControlHandle {
2520    fn shutdown(&self) {
2521        self.inner.shutdown()
2522    }
2523    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2524        self.inner.shutdown_with_epitaph(status)
2525    }
2526
2527    fn is_closed(&self) -> bool {
2528        self.inner.channel().is_closed()
2529    }
2530    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2531        self.inner.channel().on_closed()
2532    }
2533
2534    #[cfg(target_os = "fuchsia")]
2535    fn signal_peer(
2536        &self,
2537        clear_mask: zx::Signals,
2538        set_mask: zx::Signals,
2539    ) -> Result<(), zx_status::Status> {
2540        use fidl::Peered;
2541        self.inner.channel().signal_peer(clear_mask, set_mask)
2542    }
2543}
2544
2545impl SendHandleProtocolControlHandle {}
2546
2547mod internal {
2548    use super::*;
2549
2550    impl fidl::encoding::ResourceTypeMarker
2551        for EchoHandleProtocolEchoHandleRequestReducedRightsRequest
2552    {
2553        type Borrowed<'a> = &'a mut Self;
2554        fn take_or_borrow<'a>(
2555            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2556        ) -> Self::Borrowed<'a> {
2557            value
2558        }
2559    }
2560
2561    unsafe impl fidl::encoding::TypeMarker for EchoHandleProtocolEchoHandleRequestReducedRightsRequest {
2562        type Owned = Self;
2563
2564        #[inline(always)]
2565        fn inline_align(_context: fidl::encoding::Context) -> usize {
2566            4
2567        }
2568
2569        #[inline(always)]
2570        fn inline_size(_context: fidl::encoding::Context) -> usize {
2571            4
2572        }
2573    }
2574
2575    unsafe impl
2576        fidl::encoding::Encode<
2577            EchoHandleProtocolEchoHandleRequestReducedRightsRequest,
2578            fidl::encoding::DefaultFuchsiaResourceDialect,
2579        > for &mut EchoHandleProtocolEchoHandleRequestReducedRightsRequest
2580    {
2581        #[inline]
2582        unsafe fn encode(
2583            self,
2584            encoder: &mut fidl::encoding::Encoder<
2585                '_,
2586                fidl::encoding::DefaultFuchsiaResourceDialect,
2587            >,
2588            offset: usize,
2589            _depth: fidl::encoding::Depth,
2590        ) -> fidl::Result<()> {
2591            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestReducedRightsRequest>(
2592                offset,
2593            );
2594            // Delegate to tuple encoding.
2595            fidl::encoding::Encode::<
2596                EchoHandleProtocolEchoHandleRequestReducedRightsRequest,
2597                fidl::encoding::DefaultFuchsiaResourceDialect,
2598            >::encode(
2599                (<fidl::encoding::HandleType<
2600                    fidl::Event,
2601                    { fidl::ObjectType::EVENT.into_raw() },
2602                    2,
2603                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2604                    &mut self.h
2605                ),),
2606                encoder,
2607                offset,
2608                _depth,
2609            )
2610        }
2611    }
2612    unsafe impl<
2613            T0: fidl::encoding::Encode<
2614                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>,
2615                fidl::encoding::DefaultFuchsiaResourceDialect,
2616            >,
2617        >
2618        fidl::encoding::Encode<
2619            EchoHandleProtocolEchoHandleRequestReducedRightsRequest,
2620            fidl::encoding::DefaultFuchsiaResourceDialect,
2621        > for (T0,)
2622    {
2623        #[inline]
2624        unsafe fn encode(
2625            self,
2626            encoder: &mut fidl::encoding::Encoder<
2627                '_,
2628                fidl::encoding::DefaultFuchsiaResourceDialect,
2629            >,
2630            offset: usize,
2631            depth: fidl::encoding::Depth,
2632        ) -> fidl::Result<()> {
2633            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestReducedRightsRequest>(
2634                offset,
2635            );
2636            // Zero out padding regions. There's no need to apply masks
2637            // because the unmasked parts will be overwritten by fields.
2638            // Write the fields.
2639            self.0.encode(encoder, offset + 0, depth)?;
2640            Ok(())
2641        }
2642    }
2643
2644    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2645        for EchoHandleProtocolEchoHandleRequestReducedRightsRequest
2646    {
2647        #[inline(always)]
2648        fn new_empty() -> Self {
2649            Self {
2650                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
2651            }
2652        }
2653
2654        #[inline]
2655        unsafe fn decode(
2656            &mut self,
2657            decoder: &mut fidl::encoding::Decoder<
2658                '_,
2659                fidl::encoding::DefaultFuchsiaResourceDialect,
2660            >,
2661            offset: usize,
2662            _depth: fidl::encoding::Depth,
2663        ) -> fidl::Result<()> {
2664            decoder.debug_check_bounds::<Self>(offset);
2665            // Verify that padding bytes are zero.
2666            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
2667            Ok(())
2668        }
2669    }
2670
2671    impl fidl::encoding::ResourceTypeMarker
2672        for EchoHandleProtocolEchoHandleRequestReducedRightsResponse
2673    {
2674        type Borrowed<'a> = &'a mut Self;
2675        fn take_or_borrow<'a>(
2676            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2677        ) -> Self::Borrowed<'a> {
2678            value
2679        }
2680    }
2681
2682    unsafe impl fidl::encoding::TypeMarker
2683        for EchoHandleProtocolEchoHandleRequestReducedRightsResponse
2684    {
2685        type Owned = Self;
2686
2687        #[inline(always)]
2688        fn inline_align(_context: fidl::encoding::Context) -> usize {
2689            4
2690        }
2691
2692        #[inline(always)]
2693        fn inline_size(_context: fidl::encoding::Context) -> usize {
2694            4
2695        }
2696    }
2697
2698    unsafe impl
2699        fidl::encoding::Encode<
2700            EchoHandleProtocolEchoHandleRequestReducedRightsResponse,
2701            fidl::encoding::DefaultFuchsiaResourceDialect,
2702        > for &mut EchoHandleProtocolEchoHandleRequestReducedRightsResponse
2703    {
2704        #[inline]
2705        unsafe fn encode(
2706            self,
2707            encoder: &mut fidl::encoding::Encoder<
2708                '_,
2709                fidl::encoding::DefaultFuchsiaResourceDialect,
2710            >,
2711            offset: usize,
2712            _depth: fidl::encoding::Depth,
2713        ) -> fidl::Result<()> {
2714            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestReducedRightsResponse>(
2715                offset,
2716            );
2717            // Delegate to tuple encoding.
2718            fidl::encoding::Encode::<
2719                EchoHandleProtocolEchoHandleRequestReducedRightsResponse,
2720                fidl::encoding::DefaultFuchsiaResourceDialect,
2721            >::encode(
2722                (<fidl::encoding::HandleType<
2723                    fidl::Event,
2724                    { fidl::ObjectType::EVENT.into_raw() },
2725                    2147483648,
2726                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2727                    &mut self.h
2728                ),),
2729                encoder,
2730                offset,
2731                _depth,
2732            )
2733        }
2734    }
2735    unsafe impl<
2736            T0: fidl::encoding::Encode<
2737                fidl::encoding::HandleType<
2738                    fidl::Event,
2739                    { fidl::ObjectType::EVENT.into_raw() },
2740                    2147483648,
2741                >,
2742                fidl::encoding::DefaultFuchsiaResourceDialect,
2743            >,
2744        >
2745        fidl::encoding::Encode<
2746            EchoHandleProtocolEchoHandleRequestReducedRightsResponse,
2747            fidl::encoding::DefaultFuchsiaResourceDialect,
2748        > for (T0,)
2749    {
2750        #[inline]
2751        unsafe fn encode(
2752            self,
2753            encoder: &mut fidl::encoding::Encoder<
2754                '_,
2755                fidl::encoding::DefaultFuchsiaResourceDialect,
2756            >,
2757            offset: usize,
2758            depth: fidl::encoding::Depth,
2759        ) -> fidl::Result<()> {
2760            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestReducedRightsResponse>(
2761                offset,
2762            );
2763            // Zero out padding regions. There's no need to apply masks
2764            // because the unmasked parts will be overwritten by fields.
2765            // Write the fields.
2766            self.0.encode(encoder, offset + 0, depth)?;
2767            Ok(())
2768        }
2769    }
2770
2771    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2772        for EchoHandleProtocolEchoHandleRequestReducedRightsResponse
2773    {
2774        #[inline(always)]
2775        fn new_empty() -> Self {
2776            Self {
2777                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2778            }
2779        }
2780
2781        #[inline]
2782        unsafe fn decode(
2783            &mut self,
2784            decoder: &mut fidl::encoding::Decoder<
2785                '_,
2786                fidl::encoding::DefaultFuchsiaResourceDialect,
2787            >,
2788            offset: usize,
2789            _depth: fidl::encoding::Depth,
2790        ) -> fidl::Result<()> {
2791            decoder.debug_check_bounds::<Self>(offset);
2792            // Verify that padding bytes are zero.
2793            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
2794            Ok(())
2795        }
2796    }
2797
2798    impl fidl::encoding::ResourceTypeMarker
2799        for EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest
2800    {
2801        type Borrowed<'a> = &'a mut Self;
2802        fn take_or_borrow<'a>(
2803            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2804        ) -> Self::Borrowed<'a> {
2805            value
2806        }
2807    }
2808
2809    unsafe impl fidl::encoding::TypeMarker
2810        for EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest
2811    {
2812        type Owned = Self;
2813
2814        #[inline(always)]
2815        fn inline_align(_context: fidl::encoding::Context) -> usize {
2816            4
2817        }
2818
2819        #[inline(always)]
2820        fn inline_size(_context: fidl::encoding::Context) -> usize {
2821            4
2822        }
2823    }
2824
2825    unsafe impl
2826        fidl::encoding::Encode<
2827            EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest,
2828            fidl::encoding::DefaultFuchsiaResourceDialect,
2829        > for &mut EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest
2830    {
2831        #[inline]
2832        unsafe fn encode(
2833            self,
2834            encoder: &mut fidl::encoding::Encoder<
2835                '_,
2836                fidl::encoding::DefaultFuchsiaResourceDialect,
2837            >,
2838            offset: usize,
2839            _depth: fidl::encoding::Depth,
2840        ) -> fidl::Result<()> {
2841            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest>(offset);
2842            // Delegate to tuple encoding.
2843            fidl::encoding::Encode::<
2844                EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest,
2845                fidl::encoding::DefaultFuchsiaResourceDialect,
2846            >::encode(
2847                (<fidl::encoding::HandleType<
2848                    fidl::Event,
2849                    { fidl::ObjectType::EVENT.into_raw() },
2850                    3,
2851                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2852                    &mut self.h
2853                ),),
2854                encoder,
2855                offset,
2856                _depth,
2857            )
2858        }
2859    }
2860    unsafe impl<
2861            T0: fidl::encoding::Encode<
2862                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
2863                fidl::encoding::DefaultFuchsiaResourceDialect,
2864            >,
2865        >
2866        fidl::encoding::Encode<
2867            EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest,
2868            fidl::encoding::DefaultFuchsiaResourceDialect,
2869        > for (T0,)
2870    {
2871        #[inline]
2872        unsafe fn encode(
2873            self,
2874            encoder: &mut fidl::encoding::Encoder<
2875                '_,
2876                fidl::encoding::DefaultFuchsiaResourceDialect,
2877            >,
2878            offset: usize,
2879            depth: fidl::encoding::Depth,
2880        ) -> fidl::Result<()> {
2881            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest>(offset);
2882            // Zero out padding regions. There's no need to apply masks
2883            // because the unmasked parts will be overwritten by fields.
2884            // Write the fields.
2885            self.0.encode(encoder, offset + 0, depth)?;
2886            Ok(())
2887        }
2888    }
2889
2890    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2891        for EchoHandleProtocolEchoHandleRequestResponseReducedRightsRequest
2892    {
2893        #[inline(always)]
2894        fn new_empty() -> Self {
2895            Self {
2896                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
2897            }
2898        }
2899
2900        #[inline]
2901        unsafe fn decode(
2902            &mut self,
2903            decoder: &mut fidl::encoding::Decoder<
2904                '_,
2905                fidl::encoding::DefaultFuchsiaResourceDialect,
2906            >,
2907            offset: usize,
2908            _depth: fidl::encoding::Depth,
2909        ) -> fidl::Result<()> {
2910            decoder.debug_check_bounds::<Self>(offset);
2911            // Verify that padding bytes are zero.
2912            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
2913            Ok(())
2914        }
2915    }
2916
2917    impl fidl::encoding::ResourceTypeMarker
2918        for EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse
2919    {
2920        type Borrowed<'a> = &'a mut Self;
2921        fn take_or_borrow<'a>(
2922            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2923        ) -> Self::Borrowed<'a> {
2924            value
2925        }
2926    }
2927
2928    unsafe impl fidl::encoding::TypeMarker
2929        for EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse
2930    {
2931        type Owned = Self;
2932
2933        #[inline(always)]
2934        fn inline_align(_context: fidl::encoding::Context) -> usize {
2935            4
2936        }
2937
2938        #[inline(always)]
2939        fn inline_size(_context: fidl::encoding::Context) -> usize {
2940            4
2941        }
2942    }
2943
2944    unsafe impl
2945        fidl::encoding::Encode<
2946            EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse,
2947            fidl::encoding::DefaultFuchsiaResourceDialect,
2948        > for &mut EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse
2949    {
2950        #[inline]
2951        unsafe fn encode(
2952            self,
2953            encoder: &mut fidl::encoding::Encoder<
2954                '_,
2955                fidl::encoding::DefaultFuchsiaResourceDialect,
2956            >,
2957            offset: usize,
2958            _depth: fidl::encoding::Depth,
2959        ) -> fidl::Result<()> {
2960            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse>(offset);
2961            // Delegate to tuple encoding.
2962            fidl::encoding::Encode::<
2963                EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse,
2964                fidl::encoding::DefaultFuchsiaResourceDialect,
2965            >::encode(
2966                (<fidl::encoding::HandleType<
2967                    fidl::Event,
2968                    { fidl::ObjectType::EVENT.into_raw() },
2969                    2,
2970                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2971                    &mut self.h
2972                ),),
2973                encoder,
2974                offset,
2975                _depth,
2976            )
2977        }
2978    }
2979    unsafe impl<
2980            T0: fidl::encoding::Encode<
2981                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>,
2982                fidl::encoding::DefaultFuchsiaResourceDialect,
2983            >,
2984        >
2985        fidl::encoding::Encode<
2986            EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse,
2987            fidl::encoding::DefaultFuchsiaResourceDialect,
2988        > for (T0,)
2989    {
2990        #[inline]
2991        unsafe fn encode(
2992            self,
2993            encoder: &mut fidl::encoding::Encoder<
2994                '_,
2995                fidl::encoding::DefaultFuchsiaResourceDialect,
2996            >,
2997            offset: usize,
2998            depth: fidl::encoding::Depth,
2999        ) -> fidl::Result<()> {
3000            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse>(offset);
3001            // Zero out padding regions. There's no need to apply masks
3002            // because the unmasked parts will be overwritten by fields.
3003            // Write the fields.
3004            self.0.encode(encoder, offset + 0, depth)?;
3005            Ok(())
3006        }
3007    }
3008
3009    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3010        for EchoHandleProtocolEchoHandleRequestResponseReducedRightsResponse
3011    {
3012        #[inline(always)]
3013        fn new_empty() -> Self {
3014            Self {
3015                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
3016            }
3017        }
3018
3019        #[inline]
3020        unsafe fn decode(
3021            &mut self,
3022            decoder: &mut fidl::encoding::Decoder<
3023                '_,
3024                fidl::encoding::DefaultFuchsiaResourceDialect,
3025            >,
3026            offset: usize,
3027            _depth: fidl::encoding::Depth,
3028        ) -> fidl::Result<()> {
3029            decoder.debug_check_bounds::<Self>(offset);
3030            // Verify that padding bytes are zero.
3031            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3032            Ok(())
3033        }
3034    }
3035
3036    impl fidl::encoding::ResourceTypeMarker for EchoHandleProtocolEchoHandleRequestSameRightsRequest {
3037        type Borrowed<'a> = &'a mut Self;
3038        fn take_or_borrow<'a>(
3039            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3040        ) -> Self::Borrowed<'a> {
3041            value
3042        }
3043    }
3044
3045    unsafe impl fidl::encoding::TypeMarker for EchoHandleProtocolEchoHandleRequestSameRightsRequest {
3046        type Owned = Self;
3047
3048        #[inline(always)]
3049        fn inline_align(_context: fidl::encoding::Context) -> usize {
3050            4
3051        }
3052
3053        #[inline(always)]
3054        fn inline_size(_context: fidl::encoding::Context) -> usize {
3055            4
3056        }
3057    }
3058
3059    unsafe impl
3060        fidl::encoding::Encode<
3061            EchoHandleProtocolEchoHandleRequestSameRightsRequest,
3062            fidl::encoding::DefaultFuchsiaResourceDialect,
3063        > for &mut EchoHandleProtocolEchoHandleRequestSameRightsRequest
3064    {
3065        #[inline]
3066        unsafe fn encode(
3067            self,
3068            encoder: &mut fidl::encoding::Encoder<
3069                '_,
3070                fidl::encoding::DefaultFuchsiaResourceDialect,
3071            >,
3072            offset: usize,
3073            _depth: fidl::encoding::Depth,
3074        ) -> fidl::Result<()> {
3075            encoder
3076                .debug_check_bounds::<EchoHandleProtocolEchoHandleRequestSameRightsRequest>(offset);
3077            // Delegate to tuple encoding.
3078            fidl::encoding::Encode::<
3079                EchoHandleProtocolEchoHandleRequestSameRightsRequest,
3080                fidl::encoding::DefaultFuchsiaResourceDialect,
3081            >::encode(
3082                (<fidl::encoding::HandleType<
3083                    fidl::Event,
3084                    { fidl::ObjectType::EVENT.into_raw() },
3085                    2147483648,
3086                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3087                    &mut self.h
3088                ),),
3089                encoder,
3090                offset,
3091                _depth,
3092            )
3093        }
3094    }
3095    unsafe impl<
3096            T0: fidl::encoding::Encode<
3097                fidl::encoding::HandleType<
3098                    fidl::Event,
3099                    { fidl::ObjectType::EVENT.into_raw() },
3100                    2147483648,
3101                >,
3102                fidl::encoding::DefaultFuchsiaResourceDialect,
3103            >,
3104        >
3105        fidl::encoding::Encode<
3106            EchoHandleProtocolEchoHandleRequestSameRightsRequest,
3107            fidl::encoding::DefaultFuchsiaResourceDialect,
3108        > for (T0,)
3109    {
3110        #[inline]
3111        unsafe fn encode(
3112            self,
3113            encoder: &mut fidl::encoding::Encoder<
3114                '_,
3115                fidl::encoding::DefaultFuchsiaResourceDialect,
3116            >,
3117            offset: usize,
3118            depth: fidl::encoding::Depth,
3119        ) -> fidl::Result<()> {
3120            encoder
3121                .debug_check_bounds::<EchoHandleProtocolEchoHandleRequestSameRightsRequest>(offset);
3122            // Zero out padding regions. There's no need to apply masks
3123            // because the unmasked parts will be overwritten by fields.
3124            // Write the fields.
3125            self.0.encode(encoder, offset + 0, depth)?;
3126            Ok(())
3127        }
3128    }
3129
3130    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3131        for EchoHandleProtocolEchoHandleRequestSameRightsRequest
3132    {
3133        #[inline(always)]
3134        fn new_empty() -> Self {
3135            Self {
3136                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3137            }
3138        }
3139
3140        #[inline]
3141        unsafe fn decode(
3142            &mut self,
3143            decoder: &mut fidl::encoding::Decoder<
3144                '_,
3145                fidl::encoding::DefaultFuchsiaResourceDialect,
3146            >,
3147            offset: usize,
3148            _depth: fidl::encoding::Depth,
3149        ) -> fidl::Result<()> {
3150            decoder.debug_check_bounds::<Self>(offset);
3151            // Verify that padding bytes are zero.
3152            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3153            Ok(())
3154        }
3155    }
3156
3157    impl fidl::encoding::ResourceTypeMarker for EchoHandleProtocolEchoHandleRequestSameRightsResponse {
3158        type Borrowed<'a> = &'a mut Self;
3159        fn take_or_borrow<'a>(
3160            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3161        ) -> Self::Borrowed<'a> {
3162            value
3163        }
3164    }
3165
3166    unsafe impl fidl::encoding::TypeMarker for EchoHandleProtocolEchoHandleRequestSameRightsResponse {
3167        type Owned = Self;
3168
3169        #[inline(always)]
3170        fn inline_align(_context: fidl::encoding::Context) -> usize {
3171            4
3172        }
3173
3174        #[inline(always)]
3175        fn inline_size(_context: fidl::encoding::Context) -> usize {
3176            4
3177        }
3178    }
3179
3180    unsafe impl
3181        fidl::encoding::Encode<
3182            EchoHandleProtocolEchoHandleRequestSameRightsResponse,
3183            fidl::encoding::DefaultFuchsiaResourceDialect,
3184        > for &mut EchoHandleProtocolEchoHandleRequestSameRightsResponse
3185    {
3186        #[inline]
3187        unsafe fn encode(
3188            self,
3189            encoder: &mut fidl::encoding::Encoder<
3190                '_,
3191                fidl::encoding::DefaultFuchsiaResourceDialect,
3192            >,
3193            offset: usize,
3194            _depth: fidl::encoding::Depth,
3195        ) -> fidl::Result<()> {
3196            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestSameRightsResponse>(
3197                offset,
3198            );
3199            // Delegate to tuple encoding.
3200            fidl::encoding::Encode::<
3201                EchoHandleProtocolEchoHandleRequestSameRightsResponse,
3202                fidl::encoding::DefaultFuchsiaResourceDialect,
3203            >::encode(
3204                (<fidl::encoding::HandleType<
3205                    fidl::Event,
3206                    { fidl::ObjectType::EVENT.into_raw() },
3207                    2147483648,
3208                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3209                    &mut self.h
3210                ),),
3211                encoder,
3212                offset,
3213                _depth,
3214            )
3215        }
3216    }
3217    unsafe impl<
3218            T0: fidl::encoding::Encode<
3219                fidl::encoding::HandleType<
3220                    fidl::Event,
3221                    { fidl::ObjectType::EVENT.into_raw() },
3222                    2147483648,
3223                >,
3224                fidl::encoding::DefaultFuchsiaResourceDialect,
3225            >,
3226        >
3227        fidl::encoding::Encode<
3228            EchoHandleProtocolEchoHandleRequestSameRightsResponse,
3229            fidl::encoding::DefaultFuchsiaResourceDialect,
3230        > for (T0,)
3231    {
3232        #[inline]
3233        unsafe fn encode(
3234            self,
3235            encoder: &mut fidl::encoding::Encoder<
3236                '_,
3237                fidl::encoding::DefaultFuchsiaResourceDialect,
3238            >,
3239            offset: usize,
3240            depth: fidl::encoding::Depth,
3241        ) -> fidl::Result<()> {
3242            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleRequestSameRightsResponse>(
3243                offset,
3244            );
3245            // Zero out padding regions. There's no need to apply masks
3246            // because the unmasked parts will be overwritten by fields.
3247            // Write the fields.
3248            self.0.encode(encoder, offset + 0, depth)?;
3249            Ok(())
3250        }
3251    }
3252
3253    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3254        for EchoHandleProtocolEchoHandleRequestSameRightsResponse
3255    {
3256        #[inline(always)]
3257        fn new_empty() -> Self {
3258            Self {
3259                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3260            }
3261        }
3262
3263        #[inline]
3264        unsafe fn decode(
3265            &mut self,
3266            decoder: &mut fidl::encoding::Decoder<
3267                '_,
3268                fidl::encoding::DefaultFuchsiaResourceDialect,
3269            >,
3270            offset: usize,
3271            _depth: fidl::encoding::Depth,
3272        ) -> fidl::Result<()> {
3273            decoder.debug_check_bounds::<Self>(offset);
3274            // Verify that padding bytes are zero.
3275            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3276            Ok(())
3277        }
3278    }
3279
3280    impl fidl::encoding::ResourceTypeMarker
3281        for EchoHandleProtocolEchoHandleResponseReducedRightsRequest
3282    {
3283        type Borrowed<'a> = &'a mut Self;
3284        fn take_or_borrow<'a>(
3285            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3286        ) -> Self::Borrowed<'a> {
3287            value
3288        }
3289    }
3290
3291    unsafe impl fidl::encoding::TypeMarker
3292        for EchoHandleProtocolEchoHandleResponseReducedRightsRequest
3293    {
3294        type Owned = Self;
3295
3296        #[inline(always)]
3297        fn inline_align(_context: fidl::encoding::Context) -> usize {
3298            4
3299        }
3300
3301        #[inline(always)]
3302        fn inline_size(_context: fidl::encoding::Context) -> usize {
3303            4
3304        }
3305    }
3306
3307    unsafe impl
3308        fidl::encoding::Encode<
3309            EchoHandleProtocolEchoHandleResponseReducedRightsRequest,
3310            fidl::encoding::DefaultFuchsiaResourceDialect,
3311        > for &mut EchoHandleProtocolEchoHandleResponseReducedRightsRequest
3312    {
3313        #[inline]
3314        unsafe fn encode(
3315            self,
3316            encoder: &mut fidl::encoding::Encoder<
3317                '_,
3318                fidl::encoding::DefaultFuchsiaResourceDialect,
3319            >,
3320            offset: usize,
3321            _depth: fidl::encoding::Depth,
3322        ) -> fidl::Result<()> {
3323            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleResponseReducedRightsRequest>(
3324                offset,
3325            );
3326            // Delegate to tuple encoding.
3327            fidl::encoding::Encode::<
3328                EchoHandleProtocolEchoHandleResponseReducedRightsRequest,
3329                fidl::encoding::DefaultFuchsiaResourceDialect,
3330            >::encode(
3331                (<fidl::encoding::HandleType<
3332                    fidl::Event,
3333                    { fidl::ObjectType::EVENT.into_raw() },
3334                    2147483648,
3335                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3336                    &mut self.h
3337                ),),
3338                encoder,
3339                offset,
3340                _depth,
3341            )
3342        }
3343    }
3344    unsafe impl<
3345            T0: fidl::encoding::Encode<
3346                fidl::encoding::HandleType<
3347                    fidl::Event,
3348                    { fidl::ObjectType::EVENT.into_raw() },
3349                    2147483648,
3350                >,
3351                fidl::encoding::DefaultFuchsiaResourceDialect,
3352            >,
3353        >
3354        fidl::encoding::Encode<
3355            EchoHandleProtocolEchoHandleResponseReducedRightsRequest,
3356            fidl::encoding::DefaultFuchsiaResourceDialect,
3357        > for (T0,)
3358    {
3359        #[inline]
3360        unsafe fn encode(
3361            self,
3362            encoder: &mut fidl::encoding::Encoder<
3363                '_,
3364                fidl::encoding::DefaultFuchsiaResourceDialect,
3365            >,
3366            offset: usize,
3367            depth: fidl::encoding::Depth,
3368        ) -> fidl::Result<()> {
3369            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleResponseReducedRightsRequest>(
3370                offset,
3371            );
3372            // Zero out padding regions. There's no need to apply masks
3373            // because the unmasked parts will be overwritten by fields.
3374            // Write the fields.
3375            self.0.encode(encoder, offset + 0, depth)?;
3376            Ok(())
3377        }
3378    }
3379
3380    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3381        for EchoHandleProtocolEchoHandleResponseReducedRightsRequest
3382    {
3383        #[inline(always)]
3384        fn new_empty() -> Self {
3385            Self {
3386                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3387            }
3388        }
3389
3390        #[inline]
3391        unsafe fn decode(
3392            &mut self,
3393            decoder: &mut fidl::encoding::Decoder<
3394                '_,
3395                fidl::encoding::DefaultFuchsiaResourceDialect,
3396            >,
3397            offset: usize,
3398            _depth: fidl::encoding::Depth,
3399        ) -> fidl::Result<()> {
3400            decoder.debug_check_bounds::<Self>(offset);
3401            // Verify that padding bytes are zero.
3402            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3403            Ok(())
3404        }
3405    }
3406
3407    impl fidl::encoding::ResourceTypeMarker
3408        for EchoHandleProtocolEchoHandleResponseReducedRightsResponse
3409    {
3410        type Borrowed<'a> = &'a mut Self;
3411        fn take_or_borrow<'a>(
3412            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3413        ) -> Self::Borrowed<'a> {
3414            value
3415        }
3416    }
3417
3418    unsafe impl fidl::encoding::TypeMarker
3419        for EchoHandleProtocolEchoHandleResponseReducedRightsResponse
3420    {
3421        type Owned = Self;
3422
3423        #[inline(always)]
3424        fn inline_align(_context: fidl::encoding::Context) -> usize {
3425            4
3426        }
3427
3428        #[inline(always)]
3429        fn inline_size(_context: fidl::encoding::Context) -> usize {
3430            4
3431        }
3432    }
3433
3434    unsafe impl
3435        fidl::encoding::Encode<
3436            EchoHandleProtocolEchoHandleResponseReducedRightsResponse,
3437            fidl::encoding::DefaultFuchsiaResourceDialect,
3438        > for &mut EchoHandleProtocolEchoHandleResponseReducedRightsResponse
3439    {
3440        #[inline]
3441        unsafe fn encode(
3442            self,
3443            encoder: &mut fidl::encoding::Encoder<
3444                '_,
3445                fidl::encoding::DefaultFuchsiaResourceDialect,
3446            >,
3447            offset: usize,
3448            _depth: fidl::encoding::Depth,
3449        ) -> fidl::Result<()> {
3450            encoder
3451                .debug_check_bounds::<EchoHandleProtocolEchoHandleResponseReducedRightsResponse>(
3452                    offset,
3453                );
3454            // Delegate to tuple encoding.
3455            fidl::encoding::Encode::<
3456                EchoHandleProtocolEchoHandleResponseReducedRightsResponse,
3457                fidl::encoding::DefaultFuchsiaResourceDialect,
3458            >::encode(
3459                (<fidl::encoding::HandleType<
3460                    fidl::Event,
3461                    { fidl::ObjectType::EVENT.into_raw() },
3462                    2,
3463                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3464                    &mut self.h
3465                ),),
3466                encoder,
3467                offset,
3468                _depth,
3469            )
3470        }
3471    }
3472    unsafe impl<
3473            T0: fidl::encoding::Encode<
3474                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>,
3475                fidl::encoding::DefaultFuchsiaResourceDialect,
3476            >,
3477        >
3478        fidl::encoding::Encode<
3479            EchoHandleProtocolEchoHandleResponseReducedRightsResponse,
3480            fidl::encoding::DefaultFuchsiaResourceDialect,
3481        > for (T0,)
3482    {
3483        #[inline]
3484        unsafe fn encode(
3485            self,
3486            encoder: &mut fidl::encoding::Encoder<
3487                '_,
3488                fidl::encoding::DefaultFuchsiaResourceDialect,
3489            >,
3490            offset: usize,
3491            depth: fidl::encoding::Depth,
3492        ) -> fidl::Result<()> {
3493            encoder
3494                .debug_check_bounds::<EchoHandleProtocolEchoHandleResponseReducedRightsResponse>(
3495                    offset,
3496                );
3497            // Zero out padding regions. There's no need to apply masks
3498            // because the unmasked parts will be overwritten by fields.
3499            // Write the fields.
3500            self.0.encode(encoder, offset + 0, depth)?;
3501            Ok(())
3502        }
3503    }
3504
3505    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3506        for EchoHandleProtocolEchoHandleResponseReducedRightsResponse
3507    {
3508        #[inline(always)]
3509        fn new_empty() -> Self {
3510            Self {
3511                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
3512            }
3513        }
3514
3515        #[inline]
3516        unsafe fn decode(
3517            &mut self,
3518            decoder: &mut fidl::encoding::Decoder<
3519                '_,
3520                fidl::encoding::DefaultFuchsiaResourceDialect,
3521            >,
3522            offset: usize,
3523            _depth: fidl::encoding::Depth,
3524        ) -> fidl::Result<()> {
3525            decoder.debug_check_bounds::<Self>(offset);
3526            // Verify that padding bytes are zero.
3527            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3528            Ok(())
3529        }
3530    }
3531
3532    impl fidl::encoding::ResourceTypeMarker for EchoHandleProtocolEchoHandleResponseSameRightsRequest {
3533        type Borrowed<'a> = &'a mut Self;
3534        fn take_or_borrow<'a>(
3535            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3536        ) -> Self::Borrowed<'a> {
3537            value
3538        }
3539    }
3540
3541    unsafe impl fidl::encoding::TypeMarker for EchoHandleProtocolEchoHandleResponseSameRightsRequest {
3542        type Owned = Self;
3543
3544        #[inline(always)]
3545        fn inline_align(_context: fidl::encoding::Context) -> usize {
3546            4
3547        }
3548
3549        #[inline(always)]
3550        fn inline_size(_context: fidl::encoding::Context) -> usize {
3551            4
3552        }
3553    }
3554
3555    unsafe impl
3556        fidl::encoding::Encode<
3557            EchoHandleProtocolEchoHandleResponseSameRightsRequest,
3558            fidl::encoding::DefaultFuchsiaResourceDialect,
3559        > for &mut EchoHandleProtocolEchoHandleResponseSameRightsRequest
3560    {
3561        #[inline]
3562        unsafe fn encode(
3563            self,
3564            encoder: &mut fidl::encoding::Encoder<
3565                '_,
3566                fidl::encoding::DefaultFuchsiaResourceDialect,
3567            >,
3568            offset: usize,
3569            _depth: fidl::encoding::Depth,
3570        ) -> fidl::Result<()> {
3571            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleResponseSameRightsRequest>(
3572                offset,
3573            );
3574            // Delegate to tuple encoding.
3575            fidl::encoding::Encode::<
3576                EchoHandleProtocolEchoHandleResponseSameRightsRequest,
3577                fidl::encoding::DefaultFuchsiaResourceDialect,
3578            >::encode(
3579                (<fidl::encoding::HandleType<
3580                    fidl::Event,
3581                    { fidl::ObjectType::EVENT.into_raw() },
3582                    2147483648,
3583                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3584                    &mut self.h
3585                ),),
3586                encoder,
3587                offset,
3588                _depth,
3589            )
3590        }
3591    }
3592    unsafe impl<
3593            T0: fidl::encoding::Encode<
3594                fidl::encoding::HandleType<
3595                    fidl::Event,
3596                    { fidl::ObjectType::EVENT.into_raw() },
3597                    2147483648,
3598                >,
3599                fidl::encoding::DefaultFuchsiaResourceDialect,
3600            >,
3601        >
3602        fidl::encoding::Encode<
3603            EchoHandleProtocolEchoHandleResponseSameRightsRequest,
3604            fidl::encoding::DefaultFuchsiaResourceDialect,
3605        > for (T0,)
3606    {
3607        #[inline]
3608        unsafe fn encode(
3609            self,
3610            encoder: &mut fidl::encoding::Encoder<
3611                '_,
3612                fidl::encoding::DefaultFuchsiaResourceDialect,
3613            >,
3614            offset: usize,
3615            depth: fidl::encoding::Depth,
3616        ) -> fidl::Result<()> {
3617            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleResponseSameRightsRequest>(
3618                offset,
3619            );
3620            // Zero out padding regions. There's no need to apply masks
3621            // because the unmasked parts will be overwritten by fields.
3622            // Write the fields.
3623            self.0.encode(encoder, offset + 0, depth)?;
3624            Ok(())
3625        }
3626    }
3627
3628    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3629        for EchoHandleProtocolEchoHandleResponseSameRightsRequest
3630    {
3631        #[inline(always)]
3632        fn new_empty() -> Self {
3633            Self {
3634                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3635            }
3636        }
3637
3638        #[inline]
3639        unsafe fn decode(
3640            &mut self,
3641            decoder: &mut fidl::encoding::Decoder<
3642                '_,
3643                fidl::encoding::DefaultFuchsiaResourceDialect,
3644            >,
3645            offset: usize,
3646            _depth: fidl::encoding::Depth,
3647        ) -> fidl::Result<()> {
3648            decoder.debug_check_bounds::<Self>(offset);
3649            // Verify that padding bytes are zero.
3650            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3651            Ok(())
3652        }
3653    }
3654
3655    impl fidl::encoding::ResourceTypeMarker for EchoHandleProtocolEchoHandleResponseSameRightsResponse {
3656        type Borrowed<'a> = &'a mut Self;
3657        fn take_or_borrow<'a>(
3658            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3659        ) -> Self::Borrowed<'a> {
3660            value
3661        }
3662    }
3663
3664    unsafe impl fidl::encoding::TypeMarker for EchoHandleProtocolEchoHandleResponseSameRightsResponse {
3665        type Owned = Self;
3666
3667        #[inline(always)]
3668        fn inline_align(_context: fidl::encoding::Context) -> usize {
3669            4
3670        }
3671
3672        #[inline(always)]
3673        fn inline_size(_context: fidl::encoding::Context) -> usize {
3674            4
3675        }
3676    }
3677
3678    unsafe impl
3679        fidl::encoding::Encode<
3680            EchoHandleProtocolEchoHandleResponseSameRightsResponse,
3681            fidl::encoding::DefaultFuchsiaResourceDialect,
3682        > for &mut EchoHandleProtocolEchoHandleResponseSameRightsResponse
3683    {
3684        #[inline]
3685        unsafe fn encode(
3686            self,
3687            encoder: &mut fidl::encoding::Encoder<
3688                '_,
3689                fidl::encoding::DefaultFuchsiaResourceDialect,
3690            >,
3691            offset: usize,
3692            _depth: fidl::encoding::Depth,
3693        ) -> fidl::Result<()> {
3694            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleResponseSameRightsResponse>(
3695                offset,
3696            );
3697            // Delegate to tuple encoding.
3698            fidl::encoding::Encode::<
3699                EchoHandleProtocolEchoHandleResponseSameRightsResponse,
3700                fidl::encoding::DefaultFuchsiaResourceDialect,
3701            >::encode(
3702                (<fidl::encoding::HandleType<
3703                    fidl::Event,
3704                    { fidl::ObjectType::EVENT.into_raw() },
3705                    2147483648,
3706                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3707                    &mut self.h
3708                ),),
3709                encoder,
3710                offset,
3711                _depth,
3712            )
3713        }
3714    }
3715    unsafe impl<
3716            T0: fidl::encoding::Encode<
3717                fidl::encoding::HandleType<
3718                    fidl::Event,
3719                    { fidl::ObjectType::EVENT.into_raw() },
3720                    2147483648,
3721                >,
3722                fidl::encoding::DefaultFuchsiaResourceDialect,
3723            >,
3724        >
3725        fidl::encoding::Encode<
3726            EchoHandleProtocolEchoHandleResponseSameRightsResponse,
3727            fidl::encoding::DefaultFuchsiaResourceDialect,
3728        > for (T0,)
3729    {
3730        #[inline]
3731        unsafe fn encode(
3732            self,
3733            encoder: &mut fidl::encoding::Encoder<
3734                '_,
3735                fidl::encoding::DefaultFuchsiaResourceDialect,
3736            >,
3737            offset: usize,
3738            depth: fidl::encoding::Depth,
3739        ) -> fidl::Result<()> {
3740            encoder.debug_check_bounds::<EchoHandleProtocolEchoHandleResponseSameRightsResponse>(
3741                offset,
3742            );
3743            // Zero out padding regions. There's no need to apply masks
3744            // because the unmasked parts will be overwritten by fields.
3745            // Write the fields.
3746            self.0.encode(encoder, offset + 0, depth)?;
3747            Ok(())
3748        }
3749    }
3750
3751    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3752        for EchoHandleProtocolEchoHandleResponseSameRightsResponse
3753    {
3754        #[inline(always)]
3755        fn new_empty() -> Self {
3756            Self {
3757                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3758            }
3759        }
3760
3761        #[inline]
3762        unsafe fn decode(
3763            &mut self,
3764            decoder: &mut fidl::encoding::Decoder<
3765                '_,
3766                fidl::encoding::DefaultFuchsiaResourceDialect,
3767            >,
3768            offset: usize,
3769            _depth: fidl::encoding::Depth,
3770        ) -> fidl::Result<()> {
3771            decoder.debug_check_bounds::<Self>(offset);
3772            // Verify that padding bytes are zero.
3773            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3774            Ok(())
3775        }
3776    }
3777
3778    impl fidl::encoding::ResourceTypeMarker for ErrorSyntaxProtocolTestErrorSyntaxResponse {
3779        type Borrowed<'a> = &'a mut Self;
3780        fn take_or_borrow<'a>(
3781            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3782        ) -> Self::Borrowed<'a> {
3783            value
3784        }
3785    }
3786
3787    unsafe impl fidl::encoding::TypeMarker for ErrorSyntaxProtocolTestErrorSyntaxResponse {
3788        type Owned = Self;
3789
3790        #[inline(always)]
3791        fn inline_align(_context: fidl::encoding::Context) -> usize {
3792            4
3793        }
3794
3795        #[inline(always)]
3796        fn inline_size(_context: fidl::encoding::Context) -> usize {
3797            4
3798        }
3799    }
3800
3801    unsafe impl
3802        fidl::encoding::Encode<
3803            ErrorSyntaxProtocolTestErrorSyntaxResponse,
3804            fidl::encoding::DefaultFuchsiaResourceDialect,
3805        > for &mut ErrorSyntaxProtocolTestErrorSyntaxResponse
3806    {
3807        #[inline]
3808        unsafe fn encode(
3809            self,
3810            encoder: &mut fidl::encoding::Encoder<
3811                '_,
3812                fidl::encoding::DefaultFuchsiaResourceDialect,
3813            >,
3814            offset: usize,
3815            _depth: fidl::encoding::Depth,
3816        ) -> fidl::Result<()> {
3817            encoder.debug_check_bounds::<ErrorSyntaxProtocolTestErrorSyntaxResponse>(offset);
3818            // Delegate to tuple encoding.
3819            fidl::encoding::Encode::<
3820                ErrorSyntaxProtocolTestErrorSyntaxResponse,
3821                fidl::encoding::DefaultFuchsiaResourceDialect,
3822            >::encode(
3823                (<fidl::encoding::HandleType<
3824                    fidl::Event,
3825                    { fidl::ObjectType::EVENT.into_raw() },
3826                    2,
3827                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3828                    &mut self.h
3829                ),),
3830                encoder,
3831                offset,
3832                _depth,
3833            )
3834        }
3835    }
3836    unsafe impl<
3837            T0: fidl::encoding::Encode<
3838                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>,
3839                fidl::encoding::DefaultFuchsiaResourceDialect,
3840            >,
3841        >
3842        fidl::encoding::Encode<
3843            ErrorSyntaxProtocolTestErrorSyntaxResponse,
3844            fidl::encoding::DefaultFuchsiaResourceDialect,
3845        > for (T0,)
3846    {
3847        #[inline]
3848        unsafe fn encode(
3849            self,
3850            encoder: &mut fidl::encoding::Encoder<
3851                '_,
3852                fidl::encoding::DefaultFuchsiaResourceDialect,
3853            >,
3854            offset: usize,
3855            depth: fidl::encoding::Depth,
3856        ) -> fidl::Result<()> {
3857            encoder.debug_check_bounds::<ErrorSyntaxProtocolTestErrorSyntaxResponse>(offset);
3858            // Zero out padding regions. There's no need to apply masks
3859            // because the unmasked parts will be overwritten by fields.
3860            // Write the fields.
3861            self.0.encode(encoder, offset + 0, depth)?;
3862            Ok(())
3863        }
3864    }
3865
3866    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3867        for ErrorSyntaxProtocolTestErrorSyntaxResponse
3868    {
3869        #[inline(always)]
3870        fn new_empty() -> Self {
3871            Self {
3872                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
3873            }
3874        }
3875
3876        #[inline]
3877        unsafe fn decode(
3878            &mut self,
3879            decoder: &mut fidl::encoding::Decoder<
3880                '_,
3881                fidl::encoding::DefaultFuchsiaResourceDialect,
3882            >,
3883            offset: usize,
3884            _depth: fidl::encoding::Depth,
3885        ) -> fidl::Result<()> {
3886            decoder.debug_check_bounds::<Self>(offset);
3887            // Verify that padding bytes are zero.
3888            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
3889            Ok(())
3890        }
3891    }
3892
3893    impl fidl::encoding::ResourceTypeMarker for PushEventProtocolPushEventReducedRightsRequest {
3894        type Borrowed<'a> = &'a mut Self;
3895        fn take_or_borrow<'a>(
3896            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3897        ) -> Self::Borrowed<'a> {
3898            value
3899        }
3900    }
3901
3902    unsafe impl fidl::encoding::TypeMarker for PushEventProtocolPushEventReducedRightsRequest {
3903        type Owned = Self;
3904
3905        #[inline(always)]
3906        fn inline_align(_context: fidl::encoding::Context) -> usize {
3907            4
3908        }
3909
3910        #[inline(always)]
3911        fn inline_size(_context: fidl::encoding::Context) -> usize {
3912            4
3913        }
3914    }
3915
3916    unsafe impl
3917        fidl::encoding::Encode<
3918            PushEventProtocolPushEventReducedRightsRequest,
3919            fidl::encoding::DefaultFuchsiaResourceDialect,
3920        > for &mut PushEventProtocolPushEventReducedRightsRequest
3921    {
3922        #[inline]
3923        unsafe fn encode(
3924            self,
3925            encoder: &mut fidl::encoding::Encoder<
3926                '_,
3927                fidl::encoding::DefaultFuchsiaResourceDialect,
3928            >,
3929            offset: usize,
3930            _depth: fidl::encoding::Depth,
3931        ) -> fidl::Result<()> {
3932            encoder.debug_check_bounds::<PushEventProtocolPushEventReducedRightsRequest>(offset);
3933            // Delegate to tuple encoding.
3934            fidl::encoding::Encode::<
3935                PushEventProtocolPushEventReducedRightsRequest,
3936                fidl::encoding::DefaultFuchsiaResourceDialect,
3937            >::encode(
3938                (<fidl::encoding::HandleType<
3939                    fidl::Event,
3940                    { fidl::ObjectType::EVENT.into_raw() },
3941                    2,
3942                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3943                    &mut self.h
3944                ),),
3945                encoder,
3946                offset,
3947                _depth,
3948            )
3949        }
3950    }
3951    unsafe impl<
3952            T0: fidl::encoding::Encode<
3953                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>,
3954                fidl::encoding::DefaultFuchsiaResourceDialect,
3955            >,
3956        >
3957        fidl::encoding::Encode<
3958            PushEventProtocolPushEventReducedRightsRequest,
3959            fidl::encoding::DefaultFuchsiaResourceDialect,
3960        > for (T0,)
3961    {
3962        #[inline]
3963        unsafe fn encode(
3964            self,
3965            encoder: &mut fidl::encoding::Encoder<
3966                '_,
3967                fidl::encoding::DefaultFuchsiaResourceDialect,
3968            >,
3969            offset: usize,
3970            depth: fidl::encoding::Depth,
3971        ) -> fidl::Result<()> {
3972            encoder.debug_check_bounds::<PushEventProtocolPushEventReducedRightsRequest>(offset);
3973            // Zero out padding regions. There's no need to apply masks
3974            // because the unmasked parts will be overwritten by fields.
3975            // Write the fields.
3976            self.0.encode(encoder, offset + 0, depth)?;
3977            Ok(())
3978        }
3979    }
3980
3981    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3982        for PushEventProtocolPushEventReducedRightsRequest
3983    {
3984        #[inline(always)]
3985        fn new_empty() -> Self {
3986            Self {
3987                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
3988            }
3989        }
3990
3991        #[inline]
3992        unsafe fn decode(
3993            &mut self,
3994            decoder: &mut fidl::encoding::Decoder<
3995                '_,
3996                fidl::encoding::DefaultFuchsiaResourceDialect,
3997            >,
3998            offset: usize,
3999            _depth: fidl::encoding::Depth,
4000        ) -> fidl::Result<()> {
4001            decoder.debug_check_bounds::<Self>(offset);
4002            // Verify that padding bytes are zero.
4003            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
4004            Ok(())
4005        }
4006    }
4007
4008    impl fidl::encoding::ResourceTypeMarker for PushEventProtocolPushEventSameRightsRequest {
4009        type Borrowed<'a> = &'a mut Self;
4010        fn take_or_borrow<'a>(
4011            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4012        ) -> Self::Borrowed<'a> {
4013            value
4014        }
4015    }
4016
4017    unsafe impl fidl::encoding::TypeMarker for PushEventProtocolPushEventSameRightsRequest {
4018        type Owned = Self;
4019
4020        #[inline(always)]
4021        fn inline_align(_context: fidl::encoding::Context) -> usize {
4022            4
4023        }
4024
4025        #[inline(always)]
4026        fn inline_size(_context: fidl::encoding::Context) -> usize {
4027            4
4028        }
4029    }
4030
4031    unsafe impl
4032        fidl::encoding::Encode<
4033            PushEventProtocolPushEventSameRightsRequest,
4034            fidl::encoding::DefaultFuchsiaResourceDialect,
4035        > for &mut PushEventProtocolPushEventSameRightsRequest
4036    {
4037        #[inline]
4038        unsafe fn encode(
4039            self,
4040            encoder: &mut fidl::encoding::Encoder<
4041                '_,
4042                fidl::encoding::DefaultFuchsiaResourceDialect,
4043            >,
4044            offset: usize,
4045            _depth: fidl::encoding::Depth,
4046        ) -> fidl::Result<()> {
4047            encoder.debug_check_bounds::<PushEventProtocolPushEventSameRightsRequest>(offset);
4048            // Delegate to tuple encoding.
4049            fidl::encoding::Encode::<
4050                PushEventProtocolPushEventSameRightsRequest,
4051                fidl::encoding::DefaultFuchsiaResourceDialect,
4052            >::encode(
4053                (<fidl::encoding::HandleType<
4054                    fidl::Event,
4055                    { fidl::ObjectType::EVENT.into_raw() },
4056                    2147483648,
4057                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4058                    &mut self.h
4059                ),),
4060                encoder,
4061                offset,
4062                _depth,
4063            )
4064        }
4065    }
4066    unsafe impl<
4067            T0: fidl::encoding::Encode<
4068                fidl::encoding::HandleType<
4069                    fidl::Event,
4070                    { fidl::ObjectType::EVENT.into_raw() },
4071                    2147483648,
4072                >,
4073                fidl::encoding::DefaultFuchsiaResourceDialect,
4074            >,
4075        >
4076        fidl::encoding::Encode<
4077            PushEventProtocolPushEventSameRightsRequest,
4078            fidl::encoding::DefaultFuchsiaResourceDialect,
4079        > for (T0,)
4080    {
4081        #[inline]
4082        unsafe fn encode(
4083            self,
4084            encoder: &mut fidl::encoding::Encoder<
4085                '_,
4086                fidl::encoding::DefaultFuchsiaResourceDialect,
4087            >,
4088            offset: usize,
4089            depth: fidl::encoding::Depth,
4090        ) -> fidl::Result<()> {
4091            encoder.debug_check_bounds::<PushEventProtocolPushEventSameRightsRequest>(offset);
4092            // Zero out padding regions. There's no need to apply masks
4093            // because the unmasked parts will be overwritten by fields.
4094            // Write the fields.
4095            self.0.encode(encoder, offset + 0, depth)?;
4096            Ok(())
4097        }
4098    }
4099
4100    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4101        for PushEventProtocolPushEventSameRightsRequest
4102    {
4103        #[inline(always)]
4104        fn new_empty() -> Self {
4105            Self {
4106                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4107            }
4108        }
4109
4110        #[inline]
4111        unsafe fn decode(
4112            &mut self,
4113            decoder: &mut fidl::encoding::Decoder<
4114                '_,
4115                fidl::encoding::DefaultFuchsiaResourceDialect,
4116            >,
4117            offset: usize,
4118            _depth: fidl::encoding::Depth,
4119        ) -> fidl::Result<()> {
4120            decoder.debug_check_bounds::<Self>(offset);
4121            // Verify that padding bytes are zero.
4122            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
4123            Ok(())
4124        }
4125    }
4126
4127    impl fidl::encoding::ResourceTypeMarker for SendHandleProtocolSendHandleReducedRightsRequest {
4128        type Borrowed<'a> = &'a mut Self;
4129        fn take_or_borrow<'a>(
4130            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4131        ) -> Self::Borrowed<'a> {
4132            value
4133        }
4134    }
4135
4136    unsafe impl fidl::encoding::TypeMarker for SendHandleProtocolSendHandleReducedRightsRequest {
4137        type Owned = Self;
4138
4139        #[inline(always)]
4140        fn inline_align(_context: fidl::encoding::Context) -> usize {
4141            4
4142        }
4143
4144        #[inline(always)]
4145        fn inline_size(_context: fidl::encoding::Context) -> usize {
4146            4
4147        }
4148    }
4149
4150    unsafe impl
4151        fidl::encoding::Encode<
4152            SendHandleProtocolSendHandleReducedRightsRequest,
4153            fidl::encoding::DefaultFuchsiaResourceDialect,
4154        > for &mut SendHandleProtocolSendHandleReducedRightsRequest
4155    {
4156        #[inline]
4157        unsafe fn encode(
4158            self,
4159            encoder: &mut fidl::encoding::Encoder<
4160                '_,
4161                fidl::encoding::DefaultFuchsiaResourceDialect,
4162            >,
4163            offset: usize,
4164            _depth: fidl::encoding::Depth,
4165        ) -> fidl::Result<()> {
4166            encoder.debug_check_bounds::<SendHandleProtocolSendHandleReducedRightsRequest>(offset);
4167            // Delegate to tuple encoding.
4168            fidl::encoding::Encode::<
4169                SendHandleProtocolSendHandleReducedRightsRequest,
4170                fidl::encoding::DefaultFuchsiaResourceDialect,
4171            >::encode(
4172                (<fidl::encoding::HandleType<
4173                    fidl::Event,
4174                    { fidl::ObjectType::EVENT.into_raw() },
4175                    2,
4176                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4177                    &mut self.h
4178                ),),
4179                encoder,
4180                offset,
4181                _depth,
4182            )
4183        }
4184    }
4185    unsafe impl<
4186            T0: fidl::encoding::Encode<
4187                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>,
4188                fidl::encoding::DefaultFuchsiaResourceDialect,
4189            >,
4190        >
4191        fidl::encoding::Encode<
4192            SendHandleProtocolSendHandleReducedRightsRequest,
4193            fidl::encoding::DefaultFuchsiaResourceDialect,
4194        > for (T0,)
4195    {
4196        #[inline]
4197        unsafe fn encode(
4198            self,
4199            encoder: &mut fidl::encoding::Encoder<
4200                '_,
4201                fidl::encoding::DefaultFuchsiaResourceDialect,
4202            >,
4203            offset: usize,
4204            depth: fidl::encoding::Depth,
4205        ) -> fidl::Result<()> {
4206            encoder.debug_check_bounds::<SendHandleProtocolSendHandleReducedRightsRequest>(offset);
4207            // Zero out padding regions. There's no need to apply masks
4208            // because the unmasked parts will be overwritten by fields.
4209            // Write the fields.
4210            self.0.encode(encoder, offset + 0, depth)?;
4211            Ok(())
4212        }
4213    }
4214
4215    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4216        for SendHandleProtocolSendHandleReducedRightsRequest
4217    {
4218        #[inline(always)]
4219        fn new_empty() -> Self {
4220            Self {
4221                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
4222            }
4223        }
4224
4225        #[inline]
4226        unsafe fn decode(
4227            &mut self,
4228            decoder: &mut fidl::encoding::Decoder<
4229                '_,
4230                fidl::encoding::DefaultFuchsiaResourceDialect,
4231            >,
4232            offset: usize,
4233            _depth: fidl::encoding::Depth,
4234        ) -> fidl::Result<()> {
4235            decoder.debug_check_bounds::<Self>(offset);
4236            // Verify that padding bytes are zero.
4237            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
4238            Ok(())
4239        }
4240    }
4241
4242    impl fidl::encoding::ResourceTypeMarker for SendHandleProtocolSendHandleSameRightsRequest {
4243        type Borrowed<'a> = &'a mut Self;
4244        fn take_or_borrow<'a>(
4245            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4246        ) -> Self::Borrowed<'a> {
4247            value
4248        }
4249    }
4250
4251    unsafe impl fidl::encoding::TypeMarker for SendHandleProtocolSendHandleSameRightsRequest {
4252        type Owned = Self;
4253
4254        #[inline(always)]
4255        fn inline_align(_context: fidl::encoding::Context) -> usize {
4256            4
4257        }
4258
4259        #[inline(always)]
4260        fn inline_size(_context: fidl::encoding::Context) -> usize {
4261            4
4262        }
4263    }
4264
4265    unsafe impl
4266        fidl::encoding::Encode<
4267            SendHandleProtocolSendHandleSameRightsRequest,
4268            fidl::encoding::DefaultFuchsiaResourceDialect,
4269        > for &mut SendHandleProtocolSendHandleSameRightsRequest
4270    {
4271        #[inline]
4272        unsafe fn encode(
4273            self,
4274            encoder: &mut fidl::encoding::Encoder<
4275                '_,
4276                fidl::encoding::DefaultFuchsiaResourceDialect,
4277            >,
4278            offset: usize,
4279            _depth: fidl::encoding::Depth,
4280        ) -> fidl::Result<()> {
4281            encoder.debug_check_bounds::<SendHandleProtocolSendHandleSameRightsRequest>(offset);
4282            // Delegate to tuple encoding.
4283            fidl::encoding::Encode::<
4284                SendHandleProtocolSendHandleSameRightsRequest,
4285                fidl::encoding::DefaultFuchsiaResourceDialect,
4286            >::encode(
4287                (<fidl::encoding::HandleType<
4288                    fidl::Event,
4289                    { fidl::ObjectType::EVENT.into_raw() },
4290                    2147483648,
4291                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4292                    &mut self.h
4293                ),),
4294                encoder,
4295                offset,
4296                _depth,
4297            )
4298        }
4299    }
4300    unsafe impl<
4301            T0: fidl::encoding::Encode<
4302                fidl::encoding::HandleType<
4303                    fidl::Event,
4304                    { fidl::ObjectType::EVENT.into_raw() },
4305                    2147483648,
4306                >,
4307                fidl::encoding::DefaultFuchsiaResourceDialect,
4308            >,
4309        >
4310        fidl::encoding::Encode<
4311            SendHandleProtocolSendHandleSameRightsRequest,
4312            fidl::encoding::DefaultFuchsiaResourceDialect,
4313        > for (T0,)
4314    {
4315        #[inline]
4316        unsafe fn encode(
4317            self,
4318            encoder: &mut fidl::encoding::Encoder<
4319                '_,
4320                fidl::encoding::DefaultFuchsiaResourceDialect,
4321            >,
4322            offset: usize,
4323            depth: fidl::encoding::Depth,
4324        ) -> fidl::Result<()> {
4325            encoder.debug_check_bounds::<SendHandleProtocolSendHandleSameRightsRequest>(offset);
4326            // Zero out padding regions. There's no need to apply masks
4327            // because the unmasked parts will be overwritten by fields.
4328            // Write the fields.
4329            self.0.encode(encoder, offset + 0, depth)?;
4330            Ok(())
4331        }
4332    }
4333
4334    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4335        for SendHandleProtocolSendHandleSameRightsRequest
4336    {
4337        #[inline(always)]
4338        fn new_empty() -> Self {
4339            Self {
4340                h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4341            }
4342        }
4343
4344        #[inline]
4345        unsafe fn decode(
4346            &mut self,
4347            decoder: &mut fidl::encoding::Decoder<
4348                '_,
4349                fidl::encoding::DefaultFuchsiaResourceDialect,
4350            >,
4351            offset: usize,
4352            _depth: fidl::encoding::Depth,
4353        ) -> fidl::Result<()> {
4354            decoder.debug_check_bounds::<Self>(offset);
4355            // Verify that padding bytes are zero.
4356            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
4357            Ok(())
4358        }
4359    }
4360
4361    impl fidl::encoding::ResourceTypeMarker for StructWithHandles {
4362        type Borrowed<'a> = &'a mut Self;
4363        fn take_or_borrow<'a>(
4364            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4365        ) -> Self::Borrowed<'a> {
4366            value
4367        }
4368    }
4369
4370    unsafe impl fidl::encoding::TypeMarker for StructWithHandles {
4371        type Owned = Self;
4372
4373        #[inline(always)]
4374        fn inline_align(_context: fidl::encoding::Context) -> usize {
4375            8
4376        }
4377
4378        #[inline(always)]
4379        fn inline_size(_context: fidl::encoding::Context) -> usize {
4380            16
4381        }
4382    }
4383
4384    unsafe impl
4385        fidl::encoding::Encode<StructWithHandles, fidl::encoding::DefaultFuchsiaResourceDialect>
4386        for &mut StructWithHandles
4387    {
4388        #[inline]
4389        unsafe fn encode(
4390            self,
4391            encoder: &mut fidl::encoding::Encoder<
4392                '_,
4393                fidl::encoding::DefaultFuchsiaResourceDialect,
4394            >,
4395            offset: usize,
4396            _depth: fidl::encoding::Depth,
4397        ) -> fidl::Result<()> {
4398            encoder.debug_check_bounds::<StructWithHandles>(offset);
4399            // Delegate to tuple encoding.
4400            fidl::encoding::Encode::<StructWithHandles, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4401                (
4402                    <fidl::encoding::UnboundedVector<fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.v),
4403                ),
4404                encoder, offset, _depth
4405            )
4406        }
4407    }
4408    unsafe impl<
4409            T0: fidl::encoding::Encode<
4410                fidl::encoding::UnboundedVector<
4411                    fidl::encoding::HandleType<
4412                        fidl::Channel,
4413                        { fidl::ObjectType::CHANNEL.into_raw() },
4414                        2147483648,
4415                    >,
4416                >,
4417                fidl::encoding::DefaultFuchsiaResourceDialect,
4418            >,
4419        >
4420        fidl::encoding::Encode<StructWithHandles, fidl::encoding::DefaultFuchsiaResourceDialect>
4421        for (T0,)
4422    {
4423        #[inline]
4424        unsafe fn encode(
4425            self,
4426            encoder: &mut fidl::encoding::Encoder<
4427                '_,
4428                fidl::encoding::DefaultFuchsiaResourceDialect,
4429            >,
4430            offset: usize,
4431            depth: fidl::encoding::Depth,
4432        ) -> fidl::Result<()> {
4433            encoder.debug_check_bounds::<StructWithHandles>(offset);
4434            // Zero out padding regions. There's no need to apply masks
4435            // because the unmasked parts will be overwritten by fields.
4436            // Write the fields.
4437            self.0.encode(encoder, offset + 0, depth)?;
4438            Ok(())
4439        }
4440    }
4441
4442    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4443        for StructWithHandles
4444    {
4445        #[inline(always)]
4446        fn new_empty() -> Self {
4447            Self {
4448                v: fidl::new_empty!(
4449                    fidl::encoding::UnboundedVector<
4450                        fidl::encoding::HandleType<
4451                            fidl::Channel,
4452                            { fidl::ObjectType::CHANNEL.into_raw() },
4453                            2147483648,
4454                        >,
4455                    >,
4456                    fidl::encoding::DefaultFuchsiaResourceDialect
4457                ),
4458            }
4459        }
4460
4461        #[inline]
4462        unsafe fn decode(
4463            &mut self,
4464            decoder: &mut fidl::encoding::Decoder<
4465                '_,
4466                fidl::encoding::DefaultFuchsiaResourceDialect,
4467            >,
4468            offset: usize,
4469            _depth: fidl::encoding::Depth,
4470        ) -> fidl::Result<()> {
4471            decoder.debug_check_bounds::<Self>(offset);
4472            // Verify that padding bytes are zero.
4473            fidl::decode!(
4474                fidl::encoding::UnboundedVector<
4475                    fidl::encoding::HandleType<
4476                        fidl::Channel,
4477                        { fidl::ObjectType::CHANNEL.into_raw() },
4478                        2147483648,
4479                    >,
4480                >,
4481                fidl::encoding::DefaultFuchsiaResourceDialect,
4482                &mut self.v,
4483                decoder,
4484                offset + 0,
4485                _depth
4486            )?;
4487            Ok(())
4488        }
4489    }
4490
4491    impl ResourceRecord {
4492        #[inline(always)]
4493        fn max_ordinal_present(&self) -> u64 {
4494            if let Some(_) = self.age {
4495                return 2;
4496            }
4497            if let Some(_) = self.name {
4498                return 1;
4499            }
4500            0
4501        }
4502    }
4503
4504    impl fidl::encoding::ResourceTypeMarker for ResourceRecord {
4505        type Borrowed<'a> = &'a mut Self;
4506        fn take_or_borrow<'a>(
4507            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4508        ) -> Self::Borrowed<'a> {
4509            value
4510        }
4511    }
4512
4513    unsafe impl fidl::encoding::TypeMarker for ResourceRecord {
4514        type Owned = Self;
4515
4516        #[inline(always)]
4517        fn inline_align(_context: fidl::encoding::Context) -> usize {
4518            8
4519        }
4520
4521        #[inline(always)]
4522        fn inline_size(_context: fidl::encoding::Context) -> usize {
4523            16
4524        }
4525    }
4526
4527    unsafe impl
4528        fidl::encoding::Encode<ResourceRecord, fidl::encoding::DefaultFuchsiaResourceDialect>
4529        for &mut ResourceRecord
4530    {
4531        unsafe fn encode(
4532            self,
4533            encoder: &mut fidl::encoding::Encoder<
4534                '_,
4535                fidl::encoding::DefaultFuchsiaResourceDialect,
4536            >,
4537            offset: usize,
4538            mut depth: fidl::encoding::Depth,
4539        ) -> fidl::Result<()> {
4540            encoder.debug_check_bounds::<ResourceRecord>(offset);
4541            // Vector header
4542            let max_ordinal: u64 = self.max_ordinal_present();
4543            encoder.write_num(max_ordinal, offset);
4544            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4545            // Calling encoder.out_of_line_offset(0) is not allowed.
4546            if max_ordinal == 0 {
4547                return Ok(());
4548            }
4549            depth.increment()?;
4550            let envelope_size = 8;
4551            let bytes_len = max_ordinal as usize * envelope_size;
4552            #[allow(unused_variables)]
4553            let offset = encoder.out_of_line_offset(bytes_len);
4554            let mut _prev_end_offset: usize = 0;
4555            if 1 > max_ordinal {
4556                return Ok(());
4557            }
4558
4559            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4560            // are envelope_size bytes.
4561            let cur_offset: usize = (1 - 1) * envelope_size;
4562
4563            // Zero reserved fields.
4564            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4565
4566            // Safety:
4567            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4568            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4569            //   envelope_size bytes, there is always sufficient room.
4570            fidl::encoding::encode_in_envelope_optional::<
4571                fidl::encoding::UnboundedString,
4572                fidl::encoding::DefaultFuchsiaResourceDialect,
4573            >(
4574                self.name.as_ref().map(
4575                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
4576                ),
4577                encoder,
4578                offset + cur_offset,
4579                depth,
4580            )?;
4581
4582            _prev_end_offset = cur_offset + envelope_size;
4583            if 2 > max_ordinal {
4584                return Ok(());
4585            }
4586
4587            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4588            // are envelope_size bytes.
4589            let cur_offset: usize = (2 - 1) * envelope_size;
4590
4591            // Zero reserved fields.
4592            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4593
4594            // Safety:
4595            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4596            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4597            //   envelope_size bytes, there is always sufficient room.
4598            fidl::encoding::encode_in_envelope_optional::<
4599                u8,
4600                fidl::encoding::DefaultFuchsiaResourceDialect,
4601            >(
4602                self.age.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4603                encoder,
4604                offset + cur_offset,
4605                depth,
4606            )?;
4607
4608            _prev_end_offset = cur_offset + envelope_size;
4609
4610            Ok(())
4611        }
4612    }
4613
4614    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4615        for ResourceRecord
4616    {
4617        #[inline(always)]
4618        fn new_empty() -> Self {
4619            Self::default()
4620        }
4621
4622        unsafe fn decode(
4623            &mut self,
4624            decoder: &mut fidl::encoding::Decoder<
4625                '_,
4626                fidl::encoding::DefaultFuchsiaResourceDialect,
4627            >,
4628            offset: usize,
4629            mut depth: fidl::encoding::Depth,
4630        ) -> fidl::Result<()> {
4631            decoder.debug_check_bounds::<Self>(offset);
4632            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4633                None => return Err(fidl::Error::NotNullable),
4634                Some(len) => len,
4635            };
4636            // Calling decoder.out_of_line_offset(0) is not allowed.
4637            if len == 0 {
4638                return Ok(());
4639            };
4640            depth.increment()?;
4641            let envelope_size = 8;
4642            let bytes_len = len * envelope_size;
4643            let offset = decoder.out_of_line_offset(bytes_len)?;
4644            // Decode the envelope for each type.
4645            let mut _next_ordinal_to_read = 0;
4646            let mut next_offset = offset;
4647            let end_offset = offset + bytes_len;
4648            _next_ordinal_to_read += 1;
4649            if next_offset >= end_offset {
4650                return Ok(());
4651            }
4652
4653            // Decode unknown envelopes for gaps in ordinals.
4654            while _next_ordinal_to_read < 1 {
4655                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4656                _next_ordinal_to_read += 1;
4657                next_offset += envelope_size;
4658            }
4659
4660            let next_out_of_line = decoder.next_out_of_line();
4661            let handles_before = decoder.remaining_handles();
4662            if let Some((inlined, num_bytes, num_handles)) =
4663                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4664            {
4665                let member_inline_size =
4666                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4667                        decoder.context,
4668                    );
4669                if inlined != (member_inline_size <= 4) {
4670                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4671                }
4672                let inner_offset;
4673                let mut inner_depth = depth.clone();
4674                if inlined {
4675                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4676                    inner_offset = next_offset;
4677                } else {
4678                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4679                    inner_depth.increment()?;
4680                }
4681                let val_ref = self.name.get_or_insert_with(|| {
4682                    fidl::new_empty!(
4683                        fidl::encoding::UnboundedString,
4684                        fidl::encoding::DefaultFuchsiaResourceDialect
4685                    )
4686                });
4687                fidl::decode!(
4688                    fidl::encoding::UnboundedString,
4689                    fidl::encoding::DefaultFuchsiaResourceDialect,
4690                    val_ref,
4691                    decoder,
4692                    inner_offset,
4693                    inner_depth
4694                )?;
4695                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4696                {
4697                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4698                }
4699                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4700                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4701                }
4702            }
4703
4704            next_offset += envelope_size;
4705            _next_ordinal_to_read += 1;
4706            if next_offset >= end_offset {
4707                return Ok(());
4708            }
4709
4710            // Decode unknown envelopes for gaps in ordinals.
4711            while _next_ordinal_to_read < 2 {
4712                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4713                _next_ordinal_to_read += 1;
4714                next_offset += envelope_size;
4715            }
4716
4717            let next_out_of_line = decoder.next_out_of_line();
4718            let handles_before = decoder.remaining_handles();
4719            if let Some((inlined, num_bytes, num_handles)) =
4720                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4721            {
4722                let member_inline_size =
4723                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4724                if inlined != (member_inline_size <= 4) {
4725                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4726                }
4727                let inner_offset;
4728                let mut inner_depth = depth.clone();
4729                if inlined {
4730                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4731                    inner_offset = next_offset;
4732                } else {
4733                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4734                    inner_depth.increment()?;
4735                }
4736                let val_ref = self.age.get_or_insert_with(|| {
4737                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
4738                });
4739                fidl::decode!(
4740                    u8,
4741                    fidl::encoding::DefaultFuchsiaResourceDialect,
4742                    val_ref,
4743                    decoder,
4744                    inner_offset,
4745                    inner_depth
4746                )?;
4747                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4748                {
4749                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4750                }
4751                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4752                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4753                }
4754            }
4755
4756            next_offset += envelope_size;
4757
4758            // Decode the remaining unknown envelopes.
4759            while next_offset < end_offset {
4760                _next_ordinal_to_read += 1;
4761                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4762                next_offset += envelope_size;
4763            }
4764
4765            Ok(())
4766        }
4767    }
4768
4769    impl fidl::encoding::ResourceTypeMarker for FlexibleResourceThing {
4770        type Borrowed<'a> = &'a mut Self;
4771        fn take_or_borrow<'a>(
4772            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4773        ) -> Self::Borrowed<'a> {
4774            value
4775        }
4776    }
4777
4778    unsafe impl fidl::encoding::TypeMarker for FlexibleResourceThing {
4779        type Owned = Self;
4780
4781        #[inline(always)]
4782        fn inline_align(_context: fidl::encoding::Context) -> usize {
4783            8
4784        }
4785
4786        #[inline(always)]
4787        fn inline_size(_context: fidl::encoding::Context) -> usize {
4788            16
4789        }
4790    }
4791
4792    unsafe impl
4793        fidl::encoding::Encode<FlexibleResourceThing, fidl::encoding::DefaultFuchsiaResourceDialect>
4794        for &mut FlexibleResourceThing
4795    {
4796        #[inline]
4797        unsafe fn encode(
4798            self,
4799            encoder: &mut fidl::encoding::Encoder<
4800                '_,
4801                fidl::encoding::DefaultFuchsiaResourceDialect,
4802            >,
4803            offset: usize,
4804            _depth: fidl::encoding::Depth,
4805        ) -> fidl::Result<()> {
4806            encoder.debug_check_bounds::<FlexibleResourceThing>(offset);
4807            encoder.write_num::<u64>(self.ordinal(), offset);
4808            match self {
4809                FlexibleResourceThing::Number(ref val) => fidl::encoding::encode_in_envelope::<
4810                    u32,
4811                    fidl::encoding::DefaultFuchsiaResourceDialect,
4812                >(
4813                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
4814                    encoder,
4815                    offset + 8,
4816                    _depth,
4817                ),
4818                FlexibleResourceThing::Name(ref val) => fidl::encoding::encode_in_envelope::<
4819                    fidl::encoding::UnboundedString,
4820                    fidl::encoding::DefaultFuchsiaResourceDialect,
4821                >(
4822                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
4823                        val,
4824                    ),
4825                    encoder,
4826                    offset + 8,
4827                    _depth,
4828                ),
4829                FlexibleResourceThing::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4830            }
4831        }
4832    }
4833
4834    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4835        for FlexibleResourceThing
4836    {
4837        #[inline(always)]
4838        fn new_empty() -> Self {
4839            Self::__SourceBreaking { unknown_ordinal: 0 }
4840        }
4841
4842        #[inline]
4843        unsafe fn decode(
4844            &mut self,
4845            decoder: &mut fidl::encoding::Decoder<
4846                '_,
4847                fidl::encoding::DefaultFuchsiaResourceDialect,
4848            >,
4849            offset: usize,
4850            mut depth: fidl::encoding::Depth,
4851        ) -> fidl::Result<()> {
4852            decoder.debug_check_bounds::<Self>(offset);
4853            #[allow(unused_variables)]
4854            let next_out_of_line = decoder.next_out_of_line();
4855            let handles_before = decoder.remaining_handles();
4856            let (ordinal, inlined, num_bytes, num_handles) =
4857                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4858
4859            let member_inline_size = match ordinal {
4860                1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4861                2 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4862                    decoder.context,
4863                ),
4864                0 => return Err(fidl::Error::UnknownUnionTag),
4865                _ => num_bytes as usize,
4866            };
4867
4868            if inlined != (member_inline_size <= 4) {
4869                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4870            }
4871            let _inner_offset;
4872            if inlined {
4873                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4874                _inner_offset = offset + 8;
4875            } else {
4876                depth.increment()?;
4877                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4878            }
4879            match ordinal {
4880                1 => {
4881                    #[allow(irrefutable_let_patterns)]
4882                    if let FlexibleResourceThing::Number(_) = self {
4883                        // Do nothing, read the value into the object
4884                    } else {
4885                        // Initialize `self` to the right variant
4886                        *self = FlexibleResourceThing::Number(fidl::new_empty!(
4887                            u32,
4888                            fidl::encoding::DefaultFuchsiaResourceDialect
4889                        ));
4890                    }
4891                    #[allow(irrefutable_let_patterns)]
4892                    if let FlexibleResourceThing::Number(ref mut val) = self {
4893                        fidl::decode!(
4894                            u32,
4895                            fidl::encoding::DefaultFuchsiaResourceDialect,
4896                            val,
4897                            decoder,
4898                            _inner_offset,
4899                            depth
4900                        )?;
4901                    } else {
4902                        unreachable!()
4903                    }
4904                }
4905                2 => {
4906                    #[allow(irrefutable_let_patterns)]
4907                    if let FlexibleResourceThing::Name(_) = self {
4908                        // Do nothing, read the value into the object
4909                    } else {
4910                        // Initialize `self` to the right variant
4911                        *self = FlexibleResourceThing::Name(fidl::new_empty!(
4912                            fidl::encoding::UnboundedString,
4913                            fidl::encoding::DefaultFuchsiaResourceDialect
4914                        ));
4915                    }
4916                    #[allow(irrefutable_let_patterns)]
4917                    if let FlexibleResourceThing::Name(ref mut val) = self {
4918                        fidl::decode!(
4919                            fidl::encoding::UnboundedString,
4920                            fidl::encoding::DefaultFuchsiaResourceDialect,
4921                            val,
4922                            decoder,
4923                            _inner_offset,
4924                            depth
4925                        )?;
4926                    } else {
4927                        unreachable!()
4928                    }
4929                }
4930                #[allow(deprecated)]
4931                ordinal => {
4932                    for _ in 0..num_handles {
4933                        decoder.drop_next_handle()?;
4934                    }
4935                    *self = FlexibleResourceThing::__SourceBreaking { unknown_ordinal: ordinal };
4936                }
4937            }
4938            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4939                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4940            }
4941            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4942                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4943            }
4944            Ok(())
4945        }
4946    }
4947
4948    impl fidl::encoding::ResourceTypeMarker for StrictResourceThing {
4949        type Borrowed<'a> = &'a mut Self;
4950        fn take_or_borrow<'a>(
4951            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4952        ) -> Self::Borrowed<'a> {
4953            value
4954        }
4955    }
4956
4957    unsafe impl fidl::encoding::TypeMarker for StrictResourceThing {
4958        type Owned = Self;
4959
4960        #[inline(always)]
4961        fn inline_align(_context: fidl::encoding::Context) -> usize {
4962            8
4963        }
4964
4965        #[inline(always)]
4966        fn inline_size(_context: fidl::encoding::Context) -> usize {
4967            16
4968        }
4969    }
4970
4971    unsafe impl
4972        fidl::encoding::Encode<StrictResourceThing, fidl::encoding::DefaultFuchsiaResourceDialect>
4973        for &mut StrictResourceThing
4974    {
4975        #[inline]
4976        unsafe fn encode(
4977            self,
4978            encoder: &mut fidl::encoding::Encoder<
4979                '_,
4980                fidl::encoding::DefaultFuchsiaResourceDialect,
4981            >,
4982            offset: usize,
4983            _depth: fidl::encoding::Depth,
4984        ) -> fidl::Result<()> {
4985            encoder.debug_check_bounds::<StrictResourceThing>(offset);
4986            encoder.write_num::<u64>(self.ordinal(), offset);
4987            match self {
4988                StrictResourceThing::Number(ref val) => fidl::encoding::encode_in_envelope::<
4989                    u32,
4990                    fidl::encoding::DefaultFuchsiaResourceDialect,
4991                >(
4992                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
4993                    encoder,
4994                    offset + 8,
4995                    _depth,
4996                ),
4997                StrictResourceThing::Name(ref val) => fidl::encoding::encode_in_envelope::<
4998                    fidl::encoding::UnboundedString,
4999                    fidl::encoding::DefaultFuchsiaResourceDialect,
5000                >(
5001                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
5002                        val,
5003                    ),
5004                    encoder,
5005                    offset + 8,
5006                    _depth,
5007                ),
5008            }
5009        }
5010    }
5011
5012    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5013        for StrictResourceThing
5014    {
5015        #[inline(always)]
5016        fn new_empty() -> Self {
5017            Self::Number(fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect))
5018        }
5019
5020        #[inline]
5021        unsafe fn decode(
5022            &mut self,
5023            decoder: &mut fidl::encoding::Decoder<
5024                '_,
5025                fidl::encoding::DefaultFuchsiaResourceDialect,
5026            >,
5027            offset: usize,
5028            mut depth: fidl::encoding::Depth,
5029        ) -> fidl::Result<()> {
5030            decoder.debug_check_bounds::<Self>(offset);
5031            #[allow(unused_variables)]
5032            let next_out_of_line = decoder.next_out_of_line();
5033            let handles_before = decoder.remaining_handles();
5034            let (ordinal, inlined, num_bytes, num_handles) =
5035                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5036
5037            let member_inline_size = match ordinal {
5038                1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5039                2 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
5040                    decoder.context,
5041                ),
5042                _ => return Err(fidl::Error::UnknownUnionTag),
5043            };
5044
5045            if inlined != (member_inline_size <= 4) {
5046                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5047            }
5048            let _inner_offset;
5049            if inlined {
5050                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5051                _inner_offset = offset + 8;
5052            } else {
5053                depth.increment()?;
5054                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5055            }
5056            match ordinal {
5057                1 => {
5058                    #[allow(irrefutable_let_patterns)]
5059                    if let StrictResourceThing::Number(_) = self {
5060                        // Do nothing, read the value into the object
5061                    } else {
5062                        // Initialize `self` to the right variant
5063                        *self = StrictResourceThing::Number(fidl::new_empty!(
5064                            u32,
5065                            fidl::encoding::DefaultFuchsiaResourceDialect
5066                        ));
5067                    }
5068                    #[allow(irrefutable_let_patterns)]
5069                    if let StrictResourceThing::Number(ref mut val) = self {
5070                        fidl::decode!(
5071                            u32,
5072                            fidl::encoding::DefaultFuchsiaResourceDialect,
5073                            val,
5074                            decoder,
5075                            _inner_offset,
5076                            depth
5077                        )?;
5078                    } else {
5079                        unreachable!()
5080                    }
5081                }
5082                2 => {
5083                    #[allow(irrefutable_let_patterns)]
5084                    if let StrictResourceThing::Name(_) = self {
5085                        // Do nothing, read the value into the object
5086                    } else {
5087                        // Initialize `self` to the right variant
5088                        *self = StrictResourceThing::Name(fidl::new_empty!(
5089                            fidl::encoding::UnboundedString,
5090                            fidl::encoding::DefaultFuchsiaResourceDialect
5091                        ));
5092                    }
5093                    #[allow(irrefutable_let_patterns)]
5094                    if let StrictResourceThing::Name(ref mut val) = self {
5095                        fidl::decode!(
5096                            fidl::encoding::UnboundedString,
5097                            fidl::encoding::DefaultFuchsiaResourceDialect,
5098                            val,
5099                            decoder,
5100                            _inner_offset,
5101                            depth
5102                        )?;
5103                    } else {
5104                        unreachable!()
5105                    }
5106                }
5107                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5108            }
5109            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5110                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5111            }
5112            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5113                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5114            }
5115            Ok(())
5116        }
5117    }
5118}