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