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_sharedmemory_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct SharedVmoRegisterRegisterVmoRequest {
16 pub vmo_id: u32,
17 pub vmo: fidl_fuchsia_mem::Range,
18 pub rights: SharedVmoRight,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22 for SharedVmoRegisterRegisterVmoRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct SharedVmoRegisterUnregisterVmoResponse {
28 pub vmo: fidl::Vmo,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for SharedVmoRegisterUnregisterVmoResponse
33{
34}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct SharedVmoIoMarker;
38
39impl fidl::endpoints::ProtocolMarker for SharedVmoIoMarker {
40 type Proxy = SharedVmoIoProxy;
41 type RequestStream = SharedVmoIoRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = SharedVmoIoSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "(anonymous) SharedVmoIo";
46}
47pub type SharedVmoIoTransmitResult = Result<(), i32>;
48pub type SharedVmoIoReceiveResult = Result<(), i32>;
49pub type SharedVmoIoExchangeResult = Result<(), i32>;
50
51pub trait SharedVmoIoProxyInterface: Send + Sync {
52 type TransmitResponseFut: std::future::Future<Output = Result<SharedVmoIoTransmitResult, fidl::Error>>
53 + Send;
54 fn r#transmit(&self, buffer: &SharedVmoBuffer) -> Self::TransmitResponseFut;
55 type ReceiveResponseFut: std::future::Future<Output = Result<SharedVmoIoReceiveResult, fidl::Error>>
56 + Send;
57 fn r#receive(&self, buffer: &SharedVmoBuffer) -> Self::ReceiveResponseFut;
58 type ExchangeResponseFut: std::future::Future<Output = Result<SharedVmoIoExchangeResult, fidl::Error>>
59 + Send;
60 fn r#exchange(
61 &self,
62 tx_buffer: &SharedVmoBuffer,
63 rx_buffer: &SharedVmoBuffer,
64 ) -> Self::ExchangeResponseFut;
65}
66#[derive(Debug)]
67#[cfg(target_os = "fuchsia")]
68pub struct SharedVmoIoSynchronousProxy {
69 client: fidl::client::sync::Client,
70}
71
72#[cfg(target_os = "fuchsia")]
73impl fidl::endpoints::SynchronousProxy for SharedVmoIoSynchronousProxy {
74 type Proxy = SharedVmoIoProxy;
75 type Protocol = SharedVmoIoMarker;
76
77 fn from_channel(inner: fidl::Channel) -> Self {
78 Self::new(inner)
79 }
80
81 fn into_channel(self) -> fidl::Channel {
82 self.client.into_channel()
83 }
84
85 fn as_channel(&self) -> &fidl::Channel {
86 self.client.as_channel()
87 }
88}
89
90#[cfg(target_os = "fuchsia")]
91impl SharedVmoIoSynchronousProxy {
92 pub fn new(channel: fidl::Channel) -> Self {
93 Self { client: fidl::client::sync::Client::new(channel) }
94 }
95
96 pub fn into_channel(self) -> fidl::Channel {
97 self.client.into_channel()
98 }
99
100 pub fn wait_for_event(
103 &self,
104 deadline: zx::MonotonicInstant,
105 ) -> Result<SharedVmoIoEvent, fidl::Error> {
106 SharedVmoIoEvent::decode(self.client.wait_for_event::<SharedVmoIoMarker>(deadline)?)
107 }
108
109 pub fn r#transmit(
111 &self,
112 mut buffer: &SharedVmoBuffer,
113 ___deadline: zx::MonotonicInstant,
114 ) -> Result<SharedVmoIoTransmitResult, fidl::Error> {
115 let _response = self.client.send_query::<
116 SharedVmoIoTransmitRequest,
117 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
118 SharedVmoIoMarker,
119 >(
120 (buffer,),
121 0x791970e4c961b0bf,
122 fidl::encoding::DynamicFlags::empty(),
123 ___deadline,
124 )?;
125 Ok(_response.map(|x| x))
126 }
127
128 pub fn r#receive(
130 &self,
131 mut buffer: &SharedVmoBuffer,
132 ___deadline: zx::MonotonicInstant,
133 ) -> Result<SharedVmoIoReceiveResult, fidl::Error> {
134 let _response = self.client.send_query::<
135 SharedVmoIoReceiveRequest,
136 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
137 SharedVmoIoMarker,
138 >(
139 (buffer,),
140 0x1c31986cc443db59,
141 fidl::encoding::DynamicFlags::empty(),
142 ___deadline,
143 )?;
144 Ok(_response.map(|x| x))
145 }
146
147 pub fn r#exchange(
150 &self,
151 mut tx_buffer: &SharedVmoBuffer,
152 mut rx_buffer: &SharedVmoBuffer,
153 ___deadline: zx::MonotonicInstant,
154 ) -> Result<SharedVmoIoExchangeResult, fidl::Error> {
155 let _response = self.client.send_query::<
156 SharedVmoIoExchangeRequest,
157 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
158 SharedVmoIoMarker,
159 >(
160 (tx_buffer, rx_buffer,),
161 0x6ddad3b45d5deccc,
162 fidl::encoding::DynamicFlags::empty(),
163 ___deadline,
164 )?;
165 Ok(_response.map(|x| x))
166 }
167}
168
169#[cfg(target_os = "fuchsia")]
170impl From<SharedVmoIoSynchronousProxy> for zx::NullableHandle {
171 fn from(value: SharedVmoIoSynchronousProxy) -> Self {
172 value.into_channel().into()
173 }
174}
175
176#[cfg(target_os = "fuchsia")]
177impl From<fidl::Channel> for SharedVmoIoSynchronousProxy {
178 fn from(value: fidl::Channel) -> Self {
179 Self::new(value)
180 }
181}
182
183#[cfg(target_os = "fuchsia")]
184impl fidl::endpoints::FromClient for SharedVmoIoSynchronousProxy {
185 type Protocol = SharedVmoIoMarker;
186
187 fn from_client(value: fidl::endpoints::ClientEnd<SharedVmoIoMarker>) -> Self {
188 Self::new(value.into_channel())
189 }
190}
191
192#[derive(Debug, Clone)]
193pub struct SharedVmoIoProxy {
194 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
195}
196
197impl fidl::endpoints::Proxy for SharedVmoIoProxy {
198 type Protocol = SharedVmoIoMarker;
199
200 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
201 Self::new(inner)
202 }
203
204 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
205 self.client.into_channel().map_err(|client| Self { client })
206 }
207
208 fn as_channel(&self) -> &::fidl::AsyncChannel {
209 self.client.as_channel()
210 }
211}
212
213impl SharedVmoIoProxy {
214 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
216 let protocol_name = <SharedVmoIoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
217 Self { client: fidl::client::Client::new(channel, protocol_name) }
218 }
219
220 pub fn take_event_stream(&self) -> SharedVmoIoEventStream {
226 SharedVmoIoEventStream { event_receiver: self.client.take_event_receiver() }
227 }
228
229 pub fn r#transmit(
231 &self,
232 mut buffer: &SharedVmoBuffer,
233 ) -> fidl::client::QueryResponseFut<
234 SharedVmoIoTransmitResult,
235 fidl::encoding::DefaultFuchsiaResourceDialect,
236 > {
237 SharedVmoIoProxyInterface::r#transmit(self, buffer)
238 }
239
240 pub fn r#receive(
242 &self,
243 mut buffer: &SharedVmoBuffer,
244 ) -> fidl::client::QueryResponseFut<
245 SharedVmoIoReceiveResult,
246 fidl::encoding::DefaultFuchsiaResourceDialect,
247 > {
248 SharedVmoIoProxyInterface::r#receive(self, buffer)
249 }
250
251 pub fn r#exchange(
254 &self,
255 mut tx_buffer: &SharedVmoBuffer,
256 mut rx_buffer: &SharedVmoBuffer,
257 ) -> fidl::client::QueryResponseFut<
258 SharedVmoIoExchangeResult,
259 fidl::encoding::DefaultFuchsiaResourceDialect,
260 > {
261 SharedVmoIoProxyInterface::r#exchange(self, tx_buffer, rx_buffer)
262 }
263}
264
265impl SharedVmoIoProxyInterface for SharedVmoIoProxy {
266 type TransmitResponseFut = fidl::client::QueryResponseFut<
267 SharedVmoIoTransmitResult,
268 fidl::encoding::DefaultFuchsiaResourceDialect,
269 >;
270 fn r#transmit(&self, mut buffer: &SharedVmoBuffer) -> Self::TransmitResponseFut {
271 fn _decode(
272 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
273 ) -> Result<SharedVmoIoTransmitResult, fidl::Error> {
274 let _response = fidl::client::decode_transaction_body::<
275 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
276 fidl::encoding::DefaultFuchsiaResourceDialect,
277 0x791970e4c961b0bf,
278 >(_buf?)?;
279 Ok(_response.map(|x| x))
280 }
281 self.client.send_query_and_decode::<SharedVmoIoTransmitRequest, SharedVmoIoTransmitResult>(
282 (buffer,),
283 0x791970e4c961b0bf,
284 fidl::encoding::DynamicFlags::empty(),
285 _decode,
286 )
287 }
288
289 type ReceiveResponseFut = fidl::client::QueryResponseFut<
290 SharedVmoIoReceiveResult,
291 fidl::encoding::DefaultFuchsiaResourceDialect,
292 >;
293 fn r#receive(&self, mut buffer: &SharedVmoBuffer) -> Self::ReceiveResponseFut {
294 fn _decode(
295 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
296 ) -> Result<SharedVmoIoReceiveResult, fidl::Error> {
297 let _response = fidl::client::decode_transaction_body::<
298 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
299 fidl::encoding::DefaultFuchsiaResourceDialect,
300 0x1c31986cc443db59,
301 >(_buf?)?;
302 Ok(_response.map(|x| x))
303 }
304 self.client.send_query_and_decode::<SharedVmoIoReceiveRequest, SharedVmoIoReceiveResult>(
305 (buffer,),
306 0x1c31986cc443db59,
307 fidl::encoding::DynamicFlags::empty(),
308 _decode,
309 )
310 }
311
312 type ExchangeResponseFut = fidl::client::QueryResponseFut<
313 SharedVmoIoExchangeResult,
314 fidl::encoding::DefaultFuchsiaResourceDialect,
315 >;
316 fn r#exchange(
317 &self,
318 mut tx_buffer: &SharedVmoBuffer,
319 mut rx_buffer: &SharedVmoBuffer,
320 ) -> Self::ExchangeResponseFut {
321 fn _decode(
322 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
323 ) -> Result<SharedVmoIoExchangeResult, fidl::Error> {
324 let _response = fidl::client::decode_transaction_body::<
325 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
326 fidl::encoding::DefaultFuchsiaResourceDialect,
327 0x6ddad3b45d5deccc,
328 >(_buf?)?;
329 Ok(_response.map(|x| x))
330 }
331 self.client.send_query_and_decode::<SharedVmoIoExchangeRequest, SharedVmoIoExchangeResult>(
332 (tx_buffer, rx_buffer),
333 0x6ddad3b45d5deccc,
334 fidl::encoding::DynamicFlags::empty(),
335 _decode,
336 )
337 }
338}
339
340pub struct SharedVmoIoEventStream {
341 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
342}
343
344impl std::marker::Unpin for SharedVmoIoEventStream {}
345
346impl futures::stream::FusedStream for SharedVmoIoEventStream {
347 fn is_terminated(&self) -> bool {
348 self.event_receiver.is_terminated()
349 }
350}
351
352impl futures::Stream for SharedVmoIoEventStream {
353 type Item = Result<SharedVmoIoEvent, fidl::Error>;
354
355 fn poll_next(
356 mut self: std::pin::Pin<&mut Self>,
357 cx: &mut std::task::Context<'_>,
358 ) -> std::task::Poll<Option<Self::Item>> {
359 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
360 &mut self.event_receiver,
361 cx
362 )?) {
363 Some(buf) => std::task::Poll::Ready(Some(SharedVmoIoEvent::decode(buf))),
364 None => std::task::Poll::Ready(None),
365 }
366 }
367}
368
369#[derive(Debug)]
370pub enum SharedVmoIoEvent {}
371
372impl SharedVmoIoEvent {
373 fn decode(
375 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
376 ) -> Result<SharedVmoIoEvent, fidl::Error> {
377 let (bytes, _handles) = buf.split_mut();
378 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
379 debug_assert_eq!(tx_header.tx_id, 0);
380 match tx_header.ordinal {
381 _ => Err(fidl::Error::UnknownOrdinal {
382 ordinal: tx_header.ordinal,
383 protocol_name: <SharedVmoIoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
384 }),
385 }
386 }
387}
388
389pub struct SharedVmoIoRequestStream {
391 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
392 is_terminated: bool,
393}
394
395impl std::marker::Unpin for SharedVmoIoRequestStream {}
396
397impl futures::stream::FusedStream for SharedVmoIoRequestStream {
398 fn is_terminated(&self) -> bool {
399 self.is_terminated
400 }
401}
402
403impl fidl::endpoints::RequestStream for SharedVmoIoRequestStream {
404 type Protocol = SharedVmoIoMarker;
405 type ControlHandle = SharedVmoIoControlHandle;
406
407 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
408 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
409 }
410
411 fn control_handle(&self) -> Self::ControlHandle {
412 SharedVmoIoControlHandle { inner: self.inner.clone() }
413 }
414
415 fn into_inner(
416 self,
417 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
418 {
419 (self.inner, self.is_terminated)
420 }
421
422 fn from_inner(
423 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
424 is_terminated: bool,
425 ) -> Self {
426 Self { inner, is_terminated }
427 }
428}
429
430impl futures::Stream for SharedVmoIoRequestStream {
431 type Item = Result<SharedVmoIoRequest, fidl::Error>;
432
433 fn poll_next(
434 mut self: std::pin::Pin<&mut Self>,
435 cx: &mut std::task::Context<'_>,
436 ) -> std::task::Poll<Option<Self::Item>> {
437 let this = &mut *self;
438 if this.inner.check_shutdown(cx) {
439 this.is_terminated = true;
440 return std::task::Poll::Ready(None);
441 }
442 if this.is_terminated {
443 panic!("polled SharedVmoIoRequestStream after completion");
444 }
445 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
446 |bytes, handles| {
447 match this.inner.channel().read_etc(cx, bytes, handles) {
448 std::task::Poll::Ready(Ok(())) => {}
449 std::task::Poll::Pending => return std::task::Poll::Pending,
450 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
451 this.is_terminated = true;
452 return std::task::Poll::Ready(None);
453 }
454 std::task::Poll::Ready(Err(e)) => {
455 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
456 e.into(),
457 ))));
458 }
459 }
460
461 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
463
464 std::task::Poll::Ready(Some(match header.ordinal {
465 0x791970e4c961b0bf => {
466 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
467 let mut req = fidl::new_empty!(
468 SharedVmoIoTransmitRequest,
469 fidl::encoding::DefaultFuchsiaResourceDialect
470 );
471 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SharedVmoIoTransmitRequest>(&header, _body_bytes, handles, &mut req)?;
472 let control_handle = SharedVmoIoControlHandle { inner: this.inner.clone() };
473 Ok(SharedVmoIoRequest::Transmit {
474 buffer: req.buffer,
475
476 responder: SharedVmoIoTransmitResponder {
477 control_handle: std::mem::ManuallyDrop::new(control_handle),
478 tx_id: header.tx_id,
479 },
480 })
481 }
482 0x1c31986cc443db59 => {
483 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
484 let mut req = fidl::new_empty!(
485 SharedVmoIoReceiveRequest,
486 fidl::encoding::DefaultFuchsiaResourceDialect
487 );
488 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SharedVmoIoReceiveRequest>(&header, _body_bytes, handles, &mut req)?;
489 let control_handle = SharedVmoIoControlHandle { inner: this.inner.clone() };
490 Ok(SharedVmoIoRequest::Receive {
491 buffer: req.buffer,
492
493 responder: SharedVmoIoReceiveResponder {
494 control_handle: std::mem::ManuallyDrop::new(control_handle),
495 tx_id: header.tx_id,
496 },
497 })
498 }
499 0x6ddad3b45d5deccc => {
500 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
501 let mut req = fidl::new_empty!(
502 SharedVmoIoExchangeRequest,
503 fidl::encoding::DefaultFuchsiaResourceDialect
504 );
505 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SharedVmoIoExchangeRequest>(&header, _body_bytes, handles, &mut req)?;
506 let control_handle = SharedVmoIoControlHandle { inner: this.inner.clone() };
507 Ok(SharedVmoIoRequest::Exchange {
508 tx_buffer: req.tx_buffer,
509 rx_buffer: req.rx_buffer,
510
511 responder: SharedVmoIoExchangeResponder {
512 control_handle: std::mem::ManuallyDrop::new(control_handle),
513 tx_id: header.tx_id,
514 },
515 })
516 }
517 _ => Err(fidl::Error::UnknownOrdinal {
518 ordinal: header.ordinal,
519 protocol_name:
520 <SharedVmoIoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
521 }),
522 }))
523 },
524 )
525 }
526}
527
528#[derive(Debug)]
532pub enum SharedVmoIoRequest {
533 Transmit { buffer: SharedVmoBuffer, responder: SharedVmoIoTransmitResponder },
535 Receive { buffer: SharedVmoBuffer, responder: SharedVmoIoReceiveResponder },
537 Exchange {
540 tx_buffer: SharedVmoBuffer,
541 rx_buffer: SharedVmoBuffer,
542 responder: SharedVmoIoExchangeResponder,
543 },
544}
545
546impl SharedVmoIoRequest {
547 #[allow(irrefutable_let_patterns)]
548 pub fn into_transmit(self) -> Option<(SharedVmoBuffer, SharedVmoIoTransmitResponder)> {
549 if let SharedVmoIoRequest::Transmit { buffer, responder } = self {
550 Some((buffer, responder))
551 } else {
552 None
553 }
554 }
555
556 #[allow(irrefutable_let_patterns)]
557 pub fn into_receive(self) -> Option<(SharedVmoBuffer, SharedVmoIoReceiveResponder)> {
558 if let SharedVmoIoRequest::Receive { buffer, responder } = self {
559 Some((buffer, responder))
560 } else {
561 None
562 }
563 }
564
565 #[allow(irrefutable_let_patterns)]
566 pub fn into_exchange(
567 self,
568 ) -> Option<(SharedVmoBuffer, SharedVmoBuffer, SharedVmoIoExchangeResponder)> {
569 if let SharedVmoIoRequest::Exchange { tx_buffer, rx_buffer, responder } = self {
570 Some((tx_buffer, rx_buffer, responder))
571 } else {
572 None
573 }
574 }
575
576 pub fn method_name(&self) -> &'static str {
578 match *self {
579 SharedVmoIoRequest::Transmit { .. } => "transmit",
580 SharedVmoIoRequest::Receive { .. } => "receive",
581 SharedVmoIoRequest::Exchange { .. } => "exchange",
582 }
583 }
584}
585
586#[derive(Debug, Clone)]
587pub struct SharedVmoIoControlHandle {
588 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
589}
590
591impl SharedVmoIoControlHandle {
592 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
593 self.inner.shutdown_with_epitaph(status.into())
594 }
595}
596
597impl fidl::endpoints::ControlHandle for SharedVmoIoControlHandle {
598 fn shutdown(&self) {
599 self.inner.shutdown()
600 }
601
602 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
603 self.inner.shutdown_with_epitaph(status)
604 }
605
606 fn is_closed(&self) -> bool {
607 self.inner.channel().is_closed()
608 }
609 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
610 self.inner.channel().on_closed()
611 }
612
613 #[cfg(target_os = "fuchsia")]
614 fn signal_peer(
615 &self,
616 clear_mask: zx::Signals,
617 set_mask: zx::Signals,
618 ) -> Result<(), zx_status::Status> {
619 use fidl::Peered;
620 self.inner.channel().signal_peer(clear_mask, set_mask)
621 }
622}
623
624impl SharedVmoIoControlHandle {}
625
626#[must_use = "FIDL methods require a response to be sent"]
627#[derive(Debug)]
628pub struct SharedVmoIoTransmitResponder {
629 control_handle: std::mem::ManuallyDrop<SharedVmoIoControlHandle>,
630 tx_id: u32,
631}
632
633impl std::ops::Drop for SharedVmoIoTransmitResponder {
637 fn drop(&mut self) {
638 self.control_handle.shutdown();
639 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
641 }
642}
643
644impl fidl::endpoints::Responder for SharedVmoIoTransmitResponder {
645 type ControlHandle = SharedVmoIoControlHandle;
646
647 fn control_handle(&self) -> &SharedVmoIoControlHandle {
648 &self.control_handle
649 }
650
651 fn drop_without_shutdown(mut self) {
652 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
654 std::mem::forget(self);
656 }
657}
658
659impl SharedVmoIoTransmitResponder {
660 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
664 let _result = self.send_raw(result);
665 if _result.is_err() {
666 self.control_handle.shutdown();
667 }
668 self.drop_without_shutdown();
669 _result
670 }
671
672 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
674 let _result = self.send_raw(result);
675 self.drop_without_shutdown();
676 _result
677 }
678
679 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
680 self.control_handle
681 .inner
682 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
683 result,
684 self.tx_id,
685 0x791970e4c961b0bf,
686 fidl::encoding::DynamicFlags::empty(),
687 )
688 }
689}
690
691#[must_use = "FIDL methods require a response to be sent"]
692#[derive(Debug)]
693pub struct SharedVmoIoReceiveResponder {
694 control_handle: std::mem::ManuallyDrop<SharedVmoIoControlHandle>,
695 tx_id: u32,
696}
697
698impl std::ops::Drop for SharedVmoIoReceiveResponder {
702 fn drop(&mut self) {
703 self.control_handle.shutdown();
704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
706 }
707}
708
709impl fidl::endpoints::Responder for SharedVmoIoReceiveResponder {
710 type ControlHandle = SharedVmoIoControlHandle;
711
712 fn control_handle(&self) -> &SharedVmoIoControlHandle {
713 &self.control_handle
714 }
715
716 fn drop_without_shutdown(mut self) {
717 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
719 std::mem::forget(self);
721 }
722}
723
724impl SharedVmoIoReceiveResponder {
725 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
729 let _result = self.send_raw(result);
730 if _result.is_err() {
731 self.control_handle.shutdown();
732 }
733 self.drop_without_shutdown();
734 _result
735 }
736
737 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
739 let _result = self.send_raw(result);
740 self.drop_without_shutdown();
741 _result
742 }
743
744 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
745 self.control_handle
746 .inner
747 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
748 result,
749 self.tx_id,
750 0x1c31986cc443db59,
751 fidl::encoding::DynamicFlags::empty(),
752 )
753 }
754}
755
756#[must_use = "FIDL methods require a response to be sent"]
757#[derive(Debug)]
758pub struct SharedVmoIoExchangeResponder {
759 control_handle: std::mem::ManuallyDrop<SharedVmoIoControlHandle>,
760 tx_id: u32,
761}
762
763impl std::ops::Drop for SharedVmoIoExchangeResponder {
767 fn drop(&mut self) {
768 self.control_handle.shutdown();
769 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
771 }
772}
773
774impl fidl::endpoints::Responder for SharedVmoIoExchangeResponder {
775 type ControlHandle = SharedVmoIoControlHandle;
776
777 fn control_handle(&self) -> &SharedVmoIoControlHandle {
778 &self.control_handle
779 }
780
781 fn drop_without_shutdown(mut self) {
782 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
784 std::mem::forget(self);
786 }
787}
788
789impl SharedVmoIoExchangeResponder {
790 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
794 let _result = self.send_raw(result);
795 if _result.is_err() {
796 self.control_handle.shutdown();
797 }
798 self.drop_without_shutdown();
799 _result
800 }
801
802 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
804 let _result = self.send_raw(result);
805 self.drop_without_shutdown();
806 _result
807 }
808
809 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
810 self.control_handle
811 .inner
812 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
813 result,
814 self.tx_id,
815 0x6ddad3b45d5deccc,
816 fidl::encoding::DynamicFlags::empty(),
817 )
818 }
819}
820
821#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
822pub struct SharedVmoRegisterMarker;
823
824impl fidl::endpoints::ProtocolMarker for SharedVmoRegisterMarker {
825 type Proxy = SharedVmoRegisterProxy;
826 type RequestStream = SharedVmoRegisterRequestStream;
827 #[cfg(target_os = "fuchsia")]
828 type SynchronousProxy = SharedVmoRegisterSynchronousProxy;
829
830 const DEBUG_NAME: &'static str = "(anonymous) SharedVmoRegister";
831}
832pub type SharedVmoRegisterRegisterVmoResult = Result<(), i32>;
833pub type SharedVmoRegisterUnregisterVmoResult = Result<fidl::Vmo, i32>;
834
835pub trait SharedVmoRegisterProxyInterface: Send + Sync {
836 type RegisterVmoResponseFut: std::future::Future<Output = Result<SharedVmoRegisterRegisterVmoResult, fidl::Error>>
837 + Send;
838 fn r#register_vmo(
839 &self,
840 vmo_id: u32,
841 vmo: fidl_fuchsia_mem::Range,
842 rights: SharedVmoRight,
843 ) -> Self::RegisterVmoResponseFut;
844 type UnregisterVmoResponseFut: std::future::Future<Output = Result<SharedVmoRegisterUnregisterVmoResult, fidl::Error>>
845 + Send;
846 fn r#unregister_vmo(&self, vmo_id: u32) -> Self::UnregisterVmoResponseFut;
847}
848#[derive(Debug)]
849#[cfg(target_os = "fuchsia")]
850pub struct SharedVmoRegisterSynchronousProxy {
851 client: fidl::client::sync::Client,
852}
853
854#[cfg(target_os = "fuchsia")]
855impl fidl::endpoints::SynchronousProxy for SharedVmoRegisterSynchronousProxy {
856 type Proxy = SharedVmoRegisterProxy;
857 type Protocol = SharedVmoRegisterMarker;
858
859 fn from_channel(inner: fidl::Channel) -> Self {
860 Self::new(inner)
861 }
862
863 fn into_channel(self) -> fidl::Channel {
864 self.client.into_channel()
865 }
866
867 fn as_channel(&self) -> &fidl::Channel {
868 self.client.as_channel()
869 }
870}
871
872#[cfg(target_os = "fuchsia")]
873impl SharedVmoRegisterSynchronousProxy {
874 pub fn new(channel: fidl::Channel) -> Self {
875 Self { client: fidl::client::sync::Client::new(channel) }
876 }
877
878 pub fn into_channel(self) -> fidl::Channel {
879 self.client.into_channel()
880 }
881
882 pub fn wait_for_event(
885 &self,
886 deadline: zx::MonotonicInstant,
887 ) -> Result<SharedVmoRegisterEvent, fidl::Error> {
888 SharedVmoRegisterEvent::decode(
889 self.client.wait_for_event::<SharedVmoRegisterMarker>(deadline)?,
890 )
891 }
892
893 pub fn r#register_vmo(
900 &self,
901 mut vmo_id: u32,
902 mut vmo: fidl_fuchsia_mem::Range,
903 mut rights: SharedVmoRight,
904 ___deadline: zx::MonotonicInstant,
905 ) -> Result<SharedVmoRegisterRegisterVmoResult, fidl::Error> {
906 let _response = self.client.send_query::<
907 SharedVmoRegisterRegisterVmoRequest,
908 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
909 SharedVmoRegisterMarker,
910 >(
911 (vmo_id, &mut vmo, rights,),
912 0x31df51e1e6ea4a15,
913 fidl::encoding::DynamicFlags::empty(),
914 ___deadline,
915 )?;
916 Ok(_response.map(|x| x))
917 }
918
919 pub fn r#unregister_vmo(
921 &self,
922 mut vmo_id: u32,
923 ___deadline: zx::MonotonicInstant,
924 ) -> Result<SharedVmoRegisterUnregisterVmoResult, fidl::Error> {
925 let _response = self.client.send_query::<
926 SharedVmoRegisterUnregisterVmoRequest,
927 fidl::encoding::ResultType<SharedVmoRegisterUnregisterVmoResponse, i32>,
928 SharedVmoRegisterMarker,
929 >(
930 (vmo_id,),
931 0x1194e9b693827109,
932 fidl::encoding::DynamicFlags::empty(),
933 ___deadline,
934 )?;
935 Ok(_response.map(|x| x.vmo))
936 }
937}
938
939#[cfg(target_os = "fuchsia")]
940impl From<SharedVmoRegisterSynchronousProxy> for zx::NullableHandle {
941 fn from(value: SharedVmoRegisterSynchronousProxy) -> Self {
942 value.into_channel().into()
943 }
944}
945
946#[cfg(target_os = "fuchsia")]
947impl From<fidl::Channel> for SharedVmoRegisterSynchronousProxy {
948 fn from(value: fidl::Channel) -> Self {
949 Self::new(value)
950 }
951}
952
953#[cfg(target_os = "fuchsia")]
954impl fidl::endpoints::FromClient for SharedVmoRegisterSynchronousProxy {
955 type Protocol = SharedVmoRegisterMarker;
956
957 fn from_client(value: fidl::endpoints::ClientEnd<SharedVmoRegisterMarker>) -> Self {
958 Self::new(value.into_channel())
959 }
960}
961
962#[derive(Debug, Clone)]
963pub struct SharedVmoRegisterProxy {
964 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
965}
966
967impl fidl::endpoints::Proxy for SharedVmoRegisterProxy {
968 type Protocol = SharedVmoRegisterMarker;
969
970 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
971 Self::new(inner)
972 }
973
974 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
975 self.client.into_channel().map_err(|client| Self { client })
976 }
977
978 fn as_channel(&self) -> &::fidl::AsyncChannel {
979 self.client.as_channel()
980 }
981}
982
983impl SharedVmoRegisterProxy {
984 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
986 let protocol_name =
987 <SharedVmoRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
988 Self { client: fidl::client::Client::new(channel, protocol_name) }
989 }
990
991 pub fn take_event_stream(&self) -> SharedVmoRegisterEventStream {
997 SharedVmoRegisterEventStream { event_receiver: self.client.take_event_receiver() }
998 }
999
1000 pub fn r#register_vmo(
1007 &self,
1008 mut vmo_id: u32,
1009 mut vmo: fidl_fuchsia_mem::Range,
1010 mut rights: SharedVmoRight,
1011 ) -> fidl::client::QueryResponseFut<
1012 SharedVmoRegisterRegisterVmoResult,
1013 fidl::encoding::DefaultFuchsiaResourceDialect,
1014 > {
1015 SharedVmoRegisterProxyInterface::r#register_vmo(self, vmo_id, vmo, rights)
1016 }
1017
1018 pub fn r#unregister_vmo(
1020 &self,
1021 mut vmo_id: u32,
1022 ) -> fidl::client::QueryResponseFut<
1023 SharedVmoRegisterUnregisterVmoResult,
1024 fidl::encoding::DefaultFuchsiaResourceDialect,
1025 > {
1026 SharedVmoRegisterProxyInterface::r#unregister_vmo(self, vmo_id)
1027 }
1028}
1029
1030impl SharedVmoRegisterProxyInterface for SharedVmoRegisterProxy {
1031 type RegisterVmoResponseFut = fidl::client::QueryResponseFut<
1032 SharedVmoRegisterRegisterVmoResult,
1033 fidl::encoding::DefaultFuchsiaResourceDialect,
1034 >;
1035 fn r#register_vmo(
1036 &self,
1037 mut vmo_id: u32,
1038 mut vmo: fidl_fuchsia_mem::Range,
1039 mut rights: SharedVmoRight,
1040 ) -> Self::RegisterVmoResponseFut {
1041 fn _decode(
1042 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1043 ) -> Result<SharedVmoRegisterRegisterVmoResult, fidl::Error> {
1044 let _response = fidl::client::decode_transaction_body::<
1045 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1046 fidl::encoding::DefaultFuchsiaResourceDialect,
1047 0x31df51e1e6ea4a15,
1048 >(_buf?)?;
1049 Ok(_response.map(|x| x))
1050 }
1051 self.client.send_query_and_decode::<
1052 SharedVmoRegisterRegisterVmoRequest,
1053 SharedVmoRegisterRegisterVmoResult,
1054 >(
1055 (vmo_id, &mut vmo, rights,),
1056 0x31df51e1e6ea4a15,
1057 fidl::encoding::DynamicFlags::empty(),
1058 _decode,
1059 )
1060 }
1061
1062 type UnregisterVmoResponseFut = fidl::client::QueryResponseFut<
1063 SharedVmoRegisterUnregisterVmoResult,
1064 fidl::encoding::DefaultFuchsiaResourceDialect,
1065 >;
1066 fn r#unregister_vmo(&self, mut vmo_id: u32) -> Self::UnregisterVmoResponseFut {
1067 fn _decode(
1068 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1069 ) -> Result<SharedVmoRegisterUnregisterVmoResult, fidl::Error> {
1070 let _response = fidl::client::decode_transaction_body::<
1071 fidl::encoding::ResultType<SharedVmoRegisterUnregisterVmoResponse, i32>,
1072 fidl::encoding::DefaultFuchsiaResourceDialect,
1073 0x1194e9b693827109,
1074 >(_buf?)?;
1075 Ok(_response.map(|x| x.vmo))
1076 }
1077 self.client.send_query_and_decode::<
1078 SharedVmoRegisterUnregisterVmoRequest,
1079 SharedVmoRegisterUnregisterVmoResult,
1080 >(
1081 (vmo_id,),
1082 0x1194e9b693827109,
1083 fidl::encoding::DynamicFlags::empty(),
1084 _decode,
1085 )
1086 }
1087}
1088
1089pub struct SharedVmoRegisterEventStream {
1090 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1091}
1092
1093impl std::marker::Unpin for SharedVmoRegisterEventStream {}
1094
1095impl futures::stream::FusedStream for SharedVmoRegisterEventStream {
1096 fn is_terminated(&self) -> bool {
1097 self.event_receiver.is_terminated()
1098 }
1099}
1100
1101impl futures::Stream for SharedVmoRegisterEventStream {
1102 type Item = Result<SharedVmoRegisterEvent, fidl::Error>;
1103
1104 fn poll_next(
1105 mut self: std::pin::Pin<&mut Self>,
1106 cx: &mut std::task::Context<'_>,
1107 ) -> std::task::Poll<Option<Self::Item>> {
1108 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1109 &mut self.event_receiver,
1110 cx
1111 )?) {
1112 Some(buf) => std::task::Poll::Ready(Some(SharedVmoRegisterEvent::decode(buf))),
1113 None => std::task::Poll::Ready(None),
1114 }
1115 }
1116}
1117
1118#[derive(Debug)]
1119pub enum SharedVmoRegisterEvent {}
1120
1121impl SharedVmoRegisterEvent {
1122 fn decode(
1124 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1125 ) -> Result<SharedVmoRegisterEvent, fidl::Error> {
1126 let (bytes, _handles) = buf.split_mut();
1127 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1128 debug_assert_eq!(tx_header.tx_id, 0);
1129 match tx_header.ordinal {
1130 _ => Err(fidl::Error::UnknownOrdinal {
1131 ordinal: tx_header.ordinal,
1132 protocol_name:
1133 <SharedVmoRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1134 }),
1135 }
1136 }
1137}
1138
1139pub struct SharedVmoRegisterRequestStream {
1141 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1142 is_terminated: bool,
1143}
1144
1145impl std::marker::Unpin for SharedVmoRegisterRequestStream {}
1146
1147impl futures::stream::FusedStream for SharedVmoRegisterRequestStream {
1148 fn is_terminated(&self) -> bool {
1149 self.is_terminated
1150 }
1151}
1152
1153impl fidl::endpoints::RequestStream for SharedVmoRegisterRequestStream {
1154 type Protocol = SharedVmoRegisterMarker;
1155 type ControlHandle = SharedVmoRegisterControlHandle;
1156
1157 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1158 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1159 }
1160
1161 fn control_handle(&self) -> Self::ControlHandle {
1162 SharedVmoRegisterControlHandle { inner: self.inner.clone() }
1163 }
1164
1165 fn into_inner(
1166 self,
1167 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1168 {
1169 (self.inner, self.is_terminated)
1170 }
1171
1172 fn from_inner(
1173 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1174 is_terminated: bool,
1175 ) -> Self {
1176 Self { inner, is_terminated }
1177 }
1178}
1179
1180impl futures::Stream for SharedVmoRegisterRequestStream {
1181 type Item = Result<SharedVmoRegisterRequest, fidl::Error>;
1182
1183 fn poll_next(
1184 mut self: std::pin::Pin<&mut Self>,
1185 cx: &mut std::task::Context<'_>,
1186 ) -> std::task::Poll<Option<Self::Item>> {
1187 let this = &mut *self;
1188 if this.inner.check_shutdown(cx) {
1189 this.is_terminated = true;
1190 return std::task::Poll::Ready(None);
1191 }
1192 if this.is_terminated {
1193 panic!("polled SharedVmoRegisterRequestStream after completion");
1194 }
1195 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1196 |bytes, handles| {
1197 match this.inner.channel().read_etc(cx, bytes, handles) {
1198 std::task::Poll::Ready(Ok(())) => {}
1199 std::task::Poll::Pending => return std::task::Poll::Pending,
1200 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1201 this.is_terminated = true;
1202 return std::task::Poll::Ready(None);
1203 }
1204 std::task::Poll::Ready(Err(e)) => {
1205 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1206 e.into(),
1207 ))));
1208 }
1209 }
1210
1211 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1213
1214 std::task::Poll::Ready(Some(match header.ordinal {
1215 0x31df51e1e6ea4a15 => {
1216 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1217 let mut req = fidl::new_empty!(
1218 SharedVmoRegisterRegisterVmoRequest,
1219 fidl::encoding::DefaultFuchsiaResourceDialect
1220 );
1221 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SharedVmoRegisterRegisterVmoRequest>(&header, _body_bytes, handles, &mut req)?;
1222 let control_handle =
1223 SharedVmoRegisterControlHandle { inner: this.inner.clone() };
1224 Ok(SharedVmoRegisterRequest::RegisterVmo {
1225 vmo_id: req.vmo_id,
1226 vmo: req.vmo,
1227 rights: req.rights,
1228
1229 responder: SharedVmoRegisterRegisterVmoResponder {
1230 control_handle: std::mem::ManuallyDrop::new(control_handle),
1231 tx_id: header.tx_id,
1232 },
1233 })
1234 }
1235 0x1194e9b693827109 => {
1236 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1237 let mut req = fidl::new_empty!(
1238 SharedVmoRegisterUnregisterVmoRequest,
1239 fidl::encoding::DefaultFuchsiaResourceDialect
1240 );
1241 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SharedVmoRegisterUnregisterVmoRequest>(&header, _body_bytes, handles, &mut req)?;
1242 let control_handle =
1243 SharedVmoRegisterControlHandle { inner: this.inner.clone() };
1244 Ok(SharedVmoRegisterRequest::UnregisterVmo {
1245 vmo_id: req.vmo_id,
1246
1247 responder: SharedVmoRegisterUnregisterVmoResponder {
1248 control_handle: std::mem::ManuallyDrop::new(control_handle),
1249 tx_id: header.tx_id,
1250 },
1251 })
1252 }
1253 _ => Err(fidl::Error::UnknownOrdinal {
1254 ordinal: header.ordinal,
1255 protocol_name:
1256 <SharedVmoRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1257 }),
1258 }))
1259 },
1260 )
1261 }
1262}
1263
1264#[derive(Debug)]
1266pub enum SharedVmoRegisterRequest {
1267 RegisterVmo {
1274 vmo_id: u32,
1275 vmo: fidl_fuchsia_mem::Range,
1276 rights: SharedVmoRight,
1277 responder: SharedVmoRegisterRegisterVmoResponder,
1278 },
1279 UnregisterVmo { vmo_id: u32, responder: SharedVmoRegisterUnregisterVmoResponder },
1281}
1282
1283impl SharedVmoRegisterRequest {
1284 #[allow(irrefutable_let_patterns)]
1285 pub fn into_register_vmo(
1286 self,
1287 ) -> Option<(u32, fidl_fuchsia_mem::Range, SharedVmoRight, SharedVmoRegisterRegisterVmoResponder)>
1288 {
1289 if let SharedVmoRegisterRequest::RegisterVmo { vmo_id, vmo, rights, responder } = self {
1290 Some((vmo_id, vmo, rights, responder))
1291 } else {
1292 None
1293 }
1294 }
1295
1296 #[allow(irrefutable_let_patterns)]
1297 pub fn into_unregister_vmo(self) -> Option<(u32, SharedVmoRegisterUnregisterVmoResponder)> {
1298 if let SharedVmoRegisterRequest::UnregisterVmo { vmo_id, responder } = self {
1299 Some((vmo_id, responder))
1300 } else {
1301 None
1302 }
1303 }
1304
1305 pub fn method_name(&self) -> &'static str {
1307 match *self {
1308 SharedVmoRegisterRequest::RegisterVmo { .. } => "register_vmo",
1309 SharedVmoRegisterRequest::UnregisterVmo { .. } => "unregister_vmo",
1310 }
1311 }
1312}
1313
1314#[derive(Debug, Clone)]
1315pub struct SharedVmoRegisterControlHandle {
1316 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1317}
1318
1319impl SharedVmoRegisterControlHandle {
1320 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1321 self.inner.shutdown_with_epitaph(status.into())
1322 }
1323}
1324
1325impl fidl::endpoints::ControlHandle for SharedVmoRegisterControlHandle {
1326 fn shutdown(&self) {
1327 self.inner.shutdown()
1328 }
1329
1330 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1331 self.inner.shutdown_with_epitaph(status)
1332 }
1333
1334 fn is_closed(&self) -> bool {
1335 self.inner.channel().is_closed()
1336 }
1337 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1338 self.inner.channel().on_closed()
1339 }
1340
1341 #[cfg(target_os = "fuchsia")]
1342 fn signal_peer(
1343 &self,
1344 clear_mask: zx::Signals,
1345 set_mask: zx::Signals,
1346 ) -> Result<(), zx_status::Status> {
1347 use fidl::Peered;
1348 self.inner.channel().signal_peer(clear_mask, set_mask)
1349 }
1350}
1351
1352impl SharedVmoRegisterControlHandle {}
1353
1354#[must_use = "FIDL methods require a response to be sent"]
1355#[derive(Debug)]
1356pub struct SharedVmoRegisterRegisterVmoResponder {
1357 control_handle: std::mem::ManuallyDrop<SharedVmoRegisterControlHandle>,
1358 tx_id: u32,
1359}
1360
1361impl std::ops::Drop for SharedVmoRegisterRegisterVmoResponder {
1365 fn drop(&mut self) {
1366 self.control_handle.shutdown();
1367 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1369 }
1370}
1371
1372impl fidl::endpoints::Responder for SharedVmoRegisterRegisterVmoResponder {
1373 type ControlHandle = SharedVmoRegisterControlHandle;
1374
1375 fn control_handle(&self) -> &SharedVmoRegisterControlHandle {
1376 &self.control_handle
1377 }
1378
1379 fn drop_without_shutdown(mut self) {
1380 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1382 std::mem::forget(self);
1384 }
1385}
1386
1387impl SharedVmoRegisterRegisterVmoResponder {
1388 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1392 let _result = self.send_raw(result);
1393 if _result.is_err() {
1394 self.control_handle.shutdown();
1395 }
1396 self.drop_without_shutdown();
1397 _result
1398 }
1399
1400 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1402 let _result = self.send_raw(result);
1403 self.drop_without_shutdown();
1404 _result
1405 }
1406
1407 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1408 self.control_handle
1409 .inner
1410 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1411 result,
1412 self.tx_id,
1413 0x31df51e1e6ea4a15,
1414 fidl::encoding::DynamicFlags::empty(),
1415 )
1416 }
1417}
1418
1419#[must_use = "FIDL methods require a response to be sent"]
1420#[derive(Debug)]
1421pub struct SharedVmoRegisterUnregisterVmoResponder {
1422 control_handle: std::mem::ManuallyDrop<SharedVmoRegisterControlHandle>,
1423 tx_id: u32,
1424}
1425
1426impl std::ops::Drop for SharedVmoRegisterUnregisterVmoResponder {
1430 fn drop(&mut self) {
1431 self.control_handle.shutdown();
1432 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1434 }
1435}
1436
1437impl fidl::endpoints::Responder for SharedVmoRegisterUnregisterVmoResponder {
1438 type ControlHandle = SharedVmoRegisterControlHandle;
1439
1440 fn control_handle(&self) -> &SharedVmoRegisterControlHandle {
1441 &self.control_handle
1442 }
1443
1444 fn drop_without_shutdown(mut self) {
1445 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1447 std::mem::forget(self);
1449 }
1450}
1451
1452impl SharedVmoRegisterUnregisterVmoResponder {
1453 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1457 let _result = self.send_raw(result);
1458 if _result.is_err() {
1459 self.control_handle.shutdown();
1460 }
1461 self.drop_without_shutdown();
1462 _result
1463 }
1464
1465 pub fn send_no_shutdown_on_err(
1467 self,
1468 mut result: Result<fidl::Vmo, i32>,
1469 ) -> Result<(), fidl::Error> {
1470 let _result = self.send_raw(result);
1471 self.drop_without_shutdown();
1472 _result
1473 }
1474
1475 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1476 self.control_handle.inner.send::<fidl::encoding::ResultType<
1477 SharedVmoRegisterUnregisterVmoResponse,
1478 i32,
1479 >>(
1480 result.map(|vmo| (vmo,)),
1481 self.tx_id,
1482 0x1194e9b693827109,
1483 fidl::encoding::DynamicFlags::empty(),
1484 )
1485 }
1486}
1487
1488mod internal {
1489 use super::*;
1490
1491 impl fidl::encoding::ResourceTypeMarker for SharedVmoRegisterRegisterVmoRequest {
1492 type Borrowed<'a> = &'a mut Self;
1493 fn take_or_borrow<'a>(
1494 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1495 ) -> Self::Borrowed<'a> {
1496 value
1497 }
1498 }
1499
1500 unsafe impl fidl::encoding::TypeMarker for SharedVmoRegisterRegisterVmoRequest {
1501 type Owned = Self;
1502
1503 #[inline(always)]
1504 fn inline_align(_context: fidl::encoding::Context) -> usize {
1505 8
1506 }
1507
1508 #[inline(always)]
1509 fn inline_size(_context: fidl::encoding::Context) -> usize {
1510 40
1511 }
1512 }
1513
1514 unsafe impl
1515 fidl::encoding::Encode<
1516 SharedVmoRegisterRegisterVmoRequest,
1517 fidl::encoding::DefaultFuchsiaResourceDialect,
1518 > for &mut SharedVmoRegisterRegisterVmoRequest
1519 {
1520 #[inline]
1521 unsafe fn encode(
1522 self,
1523 encoder: &mut fidl::encoding::Encoder<
1524 '_,
1525 fidl::encoding::DefaultFuchsiaResourceDialect,
1526 >,
1527 offset: usize,
1528 _depth: fidl::encoding::Depth,
1529 ) -> fidl::Result<()> {
1530 encoder.debug_check_bounds::<SharedVmoRegisterRegisterVmoRequest>(offset);
1531 fidl::encoding::Encode::<
1533 SharedVmoRegisterRegisterVmoRequest,
1534 fidl::encoding::DefaultFuchsiaResourceDialect,
1535 >::encode(
1536 (
1537 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_id),
1538 <fidl_fuchsia_mem::Range as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1539 &mut self.vmo,
1540 ),
1541 <SharedVmoRight as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
1542 ),
1543 encoder,
1544 offset,
1545 _depth,
1546 )
1547 }
1548 }
1549 unsafe impl<
1550 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1551 T1: fidl::encoding::Encode<
1552 fidl_fuchsia_mem::Range,
1553 fidl::encoding::DefaultFuchsiaResourceDialect,
1554 >,
1555 T2: fidl::encoding::Encode<SharedVmoRight, fidl::encoding::DefaultFuchsiaResourceDialect>,
1556 >
1557 fidl::encoding::Encode<
1558 SharedVmoRegisterRegisterVmoRequest,
1559 fidl::encoding::DefaultFuchsiaResourceDialect,
1560 > for (T0, T1, T2)
1561 {
1562 #[inline]
1563 unsafe fn encode(
1564 self,
1565 encoder: &mut fidl::encoding::Encoder<
1566 '_,
1567 fidl::encoding::DefaultFuchsiaResourceDialect,
1568 >,
1569 offset: usize,
1570 depth: fidl::encoding::Depth,
1571 ) -> fidl::Result<()> {
1572 encoder.debug_check_bounds::<SharedVmoRegisterRegisterVmoRequest>(offset);
1573 unsafe {
1576 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1577 (ptr as *mut u64).write_unaligned(0);
1578 }
1579 unsafe {
1580 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
1581 (ptr as *mut u64).write_unaligned(0);
1582 }
1583 self.0.encode(encoder, offset + 0, depth)?;
1585 self.1.encode(encoder, offset + 8, depth)?;
1586 self.2.encode(encoder, offset + 32, depth)?;
1587 Ok(())
1588 }
1589 }
1590
1591 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1592 for SharedVmoRegisterRegisterVmoRequest
1593 {
1594 #[inline(always)]
1595 fn new_empty() -> Self {
1596 Self {
1597 vmo_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
1598 vmo: fidl::new_empty!(
1599 fidl_fuchsia_mem::Range,
1600 fidl::encoding::DefaultFuchsiaResourceDialect
1601 ),
1602 rights: fidl::new_empty!(
1603 SharedVmoRight,
1604 fidl::encoding::DefaultFuchsiaResourceDialect
1605 ),
1606 }
1607 }
1608
1609 #[inline]
1610 unsafe fn decode(
1611 &mut self,
1612 decoder: &mut fidl::encoding::Decoder<
1613 '_,
1614 fidl::encoding::DefaultFuchsiaResourceDialect,
1615 >,
1616 offset: usize,
1617 _depth: fidl::encoding::Depth,
1618 ) -> fidl::Result<()> {
1619 decoder.debug_check_bounds::<Self>(offset);
1620 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1622 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1623 let mask = 0xffffffff00000000u64;
1624 let maskedval = padval & mask;
1625 if maskedval != 0 {
1626 return Err(fidl::Error::NonZeroPadding {
1627 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1628 });
1629 }
1630 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
1631 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1632 let mask = 0xffffffff00000000u64;
1633 let maskedval = padval & mask;
1634 if maskedval != 0 {
1635 return Err(fidl::Error::NonZeroPadding {
1636 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
1637 });
1638 }
1639 fidl::decode!(
1640 u32,
1641 fidl::encoding::DefaultFuchsiaResourceDialect,
1642 &mut self.vmo_id,
1643 decoder,
1644 offset + 0,
1645 _depth
1646 )?;
1647 fidl::decode!(
1648 fidl_fuchsia_mem::Range,
1649 fidl::encoding::DefaultFuchsiaResourceDialect,
1650 &mut self.vmo,
1651 decoder,
1652 offset + 8,
1653 _depth
1654 )?;
1655 fidl::decode!(
1656 SharedVmoRight,
1657 fidl::encoding::DefaultFuchsiaResourceDialect,
1658 &mut self.rights,
1659 decoder,
1660 offset + 32,
1661 _depth
1662 )?;
1663 Ok(())
1664 }
1665 }
1666
1667 impl fidl::encoding::ResourceTypeMarker for SharedVmoRegisterUnregisterVmoResponse {
1668 type Borrowed<'a> = &'a mut Self;
1669 fn take_or_borrow<'a>(
1670 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1671 ) -> Self::Borrowed<'a> {
1672 value
1673 }
1674 }
1675
1676 unsafe impl fidl::encoding::TypeMarker for SharedVmoRegisterUnregisterVmoResponse {
1677 type Owned = Self;
1678
1679 #[inline(always)]
1680 fn inline_align(_context: fidl::encoding::Context) -> usize {
1681 4
1682 }
1683
1684 #[inline(always)]
1685 fn inline_size(_context: fidl::encoding::Context) -> usize {
1686 4
1687 }
1688 }
1689
1690 unsafe impl
1691 fidl::encoding::Encode<
1692 SharedVmoRegisterUnregisterVmoResponse,
1693 fidl::encoding::DefaultFuchsiaResourceDialect,
1694 > for &mut SharedVmoRegisterUnregisterVmoResponse
1695 {
1696 #[inline]
1697 unsafe fn encode(
1698 self,
1699 encoder: &mut fidl::encoding::Encoder<
1700 '_,
1701 fidl::encoding::DefaultFuchsiaResourceDialect,
1702 >,
1703 offset: usize,
1704 _depth: fidl::encoding::Depth,
1705 ) -> fidl::Result<()> {
1706 encoder.debug_check_bounds::<SharedVmoRegisterUnregisterVmoResponse>(offset);
1707 fidl::encoding::Encode::<
1709 SharedVmoRegisterUnregisterVmoResponse,
1710 fidl::encoding::DefaultFuchsiaResourceDialect,
1711 >::encode(
1712 (<fidl::encoding::HandleType<
1713 fidl::Vmo,
1714 { fidl::ObjectType::VMO.into_raw() },
1715 2147483648,
1716 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1717 &mut self.vmo
1718 ),),
1719 encoder,
1720 offset,
1721 _depth,
1722 )
1723 }
1724 }
1725 unsafe impl<
1726 T0: fidl::encoding::Encode<
1727 fidl::encoding::HandleType<
1728 fidl::Vmo,
1729 { fidl::ObjectType::VMO.into_raw() },
1730 2147483648,
1731 >,
1732 fidl::encoding::DefaultFuchsiaResourceDialect,
1733 >,
1734 >
1735 fidl::encoding::Encode<
1736 SharedVmoRegisterUnregisterVmoResponse,
1737 fidl::encoding::DefaultFuchsiaResourceDialect,
1738 > for (T0,)
1739 {
1740 #[inline]
1741 unsafe fn encode(
1742 self,
1743 encoder: &mut fidl::encoding::Encoder<
1744 '_,
1745 fidl::encoding::DefaultFuchsiaResourceDialect,
1746 >,
1747 offset: usize,
1748 depth: fidl::encoding::Depth,
1749 ) -> fidl::Result<()> {
1750 encoder.debug_check_bounds::<SharedVmoRegisterUnregisterVmoResponse>(offset);
1751 self.0.encode(encoder, offset + 0, depth)?;
1755 Ok(())
1756 }
1757 }
1758
1759 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1760 for SharedVmoRegisterUnregisterVmoResponse
1761 {
1762 #[inline(always)]
1763 fn new_empty() -> Self {
1764 Self {
1765 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1766 }
1767 }
1768
1769 #[inline]
1770 unsafe fn decode(
1771 &mut self,
1772 decoder: &mut fidl::encoding::Decoder<
1773 '_,
1774 fidl::encoding::DefaultFuchsiaResourceDialect,
1775 >,
1776 offset: usize,
1777 _depth: fidl::encoding::Depth,
1778 ) -> fidl::Result<()> {
1779 decoder.debug_check_bounds::<Self>(offset);
1780 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
1782 Ok(())
1783 }
1784 }
1785}