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_storage_mapping_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct MappingProviderOpenSessionRequest {
16 pub session: fidl::endpoints::ServerEnd<MappingSessionMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for MappingProviderOpenSessionRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct MappingProviderOpenSessionResponse {
26 pub mapping_vmo: fidl::Vmo,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for MappingProviderOpenSessionResponse
31{
32}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct MappingProviderMarker;
36
37impl fidl::endpoints::ProtocolMarker for MappingProviderMarker {
38 type Proxy = MappingProviderProxy;
39 type RequestStream = MappingProviderRequestStream;
40 #[cfg(target_os = "fuchsia")]
41 type SynchronousProxy = MappingProviderSynchronousProxy;
42
43 const DEBUG_NAME: &'static str = "fuchsia.storage.mapping.MappingProvider";
44}
45impl fidl::endpoints::DiscoverableProtocolMarker for MappingProviderMarker {}
46pub type MappingProviderOpenSessionResult = Result<fidl::Vmo, i32>;
47
48pub trait MappingProviderProxyInterface: Send + Sync {
49 type OpenSessionResponseFut: std::future::Future<Output = Result<MappingProviderOpenSessionResult, fidl::Error>>
50 + Send;
51 fn r#open_session(
52 &self,
53 session: fidl::endpoints::ServerEnd<MappingSessionMarker>,
54 ) -> Self::OpenSessionResponseFut;
55}
56#[derive(Debug)]
57#[cfg(target_os = "fuchsia")]
58pub struct MappingProviderSynchronousProxy {
59 client: fidl::client::sync::Client,
60}
61
62#[cfg(target_os = "fuchsia")]
63impl fidl::endpoints::SynchronousProxy for MappingProviderSynchronousProxy {
64 type Proxy = MappingProviderProxy;
65 type Protocol = MappingProviderMarker;
66
67 fn from_channel(inner: fidl::Channel) -> Self {
68 Self::new(inner)
69 }
70
71 fn into_channel(self) -> fidl::Channel {
72 self.client.into_channel()
73 }
74
75 fn as_channel(&self) -> &fidl::Channel {
76 self.client.as_channel()
77 }
78}
79
80#[cfg(target_os = "fuchsia")]
81impl MappingProviderSynchronousProxy {
82 pub fn new(channel: fidl::Channel) -> Self {
83 Self { client: fidl::client::sync::Client::new(channel) }
84 }
85
86 pub fn into_channel(self) -> fidl::Channel {
87 self.client.into_channel()
88 }
89
90 pub fn wait_for_event(
93 &self,
94 deadline: zx::MonotonicInstant,
95 ) -> Result<MappingProviderEvent, fidl::Error> {
96 MappingProviderEvent::decode(self.client.wait_for_event::<MappingProviderMarker>(deadline)?)
97 }
98
99 pub fn r#open_session(
101 &self,
102 mut session: fidl::endpoints::ServerEnd<MappingSessionMarker>,
103 ___deadline: zx::MonotonicInstant,
104 ) -> Result<MappingProviderOpenSessionResult, fidl::Error> {
105 let _response = self.client.send_query::<
106 MappingProviderOpenSessionRequest,
107 fidl::encoding::FlexibleResultType<MappingProviderOpenSessionResponse, i32>,
108 MappingProviderMarker,
109 >(
110 (session,),
111 0x392ee248d504919a,
112 fidl::encoding::DynamicFlags::FLEXIBLE,
113 ___deadline,
114 )?
115 .into_result::<MappingProviderMarker>("open_session")?;
116 Ok(_response.map(|x| x.mapping_vmo))
117 }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<MappingProviderSynchronousProxy> for zx::NullableHandle {
122 fn from(value: MappingProviderSynchronousProxy) -> Self {
123 value.into_channel().into()
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl From<fidl::Channel> for MappingProviderSynchronousProxy {
129 fn from(value: fidl::Channel) -> Self {
130 Self::new(value)
131 }
132}
133
134#[cfg(target_os = "fuchsia")]
135impl fidl::endpoints::FromClient for MappingProviderSynchronousProxy {
136 type Protocol = MappingProviderMarker;
137
138 fn from_client(value: fidl::endpoints::ClientEnd<MappingProviderMarker>) -> Self {
139 Self::new(value.into_channel())
140 }
141}
142
143#[derive(Debug, Clone)]
144pub struct MappingProviderProxy {
145 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
146}
147
148impl fidl::endpoints::Proxy for MappingProviderProxy {
149 type Protocol = MappingProviderMarker;
150
151 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
152 Self::new(inner)
153 }
154
155 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
156 self.client.into_channel().map_err(|client| Self { client })
157 }
158
159 fn as_channel(&self) -> &::fidl::AsyncChannel {
160 self.client.as_channel()
161 }
162}
163
164impl MappingProviderProxy {
165 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
167 let protocol_name = <MappingProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
168 Self { client: fidl::client::Client::new(channel, protocol_name) }
169 }
170
171 pub fn take_event_stream(&self) -> MappingProviderEventStream {
177 MappingProviderEventStream { event_receiver: self.client.take_event_receiver() }
178 }
179
180 pub fn r#open_session(
182 &self,
183 mut session: fidl::endpoints::ServerEnd<MappingSessionMarker>,
184 ) -> fidl::client::QueryResponseFut<
185 MappingProviderOpenSessionResult,
186 fidl::encoding::DefaultFuchsiaResourceDialect,
187 > {
188 MappingProviderProxyInterface::r#open_session(self, session)
189 }
190}
191
192impl MappingProviderProxyInterface for MappingProviderProxy {
193 type OpenSessionResponseFut = fidl::client::QueryResponseFut<
194 MappingProviderOpenSessionResult,
195 fidl::encoding::DefaultFuchsiaResourceDialect,
196 >;
197 fn r#open_session(
198 &self,
199 mut session: fidl::endpoints::ServerEnd<MappingSessionMarker>,
200 ) -> Self::OpenSessionResponseFut {
201 fn _decode(
202 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
203 ) -> Result<MappingProviderOpenSessionResult, fidl::Error> {
204 let _response = fidl::client::decode_transaction_body::<
205 fidl::encoding::FlexibleResultType<MappingProviderOpenSessionResponse, i32>,
206 fidl::encoding::DefaultFuchsiaResourceDialect,
207 0x392ee248d504919a,
208 >(_buf?)?
209 .into_result::<MappingProviderMarker>("open_session")?;
210 Ok(_response.map(|x| x.mapping_vmo))
211 }
212 self.client.send_query_and_decode::<
213 MappingProviderOpenSessionRequest,
214 MappingProviderOpenSessionResult,
215 >(
216 (session,),
217 0x392ee248d504919a,
218 fidl::encoding::DynamicFlags::FLEXIBLE,
219 _decode,
220 )
221 }
222}
223
224pub struct MappingProviderEventStream {
225 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
226}
227
228impl std::marker::Unpin for MappingProviderEventStream {}
229
230impl futures::stream::FusedStream for MappingProviderEventStream {
231 fn is_terminated(&self) -> bool {
232 self.event_receiver.is_terminated()
233 }
234}
235
236impl futures::Stream for MappingProviderEventStream {
237 type Item = Result<MappingProviderEvent, fidl::Error>;
238
239 fn poll_next(
240 mut self: std::pin::Pin<&mut Self>,
241 cx: &mut std::task::Context<'_>,
242 ) -> std::task::Poll<Option<Self::Item>> {
243 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
244 &mut self.event_receiver,
245 cx
246 )?) {
247 Some(buf) => std::task::Poll::Ready(Some(MappingProviderEvent::decode(buf))),
248 None => std::task::Poll::Ready(None),
249 }
250 }
251}
252
253#[derive(Debug)]
254pub enum MappingProviderEvent {
255 #[non_exhaustive]
256 _UnknownEvent {
257 ordinal: u64,
259 },
260}
261
262impl MappingProviderEvent {
263 fn decode(
265 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
266 ) -> Result<MappingProviderEvent, fidl::Error> {
267 let (bytes, _handles) = buf.split_mut();
268 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
269 debug_assert_eq!(tx_header.tx_id, 0);
270 match tx_header.ordinal {
271 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
272 Ok(MappingProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
273 }
274 _ => Err(fidl::Error::UnknownOrdinal {
275 ordinal: tx_header.ordinal,
276 protocol_name:
277 <MappingProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
278 }),
279 }
280 }
281}
282
283pub struct MappingProviderRequestStream {
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286 is_terminated: bool,
287}
288
289impl std::marker::Unpin for MappingProviderRequestStream {}
290
291impl futures::stream::FusedStream for MappingProviderRequestStream {
292 fn is_terminated(&self) -> bool {
293 self.is_terminated
294 }
295}
296
297impl fidl::endpoints::RequestStream for MappingProviderRequestStream {
298 type Protocol = MappingProviderMarker;
299 type ControlHandle = MappingProviderControlHandle;
300
301 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
302 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
303 }
304
305 fn control_handle(&self) -> Self::ControlHandle {
306 MappingProviderControlHandle { inner: self.inner.clone() }
307 }
308
309 fn into_inner(
310 self,
311 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
312 {
313 (self.inner, self.is_terminated)
314 }
315
316 fn from_inner(
317 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
318 is_terminated: bool,
319 ) -> Self {
320 Self { inner, is_terminated }
321 }
322}
323
324impl futures::Stream for MappingProviderRequestStream {
325 type Item = Result<MappingProviderRequest, fidl::Error>;
326
327 fn poll_next(
328 mut self: std::pin::Pin<&mut Self>,
329 cx: &mut std::task::Context<'_>,
330 ) -> std::task::Poll<Option<Self::Item>> {
331 let this = &mut *self;
332 if this.inner.check_shutdown(cx) {
333 this.is_terminated = true;
334 return std::task::Poll::Ready(None);
335 }
336 if this.is_terminated {
337 panic!("polled MappingProviderRequestStream after completion");
338 }
339 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
340 |bytes, handles| {
341 match this.inner.channel().read_etc(cx, bytes, handles) {
342 std::task::Poll::Ready(Ok(())) => {}
343 std::task::Poll::Pending => return std::task::Poll::Pending,
344 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
345 this.is_terminated = true;
346 return std::task::Poll::Ready(None);
347 }
348 std::task::Poll::Ready(Err(e)) => {
349 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
350 e.into(),
351 ))));
352 }
353 }
354
355 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
357
358 std::task::Poll::Ready(Some(match header.ordinal {
359 0x392ee248d504919a => {
360 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
361 let mut req = fidl::new_empty!(
362 MappingProviderOpenSessionRequest,
363 fidl::encoding::DefaultFuchsiaResourceDialect
364 );
365 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MappingProviderOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
366 let control_handle =
367 MappingProviderControlHandle { inner: this.inner.clone() };
368 Ok(MappingProviderRequest::OpenSession {
369 session: req.session,
370
371 responder: MappingProviderOpenSessionResponder {
372 control_handle: std::mem::ManuallyDrop::new(control_handle),
373 tx_id: header.tx_id,
374 },
375 })
376 }
377 _ if header.tx_id == 0
378 && header
379 .dynamic_flags()
380 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
381 {
382 Ok(MappingProviderRequest::_UnknownMethod {
383 ordinal: header.ordinal,
384 control_handle: MappingProviderControlHandle {
385 inner: this.inner.clone(),
386 },
387 method_type: fidl::MethodType::OneWay,
388 })
389 }
390 _ if header
391 .dynamic_flags()
392 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
393 {
394 this.inner.send_framework_err(
395 fidl::encoding::FrameworkErr::UnknownMethod,
396 header.tx_id,
397 header.ordinal,
398 header.dynamic_flags(),
399 (bytes, handles),
400 )?;
401 Ok(MappingProviderRequest::_UnknownMethod {
402 ordinal: header.ordinal,
403 control_handle: MappingProviderControlHandle {
404 inner: this.inner.clone(),
405 },
406 method_type: fidl::MethodType::TwoWay,
407 })
408 }
409 _ => Err(fidl::Error::UnknownOrdinal {
410 ordinal: header.ordinal,
411 protocol_name:
412 <MappingProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
413 }),
414 }))
415 },
416 )
417 }
418}
419
420#[derive(Debug)]
421pub enum MappingProviderRequest {
422 OpenSession {
424 session: fidl::endpoints::ServerEnd<MappingSessionMarker>,
425 responder: MappingProviderOpenSessionResponder,
426 },
427 #[non_exhaustive]
429 _UnknownMethod {
430 ordinal: u64,
432 control_handle: MappingProviderControlHandle,
433 method_type: fidl::MethodType,
434 },
435}
436
437impl MappingProviderRequest {
438 #[allow(irrefutable_let_patterns)]
439 pub fn into_open_session(
440 self,
441 ) -> Option<(
442 fidl::endpoints::ServerEnd<MappingSessionMarker>,
443 MappingProviderOpenSessionResponder,
444 )> {
445 if let MappingProviderRequest::OpenSession { session, responder } = self {
446 Some((session, responder))
447 } else {
448 None
449 }
450 }
451
452 pub fn method_name(&self) -> &'static str {
454 match *self {
455 MappingProviderRequest::OpenSession { .. } => "open_session",
456 MappingProviderRequest::_UnknownMethod {
457 method_type: fidl::MethodType::OneWay,
458 ..
459 } => "unknown one-way method",
460 MappingProviderRequest::_UnknownMethod {
461 method_type: fidl::MethodType::TwoWay,
462 ..
463 } => "unknown two-way method",
464 }
465 }
466}
467
468#[derive(Debug, Clone)]
469pub struct MappingProviderControlHandle {
470 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
471}
472
473impl MappingProviderControlHandle {
474 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
475 self.inner.shutdown_with_epitaph(status.into())
476 }
477}
478
479impl fidl::endpoints::ControlHandle for MappingProviderControlHandle {
480 fn shutdown(&self) {
481 self.inner.shutdown()
482 }
483
484 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
485 self.inner.shutdown_with_epitaph(status)
486 }
487
488 fn is_closed(&self) -> bool {
489 self.inner.channel().is_closed()
490 }
491 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
492 self.inner.channel().on_closed()
493 }
494
495 #[cfg(target_os = "fuchsia")]
496 fn signal_peer(
497 &self,
498 clear_mask: zx::Signals,
499 set_mask: zx::Signals,
500 ) -> Result<(), zx_status::Status> {
501 use fidl::Peered;
502 self.inner.channel().signal_peer(clear_mask, set_mask)
503 }
504}
505
506impl MappingProviderControlHandle {}
507
508#[must_use = "FIDL methods require a response to be sent"]
509#[derive(Debug)]
510pub struct MappingProviderOpenSessionResponder {
511 control_handle: std::mem::ManuallyDrop<MappingProviderControlHandle>,
512 tx_id: u32,
513}
514
515impl std::ops::Drop for MappingProviderOpenSessionResponder {
519 fn drop(&mut self) {
520 self.control_handle.shutdown();
521 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
523 }
524}
525
526impl fidl::endpoints::Responder for MappingProviderOpenSessionResponder {
527 type ControlHandle = MappingProviderControlHandle;
528
529 fn control_handle(&self) -> &MappingProviderControlHandle {
530 &self.control_handle
531 }
532
533 fn drop_without_shutdown(mut self) {
534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
536 std::mem::forget(self);
538 }
539}
540
541impl MappingProviderOpenSessionResponder {
542 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
546 let _result = self.send_raw(result);
547 if _result.is_err() {
548 self.control_handle.shutdown();
549 }
550 self.drop_without_shutdown();
551 _result
552 }
553
554 pub fn send_no_shutdown_on_err(
556 self,
557 mut result: Result<fidl::Vmo, i32>,
558 ) -> Result<(), fidl::Error> {
559 let _result = self.send_raw(result);
560 self.drop_without_shutdown();
561 _result
562 }
563
564 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
565 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
566 MappingProviderOpenSessionResponse,
567 i32,
568 >>(
569 fidl::encoding::FlexibleResult::new(result.map(|mapping_vmo| (mapping_vmo,))),
570 self.tx_id,
571 0x392ee248d504919a,
572 fidl::encoding::DynamicFlags::FLEXIBLE,
573 )
574 }
575}
576
577#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
578pub struct MappingSessionMarker;
579
580impl fidl::endpoints::ProtocolMarker for MappingSessionMarker {
581 type Proxy = MappingSessionProxy;
582 type RequestStream = MappingSessionRequestStream;
583 #[cfg(target_os = "fuchsia")]
584 type SynchronousProxy = MappingSessionSynchronousProxy;
585
586 const DEBUG_NAME: &'static str = "(anonymous) MappingSession";
587}
588pub type MappingSessionOpenResult = Result<u64, i32>;
589pub type MappingSessionCloseResult = Result<(), i32>;
590
591pub trait MappingSessionProxyInterface: Send + Sync {
592 type OpenResponseFut: std::future::Future<Output = Result<MappingSessionOpenResult, fidl::Error>>
593 + Send;
594 fn r#open(&self, key: u64, identifier: &[u8]) -> Self::OpenResponseFut;
595 type CloseResponseFut: std::future::Future<Output = Result<MappingSessionCloseResult, fidl::Error>>
596 + Send;
597 fn r#close(&self, key: u64) -> Self::CloseResponseFut;
598}
599#[derive(Debug)]
600#[cfg(target_os = "fuchsia")]
601pub struct MappingSessionSynchronousProxy {
602 client: fidl::client::sync::Client,
603}
604
605#[cfg(target_os = "fuchsia")]
606impl fidl::endpoints::SynchronousProxy for MappingSessionSynchronousProxy {
607 type Proxy = MappingSessionProxy;
608 type Protocol = MappingSessionMarker;
609
610 fn from_channel(inner: fidl::Channel) -> Self {
611 Self::new(inner)
612 }
613
614 fn into_channel(self) -> fidl::Channel {
615 self.client.into_channel()
616 }
617
618 fn as_channel(&self) -> &fidl::Channel {
619 self.client.as_channel()
620 }
621}
622
623#[cfg(target_os = "fuchsia")]
624impl MappingSessionSynchronousProxy {
625 pub fn new(channel: fidl::Channel) -> Self {
626 Self { client: fidl::client::sync::Client::new(channel) }
627 }
628
629 pub fn into_channel(self) -> fidl::Channel {
630 self.client.into_channel()
631 }
632
633 pub fn wait_for_event(
636 &self,
637 deadline: zx::MonotonicInstant,
638 ) -> Result<MappingSessionEvent, fidl::Error> {
639 MappingSessionEvent::decode(self.client.wait_for_event::<MappingSessionMarker>(deadline)?)
640 }
641
642 pub fn r#open(
647 &self,
648 mut key: u64,
649 mut identifier: &[u8],
650 ___deadline: zx::MonotonicInstant,
651 ) -> Result<MappingSessionOpenResult, fidl::Error> {
652 let _response = self.client.send_query::<
653 MappingSessionOpenRequest,
654 fidl::encoding::FlexibleResultType<MappingSessionOpenResponse, i32>,
655 MappingSessionMarker,
656 >(
657 (key, identifier,),
658 0x1b3f5b2b1e68472b,
659 fidl::encoding::DynamicFlags::FLEXIBLE,
660 ___deadline,
661 )?
662 .into_result::<MappingSessionMarker>("open")?;
663 Ok(_response.map(|x| x.size))
664 }
665
666 pub fn r#close(
668 &self,
669 mut key: u64,
670 ___deadline: zx::MonotonicInstant,
671 ) -> Result<MappingSessionCloseResult, fidl::Error> {
672 let _response = self.client.send_query::<
673 MappingSessionCloseRequest,
674 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
675 MappingSessionMarker,
676 >(
677 (key,),
678 0x34708ae0c1044d20,
679 fidl::encoding::DynamicFlags::FLEXIBLE,
680 ___deadline,
681 )?
682 .into_result::<MappingSessionMarker>("close")?;
683 Ok(_response.map(|x| x))
684 }
685}
686
687#[cfg(target_os = "fuchsia")]
688impl From<MappingSessionSynchronousProxy> for zx::NullableHandle {
689 fn from(value: MappingSessionSynchronousProxy) -> Self {
690 value.into_channel().into()
691 }
692}
693
694#[cfg(target_os = "fuchsia")]
695impl From<fidl::Channel> for MappingSessionSynchronousProxy {
696 fn from(value: fidl::Channel) -> Self {
697 Self::new(value)
698 }
699}
700
701#[cfg(target_os = "fuchsia")]
702impl fidl::endpoints::FromClient for MappingSessionSynchronousProxy {
703 type Protocol = MappingSessionMarker;
704
705 fn from_client(value: fidl::endpoints::ClientEnd<MappingSessionMarker>) -> Self {
706 Self::new(value.into_channel())
707 }
708}
709
710#[derive(Debug, Clone)]
711pub struct MappingSessionProxy {
712 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
713}
714
715impl fidl::endpoints::Proxy for MappingSessionProxy {
716 type Protocol = MappingSessionMarker;
717
718 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
719 Self::new(inner)
720 }
721
722 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
723 self.client.into_channel().map_err(|client| Self { client })
724 }
725
726 fn as_channel(&self) -> &::fidl::AsyncChannel {
727 self.client.as_channel()
728 }
729}
730
731impl MappingSessionProxy {
732 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
734 let protocol_name = <MappingSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
735 Self { client: fidl::client::Client::new(channel, protocol_name) }
736 }
737
738 pub fn take_event_stream(&self) -> MappingSessionEventStream {
744 MappingSessionEventStream { event_receiver: self.client.take_event_receiver() }
745 }
746
747 pub fn r#open(
752 &self,
753 mut key: u64,
754 mut identifier: &[u8],
755 ) -> fidl::client::QueryResponseFut<
756 MappingSessionOpenResult,
757 fidl::encoding::DefaultFuchsiaResourceDialect,
758 > {
759 MappingSessionProxyInterface::r#open(self, key, identifier)
760 }
761
762 pub fn r#close(
764 &self,
765 mut key: u64,
766 ) -> fidl::client::QueryResponseFut<
767 MappingSessionCloseResult,
768 fidl::encoding::DefaultFuchsiaResourceDialect,
769 > {
770 MappingSessionProxyInterface::r#close(self, key)
771 }
772}
773
774impl MappingSessionProxyInterface for MappingSessionProxy {
775 type OpenResponseFut = fidl::client::QueryResponseFut<
776 MappingSessionOpenResult,
777 fidl::encoding::DefaultFuchsiaResourceDialect,
778 >;
779 fn r#open(&self, mut key: u64, mut identifier: &[u8]) -> Self::OpenResponseFut {
780 fn _decode(
781 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
782 ) -> Result<MappingSessionOpenResult, fidl::Error> {
783 let _response = fidl::client::decode_transaction_body::<
784 fidl::encoding::FlexibleResultType<MappingSessionOpenResponse, i32>,
785 fidl::encoding::DefaultFuchsiaResourceDialect,
786 0x1b3f5b2b1e68472b,
787 >(_buf?)?
788 .into_result::<MappingSessionMarker>("open")?;
789 Ok(_response.map(|x| x.size))
790 }
791 self.client.send_query_and_decode::<MappingSessionOpenRequest, MappingSessionOpenResult>(
792 (key, identifier),
793 0x1b3f5b2b1e68472b,
794 fidl::encoding::DynamicFlags::FLEXIBLE,
795 _decode,
796 )
797 }
798
799 type CloseResponseFut = fidl::client::QueryResponseFut<
800 MappingSessionCloseResult,
801 fidl::encoding::DefaultFuchsiaResourceDialect,
802 >;
803 fn r#close(&self, mut key: u64) -> Self::CloseResponseFut {
804 fn _decode(
805 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
806 ) -> Result<MappingSessionCloseResult, fidl::Error> {
807 let _response = fidl::client::decode_transaction_body::<
808 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
809 fidl::encoding::DefaultFuchsiaResourceDialect,
810 0x34708ae0c1044d20,
811 >(_buf?)?
812 .into_result::<MappingSessionMarker>("close")?;
813 Ok(_response.map(|x| x))
814 }
815 self.client.send_query_and_decode::<MappingSessionCloseRequest, MappingSessionCloseResult>(
816 (key,),
817 0x34708ae0c1044d20,
818 fidl::encoding::DynamicFlags::FLEXIBLE,
819 _decode,
820 )
821 }
822}
823
824pub struct MappingSessionEventStream {
825 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
826}
827
828impl std::marker::Unpin for MappingSessionEventStream {}
829
830impl futures::stream::FusedStream for MappingSessionEventStream {
831 fn is_terminated(&self) -> bool {
832 self.event_receiver.is_terminated()
833 }
834}
835
836impl futures::Stream for MappingSessionEventStream {
837 type Item = Result<MappingSessionEvent, fidl::Error>;
838
839 fn poll_next(
840 mut self: std::pin::Pin<&mut Self>,
841 cx: &mut std::task::Context<'_>,
842 ) -> std::task::Poll<Option<Self::Item>> {
843 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
844 &mut self.event_receiver,
845 cx
846 )?) {
847 Some(buf) => std::task::Poll::Ready(Some(MappingSessionEvent::decode(buf))),
848 None => std::task::Poll::Ready(None),
849 }
850 }
851}
852
853#[derive(Debug)]
854pub enum MappingSessionEvent {
855 #[non_exhaustive]
856 _UnknownEvent {
857 ordinal: u64,
859 },
860}
861
862impl MappingSessionEvent {
863 fn decode(
865 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
866 ) -> Result<MappingSessionEvent, fidl::Error> {
867 let (bytes, _handles) = buf.split_mut();
868 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
869 debug_assert_eq!(tx_header.tx_id, 0);
870 match tx_header.ordinal {
871 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
872 Ok(MappingSessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
873 }
874 _ => Err(fidl::Error::UnknownOrdinal {
875 ordinal: tx_header.ordinal,
876 protocol_name:
877 <MappingSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
878 }),
879 }
880 }
881}
882
883pub struct MappingSessionRequestStream {
885 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
886 is_terminated: bool,
887}
888
889impl std::marker::Unpin for MappingSessionRequestStream {}
890
891impl futures::stream::FusedStream for MappingSessionRequestStream {
892 fn is_terminated(&self) -> bool {
893 self.is_terminated
894 }
895}
896
897impl fidl::endpoints::RequestStream for MappingSessionRequestStream {
898 type Protocol = MappingSessionMarker;
899 type ControlHandle = MappingSessionControlHandle;
900
901 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
902 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
903 }
904
905 fn control_handle(&self) -> Self::ControlHandle {
906 MappingSessionControlHandle { inner: self.inner.clone() }
907 }
908
909 fn into_inner(
910 self,
911 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
912 {
913 (self.inner, self.is_terminated)
914 }
915
916 fn from_inner(
917 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
918 is_terminated: bool,
919 ) -> Self {
920 Self { inner, is_terminated }
921 }
922}
923
924impl futures::Stream for MappingSessionRequestStream {
925 type Item = Result<MappingSessionRequest, fidl::Error>;
926
927 fn poll_next(
928 mut self: std::pin::Pin<&mut Self>,
929 cx: &mut std::task::Context<'_>,
930 ) -> std::task::Poll<Option<Self::Item>> {
931 let this = &mut *self;
932 if this.inner.check_shutdown(cx) {
933 this.is_terminated = true;
934 return std::task::Poll::Ready(None);
935 }
936 if this.is_terminated {
937 panic!("polled MappingSessionRequestStream after completion");
938 }
939 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
940 |bytes, handles| {
941 match this.inner.channel().read_etc(cx, bytes, handles) {
942 std::task::Poll::Ready(Ok(())) => {}
943 std::task::Poll::Pending => return std::task::Poll::Pending,
944 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
945 this.is_terminated = true;
946 return std::task::Poll::Ready(None);
947 }
948 std::task::Poll::Ready(Err(e)) => {
949 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
950 e.into(),
951 ))));
952 }
953 }
954
955 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
957
958 std::task::Poll::Ready(Some(match header.ordinal {
959 0x1b3f5b2b1e68472b => {
960 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
961 let mut req = fidl::new_empty!(
962 MappingSessionOpenRequest,
963 fidl::encoding::DefaultFuchsiaResourceDialect
964 );
965 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MappingSessionOpenRequest>(&header, _body_bytes, handles, &mut req)?;
966 let control_handle =
967 MappingSessionControlHandle { inner: this.inner.clone() };
968 Ok(MappingSessionRequest::Open {
969 key: req.key,
970 identifier: req.identifier,
971
972 responder: MappingSessionOpenResponder {
973 control_handle: std::mem::ManuallyDrop::new(control_handle),
974 tx_id: header.tx_id,
975 },
976 })
977 }
978 0x34708ae0c1044d20 => {
979 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
980 let mut req = fidl::new_empty!(
981 MappingSessionCloseRequest,
982 fidl::encoding::DefaultFuchsiaResourceDialect
983 );
984 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MappingSessionCloseRequest>(&header, _body_bytes, handles, &mut req)?;
985 let control_handle =
986 MappingSessionControlHandle { inner: this.inner.clone() };
987 Ok(MappingSessionRequest::Close {
988 key: req.key,
989
990 responder: MappingSessionCloseResponder {
991 control_handle: std::mem::ManuallyDrop::new(control_handle),
992 tx_id: header.tx_id,
993 },
994 })
995 }
996 _ if header.tx_id == 0
997 && header
998 .dynamic_flags()
999 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1000 {
1001 Ok(MappingSessionRequest::_UnknownMethod {
1002 ordinal: header.ordinal,
1003 control_handle: MappingSessionControlHandle {
1004 inner: this.inner.clone(),
1005 },
1006 method_type: fidl::MethodType::OneWay,
1007 })
1008 }
1009 _ if header
1010 .dynamic_flags()
1011 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1012 {
1013 this.inner.send_framework_err(
1014 fidl::encoding::FrameworkErr::UnknownMethod,
1015 header.tx_id,
1016 header.ordinal,
1017 header.dynamic_flags(),
1018 (bytes, handles),
1019 )?;
1020 Ok(MappingSessionRequest::_UnknownMethod {
1021 ordinal: header.ordinal,
1022 control_handle: MappingSessionControlHandle {
1023 inner: this.inner.clone(),
1024 },
1025 method_type: fidl::MethodType::TwoWay,
1026 })
1027 }
1028 _ => Err(fidl::Error::UnknownOrdinal {
1029 ordinal: header.ordinal,
1030 protocol_name:
1031 <MappingSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1032 }),
1033 }))
1034 },
1035 )
1036 }
1037}
1038
1039#[derive(Debug)]
1040pub enum MappingSessionRequest {
1041 Open { key: u64, identifier: Vec<u8>, responder: MappingSessionOpenResponder },
1046 Close { key: u64, responder: MappingSessionCloseResponder },
1048 #[non_exhaustive]
1050 _UnknownMethod {
1051 ordinal: u64,
1053 control_handle: MappingSessionControlHandle,
1054 method_type: fidl::MethodType,
1055 },
1056}
1057
1058impl MappingSessionRequest {
1059 #[allow(irrefutable_let_patterns)]
1060 pub fn into_open(self) -> Option<(u64, Vec<u8>, MappingSessionOpenResponder)> {
1061 if let MappingSessionRequest::Open { key, identifier, responder } = self {
1062 Some((key, identifier, responder))
1063 } else {
1064 None
1065 }
1066 }
1067
1068 #[allow(irrefutable_let_patterns)]
1069 pub fn into_close(self) -> Option<(u64, MappingSessionCloseResponder)> {
1070 if let MappingSessionRequest::Close { key, responder } = self {
1071 Some((key, responder))
1072 } else {
1073 None
1074 }
1075 }
1076
1077 pub fn method_name(&self) -> &'static str {
1079 match *self {
1080 MappingSessionRequest::Open { .. } => "open",
1081 MappingSessionRequest::Close { .. } => "close",
1082 MappingSessionRequest::_UnknownMethod {
1083 method_type: fidl::MethodType::OneWay, ..
1084 } => "unknown one-way method",
1085 MappingSessionRequest::_UnknownMethod {
1086 method_type: fidl::MethodType::TwoWay, ..
1087 } => "unknown two-way method",
1088 }
1089 }
1090}
1091
1092#[derive(Debug, Clone)]
1093pub struct MappingSessionControlHandle {
1094 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1095}
1096
1097impl MappingSessionControlHandle {
1098 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1099 self.inner.shutdown_with_epitaph(status.into())
1100 }
1101}
1102
1103impl fidl::endpoints::ControlHandle for MappingSessionControlHandle {
1104 fn shutdown(&self) {
1105 self.inner.shutdown()
1106 }
1107
1108 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1109 self.inner.shutdown_with_epitaph(status)
1110 }
1111
1112 fn is_closed(&self) -> bool {
1113 self.inner.channel().is_closed()
1114 }
1115 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1116 self.inner.channel().on_closed()
1117 }
1118
1119 #[cfg(target_os = "fuchsia")]
1120 fn signal_peer(
1121 &self,
1122 clear_mask: zx::Signals,
1123 set_mask: zx::Signals,
1124 ) -> Result<(), zx_status::Status> {
1125 use fidl::Peered;
1126 self.inner.channel().signal_peer(clear_mask, set_mask)
1127 }
1128}
1129
1130impl MappingSessionControlHandle {}
1131
1132#[must_use = "FIDL methods require a response to be sent"]
1133#[derive(Debug)]
1134pub struct MappingSessionOpenResponder {
1135 control_handle: std::mem::ManuallyDrop<MappingSessionControlHandle>,
1136 tx_id: u32,
1137}
1138
1139impl std::ops::Drop for MappingSessionOpenResponder {
1143 fn drop(&mut self) {
1144 self.control_handle.shutdown();
1145 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1147 }
1148}
1149
1150impl fidl::endpoints::Responder for MappingSessionOpenResponder {
1151 type ControlHandle = MappingSessionControlHandle;
1152
1153 fn control_handle(&self) -> &MappingSessionControlHandle {
1154 &self.control_handle
1155 }
1156
1157 fn drop_without_shutdown(mut self) {
1158 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1160 std::mem::forget(self);
1162 }
1163}
1164
1165impl MappingSessionOpenResponder {
1166 pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1170 let _result = self.send_raw(result);
1171 if _result.is_err() {
1172 self.control_handle.shutdown();
1173 }
1174 self.drop_without_shutdown();
1175 _result
1176 }
1177
1178 pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1180 let _result = self.send_raw(result);
1181 self.drop_without_shutdown();
1182 _result
1183 }
1184
1185 fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1186 self.control_handle
1187 .inner
1188 .send::<fidl::encoding::FlexibleResultType<MappingSessionOpenResponse, i32>>(
1189 fidl::encoding::FlexibleResult::new(result.map(|size| (size,))),
1190 self.tx_id,
1191 0x1b3f5b2b1e68472b,
1192 fidl::encoding::DynamicFlags::FLEXIBLE,
1193 )
1194 }
1195}
1196
1197#[must_use = "FIDL methods require a response to be sent"]
1198#[derive(Debug)]
1199pub struct MappingSessionCloseResponder {
1200 control_handle: std::mem::ManuallyDrop<MappingSessionControlHandle>,
1201 tx_id: u32,
1202}
1203
1204impl std::ops::Drop for MappingSessionCloseResponder {
1208 fn drop(&mut self) {
1209 self.control_handle.shutdown();
1210 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1212 }
1213}
1214
1215impl fidl::endpoints::Responder for MappingSessionCloseResponder {
1216 type ControlHandle = MappingSessionControlHandle;
1217
1218 fn control_handle(&self) -> &MappingSessionControlHandle {
1219 &self.control_handle
1220 }
1221
1222 fn drop_without_shutdown(mut self) {
1223 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1225 std::mem::forget(self);
1227 }
1228}
1229
1230impl MappingSessionCloseResponder {
1231 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1235 let _result = self.send_raw(result);
1236 if _result.is_err() {
1237 self.control_handle.shutdown();
1238 }
1239 self.drop_without_shutdown();
1240 _result
1241 }
1242
1243 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1245 let _result = self.send_raw(result);
1246 self.drop_without_shutdown();
1247 _result
1248 }
1249
1250 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1251 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1252 fidl::encoding::EmptyStruct,
1253 i32,
1254 >>(
1255 fidl::encoding::FlexibleResult::new(result),
1256 self.tx_id,
1257 0x34708ae0c1044d20,
1258 fidl::encoding::DynamicFlags::FLEXIBLE,
1259 )
1260 }
1261}
1262
1263mod internal {
1264 use super::*;
1265
1266 impl fidl::encoding::ResourceTypeMarker for MappingProviderOpenSessionRequest {
1267 type Borrowed<'a> = &'a mut Self;
1268 fn take_or_borrow<'a>(
1269 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1270 ) -> Self::Borrowed<'a> {
1271 value
1272 }
1273 }
1274
1275 unsafe impl fidl::encoding::TypeMarker for MappingProviderOpenSessionRequest {
1276 type Owned = Self;
1277
1278 #[inline(always)]
1279 fn inline_align(_context: fidl::encoding::Context) -> usize {
1280 4
1281 }
1282
1283 #[inline(always)]
1284 fn inline_size(_context: fidl::encoding::Context) -> usize {
1285 4
1286 }
1287 }
1288
1289 unsafe impl
1290 fidl::encoding::Encode<
1291 MappingProviderOpenSessionRequest,
1292 fidl::encoding::DefaultFuchsiaResourceDialect,
1293 > for &mut MappingProviderOpenSessionRequest
1294 {
1295 #[inline]
1296 unsafe fn encode(
1297 self,
1298 encoder: &mut fidl::encoding::Encoder<
1299 '_,
1300 fidl::encoding::DefaultFuchsiaResourceDialect,
1301 >,
1302 offset: usize,
1303 _depth: fidl::encoding::Depth,
1304 ) -> fidl::Result<()> {
1305 encoder.debug_check_bounds::<MappingProviderOpenSessionRequest>(offset);
1306 fidl::encoding::Encode::<MappingProviderOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1308 (
1309 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MappingSessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
1310 ),
1311 encoder, offset, _depth
1312 )
1313 }
1314 }
1315 unsafe impl<
1316 T0: fidl::encoding::Encode<
1317 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MappingSessionMarker>>,
1318 fidl::encoding::DefaultFuchsiaResourceDialect,
1319 >,
1320 >
1321 fidl::encoding::Encode<
1322 MappingProviderOpenSessionRequest,
1323 fidl::encoding::DefaultFuchsiaResourceDialect,
1324 > for (T0,)
1325 {
1326 #[inline]
1327 unsafe fn encode(
1328 self,
1329 encoder: &mut fidl::encoding::Encoder<
1330 '_,
1331 fidl::encoding::DefaultFuchsiaResourceDialect,
1332 >,
1333 offset: usize,
1334 depth: fidl::encoding::Depth,
1335 ) -> fidl::Result<()> {
1336 encoder.debug_check_bounds::<MappingProviderOpenSessionRequest>(offset);
1337 self.0.encode(encoder, offset + 0, depth)?;
1341 Ok(())
1342 }
1343 }
1344
1345 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1346 for MappingProviderOpenSessionRequest
1347 {
1348 #[inline(always)]
1349 fn new_empty() -> Self {
1350 Self {
1351 session: fidl::new_empty!(
1352 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MappingSessionMarker>>,
1353 fidl::encoding::DefaultFuchsiaResourceDialect
1354 ),
1355 }
1356 }
1357
1358 #[inline]
1359 unsafe fn decode(
1360 &mut self,
1361 decoder: &mut fidl::encoding::Decoder<
1362 '_,
1363 fidl::encoding::DefaultFuchsiaResourceDialect,
1364 >,
1365 offset: usize,
1366 _depth: fidl::encoding::Depth,
1367 ) -> fidl::Result<()> {
1368 decoder.debug_check_bounds::<Self>(offset);
1369 fidl::decode!(
1371 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MappingSessionMarker>>,
1372 fidl::encoding::DefaultFuchsiaResourceDialect,
1373 &mut self.session,
1374 decoder,
1375 offset + 0,
1376 _depth
1377 )?;
1378 Ok(())
1379 }
1380 }
1381
1382 impl fidl::encoding::ResourceTypeMarker for MappingProviderOpenSessionResponse {
1383 type Borrowed<'a> = &'a mut Self;
1384 fn take_or_borrow<'a>(
1385 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1386 ) -> Self::Borrowed<'a> {
1387 value
1388 }
1389 }
1390
1391 unsafe impl fidl::encoding::TypeMarker for MappingProviderOpenSessionResponse {
1392 type Owned = Self;
1393
1394 #[inline(always)]
1395 fn inline_align(_context: fidl::encoding::Context) -> usize {
1396 4
1397 }
1398
1399 #[inline(always)]
1400 fn inline_size(_context: fidl::encoding::Context) -> usize {
1401 4
1402 }
1403 }
1404
1405 unsafe impl
1406 fidl::encoding::Encode<
1407 MappingProviderOpenSessionResponse,
1408 fidl::encoding::DefaultFuchsiaResourceDialect,
1409 > for &mut MappingProviderOpenSessionResponse
1410 {
1411 #[inline]
1412 unsafe fn encode(
1413 self,
1414 encoder: &mut fidl::encoding::Encoder<
1415 '_,
1416 fidl::encoding::DefaultFuchsiaResourceDialect,
1417 >,
1418 offset: usize,
1419 _depth: fidl::encoding::Depth,
1420 ) -> fidl::Result<()> {
1421 encoder.debug_check_bounds::<MappingProviderOpenSessionResponse>(offset);
1422 fidl::encoding::Encode::<
1424 MappingProviderOpenSessionResponse,
1425 fidl::encoding::DefaultFuchsiaResourceDialect,
1426 >::encode(
1427 (<fidl::encoding::HandleType<
1428 fidl::Vmo,
1429 { fidl::ObjectType::VMO.into_raw() },
1430 2147483648,
1431 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1432 &mut self.mapping_vmo
1433 ),),
1434 encoder,
1435 offset,
1436 _depth,
1437 )
1438 }
1439 }
1440 unsafe impl<
1441 T0: fidl::encoding::Encode<
1442 fidl::encoding::HandleType<
1443 fidl::Vmo,
1444 { fidl::ObjectType::VMO.into_raw() },
1445 2147483648,
1446 >,
1447 fidl::encoding::DefaultFuchsiaResourceDialect,
1448 >,
1449 >
1450 fidl::encoding::Encode<
1451 MappingProviderOpenSessionResponse,
1452 fidl::encoding::DefaultFuchsiaResourceDialect,
1453 > for (T0,)
1454 {
1455 #[inline]
1456 unsafe fn encode(
1457 self,
1458 encoder: &mut fidl::encoding::Encoder<
1459 '_,
1460 fidl::encoding::DefaultFuchsiaResourceDialect,
1461 >,
1462 offset: usize,
1463 depth: fidl::encoding::Depth,
1464 ) -> fidl::Result<()> {
1465 encoder.debug_check_bounds::<MappingProviderOpenSessionResponse>(offset);
1466 self.0.encode(encoder, offset + 0, depth)?;
1470 Ok(())
1471 }
1472 }
1473
1474 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1475 for MappingProviderOpenSessionResponse
1476 {
1477 #[inline(always)]
1478 fn new_empty() -> Self {
1479 Self {
1480 mapping_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1481 }
1482 }
1483
1484 #[inline]
1485 unsafe fn decode(
1486 &mut self,
1487 decoder: &mut fidl::encoding::Decoder<
1488 '_,
1489 fidl::encoding::DefaultFuchsiaResourceDialect,
1490 >,
1491 offset: usize,
1492 _depth: fidl::encoding::Depth,
1493 ) -> fidl::Result<()> {
1494 decoder.debug_check_bounds::<Self>(offset);
1495 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.mapping_vmo, decoder, offset + 0, _depth)?;
1497 Ok(())
1498 }
1499 }
1500}