Skip to main content

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