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