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 let protocol_name = <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
115 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
116 }
117
118 pub fn into_channel(self) -> fidl::Channel {
119 self.client.into_channel()
120 }
121
122 pub fn wait_for_event(
125 &self,
126 deadline: zx::MonotonicInstant,
127 ) -> Result<CountersEvent, fidl::Error> {
128 CountersEvent::decode(self.client.wait_for_event(deadline)?)
129 }
130
131 pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<AllCounters, fidl::Error> {
133 let _response =
134 self.client.send_query::<fidl::encoding::EmptyPayload, CountersGetResponse>(
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 =
147 self.client.send_query::<fidl::encoding::EmptyPayload, CountersResetResponse>(
148 (),
149 0x4cf9a102017cf7ad,
150 fidl::encoding::DynamicFlags::empty(),
151 ___deadline,
152 )?;
153 Ok(_response.counters)
154 }
155}
156
157#[cfg(target_os = "fuchsia")]
158impl From<CountersSynchronousProxy> for zx::Handle {
159 fn from(value: CountersSynchronousProxy) -> Self {
160 value.into_channel().into()
161 }
162}
163
164#[cfg(target_os = "fuchsia")]
165impl From<fidl::Channel> for CountersSynchronousProxy {
166 fn from(value: fidl::Channel) -> Self {
167 Self::new(value)
168 }
169}
170
171#[derive(Debug, Clone)]
172pub struct CountersProxy {
173 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
174}
175
176impl fidl::endpoints::Proxy for CountersProxy {
177 type Protocol = CountersMarker;
178
179 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
180 Self::new(inner)
181 }
182
183 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
184 self.client.into_channel().map_err(|client| Self { client })
185 }
186
187 fn as_channel(&self) -> &::fidl::AsyncChannel {
188 self.client.as_channel()
189 }
190}
191
192impl CountersProxy {
193 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
195 let protocol_name = <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
196 Self { client: fidl::client::Client::new(channel, protocol_name) }
197 }
198
199 pub fn take_event_stream(&self) -> CountersEventStream {
205 CountersEventStream { event_receiver: self.client.take_event_receiver() }
206 }
207
208 pub fn r#get(
210 &self,
211 ) -> fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>
212 {
213 CountersProxyInterface::r#get(self)
214 }
215
216 pub fn r#reset(
219 &self,
220 ) -> fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>
221 {
222 CountersProxyInterface::r#reset(self)
223 }
224}
225
226impl CountersProxyInterface for CountersProxy {
227 type GetResponseFut =
228 fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>;
229 fn r#get(&self) -> Self::GetResponseFut {
230 fn _decode(
231 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
232 ) -> Result<AllCounters, fidl::Error> {
233 let _response = fidl::client::decode_transaction_body::<
234 CountersGetResponse,
235 fidl::encoding::DefaultFuchsiaResourceDialect,
236 0xaa28d44c1535a24,
237 >(_buf?)?;
238 Ok(_response.counters)
239 }
240 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AllCounters>(
241 (),
242 0xaa28d44c1535a24,
243 fidl::encoding::DynamicFlags::empty(),
244 _decode,
245 )
246 }
247
248 type ResetResponseFut =
249 fidl::client::QueryResponseFut<AllCounters, fidl::encoding::DefaultFuchsiaResourceDialect>;
250 fn r#reset(&self) -> Self::ResetResponseFut {
251 fn _decode(
252 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
253 ) -> Result<AllCounters, fidl::Error> {
254 let _response = fidl::client::decode_transaction_body::<
255 CountersResetResponse,
256 fidl::encoding::DefaultFuchsiaResourceDialect,
257 0x4cf9a102017cf7ad,
258 >(_buf?)?;
259 Ok(_response.counters)
260 }
261 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AllCounters>(
262 (),
263 0x4cf9a102017cf7ad,
264 fidl::encoding::DynamicFlags::empty(),
265 _decode,
266 )
267 }
268}
269
270pub struct CountersEventStream {
271 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
272}
273
274impl std::marker::Unpin for CountersEventStream {}
275
276impl futures::stream::FusedStream for CountersEventStream {
277 fn is_terminated(&self) -> bool {
278 self.event_receiver.is_terminated()
279 }
280}
281
282impl futures::Stream for CountersEventStream {
283 type Item = Result<CountersEvent, fidl::Error>;
284
285 fn poll_next(
286 mut self: std::pin::Pin<&mut Self>,
287 cx: &mut std::task::Context<'_>,
288 ) -> std::task::Poll<Option<Self::Item>> {
289 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
290 &mut self.event_receiver,
291 cx
292 )?) {
293 Some(buf) => std::task::Poll::Ready(Some(CountersEvent::decode(buf))),
294 None => std::task::Poll::Ready(None),
295 }
296 }
297}
298
299#[derive(Debug)]
300pub enum CountersEvent {}
301
302impl CountersEvent {
303 fn decode(
305 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
306 ) -> Result<CountersEvent, fidl::Error> {
307 let (bytes, _handles) = buf.split_mut();
308 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
309 debug_assert_eq!(tx_header.tx_id, 0);
310 match tx_header.ordinal {
311 _ => Err(fidl::Error::UnknownOrdinal {
312 ordinal: tx_header.ordinal,
313 protocol_name: <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
314 }),
315 }
316 }
317}
318
319pub struct CountersRequestStream {
321 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
322 is_terminated: bool,
323}
324
325impl std::marker::Unpin for CountersRequestStream {}
326
327impl futures::stream::FusedStream for CountersRequestStream {
328 fn is_terminated(&self) -> bool {
329 self.is_terminated
330 }
331}
332
333impl fidl::endpoints::RequestStream for CountersRequestStream {
334 type Protocol = CountersMarker;
335 type ControlHandle = CountersControlHandle;
336
337 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
338 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
339 }
340
341 fn control_handle(&self) -> Self::ControlHandle {
342 CountersControlHandle { inner: self.inner.clone() }
343 }
344
345 fn into_inner(
346 self,
347 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
348 {
349 (self.inner, self.is_terminated)
350 }
351
352 fn from_inner(
353 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
354 is_terminated: bool,
355 ) -> Self {
356 Self { inner, is_terminated }
357 }
358}
359
360impl futures::Stream for CountersRequestStream {
361 type Item = Result<CountersRequest, fidl::Error>;
362
363 fn poll_next(
364 mut self: std::pin::Pin<&mut Self>,
365 cx: &mut std::task::Context<'_>,
366 ) -> std::task::Poll<Option<Self::Item>> {
367 let this = &mut *self;
368 if this.inner.check_shutdown(cx) {
369 this.is_terminated = true;
370 return std::task::Poll::Ready(None);
371 }
372 if this.is_terminated {
373 panic!("polled CountersRequestStream after completion");
374 }
375 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
376 |bytes, handles| {
377 match this.inner.channel().read_etc(cx, bytes, handles) {
378 std::task::Poll::Ready(Ok(())) => {}
379 std::task::Poll::Pending => return std::task::Poll::Pending,
380 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
381 this.is_terminated = true;
382 return std::task::Poll::Ready(None);
383 }
384 std::task::Poll::Ready(Err(e)) => {
385 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
386 e.into(),
387 ))))
388 }
389 }
390
391 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
393
394 std::task::Poll::Ready(Some(match header.ordinal {
395 0xaa28d44c1535a24 => {
396 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
397 let mut req = fidl::new_empty!(
398 fidl::encoding::EmptyPayload,
399 fidl::encoding::DefaultFuchsiaResourceDialect
400 );
401 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
402 let control_handle = CountersControlHandle { inner: this.inner.clone() };
403 Ok(CountersRequest::Get {
404 responder: CountersGetResponder {
405 control_handle: std::mem::ManuallyDrop::new(control_handle),
406 tx_id: header.tx_id,
407 },
408 })
409 }
410 0x4cf9a102017cf7ad => {
411 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
412 let mut req = fidl::new_empty!(
413 fidl::encoding::EmptyPayload,
414 fidl::encoding::DefaultFuchsiaResourceDialect
415 );
416 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
417 let control_handle = CountersControlHandle { inner: this.inner.clone() };
418 Ok(CountersRequest::Reset {
419 responder: CountersResetResponder {
420 control_handle: std::mem::ManuallyDrop::new(control_handle),
421 tx_id: header.tx_id,
422 },
423 })
424 }
425 _ => Err(fidl::Error::UnknownOrdinal {
426 ordinal: header.ordinal,
427 protocol_name:
428 <CountersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
429 }),
430 }))
431 },
432 )
433 }
434}
435
436#[derive(Debug)]
437pub enum CountersRequest {
438 Get { responder: CountersGetResponder },
440 Reset { responder: CountersResetResponder },
443}
444
445impl CountersRequest {
446 #[allow(irrefutable_let_patterns)]
447 pub fn into_get(self) -> Option<(CountersGetResponder)> {
448 if let CountersRequest::Get { responder } = self {
449 Some((responder))
450 } else {
451 None
452 }
453 }
454
455 #[allow(irrefutable_let_patterns)]
456 pub fn into_reset(self) -> Option<(CountersResetResponder)> {
457 if let CountersRequest::Reset { responder } = self {
458 Some((responder))
459 } else {
460 None
461 }
462 }
463
464 pub fn method_name(&self) -> &'static str {
466 match *self {
467 CountersRequest::Get { .. } => "get",
468 CountersRequest::Reset { .. } => "reset",
469 }
470 }
471}
472
473#[derive(Debug, Clone)]
474pub struct CountersControlHandle {
475 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
476}
477
478impl fidl::endpoints::ControlHandle for CountersControlHandle {
479 fn shutdown(&self) {
480 self.inner.shutdown()
481 }
482 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
483 self.inner.shutdown_with_epitaph(status)
484 }
485
486 fn is_closed(&self) -> bool {
487 self.inner.channel().is_closed()
488 }
489 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
490 self.inner.channel().on_closed()
491 }
492
493 #[cfg(target_os = "fuchsia")]
494 fn signal_peer(
495 &self,
496 clear_mask: zx::Signals,
497 set_mask: zx::Signals,
498 ) -> Result<(), zx_status::Status> {
499 use fidl::Peered;
500 self.inner.channel().signal_peer(clear_mask, set_mask)
501 }
502}
503
504impl CountersControlHandle {}
505
506#[must_use = "FIDL methods require a response to be sent"]
507#[derive(Debug)]
508pub struct CountersGetResponder {
509 control_handle: std::mem::ManuallyDrop<CountersControlHandle>,
510 tx_id: u32,
511}
512
513impl std::ops::Drop for CountersGetResponder {
517 fn drop(&mut self) {
518 self.control_handle.shutdown();
519 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
521 }
522}
523
524impl fidl::endpoints::Responder for CountersGetResponder {
525 type ControlHandle = CountersControlHandle;
526
527 fn control_handle(&self) -> &CountersControlHandle {
528 &self.control_handle
529 }
530
531 fn drop_without_shutdown(mut self) {
532 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
534 std::mem::forget(self);
536 }
537}
538
539impl CountersGetResponder {
540 pub fn send(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
544 let _result = self.send_raw(counters);
545 if _result.is_err() {
546 self.control_handle.shutdown();
547 }
548 self.drop_without_shutdown();
549 _result
550 }
551
552 pub fn send_no_shutdown_on_err(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
554 let _result = self.send_raw(counters);
555 self.drop_without_shutdown();
556 _result
557 }
558
559 fn send_raw(&self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
560 self.control_handle.inner.send::<CountersGetResponse>(
561 (counters,),
562 self.tx_id,
563 0xaa28d44c1535a24,
564 fidl::encoding::DynamicFlags::empty(),
565 )
566 }
567}
568
569#[must_use = "FIDL methods require a response to be sent"]
570#[derive(Debug)]
571pub struct CountersResetResponder {
572 control_handle: std::mem::ManuallyDrop<CountersControlHandle>,
573 tx_id: u32,
574}
575
576impl std::ops::Drop for CountersResetResponder {
580 fn drop(&mut self) {
581 self.control_handle.shutdown();
582 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
584 }
585}
586
587impl fidl::endpoints::Responder for CountersResetResponder {
588 type ControlHandle = CountersControlHandle;
589
590 fn control_handle(&self) -> &CountersControlHandle {
591 &self.control_handle
592 }
593
594 fn drop_without_shutdown(mut self) {
595 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
597 std::mem::forget(self);
599 }
600}
601
602impl CountersResetResponder {
603 pub fn send(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
607 let _result = self.send_raw(counters);
608 if _result.is_err() {
609 self.control_handle.shutdown();
610 }
611 self.drop_without_shutdown();
612 _result
613 }
614
615 pub fn send_no_shutdown_on_err(self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
617 let _result = self.send_raw(counters);
618 self.drop_without_shutdown();
619 _result
620 }
621
622 fn send_raw(&self, mut counters: &AllCounters) -> Result<(), fidl::Error> {
623 self.control_handle.inner.send::<CountersResetResponse>(
624 (counters,),
625 self.tx_id,
626 0x4cf9a102017cf7ad,
627 fidl::encoding::DynamicFlags::empty(),
628 )
629 }
630}
631
632#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
633pub struct CountersConnectorMarker;
634
635impl fidl::endpoints::ProtocolMarker for CountersConnectorMarker {
636 type Proxy = CountersConnectorProxy;
637 type RequestStream = CountersConnectorRequestStream;
638 #[cfg(target_os = "fuchsia")]
639 type SynchronousProxy = CountersConnectorSynchronousProxy;
640
641 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.CountersConnector";
642}
643impl fidl::endpoints::DiscoverableProtocolMarker for CountersConnectorMarker {}
644
645pub trait CountersConnectorProxyInterface: Send + Sync {
646 fn r#connect(
647 &self,
648 name: &str,
649 server_end: fidl::endpoints::ServerEnd<CountersMarker>,
650 ) -> Result<(), fidl::Error>;
651}
652#[derive(Debug)]
653#[cfg(target_os = "fuchsia")]
654pub struct CountersConnectorSynchronousProxy {
655 client: fidl::client::sync::Client,
656}
657
658#[cfg(target_os = "fuchsia")]
659impl fidl::endpoints::SynchronousProxy for CountersConnectorSynchronousProxy {
660 type Proxy = CountersConnectorProxy;
661 type Protocol = CountersConnectorMarker;
662
663 fn from_channel(inner: fidl::Channel) -> Self {
664 Self::new(inner)
665 }
666
667 fn into_channel(self) -> fidl::Channel {
668 self.client.into_channel()
669 }
670
671 fn as_channel(&self) -> &fidl::Channel {
672 self.client.as_channel()
673 }
674}
675
676#[cfg(target_os = "fuchsia")]
677impl CountersConnectorSynchronousProxy {
678 pub fn new(channel: fidl::Channel) -> Self {
679 let protocol_name =
680 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
681 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
682 }
683
684 pub fn into_channel(self) -> fidl::Channel {
685 self.client.into_channel()
686 }
687
688 pub fn wait_for_event(
691 &self,
692 deadline: zx::MonotonicInstant,
693 ) -> Result<CountersConnectorEvent, fidl::Error> {
694 CountersConnectorEvent::decode(self.client.wait_for_event(deadline)?)
695 }
696
697 pub fn r#connect(
714 &self,
715 mut name: &str,
716 mut server_end: fidl::endpoints::ServerEnd<CountersMarker>,
717 ) -> Result<(), fidl::Error> {
718 self.client.send::<CountersConnectorConnectRequest>(
719 (name, server_end),
720 0x61ec847f2702d188,
721 fidl::encoding::DynamicFlags::empty(),
722 )
723 }
724}
725
726#[cfg(target_os = "fuchsia")]
727impl From<CountersConnectorSynchronousProxy> for zx::Handle {
728 fn from(value: CountersConnectorSynchronousProxy) -> Self {
729 value.into_channel().into()
730 }
731}
732
733#[cfg(target_os = "fuchsia")]
734impl From<fidl::Channel> for CountersConnectorSynchronousProxy {
735 fn from(value: fidl::Channel) -> Self {
736 Self::new(value)
737 }
738}
739
740#[derive(Debug, Clone)]
741pub struct CountersConnectorProxy {
742 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
743}
744
745impl fidl::endpoints::Proxy for CountersConnectorProxy {
746 type Protocol = CountersConnectorMarker;
747
748 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
749 Self::new(inner)
750 }
751
752 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
753 self.client.into_channel().map_err(|client| Self { client })
754 }
755
756 fn as_channel(&self) -> &::fidl::AsyncChannel {
757 self.client.as_channel()
758 }
759}
760
761impl CountersConnectorProxy {
762 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
764 let protocol_name =
765 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
766 Self { client: fidl::client::Client::new(channel, protocol_name) }
767 }
768
769 pub fn take_event_stream(&self) -> CountersConnectorEventStream {
775 CountersConnectorEventStream { event_receiver: self.client.take_event_receiver() }
776 }
777
778 pub fn r#connect(
795 &self,
796 mut name: &str,
797 mut server_end: fidl::endpoints::ServerEnd<CountersMarker>,
798 ) -> Result<(), fidl::Error> {
799 CountersConnectorProxyInterface::r#connect(self, name, server_end)
800 }
801}
802
803impl CountersConnectorProxyInterface for CountersConnectorProxy {
804 fn r#connect(
805 &self,
806 mut name: &str,
807 mut server_end: fidl::endpoints::ServerEnd<CountersMarker>,
808 ) -> Result<(), fidl::Error> {
809 self.client.send::<CountersConnectorConnectRequest>(
810 (name, server_end),
811 0x61ec847f2702d188,
812 fidl::encoding::DynamicFlags::empty(),
813 )
814 }
815}
816
817pub struct CountersConnectorEventStream {
818 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
819}
820
821impl std::marker::Unpin for CountersConnectorEventStream {}
822
823impl futures::stream::FusedStream for CountersConnectorEventStream {
824 fn is_terminated(&self) -> bool {
825 self.event_receiver.is_terminated()
826 }
827}
828
829impl futures::Stream for CountersConnectorEventStream {
830 type Item = Result<CountersConnectorEvent, fidl::Error>;
831
832 fn poll_next(
833 mut self: std::pin::Pin<&mut Self>,
834 cx: &mut std::task::Context<'_>,
835 ) -> std::task::Poll<Option<Self::Item>> {
836 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
837 &mut self.event_receiver,
838 cx
839 )?) {
840 Some(buf) => std::task::Poll::Ready(Some(CountersConnectorEvent::decode(buf))),
841 None => std::task::Poll::Ready(None),
842 }
843 }
844}
845
846#[derive(Debug)]
847pub enum CountersConnectorEvent {}
848
849impl CountersConnectorEvent {
850 fn decode(
852 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
853 ) -> Result<CountersConnectorEvent, fidl::Error> {
854 let (bytes, _handles) = buf.split_mut();
855 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
856 debug_assert_eq!(tx_header.tx_id, 0);
857 match tx_header.ordinal {
858 _ => Err(fidl::Error::UnknownOrdinal {
859 ordinal: tx_header.ordinal,
860 protocol_name:
861 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
862 }),
863 }
864 }
865}
866
867pub struct CountersConnectorRequestStream {
869 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
870 is_terminated: bool,
871}
872
873impl std::marker::Unpin for CountersConnectorRequestStream {}
874
875impl futures::stream::FusedStream for CountersConnectorRequestStream {
876 fn is_terminated(&self) -> bool {
877 self.is_terminated
878 }
879}
880
881impl fidl::endpoints::RequestStream for CountersConnectorRequestStream {
882 type Protocol = CountersConnectorMarker;
883 type ControlHandle = CountersConnectorControlHandle;
884
885 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
886 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
887 }
888
889 fn control_handle(&self) -> Self::ControlHandle {
890 CountersConnectorControlHandle { inner: self.inner.clone() }
891 }
892
893 fn into_inner(
894 self,
895 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
896 {
897 (self.inner, self.is_terminated)
898 }
899
900 fn from_inner(
901 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
902 is_terminated: bool,
903 ) -> Self {
904 Self { inner, is_terminated }
905 }
906}
907
908impl futures::Stream for CountersConnectorRequestStream {
909 type Item = Result<CountersConnectorRequest, fidl::Error>;
910
911 fn poll_next(
912 mut self: std::pin::Pin<&mut Self>,
913 cx: &mut std::task::Context<'_>,
914 ) -> std::task::Poll<Option<Self::Item>> {
915 let this = &mut *self;
916 if this.inner.check_shutdown(cx) {
917 this.is_terminated = true;
918 return std::task::Poll::Ready(None);
919 }
920 if this.is_terminated {
921 panic!("polled CountersConnectorRequestStream after completion");
922 }
923 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
924 |bytes, handles| {
925 match this.inner.channel().read_etc(cx, bytes, handles) {
926 std::task::Poll::Ready(Ok(())) => {}
927 std::task::Poll::Pending => return std::task::Poll::Pending,
928 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
929 this.is_terminated = true;
930 return std::task::Poll::Ready(None);
931 }
932 std::task::Poll::Ready(Err(e)) => {
933 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
934 e.into(),
935 ))))
936 }
937 }
938
939 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
941
942 std::task::Poll::Ready(Some(match header.ordinal {
943 0x61ec847f2702d188 => {
944 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
945 let mut req = fidl::new_empty!(
946 CountersConnectorConnectRequest,
947 fidl::encoding::DefaultFuchsiaResourceDialect
948 );
949 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CountersConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
950 let control_handle =
951 CountersConnectorControlHandle { inner: this.inner.clone() };
952 Ok(CountersConnectorRequest::Connect {
953 name: req.name,
954 server_end: req.server_end,
955
956 control_handle,
957 })
958 }
959 _ => Err(fidl::Error::UnknownOrdinal {
960 ordinal: header.ordinal,
961 protocol_name:
962 <CountersConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
963 }),
964 }))
965 },
966 )
967 }
968}
969
970#[derive(Debug)]
973pub enum CountersConnectorRequest {
974 Connect {
991 name: String,
992 server_end: fidl::endpoints::ServerEnd<CountersMarker>,
993 control_handle: CountersConnectorControlHandle,
994 },
995}
996
997impl CountersConnectorRequest {
998 #[allow(irrefutable_let_patterns)]
999 pub fn into_connect(
1000 self,
1001 ) -> Option<(String, fidl::endpoints::ServerEnd<CountersMarker>, CountersConnectorControlHandle)>
1002 {
1003 if let CountersConnectorRequest::Connect { name, server_end, control_handle } = self {
1004 Some((name, server_end, control_handle))
1005 } else {
1006 None
1007 }
1008 }
1009
1010 pub fn method_name(&self) -> &'static str {
1012 match *self {
1013 CountersConnectorRequest::Connect { .. } => "connect",
1014 }
1015 }
1016}
1017
1018#[derive(Debug, Clone)]
1019pub struct CountersConnectorControlHandle {
1020 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1021}
1022
1023impl fidl::endpoints::ControlHandle for CountersConnectorControlHandle {
1024 fn shutdown(&self) {
1025 self.inner.shutdown()
1026 }
1027 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1028 self.inner.shutdown_with_epitaph(status)
1029 }
1030
1031 fn is_closed(&self) -> bool {
1032 self.inner.channel().is_closed()
1033 }
1034 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1035 self.inner.channel().on_closed()
1036 }
1037
1038 #[cfg(target_os = "fuchsia")]
1039 fn signal_peer(
1040 &self,
1041 clear_mask: zx::Signals,
1042 set_mask: zx::Signals,
1043 ) -> Result<(), zx_status::Status> {
1044 use fidl::Peered;
1045 self.inner.channel().signal_peer(clear_mask, set_mask)
1046 }
1047}
1048
1049impl CountersConnectorControlHandle {}
1050
1051#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1052pub struct DeviceMarker;
1053
1054impl fidl::endpoints::ProtocolMarker for DeviceMarker {
1055 type Proxy = DeviceProxy;
1056 type RequestStream = DeviceRequestStream;
1057 #[cfg(target_os = "fuchsia")]
1058 type SynchronousProxy = DeviceSynchronousProxy;
1059
1060 const DEBUG_NAME: &'static str = "(anonymous) Device";
1061}
1062
1063pub trait DeviceProxyInterface: Send + Sync {
1064 type ProvisionNetworkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1065 fn r#provision_network(&self, params: &ProvisioningParams)
1066 -> Self::ProvisionNetworkResponseFut;
1067 type LeaveNetworkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1068 fn r#leave_network(&self) -> Self::LeaveNetworkResponseFut;
1069 type SetActiveResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1070 fn r#set_active(&self, active: bool) -> Self::SetActiveResponseFut;
1071 type GetSupportedNetworkTypesResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
1072 + Send;
1073 fn r#get_supported_network_types(&self) -> Self::GetSupportedNetworkTypesResponseFut;
1074 type WatchDeviceStateResponseFut: std::future::Future<Output = Result<DeviceState, fidl::Error>>
1075 + Send;
1076 fn r#watch_device_state(&self) -> Self::WatchDeviceStateResponseFut;
1077}
1078#[derive(Debug)]
1079#[cfg(target_os = "fuchsia")]
1080pub struct DeviceSynchronousProxy {
1081 client: fidl::client::sync::Client,
1082}
1083
1084#[cfg(target_os = "fuchsia")]
1085impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
1086 type Proxy = DeviceProxy;
1087 type Protocol = DeviceMarker;
1088
1089 fn from_channel(inner: fidl::Channel) -> Self {
1090 Self::new(inner)
1091 }
1092
1093 fn into_channel(self) -> fidl::Channel {
1094 self.client.into_channel()
1095 }
1096
1097 fn as_channel(&self) -> &fidl::Channel {
1098 self.client.as_channel()
1099 }
1100}
1101
1102#[cfg(target_os = "fuchsia")]
1103impl DeviceSynchronousProxy {
1104 pub fn new(channel: fidl::Channel) -> Self {
1105 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1106 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1107 }
1108
1109 pub fn into_channel(self) -> fidl::Channel {
1110 self.client.into_channel()
1111 }
1112
1113 pub fn wait_for_event(
1116 &self,
1117 deadline: zx::MonotonicInstant,
1118 ) -> Result<DeviceEvent, fidl::Error> {
1119 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
1120 }
1121
1122 pub fn r#provision_network(
1149 &self,
1150 mut params: &ProvisioningParams,
1151 ___deadline: zx::MonotonicInstant,
1152 ) -> Result<(), fidl::Error> {
1153 let _response =
1154 self.client.send_query::<DeviceProvisionNetworkRequest, fidl::encoding::EmptyPayload>(
1155 (params,),
1156 0x3501046988e17076,
1157 fidl::encoding::DynamicFlags::empty(),
1158 ___deadline,
1159 )?;
1160 Ok(_response)
1161 }
1162
1163 pub fn r#leave_network(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1181 let _response =
1182 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1183 (),
1184 0x66919e4f9752c53e,
1185 fidl::encoding::DynamicFlags::empty(),
1186 ___deadline,
1187 )?;
1188 Ok(_response)
1189 }
1190
1191 pub fn r#set_active(
1204 &self,
1205 mut active: bool,
1206 ___deadline: zx::MonotonicInstant,
1207 ) -> Result<(), fidl::Error> {
1208 let _response =
1209 self.client.send_query::<DeviceSetActiveRequest, fidl::encoding::EmptyPayload>(
1210 (active,),
1211 0x55a6837f8bbb344b,
1212 fidl::encoding::DynamicFlags::empty(),
1213 ___deadline,
1214 )?;
1215 Ok(_response)
1216 }
1217
1218 pub fn r#get_supported_network_types(
1224 &self,
1225 ___deadline: zx::MonotonicInstant,
1226 ) -> Result<Vec<String>, fidl::Error> {
1227 let _response = self
1228 .client
1229 .send_query::<fidl::encoding::EmptyPayload, DeviceGetSupportedNetworkTypesResponse>(
1230 (),
1231 0x6d8f71a5beb15ebf,
1232 fidl::encoding::DynamicFlags::empty(),
1233 ___deadline,
1234 )?;
1235 Ok(_response.network_types)
1236 }
1237
1238 pub fn r#watch_device_state(
1248 &self,
1249 ___deadline: zx::MonotonicInstant,
1250 ) -> Result<DeviceState, fidl::Error> {
1251 let _response = self
1252 .client
1253 .send_query::<fidl::encoding::EmptyPayload, DeviceWatchDeviceStateResponse>(
1254 (),
1255 0x593be5b83e80d249,
1256 fidl::encoding::DynamicFlags::empty(),
1257 ___deadline,
1258 )?;
1259 Ok(_response.device_combined_state)
1260 }
1261}
1262
1263#[cfg(target_os = "fuchsia")]
1264impl From<DeviceSynchronousProxy> for zx::Handle {
1265 fn from(value: DeviceSynchronousProxy) -> Self {
1266 value.into_channel().into()
1267 }
1268}
1269
1270#[cfg(target_os = "fuchsia")]
1271impl From<fidl::Channel> for DeviceSynchronousProxy {
1272 fn from(value: fidl::Channel) -> Self {
1273 Self::new(value)
1274 }
1275}
1276
1277#[derive(Debug, Clone)]
1278pub struct DeviceProxy {
1279 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1280}
1281
1282impl fidl::endpoints::Proxy for DeviceProxy {
1283 type Protocol = DeviceMarker;
1284
1285 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1286 Self::new(inner)
1287 }
1288
1289 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1290 self.client.into_channel().map_err(|client| Self { client })
1291 }
1292
1293 fn as_channel(&self) -> &::fidl::AsyncChannel {
1294 self.client.as_channel()
1295 }
1296}
1297
1298impl DeviceProxy {
1299 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1301 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1302 Self { client: fidl::client::Client::new(channel, protocol_name) }
1303 }
1304
1305 pub fn take_event_stream(&self) -> DeviceEventStream {
1311 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1312 }
1313
1314 pub fn r#provision_network(
1341 &self,
1342 mut params: &ProvisioningParams,
1343 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1344 DeviceProxyInterface::r#provision_network(self, params)
1345 }
1346
1347 pub fn r#leave_network(
1365 &self,
1366 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1367 DeviceProxyInterface::r#leave_network(self)
1368 }
1369
1370 pub fn r#set_active(
1383 &self,
1384 mut active: bool,
1385 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1386 DeviceProxyInterface::r#set_active(self, active)
1387 }
1388
1389 pub fn r#get_supported_network_types(
1395 &self,
1396 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
1397 {
1398 DeviceProxyInterface::r#get_supported_network_types(self)
1399 }
1400
1401 pub fn r#watch_device_state(
1411 &self,
1412 ) -> fidl::client::QueryResponseFut<DeviceState, fidl::encoding::DefaultFuchsiaResourceDialect>
1413 {
1414 DeviceProxyInterface::r#watch_device_state(self)
1415 }
1416}
1417
1418impl DeviceProxyInterface for DeviceProxy {
1419 type ProvisionNetworkResponseFut =
1420 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1421 fn r#provision_network(
1422 &self,
1423 mut params: &ProvisioningParams,
1424 ) -> Self::ProvisionNetworkResponseFut {
1425 fn _decode(
1426 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1427 ) -> Result<(), fidl::Error> {
1428 let _response = fidl::client::decode_transaction_body::<
1429 fidl::encoding::EmptyPayload,
1430 fidl::encoding::DefaultFuchsiaResourceDialect,
1431 0x3501046988e17076,
1432 >(_buf?)?;
1433 Ok(_response)
1434 }
1435 self.client.send_query_and_decode::<DeviceProvisionNetworkRequest, ()>(
1436 (params,),
1437 0x3501046988e17076,
1438 fidl::encoding::DynamicFlags::empty(),
1439 _decode,
1440 )
1441 }
1442
1443 type LeaveNetworkResponseFut =
1444 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1445 fn r#leave_network(&self) -> Self::LeaveNetworkResponseFut {
1446 fn _decode(
1447 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1448 ) -> Result<(), fidl::Error> {
1449 let _response = fidl::client::decode_transaction_body::<
1450 fidl::encoding::EmptyPayload,
1451 fidl::encoding::DefaultFuchsiaResourceDialect,
1452 0x66919e4f9752c53e,
1453 >(_buf?)?;
1454 Ok(_response)
1455 }
1456 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1457 (),
1458 0x66919e4f9752c53e,
1459 fidl::encoding::DynamicFlags::empty(),
1460 _decode,
1461 )
1462 }
1463
1464 type SetActiveResponseFut =
1465 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1466 fn r#set_active(&self, mut active: bool) -> Self::SetActiveResponseFut {
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 0x55a6837f8bbb344b,
1474 >(_buf?)?;
1475 Ok(_response)
1476 }
1477 self.client.send_query_and_decode::<DeviceSetActiveRequest, ()>(
1478 (active,),
1479 0x55a6837f8bbb344b,
1480 fidl::encoding::DynamicFlags::empty(),
1481 _decode,
1482 )
1483 }
1484
1485 type GetSupportedNetworkTypesResponseFut =
1486 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1487 fn r#get_supported_network_types(&self) -> Self::GetSupportedNetworkTypesResponseFut {
1488 fn _decode(
1489 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1490 ) -> Result<Vec<String>, fidl::Error> {
1491 let _response = fidl::client::decode_transaction_body::<
1492 DeviceGetSupportedNetworkTypesResponse,
1493 fidl::encoding::DefaultFuchsiaResourceDialect,
1494 0x6d8f71a5beb15ebf,
1495 >(_buf?)?;
1496 Ok(_response.network_types)
1497 }
1498 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
1499 (),
1500 0x6d8f71a5beb15ebf,
1501 fidl::encoding::DynamicFlags::empty(),
1502 _decode,
1503 )
1504 }
1505
1506 type WatchDeviceStateResponseFut =
1507 fidl::client::QueryResponseFut<DeviceState, fidl::encoding::DefaultFuchsiaResourceDialect>;
1508 fn r#watch_device_state(&self) -> Self::WatchDeviceStateResponseFut {
1509 fn _decode(
1510 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1511 ) -> Result<DeviceState, fidl::Error> {
1512 let _response = fidl::client::decode_transaction_body::<
1513 DeviceWatchDeviceStateResponse,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 0x593be5b83e80d249,
1516 >(_buf?)?;
1517 Ok(_response.device_combined_state)
1518 }
1519 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceState>(
1520 (),
1521 0x593be5b83e80d249,
1522 fidl::encoding::DynamicFlags::empty(),
1523 _decode,
1524 )
1525 }
1526}
1527
1528pub struct DeviceEventStream {
1529 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1530}
1531
1532impl std::marker::Unpin for DeviceEventStream {}
1533
1534impl futures::stream::FusedStream for DeviceEventStream {
1535 fn is_terminated(&self) -> bool {
1536 self.event_receiver.is_terminated()
1537 }
1538}
1539
1540impl futures::Stream for DeviceEventStream {
1541 type Item = Result<DeviceEvent, fidl::Error>;
1542
1543 fn poll_next(
1544 mut self: std::pin::Pin<&mut Self>,
1545 cx: &mut std::task::Context<'_>,
1546 ) -> std::task::Poll<Option<Self::Item>> {
1547 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1548 &mut self.event_receiver,
1549 cx
1550 )?) {
1551 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1552 None => std::task::Poll::Ready(None),
1553 }
1554 }
1555}
1556
1557#[derive(Debug)]
1558pub enum DeviceEvent {}
1559
1560impl DeviceEvent {
1561 fn decode(
1563 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1564 ) -> Result<DeviceEvent, fidl::Error> {
1565 let (bytes, _handles) = buf.split_mut();
1566 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1567 debug_assert_eq!(tx_header.tx_id, 0);
1568 match tx_header.ordinal {
1569 _ => Err(fidl::Error::UnknownOrdinal {
1570 ordinal: tx_header.ordinal,
1571 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1572 }),
1573 }
1574 }
1575}
1576
1577pub struct DeviceRequestStream {
1579 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1580 is_terminated: bool,
1581}
1582
1583impl std::marker::Unpin for DeviceRequestStream {}
1584
1585impl futures::stream::FusedStream for DeviceRequestStream {
1586 fn is_terminated(&self) -> bool {
1587 self.is_terminated
1588 }
1589}
1590
1591impl fidl::endpoints::RequestStream for DeviceRequestStream {
1592 type Protocol = DeviceMarker;
1593 type ControlHandle = DeviceControlHandle;
1594
1595 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1596 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1597 }
1598
1599 fn control_handle(&self) -> Self::ControlHandle {
1600 DeviceControlHandle { inner: self.inner.clone() }
1601 }
1602
1603 fn into_inner(
1604 self,
1605 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1606 {
1607 (self.inner, self.is_terminated)
1608 }
1609
1610 fn from_inner(
1611 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1612 is_terminated: bool,
1613 ) -> Self {
1614 Self { inner, is_terminated }
1615 }
1616}
1617
1618impl futures::Stream for DeviceRequestStream {
1619 type Item = Result<DeviceRequest, fidl::Error>;
1620
1621 fn poll_next(
1622 mut self: std::pin::Pin<&mut Self>,
1623 cx: &mut std::task::Context<'_>,
1624 ) -> std::task::Poll<Option<Self::Item>> {
1625 let this = &mut *self;
1626 if this.inner.check_shutdown(cx) {
1627 this.is_terminated = true;
1628 return std::task::Poll::Ready(None);
1629 }
1630 if this.is_terminated {
1631 panic!("polled DeviceRequestStream after completion");
1632 }
1633 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1634 |bytes, handles| {
1635 match this.inner.channel().read_etc(cx, bytes, handles) {
1636 std::task::Poll::Ready(Ok(())) => {}
1637 std::task::Poll::Pending => return std::task::Poll::Pending,
1638 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1639 this.is_terminated = true;
1640 return std::task::Poll::Ready(None);
1641 }
1642 std::task::Poll::Ready(Err(e)) => {
1643 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1644 e.into(),
1645 ))))
1646 }
1647 }
1648
1649 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1651
1652 std::task::Poll::Ready(Some(match header.ordinal {
1653 0x3501046988e17076 => {
1654 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1655 let mut req = fidl::new_empty!(
1656 DeviceProvisionNetworkRequest,
1657 fidl::encoding::DefaultFuchsiaResourceDialect
1658 );
1659 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProvisionNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
1660 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1661 Ok(DeviceRequest::ProvisionNetwork {
1662 params: req.params,
1663
1664 responder: DeviceProvisionNetworkResponder {
1665 control_handle: std::mem::ManuallyDrop::new(control_handle),
1666 tx_id: header.tx_id,
1667 },
1668 })
1669 }
1670 0x66919e4f9752c53e => {
1671 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1672 let mut req = fidl::new_empty!(
1673 fidl::encoding::EmptyPayload,
1674 fidl::encoding::DefaultFuchsiaResourceDialect
1675 );
1676 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1677 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1678 Ok(DeviceRequest::LeaveNetwork {
1679 responder: DeviceLeaveNetworkResponder {
1680 control_handle: std::mem::ManuallyDrop::new(control_handle),
1681 tx_id: header.tx_id,
1682 },
1683 })
1684 }
1685 0x55a6837f8bbb344b => {
1686 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1687 let mut req = fidl::new_empty!(
1688 DeviceSetActiveRequest,
1689 fidl::encoding::DefaultFuchsiaResourceDialect
1690 );
1691 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetActiveRequest>(&header, _body_bytes, handles, &mut req)?;
1692 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1693 Ok(DeviceRequest::SetActive {
1694 active: req.active,
1695
1696 responder: DeviceSetActiveResponder {
1697 control_handle: std::mem::ManuallyDrop::new(control_handle),
1698 tx_id: header.tx_id,
1699 },
1700 })
1701 }
1702 0x6d8f71a5beb15ebf => {
1703 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1704 let mut req = fidl::new_empty!(
1705 fidl::encoding::EmptyPayload,
1706 fidl::encoding::DefaultFuchsiaResourceDialect
1707 );
1708 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1709 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1710 Ok(DeviceRequest::GetSupportedNetworkTypes {
1711 responder: DeviceGetSupportedNetworkTypesResponder {
1712 control_handle: std::mem::ManuallyDrop::new(control_handle),
1713 tx_id: header.tx_id,
1714 },
1715 })
1716 }
1717 0x593be5b83e80d249 => {
1718 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1719 let mut req = fidl::new_empty!(
1720 fidl::encoding::EmptyPayload,
1721 fidl::encoding::DefaultFuchsiaResourceDialect
1722 );
1723 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1724 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1725 Ok(DeviceRequest::WatchDeviceState {
1726 responder: DeviceWatchDeviceStateResponder {
1727 control_handle: std::mem::ManuallyDrop::new(control_handle),
1728 tx_id: header.tx_id,
1729 },
1730 })
1731 }
1732 _ => Err(fidl::Error::UnknownOrdinal {
1733 ordinal: header.ordinal,
1734 protocol_name:
1735 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1736 }),
1737 }))
1738 },
1739 )
1740 }
1741}
1742
1743#[derive(Debug)]
1751pub enum DeviceRequest {
1752 ProvisionNetwork { params: ProvisioningParams, responder: DeviceProvisionNetworkResponder },
1779 LeaveNetwork { responder: DeviceLeaveNetworkResponder },
1797 SetActive { active: bool, responder: DeviceSetActiveResponder },
1810 GetSupportedNetworkTypes { responder: DeviceGetSupportedNetworkTypesResponder },
1816 WatchDeviceState { responder: DeviceWatchDeviceStateResponder },
1826}
1827
1828impl DeviceRequest {
1829 #[allow(irrefutable_let_patterns)]
1830 pub fn into_provision_network(
1831 self,
1832 ) -> Option<(ProvisioningParams, DeviceProvisionNetworkResponder)> {
1833 if let DeviceRequest::ProvisionNetwork { params, responder } = self {
1834 Some((params, responder))
1835 } else {
1836 None
1837 }
1838 }
1839
1840 #[allow(irrefutable_let_patterns)]
1841 pub fn into_leave_network(self) -> Option<(DeviceLeaveNetworkResponder)> {
1842 if let DeviceRequest::LeaveNetwork { responder } = self {
1843 Some((responder))
1844 } else {
1845 None
1846 }
1847 }
1848
1849 #[allow(irrefutable_let_patterns)]
1850 pub fn into_set_active(self) -> Option<(bool, DeviceSetActiveResponder)> {
1851 if let DeviceRequest::SetActive { active, responder } = self {
1852 Some((active, responder))
1853 } else {
1854 None
1855 }
1856 }
1857
1858 #[allow(irrefutable_let_patterns)]
1859 pub fn into_get_supported_network_types(
1860 self,
1861 ) -> Option<(DeviceGetSupportedNetworkTypesResponder)> {
1862 if let DeviceRequest::GetSupportedNetworkTypes { responder } = self {
1863 Some((responder))
1864 } else {
1865 None
1866 }
1867 }
1868
1869 #[allow(irrefutable_let_patterns)]
1870 pub fn into_watch_device_state(self) -> Option<(DeviceWatchDeviceStateResponder)> {
1871 if let DeviceRequest::WatchDeviceState { responder } = self {
1872 Some((responder))
1873 } else {
1874 None
1875 }
1876 }
1877
1878 pub fn method_name(&self) -> &'static str {
1880 match *self {
1881 DeviceRequest::ProvisionNetwork { .. } => "provision_network",
1882 DeviceRequest::LeaveNetwork { .. } => "leave_network",
1883 DeviceRequest::SetActive { .. } => "set_active",
1884 DeviceRequest::GetSupportedNetworkTypes { .. } => "get_supported_network_types",
1885 DeviceRequest::WatchDeviceState { .. } => "watch_device_state",
1886 }
1887 }
1888}
1889
1890#[derive(Debug, Clone)]
1891pub struct DeviceControlHandle {
1892 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1893}
1894
1895impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1896 fn shutdown(&self) {
1897 self.inner.shutdown()
1898 }
1899 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1900 self.inner.shutdown_with_epitaph(status)
1901 }
1902
1903 fn is_closed(&self) -> bool {
1904 self.inner.channel().is_closed()
1905 }
1906 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1907 self.inner.channel().on_closed()
1908 }
1909
1910 #[cfg(target_os = "fuchsia")]
1911 fn signal_peer(
1912 &self,
1913 clear_mask: zx::Signals,
1914 set_mask: zx::Signals,
1915 ) -> Result<(), zx_status::Status> {
1916 use fidl::Peered;
1917 self.inner.channel().signal_peer(clear_mask, set_mask)
1918 }
1919}
1920
1921impl DeviceControlHandle {}
1922
1923#[must_use = "FIDL methods require a response to be sent"]
1924#[derive(Debug)]
1925pub struct DeviceProvisionNetworkResponder {
1926 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1927 tx_id: u32,
1928}
1929
1930impl std::ops::Drop for DeviceProvisionNetworkResponder {
1934 fn drop(&mut self) {
1935 self.control_handle.shutdown();
1936 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1938 }
1939}
1940
1941impl fidl::endpoints::Responder for DeviceProvisionNetworkResponder {
1942 type ControlHandle = DeviceControlHandle;
1943
1944 fn control_handle(&self) -> &DeviceControlHandle {
1945 &self.control_handle
1946 }
1947
1948 fn drop_without_shutdown(mut self) {
1949 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1951 std::mem::forget(self);
1953 }
1954}
1955
1956impl DeviceProvisionNetworkResponder {
1957 pub fn send(self) -> Result<(), fidl::Error> {
1961 let _result = self.send_raw();
1962 if _result.is_err() {
1963 self.control_handle.shutdown();
1964 }
1965 self.drop_without_shutdown();
1966 _result
1967 }
1968
1969 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1971 let _result = self.send_raw();
1972 self.drop_without_shutdown();
1973 _result
1974 }
1975
1976 fn send_raw(&self) -> Result<(), fidl::Error> {
1977 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1978 (),
1979 self.tx_id,
1980 0x3501046988e17076,
1981 fidl::encoding::DynamicFlags::empty(),
1982 )
1983 }
1984}
1985
1986#[must_use = "FIDL methods require a response to be sent"]
1987#[derive(Debug)]
1988pub struct DeviceLeaveNetworkResponder {
1989 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1990 tx_id: u32,
1991}
1992
1993impl std::ops::Drop for DeviceLeaveNetworkResponder {
1997 fn drop(&mut self) {
1998 self.control_handle.shutdown();
1999 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2001 }
2002}
2003
2004impl fidl::endpoints::Responder for DeviceLeaveNetworkResponder {
2005 type ControlHandle = DeviceControlHandle;
2006
2007 fn control_handle(&self) -> &DeviceControlHandle {
2008 &self.control_handle
2009 }
2010
2011 fn drop_without_shutdown(mut self) {
2012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2014 std::mem::forget(self);
2016 }
2017}
2018
2019impl DeviceLeaveNetworkResponder {
2020 pub fn send(self) -> Result<(), fidl::Error> {
2024 let _result = self.send_raw();
2025 if _result.is_err() {
2026 self.control_handle.shutdown();
2027 }
2028 self.drop_without_shutdown();
2029 _result
2030 }
2031
2032 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2034 let _result = self.send_raw();
2035 self.drop_without_shutdown();
2036 _result
2037 }
2038
2039 fn send_raw(&self) -> Result<(), fidl::Error> {
2040 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2041 (),
2042 self.tx_id,
2043 0x66919e4f9752c53e,
2044 fidl::encoding::DynamicFlags::empty(),
2045 )
2046 }
2047}
2048
2049#[must_use = "FIDL methods require a response to be sent"]
2050#[derive(Debug)]
2051pub struct DeviceSetActiveResponder {
2052 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2053 tx_id: u32,
2054}
2055
2056impl std::ops::Drop for DeviceSetActiveResponder {
2060 fn drop(&mut self) {
2061 self.control_handle.shutdown();
2062 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2064 }
2065}
2066
2067impl fidl::endpoints::Responder for DeviceSetActiveResponder {
2068 type ControlHandle = DeviceControlHandle;
2069
2070 fn control_handle(&self) -> &DeviceControlHandle {
2071 &self.control_handle
2072 }
2073
2074 fn drop_without_shutdown(mut self) {
2075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2077 std::mem::forget(self);
2079 }
2080}
2081
2082impl DeviceSetActiveResponder {
2083 pub fn send(self) -> Result<(), fidl::Error> {
2087 let _result = self.send_raw();
2088 if _result.is_err() {
2089 self.control_handle.shutdown();
2090 }
2091 self.drop_without_shutdown();
2092 _result
2093 }
2094
2095 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2097 let _result = self.send_raw();
2098 self.drop_without_shutdown();
2099 _result
2100 }
2101
2102 fn send_raw(&self) -> Result<(), fidl::Error> {
2103 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2104 (),
2105 self.tx_id,
2106 0x55a6837f8bbb344b,
2107 fidl::encoding::DynamicFlags::empty(),
2108 )
2109 }
2110}
2111
2112#[must_use = "FIDL methods require a response to be sent"]
2113#[derive(Debug)]
2114pub struct DeviceGetSupportedNetworkTypesResponder {
2115 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2116 tx_id: u32,
2117}
2118
2119impl std::ops::Drop for DeviceGetSupportedNetworkTypesResponder {
2123 fn drop(&mut self) {
2124 self.control_handle.shutdown();
2125 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2127 }
2128}
2129
2130impl fidl::endpoints::Responder for DeviceGetSupportedNetworkTypesResponder {
2131 type ControlHandle = DeviceControlHandle;
2132
2133 fn control_handle(&self) -> &DeviceControlHandle {
2134 &self.control_handle
2135 }
2136
2137 fn drop_without_shutdown(mut self) {
2138 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2140 std::mem::forget(self);
2142 }
2143}
2144
2145impl DeviceGetSupportedNetworkTypesResponder {
2146 pub fn send(self, mut network_types: &[String]) -> Result<(), fidl::Error> {
2150 let _result = self.send_raw(network_types);
2151 if _result.is_err() {
2152 self.control_handle.shutdown();
2153 }
2154 self.drop_without_shutdown();
2155 _result
2156 }
2157
2158 pub fn send_no_shutdown_on_err(self, mut network_types: &[String]) -> Result<(), fidl::Error> {
2160 let _result = self.send_raw(network_types);
2161 self.drop_without_shutdown();
2162 _result
2163 }
2164
2165 fn send_raw(&self, mut network_types: &[String]) -> Result<(), fidl::Error> {
2166 self.control_handle.inner.send::<DeviceGetSupportedNetworkTypesResponse>(
2167 (network_types,),
2168 self.tx_id,
2169 0x6d8f71a5beb15ebf,
2170 fidl::encoding::DynamicFlags::empty(),
2171 )
2172 }
2173}
2174
2175#[must_use = "FIDL methods require a response to be sent"]
2176#[derive(Debug)]
2177pub struct DeviceWatchDeviceStateResponder {
2178 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2179 tx_id: u32,
2180}
2181
2182impl std::ops::Drop for DeviceWatchDeviceStateResponder {
2186 fn drop(&mut self) {
2187 self.control_handle.shutdown();
2188 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2190 }
2191}
2192
2193impl fidl::endpoints::Responder for DeviceWatchDeviceStateResponder {
2194 type ControlHandle = DeviceControlHandle;
2195
2196 fn control_handle(&self) -> &DeviceControlHandle {
2197 &self.control_handle
2198 }
2199
2200 fn drop_without_shutdown(mut self) {
2201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2203 std::mem::forget(self);
2205 }
2206}
2207
2208impl DeviceWatchDeviceStateResponder {
2209 pub fn send(self, mut device_combined_state: &DeviceState) -> Result<(), fidl::Error> {
2213 let _result = self.send_raw(device_combined_state);
2214 if _result.is_err() {
2215 self.control_handle.shutdown();
2216 }
2217 self.drop_without_shutdown();
2218 _result
2219 }
2220
2221 pub fn send_no_shutdown_on_err(
2223 self,
2224 mut device_combined_state: &DeviceState,
2225 ) -> Result<(), fidl::Error> {
2226 let _result = self.send_raw(device_combined_state);
2227 self.drop_without_shutdown();
2228 _result
2229 }
2230
2231 fn send_raw(&self, mut device_combined_state: &DeviceState) -> Result<(), fidl::Error> {
2232 self.control_handle.inner.send::<DeviceWatchDeviceStateResponse>(
2233 (device_combined_state,),
2234 self.tx_id,
2235 0x593be5b83e80d249,
2236 fidl::encoding::DynamicFlags::empty(),
2237 )
2238 }
2239}
2240
2241#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2242pub struct DeviceConnectorMarker;
2243
2244impl fidl::endpoints::ProtocolMarker for DeviceConnectorMarker {
2245 type Proxy = DeviceConnectorProxy;
2246 type RequestStream = DeviceConnectorRequestStream;
2247 #[cfg(target_os = "fuchsia")]
2248 type SynchronousProxy = DeviceConnectorSynchronousProxy;
2249
2250 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.DeviceConnector";
2251}
2252impl fidl::endpoints::DiscoverableProtocolMarker for DeviceConnectorMarker {}
2253
2254pub trait DeviceConnectorProxyInterface: Send + Sync {
2255 fn r#connect(
2256 &self,
2257 name: &str,
2258 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2259 ) -> Result<(), fidl::Error>;
2260}
2261#[derive(Debug)]
2262#[cfg(target_os = "fuchsia")]
2263pub struct DeviceConnectorSynchronousProxy {
2264 client: fidl::client::sync::Client,
2265}
2266
2267#[cfg(target_os = "fuchsia")]
2268impl fidl::endpoints::SynchronousProxy for DeviceConnectorSynchronousProxy {
2269 type Proxy = DeviceConnectorProxy;
2270 type Protocol = DeviceConnectorMarker;
2271
2272 fn from_channel(inner: fidl::Channel) -> Self {
2273 Self::new(inner)
2274 }
2275
2276 fn into_channel(self) -> fidl::Channel {
2277 self.client.into_channel()
2278 }
2279
2280 fn as_channel(&self) -> &fidl::Channel {
2281 self.client.as_channel()
2282 }
2283}
2284
2285#[cfg(target_os = "fuchsia")]
2286impl DeviceConnectorSynchronousProxy {
2287 pub fn new(channel: fidl::Channel) -> Self {
2288 let protocol_name = <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2289 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2290 }
2291
2292 pub fn into_channel(self) -> fidl::Channel {
2293 self.client.into_channel()
2294 }
2295
2296 pub fn wait_for_event(
2299 &self,
2300 deadline: zx::MonotonicInstant,
2301 ) -> Result<DeviceConnectorEvent, fidl::Error> {
2302 DeviceConnectorEvent::decode(self.client.wait_for_event(deadline)?)
2303 }
2304
2305 pub fn r#connect(
2322 &self,
2323 mut name: &str,
2324 mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2325 ) -> Result<(), fidl::Error> {
2326 self.client.send::<DeviceConnectorConnectRequest>(
2327 (name, server_end),
2328 0x63470c4c0c8e678a,
2329 fidl::encoding::DynamicFlags::empty(),
2330 )
2331 }
2332}
2333
2334#[cfg(target_os = "fuchsia")]
2335impl From<DeviceConnectorSynchronousProxy> for zx::Handle {
2336 fn from(value: DeviceConnectorSynchronousProxy) -> Self {
2337 value.into_channel().into()
2338 }
2339}
2340
2341#[cfg(target_os = "fuchsia")]
2342impl From<fidl::Channel> for DeviceConnectorSynchronousProxy {
2343 fn from(value: fidl::Channel) -> Self {
2344 Self::new(value)
2345 }
2346}
2347
2348#[derive(Debug, Clone)]
2349pub struct DeviceConnectorProxy {
2350 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2351}
2352
2353impl fidl::endpoints::Proxy for DeviceConnectorProxy {
2354 type Protocol = DeviceConnectorMarker;
2355
2356 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2357 Self::new(inner)
2358 }
2359
2360 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2361 self.client.into_channel().map_err(|client| Self { client })
2362 }
2363
2364 fn as_channel(&self) -> &::fidl::AsyncChannel {
2365 self.client.as_channel()
2366 }
2367}
2368
2369impl DeviceConnectorProxy {
2370 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2372 let protocol_name = <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2373 Self { client: fidl::client::Client::new(channel, protocol_name) }
2374 }
2375
2376 pub fn take_event_stream(&self) -> DeviceConnectorEventStream {
2382 DeviceConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2383 }
2384
2385 pub fn r#connect(
2402 &self,
2403 mut name: &str,
2404 mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2405 ) -> Result<(), fidl::Error> {
2406 DeviceConnectorProxyInterface::r#connect(self, name, server_end)
2407 }
2408}
2409
2410impl DeviceConnectorProxyInterface for DeviceConnectorProxy {
2411 fn r#connect(
2412 &self,
2413 mut name: &str,
2414 mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2415 ) -> Result<(), fidl::Error> {
2416 self.client.send::<DeviceConnectorConnectRequest>(
2417 (name, server_end),
2418 0x63470c4c0c8e678a,
2419 fidl::encoding::DynamicFlags::empty(),
2420 )
2421 }
2422}
2423
2424pub struct DeviceConnectorEventStream {
2425 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2426}
2427
2428impl std::marker::Unpin for DeviceConnectorEventStream {}
2429
2430impl futures::stream::FusedStream for DeviceConnectorEventStream {
2431 fn is_terminated(&self) -> bool {
2432 self.event_receiver.is_terminated()
2433 }
2434}
2435
2436impl futures::Stream for DeviceConnectorEventStream {
2437 type Item = Result<DeviceConnectorEvent, fidl::Error>;
2438
2439 fn poll_next(
2440 mut self: std::pin::Pin<&mut Self>,
2441 cx: &mut std::task::Context<'_>,
2442 ) -> std::task::Poll<Option<Self::Item>> {
2443 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2444 &mut self.event_receiver,
2445 cx
2446 )?) {
2447 Some(buf) => std::task::Poll::Ready(Some(DeviceConnectorEvent::decode(buf))),
2448 None => std::task::Poll::Ready(None),
2449 }
2450 }
2451}
2452
2453#[derive(Debug)]
2454pub enum DeviceConnectorEvent {}
2455
2456impl DeviceConnectorEvent {
2457 fn decode(
2459 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2460 ) -> Result<DeviceConnectorEvent, fidl::Error> {
2461 let (bytes, _handles) = buf.split_mut();
2462 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2463 debug_assert_eq!(tx_header.tx_id, 0);
2464 match tx_header.ordinal {
2465 _ => Err(fidl::Error::UnknownOrdinal {
2466 ordinal: tx_header.ordinal,
2467 protocol_name:
2468 <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2469 }),
2470 }
2471 }
2472}
2473
2474pub struct DeviceConnectorRequestStream {
2476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2477 is_terminated: bool,
2478}
2479
2480impl std::marker::Unpin for DeviceConnectorRequestStream {}
2481
2482impl futures::stream::FusedStream for DeviceConnectorRequestStream {
2483 fn is_terminated(&self) -> bool {
2484 self.is_terminated
2485 }
2486}
2487
2488impl fidl::endpoints::RequestStream for DeviceConnectorRequestStream {
2489 type Protocol = DeviceConnectorMarker;
2490 type ControlHandle = DeviceConnectorControlHandle;
2491
2492 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2493 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2494 }
2495
2496 fn control_handle(&self) -> Self::ControlHandle {
2497 DeviceConnectorControlHandle { inner: self.inner.clone() }
2498 }
2499
2500 fn into_inner(
2501 self,
2502 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2503 {
2504 (self.inner, self.is_terminated)
2505 }
2506
2507 fn from_inner(
2508 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2509 is_terminated: bool,
2510 ) -> Self {
2511 Self { inner, is_terminated }
2512 }
2513}
2514
2515impl futures::Stream for DeviceConnectorRequestStream {
2516 type Item = Result<DeviceConnectorRequest, fidl::Error>;
2517
2518 fn poll_next(
2519 mut self: std::pin::Pin<&mut Self>,
2520 cx: &mut std::task::Context<'_>,
2521 ) -> std::task::Poll<Option<Self::Item>> {
2522 let this = &mut *self;
2523 if this.inner.check_shutdown(cx) {
2524 this.is_terminated = true;
2525 return std::task::Poll::Ready(None);
2526 }
2527 if this.is_terminated {
2528 panic!("polled DeviceConnectorRequestStream after completion");
2529 }
2530 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2531 |bytes, handles| {
2532 match this.inner.channel().read_etc(cx, bytes, handles) {
2533 std::task::Poll::Ready(Ok(())) => {}
2534 std::task::Poll::Pending => return std::task::Poll::Pending,
2535 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2536 this.is_terminated = true;
2537 return std::task::Poll::Ready(None);
2538 }
2539 std::task::Poll::Ready(Err(e)) => {
2540 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2541 e.into(),
2542 ))))
2543 }
2544 }
2545
2546 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2548
2549 std::task::Poll::Ready(Some(match header.ordinal {
2550 0x63470c4c0c8e678a => {
2551 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2552 let mut req = fidl::new_empty!(
2553 DeviceConnectorConnectRequest,
2554 fidl::encoding::DefaultFuchsiaResourceDialect
2555 );
2556 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2557 let control_handle =
2558 DeviceConnectorControlHandle { inner: this.inner.clone() };
2559 Ok(DeviceConnectorRequest::Connect {
2560 name: req.name,
2561 server_end: req.server_end,
2562
2563 control_handle,
2564 })
2565 }
2566 _ => Err(fidl::Error::UnknownOrdinal {
2567 ordinal: header.ordinal,
2568 protocol_name:
2569 <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2570 }),
2571 }))
2572 },
2573 )
2574 }
2575}
2576
2577#[derive(Debug)]
2580pub enum DeviceConnectorRequest {
2581 Connect {
2598 name: String,
2599 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2600 control_handle: DeviceConnectorControlHandle,
2601 },
2602}
2603
2604impl DeviceConnectorRequest {
2605 #[allow(irrefutable_let_patterns)]
2606 pub fn into_connect(
2607 self,
2608 ) -> Option<(String, fidl::endpoints::ServerEnd<DeviceMarker>, DeviceConnectorControlHandle)>
2609 {
2610 if let DeviceConnectorRequest::Connect { name, server_end, control_handle } = self {
2611 Some((name, server_end, control_handle))
2612 } else {
2613 None
2614 }
2615 }
2616
2617 pub fn method_name(&self) -> &'static str {
2619 match *self {
2620 DeviceConnectorRequest::Connect { .. } => "connect",
2621 }
2622 }
2623}
2624
2625#[derive(Debug, Clone)]
2626pub struct DeviceConnectorControlHandle {
2627 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2628}
2629
2630impl fidl::endpoints::ControlHandle for DeviceConnectorControlHandle {
2631 fn shutdown(&self) {
2632 self.inner.shutdown()
2633 }
2634 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2635 self.inner.shutdown_with_epitaph(status)
2636 }
2637
2638 fn is_closed(&self) -> bool {
2639 self.inner.channel().is_closed()
2640 }
2641 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2642 self.inner.channel().on_closed()
2643 }
2644
2645 #[cfg(target_os = "fuchsia")]
2646 fn signal_peer(
2647 &self,
2648 clear_mask: zx::Signals,
2649 set_mask: zx::Signals,
2650 ) -> Result<(), zx_status::Status> {
2651 use fidl::Peered;
2652 self.inner.channel().signal_peer(clear_mask, set_mask)
2653 }
2654}
2655
2656impl DeviceConnectorControlHandle {}
2657
2658#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2659pub struct DeviceExtraMarker;
2660
2661impl fidl::endpoints::ProtocolMarker for DeviceExtraMarker {
2662 type Proxy = DeviceExtraProxy;
2663 type RequestStream = DeviceExtraRequestStream;
2664 #[cfg(target_os = "fuchsia")]
2665 type SynchronousProxy = DeviceExtraSynchronousProxy;
2666
2667 const DEBUG_NAME: &'static str = "(anonymous) DeviceExtra";
2668}
2669
2670pub trait DeviceExtraProxyInterface: Send + Sync {
2671 type GetCredentialResponseFut: std::future::Future<Output = Result<Option<Box<Credential>>, fidl::Error>>
2672 + Send;
2673 fn r#get_credential(&self) -> Self::GetCredentialResponseFut;
2674 type WatchIdentityResponseFut: std::future::Future<Output = Result<Identity, fidl::Error>>
2675 + Send;
2676 fn r#watch_identity(&self) -> Self::WatchIdentityResponseFut;
2677 type GetCurrentMacAddressResponseFut: std::future::Future<Output = Result<fidl_fuchsia_lowpan::MacAddress, fidl::Error>>
2678 + Send;
2679 fn r#get_current_mac_address(&self) -> Self::GetCurrentMacAddressResponseFut;
2680}
2681#[derive(Debug)]
2682#[cfg(target_os = "fuchsia")]
2683pub struct DeviceExtraSynchronousProxy {
2684 client: fidl::client::sync::Client,
2685}
2686
2687#[cfg(target_os = "fuchsia")]
2688impl fidl::endpoints::SynchronousProxy for DeviceExtraSynchronousProxy {
2689 type Proxy = DeviceExtraProxy;
2690 type Protocol = DeviceExtraMarker;
2691
2692 fn from_channel(inner: fidl::Channel) -> Self {
2693 Self::new(inner)
2694 }
2695
2696 fn into_channel(self) -> fidl::Channel {
2697 self.client.into_channel()
2698 }
2699
2700 fn as_channel(&self) -> &fidl::Channel {
2701 self.client.as_channel()
2702 }
2703}
2704
2705#[cfg(target_os = "fuchsia")]
2706impl DeviceExtraSynchronousProxy {
2707 pub fn new(channel: fidl::Channel) -> Self {
2708 let protocol_name = <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2709 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2710 }
2711
2712 pub fn into_channel(self) -> fidl::Channel {
2713 self.client.into_channel()
2714 }
2715
2716 pub fn wait_for_event(
2719 &self,
2720 deadline: zx::MonotonicInstant,
2721 ) -> Result<DeviceExtraEvent, fidl::Error> {
2722 DeviceExtraEvent::decode(self.client.wait_for_event(deadline)?)
2723 }
2724
2725 pub fn r#get_credential(
2732 &self,
2733 ___deadline: zx::MonotonicInstant,
2734 ) -> Result<Option<Box<Credential>>, fidl::Error> {
2735 let _response = self
2736 .client
2737 .send_query::<fidl::encoding::EmptyPayload, DeviceExtraGetCredentialResponse>(
2738 (),
2739 0x77f75f289c8c4ceb,
2740 fidl::encoding::DynamicFlags::empty(),
2741 ___deadline,
2742 )?;
2743 Ok(_response.credential)
2744 }
2745
2746 pub fn r#watch_identity(
2770 &self,
2771 ___deadline: zx::MonotonicInstant,
2772 ) -> Result<Identity, fidl::Error> {
2773 let _response = self
2774 .client
2775 .send_query::<fidl::encoding::EmptyPayload, DeviceExtraWatchIdentityResponse>(
2776 (),
2777 0xb9f5d8963eaebc6,
2778 fidl::encoding::DynamicFlags::empty(),
2779 ___deadline,
2780 )?;
2781 Ok(_response.identity)
2782 }
2783
2784 pub fn r#get_current_mac_address(
2791 &self,
2792 ___deadline: zx::MonotonicInstant,
2793 ) -> Result<fidl_fuchsia_lowpan::MacAddress, fidl::Error> {
2794 let _response = self
2795 .client
2796 .send_query::<fidl::encoding::EmptyPayload, DeviceExtraGetCurrentMacAddressResponse>(
2797 (),
2798 0x70835954071d94dd,
2799 fidl::encoding::DynamicFlags::empty(),
2800 ___deadline,
2801 )?;
2802 Ok(_response.address)
2803 }
2804}
2805
2806#[cfg(target_os = "fuchsia")]
2807impl From<DeviceExtraSynchronousProxy> for zx::Handle {
2808 fn from(value: DeviceExtraSynchronousProxy) -> Self {
2809 value.into_channel().into()
2810 }
2811}
2812
2813#[cfg(target_os = "fuchsia")]
2814impl From<fidl::Channel> for DeviceExtraSynchronousProxy {
2815 fn from(value: fidl::Channel) -> Self {
2816 Self::new(value)
2817 }
2818}
2819
2820#[derive(Debug, Clone)]
2821pub struct DeviceExtraProxy {
2822 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2823}
2824
2825impl fidl::endpoints::Proxy for DeviceExtraProxy {
2826 type Protocol = DeviceExtraMarker;
2827
2828 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2829 Self::new(inner)
2830 }
2831
2832 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2833 self.client.into_channel().map_err(|client| Self { client })
2834 }
2835
2836 fn as_channel(&self) -> &::fidl::AsyncChannel {
2837 self.client.as_channel()
2838 }
2839}
2840
2841impl DeviceExtraProxy {
2842 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2844 let protocol_name = <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2845 Self { client: fidl::client::Client::new(channel, protocol_name) }
2846 }
2847
2848 pub fn take_event_stream(&self) -> DeviceExtraEventStream {
2854 DeviceExtraEventStream { event_receiver: self.client.take_event_receiver() }
2855 }
2856
2857 pub fn r#get_credential(
2864 &self,
2865 ) -> fidl::client::QueryResponseFut<
2866 Option<Box<Credential>>,
2867 fidl::encoding::DefaultFuchsiaResourceDialect,
2868 > {
2869 DeviceExtraProxyInterface::r#get_credential(self)
2870 }
2871
2872 pub fn r#watch_identity(
2896 &self,
2897 ) -> fidl::client::QueryResponseFut<Identity, fidl::encoding::DefaultFuchsiaResourceDialect>
2898 {
2899 DeviceExtraProxyInterface::r#watch_identity(self)
2900 }
2901
2902 pub fn r#get_current_mac_address(
2909 &self,
2910 ) -> fidl::client::QueryResponseFut<
2911 fidl_fuchsia_lowpan::MacAddress,
2912 fidl::encoding::DefaultFuchsiaResourceDialect,
2913 > {
2914 DeviceExtraProxyInterface::r#get_current_mac_address(self)
2915 }
2916}
2917
2918impl DeviceExtraProxyInterface for DeviceExtraProxy {
2919 type GetCredentialResponseFut = fidl::client::QueryResponseFut<
2920 Option<Box<Credential>>,
2921 fidl::encoding::DefaultFuchsiaResourceDialect,
2922 >;
2923 fn r#get_credential(&self) -> Self::GetCredentialResponseFut {
2924 fn _decode(
2925 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2926 ) -> Result<Option<Box<Credential>>, fidl::Error> {
2927 let _response = fidl::client::decode_transaction_body::<
2928 DeviceExtraGetCredentialResponse,
2929 fidl::encoding::DefaultFuchsiaResourceDialect,
2930 0x77f75f289c8c4ceb,
2931 >(_buf?)?;
2932 Ok(_response.credential)
2933 }
2934 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<Box<Credential>>>(
2935 (),
2936 0x77f75f289c8c4ceb,
2937 fidl::encoding::DynamicFlags::empty(),
2938 _decode,
2939 )
2940 }
2941
2942 type WatchIdentityResponseFut =
2943 fidl::client::QueryResponseFut<Identity, fidl::encoding::DefaultFuchsiaResourceDialect>;
2944 fn r#watch_identity(&self) -> Self::WatchIdentityResponseFut {
2945 fn _decode(
2946 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2947 ) -> Result<Identity, fidl::Error> {
2948 let _response = fidl::client::decode_transaction_body::<
2949 DeviceExtraWatchIdentityResponse,
2950 fidl::encoding::DefaultFuchsiaResourceDialect,
2951 0xb9f5d8963eaebc6,
2952 >(_buf?)?;
2953 Ok(_response.identity)
2954 }
2955 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Identity>(
2956 (),
2957 0xb9f5d8963eaebc6,
2958 fidl::encoding::DynamicFlags::empty(),
2959 _decode,
2960 )
2961 }
2962
2963 type GetCurrentMacAddressResponseFut = fidl::client::QueryResponseFut<
2964 fidl_fuchsia_lowpan::MacAddress,
2965 fidl::encoding::DefaultFuchsiaResourceDialect,
2966 >;
2967 fn r#get_current_mac_address(&self) -> Self::GetCurrentMacAddressResponseFut {
2968 fn _decode(
2969 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2970 ) -> Result<fidl_fuchsia_lowpan::MacAddress, fidl::Error> {
2971 let _response = fidl::client::decode_transaction_body::<
2972 DeviceExtraGetCurrentMacAddressResponse,
2973 fidl::encoding::DefaultFuchsiaResourceDialect,
2974 0x70835954071d94dd,
2975 >(_buf?)?;
2976 Ok(_response.address)
2977 }
2978 self.client
2979 .send_query_and_decode::<fidl::encoding::EmptyPayload, fidl_fuchsia_lowpan::MacAddress>(
2980 (),
2981 0x70835954071d94dd,
2982 fidl::encoding::DynamicFlags::empty(),
2983 _decode,
2984 )
2985 }
2986}
2987
2988pub struct DeviceExtraEventStream {
2989 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2990}
2991
2992impl std::marker::Unpin for DeviceExtraEventStream {}
2993
2994impl futures::stream::FusedStream for DeviceExtraEventStream {
2995 fn is_terminated(&self) -> bool {
2996 self.event_receiver.is_terminated()
2997 }
2998}
2999
3000impl futures::Stream for DeviceExtraEventStream {
3001 type Item = Result<DeviceExtraEvent, fidl::Error>;
3002
3003 fn poll_next(
3004 mut self: std::pin::Pin<&mut Self>,
3005 cx: &mut std::task::Context<'_>,
3006 ) -> std::task::Poll<Option<Self::Item>> {
3007 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3008 &mut self.event_receiver,
3009 cx
3010 )?) {
3011 Some(buf) => std::task::Poll::Ready(Some(DeviceExtraEvent::decode(buf))),
3012 None => std::task::Poll::Ready(None),
3013 }
3014 }
3015}
3016
3017#[derive(Debug)]
3018pub enum DeviceExtraEvent {}
3019
3020impl DeviceExtraEvent {
3021 fn decode(
3023 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3024 ) -> Result<DeviceExtraEvent, fidl::Error> {
3025 let (bytes, _handles) = buf.split_mut();
3026 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3027 debug_assert_eq!(tx_header.tx_id, 0);
3028 match tx_header.ordinal {
3029 _ => Err(fidl::Error::UnknownOrdinal {
3030 ordinal: tx_header.ordinal,
3031 protocol_name: <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3032 }),
3033 }
3034 }
3035}
3036
3037pub struct DeviceExtraRequestStream {
3039 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3040 is_terminated: bool,
3041}
3042
3043impl std::marker::Unpin for DeviceExtraRequestStream {}
3044
3045impl futures::stream::FusedStream for DeviceExtraRequestStream {
3046 fn is_terminated(&self) -> bool {
3047 self.is_terminated
3048 }
3049}
3050
3051impl fidl::endpoints::RequestStream for DeviceExtraRequestStream {
3052 type Protocol = DeviceExtraMarker;
3053 type ControlHandle = DeviceExtraControlHandle;
3054
3055 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3056 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3057 }
3058
3059 fn control_handle(&self) -> Self::ControlHandle {
3060 DeviceExtraControlHandle { inner: self.inner.clone() }
3061 }
3062
3063 fn into_inner(
3064 self,
3065 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3066 {
3067 (self.inner, self.is_terminated)
3068 }
3069
3070 fn from_inner(
3071 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3072 is_terminated: bool,
3073 ) -> Self {
3074 Self { inner, is_terminated }
3075 }
3076}
3077
3078impl futures::Stream for DeviceExtraRequestStream {
3079 type Item = Result<DeviceExtraRequest, fidl::Error>;
3080
3081 fn poll_next(
3082 mut self: std::pin::Pin<&mut Self>,
3083 cx: &mut std::task::Context<'_>,
3084 ) -> std::task::Poll<Option<Self::Item>> {
3085 let this = &mut *self;
3086 if this.inner.check_shutdown(cx) {
3087 this.is_terminated = true;
3088 return std::task::Poll::Ready(None);
3089 }
3090 if this.is_terminated {
3091 panic!("polled DeviceExtraRequestStream after completion");
3092 }
3093 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3094 |bytes, handles| {
3095 match this.inner.channel().read_etc(cx, bytes, handles) {
3096 std::task::Poll::Ready(Ok(())) => {}
3097 std::task::Poll::Pending => return std::task::Poll::Pending,
3098 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3099 this.is_terminated = true;
3100 return std::task::Poll::Ready(None);
3101 }
3102 std::task::Poll::Ready(Err(e)) => {
3103 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3104 e.into(),
3105 ))))
3106 }
3107 }
3108
3109 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3111
3112 std::task::Poll::Ready(Some(match header.ordinal {
3113 0x77f75f289c8c4ceb => {
3114 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3115 let mut req = fidl::new_empty!(
3116 fidl::encoding::EmptyPayload,
3117 fidl::encoding::DefaultFuchsiaResourceDialect
3118 );
3119 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3120 let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
3121 Ok(DeviceExtraRequest::GetCredential {
3122 responder: DeviceExtraGetCredentialResponder {
3123 control_handle: std::mem::ManuallyDrop::new(control_handle),
3124 tx_id: header.tx_id,
3125 },
3126 })
3127 }
3128 0xb9f5d8963eaebc6 => {
3129 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3130 let mut req = fidl::new_empty!(
3131 fidl::encoding::EmptyPayload,
3132 fidl::encoding::DefaultFuchsiaResourceDialect
3133 );
3134 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3135 let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
3136 Ok(DeviceExtraRequest::WatchIdentity {
3137 responder: DeviceExtraWatchIdentityResponder {
3138 control_handle: std::mem::ManuallyDrop::new(control_handle),
3139 tx_id: header.tx_id,
3140 },
3141 })
3142 }
3143 0x70835954071d94dd => {
3144 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3145 let mut req = fidl::new_empty!(
3146 fidl::encoding::EmptyPayload,
3147 fidl::encoding::DefaultFuchsiaResourceDialect
3148 );
3149 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3150 let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
3151 Ok(DeviceExtraRequest::GetCurrentMacAddress {
3152 responder: DeviceExtraGetCurrentMacAddressResponder {
3153 control_handle: std::mem::ManuallyDrop::new(control_handle),
3154 tx_id: header.tx_id,
3155 },
3156 })
3157 }
3158 _ => Err(fidl::Error::UnknownOrdinal {
3159 ordinal: header.ordinal,
3160 protocol_name:
3161 <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3162 }),
3163 }))
3164 },
3165 )
3166 }
3167}
3168
3169#[derive(Debug)]
3175pub enum DeviceExtraRequest {
3176 GetCredential { responder: DeviceExtraGetCredentialResponder },
3183 WatchIdentity { responder: DeviceExtraWatchIdentityResponder },
3207 GetCurrentMacAddress { responder: DeviceExtraGetCurrentMacAddressResponder },
3214}
3215
3216impl DeviceExtraRequest {
3217 #[allow(irrefutable_let_patterns)]
3218 pub fn into_get_credential(self) -> Option<(DeviceExtraGetCredentialResponder)> {
3219 if let DeviceExtraRequest::GetCredential { responder } = self {
3220 Some((responder))
3221 } else {
3222 None
3223 }
3224 }
3225
3226 #[allow(irrefutable_let_patterns)]
3227 pub fn into_watch_identity(self) -> Option<(DeviceExtraWatchIdentityResponder)> {
3228 if let DeviceExtraRequest::WatchIdentity { responder } = self {
3229 Some((responder))
3230 } else {
3231 None
3232 }
3233 }
3234
3235 #[allow(irrefutable_let_patterns)]
3236 pub fn into_get_current_mac_address(
3237 self,
3238 ) -> Option<(DeviceExtraGetCurrentMacAddressResponder)> {
3239 if let DeviceExtraRequest::GetCurrentMacAddress { responder } = self {
3240 Some((responder))
3241 } else {
3242 None
3243 }
3244 }
3245
3246 pub fn method_name(&self) -> &'static str {
3248 match *self {
3249 DeviceExtraRequest::GetCredential { .. } => "get_credential",
3250 DeviceExtraRequest::WatchIdentity { .. } => "watch_identity",
3251 DeviceExtraRequest::GetCurrentMacAddress { .. } => "get_current_mac_address",
3252 }
3253 }
3254}
3255
3256#[derive(Debug, Clone)]
3257pub struct DeviceExtraControlHandle {
3258 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3259}
3260
3261impl fidl::endpoints::ControlHandle for DeviceExtraControlHandle {
3262 fn shutdown(&self) {
3263 self.inner.shutdown()
3264 }
3265 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3266 self.inner.shutdown_with_epitaph(status)
3267 }
3268
3269 fn is_closed(&self) -> bool {
3270 self.inner.channel().is_closed()
3271 }
3272 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3273 self.inner.channel().on_closed()
3274 }
3275
3276 #[cfg(target_os = "fuchsia")]
3277 fn signal_peer(
3278 &self,
3279 clear_mask: zx::Signals,
3280 set_mask: zx::Signals,
3281 ) -> Result<(), zx_status::Status> {
3282 use fidl::Peered;
3283 self.inner.channel().signal_peer(clear_mask, set_mask)
3284 }
3285}
3286
3287impl DeviceExtraControlHandle {}
3288
3289#[must_use = "FIDL methods require a response to be sent"]
3290#[derive(Debug)]
3291pub struct DeviceExtraGetCredentialResponder {
3292 control_handle: std::mem::ManuallyDrop<DeviceExtraControlHandle>,
3293 tx_id: u32,
3294}
3295
3296impl std::ops::Drop for DeviceExtraGetCredentialResponder {
3300 fn drop(&mut self) {
3301 self.control_handle.shutdown();
3302 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3304 }
3305}
3306
3307impl fidl::endpoints::Responder for DeviceExtraGetCredentialResponder {
3308 type ControlHandle = DeviceExtraControlHandle;
3309
3310 fn control_handle(&self) -> &DeviceExtraControlHandle {
3311 &self.control_handle
3312 }
3313
3314 fn drop_without_shutdown(mut self) {
3315 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3317 std::mem::forget(self);
3319 }
3320}
3321
3322impl DeviceExtraGetCredentialResponder {
3323 pub fn send(self, mut credential: Option<&Credential>) -> Result<(), fidl::Error> {
3327 let _result = self.send_raw(credential);
3328 if _result.is_err() {
3329 self.control_handle.shutdown();
3330 }
3331 self.drop_without_shutdown();
3332 _result
3333 }
3334
3335 pub fn send_no_shutdown_on_err(
3337 self,
3338 mut credential: Option<&Credential>,
3339 ) -> Result<(), fidl::Error> {
3340 let _result = self.send_raw(credential);
3341 self.drop_without_shutdown();
3342 _result
3343 }
3344
3345 fn send_raw(&self, mut credential: Option<&Credential>) -> Result<(), fidl::Error> {
3346 self.control_handle.inner.send::<DeviceExtraGetCredentialResponse>(
3347 (credential,),
3348 self.tx_id,
3349 0x77f75f289c8c4ceb,
3350 fidl::encoding::DynamicFlags::empty(),
3351 )
3352 }
3353}
3354
3355#[must_use = "FIDL methods require a response to be sent"]
3356#[derive(Debug)]
3357pub struct DeviceExtraWatchIdentityResponder {
3358 control_handle: std::mem::ManuallyDrop<DeviceExtraControlHandle>,
3359 tx_id: u32,
3360}
3361
3362impl std::ops::Drop for DeviceExtraWatchIdentityResponder {
3366 fn drop(&mut self) {
3367 self.control_handle.shutdown();
3368 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3370 }
3371}
3372
3373impl fidl::endpoints::Responder for DeviceExtraWatchIdentityResponder {
3374 type ControlHandle = DeviceExtraControlHandle;
3375
3376 fn control_handle(&self) -> &DeviceExtraControlHandle {
3377 &self.control_handle
3378 }
3379
3380 fn drop_without_shutdown(mut self) {
3381 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3383 std::mem::forget(self);
3385 }
3386}
3387
3388impl DeviceExtraWatchIdentityResponder {
3389 pub fn send(self, mut identity: &Identity) -> Result<(), fidl::Error> {
3393 let _result = self.send_raw(identity);
3394 if _result.is_err() {
3395 self.control_handle.shutdown();
3396 }
3397 self.drop_without_shutdown();
3398 _result
3399 }
3400
3401 pub fn send_no_shutdown_on_err(self, mut identity: &Identity) -> Result<(), fidl::Error> {
3403 let _result = self.send_raw(identity);
3404 self.drop_without_shutdown();
3405 _result
3406 }
3407
3408 fn send_raw(&self, mut identity: &Identity) -> Result<(), fidl::Error> {
3409 self.control_handle.inner.send::<DeviceExtraWatchIdentityResponse>(
3410 (identity,),
3411 self.tx_id,
3412 0xb9f5d8963eaebc6,
3413 fidl::encoding::DynamicFlags::empty(),
3414 )
3415 }
3416}
3417
3418#[must_use = "FIDL methods require a response to be sent"]
3419#[derive(Debug)]
3420pub struct DeviceExtraGetCurrentMacAddressResponder {
3421 control_handle: std::mem::ManuallyDrop<DeviceExtraControlHandle>,
3422 tx_id: u32,
3423}
3424
3425impl std::ops::Drop for DeviceExtraGetCurrentMacAddressResponder {
3429 fn drop(&mut self) {
3430 self.control_handle.shutdown();
3431 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3433 }
3434}
3435
3436impl fidl::endpoints::Responder for DeviceExtraGetCurrentMacAddressResponder {
3437 type ControlHandle = DeviceExtraControlHandle;
3438
3439 fn control_handle(&self) -> &DeviceExtraControlHandle {
3440 &self.control_handle
3441 }
3442
3443 fn drop_without_shutdown(mut self) {
3444 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3446 std::mem::forget(self);
3448 }
3449}
3450
3451impl DeviceExtraGetCurrentMacAddressResponder {
3452 pub fn send(self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
3456 let _result = self.send_raw(address);
3457 if _result.is_err() {
3458 self.control_handle.shutdown();
3459 }
3460 self.drop_without_shutdown();
3461 _result
3462 }
3463
3464 pub fn send_no_shutdown_on_err(
3466 self,
3467 mut address: &fidl_fuchsia_lowpan::MacAddress,
3468 ) -> Result<(), fidl::Error> {
3469 let _result = self.send_raw(address);
3470 self.drop_without_shutdown();
3471 _result
3472 }
3473
3474 fn send_raw(&self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
3475 self.control_handle.inner.send::<DeviceExtraGetCurrentMacAddressResponse>(
3476 (address,),
3477 self.tx_id,
3478 0x70835954071d94dd,
3479 fidl::encoding::DynamicFlags::empty(),
3480 )
3481 }
3482}
3483
3484#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3485pub struct DeviceExtraConnectorMarker;
3486
3487impl fidl::endpoints::ProtocolMarker for DeviceExtraConnectorMarker {
3488 type Proxy = DeviceExtraConnectorProxy;
3489 type RequestStream = DeviceExtraConnectorRequestStream;
3490 #[cfg(target_os = "fuchsia")]
3491 type SynchronousProxy = DeviceExtraConnectorSynchronousProxy;
3492
3493 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.DeviceExtraConnector";
3494}
3495impl fidl::endpoints::DiscoverableProtocolMarker for DeviceExtraConnectorMarker {}
3496
3497pub trait DeviceExtraConnectorProxyInterface: Send + Sync {
3498 fn r#connect(
3499 &self,
3500 name: &str,
3501 server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3502 ) -> Result<(), fidl::Error>;
3503}
3504#[derive(Debug)]
3505#[cfg(target_os = "fuchsia")]
3506pub struct DeviceExtraConnectorSynchronousProxy {
3507 client: fidl::client::sync::Client,
3508}
3509
3510#[cfg(target_os = "fuchsia")]
3511impl fidl::endpoints::SynchronousProxy for DeviceExtraConnectorSynchronousProxy {
3512 type Proxy = DeviceExtraConnectorProxy;
3513 type Protocol = DeviceExtraConnectorMarker;
3514
3515 fn from_channel(inner: fidl::Channel) -> Self {
3516 Self::new(inner)
3517 }
3518
3519 fn into_channel(self) -> fidl::Channel {
3520 self.client.into_channel()
3521 }
3522
3523 fn as_channel(&self) -> &fidl::Channel {
3524 self.client.as_channel()
3525 }
3526}
3527
3528#[cfg(target_os = "fuchsia")]
3529impl DeviceExtraConnectorSynchronousProxy {
3530 pub fn new(channel: fidl::Channel) -> Self {
3531 let protocol_name =
3532 <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3533 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3534 }
3535
3536 pub fn into_channel(self) -> fidl::Channel {
3537 self.client.into_channel()
3538 }
3539
3540 pub fn wait_for_event(
3543 &self,
3544 deadline: zx::MonotonicInstant,
3545 ) -> Result<DeviceExtraConnectorEvent, fidl::Error> {
3546 DeviceExtraConnectorEvent::decode(self.client.wait_for_event(deadline)?)
3547 }
3548
3549 pub fn r#connect(
3566 &self,
3567 mut name: &str,
3568 mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3569 ) -> Result<(), fidl::Error> {
3570 self.client.send::<DeviceExtraConnectorConnectRequest>(
3571 (name, server_end),
3572 0x2959be873ae18ae3,
3573 fidl::encoding::DynamicFlags::empty(),
3574 )
3575 }
3576}
3577
3578#[cfg(target_os = "fuchsia")]
3579impl From<DeviceExtraConnectorSynchronousProxy> for zx::Handle {
3580 fn from(value: DeviceExtraConnectorSynchronousProxy) -> Self {
3581 value.into_channel().into()
3582 }
3583}
3584
3585#[cfg(target_os = "fuchsia")]
3586impl From<fidl::Channel> for DeviceExtraConnectorSynchronousProxy {
3587 fn from(value: fidl::Channel) -> Self {
3588 Self::new(value)
3589 }
3590}
3591
3592#[derive(Debug, Clone)]
3593pub struct DeviceExtraConnectorProxy {
3594 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3595}
3596
3597impl fidl::endpoints::Proxy for DeviceExtraConnectorProxy {
3598 type Protocol = DeviceExtraConnectorMarker;
3599
3600 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3601 Self::new(inner)
3602 }
3603
3604 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3605 self.client.into_channel().map_err(|client| Self { client })
3606 }
3607
3608 fn as_channel(&self) -> &::fidl::AsyncChannel {
3609 self.client.as_channel()
3610 }
3611}
3612
3613impl DeviceExtraConnectorProxy {
3614 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3616 let protocol_name =
3617 <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3618 Self { client: fidl::client::Client::new(channel, protocol_name) }
3619 }
3620
3621 pub fn take_event_stream(&self) -> DeviceExtraConnectorEventStream {
3627 DeviceExtraConnectorEventStream { event_receiver: self.client.take_event_receiver() }
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 DeviceExtraConnectorProxyInterface::r#connect(self, name, server_end)
3652 }
3653}
3654
3655impl DeviceExtraConnectorProxyInterface for DeviceExtraConnectorProxy {
3656 fn r#connect(
3657 &self,
3658 mut name: &str,
3659 mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3660 ) -> Result<(), fidl::Error> {
3661 self.client.send::<DeviceExtraConnectorConnectRequest>(
3662 (name, server_end),
3663 0x2959be873ae18ae3,
3664 fidl::encoding::DynamicFlags::empty(),
3665 )
3666 }
3667}
3668
3669pub struct DeviceExtraConnectorEventStream {
3670 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3671}
3672
3673impl std::marker::Unpin for DeviceExtraConnectorEventStream {}
3674
3675impl futures::stream::FusedStream for DeviceExtraConnectorEventStream {
3676 fn is_terminated(&self) -> bool {
3677 self.event_receiver.is_terminated()
3678 }
3679}
3680
3681impl futures::Stream for DeviceExtraConnectorEventStream {
3682 type Item = Result<DeviceExtraConnectorEvent, fidl::Error>;
3683
3684 fn poll_next(
3685 mut self: std::pin::Pin<&mut Self>,
3686 cx: &mut std::task::Context<'_>,
3687 ) -> std::task::Poll<Option<Self::Item>> {
3688 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3689 &mut self.event_receiver,
3690 cx
3691 )?) {
3692 Some(buf) => std::task::Poll::Ready(Some(DeviceExtraConnectorEvent::decode(buf))),
3693 None => std::task::Poll::Ready(None),
3694 }
3695 }
3696}
3697
3698#[derive(Debug)]
3699pub enum DeviceExtraConnectorEvent {}
3700
3701impl DeviceExtraConnectorEvent {
3702 fn decode(
3704 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3705 ) -> Result<DeviceExtraConnectorEvent, fidl::Error> {
3706 let (bytes, _handles) = buf.split_mut();
3707 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3708 debug_assert_eq!(tx_header.tx_id, 0);
3709 match tx_header.ordinal {
3710 _ => Err(fidl::Error::UnknownOrdinal {
3711 ordinal: tx_header.ordinal,
3712 protocol_name:
3713 <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3714 }),
3715 }
3716 }
3717}
3718
3719pub struct DeviceExtraConnectorRequestStream {
3721 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3722 is_terminated: bool,
3723}
3724
3725impl std::marker::Unpin for DeviceExtraConnectorRequestStream {}
3726
3727impl futures::stream::FusedStream for DeviceExtraConnectorRequestStream {
3728 fn is_terminated(&self) -> bool {
3729 self.is_terminated
3730 }
3731}
3732
3733impl fidl::endpoints::RequestStream for DeviceExtraConnectorRequestStream {
3734 type Protocol = DeviceExtraConnectorMarker;
3735 type ControlHandle = DeviceExtraConnectorControlHandle;
3736
3737 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3738 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3739 }
3740
3741 fn control_handle(&self) -> Self::ControlHandle {
3742 DeviceExtraConnectorControlHandle { inner: self.inner.clone() }
3743 }
3744
3745 fn into_inner(
3746 self,
3747 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3748 {
3749 (self.inner, self.is_terminated)
3750 }
3751
3752 fn from_inner(
3753 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3754 is_terminated: bool,
3755 ) -> Self {
3756 Self { inner, is_terminated }
3757 }
3758}
3759
3760impl futures::Stream for DeviceExtraConnectorRequestStream {
3761 type Item = Result<DeviceExtraConnectorRequest, fidl::Error>;
3762
3763 fn poll_next(
3764 mut self: std::pin::Pin<&mut Self>,
3765 cx: &mut std::task::Context<'_>,
3766 ) -> std::task::Poll<Option<Self::Item>> {
3767 let this = &mut *self;
3768 if this.inner.check_shutdown(cx) {
3769 this.is_terminated = true;
3770 return std::task::Poll::Ready(None);
3771 }
3772 if this.is_terminated {
3773 panic!("polled DeviceExtraConnectorRequestStream after completion");
3774 }
3775 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3776 |bytes, handles| {
3777 match this.inner.channel().read_etc(cx, bytes, handles) {
3778 std::task::Poll::Ready(Ok(())) => {}
3779 std::task::Poll::Pending => return std::task::Poll::Pending,
3780 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3781 this.is_terminated = true;
3782 return std::task::Poll::Ready(None);
3783 }
3784 std::task::Poll::Ready(Err(e)) => {
3785 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3786 e.into(),
3787 ))))
3788 }
3789 }
3790
3791 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3793
3794 std::task::Poll::Ready(Some(match header.ordinal {
3795 0x2959be873ae18ae3 => {
3796 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3797 let mut req = fidl::new_empty!(DeviceExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3798 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceExtraConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3799 let control_handle = DeviceExtraConnectorControlHandle {
3800 inner: this.inner.clone(),
3801 };
3802 Ok(DeviceExtraConnectorRequest::Connect {name: req.name,
3803server_end: req.server_end,
3804
3805 control_handle,
3806 })
3807 }
3808 _ => Err(fidl::Error::UnknownOrdinal {
3809 ordinal: header.ordinal,
3810 protocol_name: <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3811 }),
3812 }))
3813 },
3814 )
3815 }
3816}
3817
3818#[derive(Debug)]
3821pub enum DeviceExtraConnectorRequest {
3822 Connect {
3839 name: String,
3840 server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3841 control_handle: DeviceExtraConnectorControlHandle,
3842 },
3843}
3844
3845impl DeviceExtraConnectorRequest {
3846 #[allow(irrefutable_let_patterns)]
3847 pub fn into_connect(
3848 self,
3849 ) -> Option<(
3850 String,
3851 fidl::endpoints::ServerEnd<DeviceExtraMarker>,
3852 DeviceExtraConnectorControlHandle,
3853 )> {
3854 if let DeviceExtraConnectorRequest::Connect { name, server_end, control_handle } = self {
3855 Some((name, server_end, control_handle))
3856 } else {
3857 None
3858 }
3859 }
3860
3861 pub fn method_name(&self) -> &'static str {
3863 match *self {
3864 DeviceExtraConnectorRequest::Connect { .. } => "connect",
3865 }
3866 }
3867}
3868
3869#[derive(Debug, Clone)]
3870pub struct DeviceExtraConnectorControlHandle {
3871 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3872}
3873
3874impl fidl::endpoints::ControlHandle for DeviceExtraConnectorControlHandle {
3875 fn shutdown(&self) {
3876 self.inner.shutdown()
3877 }
3878 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3879 self.inner.shutdown_with_epitaph(status)
3880 }
3881
3882 fn is_closed(&self) -> bool {
3883 self.inner.channel().is_closed()
3884 }
3885 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3886 self.inner.channel().on_closed()
3887 }
3888
3889 #[cfg(target_os = "fuchsia")]
3890 fn signal_peer(
3891 &self,
3892 clear_mask: zx::Signals,
3893 set_mask: zx::Signals,
3894 ) -> Result<(), zx_status::Status> {
3895 use fidl::Peered;
3896 self.inner.channel().signal_peer(clear_mask, set_mask)
3897 }
3898}
3899
3900impl DeviceExtraConnectorControlHandle {}
3901
3902#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3903pub struct EnergyScanMarker;
3904
3905impl fidl::endpoints::ProtocolMarker for EnergyScanMarker {
3906 type Proxy = EnergyScanProxy;
3907 type RequestStream = EnergyScanRequestStream;
3908 #[cfg(target_os = "fuchsia")]
3909 type SynchronousProxy = EnergyScanSynchronousProxy;
3910
3911 const DEBUG_NAME: &'static str = "(anonymous) EnergyScan";
3912}
3913
3914pub trait EnergyScanProxyInterface: Send + Sync {
3915 fn r#start_energy_scan(
3916 &self,
3917 params: &EnergyScanParameters,
3918 stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
3919 ) -> Result<(), fidl::Error>;
3920}
3921#[derive(Debug)]
3922#[cfg(target_os = "fuchsia")]
3923pub struct EnergyScanSynchronousProxy {
3924 client: fidl::client::sync::Client,
3925}
3926
3927#[cfg(target_os = "fuchsia")]
3928impl fidl::endpoints::SynchronousProxy for EnergyScanSynchronousProxy {
3929 type Proxy = EnergyScanProxy;
3930 type Protocol = EnergyScanMarker;
3931
3932 fn from_channel(inner: fidl::Channel) -> Self {
3933 Self::new(inner)
3934 }
3935
3936 fn into_channel(self) -> fidl::Channel {
3937 self.client.into_channel()
3938 }
3939
3940 fn as_channel(&self) -> &fidl::Channel {
3941 self.client.as_channel()
3942 }
3943}
3944
3945#[cfg(target_os = "fuchsia")]
3946impl EnergyScanSynchronousProxy {
3947 pub fn new(channel: fidl::Channel) -> Self {
3948 let protocol_name = <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3949 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3950 }
3951
3952 pub fn into_channel(self) -> fidl::Channel {
3953 self.client.into_channel()
3954 }
3955
3956 pub fn wait_for_event(
3959 &self,
3960 deadline: zx::MonotonicInstant,
3961 ) -> Result<EnergyScanEvent, fidl::Error> {
3962 EnergyScanEvent::decode(self.client.wait_for_event(deadline)?)
3963 }
3964
3965 pub fn r#start_energy_scan(
3986 &self,
3987 mut params: &EnergyScanParameters,
3988 mut stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
3989 ) -> Result<(), fidl::Error> {
3990 self.client.send::<EnergyScanStartEnergyScanRequest>(
3991 (params, stream),
3992 0x4b2928a05c619b06,
3993 fidl::encoding::DynamicFlags::empty(),
3994 )
3995 }
3996}
3997
3998#[cfg(target_os = "fuchsia")]
3999impl From<EnergyScanSynchronousProxy> for zx::Handle {
4000 fn from(value: EnergyScanSynchronousProxy) -> Self {
4001 value.into_channel().into()
4002 }
4003}
4004
4005#[cfg(target_os = "fuchsia")]
4006impl From<fidl::Channel> for EnergyScanSynchronousProxy {
4007 fn from(value: fidl::Channel) -> Self {
4008 Self::new(value)
4009 }
4010}
4011
4012#[derive(Debug, Clone)]
4013pub struct EnergyScanProxy {
4014 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4015}
4016
4017impl fidl::endpoints::Proxy for EnergyScanProxy {
4018 type Protocol = EnergyScanMarker;
4019
4020 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4021 Self::new(inner)
4022 }
4023
4024 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4025 self.client.into_channel().map_err(|client| Self { client })
4026 }
4027
4028 fn as_channel(&self) -> &::fidl::AsyncChannel {
4029 self.client.as_channel()
4030 }
4031}
4032
4033impl EnergyScanProxy {
4034 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4036 let protocol_name = <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4037 Self { client: fidl::client::Client::new(channel, protocol_name) }
4038 }
4039
4040 pub fn take_event_stream(&self) -> EnergyScanEventStream {
4046 EnergyScanEventStream { event_receiver: self.client.take_event_receiver() }
4047 }
4048
4049 pub fn r#start_energy_scan(
4070 &self,
4071 mut params: &EnergyScanParameters,
4072 mut stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4073 ) -> Result<(), fidl::Error> {
4074 EnergyScanProxyInterface::r#start_energy_scan(self, params, stream)
4075 }
4076}
4077
4078impl EnergyScanProxyInterface for EnergyScanProxy {
4079 fn r#start_energy_scan(
4080 &self,
4081 mut params: &EnergyScanParameters,
4082 mut stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4083 ) -> Result<(), fidl::Error> {
4084 self.client.send::<EnergyScanStartEnergyScanRequest>(
4085 (params, stream),
4086 0x4b2928a05c619b06,
4087 fidl::encoding::DynamicFlags::empty(),
4088 )
4089 }
4090}
4091
4092pub struct EnergyScanEventStream {
4093 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4094}
4095
4096impl std::marker::Unpin for EnergyScanEventStream {}
4097
4098impl futures::stream::FusedStream for EnergyScanEventStream {
4099 fn is_terminated(&self) -> bool {
4100 self.event_receiver.is_terminated()
4101 }
4102}
4103
4104impl futures::Stream for EnergyScanEventStream {
4105 type Item = Result<EnergyScanEvent, fidl::Error>;
4106
4107 fn poll_next(
4108 mut self: std::pin::Pin<&mut Self>,
4109 cx: &mut std::task::Context<'_>,
4110 ) -> std::task::Poll<Option<Self::Item>> {
4111 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4112 &mut self.event_receiver,
4113 cx
4114 )?) {
4115 Some(buf) => std::task::Poll::Ready(Some(EnergyScanEvent::decode(buf))),
4116 None => std::task::Poll::Ready(None),
4117 }
4118 }
4119}
4120
4121#[derive(Debug)]
4122pub enum EnergyScanEvent {}
4123
4124impl EnergyScanEvent {
4125 fn decode(
4127 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4128 ) -> Result<EnergyScanEvent, fidl::Error> {
4129 let (bytes, _handles) = buf.split_mut();
4130 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4131 debug_assert_eq!(tx_header.tx_id, 0);
4132 match tx_header.ordinal {
4133 _ => Err(fidl::Error::UnknownOrdinal {
4134 ordinal: tx_header.ordinal,
4135 protocol_name: <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4136 }),
4137 }
4138 }
4139}
4140
4141pub struct EnergyScanRequestStream {
4143 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4144 is_terminated: bool,
4145}
4146
4147impl std::marker::Unpin for EnergyScanRequestStream {}
4148
4149impl futures::stream::FusedStream for EnergyScanRequestStream {
4150 fn is_terminated(&self) -> bool {
4151 self.is_terminated
4152 }
4153}
4154
4155impl fidl::endpoints::RequestStream for EnergyScanRequestStream {
4156 type Protocol = EnergyScanMarker;
4157 type ControlHandle = EnergyScanControlHandle;
4158
4159 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4160 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4161 }
4162
4163 fn control_handle(&self) -> Self::ControlHandle {
4164 EnergyScanControlHandle { inner: self.inner.clone() }
4165 }
4166
4167 fn into_inner(
4168 self,
4169 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4170 {
4171 (self.inner, self.is_terminated)
4172 }
4173
4174 fn from_inner(
4175 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4176 is_terminated: bool,
4177 ) -> Self {
4178 Self { inner, is_terminated }
4179 }
4180}
4181
4182impl futures::Stream for EnergyScanRequestStream {
4183 type Item = Result<EnergyScanRequest, fidl::Error>;
4184
4185 fn poll_next(
4186 mut self: std::pin::Pin<&mut Self>,
4187 cx: &mut std::task::Context<'_>,
4188 ) -> std::task::Poll<Option<Self::Item>> {
4189 let this = &mut *self;
4190 if this.inner.check_shutdown(cx) {
4191 this.is_terminated = true;
4192 return std::task::Poll::Ready(None);
4193 }
4194 if this.is_terminated {
4195 panic!("polled EnergyScanRequestStream after completion");
4196 }
4197 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4198 |bytes, handles| {
4199 match this.inner.channel().read_etc(cx, bytes, handles) {
4200 std::task::Poll::Ready(Ok(())) => {}
4201 std::task::Poll::Pending => return std::task::Poll::Pending,
4202 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4203 this.is_terminated = true;
4204 return std::task::Poll::Ready(None);
4205 }
4206 std::task::Poll::Ready(Err(e)) => {
4207 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4208 e.into(),
4209 ))))
4210 }
4211 }
4212
4213 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4215
4216 std::task::Poll::Ready(Some(match header.ordinal {
4217 0x4b2928a05c619b06 => {
4218 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4219 let mut req = fidl::new_empty!(
4220 EnergyScanStartEnergyScanRequest,
4221 fidl::encoding::DefaultFuchsiaResourceDialect
4222 );
4223 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EnergyScanStartEnergyScanRequest>(&header, _body_bytes, handles, &mut req)?;
4224 let control_handle = EnergyScanControlHandle { inner: this.inner.clone() };
4225 Ok(EnergyScanRequest::StartEnergyScan {
4226 params: req.params,
4227 stream: req.stream,
4228
4229 control_handle,
4230 })
4231 }
4232 _ => Err(fidl::Error::UnknownOrdinal {
4233 ordinal: header.ordinal,
4234 protocol_name:
4235 <EnergyScanMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4236 }),
4237 }))
4238 },
4239 )
4240 }
4241}
4242
4243#[derive(Debug)]
4244pub enum EnergyScanRequest {
4245 StartEnergyScan {
4266 params: EnergyScanParameters,
4267 stream: fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4268 control_handle: EnergyScanControlHandle,
4269 },
4270}
4271
4272impl EnergyScanRequest {
4273 #[allow(irrefutable_let_patterns)]
4274 pub fn into_start_energy_scan(
4275 self,
4276 ) -> Option<(
4277 EnergyScanParameters,
4278 fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
4279 EnergyScanControlHandle,
4280 )> {
4281 if let EnergyScanRequest::StartEnergyScan { params, stream, control_handle } = self {
4282 Some((params, stream, control_handle))
4283 } else {
4284 None
4285 }
4286 }
4287
4288 pub fn method_name(&self) -> &'static str {
4290 match *self {
4291 EnergyScanRequest::StartEnergyScan { .. } => "start_energy_scan",
4292 }
4293 }
4294}
4295
4296#[derive(Debug, Clone)]
4297pub struct EnergyScanControlHandle {
4298 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4299}
4300
4301impl fidl::endpoints::ControlHandle for EnergyScanControlHandle {
4302 fn shutdown(&self) {
4303 self.inner.shutdown()
4304 }
4305 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4306 self.inner.shutdown_with_epitaph(status)
4307 }
4308
4309 fn is_closed(&self) -> bool {
4310 self.inner.channel().is_closed()
4311 }
4312 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4313 self.inner.channel().on_closed()
4314 }
4315
4316 #[cfg(target_os = "fuchsia")]
4317 fn signal_peer(
4318 &self,
4319 clear_mask: zx::Signals,
4320 set_mask: zx::Signals,
4321 ) -> Result<(), zx_status::Status> {
4322 use fidl::Peered;
4323 self.inner.channel().signal_peer(clear_mask, set_mask)
4324 }
4325}
4326
4327impl EnergyScanControlHandle {}
4328
4329#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4330pub struct EnergyScanConnectorMarker;
4331
4332impl fidl::endpoints::ProtocolMarker for EnergyScanConnectorMarker {
4333 type Proxy = EnergyScanConnectorProxy;
4334 type RequestStream = EnergyScanConnectorRequestStream;
4335 #[cfg(target_os = "fuchsia")]
4336 type SynchronousProxy = EnergyScanConnectorSynchronousProxy;
4337
4338 const DEBUG_NAME: &'static str = "fuchsia.lowpan.device.EnergyScanConnector";
4339}
4340impl fidl::endpoints::DiscoverableProtocolMarker for EnergyScanConnectorMarker {}
4341
4342pub trait EnergyScanConnectorProxyInterface: Send + Sync {
4343 fn r#connect(
4344 &self,
4345 name: &str,
4346 server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4347 ) -> Result<(), fidl::Error>;
4348}
4349#[derive(Debug)]
4350#[cfg(target_os = "fuchsia")]
4351pub struct EnergyScanConnectorSynchronousProxy {
4352 client: fidl::client::sync::Client,
4353}
4354
4355#[cfg(target_os = "fuchsia")]
4356impl fidl::endpoints::SynchronousProxy for EnergyScanConnectorSynchronousProxy {
4357 type Proxy = EnergyScanConnectorProxy;
4358 type Protocol = EnergyScanConnectorMarker;
4359
4360 fn from_channel(inner: fidl::Channel) -> Self {
4361 Self::new(inner)
4362 }
4363
4364 fn into_channel(self) -> fidl::Channel {
4365 self.client.into_channel()
4366 }
4367
4368 fn as_channel(&self) -> &fidl::Channel {
4369 self.client.as_channel()
4370 }
4371}
4372
4373#[cfg(target_os = "fuchsia")]
4374impl EnergyScanConnectorSynchronousProxy {
4375 pub fn new(channel: fidl::Channel) -> Self {
4376 let protocol_name =
4377 <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4378 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4379 }
4380
4381 pub fn into_channel(self) -> fidl::Channel {
4382 self.client.into_channel()
4383 }
4384
4385 pub fn wait_for_event(
4388 &self,
4389 deadline: zx::MonotonicInstant,
4390 ) -> Result<EnergyScanConnectorEvent, fidl::Error> {
4391 EnergyScanConnectorEvent::decode(self.client.wait_for_event(deadline)?)
4392 }
4393
4394 pub fn r#connect(
4411 &self,
4412 mut name: &str,
4413 mut server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4414 ) -> Result<(), fidl::Error> {
4415 self.client.send::<EnergyScanConnectorConnectRequest>(
4416 (name, server_end),
4417 0x1076a774e74ab290,
4418 fidl::encoding::DynamicFlags::empty(),
4419 )
4420 }
4421}
4422
4423#[cfg(target_os = "fuchsia")]
4424impl From<EnergyScanConnectorSynchronousProxy> for zx::Handle {
4425 fn from(value: EnergyScanConnectorSynchronousProxy) -> Self {
4426 value.into_channel().into()
4427 }
4428}
4429
4430#[cfg(target_os = "fuchsia")]
4431impl From<fidl::Channel> for EnergyScanConnectorSynchronousProxy {
4432 fn from(value: fidl::Channel) -> Self {
4433 Self::new(value)
4434 }
4435}
4436
4437#[derive(Debug, Clone)]
4438pub struct EnergyScanConnectorProxy {
4439 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4440}
4441
4442impl fidl::endpoints::Proxy for EnergyScanConnectorProxy {
4443 type Protocol = EnergyScanConnectorMarker;
4444
4445 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4446 Self::new(inner)
4447 }
4448
4449 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4450 self.client.into_channel().map_err(|client| Self { client })
4451 }
4452
4453 fn as_channel(&self) -> &::fidl::AsyncChannel {
4454 self.client.as_channel()
4455 }
4456}
4457
4458impl EnergyScanConnectorProxy {
4459 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4461 let protocol_name =
4462 <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4463 Self { client: fidl::client::Client::new(channel, protocol_name) }
4464 }
4465
4466 pub fn take_event_stream(&self) -> EnergyScanConnectorEventStream {
4472 EnergyScanConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4473 }
4474
4475 pub fn r#connect(
4492 &self,
4493 mut name: &str,
4494 mut server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4495 ) -> Result<(), fidl::Error> {
4496 EnergyScanConnectorProxyInterface::r#connect(self, name, server_end)
4497 }
4498}
4499
4500impl EnergyScanConnectorProxyInterface for EnergyScanConnectorProxy {
4501 fn r#connect(
4502 &self,
4503 mut name: &str,
4504 mut server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4505 ) -> Result<(), fidl::Error> {
4506 self.client.send::<EnergyScanConnectorConnectRequest>(
4507 (name, server_end),
4508 0x1076a774e74ab290,
4509 fidl::encoding::DynamicFlags::empty(),
4510 )
4511 }
4512}
4513
4514pub struct EnergyScanConnectorEventStream {
4515 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4516}
4517
4518impl std::marker::Unpin for EnergyScanConnectorEventStream {}
4519
4520impl futures::stream::FusedStream for EnergyScanConnectorEventStream {
4521 fn is_terminated(&self) -> bool {
4522 self.event_receiver.is_terminated()
4523 }
4524}
4525
4526impl futures::Stream for EnergyScanConnectorEventStream {
4527 type Item = Result<EnergyScanConnectorEvent, fidl::Error>;
4528
4529 fn poll_next(
4530 mut self: std::pin::Pin<&mut Self>,
4531 cx: &mut std::task::Context<'_>,
4532 ) -> std::task::Poll<Option<Self::Item>> {
4533 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4534 &mut self.event_receiver,
4535 cx
4536 )?) {
4537 Some(buf) => std::task::Poll::Ready(Some(EnergyScanConnectorEvent::decode(buf))),
4538 None => std::task::Poll::Ready(None),
4539 }
4540 }
4541}
4542
4543#[derive(Debug)]
4544pub enum EnergyScanConnectorEvent {}
4545
4546impl EnergyScanConnectorEvent {
4547 fn decode(
4549 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4550 ) -> Result<EnergyScanConnectorEvent, fidl::Error> {
4551 let (bytes, _handles) = buf.split_mut();
4552 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4553 debug_assert_eq!(tx_header.tx_id, 0);
4554 match tx_header.ordinal {
4555 _ => Err(fidl::Error::UnknownOrdinal {
4556 ordinal: tx_header.ordinal,
4557 protocol_name:
4558 <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4559 }),
4560 }
4561 }
4562}
4563
4564pub struct EnergyScanConnectorRequestStream {
4566 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4567 is_terminated: bool,
4568}
4569
4570impl std::marker::Unpin for EnergyScanConnectorRequestStream {}
4571
4572impl futures::stream::FusedStream for EnergyScanConnectorRequestStream {
4573 fn is_terminated(&self) -> bool {
4574 self.is_terminated
4575 }
4576}
4577
4578impl fidl::endpoints::RequestStream for EnergyScanConnectorRequestStream {
4579 type Protocol = EnergyScanConnectorMarker;
4580 type ControlHandle = EnergyScanConnectorControlHandle;
4581
4582 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4583 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4584 }
4585
4586 fn control_handle(&self) -> Self::ControlHandle {
4587 EnergyScanConnectorControlHandle { inner: self.inner.clone() }
4588 }
4589
4590 fn into_inner(
4591 self,
4592 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4593 {
4594 (self.inner, self.is_terminated)
4595 }
4596
4597 fn from_inner(
4598 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4599 is_terminated: bool,
4600 ) -> Self {
4601 Self { inner, is_terminated }
4602 }
4603}
4604
4605impl futures::Stream for EnergyScanConnectorRequestStream {
4606 type Item = Result<EnergyScanConnectorRequest, fidl::Error>;
4607
4608 fn poll_next(
4609 mut self: std::pin::Pin<&mut Self>,
4610 cx: &mut std::task::Context<'_>,
4611 ) -> std::task::Poll<Option<Self::Item>> {
4612 let this = &mut *self;
4613 if this.inner.check_shutdown(cx) {
4614 this.is_terminated = true;
4615 return std::task::Poll::Ready(None);
4616 }
4617 if this.is_terminated {
4618 panic!("polled EnergyScanConnectorRequestStream after completion");
4619 }
4620 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4621 |bytes, handles| {
4622 match this.inner.channel().read_etc(cx, bytes, handles) {
4623 std::task::Poll::Ready(Ok(())) => {}
4624 std::task::Poll::Pending => return std::task::Poll::Pending,
4625 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4626 this.is_terminated = true;
4627 return std::task::Poll::Ready(None);
4628 }
4629 std::task::Poll::Ready(Err(e)) => {
4630 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4631 e.into(),
4632 ))))
4633 }
4634 }
4635
4636 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4638
4639 std::task::Poll::Ready(Some(match header.ordinal {
4640 0x1076a774e74ab290 => {
4641 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4642 let mut req = fidl::new_empty!(EnergyScanConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4643 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EnergyScanConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4644 let control_handle = EnergyScanConnectorControlHandle {
4645 inner: this.inner.clone(),
4646 };
4647 Ok(EnergyScanConnectorRequest::Connect {name: req.name,
4648server_end: req.server_end,
4649
4650 control_handle,
4651 })
4652 }
4653 _ => Err(fidl::Error::UnknownOrdinal {
4654 ordinal: header.ordinal,
4655 protocol_name: <EnergyScanConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4656 }),
4657 }))
4658 },
4659 )
4660 }
4661}
4662
4663#[derive(Debug)]
4666pub enum EnergyScanConnectorRequest {
4667 Connect {
4684 name: String,
4685 server_end: fidl::endpoints::ServerEnd<EnergyScanMarker>,
4686 control_handle: EnergyScanConnectorControlHandle,
4687 },
4688}
4689
4690impl EnergyScanConnectorRequest {
4691 #[allow(irrefutable_let_patterns)]
4692 pub fn into_connect(
4693 self,
4694 ) -> Option<(
4695 String,
4696 fidl::endpoints::ServerEnd<EnergyScanMarker>,
4697 EnergyScanConnectorControlHandle,
4698 )> {
4699 if let EnergyScanConnectorRequest::Connect { name, server_end, control_handle } = self {
4700 Some((name, server_end, control_handle))
4701 } else {
4702 None
4703 }
4704 }
4705
4706 pub fn method_name(&self) -> &'static str {
4708 match *self {
4709 EnergyScanConnectorRequest::Connect { .. } => "connect",
4710 }
4711 }
4712}
4713
4714#[derive(Debug, Clone)]
4715pub struct EnergyScanConnectorControlHandle {
4716 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4717}
4718
4719impl fidl::endpoints::ControlHandle for EnergyScanConnectorControlHandle {
4720 fn shutdown(&self) {
4721 self.inner.shutdown()
4722 }
4723 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4724 self.inner.shutdown_with_epitaph(status)
4725 }
4726
4727 fn is_closed(&self) -> bool {
4728 self.inner.channel().is_closed()
4729 }
4730 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4731 self.inner.channel().on_closed()
4732 }
4733
4734 #[cfg(target_os = "fuchsia")]
4735 fn signal_peer(
4736 &self,
4737 clear_mask: zx::Signals,
4738 set_mask: zx::Signals,
4739 ) -> Result<(), zx_status::Status> {
4740 use fidl::Peered;
4741 self.inner.channel().signal_peer(clear_mask, set_mask)
4742 }
4743}
4744
4745impl EnergyScanConnectorControlHandle {}
4746
4747#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4748pub struct EnergyScanResultStreamMarker;
4749
4750impl fidl::endpoints::ProtocolMarker for EnergyScanResultStreamMarker {
4751 type Proxy = EnergyScanResultStreamProxy;
4752 type RequestStream = EnergyScanResultStreamRequestStream;
4753 #[cfg(target_os = "fuchsia")]
4754 type SynchronousProxy = EnergyScanResultStreamSynchronousProxy;
4755
4756 const DEBUG_NAME: &'static str = "(anonymous) EnergyScanResultStream";
4757}
4758
4759pub trait EnergyScanResultStreamProxyInterface: Send + Sync {
4760 type NextResponseFut: std::future::Future<Output = Result<Vec<EnergyScanResult>, fidl::Error>>
4761 + Send;
4762 fn r#next(&self) -> Self::NextResponseFut;
4763}
4764#[derive(Debug)]
4765#[cfg(target_os = "fuchsia")]
4766pub struct EnergyScanResultStreamSynchronousProxy {
4767 client: fidl::client::sync::Client,
4768}
4769
4770#[cfg(target_os = "fuchsia")]
4771impl fidl::endpoints::SynchronousProxy for EnergyScanResultStreamSynchronousProxy {
4772 type Proxy = EnergyScanResultStreamProxy;
4773 type Protocol = EnergyScanResultStreamMarker;
4774
4775 fn from_channel(inner: fidl::Channel) -> Self {
4776 Self::new(inner)
4777 }
4778
4779 fn into_channel(self) -> fidl::Channel {
4780 self.client.into_channel()
4781 }
4782
4783 fn as_channel(&self) -> &fidl::Channel {
4784 self.client.as_channel()
4785 }
4786}
4787
4788#[cfg(target_os = "fuchsia")]
4789impl EnergyScanResultStreamSynchronousProxy {
4790 pub fn new(channel: fidl::Channel) -> Self {
4791 let protocol_name =
4792 <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4793 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4794 }
4795
4796 pub fn into_channel(self) -> fidl::Channel {
4797 self.client.into_channel()
4798 }
4799
4800 pub fn wait_for_event(
4803 &self,
4804 deadline: zx::MonotonicInstant,
4805 ) -> Result<EnergyScanResultStreamEvent, fidl::Error> {
4806 EnergyScanResultStreamEvent::decode(self.client.wait_for_event(deadline)?)
4807 }
4808
4809 pub fn r#next(
4813 &self,
4814 ___deadline: zx::MonotonicInstant,
4815 ) -> Result<Vec<EnergyScanResult>, fidl::Error> {
4816 let _response = self
4817 .client
4818 .send_query::<fidl::encoding::EmptyPayload, EnergyScanResultStreamNextResponse>(
4819 (),
4820 0x7f0139fc06fd6a9e,
4821 fidl::encoding::DynamicFlags::empty(),
4822 ___deadline,
4823 )?;
4824 Ok(_response.results)
4825 }
4826}
4827
4828#[cfg(target_os = "fuchsia")]
4829impl From<EnergyScanResultStreamSynchronousProxy> for zx::Handle {
4830 fn from(value: EnergyScanResultStreamSynchronousProxy) -> Self {
4831 value.into_channel().into()
4832 }
4833}
4834
4835#[cfg(target_os = "fuchsia")]
4836impl From<fidl::Channel> for EnergyScanResultStreamSynchronousProxy {
4837 fn from(value: fidl::Channel) -> Self {
4838 Self::new(value)
4839 }
4840}
4841
4842#[derive(Debug, Clone)]
4843pub struct EnergyScanResultStreamProxy {
4844 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4845}
4846
4847impl fidl::endpoints::Proxy for EnergyScanResultStreamProxy {
4848 type Protocol = EnergyScanResultStreamMarker;
4849
4850 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4851 Self::new(inner)
4852 }
4853
4854 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4855 self.client.into_channel().map_err(|client| Self { client })
4856 }
4857
4858 fn as_channel(&self) -> &::fidl::AsyncChannel {
4859 self.client.as_channel()
4860 }
4861}
4862
4863impl EnergyScanResultStreamProxy {
4864 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4866 let protocol_name =
4867 <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4868 Self { client: fidl::client::Client::new(channel, protocol_name) }
4869 }
4870
4871 pub fn take_event_stream(&self) -> EnergyScanResultStreamEventStream {
4877 EnergyScanResultStreamEventStream { event_receiver: self.client.take_event_receiver() }
4878 }
4879
4880 pub fn r#next(
4884 &self,
4885 ) -> fidl::client::QueryResponseFut<
4886 Vec<EnergyScanResult>,
4887 fidl::encoding::DefaultFuchsiaResourceDialect,
4888 > {
4889 EnergyScanResultStreamProxyInterface::r#next(self)
4890 }
4891}
4892
4893impl EnergyScanResultStreamProxyInterface for EnergyScanResultStreamProxy {
4894 type NextResponseFut = fidl::client::QueryResponseFut<
4895 Vec<EnergyScanResult>,
4896 fidl::encoding::DefaultFuchsiaResourceDialect,
4897 >;
4898 fn r#next(&self) -> Self::NextResponseFut {
4899 fn _decode(
4900 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4901 ) -> Result<Vec<EnergyScanResult>, fidl::Error> {
4902 let _response = fidl::client::decode_transaction_body::<
4903 EnergyScanResultStreamNextResponse,
4904 fidl::encoding::DefaultFuchsiaResourceDialect,
4905 0x7f0139fc06fd6a9e,
4906 >(_buf?)?;
4907 Ok(_response.results)
4908 }
4909 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EnergyScanResult>>(
4910 (),
4911 0x7f0139fc06fd6a9e,
4912 fidl::encoding::DynamicFlags::empty(),
4913 _decode,
4914 )
4915 }
4916}
4917
4918pub struct EnergyScanResultStreamEventStream {
4919 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4920}
4921
4922impl std::marker::Unpin for EnergyScanResultStreamEventStream {}
4923
4924impl futures::stream::FusedStream for EnergyScanResultStreamEventStream {
4925 fn is_terminated(&self) -> bool {
4926 self.event_receiver.is_terminated()
4927 }
4928}
4929
4930impl futures::Stream for EnergyScanResultStreamEventStream {
4931 type Item = Result<EnergyScanResultStreamEvent, fidl::Error>;
4932
4933 fn poll_next(
4934 mut self: std::pin::Pin<&mut Self>,
4935 cx: &mut std::task::Context<'_>,
4936 ) -> std::task::Poll<Option<Self::Item>> {
4937 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4938 &mut self.event_receiver,
4939 cx
4940 )?) {
4941 Some(buf) => std::task::Poll::Ready(Some(EnergyScanResultStreamEvent::decode(buf))),
4942 None => std::task::Poll::Ready(None),
4943 }
4944 }
4945}
4946
4947#[derive(Debug)]
4948pub enum EnergyScanResultStreamEvent {}
4949
4950impl EnergyScanResultStreamEvent {
4951 fn decode(
4953 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4954 ) -> Result<EnergyScanResultStreamEvent, fidl::Error> {
4955 let (bytes, _handles) = buf.split_mut();
4956 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4957 debug_assert_eq!(tx_header.tx_id, 0);
4958 match tx_header.ordinal {
4959 _ => Err(fidl::Error::UnknownOrdinal {
4960 ordinal: tx_header.ordinal,
4961 protocol_name:
4962 <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4963 }),
4964 }
4965 }
4966}
4967
4968pub struct EnergyScanResultStreamRequestStream {
4970 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4971 is_terminated: bool,
4972}
4973
4974impl std::marker::Unpin for EnergyScanResultStreamRequestStream {}
4975
4976impl futures::stream::FusedStream for EnergyScanResultStreamRequestStream {
4977 fn is_terminated(&self) -> bool {
4978 self.is_terminated
4979 }
4980}
4981
4982impl fidl::endpoints::RequestStream for EnergyScanResultStreamRequestStream {
4983 type Protocol = EnergyScanResultStreamMarker;
4984 type ControlHandle = EnergyScanResultStreamControlHandle;
4985
4986 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4987 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4988 }
4989
4990 fn control_handle(&self) -> Self::ControlHandle {
4991 EnergyScanResultStreamControlHandle { inner: self.inner.clone() }
4992 }
4993
4994 fn into_inner(
4995 self,
4996 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4997 {
4998 (self.inner, self.is_terminated)
4999 }
5000
5001 fn from_inner(
5002 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5003 is_terminated: bool,
5004 ) -> Self {
5005 Self { inner, is_terminated }
5006 }
5007}
5008
5009impl futures::Stream for EnergyScanResultStreamRequestStream {
5010 type Item = Result<EnergyScanResultStreamRequest, fidl::Error>;
5011
5012 fn poll_next(
5013 mut self: std::pin::Pin<&mut Self>,
5014 cx: &mut std::task::Context<'_>,
5015 ) -> std::task::Poll<Option<Self::Item>> {
5016 let this = &mut *self;
5017 if this.inner.check_shutdown(cx) {
5018 this.is_terminated = true;
5019 return std::task::Poll::Ready(None);
5020 }
5021 if this.is_terminated {
5022 panic!("polled EnergyScanResultStreamRequestStream after completion");
5023 }
5024 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5025 |bytes, handles| {
5026 match this.inner.channel().read_etc(cx, bytes, handles) {
5027 std::task::Poll::Ready(Ok(())) => {}
5028 std::task::Poll::Pending => return std::task::Poll::Pending,
5029 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5030 this.is_terminated = true;
5031 return std::task::Poll::Ready(None);
5032 }
5033 std::task::Poll::Ready(Err(e)) => {
5034 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5035 e.into(),
5036 ))))
5037 }
5038 }
5039
5040 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5042
5043 std::task::Poll::Ready(Some(match header.ordinal {
5044 0x7f0139fc06fd6a9e => {
5045 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5046 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5047 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5048 let control_handle = EnergyScanResultStreamControlHandle {
5049 inner: this.inner.clone(),
5050 };
5051 Ok(EnergyScanResultStreamRequest::Next {
5052 responder: EnergyScanResultStreamNextResponder {
5053 control_handle: std::mem::ManuallyDrop::new(control_handle),
5054 tx_id: header.tx_id,
5055 },
5056 })
5057 }
5058 _ => Err(fidl::Error::UnknownOrdinal {
5059 ordinal: header.ordinal,
5060 protocol_name: <EnergyScanResultStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5061 }),
5062 }))
5063 },
5064 )
5065 }
5066}
5067
5068#[derive(Debug)]
5072pub enum EnergyScanResultStreamRequest {
5073 Next { responder: EnergyScanResultStreamNextResponder },
5077}
5078
5079impl EnergyScanResultStreamRequest {
5080 #[allow(irrefutable_let_patterns)]
5081 pub fn into_next(self) -> Option<(EnergyScanResultStreamNextResponder)> {
5082 if let EnergyScanResultStreamRequest::Next { responder } = self {
5083 Some((responder))
5084 } else {
5085 None
5086 }
5087 }
5088
5089 pub fn method_name(&self) -> &'static str {
5091 match *self {
5092 EnergyScanResultStreamRequest::Next { .. } => "next",
5093 }
5094 }
5095}
5096
5097#[derive(Debug, Clone)]
5098pub struct EnergyScanResultStreamControlHandle {
5099 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5100}
5101
5102impl fidl::endpoints::ControlHandle for EnergyScanResultStreamControlHandle {
5103 fn shutdown(&self) {
5104 self.inner.shutdown()
5105 }
5106 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5107 self.inner.shutdown_with_epitaph(status)
5108 }
5109
5110 fn is_closed(&self) -> bool {
5111 self.inner.channel().is_closed()
5112 }
5113 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5114 self.inner.channel().on_closed()
5115 }
5116
5117 #[cfg(target_os = "fuchsia")]
5118 fn signal_peer(
5119 &self,
5120 clear_mask: zx::Signals,
5121 set_mask: zx::Signals,
5122 ) -> Result<(), zx_status::Status> {
5123 use fidl::Peered;
5124 self.inner.channel().signal_peer(clear_mask, set_mask)
5125 }
5126}
5127
5128impl EnergyScanResultStreamControlHandle {}
5129
5130#[must_use = "FIDL methods require a response to be sent"]
5131#[derive(Debug)]
5132pub struct EnergyScanResultStreamNextResponder {
5133 control_handle: std::mem::ManuallyDrop<EnergyScanResultStreamControlHandle>,
5134 tx_id: u32,
5135}
5136
5137impl std::ops::Drop for EnergyScanResultStreamNextResponder {
5141 fn drop(&mut self) {
5142 self.control_handle.shutdown();
5143 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5145 }
5146}
5147
5148impl fidl::endpoints::Responder for EnergyScanResultStreamNextResponder {
5149 type ControlHandle = EnergyScanResultStreamControlHandle;
5150
5151 fn control_handle(&self) -> &EnergyScanResultStreamControlHandle {
5152 &self.control_handle
5153 }
5154
5155 fn drop_without_shutdown(mut self) {
5156 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5158 std::mem::forget(self);
5160 }
5161}
5162
5163impl EnergyScanResultStreamNextResponder {
5164 pub fn send(self, mut results: &[EnergyScanResult]) -> Result<(), fidl::Error> {
5168 let _result = self.send_raw(results);
5169 if _result.is_err() {
5170 self.control_handle.shutdown();
5171 }
5172 self.drop_without_shutdown();
5173 _result
5174 }
5175
5176 pub fn send_no_shutdown_on_err(
5178 self,
5179 mut results: &[EnergyScanResult],
5180 ) -> Result<(), fidl::Error> {
5181 let _result = self.send_raw(results);
5182 self.drop_without_shutdown();
5183 _result
5184 }
5185
5186 fn send_raw(&self, mut results: &[EnergyScanResult]) -> Result<(), fidl::Error> {
5187 self.control_handle.inner.send::<EnergyScanResultStreamNextResponse>(
5188 (results,),
5189 self.tx_id,
5190 0x7f0139fc06fd6a9e,
5191 fidl::encoding::DynamicFlags::empty(),
5192 )
5193 }
5194}
5195
5196mod internal {
5197 use super::*;
5198
5199 impl fidl::encoding::ResourceTypeMarker for CountersConnectorConnectRequest {
5200 type Borrowed<'a> = &'a mut Self;
5201 fn take_or_borrow<'a>(
5202 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5203 ) -> Self::Borrowed<'a> {
5204 value
5205 }
5206 }
5207
5208 unsafe impl fidl::encoding::TypeMarker for CountersConnectorConnectRequest {
5209 type Owned = Self;
5210
5211 #[inline(always)]
5212 fn inline_align(_context: fidl::encoding::Context) -> usize {
5213 8
5214 }
5215
5216 #[inline(always)]
5217 fn inline_size(_context: fidl::encoding::Context) -> usize {
5218 24
5219 }
5220 }
5221
5222 unsafe impl
5223 fidl::encoding::Encode<
5224 CountersConnectorConnectRequest,
5225 fidl::encoding::DefaultFuchsiaResourceDialect,
5226 > for &mut CountersConnectorConnectRequest
5227 {
5228 #[inline]
5229 unsafe fn encode(
5230 self,
5231 encoder: &mut fidl::encoding::Encoder<
5232 '_,
5233 fidl::encoding::DefaultFuchsiaResourceDialect,
5234 >,
5235 offset: usize,
5236 _depth: fidl::encoding::Depth,
5237 ) -> fidl::Result<()> {
5238 encoder.debug_check_bounds::<CountersConnectorConnectRequest>(offset);
5239 fidl::encoding::Encode::<CountersConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5241 (
5242 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5243 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5244 ),
5245 encoder, offset, _depth
5246 )
5247 }
5248 }
5249 unsafe impl<
5250 T0: fidl::encoding::Encode<
5251 fidl::encoding::BoundedString<32>,
5252 fidl::encoding::DefaultFuchsiaResourceDialect,
5253 >,
5254 T1: fidl::encoding::Encode<
5255 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>>,
5256 fidl::encoding::DefaultFuchsiaResourceDialect,
5257 >,
5258 >
5259 fidl::encoding::Encode<
5260 CountersConnectorConnectRequest,
5261 fidl::encoding::DefaultFuchsiaResourceDialect,
5262 > for (T0, T1)
5263 {
5264 #[inline]
5265 unsafe fn encode(
5266 self,
5267 encoder: &mut fidl::encoding::Encoder<
5268 '_,
5269 fidl::encoding::DefaultFuchsiaResourceDialect,
5270 >,
5271 offset: usize,
5272 depth: fidl::encoding::Depth,
5273 ) -> fidl::Result<()> {
5274 encoder.debug_check_bounds::<CountersConnectorConnectRequest>(offset);
5275 unsafe {
5278 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5279 (ptr as *mut u64).write_unaligned(0);
5280 }
5281 self.0.encode(encoder, offset + 0, depth)?;
5283 self.1.encode(encoder, offset + 16, depth)?;
5284 Ok(())
5285 }
5286 }
5287
5288 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5289 for CountersConnectorConnectRequest
5290 {
5291 #[inline(always)]
5292 fn new_empty() -> Self {
5293 Self {
5294 name: fidl::new_empty!(
5295 fidl::encoding::BoundedString<32>,
5296 fidl::encoding::DefaultFuchsiaResourceDialect
5297 ),
5298 server_end: fidl::new_empty!(
5299 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>>,
5300 fidl::encoding::DefaultFuchsiaResourceDialect
5301 ),
5302 }
5303 }
5304
5305 #[inline]
5306 unsafe fn decode(
5307 &mut self,
5308 decoder: &mut fidl::encoding::Decoder<
5309 '_,
5310 fidl::encoding::DefaultFuchsiaResourceDialect,
5311 >,
5312 offset: usize,
5313 _depth: fidl::encoding::Depth,
5314 ) -> fidl::Result<()> {
5315 decoder.debug_check_bounds::<Self>(offset);
5316 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5318 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5319 let mask = 0xffffffff00000000u64;
5320 let maskedval = padval & mask;
5321 if maskedval != 0 {
5322 return Err(fidl::Error::NonZeroPadding {
5323 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5324 });
5325 }
5326 fidl::decode!(
5327 fidl::encoding::BoundedString<32>,
5328 fidl::encoding::DefaultFuchsiaResourceDialect,
5329 &mut self.name,
5330 decoder,
5331 offset + 0,
5332 _depth
5333 )?;
5334 fidl::decode!(
5335 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CountersMarker>>,
5336 fidl::encoding::DefaultFuchsiaResourceDialect,
5337 &mut self.server_end,
5338 decoder,
5339 offset + 16,
5340 _depth
5341 )?;
5342 Ok(())
5343 }
5344 }
5345
5346 impl fidl::encoding::ResourceTypeMarker for DeviceConnectorConnectRequest {
5347 type Borrowed<'a> = &'a mut Self;
5348 fn take_or_borrow<'a>(
5349 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5350 ) -> Self::Borrowed<'a> {
5351 value
5352 }
5353 }
5354
5355 unsafe impl fidl::encoding::TypeMarker for DeviceConnectorConnectRequest {
5356 type Owned = Self;
5357
5358 #[inline(always)]
5359 fn inline_align(_context: fidl::encoding::Context) -> usize {
5360 8
5361 }
5362
5363 #[inline(always)]
5364 fn inline_size(_context: fidl::encoding::Context) -> usize {
5365 24
5366 }
5367 }
5368
5369 unsafe impl
5370 fidl::encoding::Encode<
5371 DeviceConnectorConnectRequest,
5372 fidl::encoding::DefaultFuchsiaResourceDialect,
5373 > for &mut DeviceConnectorConnectRequest
5374 {
5375 #[inline]
5376 unsafe fn encode(
5377 self,
5378 encoder: &mut fidl::encoding::Encoder<
5379 '_,
5380 fidl::encoding::DefaultFuchsiaResourceDialect,
5381 >,
5382 offset: usize,
5383 _depth: fidl::encoding::Depth,
5384 ) -> fidl::Result<()> {
5385 encoder.debug_check_bounds::<DeviceConnectorConnectRequest>(offset);
5386 fidl::encoding::Encode::<DeviceConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5388 (
5389 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5390 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5391 ),
5392 encoder, offset, _depth
5393 )
5394 }
5395 }
5396 unsafe impl<
5397 T0: fidl::encoding::Encode<
5398 fidl::encoding::BoundedString<32>,
5399 fidl::encoding::DefaultFuchsiaResourceDialect,
5400 >,
5401 T1: fidl::encoding::Encode<
5402 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5403 fidl::encoding::DefaultFuchsiaResourceDialect,
5404 >,
5405 >
5406 fidl::encoding::Encode<
5407 DeviceConnectorConnectRequest,
5408 fidl::encoding::DefaultFuchsiaResourceDialect,
5409 > for (T0, T1)
5410 {
5411 #[inline]
5412 unsafe fn encode(
5413 self,
5414 encoder: &mut fidl::encoding::Encoder<
5415 '_,
5416 fidl::encoding::DefaultFuchsiaResourceDialect,
5417 >,
5418 offset: usize,
5419 depth: fidl::encoding::Depth,
5420 ) -> fidl::Result<()> {
5421 encoder.debug_check_bounds::<DeviceConnectorConnectRequest>(offset);
5422 unsafe {
5425 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5426 (ptr as *mut u64).write_unaligned(0);
5427 }
5428 self.0.encode(encoder, offset + 0, depth)?;
5430 self.1.encode(encoder, offset + 16, depth)?;
5431 Ok(())
5432 }
5433 }
5434
5435 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5436 for DeviceConnectorConnectRequest
5437 {
5438 #[inline(always)]
5439 fn new_empty() -> Self {
5440 Self {
5441 name: fidl::new_empty!(
5442 fidl::encoding::BoundedString<32>,
5443 fidl::encoding::DefaultFuchsiaResourceDialect
5444 ),
5445 server_end: fidl::new_empty!(
5446 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5447 fidl::encoding::DefaultFuchsiaResourceDialect
5448 ),
5449 }
5450 }
5451
5452 #[inline]
5453 unsafe fn decode(
5454 &mut self,
5455 decoder: &mut fidl::encoding::Decoder<
5456 '_,
5457 fidl::encoding::DefaultFuchsiaResourceDialect,
5458 >,
5459 offset: usize,
5460 _depth: fidl::encoding::Depth,
5461 ) -> fidl::Result<()> {
5462 decoder.debug_check_bounds::<Self>(offset);
5463 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5465 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5466 let mask = 0xffffffff00000000u64;
5467 let maskedval = padval & mask;
5468 if maskedval != 0 {
5469 return Err(fidl::Error::NonZeroPadding {
5470 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5471 });
5472 }
5473 fidl::decode!(
5474 fidl::encoding::BoundedString<32>,
5475 fidl::encoding::DefaultFuchsiaResourceDialect,
5476 &mut self.name,
5477 decoder,
5478 offset + 0,
5479 _depth
5480 )?;
5481 fidl::decode!(
5482 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
5483 fidl::encoding::DefaultFuchsiaResourceDialect,
5484 &mut self.server_end,
5485 decoder,
5486 offset + 16,
5487 _depth
5488 )?;
5489 Ok(())
5490 }
5491 }
5492
5493 impl fidl::encoding::ResourceTypeMarker for DeviceExtraConnectorConnectRequest {
5494 type Borrowed<'a> = &'a mut Self;
5495 fn take_or_borrow<'a>(
5496 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5497 ) -> Self::Borrowed<'a> {
5498 value
5499 }
5500 }
5501
5502 unsafe impl fidl::encoding::TypeMarker for DeviceExtraConnectorConnectRequest {
5503 type Owned = Self;
5504
5505 #[inline(always)]
5506 fn inline_align(_context: fidl::encoding::Context) -> usize {
5507 8
5508 }
5509
5510 #[inline(always)]
5511 fn inline_size(_context: fidl::encoding::Context) -> usize {
5512 24
5513 }
5514 }
5515
5516 unsafe impl
5517 fidl::encoding::Encode<
5518 DeviceExtraConnectorConnectRequest,
5519 fidl::encoding::DefaultFuchsiaResourceDialect,
5520 > for &mut DeviceExtraConnectorConnectRequest
5521 {
5522 #[inline]
5523 unsafe fn encode(
5524 self,
5525 encoder: &mut fidl::encoding::Encoder<
5526 '_,
5527 fidl::encoding::DefaultFuchsiaResourceDialect,
5528 >,
5529 offset: usize,
5530 _depth: fidl::encoding::Depth,
5531 ) -> fidl::Result<()> {
5532 encoder.debug_check_bounds::<DeviceExtraConnectorConnectRequest>(offset);
5533 fidl::encoding::Encode::<DeviceExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5535 (
5536 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5537 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5538 ),
5539 encoder, offset, _depth
5540 )
5541 }
5542 }
5543 unsafe impl<
5544 T0: fidl::encoding::Encode<
5545 fidl::encoding::BoundedString<32>,
5546 fidl::encoding::DefaultFuchsiaResourceDialect,
5547 >,
5548 T1: fidl::encoding::Encode<
5549 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
5550 fidl::encoding::DefaultFuchsiaResourceDialect,
5551 >,
5552 >
5553 fidl::encoding::Encode<
5554 DeviceExtraConnectorConnectRequest,
5555 fidl::encoding::DefaultFuchsiaResourceDialect,
5556 > for (T0, T1)
5557 {
5558 #[inline]
5559 unsafe fn encode(
5560 self,
5561 encoder: &mut fidl::encoding::Encoder<
5562 '_,
5563 fidl::encoding::DefaultFuchsiaResourceDialect,
5564 >,
5565 offset: usize,
5566 depth: fidl::encoding::Depth,
5567 ) -> fidl::Result<()> {
5568 encoder.debug_check_bounds::<DeviceExtraConnectorConnectRequest>(offset);
5569 unsafe {
5572 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5573 (ptr as *mut u64).write_unaligned(0);
5574 }
5575 self.0.encode(encoder, offset + 0, depth)?;
5577 self.1.encode(encoder, offset + 16, depth)?;
5578 Ok(())
5579 }
5580 }
5581
5582 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5583 for DeviceExtraConnectorConnectRequest
5584 {
5585 #[inline(always)]
5586 fn new_empty() -> Self {
5587 Self {
5588 name: fidl::new_empty!(
5589 fidl::encoding::BoundedString<32>,
5590 fidl::encoding::DefaultFuchsiaResourceDialect
5591 ),
5592 server_end: fidl::new_empty!(
5593 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
5594 fidl::encoding::DefaultFuchsiaResourceDialect
5595 ),
5596 }
5597 }
5598
5599 #[inline]
5600 unsafe fn decode(
5601 &mut self,
5602 decoder: &mut fidl::encoding::Decoder<
5603 '_,
5604 fidl::encoding::DefaultFuchsiaResourceDialect,
5605 >,
5606 offset: usize,
5607 _depth: fidl::encoding::Depth,
5608 ) -> fidl::Result<()> {
5609 decoder.debug_check_bounds::<Self>(offset);
5610 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5612 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5613 let mask = 0xffffffff00000000u64;
5614 let maskedval = padval & mask;
5615 if maskedval != 0 {
5616 return Err(fidl::Error::NonZeroPadding {
5617 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5618 });
5619 }
5620 fidl::decode!(
5621 fidl::encoding::BoundedString<32>,
5622 fidl::encoding::DefaultFuchsiaResourceDialect,
5623 &mut self.name,
5624 decoder,
5625 offset + 0,
5626 _depth
5627 )?;
5628 fidl::decode!(
5629 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
5630 fidl::encoding::DefaultFuchsiaResourceDialect,
5631 &mut self.server_end,
5632 decoder,
5633 offset + 16,
5634 _depth
5635 )?;
5636 Ok(())
5637 }
5638 }
5639
5640 impl fidl::encoding::ResourceTypeMarker for EnergyScanConnectorConnectRequest {
5641 type Borrowed<'a> = &'a mut Self;
5642 fn take_or_borrow<'a>(
5643 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5644 ) -> Self::Borrowed<'a> {
5645 value
5646 }
5647 }
5648
5649 unsafe impl fidl::encoding::TypeMarker for EnergyScanConnectorConnectRequest {
5650 type Owned = Self;
5651
5652 #[inline(always)]
5653 fn inline_align(_context: fidl::encoding::Context) -> usize {
5654 8
5655 }
5656
5657 #[inline(always)]
5658 fn inline_size(_context: fidl::encoding::Context) -> usize {
5659 24
5660 }
5661 }
5662
5663 unsafe impl
5664 fidl::encoding::Encode<
5665 EnergyScanConnectorConnectRequest,
5666 fidl::encoding::DefaultFuchsiaResourceDialect,
5667 > for &mut EnergyScanConnectorConnectRequest
5668 {
5669 #[inline]
5670 unsafe fn encode(
5671 self,
5672 encoder: &mut fidl::encoding::Encoder<
5673 '_,
5674 fidl::encoding::DefaultFuchsiaResourceDialect,
5675 >,
5676 offset: usize,
5677 _depth: fidl::encoding::Depth,
5678 ) -> fidl::Result<()> {
5679 encoder.debug_check_bounds::<EnergyScanConnectorConnectRequest>(offset);
5680 fidl::encoding::Encode::<EnergyScanConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5682 (
5683 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5684 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5685 ),
5686 encoder, offset, _depth
5687 )
5688 }
5689 }
5690 unsafe impl<
5691 T0: fidl::encoding::Encode<
5692 fidl::encoding::BoundedString<32>,
5693 fidl::encoding::DefaultFuchsiaResourceDialect,
5694 >,
5695 T1: fidl::encoding::Encode<
5696 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>>,
5697 fidl::encoding::DefaultFuchsiaResourceDialect,
5698 >,
5699 >
5700 fidl::encoding::Encode<
5701 EnergyScanConnectorConnectRequest,
5702 fidl::encoding::DefaultFuchsiaResourceDialect,
5703 > for (T0, T1)
5704 {
5705 #[inline]
5706 unsafe fn encode(
5707 self,
5708 encoder: &mut fidl::encoding::Encoder<
5709 '_,
5710 fidl::encoding::DefaultFuchsiaResourceDialect,
5711 >,
5712 offset: usize,
5713 depth: fidl::encoding::Depth,
5714 ) -> fidl::Result<()> {
5715 encoder.debug_check_bounds::<EnergyScanConnectorConnectRequest>(offset);
5716 unsafe {
5719 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5720 (ptr as *mut u64).write_unaligned(0);
5721 }
5722 self.0.encode(encoder, offset + 0, depth)?;
5724 self.1.encode(encoder, offset + 16, depth)?;
5725 Ok(())
5726 }
5727 }
5728
5729 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5730 for EnergyScanConnectorConnectRequest
5731 {
5732 #[inline(always)]
5733 fn new_empty() -> Self {
5734 Self {
5735 name: fidl::new_empty!(
5736 fidl::encoding::BoundedString<32>,
5737 fidl::encoding::DefaultFuchsiaResourceDialect
5738 ),
5739 server_end: fidl::new_empty!(
5740 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>>,
5741 fidl::encoding::DefaultFuchsiaResourceDialect
5742 ),
5743 }
5744 }
5745
5746 #[inline]
5747 unsafe fn decode(
5748 &mut self,
5749 decoder: &mut fidl::encoding::Decoder<
5750 '_,
5751 fidl::encoding::DefaultFuchsiaResourceDialect,
5752 >,
5753 offset: usize,
5754 _depth: fidl::encoding::Depth,
5755 ) -> fidl::Result<()> {
5756 decoder.debug_check_bounds::<Self>(offset);
5757 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5759 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5760 let mask = 0xffffffff00000000u64;
5761 let maskedval = padval & mask;
5762 if maskedval != 0 {
5763 return Err(fidl::Error::NonZeroPadding {
5764 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5765 });
5766 }
5767 fidl::decode!(
5768 fidl::encoding::BoundedString<32>,
5769 fidl::encoding::DefaultFuchsiaResourceDialect,
5770 &mut self.name,
5771 decoder,
5772 offset + 0,
5773 _depth
5774 )?;
5775 fidl::decode!(
5776 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanMarker>>,
5777 fidl::encoding::DefaultFuchsiaResourceDialect,
5778 &mut self.server_end,
5779 decoder,
5780 offset + 16,
5781 _depth
5782 )?;
5783 Ok(())
5784 }
5785 }
5786
5787 impl fidl::encoding::ResourceTypeMarker for EnergyScanStartEnergyScanRequest {
5788 type Borrowed<'a> = &'a mut Self;
5789 fn take_or_borrow<'a>(
5790 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5791 ) -> Self::Borrowed<'a> {
5792 value
5793 }
5794 }
5795
5796 unsafe impl fidl::encoding::TypeMarker for EnergyScanStartEnergyScanRequest {
5797 type Owned = Self;
5798
5799 #[inline(always)]
5800 fn inline_align(_context: fidl::encoding::Context) -> usize {
5801 8
5802 }
5803
5804 #[inline(always)]
5805 fn inline_size(_context: fidl::encoding::Context) -> usize {
5806 24
5807 }
5808 }
5809
5810 unsafe impl
5811 fidl::encoding::Encode<
5812 EnergyScanStartEnergyScanRequest,
5813 fidl::encoding::DefaultFuchsiaResourceDialect,
5814 > for &mut EnergyScanStartEnergyScanRequest
5815 {
5816 #[inline]
5817 unsafe fn encode(
5818 self,
5819 encoder: &mut fidl::encoding::Encoder<
5820 '_,
5821 fidl::encoding::DefaultFuchsiaResourceDialect,
5822 >,
5823 offset: usize,
5824 _depth: fidl::encoding::Depth,
5825 ) -> fidl::Result<()> {
5826 encoder.debug_check_bounds::<EnergyScanStartEnergyScanRequest>(offset);
5827 fidl::encoding::Encode::<
5829 EnergyScanStartEnergyScanRequest,
5830 fidl::encoding::DefaultFuchsiaResourceDialect,
5831 >::encode(
5832 (
5833 <EnergyScanParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
5834 <fidl::encoding::Endpoint<
5835 fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
5836 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5837 &mut self.stream
5838 ),
5839 ),
5840 encoder,
5841 offset,
5842 _depth,
5843 )
5844 }
5845 }
5846 unsafe impl<
5847 T0: fidl::encoding::Encode<
5848 EnergyScanParameters,
5849 fidl::encoding::DefaultFuchsiaResourceDialect,
5850 >,
5851 T1: fidl::encoding::Encode<
5852 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>>,
5853 fidl::encoding::DefaultFuchsiaResourceDialect,
5854 >,
5855 >
5856 fidl::encoding::Encode<
5857 EnergyScanStartEnergyScanRequest,
5858 fidl::encoding::DefaultFuchsiaResourceDialect,
5859 > for (T0, T1)
5860 {
5861 #[inline]
5862 unsafe fn encode(
5863 self,
5864 encoder: &mut fidl::encoding::Encoder<
5865 '_,
5866 fidl::encoding::DefaultFuchsiaResourceDialect,
5867 >,
5868 offset: usize,
5869 depth: fidl::encoding::Depth,
5870 ) -> fidl::Result<()> {
5871 encoder.debug_check_bounds::<EnergyScanStartEnergyScanRequest>(offset);
5872 unsafe {
5875 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5876 (ptr as *mut u64).write_unaligned(0);
5877 }
5878 self.0.encode(encoder, offset + 0, depth)?;
5880 self.1.encode(encoder, offset + 16, depth)?;
5881 Ok(())
5882 }
5883 }
5884
5885 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5886 for EnergyScanStartEnergyScanRequest
5887 {
5888 #[inline(always)]
5889 fn new_empty() -> Self {
5890 Self {
5891 params: fidl::new_empty!(
5892 EnergyScanParameters,
5893 fidl::encoding::DefaultFuchsiaResourceDialect
5894 ),
5895 stream: fidl::new_empty!(
5896 fidl::encoding::Endpoint<
5897 fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>,
5898 >,
5899 fidl::encoding::DefaultFuchsiaResourceDialect
5900 ),
5901 }
5902 }
5903
5904 #[inline]
5905 unsafe fn decode(
5906 &mut self,
5907 decoder: &mut fidl::encoding::Decoder<
5908 '_,
5909 fidl::encoding::DefaultFuchsiaResourceDialect,
5910 >,
5911 offset: usize,
5912 _depth: fidl::encoding::Depth,
5913 ) -> fidl::Result<()> {
5914 decoder.debug_check_bounds::<Self>(offset);
5915 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5917 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5918 let mask = 0xffffffff00000000u64;
5919 let maskedval = padval & mask;
5920 if maskedval != 0 {
5921 return Err(fidl::Error::NonZeroPadding {
5922 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5923 });
5924 }
5925 fidl::decode!(
5926 EnergyScanParameters,
5927 fidl::encoding::DefaultFuchsiaResourceDialect,
5928 &mut self.params,
5929 decoder,
5930 offset + 0,
5931 _depth
5932 )?;
5933 fidl::decode!(
5934 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EnergyScanResultStreamMarker>>,
5935 fidl::encoding::DefaultFuchsiaResourceDialect,
5936 &mut self.stream,
5937 decoder,
5938 offset + 16,
5939 _depth
5940 )?;
5941 Ok(())
5942 }
5943 }
5944}