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