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