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 FactoryDeviceControlHandle {
536 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
537 self.inner.shutdown_with_epitaph(status.into())
538 }
539}
540
541impl fidl::endpoints::ControlHandle for FactoryDeviceControlHandle {
542 fn shutdown(&self) {
543 self.inner.shutdown()
544 }
545
546 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
547 self.inner.shutdown_with_epitaph(status)
548 }
549
550 fn is_closed(&self) -> bool {
551 self.inner.channel().is_closed()
552 }
553 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
554 self.inner.channel().on_closed()
555 }
556
557 #[cfg(target_os = "fuchsia")]
558 fn signal_peer(
559 &self,
560 clear_mask: zx::Signals,
561 set_mask: zx::Signals,
562 ) -> Result<(), zx_status::Status> {
563 use fidl::Peered;
564 self.inner.channel().signal_peer(clear_mask, set_mask)
565 }
566}
567
568impl FactoryDeviceControlHandle {}
569
570#[must_use = "FIDL methods require a response to be sent"]
571#[derive(Debug)]
572pub struct FactoryDeviceSendMfgCommandResponder {
573 control_handle: std::mem::ManuallyDrop<FactoryDeviceControlHandle>,
574 tx_id: u32,
575}
576
577impl std::ops::Drop for FactoryDeviceSendMfgCommandResponder {
581 fn drop(&mut self) {
582 self.control_handle.shutdown();
583 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
585 }
586}
587
588impl fidl::endpoints::Responder for FactoryDeviceSendMfgCommandResponder {
589 type ControlHandle = FactoryDeviceControlHandle;
590
591 fn control_handle(&self) -> &FactoryDeviceControlHandle {
592 &self.control_handle
593 }
594
595 fn drop_without_shutdown(mut self) {
596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
598 std::mem::forget(self);
600 }
601}
602
603impl FactoryDeviceSendMfgCommandResponder {
604 pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
608 let _result = self.send_raw(response);
609 if _result.is_err() {
610 self.control_handle.shutdown();
611 }
612 self.drop_without_shutdown();
613 _result
614 }
615
616 pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
618 let _result = self.send_raw(response);
619 self.drop_without_shutdown();
620 _result
621 }
622
623 fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
624 self.control_handle.inner.send::<FactoryDeviceSendMfgCommandResponse>(
625 (response,),
626 self.tx_id,
627 0x61ea2fba8c9fb7,
628 fidl::encoding::DynamicFlags::empty(),
629 )
630 }
631}
632
633#[must_use = "FIDL methods require a response to be sent"]
634#[derive(Debug)]
635pub struct FactoryDeviceSetupOtCliResponder {
636 control_handle: std::mem::ManuallyDrop<FactoryDeviceControlHandle>,
637 tx_id: u32,
638}
639
640impl std::ops::Drop for FactoryDeviceSetupOtCliResponder {
644 fn drop(&mut self) {
645 self.control_handle.shutdown();
646 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
648 }
649}
650
651impl fidl::endpoints::Responder for FactoryDeviceSetupOtCliResponder {
652 type ControlHandle = FactoryDeviceControlHandle;
653
654 fn control_handle(&self) -> &FactoryDeviceControlHandle {
655 &self.control_handle
656 }
657
658 fn drop_without_shutdown(mut self) {
659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
661 std::mem::forget(self);
663 }
664}
665
666impl FactoryDeviceSetupOtCliResponder {
667 pub fn send(self) -> Result<(), fidl::Error> {
671 let _result = self.send_raw();
672 if _result.is_err() {
673 self.control_handle.shutdown();
674 }
675 self.drop_without_shutdown();
676 _result
677 }
678
679 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
681 let _result = self.send_raw();
682 self.drop_without_shutdown();
683 _result
684 }
685
686 fn send_raw(&self) -> Result<(), fidl::Error> {
687 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
688 (),
689 self.tx_id,
690 0x6a2b94d0a72e1663,
691 fidl::encoding::DynamicFlags::empty(),
692 )
693 }
694}
695
696#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
697pub struct FactoryDriverMarker;
698
699impl fidl::endpoints::ProtocolMarker for FactoryDriverMarker {
700 type Proxy = FactoryDriverProxy;
701 type RequestStream = FactoryDriverRequestStream;
702 #[cfg(target_os = "fuchsia")]
703 type SynchronousProxy = FactoryDriverSynchronousProxy;
704
705 const DEBUG_NAME: &'static str = "(anonymous) FactoryDriver";
706}
707
708pub trait FactoryDriverProxyInterface: Send + Sync {
709 fn r#get_factory_device(
710 &self,
711 device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
712 ) -> Result<(), fidl::Error>;
713}
714#[derive(Debug)]
715#[cfg(target_os = "fuchsia")]
716pub struct FactoryDriverSynchronousProxy {
717 client: fidl::client::sync::Client,
718}
719
720#[cfg(target_os = "fuchsia")]
721impl fidl::endpoints::SynchronousProxy for FactoryDriverSynchronousProxy {
722 type Proxy = FactoryDriverProxy;
723 type Protocol = FactoryDriverMarker;
724
725 fn from_channel(inner: fidl::Channel) -> Self {
726 Self::new(inner)
727 }
728
729 fn into_channel(self) -> fidl::Channel {
730 self.client.into_channel()
731 }
732
733 fn as_channel(&self) -> &fidl::Channel {
734 self.client.as_channel()
735 }
736}
737
738#[cfg(target_os = "fuchsia")]
739impl FactoryDriverSynchronousProxy {
740 pub fn new(channel: fidl::Channel) -> Self {
741 Self { client: fidl::client::sync::Client::new(channel) }
742 }
743
744 pub fn into_channel(self) -> fidl::Channel {
745 self.client.into_channel()
746 }
747
748 pub fn wait_for_event(
751 &self,
752 deadline: zx::MonotonicInstant,
753 ) -> Result<FactoryDriverEvent, fidl::Error> {
754 FactoryDriverEvent::decode(self.client.wait_for_event::<FactoryDriverMarker>(deadline)?)
755 }
756
757 pub fn r#get_factory_device(
759 &self,
760 mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
761 ) -> Result<(), fidl::Error> {
762 self.client.send::<FactoryDriverGetFactoryDeviceRequest>(
763 (device_factory,),
764 0x7b3a42b6d35a7e1d,
765 fidl::encoding::DynamicFlags::empty(),
766 )
767 }
768}
769
770#[cfg(target_os = "fuchsia")]
771impl From<FactoryDriverSynchronousProxy> for zx::NullableHandle {
772 fn from(value: FactoryDriverSynchronousProxy) -> Self {
773 value.into_channel().into()
774 }
775}
776
777#[cfg(target_os = "fuchsia")]
778impl From<fidl::Channel> for FactoryDriverSynchronousProxy {
779 fn from(value: fidl::Channel) -> Self {
780 Self::new(value)
781 }
782}
783
784#[cfg(target_os = "fuchsia")]
785impl fidl::endpoints::FromClient for FactoryDriverSynchronousProxy {
786 type Protocol = FactoryDriverMarker;
787
788 fn from_client(value: fidl::endpoints::ClientEnd<FactoryDriverMarker>) -> Self {
789 Self::new(value.into_channel())
790 }
791}
792
793#[derive(Debug, Clone)]
794pub struct FactoryDriverProxy {
795 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
796}
797
798impl fidl::endpoints::Proxy for FactoryDriverProxy {
799 type Protocol = FactoryDriverMarker;
800
801 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
802 Self::new(inner)
803 }
804
805 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
806 self.client.into_channel().map_err(|client| Self { client })
807 }
808
809 fn as_channel(&self) -> &::fidl::AsyncChannel {
810 self.client.as_channel()
811 }
812}
813
814impl FactoryDriverProxy {
815 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
817 let protocol_name = <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
818 Self { client: fidl::client::Client::new(channel, protocol_name) }
819 }
820
821 pub fn take_event_stream(&self) -> FactoryDriverEventStream {
827 FactoryDriverEventStream { event_receiver: self.client.take_event_receiver() }
828 }
829
830 pub fn r#get_factory_device(
832 &self,
833 mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
834 ) -> Result<(), fidl::Error> {
835 FactoryDriverProxyInterface::r#get_factory_device(self, device_factory)
836 }
837}
838
839impl FactoryDriverProxyInterface for FactoryDriverProxy {
840 fn r#get_factory_device(
841 &self,
842 mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
843 ) -> Result<(), fidl::Error> {
844 self.client.send::<FactoryDriverGetFactoryDeviceRequest>(
845 (device_factory,),
846 0x7b3a42b6d35a7e1d,
847 fidl::encoding::DynamicFlags::empty(),
848 )
849 }
850}
851
852pub struct FactoryDriverEventStream {
853 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
854}
855
856impl std::marker::Unpin for FactoryDriverEventStream {}
857
858impl futures::stream::FusedStream for FactoryDriverEventStream {
859 fn is_terminated(&self) -> bool {
860 self.event_receiver.is_terminated()
861 }
862}
863
864impl futures::Stream for FactoryDriverEventStream {
865 type Item = Result<FactoryDriverEvent, fidl::Error>;
866
867 fn poll_next(
868 mut self: std::pin::Pin<&mut Self>,
869 cx: &mut std::task::Context<'_>,
870 ) -> std::task::Poll<Option<Self::Item>> {
871 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
872 &mut self.event_receiver,
873 cx
874 )?) {
875 Some(buf) => std::task::Poll::Ready(Some(FactoryDriverEvent::decode(buf))),
876 None => std::task::Poll::Ready(None),
877 }
878 }
879}
880
881#[derive(Debug)]
882pub enum FactoryDriverEvent {}
883
884impl FactoryDriverEvent {
885 fn decode(
887 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
888 ) -> Result<FactoryDriverEvent, fidl::Error> {
889 let (bytes, _handles) = buf.split_mut();
890 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
891 debug_assert_eq!(tx_header.tx_id, 0);
892 match tx_header.ordinal {
893 _ => Err(fidl::Error::UnknownOrdinal {
894 ordinal: tx_header.ordinal,
895 protocol_name: <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
896 }),
897 }
898 }
899}
900
901pub struct FactoryDriverRequestStream {
903 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
904 is_terminated: bool,
905}
906
907impl std::marker::Unpin for FactoryDriverRequestStream {}
908
909impl futures::stream::FusedStream for FactoryDriverRequestStream {
910 fn is_terminated(&self) -> bool {
911 self.is_terminated
912 }
913}
914
915impl fidl::endpoints::RequestStream for FactoryDriverRequestStream {
916 type Protocol = FactoryDriverMarker;
917 type ControlHandle = FactoryDriverControlHandle;
918
919 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
920 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
921 }
922
923 fn control_handle(&self) -> Self::ControlHandle {
924 FactoryDriverControlHandle { inner: self.inner.clone() }
925 }
926
927 fn into_inner(
928 self,
929 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
930 {
931 (self.inner, self.is_terminated)
932 }
933
934 fn from_inner(
935 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
936 is_terminated: bool,
937 ) -> Self {
938 Self { inner, is_terminated }
939 }
940}
941
942impl futures::Stream for FactoryDriverRequestStream {
943 type Item = Result<FactoryDriverRequest, fidl::Error>;
944
945 fn poll_next(
946 mut self: std::pin::Pin<&mut Self>,
947 cx: &mut std::task::Context<'_>,
948 ) -> std::task::Poll<Option<Self::Item>> {
949 let this = &mut *self;
950 if this.inner.check_shutdown(cx) {
951 this.is_terminated = true;
952 return std::task::Poll::Ready(None);
953 }
954 if this.is_terminated {
955 panic!("polled FactoryDriverRequestStream after completion");
956 }
957 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
958 |bytes, handles| {
959 match this.inner.channel().read_etc(cx, bytes, handles) {
960 std::task::Poll::Ready(Ok(())) => {}
961 std::task::Poll::Pending => return std::task::Poll::Pending,
962 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
963 this.is_terminated = true;
964 return std::task::Poll::Ready(None);
965 }
966 std::task::Poll::Ready(Err(e)) => {
967 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
968 e.into(),
969 ))));
970 }
971 }
972
973 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
975
976 std::task::Poll::Ready(Some(match header.ordinal {
977 0x7b3a42b6d35a7e1d => {
978 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
979 let mut req = fidl::new_empty!(
980 FactoryDriverGetFactoryDeviceRequest,
981 fidl::encoding::DefaultFuchsiaResourceDialect
982 );
983 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryDriverGetFactoryDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
984 let control_handle =
985 FactoryDriverControlHandle { inner: this.inner.clone() };
986 Ok(FactoryDriverRequest::GetFactoryDevice {
987 device_factory: req.device_factory,
988
989 control_handle,
990 })
991 }
992 _ => Err(fidl::Error::UnknownOrdinal {
993 ordinal: header.ordinal,
994 protocol_name:
995 <FactoryDriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
996 }),
997 }))
998 },
999 )
1000 }
1001}
1002
1003#[derive(Debug)]
1011pub enum FactoryDriverRequest {
1012 GetFactoryDevice {
1014 device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1015 control_handle: FactoryDriverControlHandle,
1016 },
1017}
1018
1019impl FactoryDriverRequest {
1020 #[allow(irrefutable_let_patterns)]
1021 pub fn into_get_factory_device(
1022 self,
1023 ) -> Option<(fidl::endpoints::ServerEnd<FactoryDeviceMarker>, FactoryDriverControlHandle)> {
1024 if let FactoryDriverRequest::GetFactoryDevice { device_factory, control_handle } = self {
1025 Some((device_factory, control_handle))
1026 } else {
1027 None
1028 }
1029 }
1030
1031 pub fn method_name(&self) -> &'static str {
1033 match *self {
1034 FactoryDriverRequest::GetFactoryDevice { .. } => "get_factory_device",
1035 }
1036 }
1037}
1038
1039#[derive(Debug, Clone)]
1040pub struct FactoryDriverControlHandle {
1041 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1042}
1043
1044impl FactoryDriverControlHandle {
1045 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1046 self.inner.shutdown_with_epitaph(status.into())
1047 }
1048}
1049
1050impl fidl::endpoints::ControlHandle for FactoryDriverControlHandle {
1051 fn shutdown(&self) {
1052 self.inner.shutdown()
1053 }
1054
1055 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1056 self.inner.shutdown_with_epitaph(status)
1057 }
1058
1059 fn is_closed(&self) -> bool {
1060 self.inner.channel().is_closed()
1061 }
1062 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1063 self.inner.channel().on_closed()
1064 }
1065
1066 #[cfg(target_os = "fuchsia")]
1067 fn signal_peer(
1068 &self,
1069 clear_mask: zx::Signals,
1070 set_mask: zx::Signals,
1071 ) -> Result<(), zx_status::Status> {
1072 use fidl::Peered;
1073 self.inner.channel().signal_peer(clear_mask, set_mask)
1074 }
1075}
1076
1077impl FactoryDriverControlHandle {}
1078
1079#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1080pub struct FactoryLookupMarker;
1081
1082impl fidl::endpoints::ProtocolMarker for FactoryLookupMarker {
1083 type Proxy = FactoryLookupProxy;
1084 type RequestStream = FactoryLookupRequestStream;
1085 #[cfg(target_os = "fuchsia")]
1086 type SynchronousProxy = FactoryLookupSynchronousProxy;
1087
1088 const DEBUG_NAME: &'static str = "fuchsia.factory.lowpan.FactoryLookup";
1089}
1090impl fidl::endpoints::DiscoverableProtocolMarker for FactoryLookupMarker {}
1091
1092pub trait FactoryLookupProxyInterface: Send + Sync {
1093 fn r#lookup(
1094 &self,
1095 name: &str,
1096 device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1097 ) -> Result<(), fidl::Error>;
1098}
1099#[derive(Debug)]
1100#[cfg(target_os = "fuchsia")]
1101pub struct FactoryLookupSynchronousProxy {
1102 client: fidl::client::sync::Client,
1103}
1104
1105#[cfg(target_os = "fuchsia")]
1106impl fidl::endpoints::SynchronousProxy for FactoryLookupSynchronousProxy {
1107 type Proxy = FactoryLookupProxy;
1108 type Protocol = FactoryLookupMarker;
1109
1110 fn from_channel(inner: fidl::Channel) -> Self {
1111 Self::new(inner)
1112 }
1113
1114 fn into_channel(self) -> fidl::Channel {
1115 self.client.into_channel()
1116 }
1117
1118 fn as_channel(&self) -> &fidl::Channel {
1119 self.client.as_channel()
1120 }
1121}
1122
1123#[cfg(target_os = "fuchsia")]
1124impl FactoryLookupSynchronousProxy {
1125 pub fn new(channel: fidl::Channel) -> Self {
1126 Self { client: fidl::client::sync::Client::new(channel) }
1127 }
1128
1129 pub fn into_channel(self) -> fidl::Channel {
1130 self.client.into_channel()
1131 }
1132
1133 pub fn wait_for_event(
1136 &self,
1137 deadline: zx::MonotonicInstant,
1138 ) -> Result<FactoryLookupEvent, fidl::Error> {
1139 FactoryLookupEvent::decode(self.client.wait_for_event::<FactoryLookupMarker>(deadline)?)
1140 }
1141
1142 pub fn r#lookup(
1144 &self,
1145 mut name: &str,
1146 mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1147 ) -> Result<(), fidl::Error> {
1148 self.client.send::<FactoryLookupLookupRequest>(
1149 (name, device_factory),
1150 0x7b8dc96a8fbf4885,
1151 fidl::encoding::DynamicFlags::empty(),
1152 )
1153 }
1154}
1155
1156#[cfg(target_os = "fuchsia")]
1157impl From<FactoryLookupSynchronousProxy> for zx::NullableHandle {
1158 fn from(value: FactoryLookupSynchronousProxy) -> Self {
1159 value.into_channel().into()
1160 }
1161}
1162
1163#[cfg(target_os = "fuchsia")]
1164impl From<fidl::Channel> for FactoryLookupSynchronousProxy {
1165 fn from(value: fidl::Channel) -> Self {
1166 Self::new(value)
1167 }
1168}
1169
1170#[cfg(target_os = "fuchsia")]
1171impl fidl::endpoints::FromClient for FactoryLookupSynchronousProxy {
1172 type Protocol = FactoryLookupMarker;
1173
1174 fn from_client(value: fidl::endpoints::ClientEnd<FactoryLookupMarker>) -> Self {
1175 Self::new(value.into_channel())
1176 }
1177}
1178
1179#[derive(Debug, Clone)]
1180pub struct FactoryLookupProxy {
1181 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1182}
1183
1184impl fidl::endpoints::Proxy for FactoryLookupProxy {
1185 type Protocol = FactoryLookupMarker;
1186
1187 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1188 Self::new(inner)
1189 }
1190
1191 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1192 self.client.into_channel().map_err(|client| Self { client })
1193 }
1194
1195 fn as_channel(&self) -> &::fidl::AsyncChannel {
1196 self.client.as_channel()
1197 }
1198}
1199
1200impl FactoryLookupProxy {
1201 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1203 let protocol_name = <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1204 Self { client: fidl::client::Client::new(channel, protocol_name) }
1205 }
1206
1207 pub fn take_event_stream(&self) -> FactoryLookupEventStream {
1213 FactoryLookupEventStream { event_receiver: self.client.take_event_receiver() }
1214 }
1215
1216 pub fn r#lookup(
1218 &self,
1219 mut name: &str,
1220 mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1221 ) -> Result<(), fidl::Error> {
1222 FactoryLookupProxyInterface::r#lookup(self, name, device_factory)
1223 }
1224}
1225
1226impl FactoryLookupProxyInterface for FactoryLookupProxy {
1227 fn r#lookup(
1228 &self,
1229 mut name: &str,
1230 mut device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1231 ) -> Result<(), fidl::Error> {
1232 self.client.send::<FactoryLookupLookupRequest>(
1233 (name, device_factory),
1234 0x7b8dc96a8fbf4885,
1235 fidl::encoding::DynamicFlags::empty(),
1236 )
1237 }
1238}
1239
1240pub struct FactoryLookupEventStream {
1241 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1242}
1243
1244impl std::marker::Unpin for FactoryLookupEventStream {}
1245
1246impl futures::stream::FusedStream for FactoryLookupEventStream {
1247 fn is_terminated(&self) -> bool {
1248 self.event_receiver.is_terminated()
1249 }
1250}
1251
1252impl futures::Stream for FactoryLookupEventStream {
1253 type Item = Result<FactoryLookupEvent, fidl::Error>;
1254
1255 fn poll_next(
1256 mut self: std::pin::Pin<&mut Self>,
1257 cx: &mut std::task::Context<'_>,
1258 ) -> std::task::Poll<Option<Self::Item>> {
1259 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1260 &mut self.event_receiver,
1261 cx
1262 )?) {
1263 Some(buf) => std::task::Poll::Ready(Some(FactoryLookupEvent::decode(buf))),
1264 None => std::task::Poll::Ready(None),
1265 }
1266 }
1267}
1268
1269#[derive(Debug)]
1270pub enum FactoryLookupEvent {}
1271
1272impl FactoryLookupEvent {
1273 fn decode(
1275 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1276 ) -> Result<FactoryLookupEvent, fidl::Error> {
1277 let (bytes, _handles) = buf.split_mut();
1278 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1279 debug_assert_eq!(tx_header.tx_id, 0);
1280 match tx_header.ordinal {
1281 _ => Err(fidl::Error::UnknownOrdinal {
1282 ordinal: tx_header.ordinal,
1283 protocol_name: <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1284 }),
1285 }
1286 }
1287}
1288
1289pub struct FactoryLookupRequestStream {
1291 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1292 is_terminated: bool,
1293}
1294
1295impl std::marker::Unpin for FactoryLookupRequestStream {}
1296
1297impl futures::stream::FusedStream for FactoryLookupRequestStream {
1298 fn is_terminated(&self) -> bool {
1299 self.is_terminated
1300 }
1301}
1302
1303impl fidl::endpoints::RequestStream for FactoryLookupRequestStream {
1304 type Protocol = FactoryLookupMarker;
1305 type ControlHandle = FactoryLookupControlHandle;
1306
1307 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1308 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1309 }
1310
1311 fn control_handle(&self) -> Self::ControlHandle {
1312 FactoryLookupControlHandle { inner: self.inner.clone() }
1313 }
1314
1315 fn into_inner(
1316 self,
1317 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1318 {
1319 (self.inner, self.is_terminated)
1320 }
1321
1322 fn from_inner(
1323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1324 is_terminated: bool,
1325 ) -> Self {
1326 Self { inner, is_terminated }
1327 }
1328}
1329
1330impl futures::Stream for FactoryLookupRequestStream {
1331 type Item = Result<FactoryLookupRequest, fidl::Error>;
1332
1333 fn poll_next(
1334 mut self: std::pin::Pin<&mut Self>,
1335 cx: &mut std::task::Context<'_>,
1336 ) -> std::task::Poll<Option<Self::Item>> {
1337 let this = &mut *self;
1338 if this.inner.check_shutdown(cx) {
1339 this.is_terminated = true;
1340 return std::task::Poll::Ready(None);
1341 }
1342 if this.is_terminated {
1343 panic!("polled FactoryLookupRequestStream after completion");
1344 }
1345 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1346 |bytes, handles| {
1347 match this.inner.channel().read_etc(cx, bytes, handles) {
1348 std::task::Poll::Ready(Ok(())) => {}
1349 std::task::Poll::Pending => return std::task::Poll::Pending,
1350 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1351 this.is_terminated = true;
1352 return std::task::Poll::Ready(None);
1353 }
1354 std::task::Poll::Ready(Err(e)) => {
1355 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1356 e.into(),
1357 ))));
1358 }
1359 }
1360
1361 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1363
1364 std::task::Poll::Ready(Some(match header.ordinal {
1365 0x7b8dc96a8fbf4885 => {
1366 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1367 let mut req = fidl::new_empty!(
1368 FactoryLookupLookupRequest,
1369 fidl::encoding::DefaultFuchsiaResourceDialect
1370 );
1371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryLookupLookupRequest>(&header, _body_bytes, handles, &mut req)?;
1372 let control_handle =
1373 FactoryLookupControlHandle { inner: this.inner.clone() };
1374 Ok(FactoryLookupRequest::Lookup {
1375 name: req.name,
1376 device_factory: req.device_factory,
1377
1378 control_handle,
1379 })
1380 }
1381 _ => Err(fidl::Error::UnknownOrdinal {
1382 ordinal: header.ordinal,
1383 protocol_name:
1384 <FactoryLookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1385 }),
1386 }))
1387 },
1388 )
1389 }
1390}
1391
1392#[derive(Debug)]
1397pub enum FactoryLookupRequest {
1398 Lookup {
1400 name: String,
1401 device_factory: fidl::endpoints::ServerEnd<FactoryDeviceMarker>,
1402 control_handle: FactoryLookupControlHandle,
1403 },
1404}
1405
1406impl FactoryLookupRequest {
1407 #[allow(irrefutable_let_patterns)]
1408 pub fn into_lookup(
1409 self,
1410 ) -> Option<(String, fidl::endpoints::ServerEnd<FactoryDeviceMarker>, FactoryLookupControlHandle)>
1411 {
1412 if let FactoryLookupRequest::Lookup { name, device_factory, control_handle } = self {
1413 Some((name, device_factory, control_handle))
1414 } else {
1415 None
1416 }
1417 }
1418
1419 pub fn method_name(&self) -> &'static str {
1421 match *self {
1422 FactoryLookupRequest::Lookup { .. } => "lookup",
1423 }
1424 }
1425}
1426
1427#[derive(Debug, Clone)]
1428pub struct FactoryLookupControlHandle {
1429 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1430}
1431
1432impl FactoryLookupControlHandle {
1433 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1434 self.inner.shutdown_with_epitaph(status.into())
1435 }
1436}
1437
1438impl fidl::endpoints::ControlHandle for FactoryLookupControlHandle {
1439 fn shutdown(&self) {
1440 self.inner.shutdown()
1441 }
1442
1443 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1444 self.inner.shutdown_with_epitaph(status)
1445 }
1446
1447 fn is_closed(&self) -> bool {
1448 self.inner.channel().is_closed()
1449 }
1450 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1451 self.inner.channel().on_closed()
1452 }
1453
1454 #[cfg(target_os = "fuchsia")]
1455 fn signal_peer(
1456 &self,
1457 clear_mask: zx::Signals,
1458 set_mask: zx::Signals,
1459 ) -> Result<(), zx_status::Status> {
1460 use fidl::Peered;
1461 self.inner.channel().signal_peer(clear_mask, set_mask)
1462 }
1463}
1464
1465impl FactoryLookupControlHandle {}
1466
1467#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1468pub struct FactoryRegisterMarker;
1469
1470impl fidl::endpoints::ProtocolMarker for FactoryRegisterMarker {
1471 type Proxy = FactoryRegisterProxy;
1472 type RequestStream = FactoryRegisterRequestStream;
1473 #[cfg(target_os = "fuchsia")]
1474 type SynchronousProxy = FactoryRegisterSynchronousProxy;
1475
1476 const DEBUG_NAME: &'static str = "fuchsia.factory.lowpan.FactoryRegister";
1477}
1478impl fidl::endpoints::DiscoverableProtocolMarker for FactoryRegisterMarker {}
1479
1480pub trait FactoryRegisterProxyInterface: Send + Sync {
1481 fn r#register(
1482 &self,
1483 name: &str,
1484 driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1485 ) -> Result<(), fidl::Error>;
1486}
1487#[derive(Debug)]
1488#[cfg(target_os = "fuchsia")]
1489pub struct FactoryRegisterSynchronousProxy {
1490 client: fidl::client::sync::Client,
1491}
1492
1493#[cfg(target_os = "fuchsia")]
1494impl fidl::endpoints::SynchronousProxy for FactoryRegisterSynchronousProxy {
1495 type Proxy = FactoryRegisterProxy;
1496 type Protocol = FactoryRegisterMarker;
1497
1498 fn from_channel(inner: fidl::Channel) -> Self {
1499 Self::new(inner)
1500 }
1501
1502 fn into_channel(self) -> fidl::Channel {
1503 self.client.into_channel()
1504 }
1505
1506 fn as_channel(&self) -> &fidl::Channel {
1507 self.client.as_channel()
1508 }
1509}
1510
1511#[cfg(target_os = "fuchsia")]
1512impl FactoryRegisterSynchronousProxy {
1513 pub fn new(channel: fidl::Channel) -> Self {
1514 Self { client: fidl::client::sync::Client::new(channel) }
1515 }
1516
1517 pub fn into_channel(self) -> fidl::Channel {
1518 self.client.into_channel()
1519 }
1520
1521 pub fn wait_for_event(
1524 &self,
1525 deadline: zx::MonotonicInstant,
1526 ) -> Result<FactoryRegisterEvent, fidl::Error> {
1527 FactoryRegisterEvent::decode(self.client.wait_for_event::<FactoryRegisterMarker>(deadline)?)
1528 }
1529
1530 pub fn r#register(
1536 &self,
1537 mut name: &str,
1538 mut driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1539 ) -> Result<(), fidl::Error> {
1540 self.client.send::<FactoryRegisterRegisterRequest>(
1541 (name, driver),
1542 0x1d167c20bdcccf1f,
1543 fidl::encoding::DynamicFlags::empty(),
1544 )
1545 }
1546}
1547
1548#[cfg(target_os = "fuchsia")]
1549impl From<FactoryRegisterSynchronousProxy> for zx::NullableHandle {
1550 fn from(value: FactoryRegisterSynchronousProxy) -> Self {
1551 value.into_channel().into()
1552 }
1553}
1554
1555#[cfg(target_os = "fuchsia")]
1556impl From<fidl::Channel> for FactoryRegisterSynchronousProxy {
1557 fn from(value: fidl::Channel) -> Self {
1558 Self::new(value)
1559 }
1560}
1561
1562#[cfg(target_os = "fuchsia")]
1563impl fidl::endpoints::FromClient for FactoryRegisterSynchronousProxy {
1564 type Protocol = FactoryRegisterMarker;
1565
1566 fn from_client(value: fidl::endpoints::ClientEnd<FactoryRegisterMarker>) -> Self {
1567 Self::new(value.into_channel())
1568 }
1569}
1570
1571#[derive(Debug, Clone)]
1572pub struct FactoryRegisterProxy {
1573 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1574}
1575
1576impl fidl::endpoints::Proxy for FactoryRegisterProxy {
1577 type Protocol = FactoryRegisterMarker;
1578
1579 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1580 Self::new(inner)
1581 }
1582
1583 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1584 self.client.into_channel().map_err(|client| Self { client })
1585 }
1586
1587 fn as_channel(&self) -> &::fidl::AsyncChannel {
1588 self.client.as_channel()
1589 }
1590}
1591
1592impl FactoryRegisterProxy {
1593 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1595 let protocol_name = <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1596 Self { client: fidl::client::Client::new(channel, protocol_name) }
1597 }
1598
1599 pub fn take_event_stream(&self) -> FactoryRegisterEventStream {
1605 FactoryRegisterEventStream { event_receiver: self.client.take_event_receiver() }
1606 }
1607
1608 pub fn r#register(
1614 &self,
1615 mut name: &str,
1616 mut driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1617 ) -> Result<(), fidl::Error> {
1618 FactoryRegisterProxyInterface::r#register(self, name, driver)
1619 }
1620}
1621
1622impl FactoryRegisterProxyInterface for FactoryRegisterProxy {
1623 fn r#register(
1624 &self,
1625 mut name: &str,
1626 mut driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1627 ) -> Result<(), fidl::Error> {
1628 self.client.send::<FactoryRegisterRegisterRequest>(
1629 (name, driver),
1630 0x1d167c20bdcccf1f,
1631 fidl::encoding::DynamicFlags::empty(),
1632 )
1633 }
1634}
1635
1636pub struct FactoryRegisterEventStream {
1637 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1638}
1639
1640impl std::marker::Unpin for FactoryRegisterEventStream {}
1641
1642impl futures::stream::FusedStream for FactoryRegisterEventStream {
1643 fn is_terminated(&self) -> bool {
1644 self.event_receiver.is_terminated()
1645 }
1646}
1647
1648impl futures::Stream for FactoryRegisterEventStream {
1649 type Item = Result<FactoryRegisterEvent, fidl::Error>;
1650
1651 fn poll_next(
1652 mut self: std::pin::Pin<&mut Self>,
1653 cx: &mut std::task::Context<'_>,
1654 ) -> std::task::Poll<Option<Self::Item>> {
1655 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1656 &mut self.event_receiver,
1657 cx
1658 )?) {
1659 Some(buf) => std::task::Poll::Ready(Some(FactoryRegisterEvent::decode(buf))),
1660 None => std::task::Poll::Ready(None),
1661 }
1662 }
1663}
1664
1665#[derive(Debug)]
1666pub enum FactoryRegisterEvent {}
1667
1668impl FactoryRegisterEvent {
1669 fn decode(
1671 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1672 ) -> Result<FactoryRegisterEvent, fidl::Error> {
1673 let (bytes, _handles) = buf.split_mut();
1674 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1675 debug_assert_eq!(tx_header.tx_id, 0);
1676 match tx_header.ordinal {
1677 _ => Err(fidl::Error::UnknownOrdinal {
1678 ordinal: tx_header.ordinal,
1679 protocol_name:
1680 <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1681 }),
1682 }
1683 }
1684}
1685
1686pub struct FactoryRegisterRequestStream {
1688 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1689 is_terminated: bool,
1690}
1691
1692impl std::marker::Unpin for FactoryRegisterRequestStream {}
1693
1694impl futures::stream::FusedStream for FactoryRegisterRequestStream {
1695 fn is_terminated(&self) -> bool {
1696 self.is_terminated
1697 }
1698}
1699
1700impl fidl::endpoints::RequestStream for FactoryRegisterRequestStream {
1701 type Protocol = FactoryRegisterMarker;
1702 type ControlHandle = FactoryRegisterControlHandle;
1703
1704 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1705 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1706 }
1707
1708 fn control_handle(&self) -> Self::ControlHandle {
1709 FactoryRegisterControlHandle { inner: self.inner.clone() }
1710 }
1711
1712 fn into_inner(
1713 self,
1714 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1715 {
1716 (self.inner, self.is_terminated)
1717 }
1718
1719 fn from_inner(
1720 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1721 is_terminated: bool,
1722 ) -> Self {
1723 Self { inner, is_terminated }
1724 }
1725}
1726
1727impl futures::Stream for FactoryRegisterRequestStream {
1728 type Item = Result<FactoryRegisterRequest, fidl::Error>;
1729
1730 fn poll_next(
1731 mut self: std::pin::Pin<&mut Self>,
1732 cx: &mut std::task::Context<'_>,
1733 ) -> std::task::Poll<Option<Self::Item>> {
1734 let this = &mut *self;
1735 if this.inner.check_shutdown(cx) {
1736 this.is_terminated = true;
1737 return std::task::Poll::Ready(None);
1738 }
1739 if this.is_terminated {
1740 panic!("polled FactoryRegisterRequestStream after completion");
1741 }
1742 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1743 |bytes, handles| {
1744 match this.inner.channel().read_etc(cx, bytes, handles) {
1745 std::task::Poll::Ready(Ok(())) => {}
1746 std::task::Poll::Pending => return std::task::Poll::Pending,
1747 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1748 this.is_terminated = true;
1749 return std::task::Poll::Ready(None);
1750 }
1751 std::task::Poll::Ready(Err(e)) => {
1752 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1753 e.into(),
1754 ))));
1755 }
1756 }
1757
1758 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1760
1761 std::task::Poll::Ready(Some(match header.ordinal {
1762 0x1d167c20bdcccf1f => {
1763 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1764 let mut req = fidl::new_empty!(
1765 FactoryRegisterRegisterRequest,
1766 fidl::encoding::DefaultFuchsiaResourceDialect
1767 );
1768 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryRegisterRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
1769 let control_handle =
1770 FactoryRegisterControlHandle { inner: this.inner.clone() };
1771 Ok(FactoryRegisterRequest::Register {
1772 name: req.name,
1773 driver: req.driver,
1774
1775 control_handle,
1776 })
1777 }
1778 _ => Err(fidl::Error::UnknownOrdinal {
1779 ordinal: header.ordinal,
1780 protocol_name:
1781 <FactoryRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1782 }),
1783 }))
1784 },
1785 )
1786 }
1787}
1788
1789#[derive(Debug)]
1793pub enum FactoryRegisterRequest {
1794 Register {
1800 name: String,
1801 driver: fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1802 control_handle: FactoryRegisterControlHandle,
1803 },
1804}
1805
1806impl FactoryRegisterRequest {
1807 #[allow(irrefutable_let_patterns)]
1808 pub fn into_register(
1809 self,
1810 ) -> Option<(
1811 String,
1812 fidl::endpoints::ClientEnd<FactoryDriverMarker>,
1813 FactoryRegisterControlHandle,
1814 )> {
1815 if let FactoryRegisterRequest::Register { name, driver, control_handle } = self {
1816 Some((name, driver, control_handle))
1817 } else {
1818 None
1819 }
1820 }
1821
1822 pub fn method_name(&self) -> &'static str {
1824 match *self {
1825 FactoryRegisterRequest::Register { .. } => "register",
1826 }
1827 }
1828}
1829
1830#[derive(Debug, Clone)]
1831pub struct FactoryRegisterControlHandle {
1832 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1833}
1834
1835impl FactoryRegisterControlHandle {
1836 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1837 self.inner.shutdown_with_epitaph(status.into())
1838 }
1839}
1840
1841impl fidl::endpoints::ControlHandle for FactoryRegisterControlHandle {
1842 fn shutdown(&self) {
1843 self.inner.shutdown()
1844 }
1845
1846 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1847 self.inner.shutdown_with_epitaph(status)
1848 }
1849
1850 fn is_closed(&self) -> bool {
1851 self.inner.channel().is_closed()
1852 }
1853 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1854 self.inner.channel().on_closed()
1855 }
1856
1857 #[cfg(target_os = "fuchsia")]
1858 fn signal_peer(
1859 &self,
1860 clear_mask: zx::Signals,
1861 set_mask: zx::Signals,
1862 ) -> Result<(), zx_status::Status> {
1863 use fidl::Peered;
1864 self.inner.channel().signal_peer(clear_mask, set_mask)
1865 }
1866}
1867
1868impl FactoryRegisterControlHandle {}
1869
1870mod internal {
1871 use super::*;
1872
1873 impl fidl::encoding::ResourceTypeMarker for FactoryDeviceSetupOtCliRequest {
1874 type Borrowed<'a> = &'a mut Self;
1875 fn take_or_borrow<'a>(
1876 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1877 ) -> Self::Borrowed<'a> {
1878 value
1879 }
1880 }
1881
1882 unsafe impl fidl::encoding::TypeMarker for FactoryDeviceSetupOtCliRequest {
1883 type Owned = Self;
1884
1885 #[inline(always)]
1886 fn inline_align(_context: fidl::encoding::Context) -> usize {
1887 4
1888 }
1889
1890 #[inline(always)]
1891 fn inline_size(_context: fidl::encoding::Context) -> usize {
1892 4
1893 }
1894 }
1895
1896 unsafe impl
1897 fidl::encoding::Encode<
1898 FactoryDeviceSetupOtCliRequest,
1899 fidl::encoding::DefaultFuchsiaResourceDialect,
1900 > for &mut FactoryDeviceSetupOtCliRequest
1901 {
1902 #[inline]
1903 unsafe fn encode(
1904 self,
1905 encoder: &mut fidl::encoding::Encoder<
1906 '_,
1907 fidl::encoding::DefaultFuchsiaResourceDialect,
1908 >,
1909 offset: usize,
1910 _depth: fidl::encoding::Depth,
1911 ) -> fidl::Result<()> {
1912 encoder.debug_check_bounds::<FactoryDeviceSetupOtCliRequest>(offset);
1913 fidl::encoding::Encode::<
1915 FactoryDeviceSetupOtCliRequest,
1916 fidl::encoding::DefaultFuchsiaResourceDialect,
1917 >::encode(
1918 (<fidl::encoding::HandleType<
1919 fidl::Socket,
1920 { fidl::ObjectType::SOCKET.into_raw() },
1921 16396,
1922 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1923 &mut self.server_socket
1924 ),),
1925 encoder,
1926 offset,
1927 _depth,
1928 )
1929 }
1930 }
1931 unsafe impl<
1932 T0: fidl::encoding::Encode<
1933 fidl::encoding::HandleType<
1934 fidl::Socket,
1935 { fidl::ObjectType::SOCKET.into_raw() },
1936 16396,
1937 >,
1938 fidl::encoding::DefaultFuchsiaResourceDialect,
1939 >,
1940 >
1941 fidl::encoding::Encode<
1942 FactoryDeviceSetupOtCliRequest,
1943 fidl::encoding::DefaultFuchsiaResourceDialect,
1944 > for (T0,)
1945 {
1946 #[inline]
1947 unsafe fn encode(
1948 self,
1949 encoder: &mut fidl::encoding::Encoder<
1950 '_,
1951 fidl::encoding::DefaultFuchsiaResourceDialect,
1952 >,
1953 offset: usize,
1954 depth: fidl::encoding::Depth,
1955 ) -> fidl::Result<()> {
1956 encoder.debug_check_bounds::<FactoryDeviceSetupOtCliRequest>(offset);
1957 self.0.encode(encoder, offset + 0, depth)?;
1961 Ok(())
1962 }
1963 }
1964
1965 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1966 for FactoryDeviceSetupOtCliRequest
1967 {
1968 #[inline(always)]
1969 fn new_empty() -> Self {
1970 Self {
1971 server_socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16396>, fidl::encoding::DefaultFuchsiaResourceDialect),
1972 }
1973 }
1974
1975 #[inline]
1976 unsafe fn decode(
1977 &mut self,
1978 decoder: &mut fidl::encoding::Decoder<
1979 '_,
1980 fidl::encoding::DefaultFuchsiaResourceDialect,
1981 >,
1982 offset: usize,
1983 _depth: fidl::encoding::Depth,
1984 ) -> fidl::Result<()> {
1985 decoder.debug_check_bounds::<Self>(offset);
1986 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16396>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_socket, decoder, offset + 0, _depth)?;
1988 Ok(())
1989 }
1990 }
1991
1992 impl fidl::encoding::ResourceTypeMarker for FactoryDriverGetFactoryDeviceRequest {
1993 type Borrowed<'a> = &'a mut Self;
1994 fn take_or_borrow<'a>(
1995 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1996 ) -> Self::Borrowed<'a> {
1997 value
1998 }
1999 }
2000
2001 unsafe impl fidl::encoding::TypeMarker for FactoryDriverGetFactoryDeviceRequest {
2002 type Owned = Self;
2003
2004 #[inline(always)]
2005 fn inline_align(_context: fidl::encoding::Context) -> usize {
2006 4
2007 }
2008
2009 #[inline(always)]
2010 fn inline_size(_context: fidl::encoding::Context) -> usize {
2011 4
2012 }
2013 }
2014
2015 unsafe impl
2016 fidl::encoding::Encode<
2017 FactoryDriverGetFactoryDeviceRequest,
2018 fidl::encoding::DefaultFuchsiaResourceDialect,
2019 > for &mut FactoryDriverGetFactoryDeviceRequest
2020 {
2021 #[inline]
2022 unsafe fn encode(
2023 self,
2024 encoder: &mut fidl::encoding::Encoder<
2025 '_,
2026 fidl::encoding::DefaultFuchsiaResourceDialect,
2027 >,
2028 offset: usize,
2029 _depth: fidl::encoding::Depth,
2030 ) -> fidl::Result<()> {
2031 encoder.debug_check_bounds::<FactoryDriverGetFactoryDeviceRequest>(offset);
2032 fidl::encoding::Encode::<FactoryDriverGetFactoryDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2034 (
2035 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_factory),
2036 ),
2037 encoder, offset, _depth
2038 )
2039 }
2040 }
2041 unsafe impl<
2042 T0: fidl::encoding::Encode<
2043 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2044 fidl::encoding::DefaultFuchsiaResourceDialect,
2045 >,
2046 >
2047 fidl::encoding::Encode<
2048 FactoryDriverGetFactoryDeviceRequest,
2049 fidl::encoding::DefaultFuchsiaResourceDialect,
2050 > for (T0,)
2051 {
2052 #[inline]
2053 unsafe fn encode(
2054 self,
2055 encoder: &mut fidl::encoding::Encoder<
2056 '_,
2057 fidl::encoding::DefaultFuchsiaResourceDialect,
2058 >,
2059 offset: usize,
2060 depth: fidl::encoding::Depth,
2061 ) -> fidl::Result<()> {
2062 encoder.debug_check_bounds::<FactoryDriverGetFactoryDeviceRequest>(offset);
2063 self.0.encode(encoder, offset + 0, depth)?;
2067 Ok(())
2068 }
2069 }
2070
2071 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2072 for FactoryDriverGetFactoryDeviceRequest
2073 {
2074 #[inline(always)]
2075 fn new_empty() -> Self {
2076 Self {
2077 device_factory: fidl::new_empty!(
2078 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2079 fidl::encoding::DefaultFuchsiaResourceDialect
2080 ),
2081 }
2082 }
2083
2084 #[inline]
2085 unsafe fn decode(
2086 &mut self,
2087 decoder: &mut fidl::encoding::Decoder<
2088 '_,
2089 fidl::encoding::DefaultFuchsiaResourceDialect,
2090 >,
2091 offset: usize,
2092 _depth: fidl::encoding::Depth,
2093 ) -> fidl::Result<()> {
2094 decoder.debug_check_bounds::<Self>(offset);
2095 fidl::decode!(
2097 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2098 fidl::encoding::DefaultFuchsiaResourceDialect,
2099 &mut self.device_factory,
2100 decoder,
2101 offset + 0,
2102 _depth
2103 )?;
2104 Ok(())
2105 }
2106 }
2107
2108 impl fidl::encoding::ResourceTypeMarker for FactoryLookupLookupRequest {
2109 type Borrowed<'a> = &'a mut Self;
2110 fn take_or_borrow<'a>(
2111 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2112 ) -> Self::Borrowed<'a> {
2113 value
2114 }
2115 }
2116
2117 unsafe impl fidl::encoding::TypeMarker for FactoryLookupLookupRequest {
2118 type Owned = Self;
2119
2120 #[inline(always)]
2121 fn inline_align(_context: fidl::encoding::Context) -> usize {
2122 8
2123 }
2124
2125 #[inline(always)]
2126 fn inline_size(_context: fidl::encoding::Context) -> usize {
2127 24
2128 }
2129 }
2130
2131 unsafe impl
2132 fidl::encoding::Encode<
2133 FactoryLookupLookupRequest,
2134 fidl::encoding::DefaultFuchsiaResourceDialect,
2135 > for &mut FactoryLookupLookupRequest
2136 {
2137 #[inline]
2138 unsafe fn encode(
2139 self,
2140 encoder: &mut fidl::encoding::Encoder<
2141 '_,
2142 fidl::encoding::DefaultFuchsiaResourceDialect,
2143 >,
2144 offset: usize,
2145 _depth: fidl::encoding::Depth,
2146 ) -> fidl::Result<()> {
2147 encoder.debug_check_bounds::<FactoryLookupLookupRequest>(offset);
2148 fidl::encoding::Encode::<FactoryLookupLookupRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2150 (
2151 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2152 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_factory),
2153 ),
2154 encoder, offset, _depth
2155 )
2156 }
2157 }
2158 unsafe impl<
2159 T0: fidl::encoding::Encode<
2160 fidl::encoding::BoundedString<32>,
2161 fidl::encoding::DefaultFuchsiaResourceDialect,
2162 >,
2163 T1: fidl::encoding::Encode<
2164 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2165 fidl::encoding::DefaultFuchsiaResourceDialect,
2166 >,
2167 >
2168 fidl::encoding::Encode<
2169 FactoryLookupLookupRequest,
2170 fidl::encoding::DefaultFuchsiaResourceDialect,
2171 > for (T0, T1)
2172 {
2173 #[inline]
2174 unsafe fn encode(
2175 self,
2176 encoder: &mut fidl::encoding::Encoder<
2177 '_,
2178 fidl::encoding::DefaultFuchsiaResourceDialect,
2179 >,
2180 offset: usize,
2181 depth: fidl::encoding::Depth,
2182 ) -> fidl::Result<()> {
2183 encoder.debug_check_bounds::<FactoryLookupLookupRequest>(offset);
2184 unsafe {
2187 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2188 (ptr as *mut u64).write_unaligned(0);
2189 }
2190 self.0.encode(encoder, offset + 0, depth)?;
2192 self.1.encode(encoder, offset + 16, depth)?;
2193 Ok(())
2194 }
2195 }
2196
2197 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2198 for FactoryLookupLookupRequest
2199 {
2200 #[inline(always)]
2201 fn new_empty() -> Self {
2202 Self {
2203 name: fidl::new_empty!(
2204 fidl::encoding::BoundedString<32>,
2205 fidl::encoding::DefaultFuchsiaResourceDialect
2206 ),
2207 device_factory: fidl::new_empty!(
2208 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2209 fidl::encoding::DefaultFuchsiaResourceDialect
2210 ),
2211 }
2212 }
2213
2214 #[inline]
2215 unsafe fn decode(
2216 &mut self,
2217 decoder: &mut fidl::encoding::Decoder<
2218 '_,
2219 fidl::encoding::DefaultFuchsiaResourceDialect,
2220 >,
2221 offset: usize,
2222 _depth: fidl::encoding::Depth,
2223 ) -> fidl::Result<()> {
2224 decoder.debug_check_bounds::<Self>(offset);
2225 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2227 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2228 let mask = 0xffffffff00000000u64;
2229 let maskedval = padval & mask;
2230 if maskedval != 0 {
2231 return Err(fidl::Error::NonZeroPadding {
2232 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2233 });
2234 }
2235 fidl::decode!(
2236 fidl::encoding::BoundedString<32>,
2237 fidl::encoding::DefaultFuchsiaResourceDialect,
2238 &mut self.name,
2239 decoder,
2240 offset + 0,
2241 _depth
2242 )?;
2243 fidl::decode!(
2244 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FactoryDeviceMarker>>,
2245 fidl::encoding::DefaultFuchsiaResourceDialect,
2246 &mut self.device_factory,
2247 decoder,
2248 offset + 16,
2249 _depth
2250 )?;
2251 Ok(())
2252 }
2253 }
2254
2255 impl fidl::encoding::ResourceTypeMarker for FactoryRegisterRegisterRequest {
2256 type Borrowed<'a> = &'a mut Self;
2257 fn take_or_borrow<'a>(
2258 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2259 ) -> Self::Borrowed<'a> {
2260 value
2261 }
2262 }
2263
2264 unsafe impl fidl::encoding::TypeMarker for FactoryRegisterRegisterRequest {
2265 type Owned = Self;
2266
2267 #[inline(always)]
2268 fn inline_align(_context: fidl::encoding::Context) -> usize {
2269 8
2270 }
2271
2272 #[inline(always)]
2273 fn inline_size(_context: fidl::encoding::Context) -> usize {
2274 24
2275 }
2276 }
2277
2278 unsafe impl
2279 fidl::encoding::Encode<
2280 FactoryRegisterRegisterRequest,
2281 fidl::encoding::DefaultFuchsiaResourceDialect,
2282 > for &mut FactoryRegisterRegisterRequest
2283 {
2284 #[inline]
2285 unsafe fn encode(
2286 self,
2287 encoder: &mut fidl::encoding::Encoder<
2288 '_,
2289 fidl::encoding::DefaultFuchsiaResourceDialect,
2290 >,
2291 offset: usize,
2292 _depth: fidl::encoding::Depth,
2293 ) -> fidl::Result<()> {
2294 encoder.debug_check_bounds::<FactoryRegisterRegisterRequest>(offset);
2295 fidl::encoding::Encode::<FactoryRegisterRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2297 (
2298 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2299 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.driver),
2300 ),
2301 encoder, offset, _depth
2302 )
2303 }
2304 }
2305 unsafe impl<
2306 T0: fidl::encoding::Encode<
2307 fidl::encoding::BoundedString<32>,
2308 fidl::encoding::DefaultFuchsiaResourceDialect,
2309 >,
2310 T1: fidl::encoding::Encode<
2311 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>>,
2312 fidl::encoding::DefaultFuchsiaResourceDialect,
2313 >,
2314 >
2315 fidl::encoding::Encode<
2316 FactoryRegisterRegisterRequest,
2317 fidl::encoding::DefaultFuchsiaResourceDialect,
2318 > for (T0, T1)
2319 {
2320 #[inline]
2321 unsafe fn encode(
2322 self,
2323 encoder: &mut fidl::encoding::Encoder<
2324 '_,
2325 fidl::encoding::DefaultFuchsiaResourceDialect,
2326 >,
2327 offset: usize,
2328 depth: fidl::encoding::Depth,
2329 ) -> fidl::Result<()> {
2330 encoder.debug_check_bounds::<FactoryRegisterRegisterRequest>(offset);
2331 unsafe {
2334 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2335 (ptr as *mut u64).write_unaligned(0);
2336 }
2337 self.0.encode(encoder, offset + 0, depth)?;
2339 self.1.encode(encoder, offset + 16, depth)?;
2340 Ok(())
2341 }
2342 }
2343
2344 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2345 for FactoryRegisterRegisterRequest
2346 {
2347 #[inline(always)]
2348 fn new_empty() -> Self {
2349 Self {
2350 name: fidl::new_empty!(
2351 fidl::encoding::BoundedString<32>,
2352 fidl::encoding::DefaultFuchsiaResourceDialect
2353 ),
2354 driver: fidl::new_empty!(
2355 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>>,
2356 fidl::encoding::DefaultFuchsiaResourceDialect
2357 ),
2358 }
2359 }
2360
2361 #[inline]
2362 unsafe fn decode(
2363 &mut self,
2364 decoder: &mut fidl::encoding::Decoder<
2365 '_,
2366 fidl::encoding::DefaultFuchsiaResourceDialect,
2367 >,
2368 offset: usize,
2369 _depth: fidl::encoding::Depth,
2370 ) -> fidl::Result<()> {
2371 decoder.debug_check_bounds::<Self>(offset);
2372 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2374 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2375 let mask = 0xffffffff00000000u64;
2376 let maskedval = padval & mask;
2377 if maskedval != 0 {
2378 return Err(fidl::Error::NonZeroPadding {
2379 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2380 });
2381 }
2382 fidl::decode!(
2383 fidl::encoding::BoundedString<32>,
2384 fidl::encoding::DefaultFuchsiaResourceDialect,
2385 &mut self.name,
2386 decoder,
2387 offset + 0,
2388 _depth
2389 )?;
2390 fidl::decode!(
2391 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FactoryDriverMarker>>,
2392 fidl::encoding::DefaultFuchsiaResourceDialect,
2393 &mut self.driver,
2394 decoder,
2395 offset + 16,
2396 _depth
2397 )?;
2398 Ok(())
2399 }
2400 }
2401}