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