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 fidl::endpoints::ControlHandle for ControlPlaneControlHandle {
466    fn shutdown(&self) {
467        self.inner.shutdown()
468    }
469
470    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
471        self.inner.shutdown_with_epitaph(status)
472    }
473
474    fn is_closed(&self) -> bool {
475        self.inner.channel().is_closed()
476    }
477    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
478        self.inner.channel().on_closed()
479    }
480
481    #[cfg(target_os = "fuchsia")]
482    fn signal_peer(
483        &self,
484        clear_mask: zx::Signals,
485        set_mask: zx::Signals,
486    ) -> Result<(), zx_status::Status> {
487        use fidl::Peered;
488        self.inner.channel().signal_peer(clear_mask, set_mask)
489    }
490}
491
492impl ControlPlaneControlHandle {}
493
494#[must_use = "FIDL methods require a response to be sent"]
495#[derive(Debug)]
496pub struct ControlPlaneAddChildResponder {
497    control_handle: std::mem::ManuallyDrop<ControlPlaneControlHandle>,
498    tx_id: u32,
499}
500
501/// Set the the channel to be shutdown (see [`ControlPlaneControlHandle::shutdown`])
502/// if the responder is dropped without sending a response, so that the client
503/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
504impl std::ops::Drop for ControlPlaneAddChildResponder {
505    fn drop(&mut self) {
506        self.control_handle.shutdown();
507        // Safety: drops once, never accessed again
508        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
509    }
510}
511
512impl fidl::endpoints::Responder for ControlPlaneAddChildResponder {
513    type ControlHandle = ControlPlaneControlHandle;
514
515    fn control_handle(&self) -> &ControlPlaneControlHandle {
516        &self.control_handle
517    }
518
519    fn drop_without_shutdown(mut self) {
520        // Safety: drops once, never accessed again due to mem::forget
521        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
522        // Prevent Drop from running (which would shut down the channel)
523        std::mem::forget(self);
524    }
525}
526
527impl ControlPlaneAddChildResponder {
528    /// Sends a response to the FIDL transaction.
529    ///
530    /// Sets the channel to shutdown if an error occurs.
531    pub fn send(
532        self,
533        mut result: Result<(), fidl_fuchsia_driver_framework::NodeError>,
534    ) -> Result<(), fidl::Error> {
535        let _result = self.send_raw(result);
536        if _result.is_err() {
537            self.control_handle.shutdown();
538        }
539        self.drop_without_shutdown();
540        _result
541    }
542
543    /// Similar to "send" but does not shutdown the channel if an error occurs.
544    pub fn send_no_shutdown_on_err(
545        self,
546        mut result: Result<(), fidl_fuchsia_driver_framework::NodeError>,
547    ) -> Result<(), fidl::Error> {
548        let _result = self.send_raw(result);
549        self.drop_without_shutdown();
550        _result
551    }
552
553    fn send_raw(
554        &self,
555        mut result: Result<(), fidl_fuchsia_driver_framework::NodeError>,
556    ) -> Result<(), fidl::Error> {
557        self.control_handle.inner.send::<fidl::encoding::ResultType<
558            fidl::encoding::EmptyStruct,
559            fidl_fuchsia_driver_framework::NodeError,
560        >>(
561            result,
562            self.tx_id,
563            0xfe019ea8b4f1417,
564            fidl::encoding::DynamicFlags::empty(),
565        )
566    }
567}
568
569#[must_use = "FIDL methods require a response to be sent"]
570#[derive(Debug)]
571pub struct ControlPlaneCheckResponder {
572    control_handle: std::mem::ManuallyDrop<ControlPlaneControlHandle>,
573    tx_id: u32,
574}
575
576/// Set the the channel to be shutdown (see [`ControlPlaneControlHandle::shutdown`])
577/// if the responder is dropped without sending a response, so that the client
578/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
579impl std::ops::Drop for ControlPlaneCheckResponder {
580    fn drop(&mut self) {
581        self.control_handle.shutdown();
582        // Safety: drops once, never accessed again
583        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
584    }
585}
586
587impl fidl::endpoints::Responder for ControlPlaneCheckResponder {
588    type ControlHandle = ControlPlaneControlHandle;
589
590    fn control_handle(&self) -> &ControlPlaneControlHandle {
591        &self.control_handle
592    }
593
594    fn drop_without_shutdown(mut self) {
595        // Safety: drops once, never accessed again due to mem::forget
596        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
597        // Prevent Drop from running (which would shut down the channel)
598        std::mem::forget(self);
599    }
600}
601
602impl ControlPlaneCheckResponder {
603    /// Sends a response to the FIDL transaction.
604    ///
605    /// Sets the channel to shutdown if an error occurs.
606    pub fn send(self) -> Result<(), fidl::Error> {
607        let _result = self.send_raw();
608        if _result.is_err() {
609            self.control_handle.shutdown();
610        }
611        self.drop_without_shutdown();
612        _result
613    }
614
615    /// Similar to "send" but does not shutdown the channel if an error occurs.
616    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
617        let _result = self.send_raw();
618        self.drop_without_shutdown();
619        _result
620    }
621
622    fn send_raw(&self) -> Result<(), fidl::Error> {
623        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
624            (),
625            self.tx_id,
626            0x36163bc09670a090,
627            fidl::encoding::DynamicFlags::empty(),
628        )
629    }
630}
631
632#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
633pub struct DataPlaneMarker;
634
635impl fidl::endpoints::ProtocolMarker for DataPlaneMarker {
636    type Proxy = DataPlaneProxy;
637    type RequestStream = DataPlaneRequestStream;
638    #[cfg(target_os = "fuchsia")]
639    type SynchronousProxy = DataPlaneSynchronousProxy;
640
641    const DEBUG_NAME: &'static str = "fuchsia.dictionaryoffers.test.DataPlane";
642}
643impl fidl::endpoints::DiscoverableProtocolMarker for DataPlaneMarker {}
644
645pub trait DataPlaneProxyInterface: Send + Sync {
646    type DataDoResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
647    fn r#data_do(&self) -> Self::DataDoResponseFut;
648}
649#[derive(Debug)]
650#[cfg(target_os = "fuchsia")]
651pub struct DataPlaneSynchronousProxy {
652    client: fidl::client::sync::Client,
653}
654
655#[cfg(target_os = "fuchsia")]
656impl fidl::endpoints::SynchronousProxy for DataPlaneSynchronousProxy {
657    type Proxy = DataPlaneProxy;
658    type Protocol = DataPlaneMarker;
659
660    fn from_channel(inner: fidl::Channel) -> Self {
661        Self::new(inner)
662    }
663
664    fn into_channel(self) -> fidl::Channel {
665        self.client.into_channel()
666    }
667
668    fn as_channel(&self) -> &fidl::Channel {
669        self.client.as_channel()
670    }
671}
672
673#[cfg(target_os = "fuchsia")]
674impl DataPlaneSynchronousProxy {
675    pub fn new(channel: fidl::Channel) -> Self {
676        Self { client: fidl::client::sync::Client::new(channel) }
677    }
678
679    pub fn into_channel(self) -> fidl::Channel {
680        self.client.into_channel()
681    }
682
683    /// Waits until an event arrives and returns it. It is safe for other
684    /// threads to make concurrent requests while waiting for an event.
685    pub fn wait_for_event(
686        &self,
687        deadline: zx::MonotonicInstant,
688    ) -> Result<DataPlaneEvent, fidl::Error> {
689        DataPlaneEvent::decode(self.client.wait_for_event::<DataPlaneMarker>(deadline)?)
690    }
691
692    pub fn r#data_do(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
693        let _response = self.client.send_query::<
694            fidl::encoding::EmptyPayload,
695            fidl::encoding::EmptyPayload,
696            DataPlaneMarker,
697        >(
698            (),
699            0x1c2dba0f49d279e3,
700            fidl::encoding::DynamicFlags::empty(),
701            ___deadline,
702        )?;
703        Ok(_response)
704    }
705}
706
707#[cfg(target_os = "fuchsia")]
708impl From<DataPlaneSynchronousProxy> for zx::NullableHandle {
709    fn from(value: DataPlaneSynchronousProxy) -> Self {
710        value.into_channel().into()
711    }
712}
713
714#[cfg(target_os = "fuchsia")]
715impl From<fidl::Channel> for DataPlaneSynchronousProxy {
716    fn from(value: fidl::Channel) -> Self {
717        Self::new(value)
718    }
719}
720
721#[cfg(target_os = "fuchsia")]
722impl fidl::endpoints::FromClient for DataPlaneSynchronousProxy {
723    type Protocol = DataPlaneMarker;
724
725    fn from_client(value: fidl::endpoints::ClientEnd<DataPlaneMarker>) -> Self {
726        Self::new(value.into_channel())
727    }
728}
729
730#[derive(Debug, Clone)]
731pub struct DataPlaneProxy {
732    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
733}
734
735impl fidl::endpoints::Proxy for DataPlaneProxy {
736    type Protocol = DataPlaneMarker;
737
738    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
739        Self::new(inner)
740    }
741
742    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
743        self.client.into_channel().map_err(|client| Self { client })
744    }
745
746    fn as_channel(&self) -> &::fidl::AsyncChannel {
747        self.client.as_channel()
748    }
749}
750
751impl DataPlaneProxy {
752    /// Create a new Proxy for fuchsia.dictionaryoffers.test/DataPlane.
753    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
754        let protocol_name = <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
755        Self { client: fidl::client::Client::new(channel, protocol_name) }
756    }
757
758    /// Get a Stream of events from the remote end of the protocol.
759    ///
760    /// # Panics
761    ///
762    /// Panics if the event stream was already taken.
763    pub fn take_event_stream(&self) -> DataPlaneEventStream {
764        DataPlaneEventStream { event_receiver: self.client.take_event_receiver() }
765    }
766
767    pub fn r#data_do(
768        &self,
769    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
770        DataPlaneProxyInterface::r#data_do(self)
771    }
772}
773
774impl DataPlaneProxyInterface for DataPlaneProxy {
775    type DataDoResponseFut =
776        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
777    fn r#data_do(&self) -> Self::DataDoResponseFut {
778        fn _decode(
779            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
780        ) -> Result<(), fidl::Error> {
781            let _response = fidl::client::decode_transaction_body::<
782                fidl::encoding::EmptyPayload,
783                fidl::encoding::DefaultFuchsiaResourceDialect,
784                0x1c2dba0f49d279e3,
785            >(_buf?)?;
786            Ok(_response)
787        }
788        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
789            (),
790            0x1c2dba0f49d279e3,
791            fidl::encoding::DynamicFlags::empty(),
792            _decode,
793        )
794    }
795}
796
797pub struct DataPlaneEventStream {
798    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
799}
800
801impl std::marker::Unpin for DataPlaneEventStream {}
802
803impl futures::stream::FusedStream for DataPlaneEventStream {
804    fn is_terminated(&self) -> bool {
805        self.event_receiver.is_terminated()
806    }
807}
808
809impl futures::Stream for DataPlaneEventStream {
810    type Item = Result<DataPlaneEvent, fidl::Error>;
811
812    fn poll_next(
813        mut self: std::pin::Pin<&mut Self>,
814        cx: &mut std::task::Context<'_>,
815    ) -> std::task::Poll<Option<Self::Item>> {
816        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
817            &mut self.event_receiver,
818            cx
819        )?) {
820            Some(buf) => std::task::Poll::Ready(Some(DataPlaneEvent::decode(buf))),
821            None => std::task::Poll::Ready(None),
822        }
823    }
824}
825
826#[derive(Debug)]
827pub enum DataPlaneEvent {}
828
829impl DataPlaneEvent {
830    /// Decodes a message buffer as a [`DataPlaneEvent`].
831    fn decode(
832        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
833    ) -> Result<DataPlaneEvent, fidl::Error> {
834        let (bytes, _handles) = buf.split_mut();
835        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
836        debug_assert_eq!(tx_header.tx_id, 0);
837        match tx_header.ordinal {
838            _ => Err(fidl::Error::UnknownOrdinal {
839                ordinal: tx_header.ordinal,
840                protocol_name: <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
841            }),
842        }
843    }
844}
845
846/// A Stream of incoming requests for fuchsia.dictionaryoffers.test/DataPlane.
847pub struct DataPlaneRequestStream {
848    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
849    is_terminated: bool,
850}
851
852impl std::marker::Unpin for DataPlaneRequestStream {}
853
854impl futures::stream::FusedStream for DataPlaneRequestStream {
855    fn is_terminated(&self) -> bool {
856        self.is_terminated
857    }
858}
859
860impl fidl::endpoints::RequestStream for DataPlaneRequestStream {
861    type Protocol = DataPlaneMarker;
862    type ControlHandle = DataPlaneControlHandle;
863
864    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
865        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
866    }
867
868    fn control_handle(&self) -> Self::ControlHandle {
869        DataPlaneControlHandle { inner: self.inner.clone() }
870    }
871
872    fn into_inner(
873        self,
874    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
875    {
876        (self.inner, self.is_terminated)
877    }
878
879    fn from_inner(
880        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
881        is_terminated: bool,
882    ) -> Self {
883        Self { inner, is_terminated }
884    }
885}
886
887impl futures::Stream for DataPlaneRequestStream {
888    type Item = Result<DataPlaneRequest, fidl::Error>;
889
890    fn poll_next(
891        mut self: std::pin::Pin<&mut Self>,
892        cx: &mut std::task::Context<'_>,
893    ) -> std::task::Poll<Option<Self::Item>> {
894        let this = &mut *self;
895        if this.inner.check_shutdown(cx) {
896            this.is_terminated = true;
897            return std::task::Poll::Ready(None);
898        }
899        if this.is_terminated {
900            panic!("polled DataPlaneRequestStream after completion");
901        }
902        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
903            |bytes, handles| {
904                match this.inner.channel().read_etc(cx, bytes, handles) {
905                    std::task::Poll::Ready(Ok(())) => {}
906                    std::task::Poll::Pending => return std::task::Poll::Pending,
907                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
908                        this.is_terminated = true;
909                        return std::task::Poll::Ready(None);
910                    }
911                    std::task::Poll::Ready(Err(e)) => {
912                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
913                            e.into(),
914                        ))));
915                    }
916                }
917
918                // A message has been received from the channel
919                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
920
921                std::task::Poll::Ready(Some(match header.ordinal {
922                    0x1c2dba0f49d279e3 => {
923                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
924                        let mut req = fidl::new_empty!(
925                            fidl::encoding::EmptyPayload,
926                            fidl::encoding::DefaultFuchsiaResourceDialect
927                        );
928                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
929                        let control_handle = DataPlaneControlHandle { inner: this.inner.clone() };
930                        Ok(DataPlaneRequest::DataDo {
931                            responder: DataPlaneDataDoResponder {
932                                control_handle: std::mem::ManuallyDrop::new(control_handle),
933                                tx_id: header.tx_id,
934                            },
935                        })
936                    }
937                    _ => Err(fidl::Error::UnknownOrdinal {
938                        ordinal: header.ordinal,
939                        protocol_name:
940                            <DataPlaneMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
941                    }),
942                }))
943            },
944        )
945    }
946}
947
948#[derive(Debug)]
949pub enum DataPlaneRequest {
950    DataDo { responder: DataPlaneDataDoResponder },
951}
952
953impl DataPlaneRequest {
954    #[allow(irrefutable_let_patterns)]
955    pub fn into_data_do(self) -> Option<(DataPlaneDataDoResponder)> {
956        if let DataPlaneRequest::DataDo { responder } = self { Some((responder)) } else { None }
957    }
958
959    /// Name of the method defined in FIDL
960    pub fn method_name(&self) -> &'static str {
961        match *self {
962            DataPlaneRequest::DataDo { .. } => "data_do",
963        }
964    }
965}
966
967#[derive(Debug, Clone)]
968pub struct DataPlaneControlHandle {
969    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
970}
971
972impl fidl::endpoints::ControlHandle for DataPlaneControlHandle {
973    fn shutdown(&self) {
974        self.inner.shutdown()
975    }
976
977    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
978        self.inner.shutdown_with_epitaph(status)
979    }
980
981    fn is_closed(&self) -> bool {
982        self.inner.channel().is_closed()
983    }
984    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
985        self.inner.channel().on_closed()
986    }
987
988    #[cfg(target_os = "fuchsia")]
989    fn signal_peer(
990        &self,
991        clear_mask: zx::Signals,
992        set_mask: zx::Signals,
993    ) -> Result<(), zx_status::Status> {
994        use fidl::Peered;
995        self.inner.channel().signal_peer(clear_mask, set_mask)
996    }
997}
998
999impl DataPlaneControlHandle {}
1000
1001#[must_use = "FIDL methods require a response to be sent"]
1002#[derive(Debug)]
1003pub struct DataPlaneDataDoResponder {
1004    control_handle: std::mem::ManuallyDrop<DataPlaneControlHandle>,
1005    tx_id: u32,
1006}
1007
1008/// Set the the channel to be shutdown (see [`DataPlaneControlHandle::shutdown`])
1009/// if the responder is dropped without sending a response, so that the client
1010/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1011impl std::ops::Drop for DataPlaneDataDoResponder {
1012    fn drop(&mut self) {
1013        self.control_handle.shutdown();
1014        // Safety: drops once, never accessed again
1015        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1016    }
1017}
1018
1019impl fidl::endpoints::Responder for DataPlaneDataDoResponder {
1020    type ControlHandle = DataPlaneControlHandle;
1021
1022    fn control_handle(&self) -> &DataPlaneControlHandle {
1023        &self.control_handle
1024    }
1025
1026    fn drop_without_shutdown(mut self) {
1027        // Safety: drops once, never accessed again due to mem::forget
1028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1029        // Prevent Drop from running (which would shut down the channel)
1030        std::mem::forget(self);
1031    }
1032}
1033
1034impl DataPlaneDataDoResponder {
1035    /// Sends a response to the FIDL transaction.
1036    ///
1037    /// Sets the channel to shutdown if an error occurs.
1038    pub fn send(self) -> Result<(), fidl::Error> {
1039        let _result = self.send_raw();
1040        if _result.is_err() {
1041            self.control_handle.shutdown();
1042        }
1043        self.drop_without_shutdown();
1044        _result
1045    }
1046
1047    /// Similar to "send" but does not shutdown the channel if an error occurs.
1048    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1049        let _result = self.send_raw();
1050        self.drop_without_shutdown();
1051        _result
1052    }
1053
1054    fn send_raw(&self) -> Result<(), fidl::Error> {
1055        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1056            (),
1057            self.tx_id,
1058            0x1c2dba0f49d279e3,
1059            fidl::encoding::DynamicFlags::empty(),
1060        )
1061    }
1062}
1063
1064#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1065pub struct ControlServiceMarker;
1066
1067#[cfg(target_os = "fuchsia")]
1068impl fidl::endpoints::ServiceMarker for ControlServiceMarker {
1069    type Proxy = ControlServiceProxy;
1070    type Request = ControlServiceRequest;
1071    const SERVICE_NAME: &'static str = "fuchsia.dictionaryoffers.test.ControlService";
1072}
1073
1074/// A request for one of the member protocols of ControlService.
1075///
1076#[cfg(target_os = "fuchsia")]
1077pub enum ControlServiceRequest {
1078    Control(ControlPlaneRequestStream),
1079}
1080
1081#[cfg(target_os = "fuchsia")]
1082impl fidl::endpoints::ServiceRequest for ControlServiceRequest {
1083    type Service = ControlServiceMarker;
1084
1085    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1086        match name {
1087            "control" => Self::Control(
1088                <ControlPlaneRequestStream as fidl::endpoints::RequestStream>::from_channel(
1089                    _channel,
1090                ),
1091            ),
1092            _ => panic!("no such member protocol name for service ControlService"),
1093        }
1094    }
1095
1096    fn member_names() -> &'static [&'static str] {
1097        &["control"]
1098    }
1099}
1100#[cfg(target_os = "fuchsia")]
1101pub struct ControlServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1102
1103#[cfg(target_os = "fuchsia")]
1104impl fidl::endpoints::ServiceProxy for ControlServiceProxy {
1105    type Service = ControlServiceMarker;
1106
1107    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1108        Self(opener)
1109    }
1110}
1111
1112#[cfg(target_os = "fuchsia")]
1113impl ControlServiceProxy {
1114    pub fn connect_to_control(&self) -> Result<ControlPlaneProxy, fidl::Error> {
1115        let (proxy, server_end) = fidl::endpoints::create_proxy::<ControlPlaneMarker>();
1116        self.connect_channel_to_control(server_end)?;
1117        Ok(proxy)
1118    }
1119
1120    /// Like `connect_to_control`, but returns a sync proxy.
1121    /// See [`Self::connect_to_control`] for more details.
1122    pub fn connect_to_control_sync(&self) -> Result<ControlPlaneSynchronousProxy, fidl::Error> {
1123        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControlPlaneMarker>();
1124        self.connect_channel_to_control(server_end)?;
1125        Ok(proxy)
1126    }
1127
1128    /// Like `connect_to_control`, but accepts a server end.
1129    /// See [`Self::connect_to_control`] for more details.
1130    pub fn connect_channel_to_control(
1131        &self,
1132        server_end: fidl::endpoints::ServerEnd<ControlPlaneMarker>,
1133    ) -> Result<(), fidl::Error> {
1134        self.0.open_member("control", server_end.into_channel())
1135    }
1136
1137    pub fn instance_name(&self) -> &str {
1138        self.0.instance_name()
1139    }
1140}
1141
1142#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1143pub struct DataServiceMarker;
1144
1145#[cfg(target_os = "fuchsia")]
1146impl fidl::endpoints::ServiceMarker for DataServiceMarker {
1147    type Proxy = DataServiceProxy;
1148    type Request = DataServiceRequest;
1149    const SERVICE_NAME: &'static str = "fuchsia.dictionaryoffers.test.DataService";
1150}
1151
1152/// A request for one of the member protocols of DataService.
1153///
1154#[cfg(target_os = "fuchsia")]
1155pub enum DataServiceRequest {
1156    Data(DataPlaneRequestStream),
1157}
1158
1159#[cfg(target_os = "fuchsia")]
1160impl fidl::endpoints::ServiceRequest for DataServiceRequest {
1161    type Service = DataServiceMarker;
1162
1163    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1164        match name {
1165            "data" => Self::Data(
1166                <DataPlaneRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1167            ),
1168            _ => panic!("no such member protocol name for service DataService"),
1169        }
1170    }
1171
1172    fn member_names() -> &'static [&'static str] {
1173        &["data"]
1174    }
1175}
1176#[cfg(target_os = "fuchsia")]
1177pub struct DataServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1178
1179#[cfg(target_os = "fuchsia")]
1180impl fidl::endpoints::ServiceProxy for DataServiceProxy {
1181    type Service = DataServiceMarker;
1182
1183    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1184        Self(opener)
1185    }
1186}
1187
1188#[cfg(target_os = "fuchsia")]
1189impl DataServiceProxy {
1190    pub fn connect_to_data(&self) -> Result<DataPlaneProxy, fidl::Error> {
1191        let (proxy, server_end) = fidl::endpoints::create_proxy::<DataPlaneMarker>();
1192        self.connect_channel_to_data(server_end)?;
1193        Ok(proxy)
1194    }
1195
1196    /// Like `connect_to_data`, but returns a sync proxy.
1197    /// See [`Self::connect_to_data`] for more details.
1198    pub fn connect_to_data_sync(&self) -> Result<DataPlaneSynchronousProxy, fidl::Error> {
1199        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DataPlaneMarker>();
1200        self.connect_channel_to_data(server_end)?;
1201        Ok(proxy)
1202    }
1203
1204    /// Like `connect_to_data`, but accepts a server end.
1205    /// See [`Self::connect_to_data`] for more details.
1206    pub fn connect_channel_to_data(
1207        &self,
1208        server_end: fidl::endpoints::ServerEnd<DataPlaneMarker>,
1209    ) -> Result<(), fidl::Error> {
1210        self.0.open_member("data", server_end.into_channel())
1211    }
1212
1213    pub fn instance_name(&self) -> &str {
1214        self.0.instance_name()
1215    }
1216}
1217
1218mod internal {
1219    use super::*;
1220
1221    impl fidl::encoding::ResourceTypeMarker for ControlPlaneAddChildRequest {
1222        type Borrowed<'a> = &'a mut Self;
1223        fn take_or_borrow<'a>(
1224            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1225        ) -> Self::Borrowed<'a> {
1226            value
1227        }
1228    }
1229
1230    unsafe impl fidl::encoding::TypeMarker for ControlPlaneAddChildRequest {
1231        type Owned = Self;
1232
1233        #[inline(always)]
1234        fn inline_align(_context: fidl::encoding::Context) -> usize {
1235            8
1236        }
1237
1238        #[inline(always)]
1239        fn inline_size(_context: fidl::encoding::Context) -> usize {
1240            16
1241        }
1242    }
1243
1244    unsafe impl
1245        fidl::encoding::Encode<
1246            ControlPlaneAddChildRequest,
1247            fidl::encoding::DefaultFuchsiaResourceDialect,
1248        > for &mut ControlPlaneAddChildRequest
1249    {
1250        #[inline]
1251        unsafe fn encode(
1252            self,
1253            encoder: &mut fidl::encoding::Encoder<
1254                '_,
1255                fidl::encoding::DefaultFuchsiaResourceDialect,
1256            >,
1257            offset: usize,
1258            _depth: fidl::encoding::Depth,
1259        ) -> fidl::Result<()> {
1260            encoder.debug_check_bounds::<ControlPlaneAddChildRequest>(offset);
1261            // Delegate to tuple encoding.
1262            fidl::encoding::Encode::<ControlPlaneAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1263                (
1264                    <fidl_fuchsia_driver_framework::NodeAddArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
1265                ),
1266                encoder, offset, _depth
1267            )
1268        }
1269    }
1270    unsafe impl<
1271        T0: fidl::encoding::Encode<
1272                fidl_fuchsia_driver_framework::NodeAddArgs,
1273                fidl::encoding::DefaultFuchsiaResourceDialect,
1274            >,
1275    >
1276        fidl::encoding::Encode<
1277            ControlPlaneAddChildRequest,
1278            fidl::encoding::DefaultFuchsiaResourceDialect,
1279        > for (T0,)
1280    {
1281        #[inline]
1282        unsafe fn encode(
1283            self,
1284            encoder: &mut fidl::encoding::Encoder<
1285                '_,
1286                fidl::encoding::DefaultFuchsiaResourceDialect,
1287            >,
1288            offset: usize,
1289            depth: fidl::encoding::Depth,
1290        ) -> fidl::Result<()> {
1291            encoder.debug_check_bounds::<ControlPlaneAddChildRequest>(offset);
1292            // Zero out padding regions. There's no need to apply masks
1293            // because the unmasked parts will be overwritten by fields.
1294            // Write the fields.
1295            self.0.encode(encoder, offset + 0, depth)?;
1296            Ok(())
1297        }
1298    }
1299
1300    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1301        for ControlPlaneAddChildRequest
1302    {
1303        #[inline(always)]
1304        fn new_empty() -> Self {
1305            Self {
1306                args: fidl::new_empty!(
1307                    fidl_fuchsia_driver_framework::NodeAddArgs,
1308                    fidl::encoding::DefaultFuchsiaResourceDialect
1309                ),
1310            }
1311        }
1312
1313        #[inline]
1314        unsafe fn decode(
1315            &mut self,
1316            decoder: &mut fidl::encoding::Decoder<
1317                '_,
1318                fidl::encoding::DefaultFuchsiaResourceDialect,
1319            >,
1320            offset: usize,
1321            _depth: fidl::encoding::Depth,
1322        ) -> fidl::Result<()> {
1323            decoder.debug_check_bounds::<Self>(offset);
1324            // Verify that padding bytes are zero.
1325            fidl::decode!(
1326                fidl_fuchsia_driver_framework::NodeAddArgs,
1327                fidl::encoding::DefaultFuchsiaResourceDialect,
1328                &mut self.args,
1329                decoder,
1330                offset + 0,
1331                _depth
1332            )?;
1333            Ok(())
1334        }
1335    }
1336}