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_vsock_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceSendRequestRequest {
16 pub addr: Addr,
17 pub data: fidl::Socket,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceSendRequestRequest {}
21
22#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct DeviceSendResponseRequest {
24 pub addr: Addr,
25 pub data: fidl::Socket,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceSendResponseRequest {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct DeviceStartRequest {
32 pub cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceStartRequest {}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct CallbacksMarker;
39
40impl fidl::endpoints::ProtocolMarker for CallbacksMarker {
41 type Proxy = CallbacksProxy;
42 type RequestStream = CallbacksRequestStream;
43 #[cfg(target_os = "fuchsia")]
44 type SynchronousProxy = CallbacksSynchronousProxy;
45
46 const DEBUG_NAME: &'static str = "(anonymous) Callbacks";
47}
48
49pub trait CallbacksProxyInterface: Send + Sync {
50 fn r#request(&self, addr: &Addr) -> Result<(), fidl::Error>;
51 fn r#response(&self, addr: &Addr) -> Result<(), fidl::Error>;
52 fn r#rst(&self, addr: &Addr) -> Result<(), fidl::Error>;
53 fn r#shutdown(&self, addr: &Addr) -> Result<(), fidl::Error>;
54 type TransportResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
55 fn r#transport_reset(&self, new_cid: u32) -> Self::TransportResetResponseFut;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct CallbacksSynchronousProxy {
60 client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for CallbacksSynchronousProxy {
65 type Proxy = CallbacksProxy;
66 type Protocol = CallbacksMarker;
67
68 fn from_channel(inner: fidl::Channel) -> Self {
69 Self::new(inner)
70 }
71
72 fn into_channel(self) -> fidl::Channel {
73 self.client.into_channel()
74 }
75
76 fn as_channel(&self) -> &fidl::Channel {
77 self.client.as_channel()
78 }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl CallbacksSynchronousProxy {
83 pub fn new(channel: fidl::Channel) -> Self {
84 let protocol_name = <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
85 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
86 }
87
88 pub fn into_channel(self) -> fidl::Channel {
89 self.client.into_channel()
90 }
91
92 pub fn wait_for_event(
95 &self,
96 deadline: zx::MonotonicInstant,
97 ) -> Result<CallbacksEvent, fidl::Error> {
98 CallbacksEvent::decode(self.client.wait_for_event(deadline)?)
99 }
100
101 pub fn r#request(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
102 self.client.send::<CallbacksRequestRequest>(
103 (addr,),
104 0x685918e57418eda8,
105 fidl::encoding::DynamicFlags::empty(),
106 )
107 }
108
109 pub fn r#response(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
110 self.client.send::<CallbacksResponseRequest>(
111 (addr,),
112 0x951dfbcb98699cc,
113 fidl::encoding::DynamicFlags::empty(),
114 )
115 }
116
117 pub fn r#rst(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
118 self.client.send::<CallbacksRstRequest>(
119 (addr,),
120 0x7d6b0a28c75d5568,
121 fidl::encoding::DynamicFlags::empty(),
122 )
123 }
124
125 pub fn r#shutdown(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
126 self.client.send::<CallbacksShutdownRequest>(
127 (addr,),
128 0x6021a72c49ab97cb,
129 fidl::encoding::DynamicFlags::empty(),
130 )
131 }
132
133 pub fn r#transport_reset(
134 &self,
135 mut new_cid: u32,
136 ___deadline: zx::MonotonicInstant,
137 ) -> Result<(), fidl::Error> {
138 let _response = self
139 .client
140 .send_query::<CallbacksTransportResetRequest, fidl::encoding::EmptyPayload>(
141 (new_cid,),
142 0x23ba142d8c6a537,
143 fidl::encoding::DynamicFlags::empty(),
144 ___deadline,
145 )?;
146 Ok(_response)
147 }
148}
149
150#[cfg(target_os = "fuchsia")]
151impl From<CallbacksSynchronousProxy> for zx::Handle {
152 fn from(value: CallbacksSynchronousProxy) -> Self {
153 value.into_channel().into()
154 }
155}
156
157#[cfg(target_os = "fuchsia")]
158impl From<fidl::Channel> for CallbacksSynchronousProxy {
159 fn from(value: fidl::Channel) -> Self {
160 Self::new(value)
161 }
162}
163
164#[derive(Debug, Clone)]
165pub struct CallbacksProxy {
166 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
167}
168
169impl fidl::endpoints::Proxy for CallbacksProxy {
170 type Protocol = CallbacksMarker;
171
172 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
173 Self::new(inner)
174 }
175
176 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
177 self.client.into_channel().map_err(|client| Self { client })
178 }
179
180 fn as_channel(&self) -> &::fidl::AsyncChannel {
181 self.client.as_channel()
182 }
183}
184
185impl CallbacksProxy {
186 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
188 let protocol_name = <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
189 Self { client: fidl::client::Client::new(channel, protocol_name) }
190 }
191
192 pub fn take_event_stream(&self) -> CallbacksEventStream {
198 CallbacksEventStream { event_receiver: self.client.take_event_receiver() }
199 }
200
201 pub fn r#request(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
202 CallbacksProxyInterface::r#request(self, addr)
203 }
204
205 pub fn r#response(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
206 CallbacksProxyInterface::r#response(self, addr)
207 }
208
209 pub fn r#rst(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
210 CallbacksProxyInterface::r#rst(self, addr)
211 }
212
213 pub fn r#shutdown(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
214 CallbacksProxyInterface::r#shutdown(self, addr)
215 }
216
217 pub fn r#transport_reset(
218 &self,
219 mut new_cid: u32,
220 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
221 CallbacksProxyInterface::r#transport_reset(self, new_cid)
222 }
223}
224
225impl CallbacksProxyInterface for CallbacksProxy {
226 fn r#request(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
227 self.client.send::<CallbacksRequestRequest>(
228 (addr,),
229 0x685918e57418eda8,
230 fidl::encoding::DynamicFlags::empty(),
231 )
232 }
233
234 fn r#response(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
235 self.client.send::<CallbacksResponseRequest>(
236 (addr,),
237 0x951dfbcb98699cc,
238 fidl::encoding::DynamicFlags::empty(),
239 )
240 }
241
242 fn r#rst(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
243 self.client.send::<CallbacksRstRequest>(
244 (addr,),
245 0x7d6b0a28c75d5568,
246 fidl::encoding::DynamicFlags::empty(),
247 )
248 }
249
250 fn r#shutdown(&self, mut addr: &Addr) -> Result<(), fidl::Error> {
251 self.client.send::<CallbacksShutdownRequest>(
252 (addr,),
253 0x6021a72c49ab97cb,
254 fidl::encoding::DynamicFlags::empty(),
255 )
256 }
257
258 type TransportResetResponseFut =
259 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
260 fn r#transport_reset(&self, mut new_cid: u32) -> Self::TransportResetResponseFut {
261 fn _decode(
262 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
263 ) -> Result<(), fidl::Error> {
264 let _response = fidl::client::decode_transaction_body::<
265 fidl::encoding::EmptyPayload,
266 fidl::encoding::DefaultFuchsiaResourceDialect,
267 0x23ba142d8c6a537,
268 >(_buf?)?;
269 Ok(_response)
270 }
271 self.client.send_query_and_decode::<CallbacksTransportResetRequest, ()>(
272 (new_cid,),
273 0x23ba142d8c6a537,
274 fidl::encoding::DynamicFlags::empty(),
275 _decode,
276 )
277 }
278}
279
280pub struct CallbacksEventStream {
281 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
282}
283
284impl std::marker::Unpin for CallbacksEventStream {}
285
286impl futures::stream::FusedStream for CallbacksEventStream {
287 fn is_terminated(&self) -> bool {
288 self.event_receiver.is_terminated()
289 }
290}
291
292impl futures::Stream for CallbacksEventStream {
293 type Item = Result<CallbacksEvent, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
300 &mut self.event_receiver,
301 cx
302 )?) {
303 Some(buf) => std::task::Poll::Ready(Some(CallbacksEvent::decode(buf))),
304 None => std::task::Poll::Ready(None),
305 }
306 }
307}
308
309#[derive(Debug)]
310pub enum CallbacksEvent {}
311
312impl CallbacksEvent {
313 fn decode(
315 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
316 ) -> Result<CallbacksEvent, fidl::Error> {
317 let (bytes, _handles) = buf.split_mut();
318 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
319 debug_assert_eq!(tx_header.tx_id, 0);
320 match tx_header.ordinal {
321 _ => Err(fidl::Error::UnknownOrdinal {
322 ordinal: tx_header.ordinal,
323 protocol_name: <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
324 }),
325 }
326 }
327}
328
329pub struct CallbacksRequestStream {
331 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
332 is_terminated: bool,
333}
334
335impl std::marker::Unpin for CallbacksRequestStream {}
336
337impl futures::stream::FusedStream for CallbacksRequestStream {
338 fn is_terminated(&self) -> bool {
339 self.is_terminated
340 }
341}
342
343impl fidl::endpoints::RequestStream for CallbacksRequestStream {
344 type Protocol = CallbacksMarker;
345 type ControlHandle = CallbacksControlHandle;
346
347 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
348 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
349 }
350
351 fn control_handle(&self) -> Self::ControlHandle {
352 CallbacksControlHandle { inner: self.inner.clone() }
353 }
354
355 fn into_inner(
356 self,
357 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
358 {
359 (self.inner, self.is_terminated)
360 }
361
362 fn from_inner(
363 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
364 is_terminated: bool,
365 ) -> Self {
366 Self { inner, is_terminated }
367 }
368}
369
370impl futures::Stream for CallbacksRequestStream {
371 type Item = Result<CallbacksRequest, fidl::Error>;
372
373 fn poll_next(
374 mut self: std::pin::Pin<&mut Self>,
375 cx: &mut std::task::Context<'_>,
376 ) -> std::task::Poll<Option<Self::Item>> {
377 let this = &mut *self;
378 if this.inner.check_shutdown(cx) {
379 this.is_terminated = true;
380 return std::task::Poll::Ready(None);
381 }
382 if this.is_terminated {
383 panic!("polled CallbacksRequestStream after completion");
384 }
385 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
386 |bytes, handles| {
387 match this.inner.channel().read_etc(cx, bytes, handles) {
388 std::task::Poll::Ready(Ok(())) => {}
389 std::task::Poll::Pending => return std::task::Poll::Pending,
390 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
391 this.is_terminated = true;
392 return std::task::Poll::Ready(None);
393 }
394 std::task::Poll::Ready(Err(e)) => {
395 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
396 e.into(),
397 ))))
398 }
399 }
400
401 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
403
404 std::task::Poll::Ready(Some(match header.ordinal {
405 0x685918e57418eda8 => {
406 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
407 let mut req = fidl::new_empty!(
408 CallbacksRequestRequest,
409 fidl::encoding::DefaultFuchsiaResourceDialect
410 );
411 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksRequestRequest>(&header, _body_bytes, handles, &mut req)?;
412 let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
413 Ok(CallbacksRequest::Request { addr: req.addr, control_handle })
414 }
415 0x951dfbcb98699cc => {
416 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
417 let mut req = fidl::new_empty!(
418 CallbacksResponseRequest,
419 fidl::encoding::DefaultFuchsiaResourceDialect
420 );
421 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksResponseRequest>(&header, _body_bytes, handles, &mut req)?;
422 let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
423 Ok(CallbacksRequest::Response { addr: req.addr, control_handle })
424 }
425 0x7d6b0a28c75d5568 => {
426 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
427 let mut req = fidl::new_empty!(
428 CallbacksRstRequest,
429 fidl::encoding::DefaultFuchsiaResourceDialect
430 );
431 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksRstRequest>(&header, _body_bytes, handles, &mut req)?;
432 let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
433 Ok(CallbacksRequest::Rst { addr: req.addr, control_handle })
434 }
435 0x6021a72c49ab97cb => {
436 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
437 let mut req = fidl::new_empty!(
438 CallbacksShutdownRequest,
439 fidl::encoding::DefaultFuchsiaResourceDialect
440 );
441 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
442 let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
443 Ok(CallbacksRequest::Shutdown { addr: req.addr, control_handle })
444 }
445 0x23ba142d8c6a537 => {
446 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
447 let mut req = fidl::new_empty!(
448 CallbacksTransportResetRequest,
449 fidl::encoding::DefaultFuchsiaResourceDialect
450 );
451 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallbacksTransportResetRequest>(&header, _body_bytes, handles, &mut req)?;
452 let control_handle = CallbacksControlHandle { inner: this.inner.clone() };
453 Ok(CallbacksRequest::TransportReset {
454 new_cid: req.new_cid,
455
456 responder: CallbacksTransportResetResponder {
457 control_handle: std::mem::ManuallyDrop::new(control_handle),
458 tx_id: header.tx_id,
459 },
460 })
461 }
462 _ => Err(fidl::Error::UnknownOrdinal {
463 ordinal: header.ordinal,
464 protocol_name:
465 <CallbacksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
466 }),
467 }))
468 },
469 )
470 }
471}
472
473#[derive(Debug)]
474pub enum CallbacksRequest {
475 Request { addr: Addr, control_handle: CallbacksControlHandle },
476 Response { addr: Addr, control_handle: CallbacksControlHandle },
477 Rst { addr: Addr, control_handle: CallbacksControlHandle },
478 Shutdown { addr: Addr, control_handle: CallbacksControlHandle },
479 TransportReset { new_cid: u32, responder: CallbacksTransportResetResponder },
480}
481
482impl CallbacksRequest {
483 #[allow(irrefutable_let_patterns)]
484 pub fn into_request(self) -> Option<(Addr, CallbacksControlHandle)> {
485 if let CallbacksRequest::Request { addr, control_handle } = self {
486 Some((addr, control_handle))
487 } else {
488 None
489 }
490 }
491
492 #[allow(irrefutable_let_patterns)]
493 pub fn into_response(self) -> Option<(Addr, CallbacksControlHandle)> {
494 if let CallbacksRequest::Response { addr, control_handle } = self {
495 Some((addr, control_handle))
496 } else {
497 None
498 }
499 }
500
501 #[allow(irrefutable_let_patterns)]
502 pub fn into_rst(self) -> Option<(Addr, CallbacksControlHandle)> {
503 if let CallbacksRequest::Rst { addr, control_handle } = self {
504 Some((addr, control_handle))
505 } else {
506 None
507 }
508 }
509
510 #[allow(irrefutable_let_patterns)]
511 pub fn into_shutdown(self) -> Option<(Addr, CallbacksControlHandle)> {
512 if let CallbacksRequest::Shutdown { addr, control_handle } = self {
513 Some((addr, control_handle))
514 } else {
515 None
516 }
517 }
518
519 #[allow(irrefutable_let_patterns)]
520 pub fn into_transport_reset(self) -> Option<(u32, CallbacksTransportResetResponder)> {
521 if let CallbacksRequest::TransportReset { new_cid, responder } = self {
522 Some((new_cid, responder))
523 } else {
524 None
525 }
526 }
527
528 pub fn method_name(&self) -> &'static str {
530 match *self {
531 CallbacksRequest::Request { .. } => "request",
532 CallbacksRequest::Response { .. } => "response",
533 CallbacksRequest::Rst { .. } => "rst",
534 CallbacksRequest::Shutdown { .. } => "shutdown",
535 CallbacksRequest::TransportReset { .. } => "transport_reset",
536 }
537 }
538}
539
540#[derive(Debug, Clone)]
541pub struct CallbacksControlHandle {
542 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
543}
544
545impl fidl::endpoints::ControlHandle for CallbacksControlHandle {
546 fn shutdown(&self) {
547 self.inner.shutdown()
548 }
549 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
550 self.inner.shutdown_with_epitaph(status)
551 }
552
553 fn is_closed(&self) -> bool {
554 self.inner.channel().is_closed()
555 }
556 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
557 self.inner.channel().on_closed()
558 }
559
560 #[cfg(target_os = "fuchsia")]
561 fn signal_peer(
562 &self,
563 clear_mask: zx::Signals,
564 set_mask: zx::Signals,
565 ) -> Result<(), zx_status::Status> {
566 use fidl::Peered;
567 self.inner.channel().signal_peer(clear_mask, set_mask)
568 }
569}
570
571impl CallbacksControlHandle {}
572
573#[must_use = "FIDL methods require a response to be sent"]
574#[derive(Debug)]
575pub struct CallbacksTransportResetResponder {
576 control_handle: std::mem::ManuallyDrop<CallbacksControlHandle>,
577 tx_id: u32,
578}
579
580impl std::ops::Drop for CallbacksTransportResetResponder {
584 fn drop(&mut self) {
585 self.control_handle.shutdown();
586 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
588 }
589}
590
591impl fidl::endpoints::Responder for CallbacksTransportResetResponder {
592 type ControlHandle = CallbacksControlHandle;
593
594 fn control_handle(&self) -> &CallbacksControlHandle {
595 &self.control_handle
596 }
597
598 fn drop_without_shutdown(mut self) {
599 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
601 std::mem::forget(self);
603 }
604}
605
606impl CallbacksTransportResetResponder {
607 pub fn send(self) -> Result<(), fidl::Error> {
611 let _result = self.send_raw();
612 if _result.is_err() {
613 self.control_handle.shutdown();
614 }
615 self.drop_without_shutdown();
616 _result
617 }
618
619 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
621 let _result = self.send_raw();
622 self.drop_without_shutdown();
623 _result
624 }
625
626 fn send_raw(&self) -> Result<(), fidl::Error> {
627 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
628 (),
629 self.tx_id,
630 0x23ba142d8c6a537,
631 fidl::encoding::DynamicFlags::empty(),
632 )
633 }
634}
635
636#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
637pub struct DeviceMarker;
638
639impl fidl::endpoints::ProtocolMarker for DeviceMarker {
640 type Proxy = DeviceProxy;
641 type RequestStream = DeviceRequestStream;
642 #[cfg(target_os = "fuchsia")]
643 type SynchronousProxy = DeviceSynchronousProxy;
644
645 const DEBUG_NAME: &'static str = "fuchsia.hardware.vsock.Device";
646}
647impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
648pub type DeviceStartResult = Result<(), i32>;
649pub type DeviceSendRequestResult = Result<(), i32>;
650pub type DeviceSendShutdownResult = Result<(), i32>;
651pub type DeviceSendRstResult = Result<(), i32>;
652pub type DeviceSendResponseResult = Result<(), i32>;
653
654pub trait DeviceProxyInterface: Send + Sync {
655 type StartResponseFut: std::future::Future<Output = Result<DeviceStartResult, fidl::Error>>
656 + Send;
657 fn r#start(&self, cb: fidl::endpoints::ClientEnd<CallbacksMarker>) -> Self::StartResponseFut;
658 type SendRequestResponseFut: std::future::Future<Output = Result<DeviceSendRequestResult, fidl::Error>>
659 + Send;
660 fn r#send_request(&self, addr: &Addr, data: fidl::Socket) -> Self::SendRequestResponseFut;
661 type SendShutdownResponseFut: std::future::Future<Output = Result<DeviceSendShutdownResult, fidl::Error>>
662 + Send;
663 fn r#send_shutdown(&self, addr: &Addr) -> Self::SendShutdownResponseFut;
664 type SendRstResponseFut: std::future::Future<Output = Result<DeviceSendRstResult, fidl::Error>>
665 + Send;
666 fn r#send_rst(&self, addr: &Addr) -> Self::SendRstResponseFut;
667 type SendResponseResponseFut: std::future::Future<Output = Result<DeviceSendResponseResult, fidl::Error>>
668 + Send;
669 fn r#send_response(&self, addr: &Addr, data: fidl::Socket) -> Self::SendResponseResponseFut;
670 type GetCidResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
671 fn r#get_cid(&self) -> Self::GetCidResponseFut;
672}
673#[derive(Debug)]
674#[cfg(target_os = "fuchsia")]
675pub struct DeviceSynchronousProxy {
676 client: fidl::client::sync::Client,
677}
678
679#[cfg(target_os = "fuchsia")]
680impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
681 type Proxy = DeviceProxy;
682 type Protocol = DeviceMarker;
683
684 fn from_channel(inner: fidl::Channel) -> Self {
685 Self::new(inner)
686 }
687
688 fn into_channel(self) -> fidl::Channel {
689 self.client.into_channel()
690 }
691
692 fn as_channel(&self) -> &fidl::Channel {
693 self.client.as_channel()
694 }
695}
696
697#[cfg(target_os = "fuchsia")]
698impl DeviceSynchronousProxy {
699 pub fn new(channel: fidl::Channel) -> Self {
700 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
701 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
702 }
703
704 pub fn into_channel(self) -> fidl::Channel {
705 self.client.into_channel()
706 }
707
708 pub fn wait_for_event(
711 &self,
712 deadline: zx::MonotonicInstant,
713 ) -> Result<DeviceEvent, fidl::Error> {
714 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
715 }
716
717 pub fn r#start(
718 &self,
719 mut cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
720 ___deadline: zx::MonotonicInstant,
721 ) -> Result<DeviceStartResult, fidl::Error> {
722 let _response = self.client.send_query::<
723 DeviceStartRequest,
724 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
725 >(
726 (cb,),
727 0x3bc3faaec6158f27,
728 fidl::encoding::DynamicFlags::empty(),
729 ___deadline,
730 )?;
731 Ok(_response.map(|x| x))
732 }
733
734 pub fn r#send_request(
735 &self,
736 mut addr: &Addr,
737 mut data: fidl::Socket,
738 ___deadline: zx::MonotonicInstant,
739 ) -> Result<DeviceSendRequestResult, fidl::Error> {
740 let _response = self.client.send_query::<
741 DeviceSendRequestRequest,
742 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
743 >(
744 (addr, data,),
745 0x2dc165540021f74d,
746 fidl::encoding::DynamicFlags::empty(),
747 ___deadline,
748 )?;
749 Ok(_response.map(|x| x))
750 }
751
752 pub fn r#send_shutdown(
753 &self,
754 mut addr: &Addr,
755 ___deadline: zx::MonotonicInstant,
756 ) -> Result<DeviceSendShutdownResult, fidl::Error> {
757 let _response = self.client.send_query::<
758 DeviceSendShutdownRequest,
759 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
760 >(
761 (addr,),
762 0x57cdc7b234933b44,
763 fidl::encoding::DynamicFlags::empty(),
764 ___deadline,
765 )?;
766 Ok(_response.map(|x| x))
767 }
768
769 pub fn r#send_rst(
770 &self,
771 mut addr: &Addr,
772 ___deadline: zx::MonotonicInstant,
773 ) -> Result<DeviceSendRstResult, fidl::Error> {
774 let _response = self.client.send_query::<
775 DeviceSendRstRequest,
776 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
777 >(
778 (addr,),
779 0x334e890ef7cd737c,
780 fidl::encoding::DynamicFlags::empty(),
781 ___deadline,
782 )?;
783 Ok(_response.map(|x| x))
784 }
785
786 pub fn r#send_response(
787 &self,
788 mut addr: &Addr,
789 mut data: fidl::Socket,
790 ___deadline: zx::MonotonicInstant,
791 ) -> Result<DeviceSendResponseResult, fidl::Error> {
792 let _response = self.client.send_query::<
793 DeviceSendResponseRequest,
794 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
795 >(
796 (addr, data,),
797 0x487a35133ffe0672,
798 fidl::encoding::DynamicFlags::empty(),
799 ___deadline,
800 )?;
801 Ok(_response.map(|x| x))
802 }
803
804 pub fn r#get_cid(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
805 let _response =
806 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetCidResponse>(
807 (),
808 0x7cf0847a452feafe,
809 fidl::encoding::DynamicFlags::empty(),
810 ___deadline,
811 )?;
812 Ok(_response.local_cid)
813 }
814}
815
816#[cfg(target_os = "fuchsia")]
817impl From<DeviceSynchronousProxy> for zx::Handle {
818 fn from(value: DeviceSynchronousProxy) -> Self {
819 value.into_channel().into()
820 }
821}
822
823#[cfg(target_os = "fuchsia")]
824impl From<fidl::Channel> for DeviceSynchronousProxy {
825 fn from(value: fidl::Channel) -> Self {
826 Self::new(value)
827 }
828}
829
830#[derive(Debug, Clone)]
831pub struct DeviceProxy {
832 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
833}
834
835impl fidl::endpoints::Proxy for DeviceProxy {
836 type Protocol = DeviceMarker;
837
838 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
839 Self::new(inner)
840 }
841
842 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
843 self.client.into_channel().map_err(|client| Self { client })
844 }
845
846 fn as_channel(&self) -> &::fidl::AsyncChannel {
847 self.client.as_channel()
848 }
849}
850
851impl DeviceProxy {
852 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
854 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
855 Self { client: fidl::client::Client::new(channel, protocol_name) }
856 }
857
858 pub fn take_event_stream(&self) -> DeviceEventStream {
864 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
865 }
866
867 pub fn r#start(
868 &self,
869 mut cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
870 ) -> fidl::client::QueryResponseFut<
871 DeviceStartResult,
872 fidl::encoding::DefaultFuchsiaResourceDialect,
873 > {
874 DeviceProxyInterface::r#start(self, cb)
875 }
876
877 pub fn r#send_request(
878 &self,
879 mut addr: &Addr,
880 mut data: fidl::Socket,
881 ) -> fidl::client::QueryResponseFut<
882 DeviceSendRequestResult,
883 fidl::encoding::DefaultFuchsiaResourceDialect,
884 > {
885 DeviceProxyInterface::r#send_request(self, addr, data)
886 }
887
888 pub fn r#send_shutdown(
889 &self,
890 mut addr: &Addr,
891 ) -> fidl::client::QueryResponseFut<
892 DeviceSendShutdownResult,
893 fidl::encoding::DefaultFuchsiaResourceDialect,
894 > {
895 DeviceProxyInterface::r#send_shutdown(self, addr)
896 }
897
898 pub fn r#send_rst(
899 &self,
900 mut addr: &Addr,
901 ) -> fidl::client::QueryResponseFut<
902 DeviceSendRstResult,
903 fidl::encoding::DefaultFuchsiaResourceDialect,
904 > {
905 DeviceProxyInterface::r#send_rst(self, addr)
906 }
907
908 pub fn r#send_response(
909 &self,
910 mut addr: &Addr,
911 mut data: fidl::Socket,
912 ) -> fidl::client::QueryResponseFut<
913 DeviceSendResponseResult,
914 fidl::encoding::DefaultFuchsiaResourceDialect,
915 > {
916 DeviceProxyInterface::r#send_response(self, addr, data)
917 }
918
919 pub fn r#get_cid(
920 &self,
921 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
922 DeviceProxyInterface::r#get_cid(self)
923 }
924}
925
926impl DeviceProxyInterface for DeviceProxy {
927 type StartResponseFut = fidl::client::QueryResponseFut<
928 DeviceStartResult,
929 fidl::encoding::DefaultFuchsiaResourceDialect,
930 >;
931 fn r#start(
932 &self,
933 mut cb: fidl::endpoints::ClientEnd<CallbacksMarker>,
934 ) -> Self::StartResponseFut {
935 fn _decode(
936 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
937 ) -> Result<DeviceStartResult, fidl::Error> {
938 let _response = fidl::client::decode_transaction_body::<
939 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
940 fidl::encoding::DefaultFuchsiaResourceDialect,
941 0x3bc3faaec6158f27,
942 >(_buf?)?;
943 Ok(_response.map(|x| x))
944 }
945 self.client.send_query_and_decode::<DeviceStartRequest, DeviceStartResult>(
946 (cb,),
947 0x3bc3faaec6158f27,
948 fidl::encoding::DynamicFlags::empty(),
949 _decode,
950 )
951 }
952
953 type SendRequestResponseFut = fidl::client::QueryResponseFut<
954 DeviceSendRequestResult,
955 fidl::encoding::DefaultFuchsiaResourceDialect,
956 >;
957 fn r#send_request(
958 &self,
959 mut addr: &Addr,
960 mut data: fidl::Socket,
961 ) -> Self::SendRequestResponseFut {
962 fn _decode(
963 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
964 ) -> Result<DeviceSendRequestResult, fidl::Error> {
965 let _response = fidl::client::decode_transaction_body::<
966 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
967 fidl::encoding::DefaultFuchsiaResourceDialect,
968 0x2dc165540021f74d,
969 >(_buf?)?;
970 Ok(_response.map(|x| x))
971 }
972 self.client.send_query_and_decode::<DeviceSendRequestRequest, DeviceSendRequestResult>(
973 (addr, data),
974 0x2dc165540021f74d,
975 fidl::encoding::DynamicFlags::empty(),
976 _decode,
977 )
978 }
979
980 type SendShutdownResponseFut = fidl::client::QueryResponseFut<
981 DeviceSendShutdownResult,
982 fidl::encoding::DefaultFuchsiaResourceDialect,
983 >;
984 fn r#send_shutdown(&self, mut addr: &Addr) -> Self::SendShutdownResponseFut {
985 fn _decode(
986 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
987 ) -> Result<DeviceSendShutdownResult, fidl::Error> {
988 let _response = fidl::client::decode_transaction_body::<
989 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
990 fidl::encoding::DefaultFuchsiaResourceDialect,
991 0x57cdc7b234933b44,
992 >(_buf?)?;
993 Ok(_response.map(|x| x))
994 }
995 self.client.send_query_and_decode::<DeviceSendShutdownRequest, DeviceSendShutdownResult>(
996 (addr,),
997 0x57cdc7b234933b44,
998 fidl::encoding::DynamicFlags::empty(),
999 _decode,
1000 )
1001 }
1002
1003 type SendRstResponseFut = fidl::client::QueryResponseFut<
1004 DeviceSendRstResult,
1005 fidl::encoding::DefaultFuchsiaResourceDialect,
1006 >;
1007 fn r#send_rst(&self, mut addr: &Addr) -> Self::SendRstResponseFut {
1008 fn _decode(
1009 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1010 ) -> Result<DeviceSendRstResult, fidl::Error> {
1011 let _response = fidl::client::decode_transaction_body::<
1012 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1013 fidl::encoding::DefaultFuchsiaResourceDialect,
1014 0x334e890ef7cd737c,
1015 >(_buf?)?;
1016 Ok(_response.map(|x| x))
1017 }
1018 self.client.send_query_and_decode::<DeviceSendRstRequest, DeviceSendRstResult>(
1019 (addr,),
1020 0x334e890ef7cd737c,
1021 fidl::encoding::DynamicFlags::empty(),
1022 _decode,
1023 )
1024 }
1025
1026 type SendResponseResponseFut = fidl::client::QueryResponseFut<
1027 DeviceSendResponseResult,
1028 fidl::encoding::DefaultFuchsiaResourceDialect,
1029 >;
1030 fn r#send_response(
1031 &self,
1032 mut addr: &Addr,
1033 mut data: fidl::Socket,
1034 ) -> Self::SendResponseResponseFut {
1035 fn _decode(
1036 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1037 ) -> Result<DeviceSendResponseResult, fidl::Error> {
1038 let _response = fidl::client::decode_transaction_body::<
1039 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1040 fidl::encoding::DefaultFuchsiaResourceDialect,
1041 0x487a35133ffe0672,
1042 >(_buf?)?;
1043 Ok(_response.map(|x| x))
1044 }
1045 self.client.send_query_and_decode::<DeviceSendResponseRequest, DeviceSendResponseResult>(
1046 (addr, data),
1047 0x487a35133ffe0672,
1048 fidl::encoding::DynamicFlags::empty(),
1049 _decode,
1050 )
1051 }
1052
1053 type GetCidResponseFut =
1054 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1055 fn r#get_cid(&self) -> Self::GetCidResponseFut {
1056 fn _decode(
1057 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1058 ) -> Result<u32, fidl::Error> {
1059 let _response = fidl::client::decode_transaction_body::<
1060 DeviceGetCidResponse,
1061 fidl::encoding::DefaultFuchsiaResourceDialect,
1062 0x7cf0847a452feafe,
1063 >(_buf?)?;
1064 Ok(_response.local_cid)
1065 }
1066 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
1067 (),
1068 0x7cf0847a452feafe,
1069 fidl::encoding::DynamicFlags::empty(),
1070 _decode,
1071 )
1072 }
1073}
1074
1075pub struct DeviceEventStream {
1076 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1077}
1078
1079impl std::marker::Unpin for DeviceEventStream {}
1080
1081impl futures::stream::FusedStream for DeviceEventStream {
1082 fn is_terminated(&self) -> bool {
1083 self.event_receiver.is_terminated()
1084 }
1085}
1086
1087impl futures::Stream for DeviceEventStream {
1088 type Item = Result<DeviceEvent, fidl::Error>;
1089
1090 fn poll_next(
1091 mut self: std::pin::Pin<&mut Self>,
1092 cx: &mut std::task::Context<'_>,
1093 ) -> std::task::Poll<Option<Self::Item>> {
1094 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1095 &mut self.event_receiver,
1096 cx
1097 )?) {
1098 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1099 None => std::task::Poll::Ready(None),
1100 }
1101 }
1102}
1103
1104#[derive(Debug)]
1105pub enum DeviceEvent {}
1106
1107impl DeviceEvent {
1108 fn decode(
1110 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1111 ) -> Result<DeviceEvent, fidl::Error> {
1112 let (bytes, _handles) = buf.split_mut();
1113 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1114 debug_assert_eq!(tx_header.tx_id, 0);
1115 match tx_header.ordinal {
1116 _ => Err(fidl::Error::UnknownOrdinal {
1117 ordinal: tx_header.ordinal,
1118 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1119 }),
1120 }
1121 }
1122}
1123
1124pub struct DeviceRequestStream {
1126 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1127 is_terminated: bool,
1128}
1129
1130impl std::marker::Unpin for DeviceRequestStream {}
1131
1132impl futures::stream::FusedStream for DeviceRequestStream {
1133 fn is_terminated(&self) -> bool {
1134 self.is_terminated
1135 }
1136}
1137
1138impl fidl::endpoints::RequestStream for DeviceRequestStream {
1139 type Protocol = DeviceMarker;
1140 type ControlHandle = DeviceControlHandle;
1141
1142 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1143 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1144 }
1145
1146 fn control_handle(&self) -> Self::ControlHandle {
1147 DeviceControlHandle { inner: self.inner.clone() }
1148 }
1149
1150 fn into_inner(
1151 self,
1152 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1153 {
1154 (self.inner, self.is_terminated)
1155 }
1156
1157 fn from_inner(
1158 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1159 is_terminated: bool,
1160 ) -> Self {
1161 Self { inner, is_terminated }
1162 }
1163}
1164
1165impl futures::Stream for DeviceRequestStream {
1166 type Item = Result<DeviceRequest, fidl::Error>;
1167
1168 fn poll_next(
1169 mut self: std::pin::Pin<&mut Self>,
1170 cx: &mut std::task::Context<'_>,
1171 ) -> std::task::Poll<Option<Self::Item>> {
1172 let this = &mut *self;
1173 if this.inner.check_shutdown(cx) {
1174 this.is_terminated = true;
1175 return std::task::Poll::Ready(None);
1176 }
1177 if this.is_terminated {
1178 panic!("polled DeviceRequestStream after completion");
1179 }
1180 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1181 |bytes, handles| {
1182 match this.inner.channel().read_etc(cx, bytes, handles) {
1183 std::task::Poll::Ready(Ok(())) => {}
1184 std::task::Poll::Pending => return std::task::Poll::Pending,
1185 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1186 this.is_terminated = true;
1187 return std::task::Poll::Ready(None);
1188 }
1189 std::task::Poll::Ready(Err(e)) => {
1190 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1191 e.into(),
1192 ))))
1193 }
1194 }
1195
1196 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1198
1199 std::task::Poll::Ready(Some(match header.ordinal {
1200 0x3bc3faaec6158f27 => {
1201 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1202 let mut req = fidl::new_empty!(
1203 DeviceStartRequest,
1204 fidl::encoding::DefaultFuchsiaResourceDialect
1205 );
1206 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartRequest>(&header, _body_bytes, handles, &mut req)?;
1207 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1208 Ok(DeviceRequest::Start {
1209 cb: req.cb,
1210
1211 responder: DeviceStartResponder {
1212 control_handle: std::mem::ManuallyDrop::new(control_handle),
1213 tx_id: header.tx_id,
1214 },
1215 })
1216 }
1217 0x2dc165540021f74d => {
1218 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1219 let mut req = fidl::new_empty!(
1220 DeviceSendRequestRequest,
1221 fidl::encoding::DefaultFuchsiaResourceDialect
1222 );
1223 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendRequestRequest>(&header, _body_bytes, handles, &mut req)?;
1224 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1225 Ok(DeviceRequest::SendRequest {
1226 addr: req.addr,
1227 data: req.data,
1228
1229 responder: DeviceSendRequestResponder {
1230 control_handle: std::mem::ManuallyDrop::new(control_handle),
1231 tx_id: header.tx_id,
1232 },
1233 })
1234 }
1235 0x57cdc7b234933b44 => {
1236 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1237 let mut req = fidl::new_empty!(
1238 DeviceSendShutdownRequest,
1239 fidl::encoding::DefaultFuchsiaResourceDialect
1240 );
1241 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
1242 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1243 Ok(DeviceRequest::SendShutdown {
1244 addr: req.addr,
1245
1246 responder: DeviceSendShutdownResponder {
1247 control_handle: std::mem::ManuallyDrop::new(control_handle),
1248 tx_id: header.tx_id,
1249 },
1250 })
1251 }
1252 0x334e890ef7cd737c => {
1253 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1254 let mut req = fidl::new_empty!(
1255 DeviceSendRstRequest,
1256 fidl::encoding::DefaultFuchsiaResourceDialect
1257 );
1258 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendRstRequest>(&header, _body_bytes, handles, &mut req)?;
1259 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1260 Ok(DeviceRequest::SendRst {
1261 addr: req.addr,
1262
1263 responder: DeviceSendRstResponder {
1264 control_handle: std::mem::ManuallyDrop::new(control_handle),
1265 tx_id: header.tx_id,
1266 },
1267 })
1268 }
1269 0x487a35133ffe0672 => {
1270 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1271 let mut req = fidl::new_empty!(
1272 DeviceSendResponseRequest,
1273 fidl::encoding::DefaultFuchsiaResourceDialect
1274 );
1275 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSendResponseRequest>(&header, _body_bytes, handles, &mut req)?;
1276 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1277 Ok(DeviceRequest::SendResponse {
1278 addr: req.addr,
1279 data: req.data,
1280
1281 responder: DeviceSendResponseResponder {
1282 control_handle: std::mem::ManuallyDrop::new(control_handle),
1283 tx_id: header.tx_id,
1284 },
1285 })
1286 }
1287 0x7cf0847a452feafe => {
1288 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1289 let mut req = fidl::new_empty!(
1290 fidl::encoding::EmptyPayload,
1291 fidl::encoding::DefaultFuchsiaResourceDialect
1292 );
1293 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1294 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1295 Ok(DeviceRequest::GetCid {
1296 responder: DeviceGetCidResponder {
1297 control_handle: std::mem::ManuallyDrop::new(control_handle),
1298 tx_id: header.tx_id,
1299 },
1300 })
1301 }
1302 _ => Err(fidl::Error::UnknownOrdinal {
1303 ordinal: header.ordinal,
1304 protocol_name:
1305 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1306 }),
1307 }))
1308 },
1309 )
1310 }
1311}
1312
1313#[derive(Debug)]
1314pub enum DeviceRequest {
1315 Start { cb: fidl::endpoints::ClientEnd<CallbacksMarker>, responder: DeviceStartResponder },
1316 SendRequest { addr: Addr, data: fidl::Socket, responder: DeviceSendRequestResponder },
1317 SendShutdown { addr: Addr, responder: DeviceSendShutdownResponder },
1318 SendRst { addr: Addr, responder: DeviceSendRstResponder },
1319 SendResponse { addr: Addr, data: fidl::Socket, responder: DeviceSendResponseResponder },
1320 GetCid { responder: DeviceGetCidResponder },
1321}
1322
1323impl DeviceRequest {
1324 #[allow(irrefutable_let_patterns)]
1325 pub fn into_start(
1326 self,
1327 ) -> Option<(fidl::endpoints::ClientEnd<CallbacksMarker>, DeviceStartResponder)> {
1328 if let DeviceRequest::Start { cb, responder } = self {
1329 Some((cb, responder))
1330 } else {
1331 None
1332 }
1333 }
1334
1335 #[allow(irrefutable_let_patterns)]
1336 pub fn into_send_request(self) -> Option<(Addr, fidl::Socket, DeviceSendRequestResponder)> {
1337 if let DeviceRequest::SendRequest { addr, data, responder } = self {
1338 Some((addr, data, responder))
1339 } else {
1340 None
1341 }
1342 }
1343
1344 #[allow(irrefutable_let_patterns)]
1345 pub fn into_send_shutdown(self) -> Option<(Addr, DeviceSendShutdownResponder)> {
1346 if let DeviceRequest::SendShutdown { addr, responder } = self {
1347 Some((addr, responder))
1348 } else {
1349 None
1350 }
1351 }
1352
1353 #[allow(irrefutable_let_patterns)]
1354 pub fn into_send_rst(self) -> Option<(Addr, DeviceSendRstResponder)> {
1355 if let DeviceRequest::SendRst { addr, responder } = self {
1356 Some((addr, responder))
1357 } else {
1358 None
1359 }
1360 }
1361
1362 #[allow(irrefutable_let_patterns)]
1363 pub fn into_send_response(self) -> Option<(Addr, fidl::Socket, DeviceSendResponseResponder)> {
1364 if let DeviceRequest::SendResponse { addr, data, responder } = self {
1365 Some((addr, data, responder))
1366 } else {
1367 None
1368 }
1369 }
1370
1371 #[allow(irrefutable_let_patterns)]
1372 pub fn into_get_cid(self) -> Option<(DeviceGetCidResponder)> {
1373 if let DeviceRequest::GetCid { responder } = self {
1374 Some((responder))
1375 } else {
1376 None
1377 }
1378 }
1379
1380 pub fn method_name(&self) -> &'static str {
1382 match *self {
1383 DeviceRequest::Start { .. } => "start",
1384 DeviceRequest::SendRequest { .. } => "send_request",
1385 DeviceRequest::SendShutdown { .. } => "send_shutdown",
1386 DeviceRequest::SendRst { .. } => "send_rst",
1387 DeviceRequest::SendResponse { .. } => "send_response",
1388 DeviceRequest::GetCid { .. } => "get_cid",
1389 }
1390 }
1391}
1392
1393#[derive(Debug, Clone)]
1394pub struct DeviceControlHandle {
1395 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1396}
1397
1398impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1399 fn shutdown(&self) {
1400 self.inner.shutdown()
1401 }
1402 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1403 self.inner.shutdown_with_epitaph(status)
1404 }
1405
1406 fn is_closed(&self) -> bool {
1407 self.inner.channel().is_closed()
1408 }
1409 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1410 self.inner.channel().on_closed()
1411 }
1412
1413 #[cfg(target_os = "fuchsia")]
1414 fn signal_peer(
1415 &self,
1416 clear_mask: zx::Signals,
1417 set_mask: zx::Signals,
1418 ) -> Result<(), zx_status::Status> {
1419 use fidl::Peered;
1420 self.inner.channel().signal_peer(clear_mask, set_mask)
1421 }
1422}
1423
1424impl DeviceControlHandle {}
1425
1426#[must_use = "FIDL methods require a response to be sent"]
1427#[derive(Debug)]
1428pub struct DeviceStartResponder {
1429 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1430 tx_id: u32,
1431}
1432
1433impl std::ops::Drop for DeviceStartResponder {
1437 fn drop(&mut self) {
1438 self.control_handle.shutdown();
1439 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1441 }
1442}
1443
1444impl fidl::endpoints::Responder for DeviceStartResponder {
1445 type ControlHandle = DeviceControlHandle;
1446
1447 fn control_handle(&self) -> &DeviceControlHandle {
1448 &self.control_handle
1449 }
1450
1451 fn drop_without_shutdown(mut self) {
1452 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1454 std::mem::forget(self);
1456 }
1457}
1458
1459impl DeviceStartResponder {
1460 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1464 let _result = self.send_raw(result);
1465 if _result.is_err() {
1466 self.control_handle.shutdown();
1467 }
1468 self.drop_without_shutdown();
1469 _result
1470 }
1471
1472 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1474 let _result = self.send_raw(result);
1475 self.drop_without_shutdown();
1476 _result
1477 }
1478
1479 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1480 self.control_handle
1481 .inner
1482 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1483 result,
1484 self.tx_id,
1485 0x3bc3faaec6158f27,
1486 fidl::encoding::DynamicFlags::empty(),
1487 )
1488 }
1489}
1490
1491#[must_use = "FIDL methods require a response to be sent"]
1492#[derive(Debug)]
1493pub struct DeviceSendRequestResponder {
1494 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1495 tx_id: u32,
1496}
1497
1498impl std::ops::Drop for DeviceSendRequestResponder {
1502 fn drop(&mut self) {
1503 self.control_handle.shutdown();
1504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506 }
1507}
1508
1509impl fidl::endpoints::Responder for DeviceSendRequestResponder {
1510 type ControlHandle = DeviceControlHandle;
1511
1512 fn control_handle(&self) -> &DeviceControlHandle {
1513 &self.control_handle
1514 }
1515
1516 fn drop_without_shutdown(mut self) {
1517 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1519 std::mem::forget(self);
1521 }
1522}
1523
1524impl DeviceSendRequestResponder {
1525 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1529 let _result = self.send_raw(result);
1530 if _result.is_err() {
1531 self.control_handle.shutdown();
1532 }
1533 self.drop_without_shutdown();
1534 _result
1535 }
1536
1537 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1539 let _result = self.send_raw(result);
1540 self.drop_without_shutdown();
1541 _result
1542 }
1543
1544 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1545 self.control_handle
1546 .inner
1547 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1548 result,
1549 self.tx_id,
1550 0x2dc165540021f74d,
1551 fidl::encoding::DynamicFlags::empty(),
1552 )
1553 }
1554}
1555
1556#[must_use = "FIDL methods require a response to be sent"]
1557#[derive(Debug)]
1558pub struct DeviceSendShutdownResponder {
1559 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1560 tx_id: u32,
1561}
1562
1563impl std::ops::Drop for DeviceSendShutdownResponder {
1567 fn drop(&mut self) {
1568 self.control_handle.shutdown();
1569 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1571 }
1572}
1573
1574impl fidl::endpoints::Responder for DeviceSendShutdownResponder {
1575 type ControlHandle = DeviceControlHandle;
1576
1577 fn control_handle(&self) -> &DeviceControlHandle {
1578 &self.control_handle
1579 }
1580
1581 fn drop_without_shutdown(mut self) {
1582 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1584 std::mem::forget(self);
1586 }
1587}
1588
1589impl DeviceSendShutdownResponder {
1590 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1594 let _result = self.send_raw(result);
1595 if _result.is_err() {
1596 self.control_handle.shutdown();
1597 }
1598 self.drop_without_shutdown();
1599 _result
1600 }
1601
1602 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1604 let _result = self.send_raw(result);
1605 self.drop_without_shutdown();
1606 _result
1607 }
1608
1609 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1610 self.control_handle
1611 .inner
1612 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1613 result,
1614 self.tx_id,
1615 0x57cdc7b234933b44,
1616 fidl::encoding::DynamicFlags::empty(),
1617 )
1618 }
1619}
1620
1621#[must_use = "FIDL methods require a response to be sent"]
1622#[derive(Debug)]
1623pub struct DeviceSendRstResponder {
1624 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1625 tx_id: u32,
1626}
1627
1628impl std::ops::Drop for DeviceSendRstResponder {
1632 fn drop(&mut self) {
1633 self.control_handle.shutdown();
1634 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1636 }
1637}
1638
1639impl fidl::endpoints::Responder for DeviceSendRstResponder {
1640 type ControlHandle = DeviceControlHandle;
1641
1642 fn control_handle(&self) -> &DeviceControlHandle {
1643 &self.control_handle
1644 }
1645
1646 fn drop_without_shutdown(mut self) {
1647 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1649 std::mem::forget(self);
1651 }
1652}
1653
1654impl DeviceSendRstResponder {
1655 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1659 let _result = self.send_raw(result);
1660 if _result.is_err() {
1661 self.control_handle.shutdown();
1662 }
1663 self.drop_without_shutdown();
1664 _result
1665 }
1666
1667 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1669 let _result = self.send_raw(result);
1670 self.drop_without_shutdown();
1671 _result
1672 }
1673
1674 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1675 self.control_handle
1676 .inner
1677 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1678 result,
1679 self.tx_id,
1680 0x334e890ef7cd737c,
1681 fidl::encoding::DynamicFlags::empty(),
1682 )
1683 }
1684}
1685
1686#[must_use = "FIDL methods require a response to be sent"]
1687#[derive(Debug)]
1688pub struct DeviceSendResponseResponder {
1689 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1690 tx_id: u32,
1691}
1692
1693impl std::ops::Drop for DeviceSendResponseResponder {
1697 fn drop(&mut self) {
1698 self.control_handle.shutdown();
1699 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1701 }
1702}
1703
1704impl fidl::endpoints::Responder for DeviceSendResponseResponder {
1705 type ControlHandle = DeviceControlHandle;
1706
1707 fn control_handle(&self) -> &DeviceControlHandle {
1708 &self.control_handle
1709 }
1710
1711 fn drop_without_shutdown(mut self) {
1712 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1714 std::mem::forget(self);
1716 }
1717}
1718
1719impl DeviceSendResponseResponder {
1720 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1724 let _result = self.send_raw(result);
1725 if _result.is_err() {
1726 self.control_handle.shutdown();
1727 }
1728 self.drop_without_shutdown();
1729 _result
1730 }
1731
1732 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1734 let _result = self.send_raw(result);
1735 self.drop_without_shutdown();
1736 _result
1737 }
1738
1739 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1740 self.control_handle
1741 .inner
1742 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1743 result,
1744 self.tx_id,
1745 0x487a35133ffe0672,
1746 fidl::encoding::DynamicFlags::empty(),
1747 )
1748 }
1749}
1750
1751#[must_use = "FIDL methods require a response to be sent"]
1752#[derive(Debug)]
1753pub struct DeviceGetCidResponder {
1754 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1755 tx_id: u32,
1756}
1757
1758impl std::ops::Drop for DeviceGetCidResponder {
1762 fn drop(&mut self) {
1763 self.control_handle.shutdown();
1764 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1766 }
1767}
1768
1769impl fidl::endpoints::Responder for DeviceGetCidResponder {
1770 type ControlHandle = DeviceControlHandle;
1771
1772 fn control_handle(&self) -> &DeviceControlHandle {
1773 &self.control_handle
1774 }
1775
1776 fn drop_without_shutdown(mut self) {
1777 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1779 std::mem::forget(self);
1781 }
1782}
1783
1784impl DeviceGetCidResponder {
1785 pub fn send(self, mut local_cid: u32) -> Result<(), fidl::Error> {
1789 let _result = self.send_raw(local_cid);
1790 if _result.is_err() {
1791 self.control_handle.shutdown();
1792 }
1793 self.drop_without_shutdown();
1794 _result
1795 }
1796
1797 pub fn send_no_shutdown_on_err(self, mut local_cid: u32) -> Result<(), fidl::Error> {
1799 let _result = self.send_raw(local_cid);
1800 self.drop_without_shutdown();
1801 _result
1802 }
1803
1804 fn send_raw(&self, mut local_cid: u32) -> Result<(), fidl::Error> {
1805 self.control_handle.inner.send::<DeviceGetCidResponse>(
1806 (local_cid,),
1807 self.tx_id,
1808 0x7cf0847a452feafe,
1809 fidl::encoding::DynamicFlags::empty(),
1810 )
1811 }
1812}
1813
1814#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1815pub struct ServiceMarker;
1816
1817#[cfg(target_os = "fuchsia")]
1818impl fidl::endpoints::ServiceMarker for ServiceMarker {
1819 type Proxy = ServiceProxy;
1820 type Request = ServiceRequest;
1821 const SERVICE_NAME: &'static str = "fuchsia.hardware.vsock.Service";
1822}
1823
1824#[cfg(target_os = "fuchsia")]
1827pub enum ServiceRequest {
1828 Device(DeviceRequestStream),
1829}
1830
1831#[cfg(target_os = "fuchsia")]
1832impl fidl::endpoints::ServiceRequest for ServiceRequest {
1833 type Service = ServiceMarker;
1834
1835 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1836 match name {
1837 "device" => Self::Device(
1838 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1839 ),
1840 _ => panic!("no such member protocol name for service Service"),
1841 }
1842 }
1843
1844 fn member_names() -> &'static [&'static str] {
1845 &["device"]
1846 }
1847}
1848#[cfg(target_os = "fuchsia")]
1849pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1850
1851#[cfg(target_os = "fuchsia")]
1852impl fidl::endpoints::ServiceProxy for ServiceProxy {
1853 type Service = ServiceMarker;
1854
1855 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1856 Self(opener)
1857 }
1858}
1859
1860#[cfg(target_os = "fuchsia")]
1861impl ServiceProxy {
1862 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1863 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1864 self.connect_channel_to_device(server_end)?;
1865 Ok(proxy)
1866 }
1867
1868 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1871 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1872 self.connect_channel_to_device(server_end)?;
1873 Ok(proxy)
1874 }
1875
1876 pub fn connect_channel_to_device(
1879 &self,
1880 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1881 ) -> Result<(), fidl::Error> {
1882 self.0.open_member("device", server_end.into_channel())
1883 }
1884
1885 pub fn instance_name(&self) -> &str {
1886 self.0.instance_name()
1887 }
1888}
1889
1890mod internal {
1891 use super::*;
1892
1893 impl fidl::encoding::ResourceTypeMarker for DeviceSendRequestRequest {
1894 type Borrowed<'a> = &'a mut Self;
1895 fn take_or_borrow<'a>(
1896 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1897 ) -> Self::Borrowed<'a> {
1898 value
1899 }
1900 }
1901
1902 unsafe impl fidl::encoding::TypeMarker for DeviceSendRequestRequest {
1903 type Owned = Self;
1904
1905 #[inline(always)]
1906 fn inline_align(_context: fidl::encoding::Context) -> usize {
1907 4
1908 }
1909
1910 #[inline(always)]
1911 fn inline_size(_context: fidl::encoding::Context) -> usize {
1912 16
1913 }
1914 }
1915
1916 unsafe impl
1917 fidl::encoding::Encode<
1918 DeviceSendRequestRequest,
1919 fidl::encoding::DefaultFuchsiaResourceDialect,
1920 > for &mut DeviceSendRequestRequest
1921 {
1922 #[inline]
1923 unsafe fn encode(
1924 self,
1925 encoder: &mut fidl::encoding::Encoder<
1926 '_,
1927 fidl::encoding::DefaultFuchsiaResourceDialect,
1928 >,
1929 offset: usize,
1930 _depth: fidl::encoding::Depth,
1931 ) -> fidl::Result<()> {
1932 encoder.debug_check_bounds::<DeviceSendRequestRequest>(offset);
1933 fidl::encoding::Encode::<
1935 DeviceSendRequestRequest,
1936 fidl::encoding::DefaultFuchsiaResourceDialect,
1937 >::encode(
1938 (
1939 <Addr as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
1940 <fidl::encoding::HandleType<
1941 fidl::Socket,
1942 { fidl::ObjectType::SOCKET.into_raw() },
1943 2147483648,
1944 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1945 &mut self.data
1946 ),
1947 ),
1948 encoder,
1949 offset,
1950 _depth,
1951 )
1952 }
1953 }
1954 unsafe impl<
1955 T0: fidl::encoding::Encode<Addr, fidl::encoding::DefaultFuchsiaResourceDialect>,
1956 T1: fidl::encoding::Encode<
1957 fidl::encoding::HandleType<
1958 fidl::Socket,
1959 { fidl::ObjectType::SOCKET.into_raw() },
1960 2147483648,
1961 >,
1962 fidl::encoding::DefaultFuchsiaResourceDialect,
1963 >,
1964 >
1965 fidl::encoding::Encode<
1966 DeviceSendRequestRequest,
1967 fidl::encoding::DefaultFuchsiaResourceDialect,
1968 > for (T0, T1)
1969 {
1970 #[inline]
1971 unsafe fn encode(
1972 self,
1973 encoder: &mut fidl::encoding::Encoder<
1974 '_,
1975 fidl::encoding::DefaultFuchsiaResourceDialect,
1976 >,
1977 offset: usize,
1978 depth: fidl::encoding::Depth,
1979 ) -> fidl::Result<()> {
1980 encoder.debug_check_bounds::<DeviceSendRequestRequest>(offset);
1981 self.0.encode(encoder, offset + 0, depth)?;
1985 self.1.encode(encoder, offset + 12, depth)?;
1986 Ok(())
1987 }
1988 }
1989
1990 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1991 for DeviceSendRequestRequest
1992 {
1993 #[inline(always)]
1994 fn new_empty() -> Self {
1995 Self {
1996 addr: fidl::new_empty!(Addr, fidl::encoding::DefaultFuchsiaResourceDialect),
1997 data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1998 }
1999 }
2000
2001 #[inline]
2002 unsafe fn decode(
2003 &mut self,
2004 decoder: &mut fidl::encoding::Decoder<
2005 '_,
2006 fidl::encoding::DefaultFuchsiaResourceDialect,
2007 >,
2008 offset: usize,
2009 _depth: fidl::encoding::Depth,
2010 ) -> fidl::Result<()> {
2011 decoder.debug_check_bounds::<Self>(offset);
2012 fidl::decode!(
2014 Addr,
2015 fidl::encoding::DefaultFuchsiaResourceDialect,
2016 &mut self.addr,
2017 decoder,
2018 offset + 0,
2019 _depth
2020 )?;
2021 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 12, _depth)?;
2022 Ok(())
2023 }
2024 }
2025
2026 impl fidl::encoding::ResourceTypeMarker for DeviceSendResponseRequest {
2027 type Borrowed<'a> = &'a mut Self;
2028 fn take_or_borrow<'a>(
2029 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2030 ) -> Self::Borrowed<'a> {
2031 value
2032 }
2033 }
2034
2035 unsafe impl fidl::encoding::TypeMarker for DeviceSendResponseRequest {
2036 type Owned = Self;
2037
2038 #[inline(always)]
2039 fn inline_align(_context: fidl::encoding::Context) -> usize {
2040 4
2041 }
2042
2043 #[inline(always)]
2044 fn inline_size(_context: fidl::encoding::Context) -> usize {
2045 16
2046 }
2047 }
2048
2049 unsafe impl
2050 fidl::encoding::Encode<
2051 DeviceSendResponseRequest,
2052 fidl::encoding::DefaultFuchsiaResourceDialect,
2053 > for &mut DeviceSendResponseRequest
2054 {
2055 #[inline]
2056 unsafe fn encode(
2057 self,
2058 encoder: &mut fidl::encoding::Encoder<
2059 '_,
2060 fidl::encoding::DefaultFuchsiaResourceDialect,
2061 >,
2062 offset: usize,
2063 _depth: fidl::encoding::Depth,
2064 ) -> fidl::Result<()> {
2065 encoder.debug_check_bounds::<DeviceSendResponseRequest>(offset);
2066 fidl::encoding::Encode::<
2068 DeviceSendResponseRequest,
2069 fidl::encoding::DefaultFuchsiaResourceDialect,
2070 >::encode(
2071 (
2072 <Addr as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
2073 <fidl::encoding::HandleType<
2074 fidl::Socket,
2075 { fidl::ObjectType::SOCKET.into_raw() },
2076 2147483648,
2077 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2078 &mut self.data
2079 ),
2080 ),
2081 encoder,
2082 offset,
2083 _depth,
2084 )
2085 }
2086 }
2087 unsafe impl<
2088 T0: fidl::encoding::Encode<Addr, fidl::encoding::DefaultFuchsiaResourceDialect>,
2089 T1: fidl::encoding::Encode<
2090 fidl::encoding::HandleType<
2091 fidl::Socket,
2092 { fidl::ObjectType::SOCKET.into_raw() },
2093 2147483648,
2094 >,
2095 fidl::encoding::DefaultFuchsiaResourceDialect,
2096 >,
2097 >
2098 fidl::encoding::Encode<
2099 DeviceSendResponseRequest,
2100 fidl::encoding::DefaultFuchsiaResourceDialect,
2101 > for (T0, T1)
2102 {
2103 #[inline]
2104 unsafe fn encode(
2105 self,
2106 encoder: &mut fidl::encoding::Encoder<
2107 '_,
2108 fidl::encoding::DefaultFuchsiaResourceDialect,
2109 >,
2110 offset: usize,
2111 depth: fidl::encoding::Depth,
2112 ) -> fidl::Result<()> {
2113 encoder.debug_check_bounds::<DeviceSendResponseRequest>(offset);
2114 self.0.encode(encoder, offset + 0, depth)?;
2118 self.1.encode(encoder, offset + 12, depth)?;
2119 Ok(())
2120 }
2121 }
2122
2123 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2124 for DeviceSendResponseRequest
2125 {
2126 #[inline(always)]
2127 fn new_empty() -> Self {
2128 Self {
2129 addr: fidl::new_empty!(Addr, fidl::encoding::DefaultFuchsiaResourceDialect),
2130 data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2131 }
2132 }
2133
2134 #[inline]
2135 unsafe fn decode(
2136 &mut self,
2137 decoder: &mut fidl::encoding::Decoder<
2138 '_,
2139 fidl::encoding::DefaultFuchsiaResourceDialect,
2140 >,
2141 offset: usize,
2142 _depth: fidl::encoding::Depth,
2143 ) -> fidl::Result<()> {
2144 decoder.debug_check_bounds::<Self>(offset);
2145 fidl::decode!(
2147 Addr,
2148 fidl::encoding::DefaultFuchsiaResourceDialect,
2149 &mut self.addr,
2150 decoder,
2151 offset + 0,
2152 _depth
2153 )?;
2154 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 12, _depth)?;
2155 Ok(())
2156 }
2157 }
2158
2159 impl fidl::encoding::ResourceTypeMarker for DeviceStartRequest {
2160 type Borrowed<'a> = &'a mut Self;
2161 fn take_or_borrow<'a>(
2162 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2163 ) -> Self::Borrowed<'a> {
2164 value
2165 }
2166 }
2167
2168 unsafe impl fidl::encoding::TypeMarker for DeviceStartRequest {
2169 type Owned = Self;
2170
2171 #[inline(always)]
2172 fn inline_align(_context: fidl::encoding::Context) -> usize {
2173 4
2174 }
2175
2176 #[inline(always)]
2177 fn inline_size(_context: fidl::encoding::Context) -> usize {
2178 4
2179 }
2180 }
2181
2182 unsafe impl
2183 fidl::encoding::Encode<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2184 for &mut DeviceStartRequest
2185 {
2186 #[inline]
2187 unsafe fn encode(
2188 self,
2189 encoder: &mut fidl::encoding::Encoder<
2190 '_,
2191 fidl::encoding::DefaultFuchsiaResourceDialect,
2192 >,
2193 offset: usize,
2194 _depth: fidl::encoding::Depth,
2195 ) -> fidl::Result<()> {
2196 encoder.debug_check_bounds::<DeviceStartRequest>(offset);
2197 fidl::encoding::Encode::<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2199 (
2200 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cb),
2201 ),
2202 encoder, offset, _depth
2203 )
2204 }
2205 }
2206 unsafe impl<
2207 T0: fidl::encoding::Encode<
2208 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>>,
2209 fidl::encoding::DefaultFuchsiaResourceDialect,
2210 >,
2211 >
2212 fidl::encoding::Encode<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2213 for (T0,)
2214 {
2215 #[inline]
2216 unsafe fn encode(
2217 self,
2218 encoder: &mut fidl::encoding::Encoder<
2219 '_,
2220 fidl::encoding::DefaultFuchsiaResourceDialect,
2221 >,
2222 offset: usize,
2223 depth: fidl::encoding::Depth,
2224 ) -> fidl::Result<()> {
2225 encoder.debug_check_bounds::<DeviceStartRequest>(offset);
2226 self.0.encode(encoder, offset + 0, depth)?;
2230 Ok(())
2231 }
2232 }
2233
2234 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2235 for DeviceStartRequest
2236 {
2237 #[inline(always)]
2238 fn new_empty() -> Self {
2239 Self {
2240 cb: fidl::new_empty!(
2241 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>>,
2242 fidl::encoding::DefaultFuchsiaResourceDialect
2243 ),
2244 }
2245 }
2246
2247 #[inline]
2248 unsafe fn decode(
2249 &mut self,
2250 decoder: &mut fidl::encoding::Decoder<
2251 '_,
2252 fidl::encoding::DefaultFuchsiaResourceDialect,
2253 >,
2254 offset: usize,
2255 _depth: fidl::encoding::Depth,
2256 ) -> fidl::Result<()> {
2257 decoder.debug_check_bounds::<Self>(offset);
2258 fidl::decode!(
2260 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallbacksMarker>>,
2261 fidl::encoding::DefaultFuchsiaResourceDialect,
2262 &mut self.cb,
2263 decoder,
2264 offset + 0,
2265 _depth
2266 )?;
2267 Ok(())
2268 }
2269 }
2270}