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 DeviceControlHandle {
484 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
485 self.inner.shutdown_with_epitaph(status.into())
486 }
487}
488
489impl fidl::endpoints::ControlHandle for DeviceControlHandle {
490 fn shutdown(&self) {
491 self.inner.shutdown()
492 }
493
494 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
495 self.inner.shutdown_with_epitaph(status)
496 }
497
498 fn is_closed(&self) -> bool {
499 self.inner.channel().is_closed()
500 }
501 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
502 self.inner.channel().on_closed()
503 }
504
505 #[cfg(target_os = "fuchsia")]
506 fn signal_peer(
507 &self,
508 clear_mask: zx::Signals,
509 set_mask: zx::Signals,
510 ) -> Result<(), zx_status::Status> {
511 use fidl::Peered;
512 self.inner.channel().signal_peer(clear_mask, set_mask)
513 }
514}
515
516impl DeviceControlHandle {}
517
518#[must_use = "FIDL methods require a response to be sent"]
519#[derive(Debug)]
520pub struct DeviceStartAdbResponder {
521 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
522 tx_id: u32,
523}
524
525impl std::ops::Drop for DeviceStartAdbResponder {
529 fn drop(&mut self) {
530 self.control_handle.shutdown();
531 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
533 }
534}
535
536impl fidl::endpoints::Responder for DeviceStartAdbResponder {
537 type ControlHandle = DeviceControlHandle;
538
539 fn control_handle(&self) -> &DeviceControlHandle {
540 &self.control_handle
541 }
542
543 fn drop_without_shutdown(mut self) {
544 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
546 std::mem::forget(self);
548 }
549}
550
551impl DeviceStartAdbResponder {
552 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
556 let _result = self.send_raw(result);
557 if _result.is_err() {
558 self.control_handle.shutdown();
559 }
560 self.drop_without_shutdown();
561 _result
562 }
563
564 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
566 let _result = self.send_raw(result);
567 self.drop_without_shutdown();
568 _result
569 }
570
571 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
572 self.control_handle
573 .inner
574 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
575 result,
576 self.tx_id,
577 0x286c2e31de2159a5,
578 fidl::encoding::DynamicFlags::empty(),
579 )
580 }
581}
582
583#[must_use = "FIDL methods require a response to be sent"]
584#[derive(Debug)]
585pub struct DeviceStopAdbResponder {
586 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
587 tx_id: u32,
588}
589
590impl std::ops::Drop for DeviceStopAdbResponder {
594 fn drop(&mut self) {
595 self.control_handle.shutdown();
596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
598 }
599}
600
601impl fidl::endpoints::Responder for DeviceStopAdbResponder {
602 type ControlHandle = DeviceControlHandle;
603
604 fn control_handle(&self) -> &DeviceControlHandle {
605 &self.control_handle
606 }
607
608 fn drop_without_shutdown(mut self) {
609 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
611 std::mem::forget(self);
613 }
614}
615
616impl DeviceStopAdbResponder {
617 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
621 let _result = self.send_raw(result);
622 if _result.is_err() {
623 self.control_handle.shutdown();
624 }
625 self.drop_without_shutdown();
626 _result
627 }
628
629 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
631 let _result = self.send_raw(result);
632 self.drop_without_shutdown();
633 _result
634 }
635
636 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
637 self.control_handle
638 .inner
639 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
640 result,
641 self.tx_id,
642 0x6d7d1816750fd3d0,
643 fidl::encoding::DynamicFlags::empty(),
644 )
645 }
646}
647
648#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
649pub struct ProviderMarker;
650
651impl fidl::endpoints::ProtocolMarker for ProviderMarker {
652 type Proxy = ProviderProxy;
653 type RequestStream = ProviderRequestStream;
654 #[cfg(target_os = "fuchsia")]
655 type SynchronousProxy = ProviderSynchronousProxy;
656
657 const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.Provider";
658}
659impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
660pub type ProviderConnectToServiceResult = Result<(), i32>;
661
662pub trait ProviderProxyInterface: Send + Sync {
663 type ConnectToServiceResponseFut: std::future::Future<Output = Result<ProviderConnectToServiceResult, fidl::Error>>
664 + Send;
665 fn r#connect_to_service(
666 &self,
667 socket: fidl::Socket,
668 args: Option<&str>,
669 ) -> Self::ConnectToServiceResponseFut;
670}
671#[derive(Debug)]
672#[cfg(target_os = "fuchsia")]
673pub struct ProviderSynchronousProxy {
674 client: fidl::client::sync::Client,
675}
676
677#[cfg(target_os = "fuchsia")]
678impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
679 type Proxy = ProviderProxy;
680 type Protocol = ProviderMarker;
681
682 fn from_channel(inner: fidl::Channel) -> Self {
683 Self::new(inner)
684 }
685
686 fn into_channel(self) -> fidl::Channel {
687 self.client.into_channel()
688 }
689
690 fn as_channel(&self) -> &fidl::Channel {
691 self.client.as_channel()
692 }
693}
694
695#[cfg(target_os = "fuchsia")]
696impl ProviderSynchronousProxy {
697 pub fn new(channel: fidl::Channel) -> Self {
698 Self { client: fidl::client::sync::Client::new(channel) }
699 }
700
701 pub fn into_channel(self) -> fidl::Channel {
702 self.client.into_channel()
703 }
704
705 pub fn wait_for_event(
708 &self,
709 deadline: zx::MonotonicInstant,
710 ) -> Result<ProviderEvent, fidl::Error> {
711 ProviderEvent::decode(self.client.wait_for_event::<ProviderMarker>(deadline)?)
712 }
713
714 pub fn r#connect_to_service(
717 &self,
718 mut socket: fidl::Socket,
719 mut args: Option<&str>,
720 ___deadline: zx::MonotonicInstant,
721 ) -> Result<ProviderConnectToServiceResult, fidl::Error> {
722 let _response = self.client.send_query::<
723 ProviderConnectToServiceRequest,
724 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
725 ProviderMarker,
726 >(
727 (socket, args,),
728 0x303e4a312d85292b,
729 fidl::encoding::DynamicFlags::empty(),
730 ___deadline,
731 )?;
732 Ok(_response.map(|x| x))
733 }
734}
735
736#[cfg(target_os = "fuchsia")]
737impl From<ProviderSynchronousProxy> for zx::NullableHandle {
738 fn from(value: ProviderSynchronousProxy) -> Self {
739 value.into_channel().into()
740 }
741}
742
743#[cfg(target_os = "fuchsia")]
744impl From<fidl::Channel> for ProviderSynchronousProxy {
745 fn from(value: fidl::Channel) -> Self {
746 Self::new(value)
747 }
748}
749
750#[cfg(target_os = "fuchsia")]
751impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
752 type Protocol = ProviderMarker;
753
754 fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
755 Self::new(value.into_channel())
756 }
757}
758
759#[derive(Debug, Clone)]
760pub struct ProviderProxy {
761 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
762}
763
764impl fidl::endpoints::Proxy for ProviderProxy {
765 type Protocol = ProviderMarker;
766
767 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
768 Self::new(inner)
769 }
770
771 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
772 self.client.into_channel().map_err(|client| Self { client })
773 }
774
775 fn as_channel(&self) -> &::fidl::AsyncChannel {
776 self.client.as_channel()
777 }
778}
779
780impl ProviderProxy {
781 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
783 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
784 Self { client: fidl::client::Client::new(channel, protocol_name) }
785 }
786
787 pub fn take_event_stream(&self) -> ProviderEventStream {
793 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
794 }
795
796 pub fn r#connect_to_service(
799 &self,
800 mut socket: fidl::Socket,
801 mut args: Option<&str>,
802 ) -> fidl::client::QueryResponseFut<
803 ProviderConnectToServiceResult,
804 fidl::encoding::DefaultFuchsiaResourceDialect,
805 > {
806 ProviderProxyInterface::r#connect_to_service(self, socket, args)
807 }
808}
809
810impl ProviderProxyInterface for ProviderProxy {
811 type ConnectToServiceResponseFut = fidl::client::QueryResponseFut<
812 ProviderConnectToServiceResult,
813 fidl::encoding::DefaultFuchsiaResourceDialect,
814 >;
815 fn r#connect_to_service(
816 &self,
817 mut socket: fidl::Socket,
818 mut args: Option<&str>,
819 ) -> Self::ConnectToServiceResponseFut {
820 fn _decode(
821 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
822 ) -> Result<ProviderConnectToServiceResult, fidl::Error> {
823 let _response = fidl::client::decode_transaction_body::<
824 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
825 fidl::encoding::DefaultFuchsiaResourceDialect,
826 0x303e4a312d85292b,
827 >(_buf?)?;
828 Ok(_response.map(|x| x))
829 }
830 self.client.send_query_and_decode::<
831 ProviderConnectToServiceRequest,
832 ProviderConnectToServiceResult,
833 >(
834 (socket, args,),
835 0x303e4a312d85292b,
836 fidl::encoding::DynamicFlags::empty(),
837 _decode,
838 )
839 }
840}
841
842pub struct ProviderEventStream {
843 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
844}
845
846impl std::marker::Unpin for ProviderEventStream {}
847
848impl futures::stream::FusedStream for ProviderEventStream {
849 fn is_terminated(&self) -> bool {
850 self.event_receiver.is_terminated()
851 }
852}
853
854impl futures::Stream for ProviderEventStream {
855 type Item = Result<ProviderEvent, fidl::Error>;
856
857 fn poll_next(
858 mut self: std::pin::Pin<&mut Self>,
859 cx: &mut std::task::Context<'_>,
860 ) -> std::task::Poll<Option<Self::Item>> {
861 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
862 &mut self.event_receiver,
863 cx
864 )?) {
865 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
866 None => std::task::Poll::Ready(None),
867 }
868 }
869}
870
871#[derive(Debug)]
872pub enum ProviderEvent {}
873
874impl ProviderEvent {
875 fn decode(
877 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
878 ) -> Result<ProviderEvent, fidl::Error> {
879 let (bytes, _handles) = buf.split_mut();
880 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
881 debug_assert_eq!(tx_header.tx_id, 0);
882 match tx_header.ordinal {
883 _ => Err(fidl::Error::UnknownOrdinal {
884 ordinal: tx_header.ordinal,
885 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
886 }),
887 }
888 }
889}
890
891pub struct ProviderRequestStream {
893 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
894 is_terminated: bool,
895}
896
897impl std::marker::Unpin for ProviderRequestStream {}
898
899impl futures::stream::FusedStream for ProviderRequestStream {
900 fn is_terminated(&self) -> bool {
901 self.is_terminated
902 }
903}
904
905impl fidl::endpoints::RequestStream for ProviderRequestStream {
906 type Protocol = ProviderMarker;
907 type ControlHandle = ProviderControlHandle;
908
909 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
910 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
911 }
912
913 fn control_handle(&self) -> Self::ControlHandle {
914 ProviderControlHandle { inner: self.inner.clone() }
915 }
916
917 fn into_inner(
918 self,
919 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
920 {
921 (self.inner, self.is_terminated)
922 }
923
924 fn from_inner(
925 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
926 is_terminated: bool,
927 ) -> Self {
928 Self { inner, is_terminated }
929 }
930}
931
932impl futures::Stream for ProviderRequestStream {
933 type Item = Result<ProviderRequest, fidl::Error>;
934
935 fn poll_next(
936 mut self: std::pin::Pin<&mut Self>,
937 cx: &mut std::task::Context<'_>,
938 ) -> std::task::Poll<Option<Self::Item>> {
939 let this = &mut *self;
940 if this.inner.check_shutdown(cx) {
941 this.is_terminated = true;
942 return std::task::Poll::Ready(None);
943 }
944 if this.is_terminated {
945 panic!("polled ProviderRequestStream after completion");
946 }
947 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
948 |bytes, handles| {
949 match this.inner.channel().read_etc(cx, bytes, handles) {
950 std::task::Poll::Ready(Ok(())) => {}
951 std::task::Poll::Pending => return std::task::Poll::Pending,
952 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
953 this.is_terminated = true;
954 return std::task::Poll::Ready(None);
955 }
956 std::task::Poll::Ready(Err(e)) => {
957 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
958 e.into(),
959 ))));
960 }
961 }
962
963 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
965
966 std::task::Poll::Ready(Some(match header.ordinal {
967 0x303e4a312d85292b => {
968 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
969 let mut req = fidl::new_empty!(
970 ProviderConnectToServiceRequest,
971 fidl::encoding::DefaultFuchsiaResourceDialect
972 );
973 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderConnectToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
974 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
975 Ok(ProviderRequest::ConnectToService {
976 socket: req.socket,
977 args: req.args,
978
979 responder: ProviderConnectToServiceResponder {
980 control_handle: std::mem::ManuallyDrop::new(control_handle),
981 tx_id: header.tx_id,
982 },
983 })
984 }
985 _ => Err(fidl::Error::UnknownOrdinal {
986 ordinal: header.ordinal,
987 protocol_name:
988 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
989 }),
990 }))
991 },
992 )
993 }
994}
995
996#[derive(Debug)]
1009pub enum ProviderRequest {
1010 ConnectToService {
1013 socket: fidl::Socket,
1014 args: Option<String>,
1015 responder: ProviderConnectToServiceResponder,
1016 },
1017}
1018
1019impl ProviderRequest {
1020 #[allow(irrefutable_let_patterns)]
1021 pub fn into_connect_to_service(
1022 self,
1023 ) -> Option<(fidl::Socket, Option<String>, ProviderConnectToServiceResponder)> {
1024 if let ProviderRequest::ConnectToService { socket, args, responder } = self {
1025 Some((socket, args, responder))
1026 } else {
1027 None
1028 }
1029 }
1030
1031 pub fn method_name(&self) -> &'static str {
1033 match *self {
1034 ProviderRequest::ConnectToService { .. } => "connect_to_service",
1035 }
1036 }
1037}
1038
1039#[derive(Debug, Clone)]
1040pub struct ProviderControlHandle {
1041 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1042}
1043
1044impl ProviderControlHandle {
1045 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1046 self.inner.shutdown_with_epitaph(status.into())
1047 }
1048}
1049
1050impl fidl::endpoints::ControlHandle for ProviderControlHandle {
1051 fn shutdown(&self) {
1052 self.inner.shutdown()
1053 }
1054
1055 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1056 self.inner.shutdown_with_epitaph(status)
1057 }
1058
1059 fn is_closed(&self) -> bool {
1060 self.inner.channel().is_closed()
1061 }
1062 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1063 self.inner.channel().on_closed()
1064 }
1065
1066 #[cfg(target_os = "fuchsia")]
1067 fn signal_peer(
1068 &self,
1069 clear_mask: zx::Signals,
1070 set_mask: zx::Signals,
1071 ) -> Result<(), zx_status::Status> {
1072 use fidl::Peered;
1073 self.inner.channel().signal_peer(clear_mask, set_mask)
1074 }
1075}
1076
1077impl ProviderControlHandle {}
1078
1079#[must_use = "FIDL methods require a response to be sent"]
1080#[derive(Debug)]
1081pub struct ProviderConnectToServiceResponder {
1082 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1083 tx_id: u32,
1084}
1085
1086impl std::ops::Drop for ProviderConnectToServiceResponder {
1090 fn drop(&mut self) {
1091 self.control_handle.shutdown();
1092 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1094 }
1095}
1096
1097impl fidl::endpoints::Responder for ProviderConnectToServiceResponder {
1098 type ControlHandle = ProviderControlHandle;
1099
1100 fn control_handle(&self) -> &ProviderControlHandle {
1101 &self.control_handle
1102 }
1103
1104 fn drop_without_shutdown(mut self) {
1105 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1107 std::mem::forget(self);
1109 }
1110}
1111
1112impl ProviderConnectToServiceResponder {
1113 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1117 let _result = self.send_raw(result);
1118 if _result.is_err() {
1119 self.control_handle.shutdown();
1120 }
1121 self.drop_without_shutdown();
1122 _result
1123 }
1124
1125 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1127 let _result = self.send_raw(result);
1128 self.drop_without_shutdown();
1129 _result
1130 }
1131
1132 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1133 self.control_handle
1134 .inner
1135 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1136 result,
1137 self.tx_id,
1138 0x303e4a312d85292b,
1139 fidl::encoding::DynamicFlags::empty(),
1140 )
1141 }
1142}
1143
1144#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1145pub struct StateControllerMarker;
1146
1147impl fidl::endpoints::ProtocolMarker for StateControllerMarker {
1148 type Proxy = StateControllerProxy;
1149 type RequestStream = StateControllerRequestStream;
1150 #[cfg(target_os = "fuchsia")]
1151 type SynchronousProxy = StateControllerSynchronousProxy;
1152
1153 const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.StateController";
1154}
1155impl fidl::endpoints::DiscoverableProtocolMarker for StateControllerMarker {}
1156pub type StateControllerSetSystemTypeResult = Result<(), i32>;
1157
1158pub trait StateControllerProxyInterface: Send + Sync {
1159 type SetSystemTypeResponseFut: std::future::Future<Output = Result<StateControllerSetSystemTypeResult, fidl::Error>>
1160 + Send;
1161 fn r#set_system_type(&self, system_type: SystemType) -> Self::SetSystemTypeResponseFut;
1162}
1163#[derive(Debug)]
1164#[cfg(target_os = "fuchsia")]
1165pub struct StateControllerSynchronousProxy {
1166 client: fidl::client::sync::Client,
1167}
1168
1169#[cfg(target_os = "fuchsia")]
1170impl fidl::endpoints::SynchronousProxy for StateControllerSynchronousProxy {
1171 type Proxy = StateControllerProxy;
1172 type Protocol = StateControllerMarker;
1173
1174 fn from_channel(inner: fidl::Channel) -> Self {
1175 Self::new(inner)
1176 }
1177
1178 fn into_channel(self) -> fidl::Channel {
1179 self.client.into_channel()
1180 }
1181
1182 fn as_channel(&self) -> &fidl::Channel {
1183 self.client.as_channel()
1184 }
1185}
1186
1187#[cfg(target_os = "fuchsia")]
1188impl StateControllerSynchronousProxy {
1189 pub fn new(channel: fidl::Channel) -> Self {
1190 Self { client: fidl::client::sync::Client::new(channel) }
1191 }
1192
1193 pub fn into_channel(self) -> fidl::Channel {
1194 self.client.into_channel()
1195 }
1196
1197 pub fn wait_for_event(
1200 &self,
1201 deadline: zx::MonotonicInstant,
1202 ) -> Result<StateControllerEvent, fidl::Error> {
1203 StateControllerEvent::decode(self.client.wait_for_event::<StateControllerMarker>(deadline)?)
1204 }
1205
1206 pub fn r#set_system_type(
1211 &self,
1212 mut system_type: SystemType,
1213 ___deadline: zx::MonotonicInstant,
1214 ) -> Result<StateControllerSetSystemTypeResult, fidl::Error> {
1215 let _response = self.client.send_query::<
1216 StateControllerSetSystemTypeRequest,
1217 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1218 StateControllerMarker,
1219 >(
1220 (system_type,),
1221 0xa40a1100522d82e,
1222 fidl::encoding::DynamicFlags::FLEXIBLE,
1223 ___deadline,
1224 )?
1225 .into_result::<StateControllerMarker>("set_system_type")?;
1226 Ok(_response.map(|x| x))
1227 }
1228}
1229
1230#[cfg(target_os = "fuchsia")]
1231impl From<StateControllerSynchronousProxy> for zx::NullableHandle {
1232 fn from(value: StateControllerSynchronousProxy) -> Self {
1233 value.into_channel().into()
1234 }
1235}
1236
1237#[cfg(target_os = "fuchsia")]
1238impl From<fidl::Channel> for StateControllerSynchronousProxy {
1239 fn from(value: fidl::Channel) -> Self {
1240 Self::new(value)
1241 }
1242}
1243
1244#[cfg(target_os = "fuchsia")]
1245impl fidl::endpoints::FromClient for StateControllerSynchronousProxy {
1246 type Protocol = StateControllerMarker;
1247
1248 fn from_client(value: fidl::endpoints::ClientEnd<StateControllerMarker>) -> Self {
1249 Self::new(value.into_channel())
1250 }
1251}
1252
1253#[derive(Debug, Clone)]
1254pub struct StateControllerProxy {
1255 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1256}
1257
1258impl fidl::endpoints::Proxy for StateControllerProxy {
1259 type Protocol = StateControllerMarker;
1260
1261 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1262 Self::new(inner)
1263 }
1264
1265 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1266 self.client.into_channel().map_err(|client| Self { client })
1267 }
1268
1269 fn as_channel(&self) -> &::fidl::AsyncChannel {
1270 self.client.as_channel()
1271 }
1272}
1273
1274impl StateControllerProxy {
1275 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1277 let protocol_name = <StateControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1278 Self { client: fidl::client::Client::new(channel, protocol_name) }
1279 }
1280
1281 pub fn take_event_stream(&self) -> StateControllerEventStream {
1287 StateControllerEventStream { event_receiver: self.client.take_event_receiver() }
1288 }
1289
1290 pub fn r#set_system_type(
1295 &self,
1296 mut system_type: SystemType,
1297 ) -> fidl::client::QueryResponseFut<
1298 StateControllerSetSystemTypeResult,
1299 fidl::encoding::DefaultFuchsiaResourceDialect,
1300 > {
1301 StateControllerProxyInterface::r#set_system_type(self, system_type)
1302 }
1303}
1304
1305impl StateControllerProxyInterface for StateControllerProxy {
1306 type SetSystemTypeResponseFut = fidl::client::QueryResponseFut<
1307 StateControllerSetSystemTypeResult,
1308 fidl::encoding::DefaultFuchsiaResourceDialect,
1309 >;
1310 fn r#set_system_type(&self, mut system_type: SystemType) -> Self::SetSystemTypeResponseFut {
1311 fn _decode(
1312 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1313 ) -> Result<StateControllerSetSystemTypeResult, fidl::Error> {
1314 let _response = fidl::client::decode_transaction_body::<
1315 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1316 fidl::encoding::DefaultFuchsiaResourceDialect,
1317 0xa40a1100522d82e,
1318 >(_buf?)?
1319 .into_result::<StateControllerMarker>("set_system_type")?;
1320 Ok(_response.map(|x| x))
1321 }
1322 self.client.send_query_and_decode::<
1323 StateControllerSetSystemTypeRequest,
1324 StateControllerSetSystemTypeResult,
1325 >(
1326 (system_type,),
1327 0xa40a1100522d82e,
1328 fidl::encoding::DynamicFlags::FLEXIBLE,
1329 _decode,
1330 )
1331 }
1332}
1333
1334pub struct StateControllerEventStream {
1335 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1336}
1337
1338impl std::marker::Unpin for StateControllerEventStream {}
1339
1340impl futures::stream::FusedStream for StateControllerEventStream {
1341 fn is_terminated(&self) -> bool {
1342 self.event_receiver.is_terminated()
1343 }
1344}
1345
1346impl futures::Stream for StateControllerEventStream {
1347 type Item = Result<StateControllerEvent, fidl::Error>;
1348
1349 fn poll_next(
1350 mut self: std::pin::Pin<&mut Self>,
1351 cx: &mut std::task::Context<'_>,
1352 ) -> std::task::Poll<Option<Self::Item>> {
1353 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1354 &mut self.event_receiver,
1355 cx
1356 )?) {
1357 Some(buf) => std::task::Poll::Ready(Some(StateControllerEvent::decode(buf))),
1358 None => std::task::Poll::Ready(None),
1359 }
1360 }
1361}
1362
1363#[derive(Debug)]
1364pub enum StateControllerEvent {
1365 #[non_exhaustive]
1366 _UnknownEvent {
1367 ordinal: u64,
1369 },
1370}
1371
1372impl StateControllerEvent {
1373 fn decode(
1375 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1376 ) -> Result<StateControllerEvent, fidl::Error> {
1377 let (bytes, _handles) = buf.split_mut();
1378 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1379 debug_assert_eq!(tx_header.tx_id, 0);
1380 match tx_header.ordinal {
1381 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1382 Ok(StateControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1383 }
1384 _ => Err(fidl::Error::UnknownOrdinal {
1385 ordinal: tx_header.ordinal,
1386 protocol_name:
1387 <StateControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1388 }),
1389 }
1390 }
1391}
1392
1393pub struct StateControllerRequestStream {
1395 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1396 is_terminated: bool,
1397}
1398
1399impl std::marker::Unpin for StateControllerRequestStream {}
1400
1401impl futures::stream::FusedStream for StateControllerRequestStream {
1402 fn is_terminated(&self) -> bool {
1403 self.is_terminated
1404 }
1405}
1406
1407impl fidl::endpoints::RequestStream for StateControllerRequestStream {
1408 type Protocol = StateControllerMarker;
1409 type ControlHandle = StateControllerControlHandle;
1410
1411 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1412 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1413 }
1414
1415 fn control_handle(&self) -> Self::ControlHandle {
1416 StateControllerControlHandle { inner: self.inner.clone() }
1417 }
1418
1419 fn into_inner(
1420 self,
1421 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1422 {
1423 (self.inner, self.is_terminated)
1424 }
1425
1426 fn from_inner(
1427 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1428 is_terminated: bool,
1429 ) -> Self {
1430 Self { inner, is_terminated }
1431 }
1432}
1433
1434impl futures::Stream for StateControllerRequestStream {
1435 type Item = Result<StateControllerRequest, fidl::Error>;
1436
1437 fn poll_next(
1438 mut self: std::pin::Pin<&mut Self>,
1439 cx: &mut std::task::Context<'_>,
1440 ) -> std::task::Poll<Option<Self::Item>> {
1441 let this = &mut *self;
1442 if this.inner.check_shutdown(cx) {
1443 this.is_terminated = true;
1444 return std::task::Poll::Ready(None);
1445 }
1446 if this.is_terminated {
1447 panic!("polled StateControllerRequestStream after completion");
1448 }
1449 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1450 |bytes, handles| {
1451 match this.inner.channel().read_etc(cx, bytes, handles) {
1452 std::task::Poll::Ready(Ok(())) => {}
1453 std::task::Poll::Pending => return std::task::Poll::Pending,
1454 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1455 this.is_terminated = true;
1456 return std::task::Poll::Ready(None);
1457 }
1458 std::task::Poll::Ready(Err(e)) => {
1459 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1460 e.into(),
1461 ))));
1462 }
1463 }
1464
1465 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1467
1468 std::task::Poll::Ready(Some(match header.ordinal {
1469 0xa40a1100522d82e => {
1470 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1471 let mut req = fidl::new_empty!(
1472 StateControllerSetSystemTypeRequest,
1473 fidl::encoding::DefaultFuchsiaResourceDialect
1474 );
1475 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateControllerSetSystemTypeRequest>(&header, _body_bytes, handles, &mut req)?;
1476 let control_handle =
1477 StateControllerControlHandle { inner: this.inner.clone() };
1478 Ok(StateControllerRequest::SetSystemType {
1479 system_type: req.system_type,
1480
1481 responder: StateControllerSetSystemTypeResponder {
1482 control_handle: std::mem::ManuallyDrop::new(control_handle),
1483 tx_id: header.tx_id,
1484 },
1485 })
1486 }
1487 _ if header.tx_id == 0
1488 && header
1489 .dynamic_flags()
1490 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1491 {
1492 Ok(StateControllerRequest::_UnknownMethod {
1493 ordinal: header.ordinal,
1494 control_handle: StateControllerControlHandle {
1495 inner: this.inner.clone(),
1496 },
1497 method_type: fidl::MethodType::OneWay,
1498 })
1499 }
1500 _ if header
1501 .dynamic_flags()
1502 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1503 {
1504 this.inner.send_framework_err(
1505 fidl::encoding::FrameworkErr::UnknownMethod,
1506 header.tx_id,
1507 header.ordinal,
1508 header.dynamic_flags(),
1509 (bytes, handles),
1510 )?;
1511 Ok(StateControllerRequest::_UnknownMethod {
1512 ordinal: header.ordinal,
1513 control_handle: StateControllerControlHandle {
1514 inner: this.inner.clone(),
1515 },
1516 method_type: fidl::MethodType::TwoWay,
1517 })
1518 }
1519 _ => Err(fidl::Error::UnknownOrdinal {
1520 ordinal: header.ordinal,
1521 protocol_name:
1522 <StateControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1523 }),
1524 }))
1525 },
1526 )
1527 }
1528}
1529
1530#[derive(Debug)]
1532pub enum StateControllerRequest {
1533 SetSystemType { system_type: SystemType, responder: StateControllerSetSystemTypeResponder },
1538 #[non_exhaustive]
1540 _UnknownMethod {
1541 ordinal: u64,
1543 control_handle: StateControllerControlHandle,
1544 method_type: fidl::MethodType,
1545 },
1546}
1547
1548impl StateControllerRequest {
1549 #[allow(irrefutable_let_patterns)]
1550 pub fn into_set_system_type(
1551 self,
1552 ) -> Option<(SystemType, StateControllerSetSystemTypeResponder)> {
1553 if let StateControllerRequest::SetSystemType { system_type, responder } = self {
1554 Some((system_type, responder))
1555 } else {
1556 None
1557 }
1558 }
1559
1560 pub fn method_name(&self) -> &'static str {
1562 match *self {
1563 StateControllerRequest::SetSystemType { .. } => "set_system_type",
1564 StateControllerRequest::_UnknownMethod {
1565 method_type: fidl::MethodType::OneWay,
1566 ..
1567 } => "unknown one-way method",
1568 StateControllerRequest::_UnknownMethod {
1569 method_type: fidl::MethodType::TwoWay,
1570 ..
1571 } => "unknown two-way method",
1572 }
1573 }
1574}
1575
1576#[derive(Debug, Clone)]
1577pub struct StateControllerControlHandle {
1578 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1579}
1580
1581impl StateControllerControlHandle {
1582 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1583 self.inner.shutdown_with_epitaph(status.into())
1584 }
1585}
1586
1587impl fidl::endpoints::ControlHandle for StateControllerControlHandle {
1588 fn shutdown(&self) {
1589 self.inner.shutdown()
1590 }
1591
1592 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1593 self.inner.shutdown_with_epitaph(status)
1594 }
1595
1596 fn is_closed(&self) -> bool {
1597 self.inner.channel().is_closed()
1598 }
1599 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1600 self.inner.channel().on_closed()
1601 }
1602
1603 #[cfg(target_os = "fuchsia")]
1604 fn signal_peer(
1605 &self,
1606 clear_mask: zx::Signals,
1607 set_mask: zx::Signals,
1608 ) -> Result<(), zx_status::Status> {
1609 use fidl::Peered;
1610 self.inner.channel().signal_peer(clear_mask, set_mask)
1611 }
1612}
1613
1614impl StateControllerControlHandle {}
1615
1616#[must_use = "FIDL methods require a response to be sent"]
1617#[derive(Debug)]
1618pub struct StateControllerSetSystemTypeResponder {
1619 control_handle: std::mem::ManuallyDrop<StateControllerControlHandle>,
1620 tx_id: u32,
1621}
1622
1623impl std::ops::Drop for StateControllerSetSystemTypeResponder {
1627 fn drop(&mut self) {
1628 self.control_handle.shutdown();
1629 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1631 }
1632}
1633
1634impl fidl::endpoints::Responder for StateControllerSetSystemTypeResponder {
1635 type ControlHandle = StateControllerControlHandle;
1636
1637 fn control_handle(&self) -> &StateControllerControlHandle {
1638 &self.control_handle
1639 }
1640
1641 fn drop_without_shutdown(mut self) {
1642 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1644 std::mem::forget(self);
1646 }
1647}
1648
1649impl StateControllerSetSystemTypeResponder {
1650 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1654 let _result = self.send_raw(result);
1655 if _result.is_err() {
1656 self.control_handle.shutdown();
1657 }
1658 self.drop_without_shutdown();
1659 _result
1660 }
1661
1662 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1664 let _result = self.send_raw(result);
1665 self.drop_without_shutdown();
1666 _result
1667 }
1668
1669 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1670 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1671 fidl::encoding::EmptyStruct,
1672 i32,
1673 >>(
1674 fidl::encoding::FlexibleResult::new(result),
1675 self.tx_id,
1676 0xa40a1100522d82e,
1677 fidl::encoding::DynamicFlags::FLEXIBLE,
1678 )
1679 }
1680}
1681
1682#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1683pub struct UsbAdbImpl_Marker;
1684
1685impl fidl::endpoints::ProtocolMarker for UsbAdbImpl_Marker {
1686 type Proxy = UsbAdbImpl_Proxy;
1687 type RequestStream = UsbAdbImpl_RequestStream;
1688 #[cfg(target_os = "fuchsia")]
1689 type SynchronousProxy = UsbAdbImpl_SynchronousProxy;
1690
1691 const DEBUG_NAME: &'static str = "(anonymous) UsbAdbImpl_";
1692}
1693pub type UsbAdbImplQueueTxResult = Result<(), i32>;
1694pub type UsbAdbImplReceiveResult = Result<Vec<u8>, i32>;
1695
1696pub trait UsbAdbImpl_ProxyInterface: Send + Sync {
1697 type QueueTxResponseFut: std::future::Future<Output = Result<UsbAdbImplQueueTxResult, fidl::Error>>
1698 + Send;
1699 fn r#queue_tx(&self, data: &[u8]) -> Self::QueueTxResponseFut;
1700 type ReceiveResponseFut: std::future::Future<Output = Result<UsbAdbImplReceiveResult, fidl::Error>>
1701 + Send;
1702 fn r#receive(&self) -> Self::ReceiveResponseFut;
1703}
1704#[derive(Debug)]
1705#[cfg(target_os = "fuchsia")]
1706pub struct UsbAdbImpl_SynchronousProxy {
1707 client: fidl::client::sync::Client,
1708}
1709
1710#[cfg(target_os = "fuchsia")]
1711impl fidl::endpoints::SynchronousProxy for UsbAdbImpl_SynchronousProxy {
1712 type Proxy = UsbAdbImpl_Proxy;
1713 type Protocol = UsbAdbImpl_Marker;
1714
1715 fn from_channel(inner: fidl::Channel) -> Self {
1716 Self::new(inner)
1717 }
1718
1719 fn into_channel(self) -> fidl::Channel {
1720 self.client.into_channel()
1721 }
1722
1723 fn as_channel(&self) -> &fidl::Channel {
1724 self.client.as_channel()
1725 }
1726}
1727
1728#[cfg(target_os = "fuchsia")]
1729impl UsbAdbImpl_SynchronousProxy {
1730 pub fn new(channel: fidl::Channel) -> Self {
1731 Self { client: fidl::client::sync::Client::new(channel) }
1732 }
1733
1734 pub fn into_channel(self) -> fidl::Channel {
1735 self.client.into_channel()
1736 }
1737
1738 pub fn wait_for_event(
1741 &self,
1742 deadline: zx::MonotonicInstant,
1743 ) -> Result<UsbAdbImpl_Event, fidl::Error> {
1744 UsbAdbImpl_Event::decode(self.client.wait_for_event::<UsbAdbImpl_Marker>(deadline)?)
1745 }
1746
1747 pub fn r#queue_tx(
1755 &self,
1756 mut data: &[u8],
1757 ___deadline: zx::MonotonicInstant,
1758 ) -> Result<UsbAdbImplQueueTxResult, fidl::Error> {
1759 let _response = self.client.send_query::<
1760 UsbAdbImplQueueTxRequest,
1761 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1762 UsbAdbImpl_Marker,
1763 >(
1764 (data,),
1765 0x4c0af0efa9701dc9,
1766 fidl::encoding::DynamicFlags::empty(),
1767 ___deadline,
1768 )?;
1769 Ok(_response.map(|x| x))
1770 }
1771
1772 pub fn r#receive(
1782 &self,
1783 ___deadline: zx::MonotonicInstant,
1784 ) -> Result<UsbAdbImplReceiveResult, fidl::Error> {
1785 let _response = self.client.send_query::<
1786 fidl::encoding::EmptyPayload,
1787 fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>,
1788 UsbAdbImpl_Marker,
1789 >(
1790 (),
1791 0x68382fff953be5c4,
1792 fidl::encoding::DynamicFlags::empty(),
1793 ___deadline,
1794 )?;
1795 Ok(_response.map(|x| x.data))
1796 }
1797}
1798
1799#[cfg(target_os = "fuchsia")]
1800impl From<UsbAdbImpl_SynchronousProxy> for zx::NullableHandle {
1801 fn from(value: UsbAdbImpl_SynchronousProxy) -> Self {
1802 value.into_channel().into()
1803 }
1804}
1805
1806#[cfg(target_os = "fuchsia")]
1807impl From<fidl::Channel> for UsbAdbImpl_SynchronousProxy {
1808 fn from(value: fidl::Channel) -> Self {
1809 Self::new(value)
1810 }
1811}
1812
1813#[cfg(target_os = "fuchsia")]
1814impl fidl::endpoints::FromClient for UsbAdbImpl_SynchronousProxy {
1815 type Protocol = UsbAdbImpl_Marker;
1816
1817 fn from_client(value: fidl::endpoints::ClientEnd<UsbAdbImpl_Marker>) -> Self {
1818 Self::new(value.into_channel())
1819 }
1820}
1821
1822#[derive(Debug, Clone)]
1823pub struct UsbAdbImpl_Proxy {
1824 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1825}
1826
1827impl fidl::endpoints::Proxy for UsbAdbImpl_Proxy {
1828 type Protocol = UsbAdbImpl_Marker;
1829
1830 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1831 Self::new(inner)
1832 }
1833
1834 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1835 self.client.into_channel().map_err(|client| Self { client })
1836 }
1837
1838 fn as_channel(&self) -> &::fidl::AsyncChannel {
1839 self.client.as_channel()
1840 }
1841}
1842
1843impl UsbAdbImpl_Proxy {
1844 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1846 let protocol_name = <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1847 Self { client: fidl::client::Client::new(channel, protocol_name) }
1848 }
1849
1850 pub fn take_event_stream(&self) -> UsbAdbImpl_EventStream {
1856 UsbAdbImpl_EventStream { event_receiver: self.client.take_event_receiver() }
1857 }
1858
1859 pub fn r#queue_tx(
1867 &self,
1868 mut data: &[u8],
1869 ) -> fidl::client::QueryResponseFut<
1870 UsbAdbImplQueueTxResult,
1871 fidl::encoding::DefaultFuchsiaResourceDialect,
1872 > {
1873 UsbAdbImpl_ProxyInterface::r#queue_tx(self, data)
1874 }
1875
1876 pub fn r#receive(
1886 &self,
1887 ) -> fidl::client::QueryResponseFut<
1888 UsbAdbImplReceiveResult,
1889 fidl::encoding::DefaultFuchsiaResourceDialect,
1890 > {
1891 UsbAdbImpl_ProxyInterface::r#receive(self)
1892 }
1893}
1894
1895impl UsbAdbImpl_ProxyInterface for UsbAdbImpl_Proxy {
1896 type QueueTxResponseFut = fidl::client::QueryResponseFut<
1897 UsbAdbImplQueueTxResult,
1898 fidl::encoding::DefaultFuchsiaResourceDialect,
1899 >;
1900 fn r#queue_tx(&self, mut data: &[u8]) -> Self::QueueTxResponseFut {
1901 fn _decode(
1902 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1903 ) -> Result<UsbAdbImplQueueTxResult, fidl::Error> {
1904 let _response = fidl::client::decode_transaction_body::<
1905 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1906 fidl::encoding::DefaultFuchsiaResourceDialect,
1907 0x4c0af0efa9701dc9,
1908 >(_buf?)?;
1909 Ok(_response.map(|x| x))
1910 }
1911 self.client.send_query_and_decode::<UsbAdbImplQueueTxRequest, UsbAdbImplQueueTxResult>(
1912 (data,),
1913 0x4c0af0efa9701dc9,
1914 fidl::encoding::DynamicFlags::empty(),
1915 _decode,
1916 )
1917 }
1918
1919 type ReceiveResponseFut = fidl::client::QueryResponseFut<
1920 UsbAdbImplReceiveResult,
1921 fidl::encoding::DefaultFuchsiaResourceDialect,
1922 >;
1923 fn r#receive(&self) -> Self::ReceiveResponseFut {
1924 fn _decode(
1925 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1926 ) -> Result<UsbAdbImplReceiveResult, fidl::Error> {
1927 let _response = fidl::client::decode_transaction_body::<
1928 fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>,
1929 fidl::encoding::DefaultFuchsiaResourceDialect,
1930 0x68382fff953be5c4,
1931 >(_buf?)?;
1932 Ok(_response.map(|x| x.data))
1933 }
1934 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, UsbAdbImplReceiveResult>(
1935 (),
1936 0x68382fff953be5c4,
1937 fidl::encoding::DynamicFlags::empty(),
1938 _decode,
1939 )
1940 }
1941}
1942
1943pub struct UsbAdbImpl_EventStream {
1944 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1945}
1946
1947impl std::marker::Unpin for UsbAdbImpl_EventStream {}
1948
1949impl futures::stream::FusedStream for UsbAdbImpl_EventStream {
1950 fn is_terminated(&self) -> bool {
1951 self.event_receiver.is_terminated()
1952 }
1953}
1954
1955impl futures::Stream for UsbAdbImpl_EventStream {
1956 type Item = Result<UsbAdbImpl_Event, fidl::Error>;
1957
1958 fn poll_next(
1959 mut self: std::pin::Pin<&mut Self>,
1960 cx: &mut std::task::Context<'_>,
1961 ) -> std::task::Poll<Option<Self::Item>> {
1962 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1963 &mut self.event_receiver,
1964 cx
1965 )?) {
1966 Some(buf) => std::task::Poll::Ready(Some(UsbAdbImpl_Event::decode(buf))),
1967 None => std::task::Poll::Ready(None),
1968 }
1969 }
1970}
1971
1972#[derive(Debug)]
1973pub enum UsbAdbImpl_Event {
1974 OnStatusChanged { status: StatusFlags },
1975}
1976
1977impl UsbAdbImpl_Event {
1978 #[allow(irrefutable_let_patterns)]
1979 pub fn into_on_status_changed(self) -> Option<StatusFlags> {
1980 if let UsbAdbImpl_Event::OnStatusChanged { status } = self { Some((status)) } else { None }
1981 }
1982
1983 fn decode(
1985 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1986 ) -> Result<UsbAdbImpl_Event, fidl::Error> {
1987 let (bytes, _handles) = buf.split_mut();
1988 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1989 debug_assert_eq!(tx_header.tx_id, 0);
1990 match tx_header.ordinal {
1991 0x2f2926086c0a5b6e => {
1992 let mut out = fidl::new_empty!(
1993 UsbAdbImplOnStatusChangedRequest,
1994 fidl::encoding::DefaultFuchsiaResourceDialect
1995 );
1996 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbAdbImplOnStatusChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1997 Ok((UsbAdbImpl_Event::OnStatusChanged { status: out.status }))
1998 }
1999 _ => Err(fidl::Error::UnknownOrdinal {
2000 ordinal: tx_header.ordinal,
2001 protocol_name: <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2002 }),
2003 }
2004 }
2005}
2006
2007pub struct UsbAdbImpl_RequestStream {
2009 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2010 is_terminated: bool,
2011}
2012
2013impl std::marker::Unpin for UsbAdbImpl_RequestStream {}
2014
2015impl futures::stream::FusedStream for UsbAdbImpl_RequestStream {
2016 fn is_terminated(&self) -> bool {
2017 self.is_terminated
2018 }
2019}
2020
2021impl fidl::endpoints::RequestStream for UsbAdbImpl_RequestStream {
2022 type Protocol = UsbAdbImpl_Marker;
2023 type ControlHandle = UsbAdbImpl_ControlHandle;
2024
2025 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2026 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2027 }
2028
2029 fn control_handle(&self) -> Self::ControlHandle {
2030 UsbAdbImpl_ControlHandle { inner: self.inner.clone() }
2031 }
2032
2033 fn into_inner(
2034 self,
2035 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2036 {
2037 (self.inner, self.is_terminated)
2038 }
2039
2040 fn from_inner(
2041 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2042 is_terminated: bool,
2043 ) -> Self {
2044 Self { inner, is_terminated }
2045 }
2046}
2047
2048impl futures::Stream for UsbAdbImpl_RequestStream {
2049 type Item = Result<UsbAdbImpl_Request, fidl::Error>;
2050
2051 fn poll_next(
2052 mut self: std::pin::Pin<&mut Self>,
2053 cx: &mut std::task::Context<'_>,
2054 ) -> std::task::Poll<Option<Self::Item>> {
2055 let this = &mut *self;
2056 if this.inner.check_shutdown(cx) {
2057 this.is_terminated = true;
2058 return std::task::Poll::Ready(None);
2059 }
2060 if this.is_terminated {
2061 panic!("polled UsbAdbImpl_RequestStream after completion");
2062 }
2063 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2064 |bytes, handles| {
2065 match this.inner.channel().read_etc(cx, bytes, handles) {
2066 std::task::Poll::Ready(Ok(())) => {}
2067 std::task::Poll::Pending => return std::task::Poll::Pending,
2068 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2069 this.is_terminated = true;
2070 return std::task::Poll::Ready(None);
2071 }
2072 std::task::Poll::Ready(Err(e)) => {
2073 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2074 e.into(),
2075 ))));
2076 }
2077 }
2078
2079 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2081
2082 std::task::Poll::Ready(Some(match header.ordinal {
2083 0x4c0af0efa9701dc9 => {
2084 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2085 let mut req = fidl::new_empty!(
2086 UsbAdbImplQueueTxRequest,
2087 fidl::encoding::DefaultFuchsiaResourceDialect
2088 );
2089 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbAdbImplQueueTxRequest>(&header, _body_bytes, handles, &mut req)?;
2090 let control_handle = UsbAdbImpl_ControlHandle { inner: this.inner.clone() };
2091 Ok(UsbAdbImpl_Request::QueueTx {
2092 data: req.data,
2093
2094 responder: UsbAdbImpl_QueueTxResponder {
2095 control_handle: std::mem::ManuallyDrop::new(control_handle),
2096 tx_id: header.tx_id,
2097 },
2098 })
2099 }
2100 0x68382fff953be5c4 => {
2101 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2102 let mut req = fidl::new_empty!(
2103 fidl::encoding::EmptyPayload,
2104 fidl::encoding::DefaultFuchsiaResourceDialect
2105 );
2106 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2107 let control_handle = UsbAdbImpl_ControlHandle { inner: this.inner.clone() };
2108 Ok(UsbAdbImpl_Request::Receive {
2109 responder: UsbAdbImpl_ReceiveResponder {
2110 control_handle: std::mem::ManuallyDrop::new(control_handle),
2111 tx_id: header.tx_id,
2112 },
2113 })
2114 }
2115 _ => Err(fidl::Error::UnknownOrdinal {
2116 ordinal: header.ordinal,
2117 protocol_name:
2118 <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2119 }),
2120 }))
2121 },
2122 )
2123 }
2124}
2125
2126#[derive(Debug)]
2129pub enum UsbAdbImpl_Request {
2130 QueueTx { data: Vec<u8>, responder: UsbAdbImpl_QueueTxResponder },
2138 Receive { responder: UsbAdbImpl_ReceiveResponder },
2148}
2149
2150impl UsbAdbImpl_Request {
2151 #[allow(irrefutable_let_patterns)]
2152 pub fn into_queue_tx(self) -> Option<(Vec<u8>, UsbAdbImpl_QueueTxResponder)> {
2153 if let UsbAdbImpl_Request::QueueTx { data, responder } = self {
2154 Some((data, responder))
2155 } else {
2156 None
2157 }
2158 }
2159
2160 #[allow(irrefutable_let_patterns)]
2161 pub fn into_receive(self) -> Option<(UsbAdbImpl_ReceiveResponder)> {
2162 if let UsbAdbImpl_Request::Receive { responder } = self { Some((responder)) } else { None }
2163 }
2164
2165 pub fn method_name(&self) -> &'static str {
2167 match *self {
2168 UsbAdbImpl_Request::QueueTx { .. } => "queue_tx",
2169 UsbAdbImpl_Request::Receive { .. } => "receive",
2170 }
2171 }
2172}
2173
2174#[derive(Debug, Clone)]
2175pub struct UsbAdbImpl_ControlHandle {
2176 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2177}
2178
2179impl UsbAdbImpl_ControlHandle {
2180 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2181 self.inner.shutdown_with_epitaph(status.into())
2182 }
2183}
2184
2185impl fidl::endpoints::ControlHandle for UsbAdbImpl_ControlHandle {
2186 fn shutdown(&self) {
2187 self.inner.shutdown()
2188 }
2189
2190 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2191 self.inner.shutdown_with_epitaph(status)
2192 }
2193
2194 fn is_closed(&self) -> bool {
2195 self.inner.channel().is_closed()
2196 }
2197 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2198 self.inner.channel().on_closed()
2199 }
2200
2201 #[cfg(target_os = "fuchsia")]
2202 fn signal_peer(
2203 &self,
2204 clear_mask: zx::Signals,
2205 set_mask: zx::Signals,
2206 ) -> Result<(), zx_status::Status> {
2207 use fidl::Peered;
2208 self.inner.channel().signal_peer(clear_mask, set_mask)
2209 }
2210}
2211
2212impl UsbAdbImpl_ControlHandle {
2213 pub fn send_on_status_changed(&self, mut status: StatusFlags) -> Result<(), fidl::Error> {
2214 self.inner.send::<UsbAdbImplOnStatusChangedRequest>(
2215 (status,),
2216 0,
2217 0x2f2926086c0a5b6e,
2218 fidl::encoding::DynamicFlags::empty(),
2219 )
2220 }
2221}
2222
2223#[must_use = "FIDL methods require a response to be sent"]
2224#[derive(Debug)]
2225pub struct UsbAdbImpl_QueueTxResponder {
2226 control_handle: std::mem::ManuallyDrop<UsbAdbImpl_ControlHandle>,
2227 tx_id: u32,
2228}
2229
2230impl std::ops::Drop for UsbAdbImpl_QueueTxResponder {
2234 fn drop(&mut self) {
2235 self.control_handle.shutdown();
2236 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2238 }
2239}
2240
2241impl fidl::endpoints::Responder for UsbAdbImpl_QueueTxResponder {
2242 type ControlHandle = UsbAdbImpl_ControlHandle;
2243
2244 fn control_handle(&self) -> &UsbAdbImpl_ControlHandle {
2245 &self.control_handle
2246 }
2247
2248 fn drop_without_shutdown(mut self) {
2249 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2251 std::mem::forget(self);
2253 }
2254}
2255
2256impl UsbAdbImpl_QueueTxResponder {
2257 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2261 let _result = self.send_raw(result);
2262 if _result.is_err() {
2263 self.control_handle.shutdown();
2264 }
2265 self.drop_without_shutdown();
2266 _result
2267 }
2268
2269 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2271 let _result = self.send_raw(result);
2272 self.drop_without_shutdown();
2273 _result
2274 }
2275
2276 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2277 self.control_handle
2278 .inner
2279 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2280 result,
2281 self.tx_id,
2282 0x4c0af0efa9701dc9,
2283 fidl::encoding::DynamicFlags::empty(),
2284 )
2285 }
2286}
2287
2288#[must_use = "FIDL methods require a response to be sent"]
2289#[derive(Debug)]
2290pub struct UsbAdbImpl_ReceiveResponder {
2291 control_handle: std::mem::ManuallyDrop<UsbAdbImpl_ControlHandle>,
2292 tx_id: u32,
2293}
2294
2295impl std::ops::Drop for UsbAdbImpl_ReceiveResponder {
2299 fn drop(&mut self) {
2300 self.control_handle.shutdown();
2301 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2303 }
2304}
2305
2306impl fidl::endpoints::Responder for UsbAdbImpl_ReceiveResponder {
2307 type ControlHandle = UsbAdbImpl_ControlHandle;
2308
2309 fn control_handle(&self) -> &UsbAdbImpl_ControlHandle {
2310 &self.control_handle
2311 }
2312
2313 fn drop_without_shutdown(mut self) {
2314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2316 std::mem::forget(self);
2318 }
2319}
2320
2321impl UsbAdbImpl_ReceiveResponder {
2322 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2326 let _result = self.send_raw(result);
2327 if _result.is_err() {
2328 self.control_handle.shutdown();
2329 }
2330 self.drop_without_shutdown();
2331 _result
2332 }
2333
2334 pub fn send_no_shutdown_on_err(
2336 self,
2337 mut result: Result<&[u8], i32>,
2338 ) -> Result<(), fidl::Error> {
2339 let _result = self.send_raw(result);
2340 self.drop_without_shutdown();
2341 _result
2342 }
2343
2344 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2345 self.control_handle
2346 .inner
2347 .send::<fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>>(
2348 result.map(|data| (data,)),
2349 self.tx_id,
2350 0x68382fff953be5c4,
2351 fidl::encoding::DynamicFlags::empty(),
2352 )
2353 }
2354}
2355
2356#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2357pub struct ServiceMarker;
2358
2359#[cfg(target_os = "fuchsia")]
2360impl fidl::endpoints::ServiceMarker for ServiceMarker {
2361 type Proxy = ServiceProxy;
2362 type Request = ServiceRequest;
2363 const SERVICE_NAME: &'static str = "fuchsia.hardware.adb.Service";
2364}
2365
2366#[cfg(target_os = "fuchsia")]
2369pub enum ServiceRequest {
2370 Adb(DeviceRequestStream),
2371}
2372
2373#[cfg(target_os = "fuchsia")]
2374impl fidl::endpoints::ServiceRequest for ServiceRequest {
2375 type Service = ServiceMarker;
2376
2377 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2378 match name {
2379 "adb" => Self::Adb(
2380 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2381 ),
2382 _ => panic!("no such member protocol name for service Service"),
2383 }
2384 }
2385
2386 fn member_names() -> &'static [&'static str] {
2387 &["adb"]
2388 }
2389}
2390#[cfg(target_os = "fuchsia")]
2391pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2392
2393#[cfg(target_os = "fuchsia")]
2394impl fidl::endpoints::ServiceProxy for ServiceProxy {
2395 type Service = ServiceMarker;
2396
2397 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2398 Self(opener)
2399 }
2400}
2401
2402#[cfg(target_os = "fuchsia")]
2403impl ServiceProxy {
2404 pub fn connect_to_adb(&self) -> Result<DeviceProxy, fidl::Error> {
2405 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2406 self.connect_channel_to_adb(server_end)?;
2407 Ok(proxy)
2408 }
2409
2410 pub fn connect_to_adb_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2413 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2414 self.connect_channel_to_adb(server_end)?;
2415 Ok(proxy)
2416 }
2417
2418 pub fn connect_channel_to_adb(
2421 &self,
2422 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2423 ) -> Result<(), fidl::Error> {
2424 self.0.open_member("adb", server_end.into_channel())
2425 }
2426
2427 pub fn instance_name(&self) -> &str {
2428 self.0.instance_name()
2429 }
2430}
2431
2432mod internal {
2433 use super::*;
2434
2435 impl fidl::encoding::ResourceTypeMarker for DeviceStartAdbRequest {
2436 type Borrowed<'a> = &'a mut Self;
2437 fn take_or_borrow<'a>(
2438 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2439 ) -> Self::Borrowed<'a> {
2440 value
2441 }
2442 }
2443
2444 unsafe impl fidl::encoding::TypeMarker for DeviceStartAdbRequest {
2445 type Owned = Self;
2446
2447 #[inline(always)]
2448 fn inline_align(_context: fidl::encoding::Context) -> usize {
2449 4
2450 }
2451
2452 #[inline(always)]
2453 fn inline_size(_context: fidl::encoding::Context) -> usize {
2454 4
2455 }
2456 }
2457
2458 unsafe impl
2459 fidl::encoding::Encode<DeviceStartAdbRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2460 for &mut DeviceStartAdbRequest
2461 {
2462 #[inline]
2463 unsafe fn encode(
2464 self,
2465 encoder: &mut fidl::encoding::Encoder<
2466 '_,
2467 fidl::encoding::DefaultFuchsiaResourceDialect,
2468 >,
2469 offset: usize,
2470 _depth: fidl::encoding::Depth,
2471 ) -> fidl::Result<()> {
2472 encoder.debug_check_bounds::<DeviceStartAdbRequest>(offset);
2473 fidl::encoding::Encode::<DeviceStartAdbRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2475 (
2476 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
2477 ),
2478 encoder, offset, _depth
2479 )
2480 }
2481 }
2482 unsafe impl<
2483 T0: fidl::encoding::Encode<
2484 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
2485 fidl::encoding::DefaultFuchsiaResourceDialect,
2486 >,
2487 >
2488 fidl::encoding::Encode<DeviceStartAdbRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2489 for (T0,)
2490 {
2491 #[inline]
2492 unsafe fn encode(
2493 self,
2494 encoder: &mut fidl::encoding::Encoder<
2495 '_,
2496 fidl::encoding::DefaultFuchsiaResourceDialect,
2497 >,
2498 offset: usize,
2499 depth: fidl::encoding::Depth,
2500 ) -> fidl::Result<()> {
2501 encoder.debug_check_bounds::<DeviceStartAdbRequest>(offset);
2502 self.0.encode(encoder, offset + 0, depth)?;
2506 Ok(())
2507 }
2508 }
2509
2510 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2511 for DeviceStartAdbRequest
2512 {
2513 #[inline(always)]
2514 fn new_empty() -> Self {
2515 Self {
2516 interface: fidl::new_empty!(
2517 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
2518 fidl::encoding::DefaultFuchsiaResourceDialect
2519 ),
2520 }
2521 }
2522
2523 #[inline]
2524 unsafe fn decode(
2525 &mut self,
2526 decoder: &mut fidl::encoding::Decoder<
2527 '_,
2528 fidl::encoding::DefaultFuchsiaResourceDialect,
2529 >,
2530 offset: usize,
2531 _depth: fidl::encoding::Depth,
2532 ) -> fidl::Result<()> {
2533 decoder.debug_check_bounds::<Self>(offset);
2534 fidl::decode!(
2536 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
2537 fidl::encoding::DefaultFuchsiaResourceDialect,
2538 &mut self.interface,
2539 decoder,
2540 offset + 0,
2541 _depth
2542 )?;
2543 Ok(())
2544 }
2545 }
2546
2547 impl fidl::encoding::ResourceTypeMarker for ProviderConnectToServiceRequest {
2548 type Borrowed<'a> = &'a mut Self;
2549 fn take_or_borrow<'a>(
2550 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2551 ) -> Self::Borrowed<'a> {
2552 value
2553 }
2554 }
2555
2556 unsafe impl fidl::encoding::TypeMarker for ProviderConnectToServiceRequest {
2557 type Owned = Self;
2558
2559 #[inline(always)]
2560 fn inline_align(_context: fidl::encoding::Context) -> usize {
2561 8
2562 }
2563
2564 #[inline(always)]
2565 fn inline_size(_context: fidl::encoding::Context) -> usize {
2566 24
2567 }
2568 }
2569
2570 unsafe impl
2571 fidl::encoding::Encode<
2572 ProviderConnectToServiceRequest,
2573 fidl::encoding::DefaultFuchsiaResourceDialect,
2574 > for &mut ProviderConnectToServiceRequest
2575 {
2576 #[inline]
2577 unsafe fn encode(
2578 self,
2579 encoder: &mut fidl::encoding::Encoder<
2580 '_,
2581 fidl::encoding::DefaultFuchsiaResourceDialect,
2582 >,
2583 offset: usize,
2584 _depth: fidl::encoding::Depth,
2585 ) -> fidl::Result<()> {
2586 encoder.debug_check_bounds::<ProviderConnectToServiceRequest>(offset);
2587 fidl::encoding::Encode::<ProviderConnectToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2589 (
2590 <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
2591 <fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.args),
2592 ),
2593 encoder, offset, _depth
2594 )
2595 }
2596 }
2597 unsafe impl<
2598 T0: fidl::encoding::Encode<
2599 fidl::encoding::HandleType<
2600 fidl::Socket,
2601 { fidl::ObjectType::SOCKET.into_raw() },
2602 2147483648,
2603 >,
2604 fidl::encoding::DefaultFuchsiaResourceDialect,
2605 >,
2606 T1: fidl::encoding::Encode<
2607 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2608 fidl::encoding::DefaultFuchsiaResourceDialect,
2609 >,
2610 >
2611 fidl::encoding::Encode<
2612 ProviderConnectToServiceRequest,
2613 fidl::encoding::DefaultFuchsiaResourceDialect,
2614 > for (T0, T1)
2615 {
2616 #[inline]
2617 unsafe fn encode(
2618 self,
2619 encoder: &mut fidl::encoding::Encoder<
2620 '_,
2621 fidl::encoding::DefaultFuchsiaResourceDialect,
2622 >,
2623 offset: usize,
2624 depth: fidl::encoding::Depth,
2625 ) -> fidl::Result<()> {
2626 encoder.debug_check_bounds::<ProviderConnectToServiceRequest>(offset);
2627 unsafe {
2630 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2631 (ptr as *mut u64).write_unaligned(0);
2632 }
2633 self.0.encode(encoder, offset + 0, depth)?;
2635 self.1.encode(encoder, offset + 8, depth)?;
2636 Ok(())
2637 }
2638 }
2639
2640 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2641 for ProviderConnectToServiceRequest
2642 {
2643 #[inline(always)]
2644 fn new_empty() -> Self {
2645 Self {
2646 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2647 args: fidl::new_empty!(
2648 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2649 fidl::encoding::DefaultFuchsiaResourceDialect
2650 ),
2651 }
2652 }
2653
2654 #[inline]
2655 unsafe fn decode(
2656 &mut self,
2657 decoder: &mut fidl::encoding::Decoder<
2658 '_,
2659 fidl::encoding::DefaultFuchsiaResourceDialect,
2660 >,
2661 offset: usize,
2662 _depth: fidl::encoding::Depth,
2663 ) -> fidl::Result<()> {
2664 decoder.debug_check_bounds::<Self>(offset);
2665 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2667 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2668 let mask = 0xffffffff00000000u64;
2669 let maskedval = padval & mask;
2670 if maskedval != 0 {
2671 return Err(fidl::Error::NonZeroPadding {
2672 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2673 });
2674 }
2675 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
2676 fidl::decode!(
2677 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2678 fidl::encoding::DefaultFuchsiaResourceDialect,
2679 &mut self.args,
2680 decoder,
2681 offset + 8,
2682 _depth
2683 )?;
2684 Ok(())
2685 }
2686 }
2687}