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