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