fidl_test_triangle/
fidl_test_triangle.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ConscriptIssueRequest {
15    pub iface: fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
16    pub request: Option<String>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConscriptIssueRequest {}
20
21#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct ConscriptIssueResponse {
23    pub response: Option<String>,
24}
25
26impl fidl::Persistable for ConscriptIssueResponse {}
27
28#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct ConscriptServeRequest {
30    pub iface: fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConscriptServeRequest {}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
36pub struct ConscriptMarker;
37
38impl fidl::endpoints::ProtocolMarker for ConscriptMarker {
39    type Proxy = ConscriptProxy;
40    type RequestStream = ConscriptRequestStream;
41    #[cfg(target_os = "fuchsia")]
42    type SynchronousProxy = ConscriptSynchronousProxy;
43
44    const DEBUG_NAME: &'static str = "test.triangle.Conscript";
45}
46impl fidl::endpoints::DiscoverableProtocolMarker for ConscriptMarker {}
47
48pub trait ConscriptProxyInterface: Send + Sync {
49    fn r#serve(
50        &self,
51        iface: fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
52    ) -> Result<(), fidl::Error>;
53    type IssueResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>> + Send;
54    fn r#issue(
55        &self,
56        iface: fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
57        request: Option<&str>,
58    ) -> Self::IssueResponseFut;
59}
60#[derive(Debug)]
61#[cfg(target_os = "fuchsia")]
62pub struct ConscriptSynchronousProxy {
63    client: fidl::client::sync::Client,
64}
65
66#[cfg(target_os = "fuchsia")]
67impl fidl::endpoints::SynchronousProxy for ConscriptSynchronousProxy {
68    type Proxy = ConscriptProxy;
69    type Protocol = ConscriptMarker;
70
71    fn from_channel(inner: fidl::Channel) -> Self {
72        Self::new(inner)
73    }
74
75    fn into_channel(self) -> fidl::Channel {
76        self.client.into_channel()
77    }
78
79    fn as_channel(&self) -> &fidl::Channel {
80        self.client.as_channel()
81    }
82}
83
84#[cfg(target_os = "fuchsia")]
85impl ConscriptSynchronousProxy {
86    pub fn new(channel: fidl::Channel) -> Self {
87        let protocol_name = <ConscriptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
88        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
89    }
90
91    pub fn into_channel(self) -> fidl::Channel {
92        self.client.into_channel()
93    }
94
95    /// Waits until an event arrives and returns it. It is safe for other
96    /// threads to make concurrent requests while waiting for an event.
97    pub fn wait_for_event(
98        &self,
99        deadline: zx::MonotonicInstant,
100    ) -> Result<ConscriptEvent, fidl::Error> {
101        ConscriptEvent::decode(self.client.wait_for_event(deadline)?)
102    }
103
104    pub fn r#serve(
105        &self,
106        mut iface: fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
107    ) -> Result<(), fidl::Error> {
108        self.client.send::<ConscriptServeRequest>(
109            (iface,),
110            0xec2f1bfefaaf878,
111            fidl::encoding::DynamicFlags::empty(),
112        )
113    }
114
115    pub fn r#issue(
116        &self,
117        mut iface: fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
118        mut request: Option<&str>,
119        ___deadline: zx::MonotonicInstant,
120    ) -> Result<Option<String>, fidl::Error> {
121        let _response = self.client.send_query::<ConscriptIssueRequest, ConscriptIssueResponse>(
122            (iface, request),
123            0x4bcc695ef98ec8a9,
124            fidl::encoding::DynamicFlags::empty(),
125            ___deadline,
126        )?;
127        Ok(_response.response)
128    }
129}
130
131#[derive(Debug, Clone)]
132pub struct ConscriptProxy {
133    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for ConscriptProxy {
137    type Protocol = ConscriptMarker;
138
139    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140        Self::new(inner)
141    }
142
143    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144        self.client.into_channel().map_err(|client| Self { client })
145    }
146
147    fn as_channel(&self) -> &::fidl::AsyncChannel {
148        self.client.as_channel()
149    }
150}
151
152impl ConscriptProxy {
153    /// Create a new Proxy for test.triangle/Conscript.
154    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155        let protocol_name = <ConscriptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156        Self { client: fidl::client::Client::new(channel, protocol_name) }
157    }
158
159    /// Get a Stream of events from the remote end of the protocol.
160    ///
161    /// # Panics
162    ///
163    /// Panics if the event stream was already taken.
164    pub fn take_event_stream(&self) -> ConscriptEventStream {
165        ConscriptEventStream { event_receiver: self.client.take_event_receiver() }
166    }
167
168    pub fn r#serve(
169        &self,
170        mut iface: fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
171    ) -> Result<(), fidl::Error> {
172        ConscriptProxyInterface::r#serve(self, iface)
173    }
174
175    pub fn r#issue(
176        &self,
177        mut iface: fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
178        mut request: Option<&str>,
179    ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
180    {
181        ConscriptProxyInterface::r#issue(self, iface, request)
182    }
183}
184
185impl ConscriptProxyInterface for ConscriptProxy {
186    fn r#serve(
187        &self,
188        mut iface: fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
189    ) -> Result<(), fidl::Error> {
190        self.client.send::<ConscriptServeRequest>(
191            (iface,),
192            0xec2f1bfefaaf878,
193            fidl::encoding::DynamicFlags::empty(),
194        )
195    }
196
197    type IssueResponseFut = fidl::client::QueryResponseFut<
198        Option<String>,
199        fidl::encoding::DefaultFuchsiaResourceDialect,
200    >;
201    fn r#issue(
202        &self,
203        mut iface: fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
204        mut request: Option<&str>,
205    ) -> Self::IssueResponseFut {
206        fn _decode(
207            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
208        ) -> Result<Option<String>, fidl::Error> {
209            let _response = fidl::client::decode_transaction_body::<
210                ConscriptIssueResponse,
211                fidl::encoding::DefaultFuchsiaResourceDialect,
212                0x4bcc695ef98ec8a9,
213            >(_buf?)?;
214            Ok(_response.response)
215        }
216        self.client.send_query_and_decode::<ConscriptIssueRequest, Option<String>>(
217            (iface, request),
218            0x4bcc695ef98ec8a9,
219            fidl::encoding::DynamicFlags::empty(),
220            _decode,
221        )
222    }
223}
224
225pub struct ConscriptEventStream {
226    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
227}
228
229impl std::marker::Unpin for ConscriptEventStream {}
230
231impl futures::stream::FusedStream for ConscriptEventStream {
232    fn is_terminated(&self) -> bool {
233        self.event_receiver.is_terminated()
234    }
235}
236
237impl futures::Stream for ConscriptEventStream {
238    type Item = Result<ConscriptEvent, fidl::Error>;
239
240    fn poll_next(
241        mut self: std::pin::Pin<&mut Self>,
242        cx: &mut std::task::Context<'_>,
243    ) -> std::task::Poll<Option<Self::Item>> {
244        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
245            &mut self.event_receiver,
246            cx
247        )?) {
248            Some(buf) => std::task::Poll::Ready(Some(ConscriptEvent::decode(buf))),
249            None => std::task::Poll::Ready(None),
250        }
251    }
252}
253
254#[derive(Debug)]
255pub enum ConscriptEvent {}
256
257impl ConscriptEvent {
258    /// Decodes a message buffer as a [`ConscriptEvent`].
259    fn decode(
260        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
261    ) -> Result<ConscriptEvent, fidl::Error> {
262        let (bytes, _handles) = buf.split_mut();
263        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
264        debug_assert_eq!(tx_header.tx_id, 0);
265        match tx_header.ordinal {
266            _ => Err(fidl::Error::UnknownOrdinal {
267                ordinal: tx_header.ordinal,
268                protocol_name: <ConscriptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
269            }),
270        }
271    }
272}
273
274/// A Stream of incoming requests for test.triangle/Conscript.
275pub struct ConscriptRequestStream {
276    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
277    is_terminated: bool,
278}
279
280impl std::marker::Unpin for ConscriptRequestStream {}
281
282impl futures::stream::FusedStream for ConscriptRequestStream {
283    fn is_terminated(&self) -> bool {
284        self.is_terminated
285    }
286}
287
288impl fidl::endpoints::RequestStream for ConscriptRequestStream {
289    type Protocol = ConscriptMarker;
290    type ControlHandle = ConscriptControlHandle;
291
292    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
293        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
294    }
295
296    fn control_handle(&self) -> Self::ControlHandle {
297        ConscriptControlHandle { inner: self.inner.clone() }
298    }
299
300    fn into_inner(
301        self,
302    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
303    {
304        (self.inner, self.is_terminated)
305    }
306
307    fn from_inner(
308        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
309        is_terminated: bool,
310    ) -> Self {
311        Self { inner, is_terminated }
312    }
313}
314
315impl futures::Stream for ConscriptRequestStream {
316    type Item = Result<ConscriptRequest, fidl::Error>;
317
318    fn poll_next(
319        mut self: std::pin::Pin<&mut Self>,
320        cx: &mut std::task::Context<'_>,
321    ) -> std::task::Poll<Option<Self::Item>> {
322        let this = &mut *self;
323        if this.inner.check_shutdown(cx) {
324            this.is_terminated = true;
325            return std::task::Poll::Ready(None);
326        }
327        if this.is_terminated {
328            panic!("polled ConscriptRequestStream after completion");
329        }
330        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
331            |bytes, handles| {
332                match this.inner.channel().read_etc(cx, bytes, handles) {
333                    std::task::Poll::Ready(Ok(())) => {}
334                    std::task::Poll::Pending => return std::task::Poll::Pending,
335                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
336                        this.is_terminated = true;
337                        return std::task::Poll::Ready(None);
338                    }
339                    std::task::Poll::Ready(Err(e)) => {
340                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
341                            e.into(),
342                        ))))
343                    }
344                }
345
346                // A message has been received from the channel
347                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
348
349                std::task::Poll::Ready(Some(match header.ordinal {
350                    0xec2f1bfefaaf878 => {
351                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
352                        let mut req = fidl::new_empty!(
353                            ConscriptServeRequest,
354                            fidl::encoding::DefaultFuchsiaResourceDialect
355                        );
356                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConscriptServeRequest>(&header, _body_bytes, handles, &mut req)?;
357                        let control_handle = ConscriptControlHandle { inner: this.inner.clone() };
358                        Ok(ConscriptRequest::Serve { iface: req.iface, control_handle })
359                    }
360                    0x4bcc695ef98ec8a9 => {
361                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
362                        let mut req = fidl::new_empty!(
363                            ConscriptIssueRequest,
364                            fidl::encoding::DefaultFuchsiaResourceDialect
365                        );
366                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConscriptIssueRequest>(&header, _body_bytes, handles, &mut req)?;
367                        let control_handle = ConscriptControlHandle { inner: this.inner.clone() };
368                        Ok(ConscriptRequest::Issue {
369                            iface: req.iface,
370                            request: req.request,
371
372                            responder: ConscriptIssueResponder {
373                                control_handle: std::mem::ManuallyDrop::new(control_handle),
374                                tx_id: header.tx_id,
375                            },
376                        })
377                    }
378                    _ => Err(fidl::Error::UnknownOrdinal {
379                        ordinal: header.ordinal,
380                        protocol_name:
381                            <ConscriptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
382                    }),
383                }))
384            },
385        )
386    }
387}
388
389#[derive(Debug)]
390pub enum ConscriptRequest {
391    Serve {
392        iface: fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
393        control_handle: ConscriptControlHandle,
394    },
395    Issue {
396        iface: fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
397        request: Option<String>,
398        responder: ConscriptIssueResponder,
399    },
400}
401
402impl ConscriptRequest {
403    #[allow(irrefutable_let_patterns)]
404    pub fn into_serve(
405        self,
406    ) -> Option<(fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>, ConscriptControlHandle)>
407    {
408        if let ConscriptRequest::Serve { iface, control_handle } = self {
409            Some((iface, control_handle))
410        } else {
411            None
412        }
413    }
414
415    #[allow(irrefutable_let_patterns)]
416    pub fn into_issue(
417        self,
418    ) -> Option<(
419        fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
420        Option<String>,
421        ConscriptIssueResponder,
422    )> {
423        if let ConscriptRequest::Issue { iface, request, responder } = self {
424            Some((iface, request, responder))
425        } else {
426            None
427        }
428    }
429
430    /// Name of the method defined in FIDL
431    pub fn method_name(&self) -> &'static str {
432        match *self {
433            ConscriptRequest::Serve { .. } => "serve",
434            ConscriptRequest::Issue { .. } => "issue",
435        }
436    }
437}
438
439#[derive(Debug, Clone)]
440pub struct ConscriptControlHandle {
441    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
442}
443
444impl fidl::endpoints::ControlHandle for ConscriptControlHandle {
445    fn shutdown(&self) {
446        self.inner.shutdown()
447    }
448    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
449        self.inner.shutdown_with_epitaph(status)
450    }
451
452    fn is_closed(&self) -> bool {
453        self.inner.channel().is_closed()
454    }
455    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
456        self.inner.channel().on_closed()
457    }
458
459    #[cfg(target_os = "fuchsia")]
460    fn signal_peer(
461        &self,
462        clear_mask: zx::Signals,
463        set_mask: zx::Signals,
464    ) -> Result<(), zx_status::Status> {
465        use fidl::Peered;
466        self.inner.channel().signal_peer(clear_mask, set_mask)
467    }
468}
469
470impl ConscriptControlHandle {}
471
472#[must_use = "FIDL methods require a response to be sent"]
473#[derive(Debug)]
474pub struct ConscriptIssueResponder {
475    control_handle: std::mem::ManuallyDrop<ConscriptControlHandle>,
476    tx_id: u32,
477}
478
479/// Set the the channel to be shutdown (see [`ConscriptControlHandle::shutdown`])
480/// if the responder is dropped without sending a response, so that the client
481/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
482impl std::ops::Drop for ConscriptIssueResponder {
483    fn drop(&mut self) {
484        self.control_handle.shutdown();
485        // Safety: drops once, never accessed again
486        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
487    }
488}
489
490impl fidl::endpoints::Responder for ConscriptIssueResponder {
491    type ControlHandle = ConscriptControlHandle;
492
493    fn control_handle(&self) -> &ConscriptControlHandle {
494        &self.control_handle
495    }
496
497    fn drop_without_shutdown(mut self) {
498        // Safety: drops once, never accessed again due to mem::forget
499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
500        // Prevent Drop from running (which would shut down the channel)
501        std::mem::forget(self);
502    }
503}
504
505impl ConscriptIssueResponder {
506    /// Sends a response to the FIDL transaction.
507    ///
508    /// Sets the channel to shutdown if an error occurs.
509    pub fn send(self, mut response: Option<&str>) -> Result<(), fidl::Error> {
510        let _result = self.send_raw(response);
511        if _result.is_err() {
512            self.control_handle.shutdown();
513        }
514        self.drop_without_shutdown();
515        _result
516    }
517
518    /// Similar to "send" but does not shutdown the channel if an error occurs.
519    pub fn send_no_shutdown_on_err(self, mut response: Option<&str>) -> Result<(), fidl::Error> {
520        let _result = self.send_raw(response);
521        self.drop_without_shutdown();
522        _result
523    }
524
525    fn send_raw(&self, mut response: Option<&str>) -> Result<(), fidl::Error> {
526        self.control_handle.inner.send::<ConscriptIssueResponse>(
527            (response,),
528            self.tx_id,
529            0x4bcc695ef98ec8a9,
530            fidl::encoding::DynamicFlags::empty(),
531        )
532    }
533}
534
535mod internal {
536    use super::*;
537
538    impl fidl::encoding::ResourceTypeMarker for ConscriptIssueRequest {
539        type Borrowed<'a> = &'a mut Self;
540        fn take_or_borrow<'a>(
541            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
542        ) -> Self::Borrowed<'a> {
543            value
544        }
545    }
546
547    unsafe impl fidl::encoding::TypeMarker for ConscriptIssueRequest {
548        type Owned = Self;
549
550        #[inline(always)]
551        fn inline_align(_context: fidl::encoding::Context) -> usize {
552            8
553        }
554
555        #[inline(always)]
556        fn inline_size(_context: fidl::encoding::Context) -> usize {
557            24
558        }
559    }
560
561    unsafe impl
562        fidl::encoding::Encode<ConscriptIssueRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
563        for &mut ConscriptIssueRequest
564    {
565        #[inline]
566        unsafe fn encode(
567            self,
568            encoder: &mut fidl::encoding::Encoder<
569                '_,
570                fidl::encoding::DefaultFuchsiaResourceDialect,
571            >,
572            offset: usize,
573            _depth: fidl::encoding::Depth,
574        ) -> fidl::Result<()> {
575            encoder.debug_check_bounds::<ConscriptIssueRequest>(offset);
576            // Delegate to tuple encoding.
577            fidl::encoding::Encode::<ConscriptIssueRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
578                (
579                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iface),
580                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.request),
581                ),
582                encoder, offset, _depth
583            )
584        }
585    }
586    unsafe impl<
587            T0: fidl::encoding::Encode<
588                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>>,
589                fidl::encoding::DefaultFuchsiaResourceDialect,
590            >,
591            T1: fidl::encoding::Encode<
592                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
593                fidl::encoding::DefaultFuchsiaResourceDialect,
594            >,
595        >
596        fidl::encoding::Encode<ConscriptIssueRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
597        for (T0, T1)
598    {
599        #[inline]
600        unsafe fn encode(
601            self,
602            encoder: &mut fidl::encoding::Encoder<
603                '_,
604                fidl::encoding::DefaultFuchsiaResourceDialect,
605            >,
606            offset: usize,
607            depth: fidl::encoding::Depth,
608        ) -> fidl::Result<()> {
609            encoder.debug_check_bounds::<ConscriptIssueRequest>(offset);
610            // Zero out padding regions. There's no need to apply masks
611            // because the unmasked parts will be overwritten by fields.
612            unsafe {
613                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
614                (ptr as *mut u64).write_unaligned(0);
615            }
616            // Write the fields.
617            self.0.encode(encoder, offset + 0, depth)?;
618            self.1.encode(encoder, offset + 8, depth)?;
619            Ok(())
620        }
621    }
622
623    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
624        for ConscriptIssueRequest
625    {
626        #[inline(always)]
627        fn new_empty() -> Self {
628            Self {
629                iface: fidl::new_empty!(
630                    fidl::encoding::Endpoint<
631                        fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>,
632                    >,
633                    fidl::encoding::DefaultFuchsiaResourceDialect
634                ),
635                request: fidl::new_empty!(
636                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
637                    fidl::encoding::DefaultFuchsiaResourceDialect
638                ),
639            }
640        }
641
642        #[inline]
643        unsafe fn decode(
644            &mut self,
645            decoder: &mut fidl::encoding::Decoder<
646                '_,
647                fidl::encoding::DefaultFuchsiaResourceDialect,
648            >,
649            offset: usize,
650            _depth: fidl::encoding::Depth,
651        ) -> fidl::Result<()> {
652            decoder.debug_check_bounds::<Self>(offset);
653            // Verify that padding bytes are zero.
654            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
655            let padval = unsafe { (ptr as *const u64).read_unaligned() };
656            let mask = 0xffffffff00000000u64;
657            let maskedval = padval & mask;
658            if maskedval != 0 {
659                return Err(fidl::Error::NonZeroPadding {
660                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
661                });
662            }
663            fidl::decode!(
664                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_test_echo::EchoMarker>>,
665                fidl::encoding::DefaultFuchsiaResourceDialect,
666                &mut self.iface,
667                decoder,
668                offset + 0,
669                _depth
670            )?;
671            fidl::decode!(
672                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
673                fidl::encoding::DefaultFuchsiaResourceDialect,
674                &mut self.request,
675                decoder,
676                offset + 8,
677                _depth
678            )?;
679            Ok(())
680        }
681    }
682
683    impl fidl::encoding::ValueTypeMarker for ConscriptIssueResponse {
684        type Borrowed<'a> = &'a Self;
685        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
686            value
687        }
688    }
689
690    unsafe impl fidl::encoding::TypeMarker for ConscriptIssueResponse {
691        type Owned = Self;
692
693        #[inline(always)]
694        fn inline_align(_context: fidl::encoding::Context) -> usize {
695            8
696        }
697
698        #[inline(always)]
699        fn inline_size(_context: fidl::encoding::Context) -> usize {
700            16
701        }
702    }
703
704    unsafe impl<D: fidl::encoding::ResourceDialect>
705        fidl::encoding::Encode<ConscriptIssueResponse, D> for &ConscriptIssueResponse
706    {
707        #[inline]
708        unsafe fn encode(
709            self,
710            encoder: &mut fidl::encoding::Encoder<'_, D>,
711            offset: usize,
712            _depth: fidl::encoding::Depth,
713        ) -> fidl::Result<()> {
714            encoder.debug_check_bounds::<ConscriptIssueResponse>(offset);
715            // Delegate to tuple encoding.
716            fidl::encoding::Encode::<ConscriptIssueResponse, D>::encode(
717                (
718                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
719                ),
720                encoder, offset, _depth
721            )
722        }
723    }
724    unsafe impl<
725            D: fidl::encoding::ResourceDialect,
726            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
727        > fidl::encoding::Encode<ConscriptIssueResponse, D> for (T0,)
728    {
729        #[inline]
730        unsafe fn encode(
731            self,
732            encoder: &mut fidl::encoding::Encoder<'_, D>,
733            offset: usize,
734            depth: fidl::encoding::Depth,
735        ) -> fidl::Result<()> {
736            encoder.debug_check_bounds::<ConscriptIssueResponse>(offset);
737            // Zero out padding regions. There's no need to apply masks
738            // because the unmasked parts will be overwritten by fields.
739            // Write the fields.
740            self.0.encode(encoder, offset + 0, depth)?;
741            Ok(())
742        }
743    }
744
745    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
746        for ConscriptIssueResponse
747    {
748        #[inline(always)]
749        fn new_empty() -> Self {
750            Self {
751                response: fidl::new_empty!(
752                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
753                    D
754                ),
755            }
756        }
757
758        #[inline]
759        unsafe fn decode(
760            &mut self,
761            decoder: &mut fidl::encoding::Decoder<'_, D>,
762            offset: usize,
763            _depth: fidl::encoding::Depth,
764        ) -> fidl::Result<()> {
765            decoder.debug_check_bounds::<Self>(offset);
766            // Verify that padding bytes are zero.
767            fidl::decode!(
768                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
769                D,
770                &mut self.response,
771                decoder,
772                offset + 0,
773                _depth
774            )?;
775            Ok(())
776        }
777    }
778
779    impl fidl::encoding::ResourceTypeMarker for ConscriptServeRequest {
780        type Borrowed<'a> = &'a mut Self;
781        fn take_or_borrow<'a>(
782            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
783        ) -> Self::Borrowed<'a> {
784            value
785        }
786    }
787
788    unsafe impl fidl::encoding::TypeMarker for ConscriptServeRequest {
789        type Owned = Self;
790
791        #[inline(always)]
792        fn inline_align(_context: fidl::encoding::Context) -> usize {
793            4
794        }
795
796        #[inline(always)]
797        fn inline_size(_context: fidl::encoding::Context) -> usize {
798            4
799        }
800    }
801
802    unsafe impl
803        fidl::encoding::Encode<ConscriptServeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
804        for &mut ConscriptServeRequest
805    {
806        #[inline]
807        unsafe fn encode(
808            self,
809            encoder: &mut fidl::encoding::Encoder<
810                '_,
811                fidl::encoding::DefaultFuchsiaResourceDialect,
812            >,
813            offset: usize,
814            _depth: fidl::encoding::Depth,
815        ) -> fidl::Result<()> {
816            encoder.debug_check_bounds::<ConscriptServeRequest>(offset);
817            // Delegate to tuple encoding.
818            fidl::encoding::Encode::<
819                ConscriptServeRequest,
820                fidl::encoding::DefaultFuchsiaResourceDialect,
821            >::encode(
822                (
823                    <fidl::encoding::Endpoint<
824                        fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
825                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
826                        &mut self.iface
827                    ),
828                ),
829                encoder,
830                offset,
831                _depth,
832            )
833        }
834    }
835    unsafe impl<
836            T0: fidl::encoding::Encode<
837                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>>,
838                fidl::encoding::DefaultFuchsiaResourceDialect,
839            >,
840        >
841        fidl::encoding::Encode<ConscriptServeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
842        for (T0,)
843    {
844        #[inline]
845        unsafe fn encode(
846            self,
847            encoder: &mut fidl::encoding::Encoder<
848                '_,
849                fidl::encoding::DefaultFuchsiaResourceDialect,
850            >,
851            offset: usize,
852            depth: fidl::encoding::Depth,
853        ) -> fidl::Result<()> {
854            encoder.debug_check_bounds::<ConscriptServeRequest>(offset);
855            // Zero out padding regions. There's no need to apply masks
856            // because the unmasked parts will be overwritten by fields.
857            // Write the fields.
858            self.0.encode(encoder, offset + 0, depth)?;
859            Ok(())
860        }
861    }
862
863    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
864        for ConscriptServeRequest
865    {
866        #[inline(always)]
867        fn new_empty() -> Self {
868            Self {
869                iface: fidl::new_empty!(
870                    fidl::encoding::Endpoint<
871                        fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>,
872                    >,
873                    fidl::encoding::DefaultFuchsiaResourceDialect
874                ),
875            }
876        }
877
878        #[inline]
879        unsafe fn decode(
880            &mut self,
881            decoder: &mut fidl::encoding::Decoder<
882                '_,
883                fidl::encoding::DefaultFuchsiaResourceDialect,
884            >,
885            offset: usize,
886            _depth: fidl::encoding::Depth,
887        ) -> fidl::Result<()> {
888            decoder.debug_check_bounds::<Self>(offset);
889            // Verify that padding bytes are zero.
890            fidl::decode!(
891                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_test_echo::EchoMarker>>,
892                fidl::encoding::DefaultFuchsiaResourceDialect,
893                &mut self.iface,
894                decoder,
895                offset + 0,
896                _depth
897            )?;
898            Ok(())
899        }
900    }
901}