Skip to main content

fidl_fuchsia_dictionaryoffers_test/
fidl_fuchsia_dictionaryoffers_test.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_fuchsia_dictionaryoffers_test__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControlPlaneAddChildRequest {
16    pub args: fidl_fuchsia_driver_framework::NodeAddArgs,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for ControlPlaneAddChildRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct ControlPlaneMarker;
26
27impl fidl::endpoints::ProtocolMarker for ControlPlaneMarker {
28    type Proxy = ControlPlaneProxy;
29    type RequestStream = ControlPlaneRequestStream;
30    #[cfg(target_os = "fuchsia")]
31    type SynchronousProxy = ControlPlaneSynchronousProxy;
32
33    const DEBUG_NAME: &'static str = "(anonymous) ControlPlane";
34}
35pub type ControlPlaneAddChildResult = Result<(), fidl_fuchsia_driver_framework::NodeError>;
36
37pub trait ControlPlaneProxyInterface: Send + Sync {
38    type AddChildResponseFut: std::future::Future<Output = Result<ControlPlaneAddChildResult, fidl::Error>>
39        + Send;
40    fn r#add_child(
41        &self,
42        args: fidl_fuchsia_driver_framework::NodeAddArgs,
43    ) -> Self::AddChildResponseFut;
44    type CheckResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
45    fn r#check(&self) -> Self::CheckResponseFut;
46}
47#[derive(Debug)]
48#[cfg(target_os = "fuchsia")]
49pub struct ControlPlaneSynchronousProxy {
50    client: fidl::client::sync::Client,
51}
52
53#[cfg(target_os = "fuchsia")]
54impl fidl::endpoints::SynchronousProxy for ControlPlaneSynchronousProxy {
55    type Proxy = ControlPlaneProxy;
56    type Protocol = ControlPlaneMarker;
57
58    fn from_channel(inner: fidl::Channel) -> Self {
59        Self::new(inner)
60    }
61
62    fn into_channel(self) -> fidl::Channel {
63        self.client.into_channel()
64    }
65
66    fn as_channel(&self) -> &fidl::Channel {
67        self.client.as_channel()
68    }
69}
70
71#[cfg(target_os = "fuchsia")]
72impl ControlPlaneSynchronousProxy {
73    pub fn new(channel: fidl::Channel) -> Self {
74        let protocol_name = <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
75        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
76    }
77
78    pub fn into_channel(self) -> fidl::Channel {
79        self.client.into_channel()
80    }
81
82    /// Waits until an event arrives and returns it. It is safe for other
83    /// threads to make concurrent requests while waiting for an event.
84    pub fn wait_for_event(
85        &self,
86        deadline: zx::MonotonicInstant,
87    ) -> Result<ControlPlaneEvent, fidl::Error> {
88        ControlPlaneEvent::decode(self.client.wait_for_event(deadline)?)
89    }
90
91    pub fn r#add_child(
92        &self,
93        mut args: fidl_fuchsia_driver_framework::NodeAddArgs,
94        ___deadline: zx::MonotonicInstant,
95    ) -> Result<ControlPlaneAddChildResult, fidl::Error> {
96        let _response =
97            self.client.send_query::<ControlPlaneAddChildRequest, fidl::encoding::ResultType<
98                fidl::encoding::EmptyStruct,
99                fidl_fuchsia_driver_framework::NodeError,
100            >>(
101                (&mut args,),
102                0xfe019ea8b4f1417,
103                fidl::encoding::DynamicFlags::empty(),
104                ___deadline,
105            )?;
106        Ok(_response.map(|x| x))
107    }
108
109    pub fn r#check(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
110        let _response =
111            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
112                (),
113                0x36163bc09670a090,
114                fidl::encoding::DynamicFlags::empty(),
115                ___deadline,
116            )?;
117        Ok(_response)
118    }
119}
120
121#[cfg(target_os = "fuchsia")]
122impl From<ControlPlaneSynchronousProxy> for zx::NullableHandle {
123    fn from(value: ControlPlaneSynchronousProxy) -> Self {
124        value.into_channel().into()
125    }
126}
127
128#[cfg(target_os = "fuchsia")]
129impl From<fidl::Channel> for ControlPlaneSynchronousProxy {
130    fn from(value: fidl::Channel) -> Self {
131        Self::new(value)
132    }
133}
134
135#[cfg(target_os = "fuchsia")]
136impl fidl::endpoints::FromClient for ControlPlaneSynchronousProxy {
137    type Protocol = ControlPlaneMarker;
138
139    fn from_client(value: fidl::endpoints::ClientEnd<ControlPlaneMarker>) -> Self {
140        Self::new(value.into_channel())
141    }
142}
143
144#[derive(Debug, Clone)]
145pub struct ControlPlaneProxy {
146    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
147}
148
149impl fidl::endpoints::Proxy for ControlPlaneProxy {
150    type Protocol = ControlPlaneMarker;
151
152    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
153        Self::new(inner)
154    }
155
156    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
157        self.client.into_channel().map_err(|client| Self { client })
158    }
159
160    fn as_channel(&self) -> &::fidl::AsyncChannel {
161        self.client.as_channel()
162    }
163}
164
165impl ControlPlaneProxy {
166    /// Create a new Proxy for fuchsia.dictionaryoffers.test/ControlPlane.
167    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
168        let protocol_name = <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
169        Self { client: fidl::client::Client::new(channel, protocol_name) }
170    }
171
172    /// Get a Stream of events from the remote end of the protocol.
173    ///
174    /// # Panics
175    ///
176    /// Panics if the event stream was already taken.
177    pub fn take_event_stream(&self) -> ControlPlaneEventStream {
178        ControlPlaneEventStream { event_receiver: self.client.take_event_receiver() }
179    }
180
181    pub fn r#add_child(
182        &self,
183        mut args: fidl_fuchsia_driver_framework::NodeAddArgs,
184    ) -> fidl::client::QueryResponseFut<
185        ControlPlaneAddChildResult,
186        fidl::encoding::DefaultFuchsiaResourceDialect,
187    > {
188        ControlPlaneProxyInterface::r#add_child(self, args)
189    }
190
191    pub fn r#check(
192        &self,
193    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
194        ControlPlaneProxyInterface::r#check(self)
195    }
196}
197
198impl ControlPlaneProxyInterface for ControlPlaneProxy {
199    type AddChildResponseFut = fidl::client::QueryResponseFut<
200        ControlPlaneAddChildResult,
201        fidl::encoding::DefaultFuchsiaResourceDialect,
202    >;
203    fn r#add_child(
204        &self,
205        mut args: fidl_fuchsia_driver_framework::NodeAddArgs,
206    ) -> Self::AddChildResponseFut {
207        fn _decode(
208            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
209        ) -> Result<ControlPlaneAddChildResult, fidl::Error> {
210            let _response = fidl::client::decode_transaction_body::<
211                fidl::encoding::ResultType<
212                    fidl::encoding::EmptyStruct,
213                    fidl_fuchsia_driver_framework::NodeError,
214                >,
215                fidl::encoding::DefaultFuchsiaResourceDialect,
216                0xfe019ea8b4f1417,
217            >(_buf?)?;
218            Ok(_response.map(|x| x))
219        }
220        self.client
221            .send_query_and_decode::<ControlPlaneAddChildRequest, ControlPlaneAddChildResult>(
222                (&mut args,),
223                0xfe019ea8b4f1417,
224                fidl::encoding::DynamicFlags::empty(),
225                _decode,
226            )
227    }
228
229    type CheckResponseFut =
230        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
231    fn r#check(&self) -> Self::CheckResponseFut {
232        fn _decode(
233            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
234        ) -> Result<(), fidl::Error> {
235            let _response = fidl::client::decode_transaction_body::<
236                fidl::encoding::EmptyPayload,
237                fidl::encoding::DefaultFuchsiaResourceDialect,
238                0x36163bc09670a090,
239            >(_buf?)?;
240            Ok(_response)
241        }
242        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
243            (),
244            0x36163bc09670a090,
245            fidl::encoding::DynamicFlags::empty(),
246            _decode,
247        )
248    }
249}
250
251pub struct ControlPlaneEventStream {
252    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
253}
254
255impl std::marker::Unpin for ControlPlaneEventStream {}
256
257impl futures::stream::FusedStream for ControlPlaneEventStream {
258    fn is_terminated(&self) -> bool {
259        self.event_receiver.is_terminated()
260    }
261}
262
263impl futures::Stream for ControlPlaneEventStream {
264    type Item = Result<ControlPlaneEvent, fidl::Error>;
265
266    fn poll_next(
267        mut self: std::pin::Pin<&mut Self>,
268        cx: &mut std::task::Context<'_>,
269    ) -> std::task::Poll<Option<Self::Item>> {
270        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
271            &mut self.event_receiver,
272            cx
273        )?) {
274            Some(buf) => std::task::Poll::Ready(Some(ControlPlaneEvent::decode(buf))),
275            None => std::task::Poll::Ready(None),
276        }
277    }
278}
279
280#[derive(Debug)]
281pub enum ControlPlaneEvent {}
282
283impl ControlPlaneEvent {
284    /// Decodes a message buffer as a [`ControlPlaneEvent`].
285    fn decode(
286        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
287    ) -> Result<ControlPlaneEvent, fidl::Error> {
288        let (bytes, _handles) = buf.split_mut();
289        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
290        debug_assert_eq!(tx_header.tx_id, 0);
291        match tx_header.ordinal {
292            _ => Err(fidl::Error::UnknownOrdinal {
293                ordinal: tx_header.ordinal,
294                protocol_name: <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
295            }),
296        }
297    }
298}
299
300/// A Stream of incoming requests for fuchsia.dictionaryoffers.test/ControlPlane.
301pub struct ControlPlaneRequestStream {
302    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
303    is_terminated: bool,
304}
305
306impl std::marker::Unpin for ControlPlaneRequestStream {}
307
308impl futures::stream::FusedStream for ControlPlaneRequestStream {
309    fn is_terminated(&self) -> bool {
310        self.is_terminated
311    }
312}
313
314impl fidl::endpoints::RequestStream for ControlPlaneRequestStream {
315    type Protocol = ControlPlaneMarker;
316    type ControlHandle = ControlPlaneControlHandle;
317
318    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
319        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
320    }
321
322    fn control_handle(&self) -> Self::ControlHandle {
323        ControlPlaneControlHandle { inner: self.inner.clone() }
324    }
325
326    fn into_inner(
327        self,
328    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
329    {
330        (self.inner, self.is_terminated)
331    }
332
333    fn from_inner(
334        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
335        is_terminated: bool,
336    ) -> Self {
337        Self { inner, is_terminated }
338    }
339}
340
341impl futures::Stream for ControlPlaneRequestStream {
342    type Item = Result<ControlPlaneRequest, fidl::Error>;
343
344    fn poll_next(
345        mut self: std::pin::Pin<&mut Self>,
346        cx: &mut std::task::Context<'_>,
347    ) -> std::task::Poll<Option<Self::Item>> {
348        let this = &mut *self;
349        if this.inner.check_shutdown(cx) {
350            this.is_terminated = true;
351            return std::task::Poll::Ready(None);
352        }
353        if this.is_terminated {
354            panic!("polled ControlPlaneRequestStream after completion");
355        }
356        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
357            |bytes, handles| {
358                match this.inner.channel().read_etc(cx, bytes, handles) {
359                    std::task::Poll::Ready(Ok(())) => {}
360                    std::task::Poll::Pending => return std::task::Poll::Pending,
361                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
362                        this.is_terminated = true;
363                        return std::task::Poll::Ready(None);
364                    }
365                    std::task::Poll::Ready(Err(e)) => {
366                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
367                            e.into(),
368                        ))));
369                    }
370                }
371
372                // A message has been received from the channel
373                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
374
375                std::task::Poll::Ready(Some(match header.ordinal {
376                    0xfe019ea8b4f1417 => {
377                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
378                        let mut req = fidl::new_empty!(
379                            ControlPlaneAddChildRequest,
380                            fidl::encoding::DefaultFuchsiaResourceDialect
381                        );
382                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlPlaneAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
383                        let control_handle =
384                            ControlPlaneControlHandle { inner: this.inner.clone() };
385                        Ok(ControlPlaneRequest::AddChild {
386                            args: req.args,
387
388                            responder: ControlPlaneAddChildResponder {
389                                control_handle: std::mem::ManuallyDrop::new(control_handle),
390                                tx_id: header.tx_id,
391                            },
392                        })
393                    }
394                    0x36163bc09670a090 => {
395                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
396                        let mut req = fidl::new_empty!(
397                            fidl::encoding::EmptyPayload,
398                            fidl::encoding::DefaultFuchsiaResourceDialect
399                        );
400                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
401                        let control_handle =
402                            ControlPlaneControlHandle { inner: this.inner.clone() };
403                        Ok(ControlPlaneRequest::Check {
404                            responder: ControlPlaneCheckResponder {
405                                control_handle: std::mem::ManuallyDrop::new(control_handle),
406                                tx_id: header.tx_id,
407                            },
408                        })
409                    }
410                    _ => Err(fidl::Error::UnknownOrdinal {
411                        ordinal: header.ordinal,
412                        protocol_name:
413                            <ControlPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
414                    }),
415                }))
416            },
417        )
418    }
419}
420
421#[derive(Debug)]
422pub enum ControlPlaneRequest {
423    AddChild {
424        args: fidl_fuchsia_driver_framework::NodeAddArgs,
425        responder: ControlPlaneAddChildResponder,
426    },
427    Check {
428        responder: ControlPlaneCheckResponder,
429    },
430}
431
432impl ControlPlaneRequest {
433    #[allow(irrefutable_let_patterns)]
434    pub fn into_add_child(
435        self,
436    ) -> Option<(fidl_fuchsia_driver_framework::NodeAddArgs, ControlPlaneAddChildResponder)> {
437        if let ControlPlaneRequest::AddChild { args, responder } = self {
438            Some((args, responder))
439        } else {
440            None
441        }
442    }
443
444    #[allow(irrefutable_let_patterns)]
445    pub fn into_check(self) -> Option<(ControlPlaneCheckResponder)> {
446        if let ControlPlaneRequest::Check { responder } = self { Some((responder)) } else { None }
447    }
448
449    /// Name of the method defined in FIDL
450    pub fn method_name(&self) -> &'static str {
451        match *self {
452            ControlPlaneRequest::AddChild { .. } => "add_child",
453            ControlPlaneRequest::Check { .. } => "check",
454        }
455    }
456}
457
458#[derive(Debug, Clone)]
459pub struct ControlPlaneControlHandle {
460    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
461}
462
463impl fidl::endpoints::ControlHandle for ControlPlaneControlHandle {
464    fn shutdown(&self) {
465        self.inner.shutdown()
466    }
467
468    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
469        self.inner.shutdown_with_epitaph(status)
470    }
471
472    fn is_closed(&self) -> bool {
473        self.inner.channel().is_closed()
474    }
475    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
476        self.inner.channel().on_closed()
477    }
478
479    #[cfg(target_os = "fuchsia")]
480    fn signal_peer(
481        &self,
482        clear_mask: zx::Signals,
483        set_mask: zx::Signals,
484    ) -> Result<(), zx_status::Status> {
485        use fidl::Peered;
486        self.inner.channel().signal_peer(clear_mask, set_mask)
487    }
488}
489
490impl ControlPlaneControlHandle {}
491
492#[must_use = "FIDL methods require a response to be sent"]
493#[derive(Debug)]
494pub struct ControlPlaneAddChildResponder {
495    control_handle: std::mem::ManuallyDrop<ControlPlaneControlHandle>,
496    tx_id: u32,
497}
498
499/// Set the the channel to be shutdown (see [`ControlPlaneControlHandle::shutdown`])
500/// if the responder is dropped without sending a response, so that the client
501/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
502impl std::ops::Drop for ControlPlaneAddChildResponder {
503    fn drop(&mut self) {
504        self.control_handle.shutdown();
505        // Safety: drops once, never accessed again
506        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
507    }
508}
509
510impl fidl::endpoints::Responder for ControlPlaneAddChildResponder {
511    type ControlHandle = ControlPlaneControlHandle;
512
513    fn control_handle(&self) -> &ControlPlaneControlHandle {
514        &self.control_handle
515    }
516
517    fn drop_without_shutdown(mut self) {
518        // Safety: drops once, never accessed again due to mem::forget
519        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
520        // Prevent Drop from running (which would shut down the channel)
521        std::mem::forget(self);
522    }
523}
524
525impl ControlPlaneAddChildResponder {
526    /// Sends a response to the FIDL transaction.
527    ///
528    /// Sets the channel to shutdown if an error occurs.
529    pub fn send(
530        self,
531        mut result: Result<(), fidl_fuchsia_driver_framework::NodeError>,
532    ) -> Result<(), fidl::Error> {
533        let _result = self.send_raw(result);
534        if _result.is_err() {
535            self.control_handle.shutdown();
536        }
537        self.drop_without_shutdown();
538        _result
539    }
540
541    /// Similar to "send" but does not shutdown the channel if an error occurs.
542    pub fn send_no_shutdown_on_err(
543        self,
544        mut result: Result<(), fidl_fuchsia_driver_framework::NodeError>,
545    ) -> Result<(), fidl::Error> {
546        let _result = self.send_raw(result);
547        self.drop_without_shutdown();
548        _result
549    }
550
551    fn send_raw(
552        &self,
553        mut result: Result<(), fidl_fuchsia_driver_framework::NodeError>,
554    ) -> Result<(), fidl::Error> {
555        self.control_handle.inner.send::<fidl::encoding::ResultType<
556            fidl::encoding::EmptyStruct,
557            fidl_fuchsia_driver_framework::NodeError,
558        >>(
559            result,
560            self.tx_id,
561            0xfe019ea8b4f1417,
562            fidl::encoding::DynamicFlags::empty(),
563        )
564    }
565}
566
567#[must_use = "FIDL methods require a response to be sent"]
568#[derive(Debug)]
569pub struct ControlPlaneCheckResponder {
570    control_handle: std::mem::ManuallyDrop<ControlPlaneControlHandle>,
571    tx_id: u32,
572}
573
574/// Set the the channel to be shutdown (see [`ControlPlaneControlHandle::shutdown`])
575/// if the responder is dropped without sending a response, so that the client
576/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
577impl std::ops::Drop for ControlPlaneCheckResponder {
578    fn drop(&mut self) {
579        self.control_handle.shutdown();
580        // Safety: drops once, never accessed again
581        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
582    }
583}
584
585impl fidl::endpoints::Responder for ControlPlaneCheckResponder {
586    type ControlHandle = ControlPlaneControlHandle;
587
588    fn control_handle(&self) -> &ControlPlaneControlHandle {
589        &self.control_handle
590    }
591
592    fn drop_without_shutdown(mut self) {
593        // Safety: drops once, never accessed again due to mem::forget
594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
595        // Prevent Drop from running (which would shut down the channel)
596        std::mem::forget(self);
597    }
598}
599
600impl ControlPlaneCheckResponder {
601    /// Sends a response to the FIDL transaction.
602    ///
603    /// Sets the channel to shutdown if an error occurs.
604    pub fn send(self) -> Result<(), fidl::Error> {
605        let _result = self.send_raw();
606        if _result.is_err() {
607            self.control_handle.shutdown();
608        }
609        self.drop_without_shutdown();
610        _result
611    }
612
613    /// Similar to "send" but does not shutdown the channel if an error occurs.
614    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
615        let _result = self.send_raw();
616        self.drop_without_shutdown();
617        _result
618    }
619
620    fn send_raw(&self) -> Result<(), fidl::Error> {
621        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
622            (),
623            self.tx_id,
624            0x36163bc09670a090,
625            fidl::encoding::DynamicFlags::empty(),
626        )
627    }
628}
629
630#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
631pub struct DataPlaneMarker;
632
633impl fidl::endpoints::ProtocolMarker for DataPlaneMarker {
634    type Proxy = DataPlaneProxy;
635    type RequestStream = DataPlaneRequestStream;
636    #[cfg(target_os = "fuchsia")]
637    type SynchronousProxy = DataPlaneSynchronousProxy;
638
639    const DEBUG_NAME: &'static str = "fuchsia.dictionaryoffers.test.DataPlane";
640}
641impl fidl::endpoints::DiscoverableProtocolMarker for DataPlaneMarker {}
642
643pub trait DataPlaneProxyInterface: Send + Sync {
644    type DataDoResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
645    fn r#data_do(&self) -> Self::DataDoResponseFut;
646}
647#[derive(Debug)]
648#[cfg(target_os = "fuchsia")]
649pub struct DataPlaneSynchronousProxy {
650    client: fidl::client::sync::Client,
651}
652
653#[cfg(target_os = "fuchsia")]
654impl fidl::endpoints::SynchronousProxy for DataPlaneSynchronousProxy {
655    type Proxy = DataPlaneProxy;
656    type Protocol = DataPlaneMarker;
657
658    fn from_channel(inner: fidl::Channel) -> Self {
659        Self::new(inner)
660    }
661
662    fn into_channel(self) -> fidl::Channel {
663        self.client.into_channel()
664    }
665
666    fn as_channel(&self) -> &fidl::Channel {
667        self.client.as_channel()
668    }
669}
670
671#[cfg(target_os = "fuchsia")]
672impl DataPlaneSynchronousProxy {
673    pub fn new(channel: fidl::Channel) -> Self {
674        let protocol_name = <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
675        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
676    }
677
678    pub fn into_channel(self) -> fidl::Channel {
679        self.client.into_channel()
680    }
681
682    /// Waits until an event arrives and returns it. It is safe for other
683    /// threads to make concurrent requests while waiting for an event.
684    pub fn wait_for_event(
685        &self,
686        deadline: zx::MonotonicInstant,
687    ) -> Result<DataPlaneEvent, fidl::Error> {
688        DataPlaneEvent::decode(self.client.wait_for_event(deadline)?)
689    }
690
691    pub fn r#data_do(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
692        let _response =
693            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
694                (),
695                0x1c2dba0f49d279e3,
696                fidl::encoding::DynamicFlags::empty(),
697                ___deadline,
698            )?;
699        Ok(_response)
700    }
701}
702
703#[cfg(target_os = "fuchsia")]
704impl From<DataPlaneSynchronousProxy> for zx::NullableHandle {
705    fn from(value: DataPlaneSynchronousProxy) -> Self {
706        value.into_channel().into()
707    }
708}
709
710#[cfg(target_os = "fuchsia")]
711impl From<fidl::Channel> for DataPlaneSynchronousProxy {
712    fn from(value: fidl::Channel) -> Self {
713        Self::new(value)
714    }
715}
716
717#[cfg(target_os = "fuchsia")]
718impl fidl::endpoints::FromClient for DataPlaneSynchronousProxy {
719    type Protocol = DataPlaneMarker;
720
721    fn from_client(value: fidl::endpoints::ClientEnd<DataPlaneMarker>) -> Self {
722        Self::new(value.into_channel())
723    }
724}
725
726#[derive(Debug, Clone)]
727pub struct DataPlaneProxy {
728    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
729}
730
731impl fidl::endpoints::Proxy for DataPlaneProxy {
732    type Protocol = DataPlaneMarker;
733
734    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
735        Self::new(inner)
736    }
737
738    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
739        self.client.into_channel().map_err(|client| Self { client })
740    }
741
742    fn as_channel(&self) -> &::fidl::AsyncChannel {
743        self.client.as_channel()
744    }
745}
746
747impl DataPlaneProxy {
748    /// Create a new Proxy for fuchsia.dictionaryoffers.test/DataPlane.
749    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
750        let protocol_name = <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
751        Self { client: fidl::client::Client::new(channel, protocol_name) }
752    }
753
754    /// Get a Stream of events from the remote end of the protocol.
755    ///
756    /// # Panics
757    ///
758    /// Panics if the event stream was already taken.
759    pub fn take_event_stream(&self) -> DataPlaneEventStream {
760        DataPlaneEventStream { event_receiver: self.client.take_event_receiver() }
761    }
762
763    pub fn r#data_do(
764        &self,
765    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
766        DataPlaneProxyInterface::r#data_do(self)
767    }
768}
769
770impl DataPlaneProxyInterface for DataPlaneProxy {
771    type DataDoResponseFut =
772        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
773    fn r#data_do(&self) -> Self::DataDoResponseFut {
774        fn _decode(
775            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
776        ) -> Result<(), fidl::Error> {
777            let _response = fidl::client::decode_transaction_body::<
778                fidl::encoding::EmptyPayload,
779                fidl::encoding::DefaultFuchsiaResourceDialect,
780                0x1c2dba0f49d279e3,
781            >(_buf?)?;
782            Ok(_response)
783        }
784        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
785            (),
786            0x1c2dba0f49d279e3,
787            fidl::encoding::DynamicFlags::empty(),
788            _decode,
789        )
790    }
791}
792
793pub struct DataPlaneEventStream {
794    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
795}
796
797impl std::marker::Unpin for DataPlaneEventStream {}
798
799impl futures::stream::FusedStream for DataPlaneEventStream {
800    fn is_terminated(&self) -> bool {
801        self.event_receiver.is_terminated()
802    }
803}
804
805impl futures::Stream for DataPlaneEventStream {
806    type Item = Result<DataPlaneEvent, fidl::Error>;
807
808    fn poll_next(
809        mut self: std::pin::Pin<&mut Self>,
810        cx: &mut std::task::Context<'_>,
811    ) -> std::task::Poll<Option<Self::Item>> {
812        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
813            &mut self.event_receiver,
814            cx
815        )?) {
816            Some(buf) => std::task::Poll::Ready(Some(DataPlaneEvent::decode(buf))),
817            None => std::task::Poll::Ready(None),
818        }
819    }
820}
821
822#[derive(Debug)]
823pub enum DataPlaneEvent {}
824
825impl DataPlaneEvent {
826    /// Decodes a message buffer as a [`DataPlaneEvent`].
827    fn decode(
828        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
829    ) -> Result<DataPlaneEvent, fidl::Error> {
830        let (bytes, _handles) = buf.split_mut();
831        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
832        debug_assert_eq!(tx_header.tx_id, 0);
833        match tx_header.ordinal {
834            _ => Err(fidl::Error::UnknownOrdinal {
835                ordinal: tx_header.ordinal,
836                protocol_name: <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
837            }),
838        }
839    }
840}
841
842/// A Stream of incoming requests for fuchsia.dictionaryoffers.test/DataPlane.
843pub struct DataPlaneRequestStream {
844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
845    is_terminated: bool,
846}
847
848impl std::marker::Unpin for DataPlaneRequestStream {}
849
850impl futures::stream::FusedStream for DataPlaneRequestStream {
851    fn is_terminated(&self) -> bool {
852        self.is_terminated
853    }
854}
855
856impl fidl::endpoints::RequestStream for DataPlaneRequestStream {
857    type Protocol = DataPlaneMarker;
858    type ControlHandle = DataPlaneControlHandle;
859
860    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
861        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
862    }
863
864    fn control_handle(&self) -> Self::ControlHandle {
865        DataPlaneControlHandle { inner: self.inner.clone() }
866    }
867
868    fn into_inner(
869        self,
870    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
871    {
872        (self.inner, self.is_terminated)
873    }
874
875    fn from_inner(
876        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
877        is_terminated: bool,
878    ) -> Self {
879        Self { inner, is_terminated }
880    }
881}
882
883impl futures::Stream for DataPlaneRequestStream {
884    type Item = Result<DataPlaneRequest, fidl::Error>;
885
886    fn poll_next(
887        mut self: std::pin::Pin<&mut Self>,
888        cx: &mut std::task::Context<'_>,
889    ) -> std::task::Poll<Option<Self::Item>> {
890        let this = &mut *self;
891        if this.inner.check_shutdown(cx) {
892            this.is_terminated = true;
893            return std::task::Poll::Ready(None);
894        }
895        if this.is_terminated {
896            panic!("polled DataPlaneRequestStream after completion");
897        }
898        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
899            |bytes, handles| {
900                match this.inner.channel().read_etc(cx, bytes, handles) {
901                    std::task::Poll::Ready(Ok(())) => {}
902                    std::task::Poll::Pending => return std::task::Poll::Pending,
903                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
904                        this.is_terminated = true;
905                        return std::task::Poll::Ready(None);
906                    }
907                    std::task::Poll::Ready(Err(e)) => {
908                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
909                            e.into(),
910                        ))));
911                    }
912                }
913
914                // A message has been received from the channel
915                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
916
917                std::task::Poll::Ready(Some(match header.ordinal {
918                    0x1c2dba0f49d279e3 => {
919                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
920                        let mut req = fidl::new_empty!(
921                            fidl::encoding::EmptyPayload,
922                            fidl::encoding::DefaultFuchsiaResourceDialect
923                        );
924                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
925                        let control_handle = DataPlaneControlHandle { inner: this.inner.clone() };
926                        Ok(DataPlaneRequest::DataDo {
927                            responder: DataPlaneDataDoResponder {
928                                control_handle: std::mem::ManuallyDrop::new(control_handle),
929                                tx_id: header.tx_id,
930                            },
931                        })
932                    }
933                    _ => Err(fidl::Error::UnknownOrdinal {
934                        ordinal: header.ordinal,
935                        protocol_name:
936                            <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
937                    }),
938                }))
939            },
940        )
941    }
942}
943
944#[derive(Debug)]
945pub enum DataPlaneRequest {
946    DataDo { responder: DataPlaneDataDoResponder },
947}
948
949impl DataPlaneRequest {
950    #[allow(irrefutable_let_patterns)]
951    pub fn into_data_do(self) -> Option<(DataPlaneDataDoResponder)> {
952        if let DataPlaneRequest::DataDo { responder } = self { Some((responder)) } else { None }
953    }
954
955    /// Name of the method defined in FIDL
956    pub fn method_name(&self) -> &'static str {
957        match *self {
958            DataPlaneRequest::DataDo { .. } => "data_do",
959        }
960    }
961}
962
963#[derive(Debug, Clone)]
964pub struct DataPlaneControlHandle {
965    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
966}
967
968impl fidl::endpoints::ControlHandle for DataPlaneControlHandle {
969    fn shutdown(&self) {
970        self.inner.shutdown()
971    }
972
973    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
974        self.inner.shutdown_with_epitaph(status)
975    }
976
977    fn is_closed(&self) -> bool {
978        self.inner.channel().is_closed()
979    }
980    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
981        self.inner.channel().on_closed()
982    }
983
984    #[cfg(target_os = "fuchsia")]
985    fn signal_peer(
986        &self,
987        clear_mask: zx::Signals,
988        set_mask: zx::Signals,
989    ) -> Result<(), zx_status::Status> {
990        use fidl::Peered;
991        self.inner.channel().signal_peer(clear_mask, set_mask)
992    }
993}
994
995impl DataPlaneControlHandle {}
996
997#[must_use = "FIDL methods require a response to be sent"]
998#[derive(Debug)]
999pub struct DataPlaneDataDoResponder {
1000    control_handle: std::mem::ManuallyDrop<DataPlaneControlHandle>,
1001    tx_id: u32,
1002}
1003
1004/// Set the the channel to be shutdown (see [`DataPlaneControlHandle::shutdown`])
1005/// if the responder is dropped without sending a response, so that the client
1006/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1007impl std::ops::Drop for DataPlaneDataDoResponder {
1008    fn drop(&mut self) {
1009        self.control_handle.shutdown();
1010        // Safety: drops once, never accessed again
1011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012    }
1013}
1014
1015impl fidl::endpoints::Responder for DataPlaneDataDoResponder {
1016    type ControlHandle = DataPlaneControlHandle;
1017
1018    fn control_handle(&self) -> &DataPlaneControlHandle {
1019        &self.control_handle
1020    }
1021
1022    fn drop_without_shutdown(mut self) {
1023        // Safety: drops once, never accessed again due to mem::forget
1024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025        // Prevent Drop from running (which would shut down the channel)
1026        std::mem::forget(self);
1027    }
1028}
1029
1030impl DataPlaneDataDoResponder {
1031    /// Sends a response to the FIDL transaction.
1032    ///
1033    /// Sets the channel to shutdown if an error occurs.
1034    pub fn send(self) -> Result<(), fidl::Error> {
1035        let _result = self.send_raw();
1036        if _result.is_err() {
1037            self.control_handle.shutdown();
1038        }
1039        self.drop_without_shutdown();
1040        _result
1041    }
1042
1043    /// Similar to "send" but does not shutdown the channel if an error occurs.
1044    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1045        let _result = self.send_raw();
1046        self.drop_without_shutdown();
1047        _result
1048    }
1049
1050    fn send_raw(&self) -> Result<(), fidl::Error> {
1051        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1052            (),
1053            self.tx_id,
1054            0x1c2dba0f49d279e3,
1055            fidl::encoding::DynamicFlags::empty(),
1056        )
1057    }
1058}
1059
1060#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1061pub struct ControlServiceMarker;
1062
1063#[cfg(target_os = "fuchsia")]
1064impl fidl::endpoints::ServiceMarker for ControlServiceMarker {
1065    type Proxy = ControlServiceProxy;
1066    type Request = ControlServiceRequest;
1067    const SERVICE_NAME: &'static str = "fuchsia.dictionaryoffers.test.ControlService";
1068}
1069
1070/// A request for one of the member protocols of ControlService.
1071///
1072#[cfg(target_os = "fuchsia")]
1073pub enum ControlServiceRequest {
1074    Control(ControlPlaneRequestStream),
1075}
1076
1077#[cfg(target_os = "fuchsia")]
1078impl fidl::endpoints::ServiceRequest for ControlServiceRequest {
1079    type Service = ControlServiceMarker;
1080
1081    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1082        match name {
1083            "control" => Self::Control(
1084                <ControlPlaneRequestStream as fidl::endpoints::RequestStream>::from_channel(
1085                    _channel,
1086                ),
1087            ),
1088            _ => panic!("no such member protocol name for service ControlService"),
1089        }
1090    }
1091
1092    fn member_names() -> &'static [&'static str] {
1093        &["control"]
1094    }
1095}
1096#[cfg(target_os = "fuchsia")]
1097pub struct ControlServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1098
1099#[cfg(target_os = "fuchsia")]
1100impl fidl::endpoints::ServiceProxy for ControlServiceProxy {
1101    type Service = ControlServiceMarker;
1102
1103    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1104        Self(opener)
1105    }
1106}
1107
1108#[cfg(target_os = "fuchsia")]
1109impl ControlServiceProxy {
1110    pub fn connect_to_control(&self) -> Result<ControlPlaneProxy, fidl::Error> {
1111        let (proxy, server_end) = fidl::endpoints::create_proxy::<ControlPlaneMarker>();
1112        self.connect_channel_to_control(server_end)?;
1113        Ok(proxy)
1114    }
1115
1116    /// Like `connect_to_control`, but returns a sync proxy.
1117    /// See [`Self::connect_to_control`] for more details.
1118    pub fn connect_to_control_sync(&self) -> Result<ControlPlaneSynchronousProxy, fidl::Error> {
1119        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControlPlaneMarker>();
1120        self.connect_channel_to_control(server_end)?;
1121        Ok(proxy)
1122    }
1123
1124    /// Like `connect_to_control`, but accepts a server end.
1125    /// See [`Self::connect_to_control`] for more details.
1126    pub fn connect_channel_to_control(
1127        &self,
1128        server_end: fidl::endpoints::ServerEnd<ControlPlaneMarker>,
1129    ) -> Result<(), fidl::Error> {
1130        self.0.open_member("control", server_end.into_channel())
1131    }
1132
1133    pub fn instance_name(&self) -> &str {
1134        self.0.instance_name()
1135    }
1136}
1137
1138#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1139pub struct DataServiceMarker;
1140
1141#[cfg(target_os = "fuchsia")]
1142impl fidl::endpoints::ServiceMarker for DataServiceMarker {
1143    type Proxy = DataServiceProxy;
1144    type Request = DataServiceRequest;
1145    const SERVICE_NAME: &'static str = "fuchsia.dictionaryoffers.test.DataService";
1146}
1147
1148/// A request for one of the member protocols of DataService.
1149///
1150#[cfg(target_os = "fuchsia")]
1151pub enum DataServiceRequest {
1152    Data(DataPlaneRequestStream),
1153}
1154
1155#[cfg(target_os = "fuchsia")]
1156impl fidl::endpoints::ServiceRequest for DataServiceRequest {
1157    type Service = DataServiceMarker;
1158
1159    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1160        match name {
1161            "data" => Self::Data(
1162                <DataPlaneRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1163            ),
1164            _ => panic!("no such member protocol name for service DataService"),
1165        }
1166    }
1167
1168    fn member_names() -> &'static [&'static str] {
1169        &["data"]
1170    }
1171}
1172#[cfg(target_os = "fuchsia")]
1173pub struct DataServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1174
1175#[cfg(target_os = "fuchsia")]
1176impl fidl::endpoints::ServiceProxy for DataServiceProxy {
1177    type Service = DataServiceMarker;
1178
1179    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1180        Self(opener)
1181    }
1182}
1183
1184#[cfg(target_os = "fuchsia")]
1185impl DataServiceProxy {
1186    pub fn connect_to_data(&self) -> Result<DataPlaneProxy, fidl::Error> {
1187        let (proxy, server_end) = fidl::endpoints::create_proxy::<DataPlaneMarker>();
1188        self.connect_channel_to_data(server_end)?;
1189        Ok(proxy)
1190    }
1191
1192    /// Like `connect_to_data`, but returns a sync proxy.
1193    /// See [`Self::connect_to_data`] for more details.
1194    pub fn connect_to_data_sync(&self) -> Result<DataPlaneSynchronousProxy, fidl::Error> {
1195        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DataPlaneMarker>();
1196        self.connect_channel_to_data(server_end)?;
1197        Ok(proxy)
1198    }
1199
1200    /// Like `connect_to_data`, but accepts a server end.
1201    /// See [`Self::connect_to_data`] for more details.
1202    pub fn connect_channel_to_data(
1203        &self,
1204        server_end: fidl::endpoints::ServerEnd<DataPlaneMarker>,
1205    ) -> Result<(), fidl::Error> {
1206        self.0.open_member("data", server_end.into_channel())
1207    }
1208
1209    pub fn instance_name(&self) -> &str {
1210        self.0.instance_name()
1211    }
1212}
1213
1214mod internal {
1215    use super::*;
1216
1217    impl fidl::encoding::ResourceTypeMarker for ControlPlaneAddChildRequest {
1218        type Borrowed<'a> = &'a mut Self;
1219        fn take_or_borrow<'a>(
1220            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1221        ) -> Self::Borrowed<'a> {
1222            value
1223        }
1224    }
1225
1226    unsafe impl fidl::encoding::TypeMarker for ControlPlaneAddChildRequest {
1227        type Owned = Self;
1228
1229        #[inline(always)]
1230        fn inline_align(_context: fidl::encoding::Context) -> usize {
1231            8
1232        }
1233
1234        #[inline(always)]
1235        fn inline_size(_context: fidl::encoding::Context) -> usize {
1236            16
1237        }
1238    }
1239
1240    unsafe impl
1241        fidl::encoding::Encode<
1242            ControlPlaneAddChildRequest,
1243            fidl::encoding::DefaultFuchsiaResourceDialect,
1244        > for &mut ControlPlaneAddChildRequest
1245    {
1246        #[inline]
1247        unsafe fn encode(
1248            self,
1249            encoder: &mut fidl::encoding::Encoder<
1250                '_,
1251                fidl::encoding::DefaultFuchsiaResourceDialect,
1252            >,
1253            offset: usize,
1254            _depth: fidl::encoding::Depth,
1255        ) -> fidl::Result<()> {
1256            encoder.debug_check_bounds::<ControlPlaneAddChildRequest>(offset);
1257            // Delegate to tuple encoding.
1258            fidl::encoding::Encode::<ControlPlaneAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1259                (
1260                    <fidl_fuchsia_driver_framework::NodeAddArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
1261                ),
1262                encoder, offset, _depth
1263            )
1264        }
1265    }
1266    unsafe impl<
1267        T0: fidl::encoding::Encode<
1268                fidl_fuchsia_driver_framework::NodeAddArgs,
1269                fidl::encoding::DefaultFuchsiaResourceDialect,
1270            >,
1271    >
1272        fidl::encoding::Encode<
1273            ControlPlaneAddChildRequest,
1274            fidl::encoding::DefaultFuchsiaResourceDialect,
1275        > for (T0,)
1276    {
1277        #[inline]
1278        unsafe fn encode(
1279            self,
1280            encoder: &mut fidl::encoding::Encoder<
1281                '_,
1282                fidl::encoding::DefaultFuchsiaResourceDialect,
1283            >,
1284            offset: usize,
1285            depth: fidl::encoding::Depth,
1286        ) -> fidl::Result<()> {
1287            encoder.debug_check_bounds::<ControlPlaneAddChildRequest>(offset);
1288            // Zero out padding regions. There's no need to apply masks
1289            // because the unmasked parts will be overwritten by fields.
1290            // Write the fields.
1291            self.0.encode(encoder, offset + 0, depth)?;
1292            Ok(())
1293        }
1294    }
1295
1296    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1297        for ControlPlaneAddChildRequest
1298    {
1299        #[inline(always)]
1300        fn new_empty() -> Self {
1301            Self {
1302                args: fidl::new_empty!(
1303                    fidl_fuchsia_driver_framework::NodeAddArgs,
1304                    fidl::encoding::DefaultFuchsiaResourceDialect
1305                ),
1306            }
1307        }
1308
1309        #[inline]
1310        unsafe fn decode(
1311            &mut self,
1312            decoder: &mut fidl::encoding::Decoder<
1313                '_,
1314                fidl::encoding::DefaultFuchsiaResourceDialect,
1315            >,
1316            offset: usize,
1317            _depth: fidl::encoding::Depth,
1318        ) -> fidl::Result<()> {
1319            decoder.debug_check_bounds::<Self>(offset);
1320            // Verify that padding bytes are zero.
1321            fidl::decode!(
1322                fidl_fuchsia_driver_framework::NodeAddArgs,
1323                fidl::encoding::DefaultFuchsiaResourceDialect,
1324                &mut self.args,
1325                decoder,
1326                offset + 0,
1327                _depth
1328            )?;
1329            Ok(())
1330        }
1331    }
1332}