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