fidl_fuchsia_factory_lowpan/
fidl_fuchsia_factory_lowpan.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct FactoryDeviceSendMfgCommandRequest {
15    pub command: String,
16}
17
18impl fidl::Persistable for FactoryDeviceSendMfgCommandRequest {}
19
20#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
21pub struct FactoryDeviceSendMfgCommandResponse {
22    pub response: String,
23}
24
25impl fidl::Persistable for FactoryDeviceSendMfgCommandResponse {}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct FactoryDeviceSetupOtCliRequest {
29    pub server_socket: fidl::Socket,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for FactoryDeviceSetupOtCliRequest
34{
35}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct FactoryDriverGetFactoryDeviceRequest {
39    pub device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for FactoryDriverGetFactoryDeviceRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct FactoryLookupLookupRequest {
49    pub name: String,
50    pub device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54    for FactoryLookupLookupRequest
55{
56}
57
58#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59pub struct FactoryRegisterRegisterRequest {
60    pub name: String,
61    pub driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65    for FactoryRegisterRegisterRequest
66{
67}
68
69#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
70pub struct FactoryDeviceMarker;
71
72impl fidl::endpoints::ProtocolMarker for FactoryDeviceMarker {
73    type Proxy = FactoryDeviceProxy;
74    type RequestStream = FactoryDeviceRequestStream;
75    #[cfg(target_os = "fuchsia")]
76    type SynchronousProxy = FactoryDeviceSynchronousProxy;
77
78    const DEBUG_NAME: &'static str = "(anonymous) FactoryDevice";
79}
80
81pub trait FactoryDeviceProxyInterface: Send + Sync {
82    type SendMfgCommandResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
83    fn r#send_mfg_command(&self, command: &str) -> Self::SendMfgCommandResponseFut;
84    type SetupOtCliResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
85    fn r#setup_ot_cli(&self, server_socket: fidl::Socket) -> Self::SetupOtCliResponseFut;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct FactoryDeviceSynchronousProxy {
90    client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for FactoryDeviceSynchronousProxy {
95    type Proxy = FactoryDeviceProxy;
96    type Protocol = FactoryDeviceMarker;
97
98    fn from_channel(inner: fidl::Channel) -> Self {
99        Self::new(inner)
100    }
101
102    fn into_channel(self) -> fidl::Channel {
103        self.client.into_channel()
104    }
105
106    fn as_channel(&self) -> &fidl::Channel {
107        self.client.as_channel()
108    }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl FactoryDeviceSynchronousProxy {
113    pub fn new(channel: fidl::Channel) -> Self {
114        let protocol_name = <FactoryDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
115        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
116    }
117
118    pub fn into_channel(self) -> fidl::Channel {
119        self.client.into_channel()
120    }
121
122    /// Waits until an event arrives and returns it. It is safe for other
123    /// threads to make concurrent requests while waiting for an event.
124    pub fn wait_for_event(
125        &self,
126        deadline: zx::MonotonicInstant,
127    ) -> Result<FactoryDeviceEvent, fidl::Error> {
128        FactoryDeviceEvent::decode(self.client.wait_for_event(deadline)?)
129    }
130
131    /// Send a proprietary manufacturing command to the device and return the response.
132    ///
133    /// This method is intended to be used to facilitate device testing on the assembly line and is
134    /// typically only used during device manufacturing.
135    ///
136    /// Commands are given as strings (command + arguments) and the response is also a string. The
137    /// usage and format of the commands is dependent on the firmware on the LoWPAN device.
138    ///
139    /// When finished sending manufacturing commands, call `fuchsia.lowpan.test.DeviceTest.reset()`
140    /// to return the device to normal behavior.
141    pub fn r#send_mfg_command(
142        &self,
143        mut command: &str,
144        ___deadline: zx::MonotonicInstant,
145    ) -> Result<String, fidl::Error> {
146        let _response = self
147            .client
148            .send_query::<FactoryDeviceSendMfgCommandRequest, FactoryDeviceSendMfgCommandResponse>(
149                (command,),
150                0x61ea2fba8c9fb7,
151                fidl::encoding::DynamicFlags::empty(),
152                ___deadline,
153            )?;
154        Ok(_response.response)
155    }
156
157    /// Send proprietary manufacturing commands to the device and return the response.
158    ///
159    /// This method is intended to send the exact same set of commands as SendMfgCommand(), but
160    /// instead of sending one command at a time, this method opens an opens an interactive shell
161    /// operated over `server_socket`.
162    pub fn r#setup_ot_cli(
163        &self,
164        mut server_socket: fidl::Socket,
165        ___deadline: zx::MonotonicInstant,
166    ) -> Result<(), fidl::Error> {
167        let _response = self
168            .client
169            .send_query::<FactoryDeviceSetupOtCliRequest, fidl::encoding::EmptyPayload>(
170                (server_socket,),
171                0x6a2b94d0a72e1663,
172                fidl::encoding::DynamicFlags::empty(),
173                ___deadline,
174            )?;
175        Ok(_response)
176    }
177}
178
179#[derive(Debug, Clone)]
180pub struct FactoryDeviceProxy {
181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
182}
183
184impl fidl::endpoints::Proxy for FactoryDeviceProxy {
185    type Protocol = FactoryDeviceMarker;
186
187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
188        Self::new(inner)
189    }
190
191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
192        self.client.into_channel().map_err(|client| Self { client })
193    }
194
195    fn as_channel(&self) -> &::fidl::AsyncChannel {
196        self.client.as_channel()
197    }
198}
199
200impl FactoryDeviceProxy {
201    /// Create a new Proxy for fuchsia.factory.lowpan/FactoryDevice.
202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
203        let protocol_name = <FactoryDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
204        Self { client: fidl::client::Client::new(channel, protocol_name) }
205    }
206
207    /// Get a Stream of events from the remote end of the protocol.
208    ///
209    /// # Panics
210    ///
211    /// Panics if the event stream was already taken.
212    pub fn take_event_stream(&self) -> FactoryDeviceEventStream {
213        FactoryDeviceEventStream { event_receiver: self.client.take_event_receiver() }
214    }
215
216    /// Send a proprietary manufacturing command to the device and return the response.
217    ///
218    /// This method is intended to be used to facilitate device testing on the assembly line and is
219    /// typically only used during device manufacturing.
220    ///
221    /// Commands are given as strings (command + arguments) and the response is also a string. The
222    /// usage and format of the commands is dependent on the firmware on the LoWPAN device.
223    ///
224    /// When finished sending manufacturing commands, call `fuchsia.lowpan.test.DeviceTest.reset()`
225    /// to return the device to normal behavior.
226    pub fn r#send_mfg_command(
227        &self,
228        mut command: &str,
229    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
230        FactoryDeviceProxyInterface::r#send_mfg_command(self, command)
231    }
232
233    /// Send proprietary manufacturing commands to the device and return the response.
234    ///
235    /// This method is intended to send the exact same set of commands as SendMfgCommand(), but
236    /// instead of sending one command at a time, this method opens an opens an interactive shell
237    /// operated over `server_socket`.
238    pub fn r#setup_ot_cli(
239        &self,
240        mut server_socket: fidl::Socket,
241    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
242        FactoryDeviceProxyInterface::r#setup_ot_cli(self, server_socket)
243    }
244}
245
246impl FactoryDeviceProxyInterface for FactoryDeviceProxy {
247    type SendMfgCommandResponseFut =
248        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
249    fn r#send_mfg_command(&self, mut command: &str) -> Self::SendMfgCommandResponseFut {
250        fn _decode(
251            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
252        ) -> Result<String, fidl::Error> {
253            let _response = fidl::client::decode_transaction_body::<
254                FactoryDeviceSendMfgCommandResponse,
255                fidl::encoding::DefaultFuchsiaResourceDialect,
256                0x61ea2fba8c9fb7,
257            >(_buf?)?;
258            Ok(_response.response)
259        }
260        self.client.send_query_and_decode::<FactoryDeviceSendMfgCommandRequest, String>(
261            (command,),
262            0x61ea2fba8c9fb7,
263            fidl::encoding::DynamicFlags::empty(),
264            _decode,
265        )
266    }
267
268    type SetupOtCliResponseFut =
269        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
270    fn r#setup_ot_cli(&self, mut server_socket: fidl::Socket) -> Self::SetupOtCliResponseFut {
271        fn _decode(
272            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
273        ) -> Result<(), fidl::Error> {
274            let _response = fidl::client::decode_transaction_body::<
275                fidl::encoding::EmptyPayload,
276                fidl::encoding::DefaultFuchsiaResourceDialect,
277                0x6a2b94d0a72e1663,
278            >(_buf?)?;
279            Ok(_response)
280        }
281        self.client.send_query_and_decode::<FactoryDeviceSetupOtCliRequest, ()>(
282            (server_socket,),
283            0x6a2b94d0a72e1663,
284            fidl::encoding::DynamicFlags::empty(),
285            _decode,
286        )
287    }
288}
289
290pub struct FactoryDeviceEventStream {
291    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
292}
293
294impl std::marker::Unpin for FactoryDeviceEventStream {}
295
296impl futures::stream::FusedStream for FactoryDeviceEventStream {
297    fn is_terminated(&self) -> bool {
298        self.event_receiver.is_terminated()
299    }
300}
301
302impl futures::Stream for FactoryDeviceEventStream {
303    type Item = Result<FactoryDeviceEvent, fidl::Error>;
304
305    fn poll_next(
306        mut self: std::pin::Pin<&mut Self>,
307        cx: &mut std::task::Context<'_>,
308    ) -> std::task::Poll<Option<Self::Item>> {
309        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
310            &mut self.event_receiver,
311            cx
312        )?) {
313            Some(buf) => std::task::Poll::Ready(Some(FactoryDeviceEvent::decode(buf))),
314            None => std::task::Poll::Ready(None),
315        }
316    }
317}
318
319#[derive(Debug)]
320pub enum FactoryDeviceEvent {}
321
322impl FactoryDeviceEvent {
323    /// Decodes a message buffer as a [`FactoryDeviceEvent`].
324    fn decode(
325        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
326    ) -> Result<FactoryDeviceEvent, fidl::Error> {
327        let (bytes, _handles) = buf.split_mut();
328        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
329        debug_assert_eq!(tx_header.tx_id, 0);
330        match tx_header.ordinal {
331            _ => Err(fidl::Error::UnknownOrdinal {
332                ordinal: tx_header.ordinal,
333                protocol_name: <FactoryDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
334            }),
335        }
336    }
337}
338
339/// A Stream of incoming requests for fuchsia.factory.lowpan/FactoryDevice.
340pub struct FactoryDeviceRequestStream {
341    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
342    is_terminated: bool,
343}
344
345impl std::marker::Unpin for FactoryDeviceRequestStream {}
346
347impl futures::stream::FusedStream for FactoryDeviceRequestStream {
348    fn is_terminated(&self) -> bool {
349        self.is_terminated
350    }
351}
352
353impl fidl::endpoints::RequestStream for FactoryDeviceRequestStream {
354    type Protocol = FactoryDeviceMarker;
355    type ControlHandle = FactoryDeviceControlHandle;
356
357    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
358        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
359    }
360
361    fn control_handle(&self) -> Self::ControlHandle {
362        FactoryDeviceControlHandle { inner: self.inner.clone() }
363    }
364
365    fn into_inner(
366        self,
367    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
368    {
369        (self.inner, self.is_terminated)
370    }
371
372    fn from_inner(
373        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
374        is_terminated: bool,
375    ) -> Self {
376        Self { inner, is_terminated }
377    }
378}
379
380impl futures::Stream for FactoryDeviceRequestStream {
381    type Item = Result<FactoryDeviceRequest, fidl::Error>;
382
383    fn poll_next(
384        mut self: std::pin::Pin<&mut Self>,
385        cx: &mut std::task::Context<'_>,
386    ) -> std::task::Poll<Option<Self::Item>> {
387        let this = &mut *self;
388        if this.inner.check_shutdown(cx) {
389            this.is_terminated = true;
390            return std::task::Poll::Ready(None);
391        }
392        if this.is_terminated {
393            panic!("polled FactoryDeviceRequestStream after completion");
394        }
395        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
396            |bytes, handles| {
397                match this.inner.channel().read_etc(cx, bytes, handles) {
398                    std::task::Poll::Ready(Ok(())) => {}
399                    std::task::Poll::Pending => return std::task::Poll::Pending,
400                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
401                        this.is_terminated = true;
402                        return std::task::Poll::Ready(None);
403                    }
404                    std::task::Poll::Ready(Err(e)) => {
405                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
406                            e.into(),
407                        ))))
408                    }
409                }
410
411                // A message has been received from the channel
412                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
413
414                std::task::Poll::Ready(Some(match header.ordinal {
415                    0x61ea2fba8c9fb7 => {
416                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
417                        let mut req = fidl::new_empty!(
418                            FactoryDeviceSendMfgCommandRequest,
419                            fidl::encoding::DefaultFuchsiaResourceDialect
420                        );
421                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryDeviceSendMfgCommandRequest>(&header, _body_bytes, handles, &mut req)?;
422                        let control_handle =
423                            FactoryDeviceControlHandle { inner: this.inner.clone() };
424                        Ok(FactoryDeviceRequest::SendMfgCommand {
425                            command: req.command,
426
427                            responder: FactoryDeviceSendMfgCommandResponder {
428                                control_handle: std::mem::ManuallyDrop::new(control_handle),
429                                tx_id: header.tx_id,
430                            },
431                        })
432                    }
433                    0x6a2b94d0a72e1663 => {
434                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
435                        let mut req = fidl::new_empty!(
436                            FactoryDeviceSetupOtCliRequest,
437                            fidl::encoding::DefaultFuchsiaResourceDialect
438                        );
439                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryDeviceSetupOtCliRequest>(&header, _body_bytes, handles, &mut req)?;
440                        let control_handle =
441                            FactoryDeviceControlHandle { inner: this.inner.clone() };
442                        Ok(FactoryDeviceRequest::SetupOtCli {
443                            server_socket: req.server_socket,
444
445                            responder: FactoryDeviceSetupOtCliResponder {
446                                control_handle: std::mem::ManuallyDrop::new(control_handle),
447                                tx_id: header.tx_id,
448                            },
449                        })
450                    }
451                    _ => Err(fidl::Error::UnknownOrdinal {
452                        ordinal: header.ordinal,
453                        protocol_name:
454                            <FactoryDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
455                    }),
456                }))
457            },
458        )
459    }
460}
461
462/// Protocol for sending factory commands to a LoWPAN device.
463///
464/// Not to be confused with `FactoryDriver`.
465///
466/// This protocol is implemented by LoWPAN drivers and used by client tools that need to issue
467/// factory commands. It is obtained from calling `FactoryLookup.Lookup()`.
468#[derive(Debug)]
469pub enum FactoryDeviceRequest {
470    /// Send a proprietary manufacturing command to the device and return the response.
471    ///
472    /// This method is intended to be used to facilitate device testing on the assembly line and is
473    /// typically only used during device manufacturing.
474    ///
475    /// Commands are given as strings (command + arguments) and the response is also a string. The
476    /// usage and format of the commands is dependent on the firmware on the LoWPAN device.
477    ///
478    /// When finished sending manufacturing commands, call `fuchsia.lowpan.test.DeviceTest.reset()`
479    /// to return the device to normal behavior.
480    SendMfgCommand { command: String, responder: FactoryDeviceSendMfgCommandResponder },
481    /// Send proprietary manufacturing commands to the device and return the response.
482    ///
483    /// This method is intended to send the exact same set of commands as SendMfgCommand(), but
484    /// instead of sending one command at a time, this method opens an opens an interactive shell
485    /// operated over `server_socket`.
486    SetupOtCli { server_socket: fidl::Socket, responder: FactoryDeviceSetupOtCliResponder },
487}
488
489impl FactoryDeviceRequest {
490    #[allow(irrefutable_let_patterns)]
491    pub fn into_send_mfg_command(self) -> Option<(String, FactoryDeviceSendMfgCommandResponder)> {
492        if let FactoryDeviceRequest::SendMfgCommand { command, responder } = self {
493            Some((command, responder))
494        } else {
495            None
496        }
497    }
498
499    #[allow(irrefutable_let_patterns)]
500    pub fn into_setup_ot_cli(self) -> Option<(fidl::Socket, FactoryDeviceSetupOtCliResponder)> {
501        if let FactoryDeviceRequest::SetupOtCli { server_socket, responder } = self {
502            Some((server_socket, responder))
503        } else {
504            None
505        }
506    }
507
508    /// Name of the method defined in FIDL
509    pub fn method_name(&self) -> &'static str {
510        match *self {
511            FactoryDeviceRequest::SendMfgCommand { .. } => "send_mfg_command",
512            FactoryDeviceRequest::SetupOtCli { .. } => "setup_ot_cli",
513        }
514    }
515}
516
517#[derive(Debug, Clone)]
518pub struct FactoryDeviceControlHandle {
519    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
520}
521
522impl fidl::endpoints::ControlHandle for FactoryDeviceControlHandle {
523    fn shutdown(&self) {
524        self.inner.shutdown()
525    }
526    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
527        self.inner.shutdown_with_epitaph(status)
528    }
529
530    fn is_closed(&self) -> bool {
531        self.inner.channel().is_closed()
532    }
533    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
534        self.inner.channel().on_closed()
535    }
536
537    #[cfg(target_os = "fuchsia")]
538    fn signal_peer(
539        &self,
540        clear_mask: zx::Signals,
541        set_mask: zx::Signals,
542    ) -> Result<(), zx_status::Status> {
543        use fidl::Peered;
544        self.inner.channel().signal_peer(clear_mask, set_mask)
545    }
546}
547
548impl FactoryDeviceControlHandle {}
549
550#[must_use = "FIDL methods require a response to be sent"]
551#[derive(Debug)]
552pub struct FactoryDeviceSendMfgCommandResponder {
553    control_handle: std::mem::ManuallyDrop<FactoryDeviceControlHandle>,
554    tx_id: u32,
555}
556
557/// Set the the channel to be shutdown (see [`FactoryDeviceControlHandle::shutdown`])
558/// if the responder is dropped without sending a response, so that the client
559/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
560impl std::ops::Drop for FactoryDeviceSendMfgCommandResponder {
561    fn drop(&mut self) {
562        self.control_handle.shutdown();
563        // Safety: drops once, never accessed again
564        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
565    }
566}
567
568impl fidl::endpoints::Responder for FactoryDeviceSendMfgCommandResponder {
569    type ControlHandle = FactoryDeviceControlHandle;
570
571    fn control_handle(&self) -> &FactoryDeviceControlHandle {
572        &self.control_handle
573    }
574
575    fn drop_without_shutdown(mut self) {
576        // Safety: drops once, never accessed again due to mem::forget
577        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
578        // Prevent Drop from running (which would shut down the channel)
579        std::mem::forget(self);
580    }
581}
582
583impl FactoryDeviceSendMfgCommandResponder {
584    /// Sends a response to the FIDL transaction.
585    ///
586    /// Sets the channel to shutdown if an error occurs.
587    pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
588        let _result = self.send_raw(response);
589        if _result.is_err() {
590            self.control_handle.shutdown();
591        }
592        self.drop_without_shutdown();
593        _result
594    }
595
596    /// Similar to "send" but does not shutdown the channel if an error occurs.
597    pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
598        let _result = self.send_raw(response);
599        self.drop_without_shutdown();
600        _result
601    }
602
603    fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
604        self.control_handle.inner.send::<FactoryDeviceSendMfgCommandResponse>(
605            (response,),
606            self.tx_id,
607            0x61ea2fba8c9fb7,
608            fidl::encoding::DynamicFlags::empty(),
609        )
610    }
611}
612
613#[must_use = "FIDL methods require a response to be sent"]
614#[derive(Debug)]
615pub struct FactoryDeviceSetupOtCliResponder {
616    control_handle: std::mem::ManuallyDrop<FactoryDeviceControlHandle>,
617    tx_id: u32,
618}
619
620/// Set the the channel to be shutdown (see [`FactoryDeviceControlHandle::shutdown`])
621/// if the responder is dropped without sending a response, so that the client
622/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
623impl std::ops::Drop for FactoryDeviceSetupOtCliResponder {
624    fn drop(&mut self) {
625        self.control_handle.shutdown();
626        // Safety: drops once, never accessed again
627        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
628    }
629}
630
631impl fidl::endpoints::Responder for FactoryDeviceSetupOtCliResponder {
632    type ControlHandle = FactoryDeviceControlHandle;
633
634    fn control_handle(&self) -> &FactoryDeviceControlHandle {
635        &self.control_handle
636    }
637
638    fn drop_without_shutdown(mut self) {
639        // Safety: drops once, never accessed again due to mem::forget
640        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
641        // Prevent Drop from running (which would shut down the channel)
642        std::mem::forget(self);
643    }
644}
645
646impl FactoryDeviceSetupOtCliResponder {
647    /// Sends a response to the FIDL transaction.
648    ///
649    /// Sets the channel to shutdown if an error occurs.
650    pub fn send(self) -> Result<(), fidl::Error> {
651        let _result = self.send_raw();
652        if _result.is_err() {
653            self.control_handle.shutdown();
654        }
655        self.drop_without_shutdown();
656        _result
657    }
658
659    /// Similar to "send" but does not shutdown the channel if an error occurs.
660    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
661        let _result = self.send_raw();
662        self.drop_without_shutdown();
663        _result
664    }
665
666    fn send_raw(&self) -> Result<(), fidl::Error> {
667        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
668            (),
669            self.tx_id,
670            0x6a2b94d0a72e1663,
671            fidl::encoding::DynamicFlags::empty(),
672        )
673    }
674}
675
676#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
677pub struct FactoryDriverMarker;
678
679impl fidl::endpoints::ProtocolMarker for FactoryDriverMarker {
680    type Proxy = FactoryDriverProxy;
681    type RequestStream = FactoryDriverRequestStream;
682    #[cfg(target_os = "fuchsia")]
683    type SynchronousProxy = FactoryDriverSynchronousProxy;
684
685    const DEBUG_NAME: &'static str = "(anonymous) FactoryDriver";
686}
687
688pub trait FactoryDriverProxyInterface: Send + Sync {
689    fn r#get_factory_device(
690        &self,
691        device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
692    ) -> Result<(), fidl::Error>;
693}
694#[derive(Debug)]
695#[cfg(target_os = "fuchsia")]
696pub struct FactoryDriverSynchronousProxy {
697    client: fidl::client::sync::Client,
698}
699
700#[cfg(target_os = "fuchsia")]
701impl fidl::endpoints::SynchronousProxy for FactoryDriverSynchronousProxy {
702    type Proxy = FactoryDriverProxy;
703    type Protocol = FactoryDriverMarker;
704
705    fn from_channel(inner: fidl::Channel) -> Self {
706        Self::new(inner)
707    }
708
709    fn into_channel(self) -> fidl::Channel {
710        self.client.into_channel()
711    }
712
713    fn as_channel(&self) -> &fidl::Channel {
714        self.client.as_channel()
715    }
716}
717
718#[cfg(target_os = "fuchsia")]
719impl FactoryDriverSynchronousProxy {
720    pub fn new(channel: fidl::Channel) -> Self {
721        let protocol_name = <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
722        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
723    }
724
725    pub fn into_channel(self) -> fidl::Channel {
726        self.client.into_channel()
727    }
728
729    /// Waits until an event arrives and returns it. It is safe for other
730    /// threads to make concurrent requests while waiting for an event.
731    pub fn wait_for_event(
732        &self,
733        deadline: zx::MonotonicInstant,
734    ) -> Result<FactoryDriverEvent, fidl::Error> {
735        FactoryDriverEvent::decode(self.client.wait_for_event(deadline)?)
736    }
737
738    /// Used to obtain a `FactoryDevice` protocol instance.
739    pub fn r#get_factory_device(
740        &self,
741        mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
742    ) -> Result<(), fidl::Error> {
743        self.client.send::<FactoryDriverGetFactoryDeviceRequest>(
744            (device_factory,),
745            0x7b3a42b6d35a7e1d,
746            fidl::encoding::DynamicFlags::empty(),
747        )
748    }
749}
750
751#[derive(Debug, Clone)]
752pub struct FactoryDriverProxy {
753    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
754}
755
756impl fidl::endpoints::Proxy for FactoryDriverProxy {
757    type Protocol = FactoryDriverMarker;
758
759    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
760        Self::new(inner)
761    }
762
763    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
764        self.client.into_channel().map_err(|client| Self { client })
765    }
766
767    fn as_channel(&self) -> &::fidl::AsyncChannel {
768        self.client.as_channel()
769    }
770}
771
772impl FactoryDriverProxy {
773    /// Create a new Proxy for fuchsia.factory.lowpan/FactoryDriver.
774    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
775        let protocol_name = <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
776        Self { client: fidl::client::Client::new(channel, protocol_name) }
777    }
778
779    /// Get a Stream of events from the remote end of the protocol.
780    ///
781    /// # Panics
782    ///
783    /// Panics if the event stream was already taken.
784    pub fn take_event_stream(&self) -> FactoryDriverEventStream {
785        FactoryDriverEventStream { event_receiver: self.client.take_event_receiver() }
786    }
787
788    /// Used to obtain a `FactoryDevice` protocol instance.
789    pub fn r#get_factory_device(
790        &self,
791        mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
792    ) -> Result<(), fidl::Error> {
793        FactoryDriverProxyInterface::r#get_factory_device(self, device_factory)
794    }
795}
796
797impl FactoryDriverProxyInterface for FactoryDriverProxy {
798    fn r#get_factory_device(
799        &self,
800        mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
801    ) -> Result<(), fidl::Error> {
802        self.client.send::<FactoryDriverGetFactoryDeviceRequest>(
803            (device_factory,),
804            0x7b3a42b6d35a7e1d,
805            fidl::encoding::DynamicFlags::empty(),
806        )
807    }
808}
809
810pub struct FactoryDriverEventStream {
811    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
812}
813
814impl std::marker::Unpin for FactoryDriverEventStream {}
815
816impl futures::stream::FusedStream for FactoryDriverEventStream {
817    fn is_terminated(&self) -> bool {
818        self.event_receiver.is_terminated()
819    }
820}
821
822impl futures::Stream for FactoryDriverEventStream {
823    type Item = Result<FactoryDriverEvent, fidl::Error>;
824
825    fn poll_next(
826        mut self: std::pin::Pin<&mut Self>,
827        cx: &mut std::task::Context<'_>,
828    ) -> std::task::Poll<Option<Self::Item>> {
829        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
830            &mut self.event_receiver,
831            cx
832        )?) {
833            Some(buf) => std::task::Poll::Ready(Some(FactoryDriverEvent::decode(buf))),
834            None => std::task::Poll::Ready(None),
835        }
836    }
837}
838
839#[derive(Debug)]
840pub enum FactoryDriverEvent {}
841
842impl FactoryDriverEvent {
843    /// Decodes a message buffer as a [`FactoryDriverEvent`].
844    fn decode(
845        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
846    ) -> Result<FactoryDriverEvent, fidl::Error> {
847        let (bytes, _handles) = buf.split_mut();
848        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
849        debug_assert_eq!(tx_header.tx_id, 0);
850        match tx_header.ordinal {
851            _ => Err(fidl::Error::UnknownOrdinal {
852                ordinal: tx_header.ordinal,
853                protocol_name: <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
854            }),
855        }
856    }
857}
858
859/// A Stream of incoming requests for fuchsia.factory.lowpan/FactoryDriver.
860pub struct FactoryDriverRequestStream {
861    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
862    is_terminated: bool,
863}
864
865impl std::marker::Unpin for FactoryDriverRequestStream {}
866
867impl futures::stream::FusedStream for FactoryDriverRequestStream {
868    fn is_terminated(&self) -> bool {
869        self.is_terminated
870    }
871}
872
873impl fidl::endpoints::RequestStream for FactoryDriverRequestStream {
874    type Protocol = FactoryDriverMarker;
875    type ControlHandle = FactoryDriverControlHandle;
876
877    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
878        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
879    }
880
881    fn control_handle(&self) -> Self::ControlHandle {
882        FactoryDriverControlHandle { inner: self.inner.clone() }
883    }
884
885    fn into_inner(
886        self,
887    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
888    {
889        (self.inner, self.is_terminated)
890    }
891
892    fn from_inner(
893        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
894        is_terminated: bool,
895    ) -> Self {
896        Self { inner, is_terminated }
897    }
898}
899
900impl futures::Stream for FactoryDriverRequestStream {
901    type Item = Result<FactoryDriverRequest, fidl::Error>;
902
903    fn poll_next(
904        mut self: std::pin::Pin<&mut Self>,
905        cx: &mut std::task::Context<'_>,
906    ) -> std::task::Poll<Option<Self::Item>> {
907        let this = &mut *self;
908        if this.inner.check_shutdown(cx) {
909            this.is_terminated = true;
910            return std::task::Poll::Ready(None);
911        }
912        if this.is_terminated {
913            panic!("polled FactoryDriverRequestStream after completion");
914        }
915        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
916            |bytes, handles| {
917                match this.inner.channel().read_etc(cx, bytes, handles) {
918                    std::task::Poll::Ready(Ok(())) => {}
919                    std::task::Poll::Pending => return std::task::Poll::Pending,
920                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
921                        this.is_terminated = true;
922                        return std::task::Poll::Ready(None);
923                    }
924                    std::task::Poll::Ready(Err(e)) => {
925                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
926                            e.into(),
927                        ))))
928                    }
929                }
930
931                // A message has been received from the channel
932                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
933
934                std::task::Poll::Ready(Some(match header.ordinal {
935                    0x7b3a42b6d35a7e1d => {
936                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
937                        let mut req = fidl::new_empty!(
938                            FactoryDriverGetFactoryDeviceRequest,
939                            fidl::encoding::DefaultFuchsiaResourceDialect
940                        );
941                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryDriverGetFactoryDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
942                        let control_handle =
943                            FactoryDriverControlHandle { inner: this.inner.clone() };
944                        Ok(FactoryDriverRequest::GetFactoryDevice {
945                            device_factory: req.device_factory,
946
947                            control_handle,
948                        })
949                    }
950                    _ => Err(fidl::Error::UnknownOrdinal {
951                        ordinal: header.ordinal,
952                        protocol_name:
953                            <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
954                    }),
955                }))
956            },
957        )
958    }
959}
960
961/// Protocol representing a LoWPAN driver instance that can serve `FactoryDevice` instances.
962///
963/// Not to be confused with `FactoryDevice`.
964///
965/// This protocol is implemented by LoWPAN drivers and used by the LoWPAN service when
966/// handling calls to `FactoryLookup.Lookup()`. It is registered with the service via
967/// a call to `FactoryRegister.Register()`.
968#[derive(Debug)]
969pub enum FactoryDriverRequest {
970    /// Used to obtain a `FactoryDevice` protocol instance.
971    GetFactoryDevice {
972        device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
973        control_handle: FactoryDriverControlHandle,
974    },
975}
976
977impl FactoryDriverRequest {
978    #[allow(irrefutable_let_patterns)]
979    pub fn into_get_factory_device(
980        self,
981    ) -> Option<(fidl::endpoints::ServerEnd<FactoryDeviceMarker>, FactoryDriverControlHandle)> {
982        if let FactoryDriverRequest::GetFactoryDevice { device_factory, control_handle } = self {
983            Some((device_factory, control_handle))
984        } else {
985            None
986        }
987    }
988
989    /// Name of the method defined in FIDL
990    pub fn method_name(&self) -> &'static str {
991        match *self {
992            FactoryDriverRequest::GetFactoryDevice { .. } => "get_factory_device",
993        }
994    }
995}
996
997#[derive(Debug, Clone)]
998pub struct FactoryDriverControlHandle {
999    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1000}
1001
1002impl fidl::endpoints::ControlHandle for FactoryDriverControlHandle {
1003    fn shutdown(&self) {
1004        self.inner.shutdown()
1005    }
1006    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1007        self.inner.shutdown_with_epitaph(status)
1008    }
1009
1010    fn is_closed(&self) -> bool {
1011        self.inner.channel().is_closed()
1012    }
1013    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1014        self.inner.channel().on_closed()
1015    }
1016
1017    #[cfg(target_os = "fuchsia")]
1018    fn signal_peer(
1019        &self,
1020        clear_mask: zx::Signals,
1021        set_mask: zx::Signals,
1022    ) -> Result<(), zx_status::Status> {
1023        use fidl::Peered;
1024        self.inner.channel().signal_peer(clear_mask, set_mask)
1025    }
1026}
1027
1028impl FactoryDriverControlHandle {}
1029
1030#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1031pub struct FactoryLookupMarker;
1032
1033impl fidl::endpoints::ProtocolMarker for FactoryLookupMarker {
1034    type Proxy = FactoryLookupProxy;
1035    type RequestStream = FactoryLookupRequestStream;
1036    #[cfg(target_os = "fuchsia")]
1037    type SynchronousProxy = FactoryLookupSynchronousProxy;
1038
1039    const DEBUG_NAME: &'static str = "fuchsia.factory.lowpan.FactoryLookup";
1040}
1041impl fidl::endpoints::DiscoverableProtocolMarker for FactoryLookupMarker {}
1042
1043pub trait FactoryLookupProxyInterface: Send + Sync {
1044    fn r#lookup(
1045        &self,
1046        name: &str,
1047        device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1048    ) -> Result<(), fidl::Error>;
1049}
1050#[derive(Debug)]
1051#[cfg(target_os = "fuchsia")]
1052pub struct FactoryLookupSynchronousProxy {
1053    client: fidl::client::sync::Client,
1054}
1055
1056#[cfg(target_os = "fuchsia")]
1057impl fidl::endpoints::SynchronousProxy for FactoryLookupSynchronousProxy {
1058    type Proxy = FactoryLookupProxy;
1059    type Protocol = FactoryLookupMarker;
1060
1061    fn from_channel(inner: fidl::Channel) -> Self {
1062        Self::new(inner)
1063    }
1064
1065    fn into_channel(self) -> fidl::Channel {
1066        self.client.into_channel()
1067    }
1068
1069    fn as_channel(&self) -> &fidl::Channel {
1070        self.client.as_channel()
1071    }
1072}
1073
1074#[cfg(target_os = "fuchsia")]
1075impl FactoryLookupSynchronousProxy {
1076    pub fn new(channel: fidl::Channel) -> Self {
1077        let protocol_name = <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1078        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1079    }
1080
1081    pub fn into_channel(self) -> fidl::Channel {
1082        self.client.into_channel()
1083    }
1084
1085    /// Waits until an event arrives and returns it. It is safe for other
1086    /// threads to make concurrent requests while waiting for an event.
1087    pub fn wait_for_event(
1088        &self,
1089        deadline: zx::MonotonicInstant,
1090    ) -> Result<FactoryLookupEvent, fidl::Error> {
1091        FactoryLookupEvent::decode(self.client.wait_for_event(deadline)?)
1092    }
1093
1094    /// Connects the the associated `FactoryDevice` API for the given LoWPAN interface name.
1095    pub fn r#lookup(
1096        &self,
1097        mut name: &str,
1098        mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1099    ) -> Result<(), fidl::Error> {
1100        self.client.send::<FactoryLookupLookupRequest>(
1101            (name, device_factory),
1102            0x7b8dc96a8fbf4885,
1103            fidl::encoding::DynamicFlags::empty(),
1104        )
1105    }
1106}
1107
1108#[derive(Debug, Clone)]
1109pub struct FactoryLookupProxy {
1110    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1111}
1112
1113impl fidl::endpoints::Proxy for FactoryLookupProxy {
1114    type Protocol = FactoryLookupMarker;
1115
1116    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1117        Self::new(inner)
1118    }
1119
1120    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1121        self.client.into_channel().map_err(|client| Self { client })
1122    }
1123
1124    fn as_channel(&self) -> &::fidl::AsyncChannel {
1125        self.client.as_channel()
1126    }
1127}
1128
1129impl FactoryLookupProxy {
1130    /// Create a new Proxy for fuchsia.factory.lowpan/FactoryLookup.
1131    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1132        let protocol_name = <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1133        Self { client: fidl::client::Client::new(channel, protocol_name) }
1134    }
1135
1136    /// Get a Stream of events from the remote end of the protocol.
1137    ///
1138    /// # Panics
1139    ///
1140    /// Panics if the event stream was already taken.
1141    pub fn take_event_stream(&self) -> FactoryLookupEventStream {
1142        FactoryLookupEventStream { event_receiver: self.client.take_event_receiver() }
1143    }
1144
1145    /// Connects the the associated `FactoryDevice` API for the given LoWPAN interface name.
1146    pub fn r#lookup(
1147        &self,
1148        mut name: &str,
1149        mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1150    ) -> Result<(), fidl::Error> {
1151        FactoryLookupProxyInterface::r#lookup(self, name, device_factory)
1152    }
1153}
1154
1155impl FactoryLookupProxyInterface for FactoryLookupProxy {
1156    fn r#lookup(
1157        &self,
1158        mut name: &str,
1159        mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1160    ) -> Result<(), fidl::Error> {
1161        self.client.send::<FactoryLookupLookupRequest>(
1162            (name, device_factory),
1163            0x7b8dc96a8fbf4885,
1164            fidl::encoding::DynamicFlags::empty(),
1165        )
1166    }
1167}
1168
1169pub struct FactoryLookupEventStream {
1170    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1171}
1172
1173impl std::marker::Unpin for FactoryLookupEventStream {}
1174
1175impl futures::stream::FusedStream for FactoryLookupEventStream {
1176    fn is_terminated(&self) -> bool {
1177        self.event_receiver.is_terminated()
1178    }
1179}
1180
1181impl futures::Stream for FactoryLookupEventStream {
1182    type Item = Result<FactoryLookupEvent, fidl::Error>;
1183
1184    fn poll_next(
1185        mut self: std::pin::Pin<&mut Self>,
1186        cx: &mut std::task::Context<'_>,
1187    ) -> std::task::Poll<Option<Self::Item>> {
1188        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1189            &mut self.event_receiver,
1190            cx
1191        )?) {
1192            Some(buf) => std::task::Poll::Ready(Some(FactoryLookupEvent::decode(buf))),
1193            None => std::task::Poll::Ready(None),
1194        }
1195    }
1196}
1197
1198#[derive(Debug)]
1199pub enum FactoryLookupEvent {}
1200
1201impl FactoryLookupEvent {
1202    /// Decodes a message buffer as a [`FactoryLookupEvent`].
1203    fn decode(
1204        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1205    ) -> Result<FactoryLookupEvent, fidl::Error> {
1206        let (bytes, _handles) = buf.split_mut();
1207        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1208        debug_assert_eq!(tx_header.tx_id, 0);
1209        match tx_header.ordinal {
1210            _ => Err(fidl::Error::UnknownOrdinal {
1211                ordinal: tx_header.ordinal,
1212                protocol_name: <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1213            }),
1214        }
1215    }
1216}
1217
1218/// A Stream of incoming requests for fuchsia.factory.lowpan/FactoryLookup.
1219pub struct FactoryLookupRequestStream {
1220    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1221    is_terminated: bool,
1222}
1223
1224impl std::marker::Unpin for FactoryLookupRequestStream {}
1225
1226impl futures::stream::FusedStream for FactoryLookupRequestStream {
1227    fn is_terminated(&self) -> bool {
1228        self.is_terminated
1229    }
1230}
1231
1232impl fidl::endpoints::RequestStream for FactoryLookupRequestStream {
1233    type Protocol = FactoryLookupMarker;
1234    type ControlHandle = FactoryLookupControlHandle;
1235
1236    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1237        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1238    }
1239
1240    fn control_handle(&self) -> Self::ControlHandle {
1241        FactoryLookupControlHandle { inner: self.inner.clone() }
1242    }
1243
1244    fn into_inner(
1245        self,
1246    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1247    {
1248        (self.inner, self.is_terminated)
1249    }
1250
1251    fn from_inner(
1252        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1253        is_terminated: bool,
1254    ) -> Self {
1255        Self { inner, is_terminated }
1256    }
1257}
1258
1259impl futures::Stream for FactoryLookupRequestStream {
1260    type Item = Result<FactoryLookupRequest, fidl::Error>;
1261
1262    fn poll_next(
1263        mut self: std::pin::Pin<&mut Self>,
1264        cx: &mut std::task::Context<'_>,
1265    ) -> std::task::Poll<Option<Self::Item>> {
1266        let this = &mut *self;
1267        if this.inner.check_shutdown(cx) {
1268            this.is_terminated = true;
1269            return std::task::Poll::Ready(None);
1270        }
1271        if this.is_terminated {
1272            panic!("polled FactoryLookupRequestStream after completion");
1273        }
1274        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1275            |bytes, handles| {
1276                match this.inner.channel().read_etc(cx, bytes, handles) {
1277                    std::task::Poll::Ready(Ok(())) => {}
1278                    std::task::Poll::Pending => return std::task::Poll::Pending,
1279                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1280                        this.is_terminated = true;
1281                        return std::task::Poll::Ready(None);
1282                    }
1283                    std::task::Poll::Ready(Err(e)) => {
1284                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1285                            e.into(),
1286                        ))))
1287                    }
1288                }
1289
1290                // A message has been received from the channel
1291                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1292
1293                std::task::Poll::Ready(Some(match header.ordinal {
1294                    0x7b8dc96a8fbf4885 => {
1295                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1296                        let mut req = fidl::new_empty!(
1297                            FactoryLookupLookupRequest,
1298                            fidl::encoding::DefaultFuchsiaResourceDialect
1299                        );
1300                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryLookupLookupRequest>(&header, _body_bytes, handles, &mut req)?;
1301                        let control_handle =
1302                            FactoryLookupControlHandle { inner: this.inner.clone() };
1303                        Ok(FactoryLookupRequest::Lookup {
1304                            name: req.name,
1305                            device_factory: req.device_factory,
1306
1307                            control_handle,
1308                        })
1309                    }
1310                    _ => Err(fidl::Error::UnknownOrdinal {
1311                        ordinal: header.ordinal,
1312                        protocol_name:
1313                            <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1314                    }),
1315                }))
1316            },
1317        )
1318    }
1319}
1320
1321/// Protocol for looking up the LoWPAN factory protocol for a LoWPAN interface.
1322///
1323/// This protocol is implemented by the LoWPAN service and used by client tools that need to issue
1324/// factory commands.
1325#[derive(Debug)]
1326pub enum FactoryLookupRequest {
1327    /// Connects the the associated `FactoryDevice` API for the given LoWPAN interface name.
1328    Lookup {
1329        name: String,
1330        device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1331        control_handle: FactoryLookupControlHandle,
1332    },
1333}
1334
1335impl FactoryLookupRequest {
1336    #[allow(irrefutable_let_patterns)]
1337    pub fn into_lookup(
1338        self,
1339    ) -> Option<(String, fidl::endpoints::ServerEnd<FactoryDeviceMarker>, FactoryLookupControlHandle)>
1340    {
1341        if let FactoryLookupRequest::Lookup { name, device_factory, control_handle } = self {
1342            Some((name, device_factory, control_handle))
1343        } else {
1344            None
1345        }
1346    }
1347
1348    /// Name of the method defined in FIDL
1349    pub fn method_name(&self) -> &'static str {
1350        match *self {
1351            FactoryLookupRequest::Lookup { .. } => "lookup",
1352        }
1353    }
1354}
1355
1356#[derive(Debug, Clone)]
1357pub struct FactoryLookupControlHandle {
1358    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1359}
1360
1361impl fidl::endpoints::ControlHandle for FactoryLookupControlHandle {
1362    fn shutdown(&self) {
1363        self.inner.shutdown()
1364    }
1365    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1366        self.inner.shutdown_with_epitaph(status)
1367    }
1368
1369    fn is_closed(&self) -> bool {
1370        self.inner.channel().is_closed()
1371    }
1372    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1373        self.inner.channel().on_closed()
1374    }
1375
1376    #[cfg(target_os = "fuchsia")]
1377    fn signal_peer(
1378        &self,
1379        clear_mask: zx::Signals,
1380        set_mask: zx::Signals,
1381    ) -> Result<(), zx_status::Status> {
1382        use fidl::Peered;
1383        self.inner.channel().signal_peer(clear_mask, set_mask)
1384    }
1385}
1386
1387impl FactoryLookupControlHandle {}
1388
1389#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1390pub struct FactoryRegisterMarker;
1391
1392impl fidl::endpoints::ProtocolMarker for FactoryRegisterMarker {
1393    type Proxy = FactoryRegisterProxy;
1394    type RequestStream = FactoryRegisterRequestStream;
1395    #[cfg(target_os = "fuchsia")]
1396    type SynchronousProxy = FactoryRegisterSynchronousProxy;
1397
1398    const DEBUG_NAME: &'static str = "fuchsia.factory.lowpan.FactoryRegister";
1399}
1400impl fidl::endpoints::DiscoverableProtocolMarker for FactoryRegisterMarker {}
1401
1402pub trait FactoryRegisterProxyInterface: Send + Sync {
1403    fn r#register(
1404        &self,
1405        name: &str,
1406        driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1407    ) -> Result<(), fidl::Error>;
1408}
1409#[derive(Debug)]
1410#[cfg(target_os = "fuchsia")]
1411pub struct FactoryRegisterSynchronousProxy {
1412    client: fidl::client::sync::Client,
1413}
1414
1415#[cfg(target_os = "fuchsia")]
1416impl fidl::endpoints::SynchronousProxy for FactoryRegisterSynchronousProxy {
1417    type Proxy = FactoryRegisterProxy;
1418    type Protocol = FactoryRegisterMarker;
1419
1420    fn from_channel(inner: fidl::Channel) -> Self {
1421        Self::new(inner)
1422    }
1423
1424    fn into_channel(self) -> fidl::Channel {
1425        self.client.into_channel()
1426    }
1427
1428    fn as_channel(&self) -> &fidl::Channel {
1429        self.client.as_channel()
1430    }
1431}
1432
1433#[cfg(target_os = "fuchsia")]
1434impl FactoryRegisterSynchronousProxy {
1435    pub fn new(channel: fidl::Channel) -> Self {
1436        let protocol_name = <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1437        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1438    }
1439
1440    pub fn into_channel(self) -> fidl::Channel {
1441        self.client.into_channel()
1442    }
1443
1444    /// Waits until an event arrives and returns it. It is safe for other
1445    /// threads to make concurrent requests while waiting for an event.
1446    pub fn wait_for_event(
1447        &self,
1448        deadline: zx::MonotonicInstant,
1449    ) -> Result<FactoryRegisterEvent, fidl::Error> {
1450        FactoryRegisterEvent::decode(self.client.wait_for_event(deadline)?)
1451    }
1452
1453    /// Registers the given LoWPAN device factory API with the LoWPAN Service
1454    /// using the given interface name.
1455    ///
1456    /// The provided `FactoryDriver` will be used to connect requests made via
1457    /// `FactoryLookup.Lookup()` for `FactoryDevice`.
1458    pub fn r#register(
1459        &self,
1460        mut name: &str,
1461        mut driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1462    ) -> Result<(), fidl::Error> {
1463        self.client.send::<FactoryRegisterRegisterRequest>(
1464            (name, driver),
1465            0x1d167c20bdcccf1f,
1466            fidl::encoding::DynamicFlags::empty(),
1467        )
1468    }
1469}
1470
1471#[derive(Debug, Clone)]
1472pub struct FactoryRegisterProxy {
1473    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1474}
1475
1476impl fidl::endpoints::Proxy for FactoryRegisterProxy {
1477    type Protocol = FactoryRegisterMarker;
1478
1479    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1480        Self::new(inner)
1481    }
1482
1483    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1484        self.client.into_channel().map_err(|client| Self { client })
1485    }
1486
1487    fn as_channel(&self) -> &::fidl::AsyncChannel {
1488        self.client.as_channel()
1489    }
1490}
1491
1492impl FactoryRegisterProxy {
1493    /// Create a new Proxy for fuchsia.factory.lowpan/FactoryRegister.
1494    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1495        let protocol_name = <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1496        Self { client: fidl::client::Client::new(channel, protocol_name) }
1497    }
1498
1499    /// Get a Stream of events from the remote end of the protocol.
1500    ///
1501    /// # Panics
1502    ///
1503    /// Panics if the event stream was already taken.
1504    pub fn take_event_stream(&self) -> FactoryRegisterEventStream {
1505        FactoryRegisterEventStream { event_receiver: self.client.take_event_receiver() }
1506    }
1507
1508    /// Registers the given LoWPAN device factory API with the LoWPAN Service
1509    /// using the given interface name.
1510    ///
1511    /// The provided `FactoryDriver` will be used to connect requests made via
1512    /// `FactoryLookup.Lookup()` for `FactoryDevice`.
1513    pub fn r#register(
1514        &self,
1515        mut name: &str,
1516        mut driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1517    ) -> Result<(), fidl::Error> {
1518        FactoryRegisterProxyInterface::r#register(self, name, driver)
1519    }
1520}
1521
1522impl FactoryRegisterProxyInterface for FactoryRegisterProxy {
1523    fn r#register(
1524        &self,
1525        mut name: &str,
1526        mut driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1527    ) -> Result<(), fidl::Error> {
1528        self.client.send::<FactoryRegisterRegisterRequest>(
1529            (name, driver),
1530            0x1d167c20bdcccf1f,
1531            fidl::encoding::DynamicFlags::empty(),
1532        )
1533    }
1534}
1535
1536pub struct FactoryRegisterEventStream {
1537    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1538}
1539
1540impl std::marker::Unpin for FactoryRegisterEventStream {}
1541
1542impl futures::stream::FusedStream for FactoryRegisterEventStream {
1543    fn is_terminated(&self) -> bool {
1544        self.event_receiver.is_terminated()
1545    }
1546}
1547
1548impl futures::Stream for FactoryRegisterEventStream {
1549    type Item = Result<FactoryRegisterEvent, fidl::Error>;
1550
1551    fn poll_next(
1552        mut self: std::pin::Pin<&mut Self>,
1553        cx: &mut std::task::Context<'_>,
1554    ) -> std::task::Poll<Option<Self::Item>> {
1555        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1556            &mut self.event_receiver,
1557            cx
1558        )?) {
1559            Some(buf) => std::task::Poll::Ready(Some(FactoryRegisterEvent::decode(buf))),
1560            None => std::task::Poll::Ready(None),
1561        }
1562    }
1563}
1564
1565#[derive(Debug)]
1566pub enum FactoryRegisterEvent {}
1567
1568impl FactoryRegisterEvent {
1569    /// Decodes a message buffer as a [`FactoryRegisterEvent`].
1570    fn decode(
1571        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1572    ) -> Result<FactoryRegisterEvent, fidl::Error> {
1573        let (bytes, _handles) = buf.split_mut();
1574        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1575        debug_assert_eq!(tx_header.tx_id, 0);
1576        match tx_header.ordinal {
1577            _ => Err(fidl::Error::UnknownOrdinal {
1578                ordinal: tx_header.ordinal,
1579                protocol_name:
1580                    <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1581            }),
1582        }
1583    }
1584}
1585
1586/// A Stream of incoming requests for fuchsia.factory.lowpan/FactoryRegister.
1587pub struct FactoryRegisterRequestStream {
1588    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1589    is_terminated: bool,
1590}
1591
1592impl std::marker::Unpin for FactoryRegisterRequestStream {}
1593
1594impl futures::stream::FusedStream for FactoryRegisterRequestStream {
1595    fn is_terminated(&self) -> bool {
1596        self.is_terminated
1597    }
1598}
1599
1600impl fidl::endpoints::RequestStream for FactoryRegisterRequestStream {
1601    type Protocol = FactoryRegisterMarker;
1602    type ControlHandle = FactoryRegisterControlHandle;
1603
1604    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1605        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1606    }
1607
1608    fn control_handle(&self) -> Self::ControlHandle {
1609        FactoryRegisterControlHandle { inner: self.inner.clone() }
1610    }
1611
1612    fn into_inner(
1613        self,
1614    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1615    {
1616        (self.inner, self.is_terminated)
1617    }
1618
1619    fn from_inner(
1620        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1621        is_terminated: bool,
1622    ) -> Self {
1623        Self { inner, is_terminated }
1624    }
1625}
1626
1627impl futures::Stream for FactoryRegisterRequestStream {
1628    type Item = Result<FactoryRegisterRequest, fidl::Error>;
1629
1630    fn poll_next(
1631        mut self: std::pin::Pin<&mut Self>,
1632        cx: &mut std::task::Context<'_>,
1633    ) -> std::task::Poll<Option<Self::Item>> {
1634        let this = &mut *self;
1635        if this.inner.check_shutdown(cx) {
1636            this.is_terminated = true;
1637            return std::task::Poll::Ready(None);
1638        }
1639        if this.is_terminated {
1640            panic!("polled FactoryRegisterRequestStream after completion");
1641        }
1642        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1643            |bytes, handles| {
1644                match this.inner.channel().read_etc(cx, bytes, handles) {
1645                    std::task::Poll::Ready(Ok(())) => {}
1646                    std::task::Poll::Pending => return std::task::Poll::Pending,
1647                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1648                        this.is_terminated = true;
1649                        return std::task::Poll::Ready(None);
1650                    }
1651                    std::task::Poll::Ready(Err(e)) => {
1652                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1653                            e.into(),
1654                        ))))
1655                    }
1656                }
1657
1658                // A message has been received from the channel
1659                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1660
1661                std::task::Poll::Ready(Some(match header.ordinal {
1662                    0x1d167c20bdcccf1f => {
1663                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1664                        let mut req = fidl::new_empty!(
1665                            FactoryRegisterRegisterRequest,
1666                            fidl::encoding::DefaultFuchsiaResourceDialect
1667                        );
1668                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryRegisterRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
1669                        let control_handle =
1670                            FactoryRegisterControlHandle { inner: this.inner.clone() };
1671                        Ok(FactoryRegisterRequest::Register {
1672                            name: req.name,
1673                            driver: req.driver,
1674
1675                            control_handle,
1676                        })
1677                    }
1678                    _ => Err(fidl::Error::UnknownOrdinal {
1679                        ordinal: header.ordinal,
1680                        protocol_name:
1681                            <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1682                    }),
1683                }))
1684            },
1685        )
1686    }
1687}
1688
1689/// Protocol for registering the factory instance of a LoWPAN driver with the LoWPAN service.
1690///
1691/// This protocol is implemented by the LoWPAN service and used by LoWPAN drivers.
1692#[derive(Debug)]
1693pub enum FactoryRegisterRequest {
1694    /// Registers the given LoWPAN device factory API with the LoWPAN Service
1695    /// using the given interface name.
1696    ///
1697    /// The provided `FactoryDriver` will be used to connect requests made via
1698    /// `FactoryLookup.Lookup()` for `FactoryDevice`.
1699    Register {
1700        name: String,
1701        driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1702        control_handle: FactoryRegisterControlHandle,
1703    },
1704}
1705
1706impl FactoryRegisterRequest {
1707    #[allow(irrefutable_let_patterns)]
1708    pub fn into_register(
1709        self,
1710    ) -> Option<(
1711        String,
1712        fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1713        FactoryRegisterControlHandle,
1714    )> {
1715        if let FactoryRegisterRequest::Register { name, driver, control_handle } = self {
1716            Some((name, driver, control_handle))
1717        } else {
1718            None
1719        }
1720    }
1721
1722    /// Name of the method defined in FIDL
1723    pub fn method_name(&self) -> &'static str {
1724        match *self {
1725            FactoryRegisterRequest::Register { .. } => "register",
1726        }
1727    }
1728}
1729
1730#[derive(Debug, Clone)]
1731pub struct FactoryRegisterControlHandle {
1732    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1733}
1734
1735impl fidl::endpoints::ControlHandle for FactoryRegisterControlHandle {
1736    fn shutdown(&self) {
1737        self.inner.shutdown()
1738    }
1739    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1740        self.inner.shutdown_with_epitaph(status)
1741    }
1742
1743    fn is_closed(&self) -> bool {
1744        self.inner.channel().is_closed()
1745    }
1746    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1747        self.inner.channel().on_closed()
1748    }
1749
1750    #[cfg(target_os = "fuchsia")]
1751    fn signal_peer(
1752        &self,
1753        clear_mask: zx::Signals,
1754        set_mask: zx::Signals,
1755    ) -> Result<(), zx_status::Status> {
1756        use fidl::Peered;
1757        self.inner.channel().signal_peer(clear_mask, set_mask)
1758    }
1759}
1760
1761impl FactoryRegisterControlHandle {}
1762
1763mod internal {
1764    use super::*;
1765
1766    impl fidl::encoding::ValueTypeMarker for FactoryDeviceSendMfgCommandRequest {
1767        type Borrowed<'a> = &'a Self;
1768        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1769            value
1770        }
1771    }
1772
1773    unsafe impl fidl::encoding::TypeMarker for FactoryDeviceSendMfgCommandRequest {
1774        type Owned = Self;
1775
1776        #[inline(always)]
1777        fn inline_align(_context: fidl::encoding::Context) -> usize {
1778            8
1779        }
1780
1781        #[inline(always)]
1782        fn inline_size(_context: fidl::encoding::Context) -> usize {
1783            16
1784        }
1785    }
1786
1787    unsafe impl<D: fidl::encoding::ResourceDialect>
1788        fidl::encoding::Encode<FactoryDeviceSendMfgCommandRequest, D>
1789        for &FactoryDeviceSendMfgCommandRequest
1790    {
1791        #[inline]
1792        unsafe fn encode(
1793            self,
1794            encoder: &mut fidl::encoding::Encoder<'_, D>,
1795            offset: usize,
1796            _depth: fidl::encoding::Depth,
1797        ) -> fidl::Result<()> {
1798            encoder.debug_check_bounds::<FactoryDeviceSendMfgCommandRequest>(offset);
1799            // Delegate to tuple encoding.
1800            fidl::encoding::Encode::<FactoryDeviceSendMfgCommandRequest, D>::encode(
1801                (<fidl::encoding::BoundedString<2000> as fidl::encoding::ValueTypeMarker>::borrow(
1802                    &self.command,
1803                ),),
1804                encoder,
1805                offset,
1806                _depth,
1807            )
1808        }
1809    }
1810    unsafe impl<
1811            D: fidl::encoding::ResourceDialect,
1812            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2000>, D>,
1813        > fidl::encoding::Encode<FactoryDeviceSendMfgCommandRequest, D> for (T0,)
1814    {
1815        #[inline]
1816        unsafe fn encode(
1817            self,
1818            encoder: &mut fidl::encoding::Encoder<'_, D>,
1819            offset: usize,
1820            depth: fidl::encoding::Depth,
1821        ) -> fidl::Result<()> {
1822            encoder.debug_check_bounds::<FactoryDeviceSendMfgCommandRequest>(offset);
1823            // Zero out padding regions. There's no need to apply masks
1824            // because the unmasked parts will be overwritten by fields.
1825            // Write the fields.
1826            self.0.encode(encoder, offset + 0, depth)?;
1827            Ok(())
1828        }
1829    }
1830
1831    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1832        for FactoryDeviceSendMfgCommandRequest
1833    {
1834        #[inline(always)]
1835        fn new_empty() -> Self {
1836            Self { command: fidl::new_empty!(fidl::encoding::BoundedString<2000>, D) }
1837        }
1838
1839        #[inline]
1840        unsafe fn decode(
1841            &mut self,
1842            decoder: &mut fidl::encoding::Decoder<'_, D>,
1843            offset: usize,
1844            _depth: fidl::encoding::Depth,
1845        ) -> fidl::Result<()> {
1846            decoder.debug_check_bounds::<Self>(offset);
1847            // Verify that padding bytes are zero.
1848            fidl::decode!(
1849                fidl::encoding::BoundedString<2000>,
1850                D,
1851                &mut self.command,
1852                decoder,
1853                offset + 0,
1854                _depth
1855            )?;
1856            Ok(())
1857        }
1858    }
1859
1860    impl fidl::encoding::ValueTypeMarker for FactoryDeviceSendMfgCommandResponse {
1861        type Borrowed<'a> = &'a Self;
1862        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1863            value
1864        }
1865    }
1866
1867    unsafe impl fidl::encoding::TypeMarker for FactoryDeviceSendMfgCommandResponse {
1868        type Owned = Self;
1869
1870        #[inline(always)]
1871        fn inline_align(_context: fidl::encoding::Context) -> usize {
1872            8
1873        }
1874
1875        #[inline(always)]
1876        fn inline_size(_context: fidl::encoding::Context) -> usize {
1877            16
1878        }
1879    }
1880
1881    unsafe impl<D: fidl::encoding::ResourceDialect>
1882        fidl::encoding::Encode<FactoryDeviceSendMfgCommandResponse, D>
1883        for &FactoryDeviceSendMfgCommandResponse
1884    {
1885        #[inline]
1886        unsafe fn encode(
1887            self,
1888            encoder: &mut fidl::encoding::Encoder<'_, D>,
1889            offset: usize,
1890            _depth: fidl::encoding::Depth,
1891        ) -> fidl::Result<()> {
1892            encoder.debug_check_bounds::<FactoryDeviceSendMfgCommandResponse>(offset);
1893            // Delegate to tuple encoding.
1894            fidl::encoding::Encode::<FactoryDeviceSendMfgCommandResponse, D>::encode(
1895                (<fidl::encoding::BoundedString<2000> as fidl::encoding::ValueTypeMarker>::borrow(
1896                    &self.response,
1897                ),),
1898                encoder,
1899                offset,
1900                _depth,
1901            )
1902        }
1903    }
1904    unsafe impl<
1905            D: fidl::encoding::ResourceDialect,
1906            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2000>, D>,
1907        > fidl::encoding::Encode<FactoryDeviceSendMfgCommandResponse, D> for (T0,)
1908    {
1909        #[inline]
1910        unsafe fn encode(
1911            self,
1912            encoder: &mut fidl::encoding::Encoder<'_, D>,
1913            offset: usize,
1914            depth: fidl::encoding::Depth,
1915        ) -> fidl::Result<()> {
1916            encoder.debug_check_bounds::<FactoryDeviceSendMfgCommandResponse>(offset);
1917            // Zero out padding regions. There's no need to apply masks
1918            // because the unmasked parts will be overwritten by fields.
1919            // Write the fields.
1920            self.0.encode(encoder, offset + 0, depth)?;
1921            Ok(())
1922        }
1923    }
1924
1925    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1926        for FactoryDeviceSendMfgCommandResponse
1927    {
1928        #[inline(always)]
1929        fn new_empty() -> Self {
1930            Self { response: fidl::new_empty!(fidl::encoding::BoundedString<2000>, D) }
1931        }
1932
1933        #[inline]
1934        unsafe fn decode(
1935            &mut self,
1936            decoder: &mut fidl::encoding::Decoder<'_, D>,
1937            offset: usize,
1938            _depth: fidl::encoding::Depth,
1939        ) -> fidl::Result<()> {
1940            decoder.debug_check_bounds::<Self>(offset);
1941            // Verify that padding bytes are zero.
1942            fidl::decode!(
1943                fidl::encoding::BoundedString<2000>,
1944                D,
1945                &mut self.response,
1946                decoder,
1947                offset + 0,
1948                _depth
1949            )?;
1950            Ok(())
1951        }
1952    }
1953
1954    impl fidl::encoding::ResourceTypeMarker for FactoryDeviceSetupOtCliRequest {
1955        type Borrowed<'a> = &'a mut Self;
1956        fn take_or_borrow<'a>(
1957            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1958        ) -> Self::Borrowed<'a> {
1959            value
1960        }
1961    }
1962
1963    unsafe impl fidl::encoding::TypeMarker for FactoryDeviceSetupOtCliRequest {
1964        type Owned = Self;
1965
1966        #[inline(always)]
1967        fn inline_align(_context: fidl::encoding::Context) -> usize {
1968            4
1969        }
1970
1971        #[inline(always)]
1972        fn inline_size(_context: fidl::encoding::Context) -> usize {
1973            4
1974        }
1975    }
1976
1977    unsafe impl
1978        fidl::encoding::Encode<
1979            FactoryDeviceSetupOtCliRequest,
1980            fidl::encoding::DefaultFuchsiaResourceDialect,
1981        > for &mut FactoryDeviceSetupOtCliRequest
1982    {
1983        #[inline]
1984        unsafe fn encode(
1985            self,
1986            encoder: &mut fidl::encoding::Encoder<
1987                '_,
1988                fidl::encoding::DefaultFuchsiaResourceDialect,
1989            >,
1990            offset: usize,
1991            _depth: fidl::encoding::Depth,
1992        ) -> fidl::Result<()> {
1993            encoder.debug_check_bounds::<FactoryDeviceSetupOtCliRequest>(offset);
1994            // Delegate to tuple encoding.
1995            fidl::encoding::Encode::<
1996                FactoryDeviceSetupOtCliRequest,
1997                fidl::encoding::DefaultFuchsiaResourceDialect,
1998            >::encode(
1999                (<fidl::encoding::HandleType<
2000                    fidl::Socket,
2001                    { fidl::ObjectType::SOCKET.into_raw() },
2002                    16396,
2003                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2004                    &mut self.server_socket
2005                ),),
2006                encoder,
2007                offset,
2008                _depth,
2009            )
2010        }
2011    }
2012    unsafe impl<
2013            T0: fidl::encoding::Encode<
2014                fidl::encoding::HandleType<
2015                    fidl::Socket,
2016                    { fidl::ObjectType::SOCKET.into_raw() },
2017                    16396,
2018                >,
2019                fidl::encoding::DefaultFuchsiaResourceDialect,
2020            >,
2021        >
2022        fidl::encoding::Encode<
2023            FactoryDeviceSetupOtCliRequest,
2024            fidl::encoding::DefaultFuchsiaResourceDialect,
2025        > for (T0,)
2026    {
2027        #[inline]
2028        unsafe fn encode(
2029            self,
2030            encoder: &mut fidl::encoding::Encoder<
2031                '_,
2032                fidl::encoding::DefaultFuchsiaResourceDialect,
2033            >,
2034            offset: usize,
2035            depth: fidl::encoding::Depth,
2036        ) -> fidl::Result<()> {
2037            encoder.debug_check_bounds::<FactoryDeviceSetupOtCliRequest>(offset);
2038            // Zero out padding regions. There's no need to apply masks
2039            // because the unmasked parts will be overwritten by fields.
2040            // Write the fields.
2041            self.0.encode(encoder, offset + 0, depth)?;
2042            Ok(())
2043        }
2044    }
2045
2046    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2047        for FactoryDeviceSetupOtCliRequest
2048    {
2049        #[inline(always)]
2050        fn new_empty() -> Self {
2051            Self {
2052                server_socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16396>, fidl::encoding::DefaultFuchsiaResourceDialect),
2053            }
2054        }
2055
2056        #[inline]
2057        unsafe fn decode(
2058            &mut self,
2059            decoder: &mut fidl::encoding::Decoder<
2060                '_,
2061                fidl::encoding::DefaultFuchsiaResourceDialect,
2062            >,
2063            offset: usize,
2064            _depth: fidl::encoding::Depth,
2065        ) -> fidl::Result<()> {
2066            decoder.debug_check_bounds::<Self>(offset);
2067            // Verify that padding bytes are zero.
2068            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16396>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_socket, decoder, offset + 0, _depth)?;
2069            Ok(())
2070        }
2071    }
2072
2073    impl fidl::encoding::ResourceTypeMarker for FactoryDriverGetFactoryDeviceRequest {
2074        type Borrowed<'a> = &'a mut Self;
2075        fn take_or_borrow<'a>(
2076            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2077        ) -> Self::Borrowed<'a> {
2078            value
2079        }
2080    }
2081
2082    unsafe impl fidl::encoding::TypeMarker for FactoryDriverGetFactoryDeviceRequest {
2083        type Owned = Self;
2084
2085        #[inline(always)]
2086        fn inline_align(_context: fidl::encoding::Context) -> usize {
2087            4
2088        }
2089
2090        #[inline(always)]
2091        fn inline_size(_context: fidl::encoding::Context) -> usize {
2092            4
2093        }
2094    }
2095
2096    unsafe impl
2097        fidl::encoding::Encode<
2098            FactoryDriverGetFactoryDeviceRequest,
2099            fidl::encoding::DefaultFuchsiaResourceDialect,
2100        > for &mut FactoryDriverGetFactoryDeviceRequest
2101    {
2102        #[inline]
2103        unsafe fn encode(
2104            self,
2105            encoder: &mut fidl::encoding::Encoder<
2106                '_,
2107                fidl::encoding::DefaultFuchsiaResourceDialect,
2108            >,
2109            offset: usize,
2110            _depth: fidl::encoding::Depth,
2111        ) -> fidl::Result<()> {
2112            encoder.debug_check_bounds::<FactoryDriverGetFactoryDeviceRequest>(offset);
2113            // Delegate to tuple encoding.
2114            fidl::encoding::Encode::<FactoryDriverGetFactoryDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2115                (
2116                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_factory),
2117                ),
2118                encoder, offset, _depth
2119            )
2120        }
2121    }
2122    unsafe impl<
2123            T0: fidl::encoding::Encode<
2124                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2125                fidl::encoding::DefaultFuchsiaResourceDialect,
2126            >,
2127        >
2128        fidl::encoding::Encode<
2129            FactoryDriverGetFactoryDeviceRequest,
2130            fidl::encoding::DefaultFuchsiaResourceDialect,
2131        > for (T0,)
2132    {
2133        #[inline]
2134        unsafe fn encode(
2135            self,
2136            encoder: &mut fidl::encoding::Encoder<
2137                '_,
2138                fidl::encoding::DefaultFuchsiaResourceDialect,
2139            >,
2140            offset: usize,
2141            depth: fidl::encoding::Depth,
2142        ) -> fidl::Result<()> {
2143            encoder.debug_check_bounds::<FactoryDriverGetFactoryDeviceRequest>(offset);
2144            // Zero out padding regions. There's no need to apply masks
2145            // because the unmasked parts will be overwritten by fields.
2146            // Write the fields.
2147            self.0.encode(encoder, offset + 0, depth)?;
2148            Ok(())
2149        }
2150    }
2151
2152    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2153        for FactoryDriverGetFactoryDeviceRequest
2154    {
2155        #[inline(always)]
2156        fn new_empty() -> Self {
2157            Self {
2158                device_factory: fidl::new_empty!(
2159                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2160                    fidl::encoding::DefaultFuchsiaResourceDialect
2161                ),
2162            }
2163        }
2164
2165        #[inline]
2166        unsafe fn decode(
2167            &mut self,
2168            decoder: &mut fidl::encoding::Decoder<
2169                '_,
2170                fidl::encoding::DefaultFuchsiaResourceDialect,
2171            >,
2172            offset: usize,
2173            _depth: fidl::encoding::Depth,
2174        ) -> fidl::Result<()> {
2175            decoder.debug_check_bounds::<Self>(offset);
2176            // Verify that padding bytes are zero.
2177            fidl::decode!(
2178                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2179                fidl::encoding::DefaultFuchsiaResourceDialect,
2180                &mut self.device_factory,
2181                decoder,
2182                offset + 0,
2183                _depth
2184            )?;
2185            Ok(())
2186        }
2187    }
2188
2189    impl fidl::encoding::ResourceTypeMarker for FactoryLookupLookupRequest {
2190        type Borrowed<'a> = &'a mut Self;
2191        fn take_or_borrow<'a>(
2192            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2193        ) -> Self::Borrowed<'a> {
2194            value
2195        }
2196    }
2197
2198    unsafe impl fidl::encoding::TypeMarker for FactoryLookupLookupRequest {
2199        type Owned = Self;
2200
2201        #[inline(always)]
2202        fn inline_align(_context: fidl::encoding::Context) -> usize {
2203            8
2204        }
2205
2206        #[inline(always)]
2207        fn inline_size(_context: fidl::encoding::Context) -> usize {
2208            24
2209        }
2210    }
2211
2212    unsafe impl
2213        fidl::encoding::Encode<
2214            FactoryLookupLookupRequest,
2215            fidl::encoding::DefaultFuchsiaResourceDialect,
2216        > for &mut FactoryLookupLookupRequest
2217    {
2218        #[inline]
2219        unsafe fn encode(
2220            self,
2221            encoder: &mut fidl::encoding::Encoder<
2222                '_,
2223                fidl::encoding::DefaultFuchsiaResourceDialect,
2224            >,
2225            offset: usize,
2226            _depth: fidl::encoding::Depth,
2227        ) -> fidl::Result<()> {
2228            encoder.debug_check_bounds::<FactoryLookupLookupRequest>(offset);
2229            // Delegate to tuple encoding.
2230            fidl::encoding::Encode::<FactoryLookupLookupRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2231                (
2232                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2233                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_factory),
2234                ),
2235                encoder, offset, _depth
2236            )
2237        }
2238    }
2239    unsafe impl<
2240            T0: fidl::encoding::Encode<
2241                fidl::encoding::BoundedString<32>,
2242                fidl::encoding::DefaultFuchsiaResourceDialect,
2243            >,
2244            T1: fidl::encoding::Encode<
2245                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2246                fidl::encoding::DefaultFuchsiaResourceDialect,
2247            >,
2248        >
2249        fidl::encoding::Encode<
2250            FactoryLookupLookupRequest,
2251            fidl::encoding::DefaultFuchsiaResourceDialect,
2252        > for (T0, T1)
2253    {
2254        #[inline]
2255        unsafe fn encode(
2256            self,
2257            encoder: &mut fidl::encoding::Encoder<
2258                '_,
2259                fidl::encoding::DefaultFuchsiaResourceDialect,
2260            >,
2261            offset: usize,
2262            depth: fidl::encoding::Depth,
2263        ) -> fidl::Result<()> {
2264            encoder.debug_check_bounds::<FactoryLookupLookupRequest>(offset);
2265            // Zero out padding regions. There's no need to apply masks
2266            // because the unmasked parts will be overwritten by fields.
2267            unsafe {
2268                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2269                (ptr as *mut u64).write_unaligned(0);
2270            }
2271            // Write the fields.
2272            self.0.encode(encoder, offset + 0, depth)?;
2273            self.1.encode(encoder, offset + 16, depth)?;
2274            Ok(())
2275        }
2276    }
2277
2278    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2279        for FactoryLookupLookupRequest
2280    {
2281        #[inline(always)]
2282        fn new_empty() -> Self {
2283            Self {
2284                name: fidl::new_empty!(
2285                    fidl::encoding::BoundedString<32>,
2286                    fidl::encoding::DefaultFuchsiaResourceDialect
2287                ),
2288                device_factory: fidl::new_empty!(
2289                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2290                    fidl::encoding::DefaultFuchsiaResourceDialect
2291                ),
2292            }
2293        }
2294
2295        #[inline]
2296        unsafe fn decode(
2297            &mut self,
2298            decoder: &mut fidl::encoding::Decoder<
2299                '_,
2300                fidl::encoding::DefaultFuchsiaResourceDialect,
2301            >,
2302            offset: usize,
2303            _depth: fidl::encoding::Depth,
2304        ) -> fidl::Result<()> {
2305            decoder.debug_check_bounds::<Self>(offset);
2306            // Verify that padding bytes are zero.
2307            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2308            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2309            let mask = 0xffffffff00000000u64;
2310            let maskedval = padval & mask;
2311            if maskedval != 0 {
2312                return Err(fidl::Error::NonZeroPadding {
2313                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2314                });
2315            }
2316            fidl::decode!(
2317                fidl::encoding::BoundedString<32>,
2318                fidl::encoding::DefaultFuchsiaResourceDialect,
2319                &mut self.name,
2320                decoder,
2321                offset + 0,
2322                _depth
2323            )?;
2324            fidl::decode!(
2325                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2326                fidl::encoding::DefaultFuchsiaResourceDialect,
2327                &mut self.device_factory,
2328                decoder,
2329                offset + 16,
2330                _depth
2331            )?;
2332            Ok(())
2333        }
2334    }
2335
2336    impl fidl::encoding::ResourceTypeMarker for FactoryRegisterRegisterRequest {
2337        type Borrowed<'a> = &'a mut Self;
2338        fn take_or_borrow<'a>(
2339            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2340        ) -> Self::Borrowed<'a> {
2341            value
2342        }
2343    }
2344
2345    unsafe impl fidl::encoding::TypeMarker for FactoryRegisterRegisterRequest {
2346        type Owned = Self;
2347
2348        #[inline(always)]
2349        fn inline_align(_context: fidl::encoding::Context) -> usize {
2350            8
2351        }
2352
2353        #[inline(always)]
2354        fn inline_size(_context: fidl::encoding::Context) -> usize {
2355            24
2356        }
2357    }
2358
2359    unsafe impl
2360        fidl::encoding::Encode<
2361            FactoryRegisterRegisterRequest,
2362            fidl::encoding::DefaultFuchsiaResourceDialect,
2363        > for &mut FactoryRegisterRegisterRequest
2364    {
2365        #[inline]
2366        unsafe fn encode(
2367            self,
2368            encoder: &mut fidl::encoding::Encoder<
2369                '_,
2370                fidl::encoding::DefaultFuchsiaResourceDialect,
2371            >,
2372            offset: usize,
2373            _depth: fidl::encoding::Depth,
2374        ) -> fidl::Result<()> {
2375            encoder.debug_check_bounds::<FactoryRegisterRegisterRequest>(offset);
2376            // Delegate to tuple encoding.
2377            fidl::encoding::Encode::<FactoryRegisterRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2378                (
2379                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2380                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.driver),
2381                ),
2382                encoder, offset, _depth
2383            )
2384        }
2385    }
2386    unsafe impl<
2387            T0: fidl::encoding::Encode<
2388                fidl::encoding::BoundedString<32>,
2389                fidl::encoding::DefaultFuchsiaResourceDialect,
2390            >,
2391            T1: fidl::encoding::Encode<
2392                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>>,
2393                fidl::encoding::DefaultFuchsiaResourceDialect,
2394            >,
2395        >
2396        fidl::encoding::Encode<
2397            FactoryRegisterRegisterRequest,
2398            fidl::encoding::DefaultFuchsiaResourceDialect,
2399        > for (T0, T1)
2400    {
2401        #[inline]
2402        unsafe fn encode(
2403            self,
2404            encoder: &mut fidl::encoding::Encoder<
2405                '_,
2406                fidl::encoding::DefaultFuchsiaResourceDialect,
2407            >,
2408            offset: usize,
2409            depth: fidl::encoding::Depth,
2410        ) -> fidl::Result<()> {
2411            encoder.debug_check_bounds::<FactoryRegisterRegisterRequest>(offset);
2412            // Zero out padding regions. There's no need to apply masks
2413            // because the unmasked parts will be overwritten by fields.
2414            unsafe {
2415                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2416                (ptr as *mut u64).write_unaligned(0);
2417            }
2418            // Write the fields.
2419            self.0.encode(encoder, offset + 0, depth)?;
2420            self.1.encode(encoder, offset + 16, depth)?;
2421            Ok(())
2422        }
2423    }
2424
2425    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2426        for FactoryRegisterRegisterRequest
2427    {
2428        #[inline(always)]
2429        fn new_empty() -> Self {
2430            Self {
2431                name: fidl::new_empty!(
2432                    fidl::encoding::BoundedString<32>,
2433                    fidl::encoding::DefaultFuchsiaResourceDialect
2434                ),
2435                driver: fidl::new_empty!(
2436                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>>,
2437                    fidl::encoding::DefaultFuchsiaResourceDialect
2438                ),
2439            }
2440        }
2441
2442        #[inline]
2443        unsafe fn decode(
2444            &mut self,
2445            decoder: &mut fidl::encoding::Decoder<
2446                '_,
2447                fidl::encoding::DefaultFuchsiaResourceDialect,
2448            >,
2449            offset: usize,
2450            _depth: fidl::encoding::Depth,
2451        ) -> fidl::Result<()> {
2452            decoder.debug_check_bounds::<Self>(offset);
2453            // Verify that padding bytes are zero.
2454            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2455            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2456            let mask = 0xffffffff00000000u64;
2457            let maskedval = padval & mask;
2458            if maskedval != 0 {
2459                return Err(fidl::Error::NonZeroPadding {
2460                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2461                });
2462            }
2463            fidl::decode!(
2464                fidl::encoding::BoundedString<32>,
2465                fidl::encoding::DefaultFuchsiaResourceDialect,
2466                &mut self.name,
2467                decoder,
2468                offset + 0,
2469                _depth
2470            )?;
2471            fidl::decode!(
2472                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>>,
2473                fidl::encoding::DefaultFuchsiaResourceDialect,
2474                &mut self.driver,
2475                decoder,
2476                offset + 16,
2477                _depth
2478            )?;
2479            Ok(())
2480        }
2481    }
2482}