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