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_vsockbridge_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CallbackNewLinkRequest {
16 pub socket: fidl::Socket,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CallbackNewLinkRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct DeviceSetCallbackRequest {
23 pub callback: fidl::endpoints::ClientEnd<CallbackMarker>,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceSetCallbackRequest {}
27
28#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct UsbSetCallbackRequest {
30 pub callback: fidl::endpoints::ClientEnd<CallbackMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for UsbSetCallbackRequest {}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
36pub struct CallbackMarker;
37
38impl fidl::endpoints::ProtocolMarker for CallbackMarker {
39 type Proxy = CallbackProxy;
40 type RequestStream = CallbackRequestStream;
41 #[cfg(target_os = "fuchsia")]
42 type SynchronousProxy = CallbackSynchronousProxy;
43
44 const DEBUG_NAME: &'static str = "(anonymous) Callback";
45}
46
47pub trait CallbackProxyInterface: Send + Sync {
48 type NewLinkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
49 fn r#new_link(&self, socket: fidl::Socket) -> Self::NewLinkResponseFut;
50}
51#[derive(Debug)]
52#[cfg(target_os = "fuchsia")]
53pub struct CallbackSynchronousProxy {
54 client: fidl::client::sync::Client,
55}
56
57#[cfg(target_os = "fuchsia")]
58impl fidl::endpoints::SynchronousProxy for CallbackSynchronousProxy {
59 type Proxy = CallbackProxy;
60 type Protocol = CallbackMarker;
61
62 fn from_channel(inner: fidl::Channel) -> Self {
63 Self::new(inner)
64 }
65
66 fn into_channel(self) -> fidl::Channel {
67 self.client.into_channel()
68 }
69
70 fn as_channel(&self) -> &fidl::Channel {
71 self.client.as_channel()
72 }
73}
74
75#[cfg(target_os = "fuchsia")]
76impl CallbackSynchronousProxy {
77 pub fn new(channel: fidl::Channel) -> Self {
78 Self { client: fidl::client::sync::Client::new(channel) }
79 }
80
81 pub fn into_channel(self) -> fidl::Channel {
82 self.client.into_channel()
83 }
84
85 pub fn wait_for_event(
88 &self,
89 deadline: zx::MonotonicInstant,
90 ) -> Result<CallbackEvent, fidl::Error> {
91 CallbackEvent::decode(self.client.wait_for_event::<CallbackMarker>(deadline)?)
92 }
93
94 pub fn r#new_link(
95 &self,
96 mut socket: fidl::Socket,
97 ___deadline: zx::MonotonicInstant,
98 ) -> Result<(), fidl::Error> {
99 let _response = self
100 .client
101 .send_query::<CallbackNewLinkRequest, fidl::encoding::EmptyPayload, CallbackMarker>(
102 (socket,),
103 0x505939d3da6b8056,
104 fidl::encoding::DynamicFlags::empty(),
105 ___deadline,
106 )?;
107 Ok(_response)
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl From<CallbackSynchronousProxy> for zx::NullableHandle {
113 fn from(value: CallbackSynchronousProxy) -> Self {
114 value.into_channel().into()
115 }
116}
117
118#[cfg(target_os = "fuchsia")]
119impl From<fidl::Channel> for CallbackSynchronousProxy {
120 fn from(value: fidl::Channel) -> Self {
121 Self::new(value)
122 }
123}
124
125#[cfg(target_os = "fuchsia")]
126impl fidl::endpoints::FromClient for CallbackSynchronousProxy {
127 type Protocol = CallbackMarker;
128
129 fn from_client(value: fidl::endpoints::ClientEnd<CallbackMarker>) -> Self {
130 Self::new(value.into_channel())
131 }
132}
133
134#[derive(Debug, Clone)]
135pub struct CallbackProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for CallbackProxy {
140 type Protocol = CallbackMarker;
141
142 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
143 Self::new(inner)
144 }
145
146 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
147 self.client.into_channel().map_err(|client| Self { client })
148 }
149
150 fn as_channel(&self) -> &::fidl::AsyncChannel {
151 self.client.as_channel()
152 }
153}
154
155impl CallbackProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name = <CallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
159 Self { client: fidl::client::Client::new(channel, protocol_name) }
160 }
161
162 pub fn take_event_stream(&self) -> CallbackEventStream {
168 CallbackEventStream { event_receiver: self.client.take_event_receiver() }
169 }
170
171 pub fn r#new_link(
172 &self,
173 mut socket: fidl::Socket,
174 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
175 CallbackProxyInterface::r#new_link(self, socket)
176 }
177}
178
179impl CallbackProxyInterface for CallbackProxy {
180 type NewLinkResponseFut =
181 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
182 fn r#new_link(&self, mut socket: fidl::Socket) -> Self::NewLinkResponseFut {
183 fn _decode(
184 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
185 ) -> Result<(), fidl::Error> {
186 let _response = fidl::client::decode_transaction_body::<
187 fidl::encoding::EmptyPayload,
188 fidl::encoding::DefaultFuchsiaResourceDialect,
189 0x505939d3da6b8056,
190 >(_buf?)?;
191 Ok(_response)
192 }
193 self.client.send_query_and_decode::<CallbackNewLinkRequest, ()>(
194 (socket,),
195 0x505939d3da6b8056,
196 fidl::encoding::DynamicFlags::empty(),
197 _decode,
198 )
199 }
200}
201
202pub struct CallbackEventStream {
203 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl std::marker::Unpin for CallbackEventStream {}
207
208impl futures::stream::FusedStream for CallbackEventStream {
209 fn is_terminated(&self) -> bool {
210 self.event_receiver.is_terminated()
211 }
212}
213
214impl futures::Stream for CallbackEventStream {
215 type Item = Result<CallbackEvent, fidl::Error>;
216
217 fn poll_next(
218 mut self: std::pin::Pin<&mut Self>,
219 cx: &mut std::task::Context<'_>,
220 ) -> std::task::Poll<Option<Self::Item>> {
221 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
222 &mut self.event_receiver,
223 cx
224 )?) {
225 Some(buf) => std::task::Poll::Ready(Some(CallbackEvent::decode(buf))),
226 None => std::task::Poll::Ready(None),
227 }
228 }
229}
230
231#[derive(Debug)]
232pub enum CallbackEvent {}
233
234impl CallbackEvent {
235 fn decode(
237 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
238 ) -> Result<CallbackEvent, fidl::Error> {
239 let (bytes, _handles) = buf.split_mut();
240 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
241 debug_assert_eq!(tx_header.tx_id, 0);
242 match tx_header.ordinal {
243 _ => Err(fidl::Error::UnknownOrdinal {
244 ordinal: tx_header.ordinal,
245 protocol_name: <CallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
246 }),
247 }
248 }
249}
250
251pub struct CallbackRequestStream {
253 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
254 is_terminated: bool,
255}
256
257impl std::marker::Unpin for CallbackRequestStream {}
258
259impl futures::stream::FusedStream for CallbackRequestStream {
260 fn is_terminated(&self) -> bool {
261 self.is_terminated
262 }
263}
264
265impl fidl::endpoints::RequestStream for CallbackRequestStream {
266 type Protocol = CallbackMarker;
267 type ControlHandle = CallbackControlHandle;
268
269 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
270 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
271 }
272
273 fn control_handle(&self) -> Self::ControlHandle {
274 CallbackControlHandle { inner: self.inner.clone() }
275 }
276
277 fn into_inner(
278 self,
279 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
280 {
281 (self.inner, self.is_terminated)
282 }
283
284 fn from_inner(
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286 is_terminated: bool,
287 ) -> Self {
288 Self { inner, is_terminated }
289 }
290}
291
292impl futures::Stream for CallbackRequestStream {
293 type Item = Result<CallbackRequest, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 let this = &mut *self;
300 if this.inner.check_shutdown(cx) {
301 this.is_terminated = true;
302 return std::task::Poll::Ready(None);
303 }
304 if this.is_terminated {
305 panic!("polled CallbackRequestStream after completion");
306 }
307 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
308 |bytes, handles| {
309 match this.inner.channel().read_etc(cx, bytes, handles) {
310 std::task::Poll::Ready(Ok(())) => {}
311 std::task::Poll::Pending => return std::task::Poll::Pending,
312 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
313 this.is_terminated = true;
314 return std::task::Poll::Ready(None);
315 }
316 std::task::Poll::Ready(Err(e)) => {
317 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
318 e.into(),
319 ))));
320 }
321 }
322
323 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
325
326 std::task::Poll::Ready(Some(match header.ordinal {
327 0x505939d3da6b8056 => {
328 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
329 let mut req = fidl::new_empty!(
330 CallbackNewLinkRequest,
331 fidl::encoding::DefaultFuchsiaResourceDialect
332 );
333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbackNewLinkRequest>(&header, _body_bytes, handles, &mut req)?;
334 let control_handle = CallbackControlHandle { inner: this.inner.clone() };
335 Ok(CallbackRequest::NewLink {
336 socket: req.socket,
337
338 responder: CallbackNewLinkResponder {
339 control_handle: std::mem::ManuallyDrop::new(control_handle),
340 tx_id: header.tx_id,
341 },
342 })
343 }
344 _ => Err(fidl::Error::UnknownOrdinal {
345 ordinal: header.ordinal,
346 protocol_name:
347 <CallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
348 }),
349 }))
350 },
351 )
352 }
353}
354
355#[derive(Debug)]
356pub enum CallbackRequest {
357 NewLink { socket: fidl::Socket, responder: CallbackNewLinkResponder },
358}
359
360impl CallbackRequest {
361 #[allow(irrefutable_let_patterns)]
362 pub fn into_new_link(self) -> Option<(fidl::Socket, CallbackNewLinkResponder)> {
363 if let CallbackRequest::NewLink { socket, responder } = self {
364 Some((socket, responder))
365 } else {
366 None
367 }
368 }
369
370 pub fn method_name(&self) -> &'static str {
372 match *self {
373 CallbackRequest::NewLink { .. } => "new_link",
374 }
375 }
376}
377
378#[derive(Debug, Clone)]
379pub struct CallbackControlHandle {
380 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
381}
382
383impl CallbackControlHandle {
384 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
385 self.inner.shutdown_with_epitaph(status.into())
386 }
387}
388
389impl fidl::endpoints::ControlHandle for CallbackControlHandle {
390 fn shutdown(&self) {
391 self.inner.shutdown()
392 }
393
394 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
395 self.inner.shutdown_with_epitaph(status)
396 }
397
398 fn is_closed(&self) -> bool {
399 self.inner.channel().is_closed()
400 }
401 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
402 self.inner.channel().on_closed()
403 }
404
405 #[cfg(target_os = "fuchsia")]
406 fn signal_peer(
407 &self,
408 clear_mask: zx::Signals,
409 set_mask: zx::Signals,
410 ) -> Result<(), zx_status::Status> {
411 use fidl::Peered;
412 self.inner.channel().signal_peer(clear_mask, set_mask)
413 }
414}
415
416impl CallbackControlHandle {}
417
418#[must_use = "FIDL methods require a response to be sent"]
419#[derive(Debug)]
420pub struct CallbackNewLinkResponder {
421 control_handle: std::mem::ManuallyDrop<CallbackControlHandle>,
422 tx_id: u32,
423}
424
425impl std::ops::Drop for CallbackNewLinkResponder {
429 fn drop(&mut self) {
430 self.control_handle.shutdown();
431 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
433 }
434}
435
436impl fidl::endpoints::Responder for CallbackNewLinkResponder {
437 type ControlHandle = CallbackControlHandle;
438
439 fn control_handle(&self) -> &CallbackControlHandle {
440 &self.control_handle
441 }
442
443 fn drop_without_shutdown(mut self) {
444 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
446 std::mem::forget(self);
448 }
449}
450
451impl CallbackNewLinkResponder {
452 pub fn send(self) -> Result<(), fidl::Error> {
456 let _result = self.send_raw();
457 if _result.is_err() {
458 self.control_handle.shutdown();
459 }
460 self.drop_without_shutdown();
461 _result
462 }
463
464 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
466 let _result = self.send_raw();
467 self.drop_without_shutdown();
468 _result
469 }
470
471 fn send_raw(&self) -> Result<(), fidl::Error> {
472 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
473 (),
474 self.tx_id,
475 0x505939d3da6b8056,
476 fidl::encoding::DynamicFlags::empty(),
477 )
478 }
479}
480
481#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
482pub struct DeviceMarker;
483
484impl fidl::endpoints::ProtocolMarker for DeviceMarker {
485 type Proxy = DeviceProxy;
486 type RequestStream = DeviceRequestStream;
487 #[cfg(target_os = "fuchsia")]
488 type SynchronousProxy = DeviceSynchronousProxy;
489
490 const DEBUG_NAME: &'static str = "(anonymous) Device";
491}
492
493pub trait DeviceProxyInterface: Send + Sync {
494 type SetCallbackResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
495 fn r#set_callback(
496 &self,
497 callback: fidl::endpoints::ClientEnd<CallbackMarker>,
498 ) -> Self::SetCallbackResponseFut;
499}
500#[derive(Debug)]
501#[cfg(target_os = "fuchsia")]
502pub struct DeviceSynchronousProxy {
503 client: fidl::client::sync::Client,
504}
505
506#[cfg(target_os = "fuchsia")]
507impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
508 type Proxy = DeviceProxy;
509 type Protocol = DeviceMarker;
510
511 fn from_channel(inner: fidl::Channel) -> Self {
512 Self::new(inner)
513 }
514
515 fn into_channel(self) -> fidl::Channel {
516 self.client.into_channel()
517 }
518
519 fn as_channel(&self) -> &fidl::Channel {
520 self.client.as_channel()
521 }
522}
523
524#[cfg(target_os = "fuchsia")]
525impl DeviceSynchronousProxy {
526 pub fn new(channel: fidl::Channel) -> Self {
527 Self { client: fidl::client::sync::Client::new(channel) }
528 }
529
530 pub fn into_channel(self) -> fidl::Channel {
531 self.client.into_channel()
532 }
533
534 pub fn wait_for_event(
537 &self,
538 deadline: zx::MonotonicInstant,
539 ) -> Result<DeviceEvent, fidl::Error> {
540 DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
541 }
542
543 pub fn r#set_callback(
544 &self,
545 mut callback: fidl::endpoints::ClientEnd<CallbackMarker>,
546 ___deadline: zx::MonotonicInstant,
547 ) -> Result<(), fidl::Error> {
548 let _response = self
549 .client
550 .send_query::<DeviceSetCallbackRequest, fidl::encoding::EmptyPayload, DeviceMarker>(
551 (callback,),
552 0x74b18fb8e6277e6e,
553 fidl::encoding::DynamicFlags::empty(),
554 ___deadline,
555 )?;
556 Ok(_response)
557 }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl From<DeviceSynchronousProxy> for zx::NullableHandle {
562 fn from(value: DeviceSynchronousProxy) -> Self {
563 value.into_channel().into()
564 }
565}
566
567#[cfg(target_os = "fuchsia")]
568impl From<fidl::Channel> for DeviceSynchronousProxy {
569 fn from(value: fidl::Channel) -> Self {
570 Self::new(value)
571 }
572}
573
574#[cfg(target_os = "fuchsia")]
575impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
576 type Protocol = DeviceMarker;
577
578 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
579 Self::new(value.into_channel())
580 }
581}
582
583#[derive(Debug, Clone)]
584pub struct DeviceProxy {
585 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
586}
587
588impl fidl::endpoints::Proxy for DeviceProxy {
589 type Protocol = DeviceMarker;
590
591 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
592 Self::new(inner)
593 }
594
595 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
596 self.client.into_channel().map_err(|client| Self { client })
597 }
598
599 fn as_channel(&self) -> &::fidl::AsyncChannel {
600 self.client.as_channel()
601 }
602}
603
604impl DeviceProxy {
605 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
607 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
608 Self { client: fidl::client::Client::new(channel, protocol_name) }
609 }
610
611 pub fn take_event_stream(&self) -> DeviceEventStream {
617 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
618 }
619
620 pub fn r#set_callback(
621 &self,
622 mut callback: fidl::endpoints::ClientEnd<CallbackMarker>,
623 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
624 DeviceProxyInterface::r#set_callback(self, callback)
625 }
626}
627
628impl DeviceProxyInterface for DeviceProxy {
629 type SetCallbackResponseFut =
630 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
631 fn r#set_callback(
632 &self,
633 mut callback: fidl::endpoints::ClientEnd<CallbackMarker>,
634 ) -> Self::SetCallbackResponseFut {
635 fn _decode(
636 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
637 ) -> Result<(), fidl::Error> {
638 let _response = fidl::client::decode_transaction_body::<
639 fidl::encoding::EmptyPayload,
640 fidl::encoding::DefaultFuchsiaResourceDialect,
641 0x74b18fb8e6277e6e,
642 >(_buf?)?;
643 Ok(_response)
644 }
645 self.client.send_query_and_decode::<DeviceSetCallbackRequest, ()>(
646 (callback,),
647 0x74b18fb8e6277e6e,
648 fidl::encoding::DynamicFlags::empty(),
649 _decode,
650 )
651 }
652}
653
654pub struct DeviceEventStream {
655 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
656}
657
658impl std::marker::Unpin for DeviceEventStream {}
659
660impl futures::stream::FusedStream for DeviceEventStream {
661 fn is_terminated(&self) -> bool {
662 self.event_receiver.is_terminated()
663 }
664}
665
666impl futures::Stream for DeviceEventStream {
667 type Item = Result<DeviceEvent, fidl::Error>;
668
669 fn poll_next(
670 mut self: std::pin::Pin<&mut Self>,
671 cx: &mut std::task::Context<'_>,
672 ) -> std::task::Poll<Option<Self::Item>> {
673 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
674 &mut self.event_receiver,
675 cx
676 )?) {
677 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
678 None => std::task::Poll::Ready(None),
679 }
680 }
681}
682
683#[derive(Debug)]
684pub enum DeviceEvent {}
685
686impl DeviceEvent {
687 fn decode(
689 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
690 ) -> Result<DeviceEvent, fidl::Error> {
691 let (bytes, _handles) = buf.split_mut();
692 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
693 debug_assert_eq!(tx_header.tx_id, 0);
694 match tx_header.ordinal {
695 _ => Err(fidl::Error::UnknownOrdinal {
696 ordinal: tx_header.ordinal,
697 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
698 }),
699 }
700 }
701}
702
703pub struct DeviceRequestStream {
705 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
706 is_terminated: bool,
707}
708
709impl std::marker::Unpin for DeviceRequestStream {}
710
711impl futures::stream::FusedStream for DeviceRequestStream {
712 fn is_terminated(&self) -> bool {
713 self.is_terminated
714 }
715}
716
717impl fidl::endpoints::RequestStream for DeviceRequestStream {
718 type Protocol = DeviceMarker;
719 type ControlHandle = DeviceControlHandle;
720
721 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
722 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
723 }
724
725 fn control_handle(&self) -> Self::ControlHandle {
726 DeviceControlHandle { inner: self.inner.clone() }
727 }
728
729 fn into_inner(
730 self,
731 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
732 {
733 (self.inner, self.is_terminated)
734 }
735
736 fn from_inner(
737 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
738 is_terminated: bool,
739 ) -> Self {
740 Self { inner, is_terminated }
741 }
742}
743
744impl futures::Stream for DeviceRequestStream {
745 type Item = Result<DeviceRequest, fidl::Error>;
746
747 fn poll_next(
748 mut self: std::pin::Pin<&mut Self>,
749 cx: &mut std::task::Context<'_>,
750 ) -> std::task::Poll<Option<Self::Item>> {
751 let this = &mut *self;
752 if this.inner.check_shutdown(cx) {
753 this.is_terminated = true;
754 return std::task::Poll::Ready(None);
755 }
756 if this.is_terminated {
757 panic!("polled DeviceRequestStream after completion");
758 }
759 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
760 |bytes, handles| {
761 match this.inner.channel().read_etc(cx, bytes, handles) {
762 std::task::Poll::Ready(Ok(())) => {}
763 std::task::Poll::Pending => return std::task::Poll::Pending,
764 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
765 this.is_terminated = true;
766 return std::task::Poll::Ready(None);
767 }
768 std::task::Poll::Ready(Err(e)) => {
769 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
770 e.into(),
771 ))));
772 }
773 }
774
775 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
777
778 std::task::Poll::Ready(Some(match header.ordinal {
779 0x74b18fb8e6277e6e => {
780 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
781 let mut req = fidl::new_empty!(
782 DeviceSetCallbackRequest,
783 fidl::encoding::DefaultFuchsiaResourceDialect
784 );
785 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetCallbackRequest>(&header, _body_bytes, handles, &mut req)?;
786 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
787 Ok(DeviceRequest::SetCallback {
788 callback: req.callback,
789
790 responder: DeviceSetCallbackResponder {
791 control_handle: std::mem::ManuallyDrop::new(control_handle),
792 tx_id: header.tx_id,
793 },
794 })
795 }
796 _ => Err(fidl::Error::UnknownOrdinal {
797 ordinal: header.ordinal,
798 protocol_name:
799 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
800 }),
801 }))
802 },
803 )
804 }
805}
806
807#[derive(Debug)]
808pub enum DeviceRequest {
809 SetCallback {
810 callback: fidl::endpoints::ClientEnd<CallbackMarker>,
811 responder: DeviceSetCallbackResponder,
812 },
813}
814
815impl DeviceRequest {
816 #[allow(irrefutable_let_patterns)]
817 pub fn into_set_callback(
818 self,
819 ) -> Option<(fidl::endpoints::ClientEnd<CallbackMarker>, DeviceSetCallbackResponder)> {
820 if let DeviceRequest::SetCallback { callback, responder } = self {
821 Some((callback, responder))
822 } else {
823 None
824 }
825 }
826
827 pub fn method_name(&self) -> &'static str {
829 match *self {
830 DeviceRequest::SetCallback { .. } => "set_callback",
831 }
832 }
833}
834
835#[derive(Debug, Clone)]
836pub struct DeviceControlHandle {
837 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
838}
839
840impl DeviceControlHandle {
841 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
842 self.inner.shutdown_with_epitaph(status.into())
843 }
844}
845
846impl fidl::endpoints::ControlHandle for DeviceControlHandle {
847 fn shutdown(&self) {
848 self.inner.shutdown()
849 }
850
851 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
852 self.inner.shutdown_with_epitaph(status)
853 }
854
855 fn is_closed(&self) -> bool {
856 self.inner.channel().is_closed()
857 }
858 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
859 self.inner.channel().on_closed()
860 }
861
862 #[cfg(target_os = "fuchsia")]
863 fn signal_peer(
864 &self,
865 clear_mask: zx::Signals,
866 set_mask: zx::Signals,
867 ) -> Result<(), zx_status::Status> {
868 use fidl::Peered;
869 self.inner.channel().signal_peer(clear_mask, set_mask)
870 }
871}
872
873impl DeviceControlHandle {}
874
875#[must_use = "FIDL methods require a response to be sent"]
876#[derive(Debug)]
877pub struct DeviceSetCallbackResponder {
878 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
879 tx_id: u32,
880}
881
882impl std::ops::Drop for DeviceSetCallbackResponder {
886 fn drop(&mut self) {
887 self.control_handle.shutdown();
888 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
890 }
891}
892
893impl fidl::endpoints::Responder for DeviceSetCallbackResponder {
894 type ControlHandle = DeviceControlHandle;
895
896 fn control_handle(&self) -> &DeviceControlHandle {
897 &self.control_handle
898 }
899
900 fn drop_without_shutdown(mut self) {
901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
903 std::mem::forget(self);
905 }
906}
907
908impl DeviceSetCallbackResponder {
909 pub fn send(self) -> Result<(), fidl::Error> {
913 let _result = self.send_raw();
914 if _result.is_err() {
915 self.control_handle.shutdown();
916 }
917 self.drop_without_shutdown();
918 _result
919 }
920
921 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
923 let _result = self.send_raw();
924 self.drop_without_shutdown();
925 _result
926 }
927
928 fn send_raw(&self) -> Result<(), fidl::Error> {
929 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
930 (),
931 self.tx_id,
932 0x74b18fb8e6277e6e,
933 fidl::encoding::DynamicFlags::empty(),
934 )
935 }
936}
937
938#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
939pub struct UsbMarker;
940
941impl fidl::endpoints::ProtocolMarker for UsbMarker {
942 type Proxy = UsbProxy;
943 type RequestStream = UsbRequestStream;
944 #[cfg(target_os = "fuchsia")]
945 type SynchronousProxy = UsbSynchronousProxy;
946
947 const DEBUG_NAME: &'static str = "(anonymous) Usb";
948}
949
950pub trait UsbProxyInterface: Send + Sync {
951 type SetCallbackResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
952 fn r#set_callback(
953 &self,
954 callback: fidl::endpoints::ClientEnd<CallbackMarker>,
955 ) -> Self::SetCallbackResponseFut;
956}
957#[derive(Debug)]
958#[cfg(target_os = "fuchsia")]
959pub struct UsbSynchronousProxy {
960 client: fidl::client::sync::Client,
961}
962
963#[cfg(target_os = "fuchsia")]
964impl fidl::endpoints::SynchronousProxy for UsbSynchronousProxy {
965 type Proxy = UsbProxy;
966 type Protocol = UsbMarker;
967
968 fn from_channel(inner: fidl::Channel) -> Self {
969 Self::new(inner)
970 }
971
972 fn into_channel(self) -> fidl::Channel {
973 self.client.into_channel()
974 }
975
976 fn as_channel(&self) -> &fidl::Channel {
977 self.client.as_channel()
978 }
979}
980
981#[cfg(target_os = "fuchsia")]
982impl UsbSynchronousProxy {
983 pub fn new(channel: fidl::Channel) -> Self {
984 Self { client: fidl::client::sync::Client::new(channel) }
985 }
986
987 pub fn into_channel(self) -> fidl::Channel {
988 self.client.into_channel()
989 }
990
991 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<UsbEvent, fidl::Error> {
994 UsbEvent::decode(self.client.wait_for_event::<UsbMarker>(deadline)?)
995 }
996
997 pub fn r#set_callback(
998 &self,
999 mut callback: fidl::endpoints::ClientEnd<CallbackMarker>,
1000 ___deadline: zx::MonotonicInstant,
1001 ) -> Result<(), fidl::Error> {
1002 let _response = self
1003 .client
1004 .send_query::<UsbSetCallbackRequest, fidl::encoding::EmptyPayload, UsbMarker>(
1005 (callback,),
1006 0x774f2f7d70d46a73,
1007 fidl::encoding::DynamicFlags::empty(),
1008 ___deadline,
1009 )?;
1010 Ok(_response)
1011 }
1012}
1013
1014#[cfg(target_os = "fuchsia")]
1015impl From<UsbSynchronousProxy> for zx::NullableHandle {
1016 fn from(value: UsbSynchronousProxy) -> Self {
1017 value.into_channel().into()
1018 }
1019}
1020
1021#[cfg(target_os = "fuchsia")]
1022impl From<fidl::Channel> for UsbSynchronousProxy {
1023 fn from(value: fidl::Channel) -> Self {
1024 Self::new(value)
1025 }
1026}
1027
1028#[cfg(target_os = "fuchsia")]
1029impl fidl::endpoints::FromClient for UsbSynchronousProxy {
1030 type Protocol = UsbMarker;
1031
1032 fn from_client(value: fidl::endpoints::ClientEnd<UsbMarker>) -> Self {
1033 Self::new(value.into_channel())
1034 }
1035}
1036
1037#[derive(Debug, Clone)]
1038pub struct UsbProxy {
1039 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1040}
1041
1042impl fidl::endpoints::Proxy for UsbProxy {
1043 type Protocol = UsbMarker;
1044
1045 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1046 Self::new(inner)
1047 }
1048
1049 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1050 self.client.into_channel().map_err(|client| Self { client })
1051 }
1052
1053 fn as_channel(&self) -> &::fidl::AsyncChannel {
1054 self.client.as_channel()
1055 }
1056}
1057
1058impl UsbProxy {
1059 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1061 let protocol_name = <UsbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1062 Self { client: fidl::client::Client::new(channel, protocol_name) }
1063 }
1064
1065 pub fn take_event_stream(&self) -> UsbEventStream {
1071 UsbEventStream { event_receiver: self.client.take_event_receiver() }
1072 }
1073
1074 pub fn r#set_callback(
1075 &self,
1076 mut callback: fidl::endpoints::ClientEnd<CallbackMarker>,
1077 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1078 UsbProxyInterface::r#set_callback(self, callback)
1079 }
1080}
1081
1082impl UsbProxyInterface for UsbProxy {
1083 type SetCallbackResponseFut =
1084 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1085 fn r#set_callback(
1086 &self,
1087 mut callback: fidl::endpoints::ClientEnd<CallbackMarker>,
1088 ) -> Self::SetCallbackResponseFut {
1089 fn _decode(
1090 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1091 ) -> Result<(), fidl::Error> {
1092 let _response = fidl::client::decode_transaction_body::<
1093 fidl::encoding::EmptyPayload,
1094 fidl::encoding::DefaultFuchsiaResourceDialect,
1095 0x774f2f7d70d46a73,
1096 >(_buf?)?;
1097 Ok(_response)
1098 }
1099 self.client.send_query_and_decode::<UsbSetCallbackRequest, ()>(
1100 (callback,),
1101 0x774f2f7d70d46a73,
1102 fidl::encoding::DynamicFlags::empty(),
1103 _decode,
1104 )
1105 }
1106}
1107
1108pub struct UsbEventStream {
1109 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1110}
1111
1112impl std::marker::Unpin for UsbEventStream {}
1113
1114impl futures::stream::FusedStream for UsbEventStream {
1115 fn is_terminated(&self) -> bool {
1116 self.event_receiver.is_terminated()
1117 }
1118}
1119
1120impl futures::Stream for UsbEventStream {
1121 type Item = Result<UsbEvent, fidl::Error>;
1122
1123 fn poll_next(
1124 mut self: std::pin::Pin<&mut Self>,
1125 cx: &mut std::task::Context<'_>,
1126 ) -> std::task::Poll<Option<Self::Item>> {
1127 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1128 &mut self.event_receiver,
1129 cx
1130 )?) {
1131 Some(buf) => std::task::Poll::Ready(Some(UsbEvent::decode(buf))),
1132 None => std::task::Poll::Ready(None),
1133 }
1134 }
1135}
1136
1137#[derive(Debug)]
1138pub enum UsbEvent {}
1139
1140impl UsbEvent {
1141 fn decode(
1143 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1144 ) -> Result<UsbEvent, fidl::Error> {
1145 let (bytes, _handles) = buf.split_mut();
1146 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1147 debug_assert_eq!(tx_header.tx_id, 0);
1148 match tx_header.ordinal {
1149 _ => Err(fidl::Error::UnknownOrdinal {
1150 ordinal: tx_header.ordinal,
1151 protocol_name: <UsbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1152 }),
1153 }
1154 }
1155}
1156
1157pub struct UsbRequestStream {
1159 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1160 is_terminated: bool,
1161}
1162
1163impl std::marker::Unpin for UsbRequestStream {}
1164
1165impl futures::stream::FusedStream for UsbRequestStream {
1166 fn is_terminated(&self) -> bool {
1167 self.is_terminated
1168 }
1169}
1170
1171impl fidl::endpoints::RequestStream for UsbRequestStream {
1172 type Protocol = UsbMarker;
1173 type ControlHandle = UsbControlHandle;
1174
1175 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1176 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1177 }
1178
1179 fn control_handle(&self) -> Self::ControlHandle {
1180 UsbControlHandle { inner: self.inner.clone() }
1181 }
1182
1183 fn into_inner(
1184 self,
1185 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1186 {
1187 (self.inner, self.is_terminated)
1188 }
1189
1190 fn from_inner(
1191 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1192 is_terminated: bool,
1193 ) -> Self {
1194 Self { inner, is_terminated }
1195 }
1196}
1197
1198impl futures::Stream for UsbRequestStream {
1199 type Item = Result<UsbRequest, fidl::Error>;
1200
1201 fn poll_next(
1202 mut self: std::pin::Pin<&mut Self>,
1203 cx: &mut std::task::Context<'_>,
1204 ) -> std::task::Poll<Option<Self::Item>> {
1205 let this = &mut *self;
1206 if this.inner.check_shutdown(cx) {
1207 this.is_terminated = true;
1208 return std::task::Poll::Ready(None);
1209 }
1210 if this.is_terminated {
1211 panic!("polled UsbRequestStream after completion");
1212 }
1213 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1214 |bytes, handles| {
1215 match this.inner.channel().read_etc(cx, bytes, handles) {
1216 std::task::Poll::Ready(Ok(())) => {}
1217 std::task::Poll::Pending => return std::task::Poll::Pending,
1218 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1219 this.is_terminated = true;
1220 return std::task::Poll::Ready(None);
1221 }
1222 std::task::Poll::Ready(Err(e)) => {
1223 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1224 e.into(),
1225 ))));
1226 }
1227 }
1228
1229 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1231
1232 std::task::Poll::Ready(Some(match header.ordinal {
1233 0x774f2f7d70d46a73 => {
1234 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1235 let mut req = fidl::new_empty!(
1236 UsbSetCallbackRequest,
1237 fidl::encoding::DefaultFuchsiaResourceDialect
1238 );
1239 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbSetCallbackRequest>(&header, _body_bytes, handles, &mut req)?;
1240 let control_handle = UsbControlHandle { inner: this.inner.clone() };
1241 Ok(UsbRequest::SetCallback {
1242 callback: req.callback,
1243
1244 responder: UsbSetCallbackResponder {
1245 control_handle: std::mem::ManuallyDrop::new(control_handle),
1246 tx_id: header.tx_id,
1247 },
1248 })
1249 }
1250 _ => Err(fidl::Error::UnknownOrdinal {
1251 ordinal: header.ordinal,
1252 protocol_name: <UsbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1253 }),
1254 }))
1255 },
1256 )
1257 }
1258}
1259
1260#[derive(Debug)]
1261pub enum UsbRequest {
1262 SetCallback {
1263 callback: fidl::endpoints::ClientEnd<CallbackMarker>,
1264 responder: UsbSetCallbackResponder,
1265 },
1266}
1267
1268impl UsbRequest {
1269 #[allow(irrefutable_let_patterns)]
1270 pub fn into_set_callback(
1271 self,
1272 ) -> Option<(fidl::endpoints::ClientEnd<CallbackMarker>, UsbSetCallbackResponder)> {
1273 if let UsbRequest::SetCallback { callback, responder } = self {
1274 Some((callback, responder))
1275 } else {
1276 None
1277 }
1278 }
1279
1280 pub fn method_name(&self) -> &'static str {
1282 match *self {
1283 UsbRequest::SetCallback { .. } => "set_callback",
1284 }
1285 }
1286}
1287
1288#[derive(Debug, Clone)]
1289pub struct UsbControlHandle {
1290 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1291}
1292
1293impl UsbControlHandle {
1294 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1295 self.inner.shutdown_with_epitaph(status.into())
1296 }
1297}
1298
1299impl fidl::endpoints::ControlHandle for UsbControlHandle {
1300 fn shutdown(&self) {
1301 self.inner.shutdown()
1302 }
1303
1304 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1305 self.inner.shutdown_with_epitaph(status)
1306 }
1307
1308 fn is_closed(&self) -> bool {
1309 self.inner.channel().is_closed()
1310 }
1311 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1312 self.inner.channel().on_closed()
1313 }
1314
1315 #[cfg(target_os = "fuchsia")]
1316 fn signal_peer(
1317 &self,
1318 clear_mask: zx::Signals,
1319 set_mask: zx::Signals,
1320 ) -> Result<(), zx_status::Status> {
1321 use fidl::Peered;
1322 self.inner.channel().signal_peer(clear_mask, set_mask)
1323 }
1324}
1325
1326impl UsbControlHandle {}
1327
1328#[must_use = "FIDL methods require a response to be sent"]
1329#[derive(Debug)]
1330pub struct UsbSetCallbackResponder {
1331 control_handle: std::mem::ManuallyDrop<UsbControlHandle>,
1332 tx_id: u32,
1333}
1334
1335impl std::ops::Drop for UsbSetCallbackResponder {
1339 fn drop(&mut self) {
1340 self.control_handle.shutdown();
1341 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1343 }
1344}
1345
1346impl fidl::endpoints::Responder for UsbSetCallbackResponder {
1347 type ControlHandle = UsbControlHandle;
1348
1349 fn control_handle(&self) -> &UsbControlHandle {
1350 &self.control_handle
1351 }
1352
1353 fn drop_without_shutdown(mut self) {
1354 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1356 std::mem::forget(self);
1358 }
1359}
1360
1361impl UsbSetCallbackResponder {
1362 pub fn send(self) -> Result<(), fidl::Error> {
1366 let _result = self.send_raw();
1367 if _result.is_err() {
1368 self.control_handle.shutdown();
1369 }
1370 self.drop_without_shutdown();
1371 _result
1372 }
1373
1374 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1376 let _result = self.send_raw();
1377 self.drop_without_shutdown();
1378 _result
1379 }
1380
1381 fn send_raw(&self) -> Result<(), fidl::Error> {
1382 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1383 (),
1384 self.tx_id,
1385 0x774f2f7d70d46a73,
1386 fidl::encoding::DynamicFlags::empty(),
1387 )
1388 }
1389}
1390
1391#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1392pub struct ServiceMarker;
1393
1394#[cfg(target_os = "fuchsia")]
1395impl fidl::endpoints::ServiceMarker for ServiceMarker {
1396 type Proxy = ServiceProxy;
1397 type Request = ServiceRequest;
1398 const SERVICE_NAME: &'static str = "fuchsia.hardware.vsockbridge.Service";
1399}
1400
1401#[cfg(target_os = "fuchsia")]
1404pub enum ServiceRequest {
1405 Device(DeviceRequestStream),
1406}
1407
1408#[cfg(target_os = "fuchsia")]
1409impl fidl::endpoints::ServiceRequest for ServiceRequest {
1410 type Service = ServiceMarker;
1411
1412 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1413 match name {
1414 "device" => Self::Device(
1415 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1416 ),
1417 _ => panic!("no such member protocol name for service Service"),
1418 }
1419 }
1420
1421 fn member_names() -> &'static [&'static str] {
1422 &["device"]
1423 }
1424}
1425#[cfg(target_os = "fuchsia")]
1426pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1427
1428#[cfg(target_os = "fuchsia")]
1429impl fidl::endpoints::ServiceProxy for ServiceProxy {
1430 type Service = ServiceMarker;
1431
1432 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1433 Self(opener)
1434 }
1435}
1436
1437#[cfg(target_os = "fuchsia")]
1438impl ServiceProxy {
1439 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1440 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1441 self.connect_channel_to_device(server_end)?;
1442 Ok(proxy)
1443 }
1444
1445 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1448 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1449 self.connect_channel_to_device(server_end)?;
1450 Ok(proxy)
1451 }
1452
1453 pub fn connect_channel_to_device(
1456 &self,
1457 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1458 ) -> Result<(), fidl::Error> {
1459 self.0.open_member("device", server_end.into_channel())
1460 }
1461
1462 pub fn instance_name(&self) -> &str {
1463 self.0.instance_name()
1464 }
1465}
1466
1467#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1468pub struct UsbServiceMarker;
1469
1470#[cfg(target_os = "fuchsia")]
1471impl fidl::endpoints::ServiceMarker for UsbServiceMarker {
1472 type Proxy = UsbServiceProxy;
1473 type Request = UsbServiceRequest;
1474 const SERVICE_NAME: &'static str = "fuchsia.hardware.vsockbridge.UsbService";
1475}
1476
1477#[cfg(target_os = "fuchsia")]
1480pub enum UsbServiceRequest {
1481 Device(UsbRequestStream),
1482}
1483
1484#[cfg(target_os = "fuchsia")]
1485impl fidl::endpoints::ServiceRequest for UsbServiceRequest {
1486 type Service = UsbServiceMarker;
1487
1488 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1489 match name {
1490 "device" => Self::Device(
1491 <UsbRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1492 ),
1493 _ => panic!("no such member protocol name for service UsbService"),
1494 }
1495 }
1496
1497 fn member_names() -> &'static [&'static str] {
1498 &["device"]
1499 }
1500}
1501#[cfg(target_os = "fuchsia")]
1502pub struct UsbServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1503
1504#[cfg(target_os = "fuchsia")]
1505impl fidl::endpoints::ServiceProxy for UsbServiceProxy {
1506 type Service = UsbServiceMarker;
1507
1508 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1509 Self(opener)
1510 }
1511}
1512
1513#[cfg(target_os = "fuchsia")]
1514impl UsbServiceProxy {
1515 pub fn connect_to_device(&self) -> Result<UsbProxy, fidl::Error> {
1516 let (proxy, server_end) = fidl::endpoints::create_proxy::<UsbMarker>();
1517 self.connect_channel_to_device(server_end)?;
1518 Ok(proxy)
1519 }
1520
1521 pub fn connect_to_device_sync(&self) -> Result<UsbSynchronousProxy, fidl::Error> {
1524 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<UsbMarker>();
1525 self.connect_channel_to_device(server_end)?;
1526 Ok(proxy)
1527 }
1528
1529 pub fn connect_channel_to_device(
1532 &self,
1533 server_end: fidl::endpoints::ServerEnd<UsbMarker>,
1534 ) -> Result<(), fidl::Error> {
1535 self.0.open_member("device", server_end.into_channel())
1536 }
1537
1538 pub fn instance_name(&self) -> &str {
1539 self.0.instance_name()
1540 }
1541}
1542
1543mod internal {
1544 use super::*;
1545
1546 impl fidl::encoding::ResourceTypeMarker for CallbackNewLinkRequest {
1547 type Borrowed<'a> = &'a mut Self;
1548 fn take_or_borrow<'a>(
1549 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1550 ) -> Self::Borrowed<'a> {
1551 value
1552 }
1553 }
1554
1555 unsafe impl fidl::encoding::TypeMarker for CallbackNewLinkRequest {
1556 type Owned = Self;
1557
1558 #[inline(always)]
1559 fn inline_align(_context: fidl::encoding::Context) -> usize {
1560 4
1561 }
1562
1563 #[inline(always)]
1564 fn inline_size(_context: fidl::encoding::Context) -> usize {
1565 4
1566 }
1567 }
1568
1569 unsafe impl
1570 fidl::encoding::Encode<
1571 CallbackNewLinkRequest,
1572 fidl::encoding::DefaultFuchsiaResourceDialect,
1573 > for &mut CallbackNewLinkRequest
1574 {
1575 #[inline]
1576 unsafe fn encode(
1577 self,
1578 encoder: &mut fidl::encoding::Encoder<
1579 '_,
1580 fidl::encoding::DefaultFuchsiaResourceDialect,
1581 >,
1582 offset: usize,
1583 _depth: fidl::encoding::Depth,
1584 ) -> fidl::Result<()> {
1585 encoder.debug_check_bounds::<CallbackNewLinkRequest>(offset);
1586 fidl::encoding::Encode::<
1588 CallbackNewLinkRequest,
1589 fidl::encoding::DefaultFuchsiaResourceDialect,
1590 >::encode(
1591 (<fidl::encoding::HandleType<
1592 fidl::Socket,
1593 { fidl::ObjectType::SOCKET.into_raw() },
1594 2147483648,
1595 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1596 &mut self.socket
1597 ),),
1598 encoder,
1599 offset,
1600 _depth,
1601 )
1602 }
1603 }
1604 unsafe impl<
1605 T0: fidl::encoding::Encode<
1606 fidl::encoding::HandleType<
1607 fidl::Socket,
1608 { fidl::ObjectType::SOCKET.into_raw() },
1609 2147483648,
1610 >,
1611 fidl::encoding::DefaultFuchsiaResourceDialect,
1612 >,
1613 >
1614 fidl::encoding::Encode<
1615 CallbackNewLinkRequest,
1616 fidl::encoding::DefaultFuchsiaResourceDialect,
1617 > for (T0,)
1618 {
1619 #[inline]
1620 unsafe fn encode(
1621 self,
1622 encoder: &mut fidl::encoding::Encoder<
1623 '_,
1624 fidl::encoding::DefaultFuchsiaResourceDialect,
1625 >,
1626 offset: usize,
1627 depth: fidl::encoding::Depth,
1628 ) -> fidl::Result<()> {
1629 encoder.debug_check_bounds::<CallbackNewLinkRequest>(offset);
1630 self.0.encode(encoder, offset + 0, depth)?;
1634 Ok(())
1635 }
1636 }
1637
1638 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1639 for CallbackNewLinkRequest
1640 {
1641 #[inline(always)]
1642 fn new_empty() -> Self {
1643 Self {
1644 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1645 }
1646 }
1647
1648 #[inline]
1649 unsafe fn decode(
1650 &mut self,
1651 decoder: &mut fidl::encoding::Decoder<
1652 '_,
1653 fidl::encoding::DefaultFuchsiaResourceDialect,
1654 >,
1655 offset: usize,
1656 _depth: fidl::encoding::Depth,
1657 ) -> fidl::Result<()> {
1658 decoder.debug_check_bounds::<Self>(offset);
1659 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
1661 Ok(())
1662 }
1663 }
1664
1665 impl fidl::encoding::ResourceTypeMarker for DeviceSetCallbackRequest {
1666 type Borrowed<'a> = &'a mut Self;
1667 fn take_or_borrow<'a>(
1668 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1669 ) -> Self::Borrowed<'a> {
1670 value
1671 }
1672 }
1673
1674 unsafe impl fidl::encoding::TypeMarker for DeviceSetCallbackRequest {
1675 type Owned = Self;
1676
1677 #[inline(always)]
1678 fn inline_align(_context: fidl::encoding::Context) -> usize {
1679 4
1680 }
1681
1682 #[inline(always)]
1683 fn inline_size(_context: fidl::encoding::Context) -> usize {
1684 4
1685 }
1686 }
1687
1688 unsafe impl
1689 fidl::encoding::Encode<
1690 DeviceSetCallbackRequest,
1691 fidl::encoding::DefaultFuchsiaResourceDialect,
1692 > for &mut DeviceSetCallbackRequest
1693 {
1694 #[inline]
1695 unsafe fn encode(
1696 self,
1697 encoder: &mut fidl::encoding::Encoder<
1698 '_,
1699 fidl::encoding::DefaultFuchsiaResourceDialect,
1700 >,
1701 offset: usize,
1702 _depth: fidl::encoding::Depth,
1703 ) -> fidl::Result<()> {
1704 encoder.debug_check_bounds::<DeviceSetCallbackRequest>(offset);
1705 fidl::encoding::Encode::<DeviceSetCallbackRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1707 (
1708 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.callback),
1709 ),
1710 encoder, offset, _depth
1711 )
1712 }
1713 }
1714 unsafe impl<
1715 T0: fidl::encoding::Encode<
1716 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>>,
1717 fidl::encoding::DefaultFuchsiaResourceDialect,
1718 >,
1719 >
1720 fidl::encoding::Encode<
1721 DeviceSetCallbackRequest,
1722 fidl::encoding::DefaultFuchsiaResourceDialect,
1723 > for (T0,)
1724 {
1725 #[inline]
1726 unsafe fn encode(
1727 self,
1728 encoder: &mut fidl::encoding::Encoder<
1729 '_,
1730 fidl::encoding::DefaultFuchsiaResourceDialect,
1731 >,
1732 offset: usize,
1733 depth: fidl::encoding::Depth,
1734 ) -> fidl::Result<()> {
1735 encoder.debug_check_bounds::<DeviceSetCallbackRequest>(offset);
1736 self.0.encode(encoder, offset + 0, depth)?;
1740 Ok(())
1741 }
1742 }
1743
1744 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1745 for DeviceSetCallbackRequest
1746 {
1747 #[inline(always)]
1748 fn new_empty() -> Self {
1749 Self {
1750 callback: fidl::new_empty!(
1751 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>>,
1752 fidl::encoding::DefaultFuchsiaResourceDialect
1753 ),
1754 }
1755 }
1756
1757 #[inline]
1758 unsafe fn decode(
1759 &mut self,
1760 decoder: &mut fidl::encoding::Decoder<
1761 '_,
1762 fidl::encoding::DefaultFuchsiaResourceDialect,
1763 >,
1764 offset: usize,
1765 _depth: fidl::encoding::Depth,
1766 ) -> fidl::Result<()> {
1767 decoder.debug_check_bounds::<Self>(offset);
1768 fidl::decode!(
1770 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>>,
1771 fidl::encoding::DefaultFuchsiaResourceDialect,
1772 &mut self.callback,
1773 decoder,
1774 offset + 0,
1775 _depth
1776 )?;
1777 Ok(())
1778 }
1779 }
1780
1781 impl fidl::encoding::ResourceTypeMarker for UsbSetCallbackRequest {
1782 type Borrowed<'a> = &'a mut Self;
1783 fn take_or_borrow<'a>(
1784 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1785 ) -> Self::Borrowed<'a> {
1786 value
1787 }
1788 }
1789
1790 unsafe impl fidl::encoding::TypeMarker for UsbSetCallbackRequest {
1791 type Owned = Self;
1792
1793 #[inline(always)]
1794 fn inline_align(_context: fidl::encoding::Context) -> usize {
1795 4
1796 }
1797
1798 #[inline(always)]
1799 fn inline_size(_context: fidl::encoding::Context) -> usize {
1800 4
1801 }
1802 }
1803
1804 unsafe impl
1805 fidl::encoding::Encode<UsbSetCallbackRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1806 for &mut UsbSetCallbackRequest
1807 {
1808 #[inline]
1809 unsafe fn encode(
1810 self,
1811 encoder: &mut fidl::encoding::Encoder<
1812 '_,
1813 fidl::encoding::DefaultFuchsiaResourceDialect,
1814 >,
1815 offset: usize,
1816 _depth: fidl::encoding::Depth,
1817 ) -> fidl::Result<()> {
1818 encoder.debug_check_bounds::<UsbSetCallbackRequest>(offset);
1819 fidl::encoding::Encode::<UsbSetCallbackRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1821 (
1822 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.callback),
1823 ),
1824 encoder, offset, _depth
1825 )
1826 }
1827 }
1828 unsafe impl<
1829 T0: fidl::encoding::Encode<
1830 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>>,
1831 fidl::encoding::DefaultFuchsiaResourceDialect,
1832 >,
1833 >
1834 fidl::encoding::Encode<UsbSetCallbackRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1835 for (T0,)
1836 {
1837 #[inline]
1838 unsafe fn encode(
1839 self,
1840 encoder: &mut fidl::encoding::Encoder<
1841 '_,
1842 fidl::encoding::DefaultFuchsiaResourceDialect,
1843 >,
1844 offset: usize,
1845 depth: fidl::encoding::Depth,
1846 ) -> fidl::Result<()> {
1847 encoder.debug_check_bounds::<UsbSetCallbackRequest>(offset);
1848 self.0.encode(encoder, offset + 0, depth)?;
1852 Ok(())
1853 }
1854 }
1855
1856 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1857 for UsbSetCallbackRequest
1858 {
1859 #[inline(always)]
1860 fn new_empty() -> Self {
1861 Self {
1862 callback: fidl::new_empty!(
1863 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>>,
1864 fidl::encoding::DefaultFuchsiaResourceDialect
1865 ),
1866 }
1867 }
1868
1869 #[inline]
1870 unsafe fn decode(
1871 &mut self,
1872 decoder: &mut fidl::encoding::Decoder<
1873 '_,
1874 fidl::encoding::DefaultFuchsiaResourceDialect,
1875 >,
1876 offset: usize,
1877 _depth: fidl::encoding::Depth,
1878 ) -> fidl::Result<()> {
1879 decoder.debug_check_bounds::<Self>(offset);
1880 fidl::decode!(
1882 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbackMarker>>,
1883 fidl::encoding::DefaultFuchsiaResourceDialect,
1884 &mut self.callback,
1885 decoder,
1886 offset + 0,
1887 _depth
1888 )?;
1889 Ok(())
1890 }
1891 }
1892}