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_lowpan_device_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CountersConnectorConnectRequest {
16 pub name: String,
17 pub server_end: fidl::endpoints::ServerEnd<CountersMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for CountersConnectorConnectRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct DeviceConnectorConnectRequest {
27 pub name: String,
28 pub server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for DeviceConnectorConnectRequest
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct DeviceExtraConnectorConnectRequest {
38 pub name: String,
39 pub server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for DeviceExtraConnectorConnectRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct EnergyScanConnectorConnectRequest {
49 pub name: String,
50 pub server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for EnergyScanConnectorConnectRequest
55{
56}
57
58#[derive(Debug, PartialEq)]
59pub struct EnergyScanStartEnergyScanRequest {
60 pub params: EnergyScanParameters,
61 pub stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65 for EnergyScanStartEnergyScanRequest
66{
67}
68
69#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
70pub struct CountersMarker;
71
72impl fidl::endpoints::ProtocolMarker for CountersMarker {
73 type Proxy = CountersProxy;
74 type RequestStream = CountersRequestStream;
75 #[cfg(target_os = "fuchsia")]
76 type SynchronousProxy = CountersSynchronousProxy;
77
78 const DEBUG_NAME: &'static str = "(anonymous) Counters";
79}
80
81pub trait CountersProxyInterface: Send + Sync {
82 type GetResponseFut: std::future::Future<Output = Result<AllCounters, fidl::Error>> + Send;
83 fn r#get(&self) -> Self::GetResponseFut;
84 type ResetResponseFut: std::future::Future<Output = Result<AllCounters, fidl::Error>> + Send;
85 fn r#reset(&self) -> Self::ResetResponseFut;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct CountersSynchronousProxy {
90 client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for CountersSynchronousProxy {
95 type Proxy = CountersProxy;
96 type Protocol = CountersMarker;
97
98 fn from_channel(inner: fidl::Channel) -> Self {
99 Self::new(inner)
100 }
101
102 fn into_channel(self) -> fidl::Channel {
103 self.client.into_channel()
104 }
105
106 fn as_channel(&self) -> &fidl::Channel {
107 self.client.as_channel()
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl CountersSynchronousProxy {
113 pub fn new(channel: fidl::Channel) -> Self {
114 Self { client: fidl::client::sync::Client::new(channel) }
115 }
116
117 pub fn into_channel(self) -> fidl::Channel {
118 self.client.into_channel()
119 }
120
121 pub fn wait_for_event(
124 &self,
125 deadline: zx::MonotonicInstant,
126 ) -> Result<CountersEvent, fidl::Error> {
127 CountersEvent::decode(self.client.wait_for_event::<CountersMarker>(deadline)?)
128 }
129
130 pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<AllCounters, fidl::Error> {
132 let _response = self
133 .client
134 .send_query::<fidl::encoding::EmptyPayload, CountersGetResponse, CountersMarker>(
135 (),
136 0xaa28d44c1535a24,
137 fidl::encoding::DynamicFlags::empty(),
138 ___deadline,
139 )?;
140 Ok(_response.counters)
141 }
142
143 pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<AllCounters, fidl::Error> {
146 let _response = self
147 .client
148 .send_query::<fidl::encoding::EmptyPayload, CountersResetResponse, CountersMarker>(
149 (),
150 0x4cf9a102017cf7ad,
151 fidl::encoding::DynamicFlags::empty(),
152 ___deadline,
153 )?;
154 Ok(_response.counters)
155 }
156}
157
158#[cfg(target_os = "fuchsia")]
159impl From<CountersSynchronousProxy> for zx::NullableHandle {
160 fn from(value: CountersSynchronousProxy) -> Self {
161 value.into_channel().into()
162 }
163}
164
165#[cfg(target_os = "fuchsia")]
166impl From<fidl::Channel> for CountersSynchronousProxy {
167 fn from(value: fidl::Channel) -> Self {
168 Self::new(value)
169 }
170}
171
172#[cfg(target_os = "fuchsia")]
173impl fidl::endpoints::FromClient for CountersSynchronousProxy {
174 type Protocol = CountersMarker;
175
176 fn from_client(value: fidl::endpoints::ClientEnd<CountersMarker>) -> Self {
177 Self::new(value.into_channel())
178 }
179}
180
181#[derive(Debug, Clone)]
182pub struct CountersProxy {
183 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
184}
185
186impl fidl::endpoints::Proxy for CountersProxy {
187 type Protocol = CountersMarker;
188
189 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
190 Self::new(inner)
191 }
192
193 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
194 self.client.into_channel().map_err(|client| Self { client })
195 }
196
197 fn as_channel(&self) -> &::fidl::AsyncChannel {
198 self.client.as_channel()
199 }
200}
201
202impl CountersProxy {
203 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
205 let protocol_name = <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
206 Self { client: fidl::client::Client::new(channel, protocol_name) }
207 }
208
209 pub fn take_event_stream(&self) -> CountersEventStream {
215 CountersEventStream { event_receiver: self.client.take_event_receiver() }
216 }
217
218 pub fn r#get(
220 &self,
221 ) -> fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>
222 {
223 CountersProxyInterface::r#get(self)
224 }
225
226 pub fn r#reset(
229 &self,
230 ) -> fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>
231 {
232 CountersProxyInterface::r#reset(self)
233 }
234}
235
236impl CountersProxyInterface for CountersProxy {
237 type GetResponseFut =
238 fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>;
239 fn r#get(&self) -> Self::GetResponseFut {
240 fn _decode(
241 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
242 ) -> Result<AllCounters, fidl::Error> {
243 let _response = fidl::client::decode_transaction_body::<
244 CountersGetResponse,
245 fidl::encoding::DefaultFuchsiaResourceDialect,
246 0xaa28d44c1535a24,
247 >(_buf?)?;
248 Ok(_response.counters)
249 }
250 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AllCounters>(
251 (),
252 0xaa28d44c1535a24,
253 fidl::encoding::DynamicFlags::empty(),
254 _decode,
255 )
256 }
257
258 type ResetResponseFut =
259 fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>;
260 fn r#reset(&self) -> Self::ResetResponseFut {
261 fn _decode(
262 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
263 ) -> Result<AllCounters, fidl::Error> {
264 let _response = fidl::client::decode_transaction_body::<
265 CountersResetResponse,
266 fidl::encoding::DefaultFuchsiaResourceDialect,
267 0x4cf9a102017cf7ad,
268 >(_buf?)?;
269 Ok(_response.counters)
270 }
271 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AllCounters>(
272 (),
273 0x4cf9a102017cf7ad,
274 fidl::encoding::DynamicFlags::empty(),
275 _decode,
276 )
277 }
278}
279
280pub struct CountersEventStream {
281 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
282}
283
284impl std::marker::Unpin for CountersEventStream {}
285
286impl futures::stream::FusedStream for CountersEventStream {
287 fn is_terminated(&self) -> bool {
288 self.event_receiver.is_terminated()
289 }
290}
291
292impl futures::Stream for CountersEventStream {
293 type Item = Result<CountersEvent, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
300 &mut self.event_receiver,
301 cx
302 )?) {
303 Some(buf) => std::task::Poll::Ready(Some(CountersEvent::decode(buf))),
304 None => std::task::Poll::Ready(None),
305 }
306 }
307}
308
309#[derive(Debug)]
310pub enum CountersEvent {}
311
312impl CountersEvent {
313 fn decode(
315 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
316 ) -> Result<CountersEvent, fidl::Error> {
317 let (bytes, _handles) = buf.split_mut();
318 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
319 debug_assert_eq!(tx_header.tx_id, 0);
320 match tx_header.ordinal {
321 _ => Err(fidl::Error::UnknownOrdinal {
322 ordinal: tx_header.ordinal,
323 protocol_name: <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
324 }),
325 }
326 }
327}
328
329pub struct CountersRequestStream {
331 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
332 is_terminated: bool,
333}
334
335impl std::marker::Unpin for CountersRequestStream {}
336
337impl futures::stream::FusedStream for CountersRequestStream {
338 fn is_terminated(&self) -> bool {
339 self.is_terminated
340 }
341}
342
343impl fidl::endpoints::RequestStream for CountersRequestStream {
344 type Protocol = CountersMarker;
345 type ControlHandle = CountersControlHandle;
346
347 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
348 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
349 }
350
351 fn control_handle(&self) -> Self::ControlHandle {
352 CountersControlHandle { inner: self.inner.clone() }
353 }
354
355 fn into_inner(
356 self,
357 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
358 {
359 (self.inner, self.is_terminated)
360 }
361
362 fn from_inner(
363 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
364 is_terminated: bool,
365 ) -> Self {
366 Self { inner, is_terminated }
367 }
368}
369
370impl futures::Stream for CountersRequestStream {
371 type Item = Result<CountersRequest, fidl::Error>;
372
373 fn poll_next(
374 mut self: std::pin::Pin<&mut Self>,
375 cx: &mut std::task::Context<'_>,
376 ) -> std::task::Poll<Option<Self::Item>> {
377 let this = &mut *self;
378 if this.inner.check_shutdown(cx) {
379 this.is_terminated = true;
380 return std::task::Poll::Ready(None);
381 }
382 if this.is_terminated {
383 panic!("polled CountersRequestStream after completion");
384 }
385 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
386 |bytes, handles| {
387 match this.inner.channel().read_etc(cx, bytes, handles) {
388 std::task::Poll::Ready(Ok(())) => {}
389 std::task::Poll::Pending => return std::task::Poll::Pending,
390 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
391 this.is_terminated = true;
392 return std::task::Poll::Ready(None);
393 }
394 std::task::Poll::Ready(Err(e)) => {
395 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
396 e.into(),
397 ))));
398 }
399 }
400
401 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
403
404 std::task::Poll::Ready(Some(match header.ordinal {
405 0xaa28d44c1535a24 => {
406 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
407 let mut req = fidl::new_empty!(
408 fidl::encoding::EmptyPayload,
409 fidl::encoding::DefaultFuchsiaResourceDialect
410 );
411 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
412 let control_handle = CountersControlHandle { inner: this.inner.clone() };
413 Ok(CountersRequest::Get {
414 responder: CountersGetResponder {
415 control_handle: std::mem::ManuallyDrop::new(control_handle),
416 tx_id: header.tx_id,
417 },
418 })
419 }
420 0x4cf9a102017cf7ad => {
421 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
422 let mut req = fidl::new_empty!(
423 fidl::encoding::EmptyPayload,
424 fidl::encoding::DefaultFuchsiaResourceDialect
425 );
426 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
427 let control_handle = CountersControlHandle { inner: this.inner.clone() };
428 Ok(CountersRequest::Reset {
429 responder: CountersResetResponder {
430 control_handle: std::mem::ManuallyDrop::new(control_handle),
431 tx_id: header.tx_id,
432 },
433 })
434 }
435 _ => Err(fidl::Error::UnknownOrdinal {
436 ordinal: header.ordinal,
437 protocol_name:
438 <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
439 }),
440 }))
441 },
442 )
443 }
444}
445
446#[derive(Debug)]
447pub enum CountersRequest {
448 Get { responder: CountersGetResponder },
450 Reset { responder: CountersResetResponder },
453}
454
455impl CountersRequest {
456 #[allow(irrefutable_let_patterns)]
457 pub fn into_get(self) -> Option<(CountersGetResponder)> {
458 if let CountersRequest::Get { responder } = self { Some((responder)) } else { None }
459 }
460
461 #[allow(irrefutable_let_patterns)]
462 pub fn into_reset(self) -> Option<(CountersResetResponder)> {
463 if let CountersRequest::Reset { responder } = self { Some((responder)) } else { None }
464 }
465
466 pub fn method_name(&self) -> &'static str {
468 match *self {
469 CountersRequest::Get { .. } => "get",
470 CountersRequest::Reset { .. } => "reset",
471 }
472 }
473}
474
475#[derive(Debug, Clone)]
476pub struct CountersControlHandle {
477 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
478}
479
480impl CountersControlHandle {
481 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
482 self.inner.shutdown_with_epitaph(status.into())
483 }
484}
485
486impl fidl::endpoints::ControlHandle for CountersControlHandle {
487 fn shutdown(&self) {
488 self.inner.shutdown()
489 }
490
491 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
492 self.inner.shutdown_with_epitaph(status)
493 }
494
495 fn is_closed(&self) -> bool {
496 self.inner.channel().is_closed()
497 }
498 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
499 self.inner.channel().on_closed()
500 }
501
502 #[cfg(target_os = "fuchsia")]
503 fn signal_peer(
504 &self,
505 clear_mask: zx::Signals,
506 set_mask: zx::Signals,
507 ) -> Result<(), zx_status::Status> {
508 use fidl::Peered;
509 self.inner.channel().signal_peer(clear_mask, set_mask)
510 }
511}
512
513impl CountersControlHandle {}
514
515#[must_use = "FIDL methods require a response to be sent"]
516#[derive(Debug)]
517pub struct CountersGetResponder {
518 control_handle: std::mem::ManuallyDrop<CountersControlHandle>,
519 tx_id: u32,
520}
521
522impl std::ops::Drop for CountersGetResponder {
526 fn drop(&mut self) {
527 self.control_handle.shutdown();
528 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
530 }
531}
532
533impl fidl::endpoints::Responder for CountersGetResponder {
534 type ControlHandle = CountersControlHandle;
535
536 fn control_handle(&self) -> &CountersControlHandle {
537 &self.control_handle
538 }
539
540 fn drop_without_shutdown(mut self) {
541 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
543 std::mem::forget(self);
545 }
546}
547
548impl CountersGetResponder {
549 pub fn send(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
553 let _result = self.send_raw(counters);
554 if _result.is_err() {
555 self.control_handle.shutdown();
556 }
557 self.drop_without_shutdown();
558 _result
559 }
560
561 pub fn send_no_shutdown_on_err(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
563 let _result = self.send_raw(counters);
564 self.drop_without_shutdown();
565 _result
566 }
567
568 fn send_raw(&self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
569 self.control_handle.inner.send::<CountersGetResponse>(
570 (counters,),
571 self.tx_id,
572 0xaa28d44c1535a24,
573 fidl::encoding::DynamicFlags::empty(),
574 )
575 }
576}
577
578#[must_use = "FIDL methods require a response to be sent"]
579#[derive(Debug)]
580pub struct CountersResetResponder {
581 control_handle: std::mem::ManuallyDrop<CountersControlHandle>,
582 tx_id: u32,
583}
584
585impl std::ops::Drop for CountersResetResponder {
589 fn drop(&mut self) {
590 self.control_handle.shutdown();
591 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
593 }
594}
595
596impl fidl::endpoints::Responder for CountersResetResponder {
597 type ControlHandle = CountersControlHandle;
598
599 fn control_handle(&self) -> &CountersControlHandle {
600 &self.control_handle
601 }
602
603 fn drop_without_shutdown(mut self) {
604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
606 std::mem::forget(self);
608 }
609}
610
611impl CountersResetResponder {
612 pub fn send(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
616 let _result = self.send_raw(counters);
617 if _result.is_err() {
618 self.control_handle.shutdown();
619 }
620 self.drop_without_shutdown();
621 _result
622 }
623
624 pub fn send_no_shutdown_on_err(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
626 let _result = self.send_raw(counters);
627 self.drop_without_shutdown();
628 _result
629 }
630
631 fn send_raw(&self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
632 self.control_handle.inner.send::<CountersResetResponse>(
633 (counters,),
634 self.tx_id,
635 0x4cf9a102017cf7ad,
636 fidl::encoding::DynamicFlags::empty(),
637 )
638 }
639}
640
641#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
642pub struct CountersConnectorMarker;
643
644impl fidl::endpoints::ProtocolMarker for CountersConnectorMarker {
645 type Proxy = CountersConnectorProxy;
646 type RequestStream = CountersConnectorRequestStream;
647 #[cfg(target_os = "fuchsia")]
648 type SynchronousProxy = CountersConnectorSynchronousProxy;
649
650 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.CountersConnector";
651}
652impl fidl::endpoints::DiscoverableProtocolMarker for CountersConnectorMarker {}
653
654pub trait CountersConnectorProxyInterface: Send + Sync {
655 fn r#connect(
656 &self,
657 name: &str,
658 server_end: fidl::endpoints::ServerEnd<CountersMarker>,
659 ) -> Result<(), fidl::Error>;
660}
661#[derive(Debug)]
662#[cfg(target_os = "fuchsia")]
663pub struct CountersConnectorSynchronousProxy {
664 client: fidl::client::sync::Client,
665}
666
667#[cfg(target_os = "fuchsia")]
668impl fidl::endpoints::SynchronousProxy for CountersConnectorSynchronousProxy {
669 type Proxy = CountersConnectorProxy;
670 type Protocol = CountersConnectorMarker;
671
672 fn from_channel(inner: fidl::Channel) -> Self {
673 Self::new(inner)
674 }
675
676 fn into_channel(self) -> fidl::Channel {
677 self.client.into_channel()
678 }
679
680 fn as_channel(&self) -> &fidl::Channel {
681 self.client.as_channel()
682 }
683}
684
685#[cfg(target_os = "fuchsia")]
686impl CountersConnectorSynchronousProxy {
687 pub fn new(channel: fidl::Channel) -> Self {
688 Self { client: fidl::client::sync::Client::new(channel) }
689 }
690
691 pub fn into_channel(self) -> fidl::Channel {
692 self.client.into_channel()
693 }
694
695 pub fn wait_for_event(
698 &self,
699 deadline: zx::MonotonicInstant,
700 ) -> Result<CountersConnectorEvent, fidl::Error> {
701 CountersConnectorEvent::decode(
702 self.client.wait_for_event::<CountersConnectorMarker>(deadline)?,
703 )
704 }
705
706 pub fn r#connect(
723 &self,
724 mut name: &str,
725 mut server_end: fidl::endpoints::ServerEnd<CountersMarker>,
726 ) -> Result<(), fidl::Error> {
727 self.client.send::<CountersConnectorConnectRequest>(
728 (name, server_end),
729 0x61ec847f2702d188,
730 fidl::encoding::DynamicFlags::empty(),
731 )
732 }
733}
734
735#[cfg(target_os = "fuchsia")]
736impl From<CountersConnectorSynchronousProxy> for zx::NullableHandle {
737 fn from(value: CountersConnectorSynchronousProxy) -> Self {
738 value.into_channel().into()
739 }
740}
741
742#[cfg(target_os = "fuchsia")]
743impl From<fidl::Channel> for CountersConnectorSynchronousProxy {
744 fn from(value: fidl::Channel) -> Self {
745 Self::new(value)
746 }
747}
748
749#[cfg(target_os = "fuchsia")]
750impl fidl::endpoints::FromClient for CountersConnectorSynchronousProxy {
751 type Protocol = CountersConnectorMarker;
752
753 fn from_client(value: fidl::endpoints::ClientEnd<CountersConnectorMarker>) -> Self {
754 Self::new(value.into_channel())
755 }
756}
757
758#[derive(Debug, Clone)]
759pub struct CountersConnectorProxy {
760 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
761}
762
763impl fidl::endpoints::Proxy for CountersConnectorProxy {
764 type Protocol = CountersConnectorMarker;
765
766 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
767 Self::new(inner)
768 }
769
770 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
771 self.client.into_channel().map_err(|client| Self { client })
772 }
773
774 fn as_channel(&self) -> &::fidl::AsyncChannel {
775 self.client.as_channel()
776 }
777}
778
779impl CountersConnectorProxy {
780 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
782 let protocol_name =
783 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
784 Self { client: fidl::client::Client::new(channel, protocol_name) }
785 }
786
787 pub fn take_event_stream(&self) -> CountersConnectorEventStream {
793 CountersConnectorEventStream { event_receiver: self.client.take_event_receiver() }
794 }
795
796 pub fn r#connect(
813 &self,
814 mut name: &str,
815 mut server_end: fidl::endpoints::ServerEnd<CountersMarker>,
816 ) -> Result<(), fidl::Error> {
817 CountersConnectorProxyInterface::r#connect(self, name, server_end)
818 }
819}
820
821impl CountersConnectorProxyInterface for CountersConnectorProxy {
822 fn r#connect(
823 &self,
824 mut name: &str,
825 mut server_end: fidl::endpoints::ServerEnd<CountersMarker>,
826 ) -> Result<(), fidl::Error> {
827 self.client.send::<CountersConnectorConnectRequest>(
828 (name, server_end),
829 0x61ec847f2702d188,
830 fidl::encoding::DynamicFlags::empty(),
831 )
832 }
833}
834
835pub struct CountersConnectorEventStream {
836 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
837}
838
839impl std::marker::Unpin for CountersConnectorEventStream {}
840
841impl futures::stream::FusedStream for CountersConnectorEventStream {
842 fn is_terminated(&self) -> bool {
843 self.event_receiver.is_terminated()
844 }
845}
846
847impl futures::Stream for CountersConnectorEventStream {
848 type Item = Result<CountersConnectorEvent, fidl::Error>;
849
850 fn poll_next(
851 mut self: std::pin::Pin<&mut Self>,
852 cx: &mut std::task::Context<'_>,
853 ) -> std::task::Poll<Option<Self::Item>> {
854 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
855 &mut self.event_receiver,
856 cx
857 )?) {
858 Some(buf) => std::task::Poll::Ready(Some(CountersConnectorEvent::decode(buf))),
859 None => std::task::Poll::Ready(None),
860 }
861 }
862}
863
864#[derive(Debug)]
865pub enum CountersConnectorEvent {}
866
867impl CountersConnectorEvent {
868 fn decode(
870 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
871 ) -> Result<CountersConnectorEvent, fidl::Error> {
872 let (bytes, _handles) = buf.split_mut();
873 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
874 debug_assert_eq!(tx_header.tx_id, 0);
875 match tx_header.ordinal {
876 _ => Err(fidl::Error::UnknownOrdinal {
877 ordinal: tx_header.ordinal,
878 protocol_name:
879 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
880 }),
881 }
882 }
883}
884
885pub struct CountersConnectorRequestStream {
887 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
888 is_terminated: bool,
889}
890
891impl std::marker::Unpin for CountersConnectorRequestStream {}
892
893impl futures::stream::FusedStream for CountersConnectorRequestStream {
894 fn is_terminated(&self) -> bool {
895 self.is_terminated
896 }
897}
898
899impl fidl::endpoints::RequestStream for CountersConnectorRequestStream {
900 type Protocol = CountersConnectorMarker;
901 type ControlHandle = CountersConnectorControlHandle;
902
903 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
904 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
905 }
906
907 fn control_handle(&self) -> Self::ControlHandle {
908 CountersConnectorControlHandle { inner: self.inner.clone() }
909 }
910
911 fn into_inner(
912 self,
913 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
914 {
915 (self.inner, self.is_terminated)
916 }
917
918 fn from_inner(
919 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
920 is_terminated: bool,
921 ) -> Self {
922 Self { inner, is_terminated }
923 }
924}
925
926impl futures::Stream for CountersConnectorRequestStream {
927 type Item = Result<CountersConnectorRequest, fidl::Error>;
928
929 fn poll_next(
930 mut self: std::pin::Pin<&mut Self>,
931 cx: &mut std::task::Context<'_>,
932 ) -> std::task::Poll<Option<Self::Item>> {
933 let this = &mut *self;
934 if this.inner.check_shutdown(cx) {
935 this.is_terminated = true;
936 return std::task::Poll::Ready(None);
937 }
938 if this.is_terminated {
939 panic!("polled CountersConnectorRequestStream after completion");
940 }
941 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
942 |bytes, handles| {
943 match this.inner.channel().read_etc(cx, bytes, handles) {
944 std::task::Poll::Ready(Ok(())) => {}
945 std::task::Poll::Pending => return std::task::Poll::Pending,
946 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
947 this.is_terminated = true;
948 return std::task::Poll::Ready(None);
949 }
950 std::task::Poll::Ready(Err(e)) => {
951 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
952 e.into(),
953 ))));
954 }
955 }
956
957 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959
960 std::task::Poll::Ready(Some(match header.ordinal {
961 0x61ec847f2702d188 => {
962 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
963 let mut req = fidl::new_empty!(
964 CountersConnectorConnectRequest,
965 fidl::encoding::DefaultFuchsiaResourceDialect
966 );
967 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CountersConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
968 let control_handle =
969 CountersConnectorControlHandle { inner: this.inner.clone() };
970 Ok(CountersConnectorRequest::Connect {
971 name: req.name,
972 server_end: req.server_end,
973
974 control_handle,
975 })
976 }
977 _ => Err(fidl::Error::UnknownOrdinal {
978 ordinal: header.ordinal,
979 protocol_name:
980 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
981 }),
982 }))
983 },
984 )
985 }
986}
987
988#[derive(Debug)]
991pub enum CountersConnectorRequest {
992 Connect {
1009 name: String,
1010 server_end: fidl::endpoints::ServerEnd<CountersMarker>,
1011 control_handle: CountersConnectorControlHandle,
1012 },
1013}
1014
1015impl CountersConnectorRequest {
1016 #[allow(irrefutable_let_patterns)]
1017 pub fn into_connect(
1018 self,
1019 ) -> Option<(String, fidl::endpoints::ServerEnd<CountersMarker>, CountersConnectorControlHandle)>
1020 {
1021 if let CountersConnectorRequest::Connect { name, server_end, control_handle } = self {
1022 Some((name, server_end, control_handle))
1023 } else {
1024 None
1025 }
1026 }
1027
1028 pub fn method_name(&self) -> &'static str {
1030 match *self {
1031 CountersConnectorRequest::Connect { .. } => "connect",
1032 }
1033 }
1034}
1035
1036#[derive(Debug, Clone)]
1037pub struct CountersConnectorControlHandle {
1038 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1039}
1040
1041impl CountersConnectorControlHandle {
1042 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1043 self.inner.shutdown_with_epitaph(status.into())
1044 }
1045}
1046
1047impl fidl::endpoints::ControlHandle for CountersConnectorControlHandle {
1048 fn shutdown(&self) {
1049 self.inner.shutdown()
1050 }
1051
1052 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1053 self.inner.shutdown_with_epitaph(status)
1054 }
1055
1056 fn is_closed(&self) -> bool {
1057 self.inner.channel().is_closed()
1058 }
1059 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1060 self.inner.channel().on_closed()
1061 }
1062
1063 #[cfg(target_os = "fuchsia")]
1064 fn signal_peer(
1065 &self,
1066 clear_mask: zx::Signals,
1067 set_mask: zx::Signals,
1068 ) -> Result<(), zx_status::Status> {
1069 use fidl::Peered;
1070 self.inner.channel().signal_peer(clear_mask, set_mask)
1071 }
1072}
1073
1074impl CountersConnectorControlHandle {}
1075
1076#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1077pub struct DeviceMarker;
1078
1079impl fidl::endpoints::ProtocolMarker for DeviceMarker {
1080 type Proxy = DeviceProxy;
1081 type RequestStream = DeviceRequestStream;
1082 #[cfg(target_os = "fuchsia")]
1083 type SynchronousProxy = DeviceSynchronousProxy;
1084
1085 const DEBUG_NAME: &'static str = "(anonymous) Device";
1086}
1087
1088pub trait DeviceProxyInterface: Send + Sync {
1089 type ProvisionNetworkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1090 fn r#provision_network(&self, params: &ProvisioningParams)
1091 -> Self::ProvisionNetworkResponseFut;
1092 type LeaveNetworkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1093 fn r#leave_network(&self) -> Self::LeaveNetworkResponseFut;
1094 type SetActiveResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1095 fn r#set_active(&self, active: bool) -> Self::SetActiveResponseFut;
1096 type GetSupportedNetworkTypesResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
1097 + Send;
1098 fn r#get_supported_network_types(&self) -> Self::GetSupportedNetworkTypesResponseFut;
1099 type WatchDeviceStateResponseFut: std::future::Future<Output = Result<DeviceState, fidl::Error>>
1100 + Send;
1101 fn r#watch_device_state(&self) -> Self::WatchDeviceStateResponseFut;
1102}
1103#[derive(Debug)]
1104#[cfg(target_os = "fuchsia")]
1105pub struct DeviceSynchronousProxy {
1106 client: fidl::client::sync::Client,
1107}
1108
1109#[cfg(target_os = "fuchsia")]
1110impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
1111 type Proxy = DeviceProxy;
1112 type Protocol = DeviceMarker;
1113
1114 fn from_channel(inner: fidl::Channel) -> Self {
1115 Self::new(inner)
1116 }
1117
1118 fn into_channel(self) -> fidl::Channel {
1119 self.client.into_channel()
1120 }
1121
1122 fn as_channel(&self) -> &fidl::Channel {
1123 self.client.as_channel()
1124 }
1125}
1126
1127#[cfg(target_os = "fuchsia")]
1128impl DeviceSynchronousProxy {
1129 pub fn new(channel: fidl::Channel) -> Self {
1130 Self { client: fidl::client::sync::Client::new(channel) }
1131 }
1132
1133 pub fn into_channel(self) -> fidl::Channel {
1134 self.client.into_channel()
1135 }
1136
1137 pub fn wait_for_event(
1140 &self,
1141 deadline: zx::MonotonicInstant,
1142 ) -> Result<DeviceEvent, fidl::Error> {
1143 DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
1144 }
1145
1146 pub fn r#provision_network(
1173 &self,
1174 mut params: &ProvisioningParams,
1175 ___deadline: zx::MonotonicInstant,
1176 ) -> Result<(), fidl::Error> {
1177 let _response = self.client.send_query::<
1178 DeviceProvisionNetworkRequest,
1179 fidl::encoding::EmptyPayload,
1180 DeviceMarker,
1181 >(
1182 (params,),
1183 0x3501046988e17076,
1184 fidl::encoding::DynamicFlags::empty(),
1185 ___deadline,
1186 )?;
1187 Ok(_response)
1188 }
1189
1190 pub fn r#leave_network(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1208 let _response = self
1209 .client
1210 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, DeviceMarker>(
1211 (),
1212 0x66919e4f9752c53e,
1213 fidl::encoding::DynamicFlags::empty(),
1214 ___deadline,
1215 )?;
1216 Ok(_response)
1217 }
1218
1219 pub fn r#set_active(
1232 &self,
1233 mut active: bool,
1234 ___deadline: zx::MonotonicInstant,
1235 ) -> Result<(), fidl::Error> {
1236 let _response = self
1237 .client
1238 .send_query::<DeviceSetActiveRequest, fidl::encoding::EmptyPayload, DeviceMarker>(
1239 (active,),
1240 0x55a6837f8bbb344b,
1241 fidl::encoding::DynamicFlags::empty(),
1242 ___deadline,
1243 )?;
1244 Ok(_response)
1245 }
1246
1247 pub fn r#get_supported_network_types(
1253 &self,
1254 ___deadline: zx::MonotonicInstant,
1255 ) -> Result<Vec<String>, fidl::Error> {
1256 let _response = self.client.send_query::<
1257 fidl::encoding::EmptyPayload,
1258 DeviceGetSupportedNetworkTypesResponse,
1259 DeviceMarker,
1260 >(
1261 (),
1262 0x6d8f71a5beb15ebf,
1263 fidl::encoding::DynamicFlags::empty(),
1264 ___deadline,
1265 )?;
1266 Ok(_response.network_types)
1267 }
1268
1269 pub fn r#watch_device_state(
1279 &self,
1280 ___deadline: zx::MonotonicInstant,
1281 ) -> Result<DeviceState, fidl::Error> {
1282 let _response = self.client.send_query::<
1283 fidl::encoding::EmptyPayload,
1284 DeviceWatchDeviceStateResponse,
1285 DeviceMarker,
1286 >(
1287 (),
1288 0x593be5b83e80d249,
1289 fidl::encoding::DynamicFlags::empty(),
1290 ___deadline,
1291 )?;
1292 Ok(_response.device_combined_state)
1293 }
1294}
1295
1296#[cfg(target_os = "fuchsia")]
1297impl From<DeviceSynchronousProxy> for zx::NullableHandle {
1298 fn from(value: DeviceSynchronousProxy) -> Self {
1299 value.into_channel().into()
1300 }
1301}
1302
1303#[cfg(target_os = "fuchsia")]
1304impl From<fidl::Channel> for DeviceSynchronousProxy {
1305 fn from(value: fidl::Channel) -> Self {
1306 Self::new(value)
1307 }
1308}
1309
1310#[cfg(target_os = "fuchsia")]
1311impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
1312 type Protocol = DeviceMarker;
1313
1314 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
1315 Self::new(value.into_channel())
1316 }
1317}
1318
1319#[derive(Debug, Clone)]
1320pub struct DeviceProxy {
1321 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1322}
1323
1324impl fidl::endpoints::Proxy for DeviceProxy {
1325 type Protocol = DeviceMarker;
1326
1327 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1328 Self::new(inner)
1329 }
1330
1331 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1332 self.client.into_channel().map_err(|client| Self { client })
1333 }
1334
1335 fn as_channel(&self) -> &::fidl::AsyncChannel {
1336 self.client.as_channel()
1337 }
1338}
1339
1340impl DeviceProxy {
1341 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1343 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1344 Self { client: fidl::client::Client::new(channel, protocol_name) }
1345 }
1346
1347 pub fn take_event_stream(&self) -> DeviceEventStream {
1353 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1354 }
1355
1356 pub fn r#provision_network(
1383 &self,
1384 mut params: &ProvisioningParams,
1385 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1386 DeviceProxyInterface::r#provision_network(self, params)
1387 }
1388
1389 pub fn r#leave_network(
1407 &self,
1408 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1409 DeviceProxyInterface::r#leave_network(self)
1410 }
1411
1412 pub fn r#set_active(
1425 &self,
1426 mut active: bool,
1427 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1428 DeviceProxyInterface::r#set_active(self, active)
1429 }
1430
1431 pub fn r#get_supported_network_types(
1437 &self,
1438 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
1439 {
1440 DeviceProxyInterface::r#get_supported_network_types(self)
1441 }
1442
1443 pub fn r#watch_device_state(
1453 &self,
1454 ) -> fidl::client::QueryResponseFut<DeviceState, fidl::encoding::DefaultFuchsiaResourceDialect>
1455 {
1456 DeviceProxyInterface::r#watch_device_state(self)
1457 }
1458}
1459
1460impl DeviceProxyInterface for DeviceProxy {
1461 type ProvisionNetworkResponseFut =
1462 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1463 fn r#provision_network(
1464 &self,
1465 mut params: &ProvisioningParams,
1466 ) -> Self::ProvisionNetworkResponseFut {
1467 fn _decode(
1468 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1469 ) -> Result<(), fidl::Error> {
1470 let _response = fidl::client::decode_transaction_body::<
1471 fidl::encoding::EmptyPayload,
1472 fidl::encoding::DefaultFuchsiaResourceDialect,
1473 0x3501046988e17076,
1474 >(_buf?)?;
1475 Ok(_response)
1476 }
1477 self.client.send_query_and_decode::<DeviceProvisionNetworkRequest, ()>(
1478 (params,),
1479 0x3501046988e17076,
1480 fidl::encoding::DynamicFlags::empty(),
1481 _decode,
1482 )
1483 }
1484
1485 type LeaveNetworkResponseFut =
1486 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1487 fn r#leave_network(&self) -> Self::LeaveNetworkResponseFut {
1488 fn _decode(
1489 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1490 ) -> Result<(), fidl::Error> {
1491 let _response = fidl::client::decode_transaction_body::<
1492 fidl::encoding::EmptyPayload,
1493 fidl::encoding::DefaultFuchsiaResourceDialect,
1494 0x66919e4f9752c53e,
1495 >(_buf?)?;
1496 Ok(_response)
1497 }
1498 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1499 (),
1500 0x66919e4f9752c53e,
1501 fidl::encoding::DynamicFlags::empty(),
1502 _decode,
1503 )
1504 }
1505
1506 type SetActiveResponseFut =
1507 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1508 fn r#set_active(&self, mut active: bool) -> Self::SetActiveResponseFut {
1509 fn _decode(
1510 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1511 ) -> Result<(), fidl::Error> {
1512 let _response = fidl::client::decode_transaction_body::<
1513 fidl::encoding::EmptyPayload,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 0x55a6837f8bbb344b,
1516 >(_buf?)?;
1517 Ok(_response)
1518 }
1519 self.client.send_query_and_decode::<DeviceSetActiveRequest, ()>(
1520 (active,),
1521 0x55a6837f8bbb344b,
1522 fidl::encoding::DynamicFlags::empty(),
1523 _decode,
1524 )
1525 }
1526
1527 type GetSupportedNetworkTypesResponseFut =
1528 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1529 fn r#get_supported_network_types(&self) -> Self::GetSupportedNetworkTypesResponseFut {
1530 fn _decode(
1531 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1532 ) -> Result<Vec<String>, fidl::Error> {
1533 let _response = fidl::client::decode_transaction_body::<
1534 DeviceGetSupportedNetworkTypesResponse,
1535 fidl::encoding::DefaultFuchsiaResourceDialect,
1536 0x6d8f71a5beb15ebf,
1537 >(_buf?)?;
1538 Ok(_response.network_types)
1539 }
1540 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
1541 (),
1542 0x6d8f71a5beb15ebf,
1543 fidl::encoding::DynamicFlags::empty(),
1544 _decode,
1545 )
1546 }
1547
1548 type WatchDeviceStateResponseFut =
1549 fidl::client::QueryResponseFut<DeviceState, fidl::encoding::DefaultFuchsiaResourceDialect>;
1550 fn r#watch_device_state(&self) -> Self::WatchDeviceStateResponseFut {
1551 fn _decode(
1552 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1553 ) -> Result<DeviceState, fidl::Error> {
1554 let _response = fidl::client::decode_transaction_body::<
1555 DeviceWatchDeviceStateResponse,
1556 fidl::encoding::DefaultFuchsiaResourceDialect,
1557 0x593be5b83e80d249,
1558 >(_buf?)?;
1559 Ok(_response.device_combined_state)
1560 }
1561 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceState>(
1562 (),
1563 0x593be5b83e80d249,
1564 fidl::encoding::DynamicFlags::empty(),
1565 _decode,
1566 )
1567 }
1568}
1569
1570pub struct DeviceEventStream {
1571 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1572}
1573
1574impl std::marker::Unpin for DeviceEventStream {}
1575
1576impl futures::stream::FusedStream for DeviceEventStream {
1577 fn is_terminated(&self) -> bool {
1578 self.event_receiver.is_terminated()
1579 }
1580}
1581
1582impl futures::Stream for DeviceEventStream {
1583 type Item = Result<DeviceEvent, fidl::Error>;
1584
1585 fn poll_next(
1586 mut self: std::pin::Pin<&mut Self>,
1587 cx: &mut std::task::Context<'_>,
1588 ) -> std::task::Poll<Option<Self::Item>> {
1589 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1590 &mut self.event_receiver,
1591 cx
1592 )?) {
1593 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1594 None => std::task::Poll::Ready(None),
1595 }
1596 }
1597}
1598
1599#[derive(Debug)]
1600pub enum DeviceEvent {}
1601
1602impl DeviceEvent {
1603 fn decode(
1605 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1606 ) -> Result<DeviceEvent, fidl::Error> {
1607 let (bytes, _handles) = buf.split_mut();
1608 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1609 debug_assert_eq!(tx_header.tx_id, 0);
1610 match tx_header.ordinal {
1611 _ => Err(fidl::Error::UnknownOrdinal {
1612 ordinal: tx_header.ordinal,
1613 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1614 }),
1615 }
1616 }
1617}
1618
1619pub struct DeviceRequestStream {
1621 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1622 is_terminated: bool,
1623}
1624
1625impl std::marker::Unpin for DeviceRequestStream {}
1626
1627impl futures::stream::FusedStream for DeviceRequestStream {
1628 fn is_terminated(&self) -> bool {
1629 self.is_terminated
1630 }
1631}
1632
1633impl fidl::endpoints::RequestStream for DeviceRequestStream {
1634 type Protocol = DeviceMarker;
1635 type ControlHandle = DeviceControlHandle;
1636
1637 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1638 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1639 }
1640
1641 fn control_handle(&self) -> Self::ControlHandle {
1642 DeviceControlHandle { inner: self.inner.clone() }
1643 }
1644
1645 fn into_inner(
1646 self,
1647 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1648 {
1649 (self.inner, self.is_terminated)
1650 }
1651
1652 fn from_inner(
1653 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1654 is_terminated: bool,
1655 ) -> Self {
1656 Self { inner, is_terminated }
1657 }
1658}
1659
1660impl futures::Stream for DeviceRequestStream {
1661 type Item = Result<DeviceRequest, fidl::Error>;
1662
1663 fn poll_next(
1664 mut self: std::pin::Pin<&mut Self>,
1665 cx: &mut std::task::Context<'_>,
1666 ) -> std::task::Poll<Option<Self::Item>> {
1667 let this = &mut *self;
1668 if this.inner.check_shutdown(cx) {
1669 this.is_terminated = true;
1670 return std::task::Poll::Ready(None);
1671 }
1672 if this.is_terminated {
1673 panic!("polled DeviceRequestStream after completion");
1674 }
1675 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1676 |bytes, handles| {
1677 match this.inner.channel().read_etc(cx, bytes, handles) {
1678 std::task::Poll::Ready(Ok(())) => {}
1679 std::task::Poll::Pending => return std::task::Poll::Pending,
1680 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1681 this.is_terminated = true;
1682 return std::task::Poll::Ready(None);
1683 }
1684 std::task::Poll::Ready(Err(e)) => {
1685 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1686 e.into(),
1687 ))));
1688 }
1689 }
1690
1691 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1693
1694 std::task::Poll::Ready(Some(match header.ordinal {
1695 0x3501046988e17076 => {
1696 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1697 let mut req = fidl::new_empty!(
1698 DeviceProvisionNetworkRequest,
1699 fidl::encoding::DefaultFuchsiaResourceDialect
1700 );
1701 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProvisionNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
1702 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1703 Ok(DeviceRequest::ProvisionNetwork {
1704 params: req.params,
1705
1706 responder: DeviceProvisionNetworkResponder {
1707 control_handle: std::mem::ManuallyDrop::new(control_handle),
1708 tx_id: header.tx_id,
1709 },
1710 })
1711 }
1712 0x66919e4f9752c53e => {
1713 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1714 let mut req = fidl::new_empty!(
1715 fidl::encoding::EmptyPayload,
1716 fidl::encoding::DefaultFuchsiaResourceDialect
1717 );
1718 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1719 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1720 Ok(DeviceRequest::LeaveNetwork {
1721 responder: DeviceLeaveNetworkResponder {
1722 control_handle: std::mem::ManuallyDrop::new(control_handle),
1723 tx_id: header.tx_id,
1724 },
1725 })
1726 }
1727 0x55a6837f8bbb344b => {
1728 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1729 let mut req = fidl::new_empty!(
1730 DeviceSetActiveRequest,
1731 fidl::encoding::DefaultFuchsiaResourceDialect
1732 );
1733 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetActiveRequest>(&header, _body_bytes, handles, &mut req)?;
1734 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1735 Ok(DeviceRequest::SetActive {
1736 active: req.active,
1737
1738 responder: DeviceSetActiveResponder {
1739 control_handle: std::mem::ManuallyDrop::new(control_handle),
1740 tx_id: header.tx_id,
1741 },
1742 })
1743 }
1744 0x6d8f71a5beb15ebf => {
1745 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1746 let mut req = fidl::new_empty!(
1747 fidl::encoding::EmptyPayload,
1748 fidl::encoding::DefaultFuchsiaResourceDialect
1749 );
1750 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1751 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1752 Ok(DeviceRequest::GetSupportedNetworkTypes {
1753 responder: DeviceGetSupportedNetworkTypesResponder {
1754 control_handle: std::mem::ManuallyDrop::new(control_handle),
1755 tx_id: header.tx_id,
1756 },
1757 })
1758 }
1759 0x593be5b83e80d249 => {
1760 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1761 let mut req = fidl::new_empty!(
1762 fidl::encoding::EmptyPayload,
1763 fidl::encoding::DefaultFuchsiaResourceDialect
1764 );
1765 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1766 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1767 Ok(DeviceRequest::WatchDeviceState {
1768 responder: DeviceWatchDeviceStateResponder {
1769 control_handle: std::mem::ManuallyDrop::new(control_handle),
1770 tx_id: header.tx_id,
1771 },
1772 })
1773 }
1774 _ => Err(fidl::Error::UnknownOrdinal {
1775 ordinal: header.ordinal,
1776 protocol_name:
1777 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1778 }),
1779 }))
1780 },
1781 )
1782 }
1783}
1784
1785#[derive(Debug)]
1793pub enum DeviceRequest {
1794 ProvisionNetwork { params: ProvisioningParams, responder: DeviceProvisionNetworkResponder },
1821 LeaveNetwork { responder: DeviceLeaveNetworkResponder },
1839 SetActive { active: bool, responder: DeviceSetActiveResponder },
1852 GetSupportedNetworkTypes { responder: DeviceGetSupportedNetworkTypesResponder },
1858 WatchDeviceState { responder: DeviceWatchDeviceStateResponder },
1868}
1869
1870impl DeviceRequest {
1871 #[allow(irrefutable_let_patterns)]
1872 pub fn into_provision_network(
1873 self,
1874 ) -> Option<(ProvisioningParams, DeviceProvisionNetworkResponder)> {
1875 if let DeviceRequest::ProvisionNetwork { params, responder } = self {
1876 Some((params, responder))
1877 } else {
1878 None
1879 }
1880 }
1881
1882 #[allow(irrefutable_let_patterns)]
1883 pub fn into_leave_network(self) -> Option<(DeviceLeaveNetworkResponder)> {
1884 if let DeviceRequest::LeaveNetwork { responder } = self { Some((responder)) } else { None }
1885 }
1886
1887 #[allow(irrefutable_let_patterns)]
1888 pub fn into_set_active(self) -> Option<(bool, DeviceSetActiveResponder)> {
1889 if let DeviceRequest::SetActive { active, responder } = self {
1890 Some((active, responder))
1891 } else {
1892 None
1893 }
1894 }
1895
1896 #[allow(irrefutable_let_patterns)]
1897 pub fn into_get_supported_network_types(
1898 self,
1899 ) -> Option<(DeviceGetSupportedNetworkTypesResponder)> {
1900 if let DeviceRequest::GetSupportedNetworkTypes { responder } = self {
1901 Some((responder))
1902 } else {
1903 None
1904 }
1905 }
1906
1907 #[allow(irrefutable_let_patterns)]
1908 pub fn into_watch_device_state(self) -> Option<(DeviceWatchDeviceStateResponder)> {
1909 if let DeviceRequest::WatchDeviceState { responder } = self {
1910 Some((responder))
1911 } else {
1912 None
1913 }
1914 }
1915
1916 pub fn method_name(&self) -> &'static str {
1918 match *self {
1919 DeviceRequest::ProvisionNetwork { .. } => "provision_network",
1920 DeviceRequest::LeaveNetwork { .. } => "leave_network",
1921 DeviceRequest::SetActive { .. } => "set_active",
1922 DeviceRequest::GetSupportedNetworkTypes { .. } => "get_supported_network_types",
1923 DeviceRequest::WatchDeviceState { .. } => "watch_device_state",
1924 }
1925 }
1926}
1927
1928#[derive(Debug, Clone)]
1929pub struct DeviceControlHandle {
1930 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1931}
1932
1933impl DeviceControlHandle {
1934 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1935 self.inner.shutdown_with_epitaph(status.into())
1936 }
1937}
1938
1939impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1940 fn shutdown(&self) {
1941 self.inner.shutdown()
1942 }
1943
1944 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1945 self.inner.shutdown_with_epitaph(status)
1946 }
1947
1948 fn is_closed(&self) -> bool {
1949 self.inner.channel().is_closed()
1950 }
1951 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1952 self.inner.channel().on_closed()
1953 }
1954
1955 #[cfg(target_os = "fuchsia")]
1956 fn signal_peer(
1957 &self,
1958 clear_mask: zx::Signals,
1959 set_mask: zx::Signals,
1960 ) -> Result<(), zx_status::Status> {
1961 use fidl::Peered;
1962 self.inner.channel().signal_peer(clear_mask, set_mask)
1963 }
1964}
1965
1966impl DeviceControlHandle {}
1967
1968#[must_use = "FIDL methods require a response to be sent"]
1969#[derive(Debug)]
1970pub struct DeviceProvisionNetworkResponder {
1971 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1972 tx_id: u32,
1973}
1974
1975impl std::ops::Drop for DeviceProvisionNetworkResponder {
1979 fn drop(&mut self) {
1980 self.control_handle.shutdown();
1981 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1983 }
1984}
1985
1986impl fidl::endpoints::Responder for DeviceProvisionNetworkResponder {
1987 type ControlHandle = DeviceControlHandle;
1988
1989 fn control_handle(&self) -> &DeviceControlHandle {
1990 &self.control_handle
1991 }
1992
1993 fn drop_without_shutdown(mut self) {
1994 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1996 std::mem::forget(self);
1998 }
1999}
2000
2001impl DeviceProvisionNetworkResponder {
2002 pub fn send(self) -> Result<(), fidl::Error> {
2006 let _result = self.send_raw();
2007 if _result.is_err() {
2008 self.control_handle.shutdown();
2009 }
2010 self.drop_without_shutdown();
2011 _result
2012 }
2013
2014 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2016 let _result = self.send_raw();
2017 self.drop_without_shutdown();
2018 _result
2019 }
2020
2021 fn send_raw(&self) -> Result<(), fidl::Error> {
2022 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2023 (),
2024 self.tx_id,
2025 0x3501046988e17076,
2026 fidl::encoding::DynamicFlags::empty(),
2027 )
2028 }
2029}
2030
2031#[must_use = "FIDL methods require a response to be sent"]
2032#[derive(Debug)]
2033pub struct DeviceLeaveNetworkResponder {
2034 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2035 tx_id: u32,
2036}
2037
2038impl std::ops::Drop for DeviceLeaveNetworkResponder {
2042 fn drop(&mut self) {
2043 self.control_handle.shutdown();
2044 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2046 }
2047}
2048
2049impl fidl::endpoints::Responder for DeviceLeaveNetworkResponder {
2050 type ControlHandle = DeviceControlHandle;
2051
2052 fn control_handle(&self) -> &DeviceControlHandle {
2053 &self.control_handle
2054 }
2055
2056 fn drop_without_shutdown(mut self) {
2057 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2059 std::mem::forget(self);
2061 }
2062}
2063
2064impl DeviceLeaveNetworkResponder {
2065 pub fn send(self) -> Result<(), fidl::Error> {
2069 let _result = self.send_raw();
2070 if _result.is_err() {
2071 self.control_handle.shutdown();
2072 }
2073 self.drop_without_shutdown();
2074 _result
2075 }
2076
2077 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2079 let _result = self.send_raw();
2080 self.drop_without_shutdown();
2081 _result
2082 }
2083
2084 fn send_raw(&self) -> Result<(), fidl::Error> {
2085 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2086 (),
2087 self.tx_id,
2088 0x66919e4f9752c53e,
2089 fidl::encoding::DynamicFlags::empty(),
2090 )
2091 }
2092}
2093
2094#[must_use = "FIDL methods require a response to be sent"]
2095#[derive(Debug)]
2096pub struct DeviceSetActiveResponder {
2097 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2098 tx_id: u32,
2099}
2100
2101impl std::ops::Drop for DeviceSetActiveResponder {
2105 fn drop(&mut self) {
2106 self.control_handle.shutdown();
2107 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2109 }
2110}
2111
2112impl fidl::endpoints::Responder for DeviceSetActiveResponder {
2113 type ControlHandle = DeviceControlHandle;
2114
2115 fn control_handle(&self) -> &DeviceControlHandle {
2116 &self.control_handle
2117 }
2118
2119 fn drop_without_shutdown(mut self) {
2120 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2122 std::mem::forget(self);
2124 }
2125}
2126
2127impl DeviceSetActiveResponder {
2128 pub fn send(self) -> Result<(), fidl::Error> {
2132 let _result = self.send_raw();
2133 if _result.is_err() {
2134 self.control_handle.shutdown();
2135 }
2136 self.drop_without_shutdown();
2137 _result
2138 }
2139
2140 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2142 let _result = self.send_raw();
2143 self.drop_without_shutdown();
2144 _result
2145 }
2146
2147 fn send_raw(&self) -> Result<(), fidl::Error> {
2148 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2149 (),
2150 self.tx_id,
2151 0x55a6837f8bbb344b,
2152 fidl::encoding::DynamicFlags::empty(),
2153 )
2154 }
2155}
2156
2157#[must_use = "FIDL methods require a response to be sent"]
2158#[derive(Debug)]
2159pub struct DeviceGetSupportedNetworkTypesResponder {
2160 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2161 tx_id: u32,
2162}
2163
2164impl std::ops::Drop for DeviceGetSupportedNetworkTypesResponder {
2168 fn drop(&mut self) {
2169 self.control_handle.shutdown();
2170 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2172 }
2173}
2174
2175impl fidl::endpoints::Responder for DeviceGetSupportedNetworkTypesResponder {
2176 type ControlHandle = DeviceControlHandle;
2177
2178 fn control_handle(&self) -> &DeviceControlHandle {
2179 &self.control_handle
2180 }
2181
2182 fn drop_without_shutdown(mut self) {
2183 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2185 std::mem::forget(self);
2187 }
2188}
2189
2190impl DeviceGetSupportedNetworkTypesResponder {
2191 pub fn send(self, mut network_types: &[String]) -> Result<(), fidl::Error> {
2195 let _result = self.send_raw(network_types);
2196 if _result.is_err() {
2197 self.control_handle.shutdown();
2198 }
2199 self.drop_without_shutdown();
2200 _result
2201 }
2202
2203 pub fn send_no_shutdown_on_err(self, mut network_types: &[String]) -> Result<(), fidl::Error> {
2205 let _result = self.send_raw(network_types);
2206 self.drop_without_shutdown();
2207 _result
2208 }
2209
2210 fn send_raw(&self, mut network_types: &[String]) -> Result<(), fidl::Error> {
2211 self.control_handle.inner.send::<DeviceGetSupportedNetworkTypesResponse>(
2212 (network_types,),
2213 self.tx_id,
2214 0x6d8f71a5beb15ebf,
2215 fidl::encoding::DynamicFlags::empty(),
2216 )
2217 }
2218}
2219
2220#[must_use = "FIDL methods require a response to be sent"]
2221#[derive(Debug)]
2222pub struct DeviceWatchDeviceStateResponder {
2223 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2224 tx_id: u32,
2225}
2226
2227impl std::ops::Drop for DeviceWatchDeviceStateResponder {
2231 fn drop(&mut self) {
2232 self.control_handle.shutdown();
2233 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2235 }
2236}
2237
2238impl fidl::endpoints::Responder for DeviceWatchDeviceStateResponder {
2239 type ControlHandle = DeviceControlHandle;
2240
2241 fn control_handle(&self) -> &DeviceControlHandle {
2242 &self.control_handle
2243 }
2244
2245 fn drop_without_shutdown(mut self) {
2246 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2248 std::mem::forget(self);
2250 }
2251}
2252
2253impl DeviceWatchDeviceStateResponder {
2254 pub fn send(self, mut device_combined_state: &DeviceState) -> Result<(), fidl::Error> {
2258 let _result = self.send_raw(device_combined_state);
2259 if _result.is_err() {
2260 self.control_handle.shutdown();
2261 }
2262 self.drop_without_shutdown();
2263 _result
2264 }
2265
2266 pub fn send_no_shutdown_on_err(
2268 self,
2269 mut device_combined_state: &DeviceState,
2270 ) -> Result<(), fidl::Error> {
2271 let _result = self.send_raw(device_combined_state);
2272 self.drop_without_shutdown();
2273 _result
2274 }
2275
2276 fn send_raw(&self, mut device_combined_state: &DeviceState) -> Result<(), fidl::Error> {
2277 self.control_handle.inner.send::<DeviceWatchDeviceStateResponse>(
2278 (device_combined_state,),
2279 self.tx_id,
2280 0x593be5b83e80d249,
2281 fidl::encoding::DynamicFlags::empty(),
2282 )
2283 }
2284}
2285
2286#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2287pub struct DeviceConnectorMarker;
2288
2289impl fidl::endpoints::ProtocolMarker for DeviceConnectorMarker {
2290 type Proxy = DeviceConnectorProxy;
2291 type RequestStream = DeviceConnectorRequestStream;
2292 #[cfg(target_os = "fuchsia")]
2293 type SynchronousProxy = DeviceConnectorSynchronousProxy;
2294
2295 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.DeviceConnector";
2296}
2297impl fidl::endpoints::DiscoverableProtocolMarker for DeviceConnectorMarker {}
2298
2299pub trait DeviceConnectorProxyInterface: Send + Sync {
2300 fn r#connect(
2301 &self,
2302 name: &str,
2303 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2304 ) -> Result<(), fidl::Error>;
2305}
2306#[derive(Debug)]
2307#[cfg(target_os = "fuchsia")]
2308pub struct DeviceConnectorSynchronousProxy {
2309 client: fidl::client::sync::Client,
2310}
2311
2312#[cfg(target_os = "fuchsia")]
2313impl fidl::endpoints::SynchronousProxy for DeviceConnectorSynchronousProxy {
2314 type Proxy = DeviceConnectorProxy;
2315 type Protocol = DeviceConnectorMarker;
2316
2317 fn from_channel(inner: fidl::Channel) -> Self {
2318 Self::new(inner)
2319 }
2320
2321 fn into_channel(self) -> fidl::Channel {
2322 self.client.into_channel()
2323 }
2324
2325 fn as_channel(&self) -> &fidl::Channel {
2326 self.client.as_channel()
2327 }
2328}
2329
2330#[cfg(target_os = "fuchsia")]
2331impl DeviceConnectorSynchronousProxy {
2332 pub fn new(channel: fidl::Channel) -> Self {
2333 Self { client: fidl::client::sync::Client::new(channel) }
2334 }
2335
2336 pub fn into_channel(self) -> fidl::Channel {
2337 self.client.into_channel()
2338 }
2339
2340 pub fn wait_for_event(
2343 &self,
2344 deadline: zx::MonotonicInstant,
2345 ) -> Result<DeviceConnectorEvent, fidl::Error> {
2346 DeviceConnectorEvent::decode(self.client.wait_for_event::<DeviceConnectorMarker>(deadline)?)
2347 }
2348
2349 pub fn r#connect(
2366 &self,
2367 mut name: &str,
2368 mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2369 ) -> Result<(), fidl::Error> {
2370 self.client.send::<DeviceConnectorConnectRequest>(
2371 (name, server_end),
2372 0x63470c4c0c8e678a,
2373 fidl::encoding::DynamicFlags::empty(),
2374 )
2375 }
2376}
2377
2378#[cfg(target_os = "fuchsia")]
2379impl From<DeviceConnectorSynchronousProxy> for zx::NullableHandle {
2380 fn from(value: DeviceConnectorSynchronousProxy) -> Self {
2381 value.into_channel().into()
2382 }
2383}
2384
2385#[cfg(target_os = "fuchsia")]
2386impl From<fidl::Channel> for DeviceConnectorSynchronousProxy {
2387 fn from(value: fidl::Channel) -> Self {
2388 Self::new(value)
2389 }
2390}
2391
2392#[cfg(target_os = "fuchsia")]
2393impl fidl::endpoints::FromClient for DeviceConnectorSynchronousProxy {
2394 type Protocol = DeviceConnectorMarker;
2395
2396 fn from_client(value: fidl::endpoints::ClientEnd<DeviceConnectorMarker>) -> Self {
2397 Self::new(value.into_channel())
2398 }
2399}
2400
2401#[derive(Debug, Clone)]
2402pub struct DeviceConnectorProxy {
2403 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2404}
2405
2406impl fidl::endpoints::Proxy for DeviceConnectorProxy {
2407 type Protocol = DeviceConnectorMarker;
2408
2409 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2410 Self::new(inner)
2411 }
2412
2413 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2414 self.client.into_channel().map_err(|client| Self { client })
2415 }
2416
2417 fn as_channel(&self) -> &::fidl::AsyncChannel {
2418 self.client.as_channel()
2419 }
2420}
2421
2422impl DeviceConnectorProxy {
2423 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2425 let protocol_name = <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2426 Self { client: fidl::client::Client::new(channel, protocol_name) }
2427 }
2428
2429 pub fn take_event_stream(&self) -> DeviceConnectorEventStream {
2435 DeviceConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2436 }
2437
2438 pub fn r#connect(
2455 &self,
2456 mut name: &str,
2457 mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2458 ) -> Result<(), fidl::Error> {
2459 DeviceConnectorProxyInterface::r#connect(self, name, server_end)
2460 }
2461}
2462
2463impl DeviceConnectorProxyInterface for DeviceConnectorProxy {
2464 fn r#connect(
2465 &self,
2466 mut name: &str,
2467 mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2468 ) -> Result<(), fidl::Error> {
2469 self.client.send::<DeviceConnectorConnectRequest>(
2470 (name, server_end),
2471 0x63470c4c0c8e678a,
2472 fidl::encoding::DynamicFlags::empty(),
2473 )
2474 }
2475}
2476
2477pub struct DeviceConnectorEventStream {
2478 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2479}
2480
2481impl std::marker::Unpin for DeviceConnectorEventStream {}
2482
2483impl futures::stream::FusedStream for DeviceConnectorEventStream {
2484 fn is_terminated(&self) -> bool {
2485 self.event_receiver.is_terminated()
2486 }
2487}
2488
2489impl futures::Stream for DeviceConnectorEventStream {
2490 type Item = Result<DeviceConnectorEvent, fidl::Error>;
2491
2492 fn poll_next(
2493 mut self: std::pin::Pin<&mut Self>,
2494 cx: &mut std::task::Context<'_>,
2495 ) -> std::task::Poll<Option<Self::Item>> {
2496 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2497 &mut self.event_receiver,
2498 cx
2499 )?) {
2500 Some(buf) => std::task::Poll::Ready(Some(DeviceConnectorEvent::decode(buf))),
2501 None => std::task::Poll::Ready(None),
2502 }
2503 }
2504}
2505
2506#[derive(Debug)]
2507pub enum DeviceConnectorEvent {}
2508
2509impl DeviceConnectorEvent {
2510 fn decode(
2512 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2513 ) -> Result<DeviceConnectorEvent, fidl::Error> {
2514 let (bytes, _handles) = buf.split_mut();
2515 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2516 debug_assert_eq!(tx_header.tx_id, 0);
2517 match tx_header.ordinal {
2518 _ => Err(fidl::Error::UnknownOrdinal {
2519 ordinal: tx_header.ordinal,
2520 protocol_name:
2521 <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2522 }),
2523 }
2524 }
2525}
2526
2527pub struct DeviceConnectorRequestStream {
2529 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2530 is_terminated: bool,
2531}
2532
2533impl std::marker::Unpin for DeviceConnectorRequestStream {}
2534
2535impl futures::stream::FusedStream for DeviceConnectorRequestStream {
2536 fn is_terminated(&self) -> bool {
2537 self.is_terminated
2538 }
2539}
2540
2541impl fidl::endpoints::RequestStream for DeviceConnectorRequestStream {
2542 type Protocol = DeviceConnectorMarker;
2543 type ControlHandle = DeviceConnectorControlHandle;
2544
2545 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2546 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2547 }
2548
2549 fn control_handle(&self) -> Self::ControlHandle {
2550 DeviceConnectorControlHandle { inner: self.inner.clone() }
2551 }
2552
2553 fn into_inner(
2554 self,
2555 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2556 {
2557 (self.inner, self.is_terminated)
2558 }
2559
2560 fn from_inner(
2561 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2562 is_terminated: bool,
2563 ) -> Self {
2564 Self { inner, is_terminated }
2565 }
2566}
2567
2568impl futures::Stream for DeviceConnectorRequestStream {
2569 type Item = Result<DeviceConnectorRequest, fidl::Error>;
2570
2571 fn poll_next(
2572 mut self: std::pin::Pin<&mut Self>,
2573 cx: &mut std::task::Context<'_>,
2574 ) -> std::task::Poll<Option<Self::Item>> {
2575 let this = &mut *self;
2576 if this.inner.check_shutdown(cx) {
2577 this.is_terminated = true;
2578 return std::task::Poll::Ready(None);
2579 }
2580 if this.is_terminated {
2581 panic!("polled DeviceConnectorRequestStream after completion");
2582 }
2583 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2584 |bytes, handles| {
2585 match this.inner.channel().read_etc(cx, bytes, handles) {
2586 std::task::Poll::Ready(Ok(())) => {}
2587 std::task::Poll::Pending => return std::task::Poll::Pending,
2588 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2589 this.is_terminated = true;
2590 return std::task::Poll::Ready(None);
2591 }
2592 std::task::Poll::Ready(Err(e)) => {
2593 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2594 e.into(),
2595 ))));
2596 }
2597 }
2598
2599 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2601
2602 std::task::Poll::Ready(Some(match header.ordinal {
2603 0x63470c4c0c8e678a => {
2604 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2605 let mut req = fidl::new_empty!(
2606 DeviceConnectorConnectRequest,
2607 fidl::encoding::DefaultFuchsiaResourceDialect
2608 );
2609 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2610 let control_handle =
2611 DeviceConnectorControlHandle { inner: this.inner.clone() };
2612 Ok(DeviceConnectorRequest::Connect {
2613 name: req.name,
2614 server_end: req.server_end,
2615
2616 control_handle,
2617 })
2618 }
2619 _ => Err(fidl::Error::UnknownOrdinal {
2620 ordinal: header.ordinal,
2621 protocol_name:
2622 <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2623 }),
2624 }))
2625 },
2626 )
2627 }
2628}
2629
2630#[derive(Debug)]
2633pub enum DeviceConnectorRequest {
2634 Connect {
2651 name: String,
2652 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2653 control_handle: DeviceConnectorControlHandle,
2654 },
2655}
2656
2657impl DeviceConnectorRequest {
2658 #[allow(irrefutable_let_patterns)]
2659 pub fn into_connect(
2660 self,
2661 ) -> Option<(String, fidl::endpoints::ServerEnd<DeviceMarker>, DeviceConnectorControlHandle)>
2662 {
2663 if let DeviceConnectorRequest::Connect { name, server_end, control_handle } = self {
2664 Some((name, server_end, control_handle))
2665 } else {
2666 None
2667 }
2668 }
2669
2670 pub fn method_name(&self) -> &'static str {
2672 match *self {
2673 DeviceConnectorRequest::Connect { .. } => "connect",
2674 }
2675 }
2676}
2677
2678#[derive(Debug, Clone)]
2679pub struct DeviceConnectorControlHandle {
2680 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2681}
2682
2683impl DeviceConnectorControlHandle {
2684 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2685 self.inner.shutdown_with_epitaph(status.into())
2686 }
2687}
2688
2689impl fidl::endpoints::ControlHandle for DeviceConnectorControlHandle {
2690 fn shutdown(&self) {
2691 self.inner.shutdown()
2692 }
2693
2694 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2695 self.inner.shutdown_with_epitaph(status)
2696 }
2697
2698 fn is_closed(&self) -> bool {
2699 self.inner.channel().is_closed()
2700 }
2701 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2702 self.inner.channel().on_closed()
2703 }
2704
2705 #[cfg(target_os = "fuchsia")]
2706 fn signal_peer(
2707 &self,
2708 clear_mask: zx::Signals,
2709 set_mask: zx::Signals,
2710 ) -> Result<(), zx_status::Status> {
2711 use fidl::Peered;
2712 self.inner.channel().signal_peer(clear_mask, set_mask)
2713 }
2714}
2715
2716impl DeviceConnectorControlHandle {}
2717
2718#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2719pub struct DeviceExtraMarker;
2720
2721impl fidl::endpoints::ProtocolMarker for DeviceExtraMarker {
2722 type Proxy = DeviceExtraProxy;
2723 type RequestStream = DeviceExtraRequestStream;
2724 #[cfg(target_os = "fuchsia")]
2725 type SynchronousProxy = DeviceExtraSynchronousProxy;
2726
2727 const DEBUG_NAME: &'static str = "(anonymous) DeviceExtra";
2728}
2729
2730pub trait DeviceExtraProxyInterface: Send + Sync {
2731 type GetCredentialResponseFut: std::future::Future<Output = Result<Option<Box<Credential>>, fidl::Error>>
2732 + Send;
2733 fn r#get_credential(&self) -> Self::GetCredentialResponseFut;
2734 type WatchIdentityResponseFut: std::future::Future<Output = Result<Identity, fidl::Error>>
2735 + Send;
2736 fn r#watch_identity(&self) -> Self::WatchIdentityResponseFut;
2737 type GetCurrentMacAddressResponseFut: std::future::Future<Output = Result<fidl_fuchsia_lowpan::MacAddress, fidl::Error>>
2738 + Send;
2739 fn r#get_current_mac_address(&self) -> Self::GetCurrentMacAddressResponseFut;
2740}
2741#[derive(Debug)]
2742#[cfg(target_os = "fuchsia")]
2743pub struct DeviceExtraSynchronousProxy {
2744 client: fidl::client::sync::Client,
2745}
2746
2747#[cfg(target_os = "fuchsia")]
2748impl fidl::endpoints::SynchronousProxy for DeviceExtraSynchronousProxy {
2749 type Proxy = DeviceExtraProxy;
2750 type Protocol = DeviceExtraMarker;
2751
2752 fn from_channel(inner: fidl::Channel) -> Self {
2753 Self::new(inner)
2754 }
2755
2756 fn into_channel(self) -> fidl::Channel {
2757 self.client.into_channel()
2758 }
2759
2760 fn as_channel(&self) -> &fidl::Channel {
2761 self.client.as_channel()
2762 }
2763}
2764
2765#[cfg(target_os = "fuchsia")]
2766impl DeviceExtraSynchronousProxy {
2767 pub fn new(channel: fidl::Channel) -> Self {
2768 Self { client: fidl::client::sync::Client::new(channel) }
2769 }
2770
2771 pub fn into_channel(self) -> fidl::Channel {
2772 self.client.into_channel()
2773 }
2774
2775 pub fn wait_for_event(
2778 &self,
2779 deadline: zx::MonotonicInstant,
2780 ) -> Result<DeviceExtraEvent, fidl::Error> {
2781 DeviceExtraEvent::decode(self.client.wait_for_event::<DeviceExtraMarker>(deadline)?)
2782 }
2783
2784 pub fn r#get_credential(
2791 &self,
2792 ___deadline: zx::MonotonicInstant,
2793 ) -> Result<Option<Box<Credential>>, fidl::Error> {
2794 let _response = self.client.send_query::<
2795 fidl::encoding::EmptyPayload,
2796 DeviceExtraGetCredentialResponse,
2797 DeviceExtraMarker,
2798 >(
2799 (),
2800 0x77f75f289c8c4ceb,
2801 fidl::encoding::DynamicFlags::empty(),
2802 ___deadline,
2803 )?;
2804 Ok(_response.credential)
2805 }
2806
2807 pub fn r#watch_identity(
2831 &self,
2832 ___deadline: zx::MonotonicInstant,
2833 ) -> Result<Identity, fidl::Error> {
2834 let _response = self.client.send_query::<
2835 fidl::encoding::EmptyPayload,
2836 DeviceExtraWatchIdentityResponse,
2837 DeviceExtraMarker,
2838 >(
2839 (),
2840 0xb9f5d8963eaebc6,
2841 fidl::encoding::DynamicFlags::empty(),
2842 ___deadline,
2843 )?;
2844 Ok(_response.identity)
2845 }
2846
2847 pub fn r#get_current_mac_address(
2854 &self,
2855 ___deadline: zx::MonotonicInstant,
2856 ) -> Result<fidl_fuchsia_lowpan::MacAddress, fidl::Error> {
2857 let _response = self.client.send_query::<
2858 fidl::encoding::EmptyPayload,
2859 DeviceExtraGetCurrentMacAddressResponse,
2860 DeviceExtraMarker,
2861 >(
2862 (),
2863 0x70835954071d94dd,
2864 fidl::encoding::DynamicFlags::empty(),
2865 ___deadline,
2866 )?;
2867 Ok(_response.address)
2868 }
2869}
2870
2871#[cfg(target_os = "fuchsia")]
2872impl From<DeviceExtraSynchronousProxy> for zx::NullableHandle {
2873 fn from(value: DeviceExtraSynchronousProxy) -> Self {
2874 value.into_channel().into()
2875 }
2876}
2877
2878#[cfg(target_os = "fuchsia")]
2879impl From<fidl::Channel> for DeviceExtraSynchronousProxy {
2880 fn from(value: fidl::Channel) -> Self {
2881 Self::new(value)
2882 }
2883}
2884
2885#[cfg(target_os = "fuchsia")]
2886impl fidl::endpoints::FromClient for DeviceExtraSynchronousProxy {
2887 type Protocol = DeviceExtraMarker;
2888
2889 fn from_client(value: fidl::endpoints::ClientEnd<DeviceExtraMarker>) -> Self {
2890 Self::new(value.into_channel())
2891 }
2892}
2893
2894#[derive(Debug, Clone)]
2895pub struct DeviceExtraProxy {
2896 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2897}
2898
2899impl fidl::endpoints::Proxy for DeviceExtraProxy {
2900 type Protocol = DeviceExtraMarker;
2901
2902 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2903 Self::new(inner)
2904 }
2905
2906 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2907 self.client.into_channel().map_err(|client| Self { client })
2908 }
2909
2910 fn as_channel(&self) -> &::fidl::AsyncChannel {
2911 self.client.as_channel()
2912 }
2913}
2914
2915impl DeviceExtraProxy {
2916 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2918 let protocol_name = <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2919 Self { client: fidl::client::Client::new(channel, protocol_name) }
2920 }
2921
2922 pub fn take_event_stream(&self) -> DeviceExtraEventStream {
2928 DeviceExtraEventStream { event_receiver: self.client.take_event_receiver() }
2929 }
2930
2931 pub fn r#get_credential(
2938 &self,
2939 ) -> fidl::client::QueryResponseFut<
2940 Option<Box<Credential>>,
2941 fidl::encoding::DefaultFuchsiaResourceDialect,
2942 > {
2943 DeviceExtraProxyInterface::r#get_credential(self)
2944 }
2945
2946 pub fn r#watch_identity(
2970 &self,
2971 ) -> fidl::client::QueryResponseFut<Identity, fidl::encoding::DefaultFuchsiaResourceDialect>
2972 {
2973 DeviceExtraProxyInterface::r#watch_identity(self)
2974 }
2975
2976 pub fn r#get_current_mac_address(
2983 &self,
2984 ) -> fidl::client::QueryResponseFut<
2985 fidl_fuchsia_lowpan::MacAddress,
2986 fidl::encoding::DefaultFuchsiaResourceDialect,
2987 > {
2988 DeviceExtraProxyInterface::r#get_current_mac_address(self)
2989 }
2990}
2991
2992impl DeviceExtraProxyInterface for DeviceExtraProxy {
2993 type GetCredentialResponseFut = fidl::client::QueryResponseFut<
2994 Option<Box<Credential>>,
2995 fidl::encoding::DefaultFuchsiaResourceDialect,
2996 >;
2997 fn r#get_credential(&self) -> Self::GetCredentialResponseFut {
2998 fn _decode(
2999 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3000 ) -> Result<Option<Box<Credential>>, fidl::Error> {
3001 let _response = fidl::client::decode_transaction_body::<
3002 DeviceExtraGetCredentialResponse,
3003 fidl::encoding::DefaultFuchsiaResourceDialect,
3004 0x77f75f289c8c4ceb,
3005 >(_buf?)?;
3006 Ok(_response.credential)
3007 }
3008 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<Box<Credential>>>(
3009 (),
3010 0x77f75f289c8c4ceb,
3011 fidl::encoding::DynamicFlags::empty(),
3012 _decode,
3013 )
3014 }
3015
3016 type WatchIdentityResponseFut =
3017 fidl::client::QueryResponseFut<Identity, fidl::encoding::DefaultFuchsiaResourceDialect>;
3018 fn r#watch_identity(&self) -> Self::WatchIdentityResponseFut {
3019 fn _decode(
3020 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3021 ) -> Result<Identity, fidl::Error> {
3022 let _response = fidl::client::decode_transaction_body::<
3023 DeviceExtraWatchIdentityResponse,
3024 fidl::encoding::DefaultFuchsiaResourceDialect,
3025 0xb9f5d8963eaebc6,
3026 >(_buf?)?;
3027 Ok(_response.identity)
3028 }
3029 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Identity>(
3030 (),
3031 0xb9f5d8963eaebc6,
3032 fidl::encoding::DynamicFlags::empty(),
3033 _decode,
3034 )
3035 }
3036
3037 type GetCurrentMacAddressResponseFut = fidl::client::QueryResponseFut<
3038 fidl_fuchsia_lowpan::MacAddress,
3039 fidl::encoding::DefaultFuchsiaResourceDialect,
3040 >;
3041 fn r#get_current_mac_address(&self) -> Self::GetCurrentMacAddressResponseFut {
3042 fn _decode(
3043 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3044 ) -> Result<fidl_fuchsia_lowpan::MacAddress, fidl::Error> {
3045 let _response = fidl::client::decode_transaction_body::<
3046 DeviceExtraGetCurrentMacAddressResponse,
3047 fidl::encoding::DefaultFuchsiaResourceDialect,
3048 0x70835954071d94dd,
3049 >(_buf?)?;
3050 Ok(_response.address)
3051 }
3052 self.client
3053 .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_lowpan::MacAddress>(
3054 (),
3055 0x70835954071d94dd,
3056 fidl::encoding::DynamicFlags::empty(),
3057 _decode,
3058 )
3059 }
3060}
3061
3062pub struct DeviceExtraEventStream {
3063 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3064}
3065
3066impl std::marker::Unpin for DeviceExtraEventStream {}
3067
3068impl futures::stream::FusedStream for DeviceExtraEventStream {
3069 fn is_terminated(&self) -> bool {
3070 self.event_receiver.is_terminated()
3071 }
3072}
3073
3074impl futures::Stream for DeviceExtraEventStream {
3075 type Item = Result<DeviceExtraEvent, fidl::Error>;
3076
3077 fn poll_next(
3078 mut self: std::pin::Pin<&mut Self>,
3079 cx: &mut std::task::Context<'_>,
3080 ) -> std::task::Poll<Option<Self::Item>> {
3081 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3082 &mut self.event_receiver,
3083 cx
3084 )?) {
3085 Some(buf) => std::task::Poll::Ready(Some(DeviceExtraEvent::decode(buf))),
3086 None => std::task::Poll::Ready(None),
3087 }
3088 }
3089}
3090
3091#[derive(Debug)]
3092pub enum DeviceExtraEvent {}
3093
3094impl DeviceExtraEvent {
3095 fn decode(
3097 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3098 ) -> Result<DeviceExtraEvent, fidl::Error> {
3099 let (bytes, _handles) = buf.split_mut();
3100 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3101 debug_assert_eq!(tx_header.tx_id, 0);
3102 match tx_header.ordinal {
3103 _ => Err(fidl::Error::UnknownOrdinal {
3104 ordinal: tx_header.ordinal,
3105 protocol_name: <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3106 }),
3107 }
3108 }
3109}
3110
3111pub struct DeviceExtraRequestStream {
3113 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3114 is_terminated: bool,
3115}
3116
3117impl std::marker::Unpin for DeviceExtraRequestStream {}
3118
3119impl futures::stream::FusedStream for DeviceExtraRequestStream {
3120 fn is_terminated(&self) -> bool {
3121 self.is_terminated
3122 }
3123}
3124
3125impl fidl::endpoints::RequestStream for DeviceExtraRequestStream {
3126 type Protocol = DeviceExtraMarker;
3127 type ControlHandle = DeviceExtraControlHandle;
3128
3129 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3130 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3131 }
3132
3133 fn control_handle(&self) -> Self::ControlHandle {
3134 DeviceExtraControlHandle { inner: self.inner.clone() }
3135 }
3136
3137 fn into_inner(
3138 self,
3139 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3140 {
3141 (self.inner, self.is_terminated)
3142 }
3143
3144 fn from_inner(
3145 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3146 is_terminated: bool,
3147 ) -> Self {
3148 Self { inner, is_terminated }
3149 }
3150}
3151
3152impl futures::Stream for DeviceExtraRequestStream {
3153 type Item = Result<DeviceExtraRequest, fidl::Error>;
3154
3155 fn poll_next(
3156 mut self: std::pin::Pin<&mut Self>,
3157 cx: &mut std::task::Context<'_>,
3158 ) -> std::task::Poll<Option<Self::Item>> {
3159 let this = &mut *self;
3160 if this.inner.check_shutdown(cx) {
3161 this.is_terminated = true;
3162 return std::task::Poll::Ready(None);
3163 }
3164 if this.is_terminated {
3165 panic!("polled DeviceExtraRequestStream after completion");
3166 }
3167 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3168 |bytes, handles| {
3169 match this.inner.channel().read_etc(cx, bytes, handles) {
3170 std::task::Poll::Ready(Ok(())) => {}
3171 std::task::Poll::Pending => return std::task::Poll::Pending,
3172 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3173 this.is_terminated = true;
3174 return std::task::Poll::Ready(None);
3175 }
3176 std::task::Poll::Ready(Err(e)) => {
3177 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3178 e.into(),
3179 ))));
3180 }
3181 }
3182
3183 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3185
3186 std::task::Poll::Ready(Some(match header.ordinal {
3187 0x77f75f289c8c4ceb => {
3188 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3189 let mut req = fidl::new_empty!(
3190 fidl::encoding::EmptyPayload,
3191 fidl::encoding::DefaultFuchsiaResourceDialect
3192 );
3193 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3194 let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
3195 Ok(DeviceExtraRequest::GetCredential {
3196 responder: DeviceExtraGetCredentialResponder {
3197 control_handle: std::mem::ManuallyDrop::new(control_handle),
3198 tx_id: header.tx_id,
3199 },
3200 })
3201 }
3202 0xb9f5d8963eaebc6 => {
3203 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3204 let mut req = fidl::new_empty!(
3205 fidl::encoding::EmptyPayload,
3206 fidl::encoding::DefaultFuchsiaResourceDialect
3207 );
3208 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3209 let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
3210 Ok(DeviceExtraRequest::WatchIdentity {
3211 responder: DeviceExtraWatchIdentityResponder {
3212 control_handle: std::mem::ManuallyDrop::new(control_handle),
3213 tx_id: header.tx_id,
3214 },
3215 })
3216 }
3217 0x70835954071d94dd => {
3218 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3219 let mut req = fidl::new_empty!(
3220 fidl::encoding::EmptyPayload,
3221 fidl::encoding::DefaultFuchsiaResourceDialect
3222 );
3223 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3224 let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
3225 Ok(DeviceExtraRequest::GetCurrentMacAddress {
3226 responder: DeviceExtraGetCurrentMacAddressResponder {
3227 control_handle: std::mem::ManuallyDrop::new(control_handle),
3228 tx_id: header.tx_id,
3229 },
3230 })
3231 }
3232 _ => Err(fidl::Error::UnknownOrdinal {
3233 ordinal: header.ordinal,
3234 protocol_name:
3235 <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3236 }),
3237 }))
3238 },
3239 )
3240 }
3241}
3242
3243#[derive(Debug)]
3249pub enum DeviceExtraRequest {
3250 GetCredential { responder: DeviceExtraGetCredentialResponder },
3257 WatchIdentity { responder: DeviceExtraWatchIdentityResponder },
3281 GetCurrentMacAddress { responder: DeviceExtraGetCurrentMacAddressResponder },
3288}
3289
3290impl DeviceExtraRequest {
3291 #[allow(irrefutable_let_patterns)]
3292 pub fn into_get_credential(self) -> Option<(DeviceExtraGetCredentialResponder)> {
3293 if let DeviceExtraRequest::GetCredential { responder } = self {
3294 Some((responder))
3295 } else {
3296 None
3297 }
3298 }
3299
3300 #[allow(irrefutable_let_patterns)]
3301 pub fn into_watch_identity(self) -> Option<(DeviceExtraWatchIdentityResponder)> {
3302 if let DeviceExtraRequest::WatchIdentity { responder } = self {
3303 Some((responder))
3304 } else {
3305 None
3306 }
3307 }
3308
3309 #[allow(irrefutable_let_patterns)]
3310 pub fn into_get_current_mac_address(
3311 self,
3312 ) -> Option<(DeviceExtraGetCurrentMacAddressResponder)> {
3313 if let DeviceExtraRequest::GetCurrentMacAddress { responder } = self {
3314 Some((responder))
3315 } else {
3316 None
3317 }
3318 }
3319
3320 pub fn method_name(&self) -> &'static str {
3322 match *self {
3323 DeviceExtraRequest::GetCredential { .. } => "get_credential",
3324 DeviceExtraRequest::WatchIdentity { .. } => "watch_identity",
3325 DeviceExtraRequest::GetCurrentMacAddress { .. } => "get_current_mac_address",
3326 }
3327 }
3328}
3329
3330#[derive(Debug, Clone)]
3331pub struct DeviceExtraControlHandle {
3332 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3333}
3334
3335impl DeviceExtraControlHandle {
3336 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3337 self.inner.shutdown_with_epitaph(status.into())
3338 }
3339}
3340
3341impl fidl::endpoints::ControlHandle for DeviceExtraControlHandle {
3342 fn shutdown(&self) {
3343 self.inner.shutdown()
3344 }
3345
3346 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3347 self.inner.shutdown_with_epitaph(status)
3348 }
3349
3350 fn is_closed(&self) -> bool {
3351 self.inner.channel().is_closed()
3352 }
3353 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3354 self.inner.channel().on_closed()
3355 }
3356
3357 #[cfg(target_os = "fuchsia")]
3358 fn signal_peer(
3359 &self,
3360 clear_mask: zx::Signals,
3361 set_mask: zx::Signals,
3362 ) -> Result<(), zx_status::Status> {
3363 use fidl::Peered;
3364 self.inner.channel().signal_peer(clear_mask, set_mask)
3365 }
3366}
3367
3368impl DeviceExtraControlHandle {}
3369
3370#[must_use = "FIDL methods require a response to be sent"]
3371#[derive(Debug)]
3372pub struct DeviceExtraGetCredentialResponder {
3373 control_handle: std::mem::ManuallyDrop<DeviceExtraControlHandle>,
3374 tx_id: u32,
3375}
3376
3377impl std::ops::Drop for DeviceExtraGetCredentialResponder {
3381 fn drop(&mut self) {
3382 self.control_handle.shutdown();
3383 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3385 }
3386}
3387
3388impl fidl::endpoints::Responder for DeviceExtraGetCredentialResponder {
3389 type ControlHandle = DeviceExtraControlHandle;
3390
3391 fn control_handle(&self) -> &DeviceExtraControlHandle {
3392 &self.control_handle
3393 }
3394
3395 fn drop_without_shutdown(mut self) {
3396 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3398 std::mem::forget(self);
3400 }
3401}
3402
3403impl DeviceExtraGetCredentialResponder {
3404 pub fn send(self, mut credential: Option<&Credential>) -> Result<(), fidl::Error> {
3408 let _result = self.send_raw(credential);
3409 if _result.is_err() {
3410 self.control_handle.shutdown();
3411 }
3412 self.drop_without_shutdown();
3413 _result
3414 }
3415
3416 pub fn send_no_shutdown_on_err(
3418 self,
3419 mut credential: Option<&Credential>,
3420 ) -> Result<(), fidl::Error> {
3421 let _result = self.send_raw(credential);
3422 self.drop_without_shutdown();
3423 _result
3424 }
3425
3426 fn send_raw(&self, mut credential: Option<&Credential>) -> Result<(), fidl::Error> {
3427 self.control_handle.inner.send::<DeviceExtraGetCredentialResponse>(
3428 (credential,),
3429 self.tx_id,
3430 0x77f75f289c8c4ceb,
3431 fidl::encoding::DynamicFlags::empty(),
3432 )
3433 }
3434}
3435
3436#[must_use = "FIDL methods require a response to be sent"]
3437#[derive(Debug)]
3438pub struct DeviceExtraWatchIdentityResponder {
3439 control_handle: std::mem::ManuallyDrop<DeviceExtraControlHandle>,
3440 tx_id: u32,
3441}
3442
3443impl std::ops::Drop for DeviceExtraWatchIdentityResponder {
3447 fn drop(&mut self) {
3448 self.control_handle.shutdown();
3449 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3451 }
3452}
3453
3454impl fidl::endpoints::Responder for DeviceExtraWatchIdentityResponder {
3455 type ControlHandle = DeviceExtraControlHandle;
3456
3457 fn control_handle(&self) -> &DeviceExtraControlHandle {
3458 &self.control_handle
3459 }
3460
3461 fn drop_without_shutdown(mut self) {
3462 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3464 std::mem::forget(self);
3466 }
3467}
3468
3469impl DeviceExtraWatchIdentityResponder {
3470 pub fn send(self, mut identity: &Identity) -> Result<(), fidl::Error> {
3474 let _result = self.send_raw(identity);
3475 if _result.is_err() {
3476 self.control_handle.shutdown();
3477 }
3478 self.drop_without_shutdown();
3479 _result
3480 }
3481
3482 pub fn send_no_shutdown_on_err(self, mut identity: &Identity) -> Result<(), fidl::Error> {
3484 let _result = self.send_raw(identity);
3485 self.drop_without_shutdown();
3486 _result
3487 }
3488
3489 fn send_raw(&self, mut identity: &Identity) -> Result<(), fidl::Error> {
3490 self.control_handle.inner.send::<DeviceExtraWatchIdentityResponse>(
3491 (identity,),
3492 self.tx_id,
3493 0xb9f5d8963eaebc6,
3494 fidl::encoding::DynamicFlags::empty(),
3495 )
3496 }
3497}
3498
3499#[must_use = "FIDL methods require a response to be sent"]
3500#[derive(Debug)]
3501pub struct DeviceExtraGetCurrentMacAddressResponder {
3502 control_handle: std::mem::ManuallyDrop<DeviceExtraControlHandle>,
3503 tx_id: u32,
3504}
3505
3506impl std::ops::Drop for DeviceExtraGetCurrentMacAddressResponder {
3510 fn drop(&mut self) {
3511 self.control_handle.shutdown();
3512 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3514 }
3515}
3516
3517impl fidl::endpoints::Responder for DeviceExtraGetCurrentMacAddressResponder {
3518 type ControlHandle = DeviceExtraControlHandle;
3519
3520 fn control_handle(&self) -> &DeviceExtraControlHandle {
3521 &self.control_handle
3522 }
3523
3524 fn drop_without_shutdown(mut self) {
3525 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3527 std::mem::forget(self);
3529 }
3530}
3531
3532impl DeviceExtraGetCurrentMacAddressResponder {
3533 pub fn send(self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
3537 let _result = self.send_raw(address);
3538 if _result.is_err() {
3539 self.control_handle.shutdown();
3540 }
3541 self.drop_without_shutdown();
3542 _result
3543 }
3544
3545 pub fn send_no_shutdown_on_err(
3547 self,
3548 mut address: &fidl_fuchsia_lowpan::MacAddress,
3549 ) -> Result<(), fidl::Error> {
3550 let _result = self.send_raw(address);
3551 self.drop_without_shutdown();
3552 _result
3553 }
3554
3555 fn send_raw(&self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
3556 self.control_handle.inner.send::<DeviceExtraGetCurrentMacAddressResponse>(
3557 (address,),
3558 self.tx_id,
3559 0x70835954071d94dd,
3560 fidl::encoding::DynamicFlags::empty(),
3561 )
3562 }
3563}
3564
3565#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3566pub struct DeviceExtraConnectorMarker;
3567
3568impl fidl::endpoints::ProtocolMarker for DeviceExtraConnectorMarker {
3569 type Proxy = DeviceExtraConnectorProxy;
3570 type RequestStream = DeviceExtraConnectorRequestStream;
3571 #[cfg(target_os = "fuchsia")]
3572 type SynchronousProxy = DeviceExtraConnectorSynchronousProxy;
3573
3574 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.DeviceExtraConnector";
3575}
3576impl fidl::endpoints::DiscoverableProtocolMarker for DeviceExtraConnectorMarker {}
3577
3578pub trait DeviceExtraConnectorProxyInterface: Send + Sync {
3579 fn r#connect(
3580 &self,
3581 name: &str,
3582 server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3583 ) -> Result<(), fidl::Error>;
3584}
3585#[derive(Debug)]
3586#[cfg(target_os = "fuchsia")]
3587pub struct DeviceExtraConnectorSynchronousProxy {
3588 client: fidl::client::sync::Client,
3589}
3590
3591#[cfg(target_os = "fuchsia")]
3592impl fidl::endpoints::SynchronousProxy for DeviceExtraConnectorSynchronousProxy {
3593 type Proxy = DeviceExtraConnectorProxy;
3594 type Protocol = DeviceExtraConnectorMarker;
3595
3596 fn from_channel(inner: fidl::Channel) -> Self {
3597 Self::new(inner)
3598 }
3599
3600 fn into_channel(self) -> fidl::Channel {
3601 self.client.into_channel()
3602 }
3603
3604 fn as_channel(&self) -> &fidl::Channel {
3605 self.client.as_channel()
3606 }
3607}
3608
3609#[cfg(target_os = "fuchsia")]
3610impl DeviceExtraConnectorSynchronousProxy {
3611 pub fn new(channel: fidl::Channel) -> Self {
3612 Self { client: fidl::client::sync::Client::new(channel) }
3613 }
3614
3615 pub fn into_channel(self) -> fidl::Channel {
3616 self.client.into_channel()
3617 }
3618
3619 pub fn wait_for_event(
3622 &self,
3623 deadline: zx::MonotonicInstant,
3624 ) -> Result<DeviceExtraConnectorEvent, fidl::Error> {
3625 DeviceExtraConnectorEvent::decode(
3626 self.client.wait_for_event::<DeviceExtraConnectorMarker>(deadline)?,
3627 )
3628 }
3629
3630 pub fn r#connect(
3647 &self,
3648 mut name: &str,
3649 mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3650 ) -> Result<(), fidl::Error> {
3651 self.client.send::<DeviceExtraConnectorConnectRequest>(
3652 (name, server_end),
3653 0x2959be873ae18ae3,
3654 fidl::encoding::DynamicFlags::empty(),
3655 )
3656 }
3657}
3658
3659#[cfg(target_os = "fuchsia")]
3660impl From<DeviceExtraConnectorSynchronousProxy> for zx::NullableHandle {
3661 fn from(value: DeviceExtraConnectorSynchronousProxy) -> Self {
3662 value.into_channel().into()
3663 }
3664}
3665
3666#[cfg(target_os = "fuchsia")]
3667impl From<fidl::Channel> for DeviceExtraConnectorSynchronousProxy {
3668 fn from(value: fidl::Channel) -> Self {
3669 Self::new(value)
3670 }
3671}
3672
3673#[cfg(target_os = "fuchsia")]
3674impl fidl::endpoints::FromClient for DeviceExtraConnectorSynchronousProxy {
3675 type Protocol = DeviceExtraConnectorMarker;
3676
3677 fn from_client(value: fidl::endpoints::ClientEnd<DeviceExtraConnectorMarker>) -> Self {
3678 Self::new(value.into_channel())
3679 }
3680}
3681
3682#[derive(Debug, Clone)]
3683pub struct DeviceExtraConnectorProxy {
3684 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3685}
3686
3687impl fidl::endpoints::Proxy for DeviceExtraConnectorProxy {
3688 type Protocol = DeviceExtraConnectorMarker;
3689
3690 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3691 Self::new(inner)
3692 }
3693
3694 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3695 self.client.into_channel().map_err(|client| Self { client })
3696 }
3697
3698 fn as_channel(&self) -> &::fidl::AsyncChannel {
3699 self.client.as_channel()
3700 }
3701}
3702
3703impl DeviceExtraConnectorProxy {
3704 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3706 let protocol_name =
3707 <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3708 Self { client: fidl::client::Client::new(channel, protocol_name) }
3709 }
3710
3711 pub fn take_event_stream(&self) -> DeviceExtraConnectorEventStream {
3717 DeviceExtraConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3718 }
3719
3720 pub fn r#connect(
3737 &self,
3738 mut name: &str,
3739 mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3740 ) -> Result<(), fidl::Error> {
3741 DeviceExtraConnectorProxyInterface::r#connect(self, name, server_end)
3742 }
3743}
3744
3745impl DeviceExtraConnectorProxyInterface for DeviceExtraConnectorProxy {
3746 fn r#connect(
3747 &self,
3748 mut name: &str,
3749 mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3750 ) -> Result<(), fidl::Error> {
3751 self.client.send::<DeviceExtraConnectorConnectRequest>(
3752 (name, server_end),
3753 0x2959be873ae18ae3,
3754 fidl::encoding::DynamicFlags::empty(),
3755 )
3756 }
3757}
3758
3759pub struct DeviceExtraConnectorEventStream {
3760 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3761}
3762
3763impl std::marker::Unpin for DeviceExtraConnectorEventStream {}
3764
3765impl futures::stream::FusedStream for DeviceExtraConnectorEventStream {
3766 fn is_terminated(&self) -> bool {
3767 self.event_receiver.is_terminated()
3768 }
3769}
3770
3771impl futures::Stream for DeviceExtraConnectorEventStream {
3772 type Item = Result<DeviceExtraConnectorEvent, fidl::Error>;
3773
3774 fn poll_next(
3775 mut self: std::pin::Pin<&mut Self>,
3776 cx: &mut std::task::Context<'_>,
3777 ) -> std::task::Poll<Option<Self::Item>> {
3778 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3779 &mut self.event_receiver,
3780 cx
3781 )?) {
3782 Some(buf) => std::task::Poll::Ready(Some(DeviceExtraConnectorEvent::decode(buf))),
3783 None => std::task::Poll::Ready(None),
3784 }
3785 }
3786}
3787
3788#[derive(Debug)]
3789pub enum DeviceExtraConnectorEvent {}
3790
3791impl DeviceExtraConnectorEvent {
3792 fn decode(
3794 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3795 ) -> Result<DeviceExtraConnectorEvent, fidl::Error> {
3796 let (bytes, _handles) = buf.split_mut();
3797 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3798 debug_assert_eq!(tx_header.tx_id, 0);
3799 match tx_header.ordinal {
3800 _ => Err(fidl::Error::UnknownOrdinal {
3801 ordinal: tx_header.ordinal,
3802 protocol_name:
3803 <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3804 }),
3805 }
3806 }
3807}
3808
3809pub struct DeviceExtraConnectorRequestStream {
3811 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3812 is_terminated: bool,
3813}
3814
3815impl std::marker::Unpin for DeviceExtraConnectorRequestStream {}
3816
3817impl futures::stream::FusedStream for DeviceExtraConnectorRequestStream {
3818 fn is_terminated(&self) -> bool {
3819 self.is_terminated
3820 }
3821}
3822
3823impl fidl::endpoints::RequestStream for DeviceExtraConnectorRequestStream {
3824 type Protocol = DeviceExtraConnectorMarker;
3825 type ControlHandle = DeviceExtraConnectorControlHandle;
3826
3827 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3828 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3829 }
3830
3831 fn control_handle(&self) -> Self::ControlHandle {
3832 DeviceExtraConnectorControlHandle { inner: self.inner.clone() }
3833 }
3834
3835 fn into_inner(
3836 self,
3837 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3838 {
3839 (self.inner, self.is_terminated)
3840 }
3841
3842 fn from_inner(
3843 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3844 is_terminated: bool,
3845 ) -> Self {
3846 Self { inner, is_terminated }
3847 }
3848}
3849
3850impl futures::Stream for DeviceExtraConnectorRequestStream {
3851 type Item = Result<DeviceExtraConnectorRequest, fidl::Error>;
3852
3853 fn poll_next(
3854 mut self: std::pin::Pin<&mut Self>,
3855 cx: &mut std::task::Context<'_>,
3856 ) -> std::task::Poll<Option<Self::Item>> {
3857 let this = &mut *self;
3858 if this.inner.check_shutdown(cx) {
3859 this.is_terminated = true;
3860 return std::task::Poll::Ready(None);
3861 }
3862 if this.is_terminated {
3863 panic!("polled DeviceExtraConnectorRequestStream after completion");
3864 }
3865 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3866 |bytes, handles| {
3867 match this.inner.channel().read_etc(cx, bytes, handles) {
3868 std::task::Poll::Ready(Ok(())) => {}
3869 std::task::Poll::Pending => return std::task::Poll::Pending,
3870 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3871 this.is_terminated = true;
3872 return std::task::Poll::Ready(None);
3873 }
3874 std::task::Poll::Ready(Err(e)) => {
3875 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3876 e.into(),
3877 ))));
3878 }
3879 }
3880
3881 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3883
3884 std::task::Poll::Ready(Some(match header.ordinal {
3885 0x2959be873ae18ae3 => {
3886 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3887 let mut req = fidl::new_empty!(DeviceExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3888 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceExtraConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3889 let control_handle = DeviceExtraConnectorControlHandle {
3890 inner: this.inner.clone(),
3891 };
3892 Ok(DeviceExtraConnectorRequest::Connect {name: req.name,
3893server_end: req.server_end,
3894
3895 control_handle,
3896 })
3897 }
3898 _ => Err(fidl::Error::UnknownOrdinal {
3899 ordinal: header.ordinal,
3900 protocol_name: <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3901 }),
3902 }))
3903 },
3904 )
3905 }
3906}
3907
3908#[derive(Debug)]
3911pub enum DeviceExtraConnectorRequest {
3912 Connect {
3929 name: String,
3930 server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3931 control_handle: DeviceExtraConnectorControlHandle,
3932 },
3933}
3934
3935impl DeviceExtraConnectorRequest {
3936 #[allow(irrefutable_let_patterns)]
3937 pub fn into_connect(
3938 self,
3939 ) -> Option<(
3940 String,
3941 fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3942 DeviceExtraConnectorControlHandle,
3943 )> {
3944 if let DeviceExtraConnectorRequest::Connect { name, server_end, control_handle } = self {
3945 Some((name, server_end, control_handle))
3946 } else {
3947 None
3948 }
3949 }
3950
3951 pub fn method_name(&self) -> &'static str {
3953 match *self {
3954 DeviceExtraConnectorRequest::Connect { .. } => "connect",
3955 }
3956 }
3957}
3958
3959#[derive(Debug, Clone)]
3960pub struct DeviceExtraConnectorControlHandle {
3961 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3962}
3963
3964impl DeviceExtraConnectorControlHandle {
3965 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3966 self.inner.shutdown_with_epitaph(status.into())
3967 }
3968}
3969
3970impl fidl::endpoints::ControlHandle for DeviceExtraConnectorControlHandle {
3971 fn shutdown(&self) {
3972 self.inner.shutdown()
3973 }
3974
3975 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3976 self.inner.shutdown_with_epitaph(status)
3977 }
3978
3979 fn is_closed(&self) -> bool {
3980 self.inner.channel().is_closed()
3981 }
3982 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3983 self.inner.channel().on_closed()
3984 }
3985
3986 #[cfg(target_os = "fuchsia")]
3987 fn signal_peer(
3988 &self,
3989 clear_mask: zx::Signals,
3990 set_mask: zx::Signals,
3991 ) -> Result<(), zx_status::Status> {
3992 use fidl::Peered;
3993 self.inner.channel().signal_peer(clear_mask, set_mask)
3994 }
3995}
3996
3997impl DeviceExtraConnectorControlHandle {}
3998
3999#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4000pub struct EnergyScanMarker;
4001
4002impl fidl::endpoints::ProtocolMarker for EnergyScanMarker {
4003 type Proxy = EnergyScanProxy;
4004 type RequestStream = EnergyScanRequestStream;
4005 #[cfg(target_os = "fuchsia")]
4006 type SynchronousProxy = EnergyScanSynchronousProxy;
4007
4008 const DEBUG_NAME: &'static str = "(anonymous) EnergyScan";
4009}
4010
4011pub trait EnergyScanProxyInterface: Send + Sync {
4012 fn r#start_energy_scan(
4013 &self,
4014 params: &EnergyScanParameters,
4015 stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4016 ) -> Result<(), fidl::Error>;
4017}
4018#[derive(Debug)]
4019#[cfg(target_os = "fuchsia")]
4020pub struct EnergyScanSynchronousProxy {
4021 client: fidl::client::sync::Client,
4022}
4023
4024#[cfg(target_os = "fuchsia")]
4025impl fidl::endpoints::SynchronousProxy for EnergyScanSynchronousProxy {
4026 type Proxy = EnergyScanProxy;
4027 type Protocol = EnergyScanMarker;
4028
4029 fn from_channel(inner: fidl::Channel) -> Self {
4030 Self::new(inner)
4031 }
4032
4033 fn into_channel(self) -> fidl::Channel {
4034 self.client.into_channel()
4035 }
4036
4037 fn as_channel(&self) -> &fidl::Channel {
4038 self.client.as_channel()
4039 }
4040}
4041
4042#[cfg(target_os = "fuchsia")]
4043impl EnergyScanSynchronousProxy {
4044 pub fn new(channel: fidl::Channel) -> Self {
4045 Self { client: fidl::client::sync::Client::new(channel) }
4046 }
4047
4048 pub fn into_channel(self) -> fidl::Channel {
4049 self.client.into_channel()
4050 }
4051
4052 pub fn wait_for_event(
4055 &self,
4056 deadline: zx::MonotonicInstant,
4057 ) -> Result<EnergyScanEvent, fidl::Error> {
4058 EnergyScanEvent::decode(self.client.wait_for_event::<EnergyScanMarker>(deadline)?)
4059 }
4060
4061 pub fn r#start_energy_scan(
4082 &self,
4083 mut params: &EnergyScanParameters,
4084 mut stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4085 ) -> Result<(), fidl::Error> {
4086 self.client.send::<EnergyScanStartEnergyScanRequest>(
4087 (params, stream),
4088 0x4b2928a05c619b06,
4089 fidl::encoding::DynamicFlags::empty(),
4090 )
4091 }
4092}
4093
4094#[cfg(target_os = "fuchsia")]
4095impl From<EnergyScanSynchronousProxy> for zx::NullableHandle {
4096 fn from(value: EnergyScanSynchronousProxy) -> Self {
4097 value.into_channel().into()
4098 }
4099}
4100
4101#[cfg(target_os = "fuchsia")]
4102impl From<fidl::Channel> for EnergyScanSynchronousProxy {
4103 fn from(value: fidl::Channel) -> Self {
4104 Self::new(value)
4105 }
4106}
4107
4108#[cfg(target_os = "fuchsia")]
4109impl fidl::endpoints::FromClient for EnergyScanSynchronousProxy {
4110 type Protocol = EnergyScanMarker;
4111
4112 fn from_client(value: fidl::endpoints::ClientEnd<EnergyScanMarker>) -> Self {
4113 Self::new(value.into_channel())
4114 }
4115}
4116
4117#[derive(Debug, Clone)]
4118pub struct EnergyScanProxy {
4119 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4120}
4121
4122impl fidl::endpoints::Proxy for EnergyScanProxy {
4123 type Protocol = EnergyScanMarker;
4124
4125 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4126 Self::new(inner)
4127 }
4128
4129 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4130 self.client.into_channel().map_err(|client| Self { client })
4131 }
4132
4133 fn as_channel(&self) -> &::fidl::AsyncChannel {
4134 self.client.as_channel()
4135 }
4136}
4137
4138impl EnergyScanProxy {
4139 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4141 let protocol_name = <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4142 Self { client: fidl::client::Client::new(channel, protocol_name) }
4143 }
4144
4145 pub fn take_event_stream(&self) -> EnergyScanEventStream {
4151 EnergyScanEventStream { event_receiver: self.client.take_event_receiver() }
4152 }
4153
4154 pub fn r#start_energy_scan(
4175 &self,
4176 mut params: &EnergyScanParameters,
4177 mut stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4178 ) -> Result<(), fidl::Error> {
4179 EnergyScanProxyInterface::r#start_energy_scan(self, params, stream)
4180 }
4181}
4182
4183impl EnergyScanProxyInterface for EnergyScanProxy {
4184 fn r#start_energy_scan(
4185 &self,
4186 mut params: &EnergyScanParameters,
4187 mut stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4188 ) -> Result<(), fidl::Error> {
4189 self.client.send::<EnergyScanStartEnergyScanRequest>(
4190 (params, stream),
4191 0x4b2928a05c619b06,
4192 fidl::encoding::DynamicFlags::empty(),
4193 )
4194 }
4195}
4196
4197pub struct EnergyScanEventStream {
4198 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4199}
4200
4201impl std::marker::Unpin for EnergyScanEventStream {}
4202
4203impl futures::stream::FusedStream for EnergyScanEventStream {
4204 fn is_terminated(&self) -> bool {
4205 self.event_receiver.is_terminated()
4206 }
4207}
4208
4209impl futures::Stream for EnergyScanEventStream {
4210 type Item = Result<EnergyScanEvent, fidl::Error>;
4211
4212 fn poll_next(
4213 mut self: std::pin::Pin<&mut Self>,
4214 cx: &mut std::task::Context<'_>,
4215 ) -> std::task::Poll<Option<Self::Item>> {
4216 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4217 &mut self.event_receiver,
4218 cx
4219 )?) {
4220 Some(buf) => std::task::Poll::Ready(Some(EnergyScanEvent::decode(buf))),
4221 None => std::task::Poll::Ready(None),
4222 }
4223 }
4224}
4225
4226#[derive(Debug)]
4227pub enum EnergyScanEvent {}
4228
4229impl EnergyScanEvent {
4230 fn decode(
4232 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4233 ) -> Result<EnergyScanEvent, fidl::Error> {
4234 let (bytes, _handles) = buf.split_mut();
4235 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4236 debug_assert_eq!(tx_header.tx_id, 0);
4237 match tx_header.ordinal {
4238 _ => Err(fidl::Error::UnknownOrdinal {
4239 ordinal: tx_header.ordinal,
4240 protocol_name: <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4241 }),
4242 }
4243 }
4244}
4245
4246pub struct EnergyScanRequestStream {
4248 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4249 is_terminated: bool,
4250}
4251
4252impl std::marker::Unpin for EnergyScanRequestStream {}
4253
4254impl futures::stream::FusedStream for EnergyScanRequestStream {
4255 fn is_terminated(&self) -> bool {
4256 self.is_terminated
4257 }
4258}
4259
4260impl fidl::endpoints::RequestStream for EnergyScanRequestStream {
4261 type Protocol = EnergyScanMarker;
4262 type ControlHandle = EnergyScanControlHandle;
4263
4264 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4265 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4266 }
4267
4268 fn control_handle(&self) -> Self::ControlHandle {
4269 EnergyScanControlHandle { inner: self.inner.clone() }
4270 }
4271
4272 fn into_inner(
4273 self,
4274 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4275 {
4276 (self.inner, self.is_terminated)
4277 }
4278
4279 fn from_inner(
4280 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4281 is_terminated: bool,
4282 ) -> Self {
4283 Self { inner, is_terminated }
4284 }
4285}
4286
4287impl futures::Stream for EnergyScanRequestStream {
4288 type Item = Result<EnergyScanRequest, fidl::Error>;
4289
4290 fn poll_next(
4291 mut self: std::pin::Pin<&mut Self>,
4292 cx: &mut std::task::Context<'_>,
4293 ) -> std::task::Poll<Option<Self::Item>> {
4294 let this = &mut *self;
4295 if this.inner.check_shutdown(cx) {
4296 this.is_terminated = true;
4297 return std::task::Poll::Ready(None);
4298 }
4299 if this.is_terminated {
4300 panic!("polled EnergyScanRequestStream after completion");
4301 }
4302 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4303 |bytes, handles| {
4304 match this.inner.channel().read_etc(cx, bytes, handles) {
4305 std::task::Poll::Ready(Ok(())) => {}
4306 std::task::Poll::Pending => return std::task::Poll::Pending,
4307 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4308 this.is_terminated = true;
4309 return std::task::Poll::Ready(None);
4310 }
4311 std::task::Poll::Ready(Err(e)) => {
4312 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4313 e.into(),
4314 ))));
4315 }
4316 }
4317
4318 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4320
4321 std::task::Poll::Ready(Some(match header.ordinal {
4322 0x4b2928a05c619b06 => {
4323 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4324 let mut req = fidl::new_empty!(
4325 EnergyScanStartEnergyScanRequest,
4326 fidl::encoding::DefaultFuchsiaResourceDialect
4327 );
4328 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EnergyScanStartEnergyScanRequest>(&header, _body_bytes, handles, &mut req)?;
4329 let control_handle = EnergyScanControlHandle { inner: this.inner.clone() };
4330 Ok(EnergyScanRequest::StartEnergyScan {
4331 params: req.params,
4332 stream: req.stream,
4333
4334 control_handle,
4335 })
4336 }
4337 _ => Err(fidl::Error::UnknownOrdinal {
4338 ordinal: header.ordinal,
4339 protocol_name:
4340 <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4341 }),
4342 }))
4343 },
4344 )
4345 }
4346}
4347
4348#[derive(Debug)]
4349pub enum EnergyScanRequest {
4350 StartEnergyScan {
4371 params: EnergyScanParameters,
4372 stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4373 control_handle: EnergyScanControlHandle,
4374 },
4375}
4376
4377impl EnergyScanRequest {
4378 #[allow(irrefutable_let_patterns)]
4379 pub fn into_start_energy_scan(
4380 self,
4381 ) -> Option<(
4382 EnergyScanParameters,
4383 fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4384 EnergyScanControlHandle,
4385 )> {
4386 if let EnergyScanRequest::StartEnergyScan { params, stream, control_handle } = self {
4387 Some((params, stream, control_handle))
4388 } else {
4389 None
4390 }
4391 }
4392
4393 pub fn method_name(&self) -> &'static str {
4395 match *self {
4396 EnergyScanRequest::StartEnergyScan { .. } => "start_energy_scan",
4397 }
4398 }
4399}
4400
4401#[derive(Debug, Clone)]
4402pub struct EnergyScanControlHandle {
4403 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4404}
4405
4406impl EnergyScanControlHandle {
4407 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4408 self.inner.shutdown_with_epitaph(status.into())
4409 }
4410}
4411
4412impl fidl::endpoints::ControlHandle for EnergyScanControlHandle {
4413 fn shutdown(&self) {
4414 self.inner.shutdown()
4415 }
4416
4417 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4418 self.inner.shutdown_with_epitaph(status)
4419 }
4420
4421 fn is_closed(&self) -> bool {
4422 self.inner.channel().is_closed()
4423 }
4424 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4425 self.inner.channel().on_closed()
4426 }
4427
4428 #[cfg(target_os = "fuchsia")]
4429 fn signal_peer(
4430 &self,
4431 clear_mask: zx::Signals,
4432 set_mask: zx::Signals,
4433 ) -> Result<(), zx_status::Status> {
4434 use fidl::Peered;
4435 self.inner.channel().signal_peer(clear_mask, set_mask)
4436 }
4437}
4438
4439impl EnergyScanControlHandle {}
4440
4441#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4442pub struct EnergyScanConnectorMarker;
4443
4444impl fidl::endpoints::ProtocolMarker for EnergyScanConnectorMarker {
4445 type Proxy = EnergyScanConnectorProxy;
4446 type RequestStream = EnergyScanConnectorRequestStream;
4447 #[cfg(target_os = "fuchsia")]
4448 type SynchronousProxy = EnergyScanConnectorSynchronousProxy;
4449
4450 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.EnergyScanConnector";
4451}
4452impl fidl::endpoints::DiscoverableProtocolMarker for EnergyScanConnectorMarker {}
4453
4454pub trait EnergyScanConnectorProxyInterface: Send + Sync {
4455 fn r#connect(
4456 &self,
4457 name: &str,
4458 server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4459 ) -> Result<(), fidl::Error>;
4460}
4461#[derive(Debug)]
4462#[cfg(target_os = "fuchsia")]
4463pub struct EnergyScanConnectorSynchronousProxy {
4464 client: fidl::client::sync::Client,
4465}
4466
4467#[cfg(target_os = "fuchsia")]
4468impl fidl::endpoints::SynchronousProxy for EnergyScanConnectorSynchronousProxy {
4469 type Proxy = EnergyScanConnectorProxy;
4470 type Protocol = EnergyScanConnectorMarker;
4471
4472 fn from_channel(inner: fidl::Channel) -> Self {
4473 Self::new(inner)
4474 }
4475
4476 fn into_channel(self) -> fidl::Channel {
4477 self.client.into_channel()
4478 }
4479
4480 fn as_channel(&self) -> &fidl::Channel {
4481 self.client.as_channel()
4482 }
4483}
4484
4485#[cfg(target_os = "fuchsia")]
4486impl EnergyScanConnectorSynchronousProxy {
4487 pub fn new(channel: fidl::Channel) -> Self {
4488 Self { client: fidl::client::sync::Client::new(channel) }
4489 }
4490
4491 pub fn into_channel(self) -> fidl::Channel {
4492 self.client.into_channel()
4493 }
4494
4495 pub fn wait_for_event(
4498 &self,
4499 deadline: zx::MonotonicInstant,
4500 ) -> Result<EnergyScanConnectorEvent, fidl::Error> {
4501 EnergyScanConnectorEvent::decode(
4502 self.client.wait_for_event::<EnergyScanConnectorMarker>(deadline)?,
4503 )
4504 }
4505
4506 pub fn r#connect(
4523 &self,
4524 mut name: &str,
4525 mut server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4526 ) -> Result<(), fidl::Error> {
4527 self.client.send::<EnergyScanConnectorConnectRequest>(
4528 (name, server_end),
4529 0x1076a774e74ab290,
4530 fidl::encoding::DynamicFlags::empty(),
4531 )
4532 }
4533}
4534
4535#[cfg(target_os = "fuchsia")]
4536impl From<EnergyScanConnectorSynchronousProxy> for zx::NullableHandle {
4537 fn from(value: EnergyScanConnectorSynchronousProxy) -> Self {
4538 value.into_channel().into()
4539 }
4540}
4541
4542#[cfg(target_os = "fuchsia")]
4543impl From<fidl::Channel> for EnergyScanConnectorSynchronousProxy {
4544 fn from(value: fidl::Channel) -> Self {
4545 Self::new(value)
4546 }
4547}
4548
4549#[cfg(target_os = "fuchsia")]
4550impl fidl::endpoints::FromClient for EnergyScanConnectorSynchronousProxy {
4551 type Protocol = EnergyScanConnectorMarker;
4552
4553 fn from_client(value: fidl::endpoints::ClientEnd<EnergyScanConnectorMarker>) -> Self {
4554 Self::new(value.into_channel())
4555 }
4556}
4557
4558#[derive(Debug, Clone)]
4559pub struct EnergyScanConnectorProxy {
4560 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4561}
4562
4563impl fidl::endpoints::Proxy for EnergyScanConnectorProxy {
4564 type Protocol = EnergyScanConnectorMarker;
4565
4566 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4567 Self::new(inner)
4568 }
4569
4570 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4571 self.client.into_channel().map_err(|client| Self { client })
4572 }
4573
4574 fn as_channel(&self) -> &::fidl::AsyncChannel {
4575 self.client.as_channel()
4576 }
4577}
4578
4579impl EnergyScanConnectorProxy {
4580 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4582 let protocol_name =
4583 <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4584 Self { client: fidl::client::Client::new(channel, protocol_name) }
4585 }
4586
4587 pub fn take_event_stream(&self) -> EnergyScanConnectorEventStream {
4593 EnergyScanConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4594 }
4595
4596 pub fn r#connect(
4613 &self,
4614 mut name: &str,
4615 mut server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4616 ) -> Result<(), fidl::Error> {
4617 EnergyScanConnectorProxyInterface::r#connect(self, name, server_end)
4618 }
4619}
4620
4621impl EnergyScanConnectorProxyInterface for EnergyScanConnectorProxy {
4622 fn r#connect(
4623 &self,
4624 mut name: &str,
4625 mut server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4626 ) -> Result<(), fidl::Error> {
4627 self.client.send::<EnergyScanConnectorConnectRequest>(
4628 (name, server_end),
4629 0x1076a774e74ab290,
4630 fidl::encoding::DynamicFlags::empty(),
4631 )
4632 }
4633}
4634
4635pub struct EnergyScanConnectorEventStream {
4636 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4637}
4638
4639impl std::marker::Unpin for EnergyScanConnectorEventStream {}
4640
4641impl futures::stream::FusedStream for EnergyScanConnectorEventStream {
4642 fn is_terminated(&self) -> bool {
4643 self.event_receiver.is_terminated()
4644 }
4645}
4646
4647impl futures::Stream for EnergyScanConnectorEventStream {
4648 type Item = Result<EnergyScanConnectorEvent, fidl::Error>;
4649
4650 fn poll_next(
4651 mut self: std::pin::Pin<&mut Self>,
4652 cx: &mut std::task::Context<'_>,
4653 ) -> std::task::Poll<Option<Self::Item>> {
4654 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4655 &mut self.event_receiver,
4656 cx
4657 )?) {
4658 Some(buf) => std::task::Poll::Ready(Some(EnergyScanConnectorEvent::decode(buf))),
4659 None => std::task::Poll::Ready(None),
4660 }
4661 }
4662}
4663
4664#[derive(Debug)]
4665pub enum EnergyScanConnectorEvent {}
4666
4667impl EnergyScanConnectorEvent {
4668 fn decode(
4670 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4671 ) -> Result<EnergyScanConnectorEvent, fidl::Error> {
4672 let (bytes, _handles) = buf.split_mut();
4673 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4674 debug_assert_eq!(tx_header.tx_id, 0);
4675 match tx_header.ordinal {
4676 _ => Err(fidl::Error::UnknownOrdinal {
4677 ordinal: tx_header.ordinal,
4678 protocol_name:
4679 <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4680 }),
4681 }
4682 }
4683}
4684
4685pub struct EnergyScanConnectorRequestStream {
4687 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4688 is_terminated: bool,
4689}
4690
4691impl std::marker::Unpin for EnergyScanConnectorRequestStream {}
4692
4693impl futures::stream::FusedStream for EnergyScanConnectorRequestStream {
4694 fn is_terminated(&self) -> bool {
4695 self.is_terminated
4696 }
4697}
4698
4699impl fidl::endpoints::RequestStream for EnergyScanConnectorRequestStream {
4700 type Protocol = EnergyScanConnectorMarker;
4701 type ControlHandle = EnergyScanConnectorControlHandle;
4702
4703 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4704 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4705 }
4706
4707 fn control_handle(&self) -> Self::ControlHandle {
4708 EnergyScanConnectorControlHandle { inner: self.inner.clone() }
4709 }
4710
4711 fn into_inner(
4712 self,
4713 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4714 {
4715 (self.inner, self.is_terminated)
4716 }
4717
4718 fn from_inner(
4719 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4720 is_terminated: bool,
4721 ) -> Self {
4722 Self { inner, is_terminated }
4723 }
4724}
4725
4726impl futures::Stream for EnergyScanConnectorRequestStream {
4727 type Item = Result<EnergyScanConnectorRequest, fidl::Error>;
4728
4729 fn poll_next(
4730 mut self: std::pin::Pin<&mut Self>,
4731 cx: &mut std::task::Context<'_>,
4732 ) -> std::task::Poll<Option<Self::Item>> {
4733 let this = &mut *self;
4734 if this.inner.check_shutdown(cx) {
4735 this.is_terminated = true;
4736 return std::task::Poll::Ready(None);
4737 }
4738 if this.is_terminated {
4739 panic!("polled EnergyScanConnectorRequestStream after completion");
4740 }
4741 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4742 |bytes, handles| {
4743 match this.inner.channel().read_etc(cx, bytes, handles) {
4744 std::task::Poll::Ready(Ok(())) => {}
4745 std::task::Poll::Pending => return std::task::Poll::Pending,
4746 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4747 this.is_terminated = true;
4748 return std::task::Poll::Ready(None);
4749 }
4750 std::task::Poll::Ready(Err(e)) => {
4751 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4752 e.into(),
4753 ))));
4754 }
4755 }
4756
4757 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4759
4760 std::task::Poll::Ready(Some(match header.ordinal {
4761 0x1076a774e74ab290 => {
4762 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4763 let mut req = fidl::new_empty!(EnergyScanConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4764 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EnergyScanConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4765 let control_handle = EnergyScanConnectorControlHandle {
4766 inner: this.inner.clone(),
4767 };
4768 Ok(EnergyScanConnectorRequest::Connect {name: req.name,
4769server_end: req.server_end,
4770
4771 control_handle,
4772 })
4773 }
4774 _ => Err(fidl::Error::UnknownOrdinal {
4775 ordinal: header.ordinal,
4776 protocol_name: <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4777 }),
4778 }))
4779 },
4780 )
4781 }
4782}
4783
4784#[derive(Debug)]
4787pub enum EnergyScanConnectorRequest {
4788 Connect {
4805 name: String,
4806 server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4807 control_handle: EnergyScanConnectorControlHandle,
4808 },
4809}
4810
4811impl EnergyScanConnectorRequest {
4812 #[allow(irrefutable_let_patterns)]
4813 pub fn into_connect(
4814 self,
4815 ) -> Option<(
4816 String,
4817 fidl::endpoints::ServerEnd<EnergyScanMarker>,
4818 EnergyScanConnectorControlHandle,
4819 )> {
4820 if let EnergyScanConnectorRequest::Connect { name, server_end, control_handle } = self {
4821 Some((name, server_end, control_handle))
4822 } else {
4823 None
4824 }
4825 }
4826
4827 pub fn method_name(&self) -> &'static str {
4829 match *self {
4830 EnergyScanConnectorRequest::Connect { .. } => "connect",
4831 }
4832 }
4833}
4834
4835#[derive(Debug, Clone)]
4836pub struct EnergyScanConnectorControlHandle {
4837 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4838}
4839
4840impl EnergyScanConnectorControlHandle {
4841 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4842 self.inner.shutdown_with_epitaph(status.into())
4843 }
4844}
4845
4846impl fidl::endpoints::ControlHandle for EnergyScanConnectorControlHandle {
4847 fn shutdown(&self) {
4848 self.inner.shutdown()
4849 }
4850
4851 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4852 self.inner.shutdown_with_epitaph(status)
4853 }
4854
4855 fn is_closed(&self) -> bool {
4856 self.inner.channel().is_closed()
4857 }
4858 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4859 self.inner.channel().on_closed()
4860 }
4861
4862 #[cfg(target_os = "fuchsia")]
4863 fn signal_peer(
4864 &self,
4865 clear_mask: zx::Signals,
4866 set_mask: zx::Signals,
4867 ) -> Result<(), zx_status::Status> {
4868 use fidl::Peered;
4869 self.inner.channel().signal_peer(clear_mask, set_mask)
4870 }
4871}
4872
4873impl EnergyScanConnectorControlHandle {}
4874
4875#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4876pub struct EnergyScanResultStreamMarker;
4877
4878impl fidl::endpoints::ProtocolMarker for EnergyScanResultStreamMarker {
4879 type Proxy = EnergyScanResultStreamProxy;
4880 type RequestStream = EnergyScanResultStreamRequestStream;
4881 #[cfg(target_os = "fuchsia")]
4882 type SynchronousProxy = EnergyScanResultStreamSynchronousProxy;
4883
4884 const DEBUG_NAME: &'static str = "(anonymous) EnergyScanResultStream";
4885}
4886
4887pub trait EnergyScanResultStreamProxyInterface: Send + Sync {
4888 type NextResponseFut: std::future::Future<Output = Result<Vec<EnergyScanResult>, fidl::Error>>
4889 + Send;
4890 fn r#next(&self) -> Self::NextResponseFut;
4891}
4892#[derive(Debug)]
4893#[cfg(target_os = "fuchsia")]
4894pub struct EnergyScanResultStreamSynchronousProxy {
4895 client: fidl::client::sync::Client,
4896}
4897
4898#[cfg(target_os = "fuchsia")]
4899impl fidl::endpoints::SynchronousProxy for EnergyScanResultStreamSynchronousProxy {
4900 type Proxy = EnergyScanResultStreamProxy;
4901 type Protocol = EnergyScanResultStreamMarker;
4902
4903 fn from_channel(inner: fidl::Channel) -> Self {
4904 Self::new(inner)
4905 }
4906
4907 fn into_channel(self) -> fidl::Channel {
4908 self.client.into_channel()
4909 }
4910
4911 fn as_channel(&self) -> &fidl::Channel {
4912 self.client.as_channel()
4913 }
4914}
4915
4916#[cfg(target_os = "fuchsia")]
4917impl EnergyScanResultStreamSynchronousProxy {
4918 pub fn new(channel: fidl::Channel) -> Self {
4919 Self { client: fidl::client::sync::Client::new(channel) }
4920 }
4921
4922 pub fn into_channel(self) -> fidl::Channel {
4923 self.client.into_channel()
4924 }
4925
4926 pub fn wait_for_event(
4929 &self,
4930 deadline: zx::MonotonicInstant,
4931 ) -> Result<EnergyScanResultStreamEvent, fidl::Error> {
4932 EnergyScanResultStreamEvent::decode(
4933 self.client.wait_for_event::<EnergyScanResultStreamMarker>(deadline)?,
4934 )
4935 }
4936
4937 pub fn r#next(
4941 &self,
4942 ___deadline: zx::MonotonicInstant,
4943 ) -> Result<Vec<EnergyScanResult>, fidl::Error> {
4944 let _response = self.client.send_query::<
4945 fidl::encoding::EmptyPayload,
4946 EnergyScanResultStreamNextResponse,
4947 EnergyScanResultStreamMarker,
4948 >(
4949 (),
4950 0x7f0139fc06fd6a9e,
4951 fidl::encoding::DynamicFlags::empty(),
4952 ___deadline,
4953 )?;
4954 Ok(_response.results)
4955 }
4956}
4957
4958#[cfg(target_os = "fuchsia")]
4959impl From<EnergyScanResultStreamSynchronousProxy> for zx::NullableHandle {
4960 fn from(value: EnergyScanResultStreamSynchronousProxy) -> Self {
4961 value.into_channel().into()
4962 }
4963}
4964
4965#[cfg(target_os = "fuchsia")]
4966impl From<fidl::Channel> for EnergyScanResultStreamSynchronousProxy {
4967 fn from(value: fidl::Channel) -> Self {
4968 Self::new(value)
4969 }
4970}
4971
4972#[cfg(target_os = "fuchsia")]
4973impl fidl::endpoints::FromClient for EnergyScanResultStreamSynchronousProxy {
4974 type Protocol = EnergyScanResultStreamMarker;
4975
4976 fn from_client(value: fidl::endpoints::ClientEnd<EnergyScanResultStreamMarker>) -> Self {
4977 Self::new(value.into_channel())
4978 }
4979}
4980
4981#[derive(Debug, Clone)]
4982pub struct EnergyScanResultStreamProxy {
4983 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4984}
4985
4986impl fidl::endpoints::Proxy for EnergyScanResultStreamProxy {
4987 type Protocol = EnergyScanResultStreamMarker;
4988
4989 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4990 Self::new(inner)
4991 }
4992
4993 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4994 self.client.into_channel().map_err(|client| Self { client })
4995 }
4996
4997 fn as_channel(&self) -> &::fidl::AsyncChannel {
4998 self.client.as_channel()
4999 }
5000}
5001
5002impl EnergyScanResultStreamProxy {
5003 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5005 let protocol_name =
5006 <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5007 Self { client: fidl::client::Client::new(channel, protocol_name) }
5008 }
5009
5010 pub fn take_event_stream(&self) -> EnergyScanResultStreamEventStream {
5016 EnergyScanResultStreamEventStream { event_receiver: self.client.take_event_receiver() }
5017 }
5018
5019 pub fn r#next(
5023 &self,
5024 ) -> fidl::client::QueryResponseFut<
5025 Vec<EnergyScanResult>,
5026 fidl::encoding::DefaultFuchsiaResourceDialect,
5027 > {
5028 EnergyScanResultStreamProxyInterface::r#next(self)
5029 }
5030}
5031
5032impl EnergyScanResultStreamProxyInterface for EnergyScanResultStreamProxy {
5033 type NextResponseFut = fidl::client::QueryResponseFut<
5034 Vec<EnergyScanResult>,
5035 fidl::encoding::DefaultFuchsiaResourceDialect,
5036 >;
5037 fn r#next(&self) -> Self::NextResponseFut {
5038 fn _decode(
5039 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5040 ) -> Result<Vec<EnergyScanResult>, fidl::Error> {
5041 let _response = fidl::client::decode_transaction_body::<
5042 EnergyScanResultStreamNextResponse,
5043 fidl::encoding::DefaultFuchsiaResourceDialect,
5044 0x7f0139fc06fd6a9e,
5045 >(_buf?)?;
5046 Ok(_response.results)
5047 }
5048 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EnergyScanResult>>(
5049 (),
5050 0x7f0139fc06fd6a9e,
5051 fidl::encoding::DynamicFlags::empty(),
5052 _decode,
5053 )
5054 }
5055}
5056
5057pub struct EnergyScanResultStreamEventStream {
5058 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5059}
5060
5061impl std::marker::Unpin for EnergyScanResultStreamEventStream {}
5062
5063impl futures::stream::FusedStream for EnergyScanResultStreamEventStream {
5064 fn is_terminated(&self) -> bool {
5065 self.event_receiver.is_terminated()
5066 }
5067}
5068
5069impl futures::Stream for EnergyScanResultStreamEventStream {
5070 type Item = Result<EnergyScanResultStreamEvent, fidl::Error>;
5071
5072 fn poll_next(
5073 mut self: std::pin::Pin<&mut Self>,
5074 cx: &mut std::task::Context<'_>,
5075 ) -> std::task::Poll<Option<Self::Item>> {
5076 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5077 &mut self.event_receiver,
5078 cx
5079 )?) {
5080 Some(buf) => std::task::Poll::Ready(Some(EnergyScanResultStreamEvent::decode(buf))),
5081 None => std::task::Poll::Ready(None),
5082 }
5083 }
5084}
5085
5086#[derive(Debug)]
5087pub enum EnergyScanResultStreamEvent {}
5088
5089impl EnergyScanResultStreamEvent {
5090 fn decode(
5092 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5093 ) -> Result<EnergyScanResultStreamEvent, fidl::Error> {
5094 let (bytes, _handles) = buf.split_mut();
5095 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5096 debug_assert_eq!(tx_header.tx_id, 0);
5097 match tx_header.ordinal {
5098 _ => Err(fidl::Error::UnknownOrdinal {
5099 ordinal: tx_header.ordinal,
5100 protocol_name:
5101 <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5102 }),
5103 }
5104 }
5105}
5106
5107pub struct EnergyScanResultStreamRequestStream {
5109 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5110 is_terminated: bool,
5111}
5112
5113impl std::marker::Unpin for EnergyScanResultStreamRequestStream {}
5114
5115impl futures::stream::FusedStream for EnergyScanResultStreamRequestStream {
5116 fn is_terminated(&self) -> bool {
5117 self.is_terminated
5118 }
5119}
5120
5121impl fidl::endpoints::RequestStream for EnergyScanResultStreamRequestStream {
5122 type Protocol = EnergyScanResultStreamMarker;
5123 type ControlHandle = EnergyScanResultStreamControlHandle;
5124
5125 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5126 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5127 }
5128
5129 fn control_handle(&self) -> Self::ControlHandle {
5130 EnergyScanResultStreamControlHandle { inner: self.inner.clone() }
5131 }
5132
5133 fn into_inner(
5134 self,
5135 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5136 {
5137 (self.inner, self.is_terminated)
5138 }
5139
5140 fn from_inner(
5141 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5142 is_terminated: bool,
5143 ) -> Self {
5144 Self { inner, is_terminated }
5145 }
5146}
5147
5148impl futures::Stream for EnergyScanResultStreamRequestStream {
5149 type Item = Result<EnergyScanResultStreamRequest, fidl::Error>;
5150
5151 fn poll_next(
5152 mut self: std::pin::Pin<&mut Self>,
5153 cx: &mut std::task::Context<'_>,
5154 ) -> std::task::Poll<Option<Self::Item>> {
5155 let this = &mut *self;
5156 if this.inner.check_shutdown(cx) {
5157 this.is_terminated = true;
5158 return std::task::Poll::Ready(None);
5159 }
5160 if this.is_terminated {
5161 panic!("polled EnergyScanResultStreamRequestStream after completion");
5162 }
5163 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5164 |bytes, handles| {
5165 match this.inner.channel().read_etc(cx, bytes, handles) {
5166 std::task::Poll::Ready(Ok(())) => {}
5167 std::task::Poll::Pending => return std::task::Poll::Pending,
5168 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5169 this.is_terminated = true;
5170 return std::task::Poll::Ready(None);
5171 }
5172 std::task::Poll::Ready(Err(e)) => {
5173 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5174 e.into(),
5175 ))));
5176 }
5177 }
5178
5179 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5181
5182 std::task::Poll::Ready(Some(match header.ordinal {
5183 0x7f0139fc06fd6a9e => {
5184 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5185 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5186 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5187 let control_handle = EnergyScanResultStreamControlHandle {
5188 inner: this.inner.clone(),
5189 };
5190 Ok(EnergyScanResultStreamRequest::Next {
5191 responder: EnergyScanResultStreamNextResponder {
5192 control_handle: std::mem::ManuallyDrop::new(control_handle),
5193 tx_id: header.tx_id,
5194 },
5195 })
5196 }
5197 _ => Err(fidl::Error::UnknownOrdinal {
5198 ordinal: header.ordinal,
5199 protocol_name: <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5200 }),
5201 }))
5202 },
5203 )
5204 }
5205}
5206
5207#[derive(Debug)]
5211pub enum EnergyScanResultStreamRequest {
5212 Next { responder: EnergyScanResultStreamNextResponder },
5216}
5217
5218impl EnergyScanResultStreamRequest {
5219 #[allow(irrefutable_let_patterns)]
5220 pub fn into_next(self) -> Option<(EnergyScanResultStreamNextResponder)> {
5221 if let EnergyScanResultStreamRequest::Next { responder } = self {
5222 Some((responder))
5223 } else {
5224 None
5225 }
5226 }
5227
5228 pub fn method_name(&self) -> &'static str {
5230 match *self {
5231 EnergyScanResultStreamRequest::Next { .. } => "next",
5232 }
5233 }
5234}
5235
5236#[derive(Debug, Clone)]
5237pub struct EnergyScanResultStreamControlHandle {
5238 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5239}
5240
5241impl EnergyScanResultStreamControlHandle {
5242 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5243 self.inner.shutdown_with_epitaph(status.into())
5244 }
5245}
5246
5247impl fidl::endpoints::ControlHandle for EnergyScanResultStreamControlHandle {
5248 fn shutdown(&self) {
5249 self.inner.shutdown()
5250 }
5251
5252 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5253 self.inner.shutdown_with_epitaph(status)
5254 }
5255
5256 fn is_closed(&self) -> bool {
5257 self.inner.channel().is_closed()
5258 }
5259 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5260 self.inner.channel().on_closed()
5261 }
5262
5263 #[cfg(target_os = "fuchsia")]
5264 fn signal_peer(
5265 &self,
5266 clear_mask: zx::Signals,
5267 set_mask: zx::Signals,
5268 ) -> Result<(), zx_status::Status> {
5269 use fidl::Peered;
5270 self.inner.channel().signal_peer(clear_mask, set_mask)
5271 }
5272}
5273
5274impl EnergyScanResultStreamControlHandle {}
5275
5276#[must_use = "FIDL methods require a response to be sent"]
5277#[derive(Debug)]
5278pub struct EnergyScanResultStreamNextResponder {
5279 control_handle: std::mem::ManuallyDrop<EnergyScanResultStreamControlHandle>,
5280 tx_id: u32,
5281}
5282
5283impl std::ops::Drop for EnergyScanResultStreamNextResponder {
5287 fn drop(&mut self) {
5288 self.control_handle.shutdown();
5289 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5291 }
5292}
5293
5294impl fidl::endpoints::Responder for EnergyScanResultStreamNextResponder {
5295 type ControlHandle = EnergyScanResultStreamControlHandle;
5296
5297 fn control_handle(&self) -> &EnergyScanResultStreamControlHandle {
5298 &self.control_handle
5299 }
5300
5301 fn drop_without_shutdown(mut self) {
5302 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5304 std::mem::forget(self);
5306 }
5307}
5308
5309impl EnergyScanResultStreamNextResponder {
5310 pub fn send(self, mut results: &[EnergyScanResult]) -> Result<(), fidl::Error> {
5314 let _result = self.send_raw(results);
5315 if _result.is_err() {
5316 self.control_handle.shutdown();
5317 }
5318 self.drop_without_shutdown();
5319 _result
5320 }
5321
5322 pub fn send_no_shutdown_on_err(
5324 self,
5325 mut results: &[EnergyScanResult],
5326 ) -> Result<(), fidl::Error> {
5327 let _result = self.send_raw(results);
5328 self.drop_without_shutdown();
5329 _result
5330 }
5331
5332 fn send_raw(&self, mut results: &[EnergyScanResult]) -> Result<(), fidl::Error> {
5333 self.control_handle.inner.send::<EnergyScanResultStreamNextResponse>(
5334 (results,),
5335 self.tx_id,
5336 0x7f0139fc06fd6a9e,
5337 fidl::encoding::DynamicFlags::empty(),
5338 )
5339 }
5340}
5341
5342mod internal {
5343 use super::*;
5344
5345 impl fidl::encoding::ResourceTypeMarker for CountersConnectorConnectRequest {
5346 type Borrowed<'a> = &'a mut Self;
5347 fn take_or_borrow<'a>(
5348 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5349 ) -> Self::Borrowed<'a> {
5350 value
5351 }
5352 }
5353
5354 unsafe impl fidl::encoding::TypeMarker for CountersConnectorConnectRequest {
5355 type Owned = Self;
5356
5357 #[inline(always)]
5358 fn inline_align(_context: fidl::encoding::Context) -> usize {
5359 8
5360 }
5361
5362 #[inline(always)]
5363 fn inline_size(_context: fidl::encoding::Context) -> usize {
5364 24
5365 }
5366 }
5367
5368 unsafe impl
5369 fidl::encoding::Encode<
5370 CountersConnectorConnectRequest,
5371 fidl::encoding::DefaultFuchsiaResourceDialect,
5372 > for &mut CountersConnectorConnectRequest
5373 {
5374 #[inline]
5375 unsafe fn encode(
5376 self,
5377 encoder: &mut fidl::encoding::Encoder<
5378 '_,
5379 fidl::encoding::DefaultFuchsiaResourceDialect,
5380 >,
5381 offset: usize,
5382 _depth: fidl::encoding::Depth,
5383 ) -> fidl::Result<()> {
5384 encoder.debug_check_bounds::<CountersConnectorConnectRequest>(offset);
5385 fidl::encoding::Encode::<CountersConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5387 (
5388 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5389 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5390 ),
5391 encoder, offset, _depth
5392 )
5393 }
5394 }
5395 unsafe impl<
5396 T0: fidl::encoding::Encode<
5397 fidl::encoding::BoundedString<32>,
5398 fidl::encoding::DefaultFuchsiaResourceDialect,
5399 >,
5400 T1: fidl::encoding::Encode<
5401 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>>,
5402 fidl::encoding::DefaultFuchsiaResourceDialect,
5403 >,
5404 >
5405 fidl::encoding::Encode<
5406 CountersConnectorConnectRequest,
5407 fidl::encoding::DefaultFuchsiaResourceDialect,
5408 > for (T0, T1)
5409 {
5410 #[inline]
5411 unsafe fn encode(
5412 self,
5413 encoder: &mut fidl::encoding::Encoder<
5414 '_,
5415 fidl::encoding::DefaultFuchsiaResourceDialect,
5416 >,
5417 offset: usize,
5418 depth: fidl::encoding::Depth,
5419 ) -> fidl::Result<()> {
5420 encoder.debug_check_bounds::<CountersConnectorConnectRequest>(offset);
5421 unsafe {
5424 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5425 (ptr as *mut u64).write_unaligned(0);
5426 }
5427 self.0.encode(encoder, offset + 0, depth)?;
5429 self.1.encode(encoder, offset + 16, depth)?;
5430 Ok(())
5431 }
5432 }
5433
5434 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5435 for CountersConnectorConnectRequest
5436 {
5437 #[inline(always)]
5438 fn new_empty() -> Self {
5439 Self {
5440 name: fidl::new_empty!(
5441 fidl::encoding::BoundedString<32>,
5442 fidl::encoding::DefaultFuchsiaResourceDialect
5443 ),
5444 server_end: fidl::new_empty!(
5445 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>>,
5446 fidl::encoding::DefaultFuchsiaResourceDialect
5447 ),
5448 }
5449 }
5450
5451 #[inline]
5452 unsafe fn decode(
5453 &mut self,
5454 decoder: &mut fidl::encoding::Decoder<
5455 '_,
5456 fidl::encoding::DefaultFuchsiaResourceDialect,
5457 >,
5458 offset: usize,
5459 _depth: fidl::encoding::Depth,
5460 ) -> fidl::Result<()> {
5461 decoder.debug_check_bounds::<Self>(offset);
5462 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5464 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5465 let mask = 0xffffffff00000000u64;
5466 let maskedval = padval & mask;
5467 if maskedval != 0 {
5468 return Err(fidl::Error::NonZeroPadding {
5469 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5470 });
5471 }
5472 fidl::decode!(
5473 fidl::encoding::BoundedString<32>,
5474 fidl::encoding::DefaultFuchsiaResourceDialect,
5475 &mut self.name,
5476 decoder,
5477 offset + 0,
5478 _depth
5479 )?;
5480 fidl::decode!(
5481 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>>,
5482 fidl::encoding::DefaultFuchsiaResourceDialect,
5483 &mut self.server_end,
5484 decoder,
5485 offset + 16,
5486 _depth
5487 )?;
5488 Ok(())
5489 }
5490 }
5491
5492 impl fidl::encoding::ResourceTypeMarker for DeviceConnectorConnectRequest {
5493 type Borrowed<'a> = &'a mut Self;
5494 fn take_or_borrow<'a>(
5495 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5496 ) -> Self::Borrowed<'a> {
5497 value
5498 }
5499 }
5500
5501 unsafe impl fidl::encoding::TypeMarker for DeviceConnectorConnectRequest {
5502 type Owned = Self;
5503
5504 #[inline(always)]
5505 fn inline_align(_context: fidl::encoding::Context) -> usize {
5506 8
5507 }
5508
5509 #[inline(always)]
5510 fn inline_size(_context: fidl::encoding::Context) -> usize {
5511 24
5512 }
5513 }
5514
5515 unsafe impl
5516 fidl::encoding::Encode<
5517 DeviceConnectorConnectRequest,
5518 fidl::encoding::DefaultFuchsiaResourceDialect,
5519 > for &mut DeviceConnectorConnectRequest
5520 {
5521 #[inline]
5522 unsafe fn encode(
5523 self,
5524 encoder: &mut fidl::encoding::Encoder<
5525 '_,
5526 fidl::encoding::DefaultFuchsiaResourceDialect,
5527 >,
5528 offset: usize,
5529 _depth: fidl::encoding::Depth,
5530 ) -> fidl::Result<()> {
5531 encoder.debug_check_bounds::<DeviceConnectorConnectRequest>(offset);
5532 fidl::encoding::Encode::<DeviceConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5534 (
5535 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5536 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5537 ),
5538 encoder, offset, _depth
5539 )
5540 }
5541 }
5542 unsafe impl<
5543 T0: fidl::encoding::Encode<
5544 fidl::encoding::BoundedString<32>,
5545 fidl::encoding::DefaultFuchsiaResourceDialect,
5546 >,
5547 T1: fidl::encoding::Encode<
5548 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5549 fidl::encoding::DefaultFuchsiaResourceDialect,
5550 >,
5551 >
5552 fidl::encoding::Encode<
5553 DeviceConnectorConnectRequest,
5554 fidl::encoding::DefaultFuchsiaResourceDialect,
5555 > for (T0, T1)
5556 {
5557 #[inline]
5558 unsafe fn encode(
5559 self,
5560 encoder: &mut fidl::encoding::Encoder<
5561 '_,
5562 fidl::encoding::DefaultFuchsiaResourceDialect,
5563 >,
5564 offset: usize,
5565 depth: fidl::encoding::Depth,
5566 ) -> fidl::Result<()> {
5567 encoder.debug_check_bounds::<DeviceConnectorConnectRequest>(offset);
5568 unsafe {
5571 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5572 (ptr as *mut u64).write_unaligned(0);
5573 }
5574 self.0.encode(encoder, offset + 0, depth)?;
5576 self.1.encode(encoder, offset + 16, depth)?;
5577 Ok(())
5578 }
5579 }
5580
5581 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5582 for DeviceConnectorConnectRequest
5583 {
5584 #[inline(always)]
5585 fn new_empty() -> Self {
5586 Self {
5587 name: fidl::new_empty!(
5588 fidl::encoding::BoundedString<32>,
5589 fidl::encoding::DefaultFuchsiaResourceDialect
5590 ),
5591 server_end: fidl::new_empty!(
5592 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5593 fidl::encoding::DefaultFuchsiaResourceDialect
5594 ),
5595 }
5596 }
5597
5598 #[inline]
5599 unsafe fn decode(
5600 &mut self,
5601 decoder: &mut fidl::encoding::Decoder<
5602 '_,
5603 fidl::encoding::DefaultFuchsiaResourceDialect,
5604 >,
5605 offset: usize,
5606 _depth: fidl::encoding::Depth,
5607 ) -> fidl::Result<()> {
5608 decoder.debug_check_bounds::<Self>(offset);
5609 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5611 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5612 let mask = 0xffffffff00000000u64;
5613 let maskedval = padval & mask;
5614 if maskedval != 0 {
5615 return Err(fidl::Error::NonZeroPadding {
5616 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5617 });
5618 }
5619 fidl::decode!(
5620 fidl::encoding::BoundedString<32>,
5621 fidl::encoding::DefaultFuchsiaResourceDialect,
5622 &mut self.name,
5623 decoder,
5624 offset + 0,
5625 _depth
5626 )?;
5627 fidl::decode!(
5628 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5629 fidl::encoding::DefaultFuchsiaResourceDialect,
5630 &mut self.server_end,
5631 decoder,
5632 offset + 16,
5633 _depth
5634 )?;
5635 Ok(())
5636 }
5637 }
5638
5639 impl fidl::encoding::ResourceTypeMarker for DeviceExtraConnectorConnectRequest {
5640 type Borrowed<'a> = &'a mut Self;
5641 fn take_or_borrow<'a>(
5642 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5643 ) -> Self::Borrowed<'a> {
5644 value
5645 }
5646 }
5647
5648 unsafe impl fidl::encoding::TypeMarker for DeviceExtraConnectorConnectRequest {
5649 type Owned = Self;
5650
5651 #[inline(always)]
5652 fn inline_align(_context: fidl::encoding::Context) -> usize {
5653 8
5654 }
5655
5656 #[inline(always)]
5657 fn inline_size(_context: fidl::encoding::Context) -> usize {
5658 24
5659 }
5660 }
5661
5662 unsafe impl
5663 fidl::encoding::Encode<
5664 DeviceExtraConnectorConnectRequest,
5665 fidl::encoding::DefaultFuchsiaResourceDialect,
5666 > for &mut DeviceExtraConnectorConnectRequest
5667 {
5668 #[inline]
5669 unsafe fn encode(
5670 self,
5671 encoder: &mut fidl::encoding::Encoder<
5672 '_,
5673 fidl::encoding::DefaultFuchsiaResourceDialect,
5674 >,
5675 offset: usize,
5676 _depth: fidl::encoding::Depth,
5677 ) -> fidl::Result<()> {
5678 encoder.debug_check_bounds::<DeviceExtraConnectorConnectRequest>(offset);
5679 fidl::encoding::Encode::<DeviceExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5681 (
5682 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5683 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5684 ),
5685 encoder, offset, _depth
5686 )
5687 }
5688 }
5689 unsafe impl<
5690 T0: fidl::encoding::Encode<
5691 fidl::encoding::BoundedString<32>,
5692 fidl::encoding::DefaultFuchsiaResourceDialect,
5693 >,
5694 T1: fidl::encoding::Encode<
5695 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
5696 fidl::encoding::DefaultFuchsiaResourceDialect,
5697 >,
5698 >
5699 fidl::encoding::Encode<
5700 DeviceExtraConnectorConnectRequest,
5701 fidl::encoding::DefaultFuchsiaResourceDialect,
5702 > for (T0, T1)
5703 {
5704 #[inline]
5705 unsafe fn encode(
5706 self,
5707 encoder: &mut fidl::encoding::Encoder<
5708 '_,
5709 fidl::encoding::DefaultFuchsiaResourceDialect,
5710 >,
5711 offset: usize,
5712 depth: fidl::encoding::Depth,
5713 ) -> fidl::Result<()> {
5714 encoder.debug_check_bounds::<DeviceExtraConnectorConnectRequest>(offset);
5715 unsafe {
5718 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5719 (ptr as *mut u64).write_unaligned(0);
5720 }
5721 self.0.encode(encoder, offset + 0, depth)?;
5723 self.1.encode(encoder, offset + 16, depth)?;
5724 Ok(())
5725 }
5726 }
5727
5728 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5729 for DeviceExtraConnectorConnectRequest
5730 {
5731 #[inline(always)]
5732 fn new_empty() -> Self {
5733 Self {
5734 name: fidl::new_empty!(
5735 fidl::encoding::BoundedString<32>,
5736 fidl::encoding::DefaultFuchsiaResourceDialect
5737 ),
5738 server_end: fidl::new_empty!(
5739 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
5740 fidl::encoding::DefaultFuchsiaResourceDialect
5741 ),
5742 }
5743 }
5744
5745 #[inline]
5746 unsafe fn decode(
5747 &mut self,
5748 decoder: &mut fidl::encoding::Decoder<
5749 '_,
5750 fidl::encoding::DefaultFuchsiaResourceDialect,
5751 >,
5752 offset: usize,
5753 _depth: fidl::encoding::Depth,
5754 ) -> fidl::Result<()> {
5755 decoder.debug_check_bounds::<Self>(offset);
5756 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5758 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5759 let mask = 0xffffffff00000000u64;
5760 let maskedval = padval & mask;
5761 if maskedval != 0 {
5762 return Err(fidl::Error::NonZeroPadding {
5763 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5764 });
5765 }
5766 fidl::decode!(
5767 fidl::encoding::BoundedString<32>,
5768 fidl::encoding::DefaultFuchsiaResourceDialect,
5769 &mut self.name,
5770 decoder,
5771 offset + 0,
5772 _depth
5773 )?;
5774 fidl::decode!(
5775 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
5776 fidl::encoding::DefaultFuchsiaResourceDialect,
5777 &mut self.server_end,
5778 decoder,
5779 offset + 16,
5780 _depth
5781 )?;
5782 Ok(())
5783 }
5784 }
5785
5786 impl fidl::encoding::ResourceTypeMarker for EnergyScanConnectorConnectRequest {
5787 type Borrowed<'a> = &'a mut Self;
5788 fn take_or_borrow<'a>(
5789 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5790 ) -> Self::Borrowed<'a> {
5791 value
5792 }
5793 }
5794
5795 unsafe impl fidl::encoding::TypeMarker for EnergyScanConnectorConnectRequest {
5796 type Owned = Self;
5797
5798 #[inline(always)]
5799 fn inline_align(_context: fidl::encoding::Context) -> usize {
5800 8
5801 }
5802
5803 #[inline(always)]
5804 fn inline_size(_context: fidl::encoding::Context) -> usize {
5805 24
5806 }
5807 }
5808
5809 unsafe impl
5810 fidl::encoding::Encode<
5811 EnergyScanConnectorConnectRequest,
5812 fidl::encoding::DefaultFuchsiaResourceDialect,
5813 > for &mut EnergyScanConnectorConnectRequest
5814 {
5815 #[inline]
5816 unsafe fn encode(
5817 self,
5818 encoder: &mut fidl::encoding::Encoder<
5819 '_,
5820 fidl::encoding::DefaultFuchsiaResourceDialect,
5821 >,
5822 offset: usize,
5823 _depth: fidl::encoding::Depth,
5824 ) -> fidl::Result<()> {
5825 encoder.debug_check_bounds::<EnergyScanConnectorConnectRequest>(offset);
5826 fidl::encoding::Encode::<EnergyScanConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5828 (
5829 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5830 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5831 ),
5832 encoder, offset, _depth
5833 )
5834 }
5835 }
5836 unsafe impl<
5837 T0: fidl::encoding::Encode<
5838 fidl::encoding::BoundedString<32>,
5839 fidl::encoding::DefaultFuchsiaResourceDialect,
5840 >,
5841 T1: fidl::encoding::Encode<
5842 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>>,
5843 fidl::encoding::DefaultFuchsiaResourceDialect,
5844 >,
5845 >
5846 fidl::encoding::Encode<
5847 EnergyScanConnectorConnectRequest,
5848 fidl::encoding::DefaultFuchsiaResourceDialect,
5849 > for (T0, T1)
5850 {
5851 #[inline]
5852 unsafe fn encode(
5853 self,
5854 encoder: &mut fidl::encoding::Encoder<
5855 '_,
5856 fidl::encoding::DefaultFuchsiaResourceDialect,
5857 >,
5858 offset: usize,
5859 depth: fidl::encoding::Depth,
5860 ) -> fidl::Result<()> {
5861 encoder.debug_check_bounds::<EnergyScanConnectorConnectRequest>(offset);
5862 unsafe {
5865 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5866 (ptr as *mut u64).write_unaligned(0);
5867 }
5868 self.0.encode(encoder, offset + 0, depth)?;
5870 self.1.encode(encoder, offset + 16, depth)?;
5871 Ok(())
5872 }
5873 }
5874
5875 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5876 for EnergyScanConnectorConnectRequest
5877 {
5878 #[inline(always)]
5879 fn new_empty() -> Self {
5880 Self {
5881 name: fidl::new_empty!(
5882 fidl::encoding::BoundedString<32>,
5883 fidl::encoding::DefaultFuchsiaResourceDialect
5884 ),
5885 server_end: fidl::new_empty!(
5886 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>>,
5887 fidl::encoding::DefaultFuchsiaResourceDialect
5888 ),
5889 }
5890 }
5891
5892 #[inline]
5893 unsafe fn decode(
5894 &mut self,
5895 decoder: &mut fidl::encoding::Decoder<
5896 '_,
5897 fidl::encoding::DefaultFuchsiaResourceDialect,
5898 >,
5899 offset: usize,
5900 _depth: fidl::encoding::Depth,
5901 ) -> fidl::Result<()> {
5902 decoder.debug_check_bounds::<Self>(offset);
5903 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5905 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5906 let mask = 0xffffffff00000000u64;
5907 let maskedval = padval & mask;
5908 if maskedval != 0 {
5909 return Err(fidl::Error::NonZeroPadding {
5910 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5911 });
5912 }
5913 fidl::decode!(
5914 fidl::encoding::BoundedString<32>,
5915 fidl::encoding::DefaultFuchsiaResourceDialect,
5916 &mut self.name,
5917 decoder,
5918 offset + 0,
5919 _depth
5920 )?;
5921 fidl::decode!(
5922 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>>,
5923 fidl::encoding::DefaultFuchsiaResourceDialect,
5924 &mut self.server_end,
5925 decoder,
5926 offset + 16,
5927 _depth
5928 )?;
5929 Ok(())
5930 }
5931 }
5932
5933 impl fidl::encoding::ResourceTypeMarker for EnergyScanStartEnergyScanRequest {
5934 type Borrowed<'a> = &'a mut Self;
5935 fn take_or_borrow<'a>(
5936 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5937 ) -> Self::Borrowed<'a> {
5938 value
5939 }
5940 }
5941
5942 unsafe impl fidl::encoding::TypeMarker for EnergyScanStartEnergyScanRequest {
5943 type Owned = Self;
5944
5945 #[inline(always)]
5946 fn inline_align(_context: fidl::encoding::Context) -> usize {
5947 8
5948 }
5949
5950 #[inline(always)]
5951 fn inline_size(_context: fidl::encoding::Context) -> usize {
5952 24
5953 }
5954 }
5955
5956 unsafe impl
5957 fidl::encoding::Encode<
5958 EnergyScanStartEnergyScanRequest,
5959 fidl::encoding::DefaultFuchsiaResourceDialect,
5960 > for &mut EnergyScanStartEnergyScanRequest
5961 {
5962 #[inline]
5963 unsafe fn encode(
5964 self,
5965 encoder: &mut fidl::encoding::Encoder<
5966 '_,
5967 fidl::encoding::DefaultFuchsiaResourceDialect,
5968 >,
5969 offset: usize,
5970 _depth: fidl::encoding::Depth,
5971 ) -> fidl::Result<()> {
5972 encoder.debug_check_bounds::<EnergyScanStartEnergyScanRequest>(offset);
5973 fidl::encoding::Encode::<
5975 EnergyScanStartEnergyScanRequest,
5976 fidl::encoding::DefaultFuchsiaResourceDialect,
5977 >::encode(
5978 (
5979 <EnergyScanParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
5980 <fidl::encoding::Endpoint<
5981 fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
5982 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5983 &mut self.stream
5984 ),
5985 ),
5986 encoder,
5987 offset,
5988 _depth,
5989 )
5990 }
5991 }
5992 unsafe impl<
5993 T0: fidl::encoding::Encode<EnergyScanParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
5994 T1: fidl::encoding::Encode<
5995 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>>,
5996 fidl::encoding::DefaultFuchsiaResourceDialect,
5997 >,
5998 >
5999 fidl::encoding::Encode<
6000 EnergyScanStartEnergyScanRequest,
6001 fidl::encoding::DefaultFuchsiaResourceDialect,
6002 > for (T0, T1)
6003 {
6004 #[inline]
6005 unsafe fn encode(
6006 self,
6007 encoder: &mut fidl::encoding::Encoder<
6008 '_,
6009 fidl::encoding::DefaultFuchsiaResourceDialect,
6010 >,
6011 offset: usize,
6012 depth: fidl::encoding::Depth,
6013 ) -> fidl::Result<()> {
6014 encoder.debug_check_bounds::<EnergyScanStartEnergyScanRequest>(offset);
6015 unsafe {
6018 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6019 (ptr as *mut u64).write_unaligned(0);
6020 }
6021 self.0.encode(encoder, offset + 0, depth)?;
6023 self.1.encode(encoder, offset + 16, depth)?;
6024 Ok(())
6025 }
6026 }
6027
6028 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6029 for EnergyScanStartEnergyScanRequest
6030 {
6031 #[inline(always)]
6032 fn new_empty() -> Self {
6033 Self {
6034 params: fidl::new_empty!(
6035 EnergyScanParameters,
6036 fidl::encoding::DefaultFuchsiaResourceDialect
6037 ),
6038 stream: fidl::new_empty!(
6039 fidl::encoding::Endpoint<
6040 fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
6041 >,
6042 fidl::encoding::DefaultFuchsiaResourceDialect
6043 ),
6044 }
6045 }
6046
6047 #[inline]
6048 unsafe fn decode(
6049 &mut self,
6050 decoder: &mut fidl::encoding::Decoder<
6051 '_,
6052 fidl::encoding::DefaultFuchsiaResourceDialect,
6053 >,
6054 offset: usize,
6055 _depth: fidl::encoding::Depth,
6056 ) -> fidl::Result<()> {
6057 decoder.debug_check_bounds::<Self>(offset);
6058 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6060 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6061 let mask = 0xffffffff00000000u64;
6062 let maskedval = padval & mask;
6063 if maskedval != 0 {
6064 return Err(fidl::Error::NonZeroPadding {
6065 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6066 });
6067 }
6068 fidl::decode!(
6069 EnergyScanParameters,
6070 fidl::encoding::DefaultFuchsiaResourceDialect,
6071 &mut self.params,
6072 decoder,
6073 offset + 0,
6074 _depth
6075 )?;
6076 fidl::decode!(
6077 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>>,
6078 fidl::encoding::DefaultFuchsiaResourceDialect,
6079 &mut self.stream,
6080 decoder,
6081 offset + 16,
6082 _depth
6083 )?;
6084 Ok(())
6085 }
6086 }
6087}