fidl_test_external/
fidl_test_external.rs

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