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_hardware_adb__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceStartAdbRequest {
16 pub interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceStartAdbRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct ProviderConnectToServiceRequest {
23 pub socket: fidl::Socket,
24 pub args: Option<String>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28 for ProviderConnectToServiceRequest
29{
30}
31
32#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
33pub struct DeviceMarker;
34
35impl fidl::endpoints::ProtocolMarker for DeviceMarker {
36 type Proxy = DeviceProxy;
37 type RequestStream = DeviceRequestStream;
38 #[cfg(target_os = "fuchsia")]
39 type SynchronousProxy = DeviceSynchronousProxy;
40
41 const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.Device";
42}
43impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
44pub type DeviceStartAdbResult = Result<(), i32>;
45pub type DeviceStopAdbResult = Result<(), i32>;
46
47pub trait DeviceProxyInterface: Send + Sync {
48 type StartAdbResponseFut: std::future::Future<Output = Result<DeviceStartAdbResult, fidl::Error>>
49 + Send;
50 fn r#start_adb(
51 &self,
52 interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
53 ) -> Self::StartAdbResponseFut;
54 type StopAdbResponseFut: std::future::Future<Output = Result<DeviceStopAdbResult, fidl::Error>>
55 + Send;
56 fn r#stop_adb(&self) -> Self::StopAdbResponseFut;
57}
58#[derive(Debug)]
59#[cfg(target_os = "fuchsia")]
60pub struct DeviceSynchronousProxy {
61 client: fidl::client::sync::Client,
62}
63
64#[cfg(target_os = "fuchsia")]
65impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
66 type Proxy = DeviceProxy;
67 type Protocol = DeviceMarker;
68
69 fn from_channel(inner: fidl::Channel) -> Self {
70 Self::new(inner)
71 }
72
73 fn into_channel(self) -> fidl::Channel {
74 self.client.into_channel()
75 }
76
77 fn as_channel(&self) -> &fidl::Channel {
78 self.client.as_channel()
79 }
80}
81
82#[cfg(target_os = "fuchsia")]
83impl DeviceSynchronousProxy {
84 pub fn new(channel: fidl::Channel) -> Self {
85 Self { client: fidl::client::sync::Client::new(channel) }
86 }
87
88 pub fn into_channel(self) -> fidl::Channel {
89 self.client.into_channel()
90 }
91
92 pub fn wait_for_event(
95 &self,
96 deadline: zx::MonotonicInstant,
97 ) -> Result<DeviceEvent, fidl::Error> {
98 DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
99 }
100
101 pub fn r#start_adb(
103 &self,
104 mut interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
105 ___deadline: zx::MonotonicInstant,
106 ) -> Result<DeviceStartAdbResult, fidl::Error> {
107 let _response = self.client.send_query::<
108 DeviceStartAdbRequest,
109 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
110 DeviceMarker,
111 >(
112 (interface,),
113 0x286c2e31de2159a5,
114 fidl::encoding::DynamicFlags::empty(),
115 ___deadline,
116 )?;
117 Ok(_response.map(|x| x))
118 }
119
120 pub fn r#stop_adb(
122 &self,
123 ___deadline: zx::MonotonicInstant,
124 ) -> Result<DeviceStopAdbResult, fidl::Error> {
125 let _response = self.client.send_query::<
126 fidl::encoding::EmptyPayload,
127 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
128 DeviceMarker,
129 >(
130 (),
131 0x6d7d1816750fd3d0,
132 fidl::encoding::DynamicFlags::empty(),
133 ___deadline,
134 )?;
135 Ok(_response.map(|x| x))
136 }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl From<DeviceSynchronousProxy> for zx::NullableHandle {
141 fn from(value: DeviceSynchronousProxy) -> Self {
142 value.into_channel().into()
143 }
144}
145
146#[cfg(target_os = "fuchsia")]
147impl From<fidl::Channel> for DeviceSynchronousProxy {
148 fn from(value: fidl::Channel) -> Self {
149 Self::new(value)
150 }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
155 type Protocol = DeviceMarker;
156
157 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
158 Self::new(value.into_channel())
159 }
160}
161
162#[derive(Debug, Clone)]
163pub struct DeviceProxy {
164 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
165}
166
167impl fidl::endpoints::Proxy for DeviceProxy {
168 type Protocol = DeviceMarker;
169
170 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
171 Self::new(inner)
172 }
173
174 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
175 self.client.into_channel().map_err(|client| Self { client })
176 }
177
178 fn as_channel(&self) -> &::fidl::AsyncChannel {
179 self.client.as_channel()
180 }
181}
182
183impl DeviceProxy {
184 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
186 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
187 Self { client: fidl::client::Client::new(channel, protocol_name) }
188 }
189
190 pub fn take_event_stream(&self) -> DeviceEventStream {
196 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
197 }
198
199 pub fn r#start_adb(
201 &self,
202 mut interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
203 ) -> fidl::client::QueryResponseFut<
204 DeviceStartAdbResult,
205 fidl::encoding::DefaultFuchsiaResourceDialect,
206 > {
207 DeviceProxyInterface::r#start_adb(self, interface)
208 }
209
210 pub fn r#stop_adb(
212 &self,
213 ) -> fidl::client::QueryResponseFut<
214 DeviceStopAdbResult,
215 fidl::encoding::DefaultFuchsiaResourceDialect,
216 > {
217 DeviceProxyInterface::r#stop_adb(self)
218 }
219}
220
221impl DeviceProxyInterface for DeviceProxy {
222 type StartAdbResponseFut = fidl::client::QueryResponseFut<
223 DeviceStartAdbResult,
224 fidl::encoding::DefaultFuchsiaResourceDialect,
225 >;
226 fn r#start_adb(
227 &self,
228 mut interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
229 ) -> Self::StartAdbResponseFut {
230 fn _decode(
231 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
232 ) -> Result<DeviceStartAdbResult, fidl::Error> {
233 let _response = fidl::client::decode_transaction_body::<
234 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
235 fidl::encoding::DefaultFuchsiaResourceDialect,
236 0x286c2e31de2159a5,
237 >(_buf?)?;
238 Ok(_response.map(|x| x))
239 }
240 self.client.send_query_and_decode::<DeviceStartAdbRequest, DeviceStartAdbResult>(
241 (interface,),
242 0x286c2e31de2159a5,
243 fidl::encoding::DynamicFlags::empty(),
244 _decode,
245 )
246 }
247
248 type StopAdbResponseFut = fidl::client::QueryResponseFut<
249 DeviceStopAdbResult,
250 fidl::encoding::DefaultFuchsiaResourceDialect,
251 >;
252 fn r#stop_adb(&self) -> Self::StopAdbResponseFut {
253 fn _decode(
254 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
255 ) -> Result<DeviceStopAdbResult, fidl::Error> {
256 let _response = fidl::client::decode_transaction_body::<
257 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
258 fidl::encoding::DefaultFuchsiaResourceDialect,
259 0x6d7d1816750fd3d0,
260 >(_buf?)?;
261 Ok(_response.map(|x| x))
262 }
263 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceStopAdbResult>(
264 (),
265 0x6d7d1816750fd3d0,
266 fidl::encoding::DynamicFlags::empty(),
267 _decode,
268 )
269 }
270}
271
272pub struct DeviceEventStream {
273 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
274}
275
276impl std::marker::Unpin for DeviceEventStream {}
277
278impl futures::stream::FusedStream for DeviceEventStream {
279 fn is_terminated(&self) -> bool {
280 self.event_receiver.is_terminated()
281 }
282}
283
284impl futures::Stream for DeviceEventStream {
285 type Item = Result<DeviceEvent, fidl::Error>;
286
287 fn poll_next(
288 mut self: std::pin::Pin<&mut Self>,
289 cx: &mut std::task::Context<'_>,
290 ) -> std::task::Poll<Option<Self::Item>> {
291 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
292 &mut self.event_receiver,
293 cx
294 )?) {
295 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
296 None => std::task::Poll::Ready(None),
297 }
298 }
299}
300
301#[derive(Debug)]
302pub enum DeviceEvent {}
303
304impl DeviceEvent {
305 fn decode(
307 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
308 ) -> Result<DeviceEvent, fidl::Error> {
309 let (bytes, _handles) = buf.split_mut();
310 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
311 debug_assert_eq!(tx_header.tx_id, 0);
312 match tx_header.ordinal {
313 _ => Err(fidl::Error::UnknownOrdinal {
314 ordinal: tx_header.ordinal,
315 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
316 }),
317 }
318 }
319}
320
321pub struct DeviceRequestStream {
323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
324 is_terminated: bool,
325}
326
327impl std::marker::Unpin for DeviceRequestStream {}
328
329impl futures::stream::FusedStream for DeviceRequestStream {
330 fn is_terminated(&self) -> bool {
331 self.is_terminated
332 }
333}
334
335impl fidl::endpoints::RequestStream for DeviceRequestStream {
336 type Protocol = DeviceMarker;
337 type ControlHandle = DeviceControlHandle;
338
339 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
340 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
341 }
342
343 fn control_handle(&self) -> Self::ControlHandle {
344 DeviceControlHandle { inner: self.inner.clone() }
345 }
346
347 fn into_inner(
348 self,
349 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
350 {
351 (self.inner, self.is_terminated)
352 }
353
354 fn from_inner(
355 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
356 is_terminated: bool,
357 ) -> Self {
358 Self { inner, is_terminated }
359 }
360}
361
362impl futures::Stream for DeviceRequestStream {
363 type Item = Result<DeviceRequest, fidl::Error>;
364
365 fn poll_next(
366 mut self: std::pin::Pin<&mut Self>,
367 cx: &mut std::task::Context<'_>,
368 ) -> std::task::Poll<Option<Self::Item>> {
369 let this = &mut *self;
370 if this.inner.check_shutdown(cx) {
371 this.is_terminated = true;
372 return std::task::Poll::Ready(None);
373 }
374 if this.is_terminated {
375 panic!("polled DeviceRequestStream after completion");
376 }
377 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
378 |bytes, handles| {
379 match this.inner.channel().read_etc(cx, bytes, handles) {
380 std::task::Poll::Ready(Ok(())) => {}
381 std::task::Poll::Pending => return std::task::Poll::Pending,
382 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
383 this.is_terminated = true;
384 return std::task::Poll::Ready(None);
385 }
386 std::task::Poll::Ready(Err(e)) => {
387 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
388 e.into(),
389 ))));
390 }
391 }
392
393 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
395
396 std::task::Poll::Ready(Some(match header.ordinal {
397 0x286c2e31de2159a5 => {
398 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
399 let mut req = fidl::new_empty!(
400 DeviceStartAdbRequest,
401 fidl::encoding::DefaultFuchsiaResourceDialect
402 );
403 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartAdbRequest>(&header, _body_bytes, handles, &mut req)?;
404 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
405 Ok(DeviceRequest::StartAdb {
406 interface: req.interface,
407
408 responder: DeviceStartAdbResponder {
409 control_handle: std::mem::ManuallyDrop::new(control_handle),
410 tx_id: header.tx_id,
411 },
412 })
413 }
414 0x6d7d1816750fd3d0 => {
415 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
416 let mut req = fidl::new_empty!(
417 fidl::encoding::EmptyPayload,
418 fidl::encoding::DefaultFuchsiaResourceDialect
419 );
420 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
421 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
422 Ok(DeviceRequest::StopAdb {
423 responder: DeviceStopAdbResponder {
424 control_handle: std::mem::ManuallyDrop::new(control_handle),
425 tx_id: header.tx_id,
426 },
427 })
428 }
429 _ => Err(fidl::Error::UnknownOrdinal {
430 ordinal: header.ordinal,
431 protocol_name:
432 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
433 }),
434 }))
435 },
436 )
437 }
438}
439
440#[derive(Debug)]
442pub enum DeviceRequest {
443 StartAdb {
445 interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
446 responder: DeviceStartAdbResponder,
447 },
448 StopAdb { responder: DeviceStopAdbResponder },
450}
451
452impl DeviceRequest {
453 #[allow(irrefutable_let_patterns)]
454 pub fn into_start_adb(
455 self,
456 ) -> Option<(fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>, DeviceStartAdbResponder)> {
457 if let DeviceRequest::StartAdb { interface, responder } = self {
458 Some((interface, responder))
459 } else {
460 None
461 }
462 }
463
464 #[allow(irrefutable_let_patterns)]
465 pub fn into_stop_adb(self) -> Option<(DeviceStopAdbResponder)> {
466 if let DeviceRequest::StopAdb { responder } = self { Some((responder)) } else { None }
467 }
468
469 pub fn method_name(&self) -> &'static str {
471 match *self {
472 DeviceRequest::StartAdb { .. } => "start_adb",
473 DeviceRequest::StopAdb { .. } => "stop_adb",
474 }
475 }
476}
477
478#[derive(Debug, Clone)]
479pub struct DeviceControlHandle {
480 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
481}
482
483impl fidl::endpoints::ControlHandle for DeviceControlHandle {
484 fn shutdown(&self) {
485 self.inner.shutdown()
486 }
487
488 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
489 self.inner.shutdown_with_epitaph(status)
490 }
491
492 fn is_closed(&self) -> bool {
493 self.inner.channel().is_closed()
494 }
495 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
496 self.inner.channel().on_closed()
497 }
498
499 #[cfg(target_os = "fuchsia")]
500 fn signal_peer(
501 &self,
502 clear_mask: zx::Signals,
503 set_mask: zx::Signals,
504 ) -> Result<(), zx_status::Status> {
505 use fidl::Peered;
506 self.inner.channel().signal_peer(clear_mask, set_mask)
507 }
508}
509
510impl DeviceControlHandle {}
511
512#[must_use = "FIDL methods require a response to be sent"]
513#[derive(Debug)]
514pub struct DeviceStartAdbResponder {
515 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
516 tx_id: u32,
517}
518
519impl std::ops::Drop for DeviceStartAdbResponder {
523 fn drop(&mut self) {
524 self.control_handle.shutdown();
525 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
527 }
528}
529
530impl fidl::endpoints::Responder for DeviceStartAdbResponder {
531 type ControlHandle = DeviceControlHandle;
532
533 fn control_handle(&self) -> &DeviceControlHandle {
534 &self.control_handle
535 }
536
537 fn drop_without_shutdown(mut self) {
538 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
540 std::mem::forget(self);
542 }
543}
544
545impl DeviceStartAdbResponder {
546 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
550 let _result = self.send_raw(result);
551 if _result.is_err() {
552 self.control_handle.shutdown();
553 }
554 self.drop_without_shutdown();
555 _result
556 }
557
558 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
560 let _result = self.send_raw(result);
561 self.drop_without_shutdown();
562 _result
563 }
564
565 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
566 self.control_handle
567 .inner
568 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
569 result,
570 self.tx_id,
571 0x286c2e31de2159a5,
572 fidl::encoding::DynamicFlags::empty(),
573 )
574 }
575}
576
577#[must_use = "FIDL methods require a response to be sent"]
578#[derive(Debug)]
579pub struct DeviceStopAdbResponder {
580 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
581 tx_id: u32,
582}
583
584impl std::ops::Drop for DeviceStopAdbResponder {
588 fn drop(&mut self) {
589 self.control_handle.shutdown();
590 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
592 }
593}
594
595impl fidl::endpoints::Responder for DeviceStopAdbResponder {
596 type ControlHandle = DeviceControlHandle;
597
598 fn control_handle(&self) -> &DeviceControlHandle {
599 &self.control_handle
600 }
601
602 fn drop_without_shutdown(mut self) {
603 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
605 std::mem::forget(self);
607 }
608}
609
610impl DeviceStopAdbResponder {
611 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
615 let _result = self.send_raw(result);
616 if _result.is_err() {
617 self.control_handle.shutdown();
618 }
619 self.drop_without_shutdown();
620 _result
621 }
622
623 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
625 let _result = self.send_raw(result);
626 self.drop_without_shutdown();
627 _result
628 }
629
630 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
631 self.control_handle
632 .inner
633 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
634 result,
635 self.tx_id,
636 0x6d7d1816750fd3d0,
637 fidl::encoding::DynamicFlags::empty(),
638 )
639 }
640}
641
642#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
643pub struct ProviderMarker;
644
645impl fidl::endpoints::ProtocolMarker for ProviderMarker {
646 type Proxy = ProviderProxy;
647 type RequestStream = ProviderRequestStream;
648 #[cfg(target_os = "fuchsia")]
649 type SynchronousProxy = ProviderSynchronousProxy;
650
651 const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.Provider";
652}
653impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
654pub type ProviderConnectToServiceResult = Result<(), i32>;
655
656pub trait ProviderProxyInterface: Send + Sync {
657 type ConnectToServiceResponseFut: std::future::Future<Output = Result<ProviderConnectToServiceResult, fidl::Error>>
658 + Send;
659 fn r#connect_to_service(
660 &self,
661 socket: fidl::Socket,
662 args: Option<&str>,
663 ) -> Self::ConnectToServiceResponseFut;
664}
665#[derive(Debug)]
666#[cfg(target_os = "fuchsia")]
667pub struct ProviderSynchronousProxy {
668 client: fidl::client::sync::Client,
669}
670
671#[cfg(target_os = "fuchsia")]
672impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
673 type Proxy = ProviderProxy;
674 type Protocol = ProviderMarker;
675
676 fn from_channel(inner: fidl::Channel) -> Self {
677 Self::new(inner)
678 }
679
680 fn into_channel(self) -> fidl::Channel {
681 self.client.into_channel()
682 }
683
684 fn as_channel(&self) -> &fidl::Channel {
685 self.client.as_channel()
686 }
687}
688
689#[cfg(target_os = "fuchsia")]
690impl ProviderSynchronousProxy {
691 pub fn new(channel: fidl::Channel) -> Self {
692 Self { client: fidl::client::sync::Client::new(channel) }
693 }
694
695 pub fn into_channel(self) -> fidl::Channel {
696 self.client.into_channel()
697 }
698
699 pub fn wait_for_event(
702 &self,
703 deadline: zx::MonotonicInstant,
704 ) -> Result<ProviderEvent, fidl::Error> {
705 ProviderEvent::decode(self.client.wait_for_event::<ProviderMarker>(deadline)?)
706 }
707
708 pub fn r#connect_to_service(
711 &self,
712 mut socket: fidl::Socket,
713 mut args: Option<&str>,
714 ___deadline: zx::MonotonicInstant,
715 ) -> Result<ProviderConnectToServiceResult, fidl::Error> {
716 let _response = self.client.send_query::<
717 ProviderConnectToServiceRequest,
718 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
719 ProviderMarker,
720 >(
721 (socket, args,),
722 0x303e4a312d85292b,
723 fidl::encoding::DynamicFlags::empty(),
724 ___deadline,
725 )?;
726 Ok(_response.map(|x| x))
727 }
728}
729
730#[cfg(target_os = "fuchsia")]
731impl From<ProviderSynchronousProxy> for zx::NullableHandle {
732 fn from(value: ProviderSynchronousProxy) -> Self {
733 value.into_channel().into()
734 }
735}
736
737#[cfg(target_os = "fuchsia")]
738impl From<fidl::Channel> for ProviderSynchronousProxy {
739 fn from(value: fidl::Channel) -> Self {
740 Self::new(value)
741 }
742}
743
744#[cfg(target_os = "fuchsia")]
745impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
746 type Protocol = ProviderMarker;
747
748 fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
749 Self::new(value.into_channel())
750 }
751}
752
753#[derive(Debug, Clone)]
754pub struct ProviderProxy {
755 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
756}
757
758impl fidl::endpoints::Proxy for ProviderProxy {
759 type Protocol = ProviderMarker;
760
761 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
762 Self::new(inner)
763 }
764
765 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
766 self.client.into_channel().map_err(|client| Self { client })
767 }
768
769 fn as_channel(&self) -> &::fidl::AsyncChannel {
770 self.client.as_channel()
771 }
772}
773
774impl ProviderProxy {
775 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
777 let protocol_name = <ProviderMarker 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) -> ProviderEventStream {
787 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
788 }
789
790 pub fn r#connect_to_service(
793 &self,
794 mut socket: fidl::Socket,
795 mut args: Option<&str>,
796 ) -> fidl::client::QueryResponseFut<
797 ProviderConnectToServiceResult,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 > {
800 ProviderProxyInterface::r#connect_to_service(self, socket, args)
801 }
802}
803
804impl ProviderProxyInterface for ProviderProxy {
805 type ConnectToServiceResponseFut = fidl::client::QueryResponseFut<
806 ProviderConnectToServiceResult,
807 fidl::encoding::DefaultFuchsiaResourceDialect,
808 >;
809 fn r#connect_to_service(
810 &self,
811 mut socket: fidl::Socket,
812 mut args: Option<&str>,
813 ) -> Self::ConnectToServiceResponseFut {
814 fn _decode(
815 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
816 ) -> Result<ProviderConnectToServiceResult, fidl::Error> {
817 let _response = fidl::client::decode_transaction_body::<
818 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
819 fidl::encoding::DefaultFuchsiaResourceDialect,
820 0x303e4a312d85292b,
821 >(_buf?)?;
822 Ok(_response.map(|x| x))
823 }
824 self.client.send_query_and_decode::<
825 ProviderConnectToServiceRequest,
826 ProviderConnectToServiceResult,
827 >(
828 (socket, args,),
829 0x303e4a312d85292b,
830 fidl::encoding::DynamicFlags::empty(),
831 _decode,
832 )
833 }
834}
835
836pub struct ProviderEventStream {
837 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
838}
839
840impl std::marker::Unpin for ProviderEventStream {}
841
842impl futures::stream::FusedStream for ProviderEventStream {
843 fn is_terminated(&self) -> bool {
844 self.event_receiver.is_terminated()
845 }
846}
847
848impl futures::Stream for ProviderEventStream {
849 type Item = Result<ProviderEvent, fidl::Error>;
850
851 fn poll_next(
852 mut self: std::pin::Pin<&mut Self>,
853 cx: &mut std::task::Context<'_>,
854 ) -> std::task::Poll<Option<Self::Item>> {
855 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
856 &mut self.event_receiver,
857 cx
858 )?) {
859 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
860 None => std::task::Poll::Ready(None),
861 }
862 }
863}
864
865#[derive(Debug)]
866pub enum ProviderEvent {}
867
868impl ProviderEvent {
869 fn decode(
871 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
872 ) -> Result<ProviderEvent, fidl::Error> {
873 let (bytes, _handles) = buf.split_mut();
874 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
875 debug_assert_eq!(tx_header.tx_id, 0);
876 match tx_header.ordinal {
877 _ => Err(fidl::Error::UnknownOrdinal {
878 ordinal: tx_header.ordinal,
879 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
880 }),
881 }
882 }
883}
884
885pub struct ProviderRequestStream {
887 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
888 is_terminated: bool,
889}
890
891impl std::marker::Unpin for ProviderRequestStream {}
892
893impl futures::stream::FusedStream for ProviderRequestStream {
894 fn is_terminated(&self) -> bool {
895 self.is_terminated
896 }
897}
898
899impl fidl::endpoints::RequestStream for ProviderRequestStream {
900 type Protocol = ProviderMarker;
901 type ControlHandle = ProviderControlHandle;
902
903 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
904 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
905 }
906
907 fn control_handle(&self) -> Self::ControlHandle {
908 ProviderControlHandle { inner: self.inner.clone() }
909 }
910
911 fn into_inner(
912 self,
913 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
914 {
915 (self.inner, self.is_terminated)
916 }
917
918 fn from_inner(
919 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
920 is_terminated: bool,
921 ) -> Self {
922 Self { inner, is_terminated }
923 }
924}
925
926impl futures::Stream for ProviderRequestStream {
927 type Item = Result<ProviderRequest, fidl::Error>;
928
929 fn poll_next(
930 mut self: std::pin::Pin<&mut Self>,
931 cx: &mut std::task::Context<'_>,
932 ) -> std::task::Poll<Option<Self::Item>> {
933 let this = &mut *self;
934 if this.inner.check_shutdown(cx) {
935 this.is_terminated = true;
936 return std::task::Poll::Ready(None);
937 }
938 if this.is_terminated {
939 panic!("polled ProviderRequestStream after completion");
940 }
941 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
942 |bytes, handles| {
943 match this.inner.channel().read_etc(cx, bytes, handles) {
944 std::task::Poll::Ready(Ok(())) => {}
945 std::task::Poll::Pending => return std::task::Poll::Pending,
946 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
947 this.is_terminated = true;
948 return std::task::Poll::Ready(None);
949 }
950 std::task::Poll::Ready(Err(e)) => {
951 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
952 e.into(),
953 ))));
954 }
955 }
956
957 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959
960 std::task::Poll::Ready(Some(match header.ordinal {
961 0x303e4a312d85292b => {
962 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
963 let mut req = fidl::new_empty!(
964 ProviderConnectToServiceRequest,
965 fidl::encoding::DefaultFuchsiaResourceDialect
966 );
967 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderConnectToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
968 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
969 Ok(ProviderRequest::ConnectToService {
970 socket: req.socket,
971 args: req.args,
972
973 responder: ProviderConnectToServiceResponder {
974 control_handle: std::mem::ManuallyDrop::new(control_handle),
975 tx_id: header.tx_id,
976 },
977 })
978 }
979 _ => Err(fidl::Error::UnknownOrdinal {
980 ordinal: header.ordinal,
981 protocol_name:
982 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
983 }),
984 }))
985 },
986 )
987 }
988}
989
990#[derive(Debug)]
1003pub enum ProviderRequest {
1004 ConnectToService {
1007 socket: fidl::Socket,
1008 args: Option<String>,
1009 responder: ProviderConnectToServiceResponder,
1010 },
1011}
1012
1013impl ProviderRequest {
1014 #[allow(irrefutable_let_patterns)]
1015 pub fn into_connect_to_service(
1016 self,
1017 ) -> Option<(fidl::Socket, Option<String>, ProviderConnectToServiceResponder)> {
1018 if let ProviderRequest::ConnectToService { socket, args, responder } = self {
1019 Some((socket, args, responder))
1020 } else {
1021 None
1022 }
1023 }
1024
1025 pub fn method_name(&self) -> &'static str {
1027 match *self {
1028 ProviderRequest::ConnectToService { .. } => "connect_to_service",
1029 }
1030 }
1031}
1032
1033#[derive(Debug, Clone)]
1034pub struct ProviderControlHandle {
1035 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1036}
1037
1038impl fidl::endpoints::ControlHandle for ProviderControlHandle {
1039 fn shutdown(&self) {
1040 self.inner.shutdown()
1041 }
1042
1043 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1044 self.inner.shutdown_with_epitaph(status)
1045 }
1046
1047 fn is_closed(&self) -> bool {
1048 self.inner.channel().is_closed()
1049 }
1050 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1051 self.inner.channel().on_closed()
1052 }
1053
1054 #[cfg(target_os = "fuchsia")]
1055 fn signal_peer(
1056 &self,
1057 clear_mask: zx::Signals,
1058 set_mask: zx::Signals,
1059 ) -> Result<(), zx_status::Status> {
1060 use fidl::Peered;
1061 self.inner.channel().signal_peer(clear_mask, set_mask)
1062 }
1063}
1064
1065impl ProviderControlHandle {}
1066
1067#[must_use = "FIDL methods require a response to be sent"]
1068#[derive(Debug)]
1069pub struct ProviderConnectToServiceResponder {
1070 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1071 tx_id: u32,
1072}
1073
1074impl std::ops::Drop for ProviderConnectToServiceResponder {
1078 fn drop(&mut self) {
1079 self.control_handle.shutdown();
1080 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1082 }
1083}
1084
1085impl fidl::endpoints::Responder for ProviderConnectToServiceResponder {
1086 type ControlHandle = ProviderControlHandle;
1087
1088 fn control_handle(&self) -> &ProviderControlHandle {
1089 &self.control_handle
1090 }
1091
1092 fn drop_without_shutdown(mut self) {
1093 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1095 std::mem::forget(self);
1097 }
1098}
1099
1100impl ProviderConnectToServiceResponder {
1101 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1105 let _result = self.send_raw(result);
1106 if _result.is_err() {
1107 self.control_handle.shutdown();
1108 }
1109 self.drop_without_shutdown();
1110 _result
1111 }
1112
1113 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1115 let _result = self.send_raw(result);
1116 self.drop_without_shutdown();
1117 _result
1118 }
1119
1120 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1121 self.control_handle
1122 .inner
1123 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1124 result,
1125 self.tx_id,
1126 0x303e4a312d85292b,
1127 fidl::encoding::DynamicFlags::empty(),
1128 )
1129 }
1130}
1131
1132#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1133pub struct StateControllerMarker;
1134
1135impl fidl::endpoints::ProtocolMarker for StateControllerMarker {
1136 type Proxy = StateControllerProxy;
1137 type RequestStream = StateControllerRequestStream;
1138 #[cfg(target_os = "fuchsia")]
1139 type SynchronousProxy = StateControllerSynchronousProxy;
1140
1141 const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.StateController";
1142}
1143impl fidl::endpoints::DiscoverableProtocolMarker for StateControllerMarker {}
1144pub type StateControllerSetSystemTypeResult = Result<(), i32>;
1145
1146pub trait StateControllerProxyInterface: Send + Sync {
1147 type SetSystemTypeResponseFut: std::future::Future<Output = Result<StateControllerSetSystemTypeResult, fidl::Error>>
1148 + Send;
1149 fn r#set_system_type(&self, system_type: SystemType) -> Self::SetSystemTypeResponseFut;
1150}
1151#[derive(Debug)]
1152#[cfg(target_os = "fuchsia")]
1153pub struct StateControllerSynchronousProxy {
1154 client: fidl::client::sync::Client,
1155}
1156
1157#[cfg(target_os = "fuchsia")]
1158impl fidl::endpoints::SynchronousProxy for StateControllerSynchronousProxy {
1159 type Proxy = StateControllerProxy;
1160 type Protocol = StateControllerMarker;
1161
1162 fn from_channel(inner: fidl::Channel) -> Self {
1163 Self::new(inner)
1164 }
1165
1166 fn into_channel(self) -> fidl::Channel {
1167 self.client.into_channel()
1168 }
1169
1170 fn as_channel(&self) -> &fidl::Channel {
1171 self.client.as_channel()
1172 }
1173}
1174
1175#[cfg(target_os = "fuchsia")]
1176impl StateControllerSynchronousProxy {
1177 pub fn new(channel: fidl::Channel) -> Self {
1178 Self { client: fidl::client::sync::Client::new(channel) }
1179 }
1180
1181 pub fn into_channel(self) -> fidl::Channel {
1182 self.client.into_channel()
1183 }
1184
1185 pub fn wait_for_event(
1188 &self,
1189 deadline: zx::MonotonicInstant,
1190 ) -> Result<StateControllerEvent, fidl::Error> {
1191 StateControllerEvent::decode(self.client.wait_for_event::<StateControllerMarker>(deadline)?)
1192 }
1193
1194 pub fn r#set_system_type(
1199 &self,
1200 mut system_type: SystemType,
1201 ___deadline: zx::MonotonicInstant,
1202 ) -> Result<StateControllerSetSystemTypeResult, fidl::Error> {
1203 let _response = self.client.send_query::<
1204 StateControllerSetSystemTypeRequest,
1205 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1206 StateControllerMarker,
1207 >(
1208 (system_type,),
1209 0xa40a1100522d82e,
1210 fidl::encoding::DynamicFlags::FLEXIBLE,
1211 ___deadline,
1212 )?
1213 .into_result::<StateControllerMarker>("set_system_type")?;
1214 Ok(_response.map(|x| x))
1215 }
1216}
1217
1218#[cfg(target_os = "fuchsia")]
1219impl From<StateControllerSynchronousProxy> for zx::NullableHandle {
1220 fn from(value: StateControllerSynchronousProxy) -> Self {
1221 value.into_channel().into()
1222 }
1223}
1224
1225#[cfg(target_os = "fuchsia")]
1226impl From<fidl::Channel> for StateControllerSynchronousProxy {
1227 fn from(value: fidl::Channel) -> Self {
1228 Self::new(value)
1229 }
1230}
1231
1232#[cfg(target_os = "fuchsia")]
1233impl fidl::endpoints::FromClient for StateControllerSynchronousProxy {
1234 type Protocol = StateControllerMarker;
1235
1236 fn from_client(value: fidl::endpoints::ClientEnd<StateControllerMarker>) -> Self {
1237 Self::new(value.into_channel())
1238 }
1239}
1240
1241#[derive(Debug, Clone)]
1242pub struct StateControllerProxy {
1243 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1244}
1245
1246impl fidl::endpoints::Proxy for StateControllerProxy {
1247 type Protocol = StateControllerMarker;
1248
1249 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1250 Self::new(inner)
1251 }
1252
1253 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1254 self.client.into_channel().map_err(|client| Self { client })
1255 }
1256
1257 fn as_channel(&self) -> &::fidl::AsyncChannel {
1258 self.client.as_channel()
1259 }
1260}
1261
1262impl StateControllerProxy {
1263 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1265 let protocol_name = <StateControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1266 Self { client: fidl::client::Client::new(channel, protocol_name) }
1267 }
1268
1269 pub fn take_event_stream(&self) -> StateControllerEventStream {
1275 StateControllerEventStream { event_receiver: self.client.take_event_receiver() }
1276 }
1277
1278 pub fn r#set_system_type(
1283 &self,
1284 mut system_type: SystemType,
1285 ) -> fidl::client::QueryResponseFut<
1286 StateControllerSetSystemTypeResult,
1287 fidl::encoding::DefaultFuchsiaResourceDialect,
1288 > {
1289 StateControllerProxyInterface::r#set_system_type(self, system_type)
1290 }
1291}
1292
1293impl StateControllerProxyInterface for StateControllerProxy {
1294 type SetSystemTypeResponseFut = fidl::client::QueryResponseFut<
1295 StateControllerSetSystemTypeResult,
1296 fidl::encoding::DefaultFuchsiaResourceDialect,
1297 >;
1298 fn r#set_system_type(&self, mut system_type: SystemType) -> Self::SetSystemTypeResponseFut {
1299 fn _decode(
1300 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1301 ) -> Result<StateControllerSetSystemTypeResult, fidl::Error> {
1302 let _response = fidl::client::decode_transaction_body::<
1303 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1304 fidl::encoding::DefaultFuchsiaResourceDialect,
1305 0xa40a1100522d82e,
1306 >(_buf?)?
1307 .into_result::<StateControllerMarker>("set_system_type")?;
1308 Ok(_response.map(|x| x))
1309 }
1310 self.client.send_query_and_decode::<
1311 StateControllerSetSystemTypeRequest,
1312 StateControllerSetSystemTypeResult,
1313 >(
1314 (system_type,),
1315 0xa40a1100522d82e,
1316 fidl::encoding::DynamicFlags::FLEXIBLE,
1317 _decode,
1318 )
1319 }
1320}
1321
1322pub struct StateControllerEventStream {
1323 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1324}
1325
1326impl std::marker::Unpin for StateControllerEventStream {}
1327
1328impl futures::stream::FusedStream for StateControllerEventStream {
1329 fn is_terminated(&self) -> bool {
1330 self.event_receiver.is_terminated()
1331 }
1332}
1333
1334impl futures::Stream for StateControllerEventStream {
1335 type Item = Result<StateControllerEvent, fidl::Error>;
1336
1337 fn poll_next(
1338 mut self: std::pin::Pin<&mut Self>,
1339 cx: &mut std::task::Context<'_>,
1340 ) -> std::task::Poll<Option<Self::Item>> {
1341 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1342 &mut self.event_receiver,
1343 cx
1344 )?) {
1345 Some(buf) => std::task::Poll::Ready(Some(StateControllerEvent::decode(buf))),
1346 None => std::task::Poll::Ready(None),
1347 }
1348 }
1349}
1350
1351#[derive(Debug)]
1352pub enum StateControllerEvent {
1353 #[non_exhaustive]
1354 _UnknownEvent {
1355 ordinal: u64,
1357 },
1358}
1359
1360impl StateControllerEvent {
1361 fn decode(
1363 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1364 ) -> Result<StateControllerEvent, fidl::Error> {
1365 let (bytes, _handles) = buf.split_mut();
1366 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1367 debug_assert_eq!(tx_header.tx_id, 0);
1368 match tx_header.ordinal {
1369 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1370 Ok(StateControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1371 }
1372 _ => Err(fidl::Error::UnknownOrdinal {
1373 ordinal: tx_header.ordinal,
1374 protocol_name:
1375 <StateControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1376 }),
1377 }
1378 }
1379}
1380
1381pub struct StateControllerRequestStream {
1383 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1384 is_terminated: bool,
1385}
1386
1387impl std::marker::Unpin for StateControllerRequestStream {}
1388
1389impl futures::stream::FusedStream for StateControllerRequestStream {
1390 fn is_terminated(&self) -> bool {
1391 self.is_terminated
1392 }
1393}
1394
1395impl fidl::endpoints::RequestStream for StateControllerRequestStream {
1396 type Protocol = StateControllerMarker;
1397 type ControlHandle = StateControllerControlHandle;
1398
1399 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1400 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1401 }
1402
1403 fn control_handle(&self) -> Self::ControlHandle {
1404 StateControllerControlHandle { inner: self.inner.clone() }
1405 }
1406
1407 fn into_inner(
1408 self,
1409 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1410 {
1411 (self.inner, self.is_terminated)
1412 }
1413
1414 fn from_inner(
1415 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1416 is_terminated: bool,
1417 ) -> Self {
1418 Self { inner, is_terminated }
1419 }
1420}
1421
1422impl futures::Stream for StateControllerRequestStream {
1423 type Item = Result<StateControllerRequest, fidl::Error>;
1424
1425 fn poll_next(
1426 mut self: std::pin::Pin<&mut Self>,
1427 cx: &mut std::task::Context<'_>,
1428 ) -> std::task::Poll<Option<Self::Item>> {
1429 let this = &mut *self;
1430 if this.inner.check_shutdown(cx) {
1431 this.is_terminated = true;
1432 return std::task::Poll::Ready(None);
1433 }
1434 if this.is_terminated {
1435 panic!("polled StateControllerRequestStream after completion");
1436 }
1437 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1438 |bytes, handles| {
1439 match this.inner.channel().read_etc(cx, bytes, handles) {
1440 std::task::Poll::Ready(Ok(())) => {}
1441 std::task::Poll::Pending => return std::task::Poll::Pending,
1442 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1443 this.is_terminated = true;
1444 return std::task::Poll::Ready(None);
1445 }
1446 std::task::Poll::Ready(Err(e)) => {
1447 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1448 e.into(),
1449 ))));
1450 }
1451 }
1452
1453 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1455
1456 std::task::Poll::Ready(Some(match header.ordinal {
1457 0xa40a1100522d82e => {
1458 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1459 let mut req = fidl::new_empty!(
1460 StateControllerSetSystemTypeRequest,
1461 fidl::encoding::DefaultFuchsiaResourceDialect
1462 );
1463 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateControllerSetSystemTypeRequest>(&header, _body_bytes, handles, &mut req)?;
1464 let control_handle =
1465 StateControllerControlHandle { inner: this.inner.clone() };
1466 Ok(StateControllerRequest::SetSystemType {
1467 system_type: req.system_type,
1468
1469 responder: StateControllerSetSystemTypeResponder {
1470 control_handle: std::mem::ManuallyDrop::new(control_handle),
1471 tx_id: header.tx_id,
1472 },
1473 })
1474 }
1475 _ if header.tx_id == 0
1476 && header
1477 .dynamic_flags()
1478 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1479 {
1480 Ok(StateControllerRequest::_UnknownMethod {
1481 ordinal: header.ordinal,
1482 control_handle: StateControllerControlHandle {
1483 inner: this.inner.clone(),
1484 },
1485 method_type: fidl::MethodType::OneWay,
1486 })
1487 }
1488 _ if header
1489 .dynamic_flags()
1490 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1491 {
1492 this.inner.send_framework_err(
1493 fidl::encoding::FrameworkErr::UnknownMethod,
1494 header.tx_id,
1495 header.ordinal,
1496 header.dynamic_flags(),
1497 (bytes, handles),
1498 )?;
1499 Ok(StateControllerRequest::_UnknownMethod {
1500 ordinal: header.ordinal,
1501 control_handle: StateControllerControlHandle {
1502 inner: this.inner.clone(),
1503 },
1504 method_type: fidl::MethodType::TwoWay,
1505 })
1506 }
1507 _ => Err(fidl::Error::UnknownOrdinal {
1508 ordinal: header.ordinal,
1509 protocol_name:
1510 <StateControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1511 }),
1512 }))
1513 },
1514 )
1515 }
1516}
1517
1518#[derive(Debug)]
1520pub enum StateControllerRequest {
1521 SetSystemType { system_type: SystemType, responder: StateControllerSetSystemTypeResponder },
1526 #[non_exhaustive]
1528 _UnknownMethod {
1529 ordinal: u64,
1531 control_handle: StateControllerControlHandle,
1532 method_type: fidl::MethodType,
1533 },
1534}
1535
1536impl StateControllerRequest {
1537 #[allow(irrefutable_let_patterns)]
1538 pub fn into_set_system_type(
1539 self,
1540 ) -> Option<(SystemType, StateControllerSetSystemTypeResponder)> {
1541 if let StateControllerRequest::SetSystemType { system_type, responder } = self {
1542 Some((system_type, responder))
1543 } else {
1544 None
1545 }
1546 }
1547
1548 pub fn method_name(&self) -> &'static str {
1550 match *self {
1551 StateControllerRequest::SetSystemType { .. } => "set_system_type",
1552 StateControllerRequest::_UnknownMethod {
1553 method_type: fidl::MethodType::OneWay,
1554 ..
1555 } => "unknown one-way method",
1556 StateControllerRequest::_UnknownMethod {
1557 method_type: fidl::MethodType::TwoWay,
1558 ..
1559 } => "unknown two-way method",
1560 }
1561 }
1562}
1563
1564#[derive(Debug, Clone)]
1565pub struct StateControllerControlHandle {
1566 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1567}
1568
1569impl fidl::endpoints::ControlHandle for StateControllerControlHandle {
1570 fn shutdown(&self) {
1571 self.inner.shutdown()
1572 }
1573
1574 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1575 self.inner.shutdown_with_epitaph(status)
1576 }
1577
1578 fn is_closed(&self) -> bool {
1579 self.inner.channel().is_closed()
1580 }
1581 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1582 self.inner.channel().on_closed()
1583 }
1584
1585 #[cfg(target_os = "fuchsia")]
1586 fn signal_peer(
1587 &self,
1588 clear_mask: zx::Signals,
1589 set_mask: zx::Signals,
1590 ) -> Result<(), zx_status::Status> {
1591 use fidl::Peered;
1592 self.inner.channel().signal_peer(clear_mask, set_mask)
1593 }
1594}
1595
1596impl StateControllerControlHandle {}
1597
1598#[must_use = "FIDL methods require a response to be sent"]
1599#[derive(Debug)]
1600pub struct StateControllerSetSystemTypeResponder {
1601 control_handle: std::mem::ManuallyDrop<StateControllerControlHandle>,
1602 tx_id: u32,
1603}
1604
1605impl std::ops::Drop for StateControllerSetSystemTypeResponder {
1609 fn drop(&mut self) {
1610 self.control_handle.shutdown();
1611 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1613 }
1614}
1615
1616impl fidl::endpoints::Responder for StateControllerSetSystemTypeResponder {
1617 type ControlHandle = StateControllerControlHandle;
1618
1619 fn control_handle(&self) -> &StateControllerControlHandle {
1620 &self.control_handle
1621 }
1622
1623 fn drop_without_shutdown(mut self) {
1624 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1626 std::mem::forget(self);
1628 }
1629}
1630
1631impl StateControllerSetSystemTypeResponder {
1632 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1636 let _result = self.send_raw(result);
1637 if _result.is_err() {
1638 self.control_handle.shutdown();
1639 }
1640 self.drop_without_shutdown();
1641 _result
1642 }
1643
1644 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1646 let _result = self.send_raw(result);
1647 self.drop_without_shutdown();
1648 _result
1649 }
1650
1651 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1652 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1653 fidl::encoding::EmptyStruct,
1654 i32,
1655 >>(
1656 fidl::encoding::FlexibleResult::new(result),
1657 self.tx_id,
1658 0xa40a1100522d82e,
1659 fidl::encoding::DynamicFlags::FLEXIBLE,
1660 )
1661 }
1662}
1663
1664#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1665pub struct UsbAdbImpl_Marker;
1666
1667impl fidl::endpoints::ProtocolMarker for UsbAdbImpl_Marker {
1668 type Proxy = UsbAdbImpl_Proxy;
1669 type RequestStream = UsbAdbImpl_RequestStream;
1670 #[cfg(target_os = "fuchsia")]
1671 type SynchronousProxy = UsbAdbImpl_SynchronousProxy;
1672
1673 const DEBUG_NAME: &'static str = "(anonymous) UsbAdbImpl_";
1674}
1675pub type UsbAdbImplQueueTxResult = Result<(), i32>;
1676pub type UsbAdbImplReceiveResult = Result<Vec<u8>, i32>;
1677
1678pub trait UsbAdbImpl_ProxyInterface: Send + Sync {
1679 type QueueTxResponseFut: std::future::Future<Output = Result<UsbAdbImplQueueTxResult, fidl::Error>>
1680 + Send;
1681 fn r#queue_tx(&self, data: &[u8]) -> Self::QueueTxResponseFut;
1682 type ReceiveResponseFut: std::future::Future<Output = Result<UsbAdbImplReceiveResult, fidl::Error>>
1683 + Send;
1684 fn r#receive(&self) -> Self::ReceiveResponseFut;
1685}
1686#[derive(Debug)]
1687#[cfg(target_os = "fuchsia")]
1688pub struct UsbAdbImpl_SynchronousProxy {
1689 client: fidl::client::sync::Client,
1690}
1691
1692#[cfg(target_os = "fuchsia")]
1693impl fidl::endpoints::SynchronousProxy for UsbAdbImpl_SynchronousProxy {
1694 type Proxy = UsbAdbImpl_Proxy;
1695 type Protocol = UsbAdbImpl_Marker;
1696
1697 fn from_channel(inner: fidl::Channel) -> Self {
1698 Self::new(inner)
1699 }
1700
1701 fn into_channel(self) -> fidl::Channel {
1702 self.client.into_channel()
1703 }
1704
1705 fn as_channel(&self) -> &fidl::Channel {
1706 self.client.as_channel()
1707 }
1708}
1709
1710#[cfg(target_os = "fuchsia")]
1711impl UsbAdbImpl_SynchronousProxy {
1712 pub fn new(channel: fidl::Channel) -> Self {
1713 Self { client: fidl::client::sync::Client::new(channel) }
1714 }
1715
1716 pub fn into_channel(self) -> fidl::Channel {
1717 self.client.into_channel()
1718 }
1719
1720 pub fn wait_for_event(
1723 &self,
1724 deadline: zx::MonotonicInstant,
1725 ) -> Result<UsbAdbImpl_Event, fidl::Error> {
1726 UsbAdbImpl_Event::decode(self.client.wait_for_event::<UsbAdbImpl_Marker>(deadline)?)
1727 }
1728
1729 pub fn r#queue_tx(
1737 &self,
1738 mut data: &[u8],
1739 ___deadline: zx::MonotonicInstant,
1740 ) -> Result<UsbAdbImplQueueTxResult, fidl::Error> {
1741 let _response = self.client.send_query::<
1742 UsbAdbImplQueueTxRequest,
1743 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1744 UsbAdbImpl_Marker,
1745 >(
1746 (data,),
1747 0x4c0af0efa9701dc9,
1748 fidl::encoding::DynamicFlags::empty(),
1749 ___deadline,
1750 )?;
1751 Ok(_response.map(|x| x))
1752 }
1753
1754 pub fn r#receive(
1764 &self,
1765 ___deadline: zx::MonotonicInstant,
1766 ) -> Result<UsbAdbImplReceiveResult, fidl::Error> {
1767 let _response = self.client.send_query::<
1768 fidl::encoding::EmptyPayload,
1769 fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>,
1770 UsbAdbImpl_Marker,
1771 >(
1772 (),
1773 0x68382fff953be5c4,
1774 fidl::encoding::DynamicFlags::empty(),
1775 ___deadline,
1776 )?;
1777 Ok(_response.map(|x| x.data))
1778 }
1779}
1780
1781#[cfg(target_os = "fuchsia")]
1782impl From<UsbAdbImpl_SynchronousProxy> for zx::NullableHandle {
1783 fn from(value: UsbAdbImpl_SynchronousProxy) -> Self {
1784 value.into_channel().into()
1785 }
1786}
1787
1788#[cfg(target_os = "fuchsia")]
1789impl From<fidl::Channel> for UsbAdbImpl_SynchronousProxy {
1790 fn from(value: fidl::Channel) -> Self {
1791 Self::new(value)
1792 }
1793}
1794
1795#[cfg(target_os = "fuchsia")]
1796impl fidl::endpoints::FromClient for UsbAdbImpl_SynchronousProxy {
1797 type Protocol = UsbAdbImpl_Marker;
1798
1799 fn from_client(value: fidl::endpoints::ClientEnd<UsbAdbImpl_Marker>) -> Self {
1800 Self::new(value.into_channel())
1801 }
1802}
1803
1804#[derive(Debug, Clone)]
1805pub struct UsbAdbImpl_Proxy {
1806 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1807}
1808
1809impl fidl::endpoints::Proxy for UsbAdbImpl_Proxy {
1810 type Protocol = UsbAdbImpl_Marker;
1811
1812 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1813 Self::new(inner)
1814 }
1815
1816 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1817 self.client.into_channel().map_err(|client| Self { client })
1818 }
1819
1820 fn as_channel(&self) -> &::fidl::AsyncChannel {
1821 self.client.as_channel()
1822 }
1823}
1824
1825impl UsbAdbImpl_Proxy {
1826 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1828 let protocol_name = <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1829 Self { client: fidl::client::Client::new(channel, protocol_name) }
1830 }
1831
1832 pub fn take_event_stream(&self) -> UsbAdbImpl_EventStream {
1838 UsbAdbImpl_EventStream { event_receiver: self.client.take_event_receiver() }
1839 }
1840
1841 pub fn r#queue_tx(
1849 &self,
1850 mut data: &[u8],
1851 ) -> fidl::client::QueryResponseFut<
1852 UsbAdbImplQueueTxResult,
1853 fidl::encoding::DefaultFuchsiaResourceDialect,
1854 > {
1855 UsbAdbImpl_ProxyInterface::r#queue_tx(self, data)
1856 }
1857
1858 pub fn r#receive(
1868 &self,
1869 ) -> fidl::client::QueryResponseFut<
1870 UsbAdbImplReceiveResult,
1871 fidl::encoding::DefaultFuchsiaResourceDialect,
1872 > {
1873 UsbAdbImpl_ProxyInterface::r#receive(self)
1874 }
1875}
1876
1877impl UsbAdbImpl_ProxyInterface for UsbAdbImpl_Proxy {
1878 type QueueTxResponseFut = fidl::client::QueryResponseFut<
1879 UsbAdbImplQueueTxResult,
1880 fidl::encoding::DefaultFuchsiaResourceDialect,
1881 >;
1882 fn r#queue_tx(&self, mut data: &[u8]) -> Self::QueueTxResponseFut {
1883 fn _decode(
1884 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1885 ) -> Result<UsbAdbImplQueueTxResult, fidl::Error> {
1886 let _response = fidl::client::decode_transaction_body::<
1887 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1888 fidl::encoding::DefaultFuchsiaResourceDialect,
1889 0x4c0af0efa9701dc9,
1890 >(_buf?)?;
1891 Ok(_response.map(|x| x))
1892 }
1893 self.client.send_query_and_decode::<UsbAdbImplQueueTxRequest, UsbAdbImplQueueTxResult>(
1894 (data,),
1895 0x4c0af0efa9701dc9,
1896 fidl::encoding::DynamicFlags::empty(),
1897 _decode,
1898 )
1899 }
1900
1901 type ReceiveResponseFut = fidl::client::QueryResponseFut<
1902 UsbAdbImplReceiveResult,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 >;
1905 fn r#receive(&self) -> Self::ReceiveResponseFut {
1906 fn _decode(
1907 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1908 ) -> Result<UsbAdbImplReceiveResult, fidl::Error> {
1909 let _response = fidl::client::decode_transaction_body::<
1910 fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>,
1911 fidl::encoding::DefaultFuchsiaResourceDialect,
1912 0x68382fff953be5c4,
1913 >(_buf?)?;
1914 Ok(_response.map(|x| x.data))
1915 }
1916 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, UsbAdbImplReceiveResult>(
1917 (),
1918 0x68382fff953be5c4,
1919 fidl::encoding::DynamicFlags::empty(),
1920 _decode,
1921 )
1922 }
1923}
1924
1925pub struct UsbAdbImpl_EventStream {
1926 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1927}
1928
1929impl std::marker::Unpin for UsbAdbImpl_EventStream {}
1930
1931impl futures::stream::FusedStream for UsbAdbImpl_EventStream {
1932 fn is_terminated(&self) -> bool {
1933 self.event_receiver.is_terminated()
1934 }
1935}
1936
1937impl futures::Stream for UsbAdbImpl_EventStream {
1938 type Item = Result<UsbAdbImpl_Event, fidl::Error>;
1939
1940 fn poll_next(
1941 mut self: std::pin::Pin<&mut Self>,
1942 cx: &mut std::task::Context<'_>,
1943 ) -> std::task::Poll<Option<Self::Item>> {
1944 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1945 &mut self.event_receiver,
1946 cx
1947 )?) {
1948 Some(buf) => std::task::Poll::Ready(Some(UsbAdbImpl_Event::decode(buf))),
1949 None => std::task::Poll::Ready(None),
1950 }
1951 }
1952}
1953
1954#[derive(Debug)]
1955pub enum UsbAdbImpl_Event {
1956 OnStatusChanged { status: StatusFlags },
1957}
1958
1959impl UsbAdbImpl_Event {
1960 #[allow(irrefutable_let_patterns)]
1961 pub fn into_on_status_changed(self) -> Option<StatusFlags> {
1962 if let UsbAdbImpl_Event::OnStatusChanged { status } = self { Some((status)) } else { None }
1963 }
1964
1965 fn decode(
1967 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1968 ) -> Result<UsbAdbImpl_Event, fidl::Error> {
1969 let (bytes, _handles) = buf.split_mut();
1970 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1971 debug_assert_eq!(tx_header.tx_id, 0);
1972 match tx_header.ordinal {
1973 0x2f2926086c0a5b6e => {
1974 let mut out = fidl::new_empty!(
1975 UsbAdbImplOnStatusChangedRequest,
1976 fidl::encoding::DefaultFuchsiaResourceDialect
1977 );
1978 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbAdbImplOnStatusChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1979 Ok((UsbAdbImpl_Event::OnStatusChanged { status: out.status }))
1980 }
1981 _ => Err(fidl::Error::UnknownOrdinal {
1982 ordinal: tx_header.ordinal,
1983 protocol_name: <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1984 }),
1985 }
1986 }
1987}
1988
1989pub struct UsbAdbImpl_RequestStream {
1991 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1992 is_terminated: bool,
1993}
1994
1995impl std::marker::Unpin for UsbAdbImpl_RequestStream {}
1996
1997impl futures::stream::FusedStream for UsbAdbImpl_RequestStream {
1998 fn is_terminated(&self) -> bool {
1999 self.is_terminated
2000 }
2001}
2002
2003impl fidl::endpoints::RequestStream for UsbAdbImpl_RequestStream {
2004 type Protocol = UsbAdbImpl_Marker;
2005 type ControlHandle = UsbAdbImpl_ControlHandle;
2006
2007 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2008 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2009 }
2010
2011 fn control_handle(&self) -> Self::ControlHandle {
2012 UsbAdbImpl_ControlHandle { inner: self.inner.clone() }
2013 }
2014
2015 fn into_inner(
2016 self,
2017 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2018 {
2019 (self.inner, self.is_terminated)
2020 }
2021
2022 fn from_inner(
2023 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2024 is_terminated: bool,
2025 ) -> Self {
2026 Self { inner, is_terminated }
2027 }
2028}
2029
2030impl futures::Stream for UsbAdbImpl_RequestStream {
2031 type Item = Result<UsbAdbImpl_Request, fidl::Error>;
2032
2033 fn poll_next(
2034 mut self: std::pin::Pin<&mut Self>,
2035 cx: &mut std::task::Context<'_>,
2036 ) -> std::task::Poll<Option<Self::Item>> {
2037 let this = &mut *self;
2038 if this.inner.check_shutdown(cx) {
2039 this.is_terminated = true;
2040 return std::task::Poll::Ready(None);
2041 }
2042 if this.is_terminated {
2043 panic!("polled UsbAdbImpl_RequestStream after completion");
2044 }
2045 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2046 |bytes, handles| {
2047 match this.inner.channel().read_etc(cx, bytes, handles) {
2048 std::task::Poll::Ready(Ok(())) => {}
2049 std::task::Poll::Pending => return std::task::Poll::Pending,
2050 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2051 this.is_terminated = true;
2052 return std::task::Poll::Ready(None);
2053 }
2054 std::task::Poll::Ready(Err(e)) => {
2055 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2056 e.into(),
2057 ))));
2058 }
2059 }
2060
2061 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2063
2064 std::task::Poll::Ready(Some(match header.ordinal {
2065 0x4c0af0efa9701dc9 => {
2066 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2067 let mut req = fidl::new_empty!(
2068 UsbAdbImplQueueTxRequest,
2069 fidl::encoding::DefaultFuchsiaResourceDialect
2070 );
2071 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbAdbImplQueueTxRequest>(&header, _body_bytes, handles, &mut req)?;
2072 let control_handle = UsbAdbImpl_ControlHandle { inner: this.inner.clone() };
2073 Ok(UsbAdbImpl_Request::QueueTx {
2074 data: req.data,
2075
2076 responder: UsbAdbImpl_QueueTxResponder {
2077 control_handle: std::mem::ManuallyDrop::new(control_handle),
2078 tx_id: header.tx_id,
2079 },
2080 })
2081 }
2082 0x68382fff953be5c4 => {
2083 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2084 let mut req = fidl::new_empty!(
2085 fidl::encoding::EmptyPayload,
2086 fidl::encoding::DefaultFuchsiaResourceDialect
2087 );
2088 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2089 let control_handle = UsbAdbImpl_ControlHandle { inner: this.inner.clone() };
2090 Ok(UsbAdbImpl_Request::Receive {
2091 responder: UsbAdbImpl_ReceiveResponder {
2092 control_handle: std::mem::ManuallyDrop::new(control_handle),
2093 tx_id: header.tx_id,
2094 },
2095 })
2096 }
2097 _ => Err(fidl::Error::UnknownOrdinal {
2098 ordinal: header.ordinal,
2099 protocol_name:
2100 <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2101 }),
2102 }))
2103 },
2104 )
2105 }
2106}
2107
2108#[derive(Debug)]
2111pub enum UsbAdbImpl_Request {
2112 QueueTx { data: Vec<u8>, responder: UsbAdbImpl_QueueTxResponder },
2120 Receive { responder: UsbAdbImpl_ReceiveResponder },
2130}
2131
2132impl UsbAdbImpl_Request {
2133 #[allow(irrefutable_let_patterns)]
2134 pub fn into_queue_tx(self) -> Option<(Vec<u8>, UsbAdbImpl_QueueTxResponder)> {
2135 if let UsbAdbImpl_Request::QueueTx { data, responder } = self {
2136 Some((data, responder))
2137 } else {
2138 None
2139 }
2140 }
2141
2142 #[allow(irrefutable_let_patterns)]
2143 pub fn into_receive(self) -> Option<(UsbAdbImpl_ReceiveResponder)> {
2144 if let UsbAdbImpl_Request::Receive { responder } = self { Some((responder)) } else { None }
2145 }
2146
2147 pub fn method_name(&self) -> &'static str {
2149 match *self {
2150 UsbAdbImpl_Request::QueueTx { .. } => "queue_tx",
2151 UsbAdbImpl_Request::Receive { .. } => "receive",
2152 }
2153 }
2154}
2155
2156#[derive(Debug, Clone)]
2157pub struct UsbAdbImpl_ControlHandle {
2158 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2159}
2160
2161impl fidl::endpoints::ControlHandle for UsbAdbImpl_ControlHandle {
2162 fn shutdown(&self) {
2163 self.inner.shutdown()
2164 }
2165
2166 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2167 self.inner.shutdown_with_epitaph(status)
2168 }
2169
2170 fn is_closed(&self) -> bool {
2171 self.inner.channel().is_closed()
2172 }
2173 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2174 self.inner.channel().on_closed()
2175 }
2176
2177 #[cfg(target_os = "fuchsia")]
2178 fn signal_peer(
2179 &self,
2180 clear_mask: zx::Signals,
2181 set_mask: zx::Signals,
2182 ) -> Result<(), zx_status::Status> {
2183 use fidl::Peered;
2184 self.inner.channel().signal_peer(clear_mask, set_mask)
2185 }
2186}
2187
2188impl UsbAdbImpl_ControlHandle {
2189 pub fn send_on_status_changed(&self, mut status: StatusFlags) -> Result<(), fidl::Error> {
2190 self.inner.send::<UsbAdbImplOnStatusChangedRequest>(
2191 (status,),
2192 0,
2193 0x2f2926086c0a5b6e,
2194 fidl::encoding::DynamicFlags::empty(),
2195 )
2196 }
2197}
2198
2199#[must_use = "FIDL methods require a response to be sent"]
2200#[derive(Debug)]
2201pub struct UsbAdbImpl_QueueTxResponder {
2202 control_handle: std::mem::ManuallyDrop<UsbAdbImpl_ControlHandle>,
2203 tx_id: u32,
2204}
2205
2206impl std::ops::Drop for UsbAdbImpl_QueueTxResponder {
2210 fn drop(&mut self) {
2211 self.control_handle.shutdown();
2212 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2214 }
2215}
2216
2217impl fidl::endpoints::Responder for UsbAdbImpl_QueueTxResponder {
2218 type ControlHandle = UsbAdbImpl_ControlHandle;
2219
2220 fn control_handle(&self) -> &UsbAdbImpl_ControlHandle {
2221 &self.control_handle
2222 }
2223
2224 fn drop_without_shutdown(mut self) {
2225 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2227 std::mem::forget(self);
2229 }
2230}
2231
2232impl UsbAdbImpl_QueueTxResponder {
2233 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2237 let _result = self.send_raw(result);
2238 if _result.is_err() {
2239 self.control_handle.shutdown();
2240 }
2241 self.drop_without_shutdown();
2242 _result
2243 }
2244
2245 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2247 let _result = self.send_raw(result);
2248 self.drop_without_shutdown();
2249 _result
2250 }
2251
2252 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2253 self.control_handle
2254 .inner
2255 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2256 result,
2257 self.tx_id,
2258 0x4c0af0efa9701dc9,
2259 fidl::encoding::DynamicFlags::empty(),
2260 )
2261 }
2262}
2263
2264#[must_use = "FIDL methods require a response to be sent"]
2265#[derive(Debug)]
2266pub struct UsbAdbImpl_ReceiveResponder {
2267 control_handle: std::mem::ManuallyDrop<UsbAdbImpl_ControlHandle>,
2268 tx_id: u32,
2269}
2270
2271impl std::ops::Drop for UsbAdbImpl_ReceiveResponder {
2275 fn drop(&mut self) {
2276 self.control_handle.shutdown();
2277 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2279 }
2280}
2281
2282impl fidl::endpoints::Responder for UsbAdbImpl_ReceiveResponder {
2283 type ControlHandle = UsbAdbImpl_ControlHandle;
2284
2285 fn control_handle(&self) -> &UsbAdbImpl_ControlHandle {
2286 &self.control_handle
2287 }
2288
2289 fn drop_without_shutdown(mut self) {
2290 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2292 std::mem::forget(self);
2294 }
2295}
2296
2297impl UsbAdbImpl_ReceiveResponder {
2298 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2302 let _result = self.send_raw(result);
2303 if _result.is_err() {
2304 self.control_handle.shutdown();
2305 }
2306 self.drop_without_shutdown();
2307 _result
2308 }
2309
2310 pub fn send_no_shutdown_on_err(
2312 self,
2313 mut result: Result<&[u8], i32>,
2314 ) -> Result<(), fidl::Error> {
2315 let _result = self.send_raw(result);
2316 self.drop_without_shutdown();
2317 _result
2318 }
2319
2320 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2321 self.control_handle
2322 .inner
2323 .send::<fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>>(
2324 result.map(|data| (data,)),
2325 self.tx_id,
2326 0x68382fff953be5c4,
2327 fidl::encoding::DynamicFlags::empty(),
2328 )
2329 }
2330}
2331
2332#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2333pub struct ServiceMarker;
2334
2335#[cfg(target_os = "fuchsia")]
2336impl fidl::endpoints::ServiceMarker for ServiceMarker {
2337 type Proxy = ServiceProxy;
2338 type Request = ServiceRequest;
2339 const SERVICE_NAME: &'static str = "fuchsia.hardware.adb.Service";
2340}
2341
2342#[cfg(target_os = "fuchsia")]
2345pub enum ServiceRequest {
2346 Adb(DeviceRequestStream),
2347}
2348
2349#[cfg(target_os = "fuchsia")]
2350impl fidl::endpoints::ServiceRequest for ServiceRequest {
2351 type Service = ServiceMarker;
2352
2353 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2354 match name {
2355 "adb" => Self::Adb(
2356 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2357 ),
2358 _ => panic!("no such member protocol name for service Service"),
2359 }
2360 }
2361
2362 fn member_names() -> &'static [&'static str] {
2363 &["adb"]
2364 }
2365}
2366#[cfg(target_os = "fuchsia")]
2367pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2368
2369#[cfg(target_os = "fuchsia")]
2370impl fidl::endpoints::ServiceProxy for ServiceProxy {
2371 type Service = ServiceMarker;
2372
2373 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2374 Self(opener)
2375 }
2376}
2377
2378#[cfg(target_os = "fuchsia")]
2379impl ServiceProxy {
2380 pub fn connect_to_adb(&self) -> Result<DeviceProxy, fidl::Error> {
2381 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2382 self.connect_channel_to_adb(server_end)?;
2383 Ok(proxy)
2384 }
2385
2386 pub fn connect_to_adb_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2389 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2390 self.connect_channel_to_adb(server_end)?;
2391 Ok(proxy)
2392 }
2393
2394 pub fn connect_channel_to_adb(
2397 &self,
2398 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2399 ) -> Result<(), fidl::Error> {
2400 self.0.open_member("adb", server_end.into_channel())
2401 }
2402
2403 pub fn instance_name(&self) -> &str {
2404 self.0.instance_name()
2405 }
2406}
2407
2408mod internal {
2409 use super::*;
2410
2411 impl fidl::encoding::ResourceTypeMarker for DeviceStartAdbRequest {
2412 type Borrowed<'a> = &'a mut Self;
2413 fn take_or_borrow<'a>(
2414 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2415 ) -> Self::Borrowed<'a> {
2416 value
2417 }
2418 }
2419
2420 unsafe impl fidl::encoding::TypeMarker for DeviceStartAdbRequest {
2421 type Owned = Self;
2422
2423 #[inline(always)]
2424 fn inline_align(_context: fidl::encoding::Context) -> usize {
2425 4
2426 }
2427
2428 #[inline(always)]
2429 fn inline_size(_context: fidl::encoding::Context) -> usize {
2430 4
2431 }
2432 }
2433
2434 unsafe impl
2435 fidl::encoding::Encode<DeviceStartAdbRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2436 for &mut DeviceStartAdbRequest
2437 {
2438 #[inline]
2439 unsafe fn encode(
2440 self,
2441 encoder: &mut fidl::encoding::Encoder<
2442 '_,
2443 fidl::encoding::DefaultFuchsiaResourceDialect,
2444 >,
2445 offset: usize,
2446 _depth: fidl::encoding::Depth,
2447 ) -> fidl::Result<()> {
2448 encoder.debug_check_bounds::<DeviceStartAdbRequest>(offset);
2449 fidl::encoding::Encode::<DeviceStartAdbRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2451 (
2452 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
2453 ),
2454 encoder, offset, _depth
2455 )
2456 }
2457 }
2458 unsafe impl<
2459 T0: fidl::encoding::Encode<
2460 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
2461 fidl::encoding::DefaultFuchsiaResourceDialect,
2462 >,
2463 >
2464 fidl::encoding::Encode<DeviceStartAdbRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2465 for (T0,)
2466 {
2467 #[inline]
2468 unsafe fn encode(
2469 self,
2470 encoder: &mut fidl::encoding::Encoder<
2471 '_,
2472 fidl::encoding::DefaultFuchsiaResourceDialect,
2473 >,
2474 offset: usize,
2475 depth: fidl::encoding::Depth,
2476 ) -> fidl::Result<()> {
2477 encoder.debug_check_bounds::<DeviceStartAdbRequest>(offset);
2478 self.0.encode(encoder, offset + 0, depth)?;
2482 Ok(())
2483 }
2484 }
2485
2486 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2487 for DeviceStartAdbRequest
2488 {
2489 #[inline(always)]
2490 fn new_empty() -> Self {
2491 Self {
2492 interface: fidl::new_empty!(
2493 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
2494 fidl::encoding::DefaultFuchsiaResourceDialect
2495 ),
2496 }
2497 }
2498
2499 #[inline]
2500 unsafe fn decode(
2501 &mut self,
2502 decoder: &mut fidl::encoding::Decoder<
2503 '_,
2504 fidl::encoding::DefaultFuchsiaResourceDialect,
2505 >,
2506 offset: usize,
2507 _depth: fidl::encoding::Depth,
2508 ) -> fidl::Result<()> {
2509 decoder.debug_check_bounds::<Self>(offset);
2510 fidl::decode!(
2512 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
2513 fidl::encoding::DefaultFuchsiaResourceDialect,
2514 &mut self.interface,
2515 decoder,
2516 offset + 0,
2517 _depth
2518 )?;
2519 Ok(())
2520 }
2521 }
2522
2523 impl fidl::encoding::ResourceTypeMarker for ProviderConnectToServiceRequest {
2524 type Borrowed<'a> = &'a mut Self;
2525 fn take_or_borrow<'a>(
2526 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2527 ) -> Self::Borrowed<'a> {
2528 value
2529 }
2530 }
2531
2532 unsafe impl fidl::encoding::TypeMarker for ProviderConnectToServiceRequest {
2533 type Owned = Self;
2534
2535 #[inline(always)]
2536 fn inline_align(_context: fidl::encoding::Context) -> usize {
2537 8
2538 }
2539
2540 #[inline(always)]
2541 fn inline_size(_context: fidl::encoding::Context) -> usize {
2542 24
2543 }
2544 }
2545
2546 unsafe impl
2547 fidl::encoding::Encode<
2548 ProviderConnectToServiceRequest,
2549 fidl::encoding::DefaultFuchsiaResourceDialect,
2550 > for &mut ProviderConnectToServiceRequest
2551 {
2552 #[inline]
2553 unsafe fn encode(
2554 self,
2555 encoder: &mut fidl::encoding::Encoder<
2556 '_,
2557 fidl::encoding::DefaultFuchsiaResourceDialect,
2558 >,
2559 offset: usize,
2560 _depth: fidl::encoding::Depth,
2561 ) -> fidl::Result<()> {
2562 encoder.debug_check_bounds::<ProviderConnectToServiceRequest>(offset);
2563 fidl::encoding::Encode::<ProviderConnectToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2565 (
2566 <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
2567 <fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.args),
2568 ),
2569 encoder, offset, _depth
2570 )
2571 }
2572 }
2573 unsafe impl<
2574 T0: fidl::encoding::Encode<
2575 fidl::encoding::HandleType<
2576 fidl::Socket,
2577 { fidl::ObjectType::SOCKET.into_raw() },
2578 2147483648,
2579 >,
2580 fidl::encoding::DefaultFuchsiaResourceDialect,
2581 >,
2582 T1: fidl::encoding::Encode<
2583 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2584 fidl::encoding::DefaultFuchsiaResourceDialect,
2585 >,
2586 >
2587 fidl::encoding::Encode<
2588 ProviderConnectToServiceRequest,
2589 fidl::encoding::DefaultFuchsiaResourceDialect,
2590 > for (T0, T1)
2591 {
2592 #[inline]
2593 unsafe fn encode(
2594 self,
2595 encoder: &mut fidl::encoding::Encoder<
2596 '_,
2597 fidl::encoding::DefaultFuchsiaResourceDialect,
2598 >,
2599 offset: usize,
2600 depth: fidl::encoding::Depth,
2601 ) -> fidl::Result<()> {
2602 encoder.debug_check_bounds::<ProviderConnectToServiceRequest>(offset);
2603 unsafe {
2606 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2607 (ptr as *mut u64).write_unaligned(0);
2608 }
2609 self.0.encode(encoder, offset + 0, depth)?;
2611 self.1.encode(encoder, offset + 8, depth)?;
2612 Ok(())
2613 }
2614 }
2615
2616 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2617 for ProviderConnectToServiceRequest
2618 {
2619 #[inline(always)]
2620 fn new_empty() -> Self {
2621 Self {
2622 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2623 args: fidl::new_empty!(
2624 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2625 fidl::encoding::DefaultFuchsiaResourceDialect
2626 ),
2627 }
2628 }
2629
2630 #[inline]
2631 unsafe fn decode(
2632 &mut self,
2633 decoder: &mut fidl::encoding::Decoder<
2634 '_,
2635 fidl::encoding::DefaultFuchsiaResourceDialect,
2636 >,
2637 offset: usize,
2638 _depth: fidl::encoding::Depth,
2639 ) -> fidl::Result<()> {
2640 decoder.debug_check_bounds::<Self>(offset);
2641 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2643 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2644 let mask = 0xffffffff00000000u64;
2645 let maskedval = padval & mask;
2646 if maskedval != 0 {
2647 return Err(fidl::Error::NonZeroPadding {
2648 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2649 });
2650 }
2651 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
2652 fidl::decode!(
2653 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2654 fidl::encoding::DefaultFuchsiaResourceDialect,
2655 &mut self.args,
2656 decoder,
2657 offset + 8,
2658 _depth
2659 )?;
2660 Ok(())
2661 }
2662 }
2663}