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_block_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct BlockOpenSessionRequest {
16 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockOpenSessionRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct BlockOpenSessionWithOffsetMapRequest {
23 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
24 pub offset_map: Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
25 pub initial_mappings: Option<Vec<BlockOffsetMapping>>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29 for BlockOpenSessionWithOffsetMapRequest
30{
31}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct InspectVmoProviderGetVmoResponse {
35 pub vmo: fidl::Vmo,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
39 for InspectVmoProviderGetVmoResponse
40{
41}
42
43#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct SessionAttachVmoRequest {
45 pub vmo: fidl::Vmo,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionAttachVmoRequest {}
49
50#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
51pub struct SessionGetFifoResponse {
52 pub fifo: fidl::Fifo,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionGetFifoResponse {}
56
57#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
58pub struct BlockMarker;
59
60impl fidl::endpoints::ProtocolMarker for BlockMarker {
61 type Proxy = BlockProxy;
62 type RequestStream = BlockRequestStream;
63 #[cfg(target_os = "fuchsia")]
64 type SynchronousProxy = BlockSynchronousProxy;
65
66 const DEBUG_NAME: &'static str = "(anonymous) Block";
67}
68pub type BlockGetInfoResult = Result<BlockInfo, i32>;
69pub type BlockGetStatsResult = Result<BlockStats, i32>;
70
71pub trait BlockProxyInterface: Send + Sync {
72 type GetInfoResponseFut: std::future::Future<Output = Result<BlockGetInfoResult, fidl::Error>>
73 + Send;
74 fn r#get_info(&self) -> Self::GetInfoResponseFut;
75 type GetStatsResponseFut: std::future::Future<Output = Result<BlockGetStatsResult, fidl::Error>>
76 + Send;
77 fn r#get_stats(&self, clear: bool) -> Self::GetStatsResponseFut;
78 fn r#open_session(
79 &self,
80 session: fidl::endpoints::ServerEnd<SessionMarker>,
81 ) -> Result<(), fidl::Error>;
82 fn r#open_session_with_offset_map(
83 &self,
84 session: fidl::endpoints::ServerEnd<SessionMarker>,
85 offset_map: Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
86 initial_mappings: Option<&[BlockOffsetMapping]>,
87 ) -> Result<(), fidl::Error>;
88}
89#[derive(Debug)]
90#[cfg(target_os = "fuchsia")]
91pub struct BlockSynchronousProxy {
92 client: fidl::client::sync::Client,
93}
94
95#[cfg(target_os = "fuchsia")]
96impl fidl::endpoints::SynchronousProxy for BlockSynchronousProxy {
97 type Proxy = BlockProxy;
98 type Protocol = BlockMarker;
99
100 fn from_channel(inner: fidl::Channel) -> Self {
101 Self::new(inner)
102 }
103
104 fn into_channel(self) -> fidl::Channel {
105 self.client.into_channel()
106 }
107
108 fn as_channel(&self) -> &fidl::Channel {
109 self.client.as_channel()
110 }
111}
112
113#[cfg(target_os = "fuchsia")]
114impl BlockSynchronousProxy {
115 pub fn new(channel: fidl::Channel) -> Self {
116 let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
117 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
118 }
119
120 pub fn into_channel(self) -> fidl::Channel {
121 self.client.into_channel()
122 }
123
124 pub fn wait_for_event(
127 &self,
128 deadline: zx::MonotonicInstant,
129 ) -> Result<BlockEvent, fidl::Error> {
130 BlockEvent::decode(self.client.wait_for_event(deadline)?)
131 }
132
133 pub fn r#get_info(
135 &self,
136 ___deadline: zx::MonotonicInstant,
137 ) -> Result<BlockGetInfoResult, fidl::Error> {
138 let _response = self.client.send_query::<
139 fidl::encoding::EmptyPayload,
140 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
141 >(
142 (),
143 0x79df1a5cdb6cc6a3,
144 fidl::encoding::DynamicFlags::empty(),
145 ___deadline,
146 )?;
147 Ok(_response.map(|x| x.info))
148 }
149
150 pub fn r#get_stats(
152 &self,
153 mut clear: bool,
154 ___deadline: zx::MonotonicInstant,
155 ) -> Result<BlockGetStatsResult, fidl::Error> {
156 let _response = self.client.send_query::<
157 BlockGetStatsRequest,
158 fidl::encoding::ResultType<BlockGetStatsResponse, i32>,
159 >(
160 (clear,),
161 0x53d9542a778385ae,
162 fidl::encoding::DynamicFlags::empty(),
163 ___deadline,
164 )?;
165 Ok(_response.map(|x| x.stats))
166 }
167
168 pub fn r#open_session(
170 &self,
171 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
172 ) -> Result<(), fidl::Error> {
173 self.client.send::<BlockOpenSessionRequest>(
174 (session,),
175 0x7241c68d17614a31,
176 fidl::encoding::DynamicFlags::empty(),
177 )
178 }
179
180 pub fn r#open_session_with_offset_map(
200 &self,
201 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
202 mut offset_map: Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
203 mut initial_mappings: Option<&[BlockOffsetMapping]>,
204 ) -> Result<(), fidl::Error> {
205 self.client.send::<BlockOpenSessionWithOffsetMapRequest>(
206 (session, offset_map, initial_mappings),
207 0x7a8d3ba3d8bfa10f,
208 fidl::encoding::DynamicFlags::empty(),
209 )
210 }
211}
212
213#[cfg(target_os = "fuchsia")]
214impl From<BlockSynchronousProxy> for zx::Handle {
215 fn from(value: BlockSynchronousProxy) -> Self {
216 value.into_channel().into()
217 }
218}
219
220#[cfg(target_os = "fuchsia")]
221impl From<fidl::Channel> for BlockSynchronousProxy {
222 fn from(value: fidl::Channel) -> Self {
223 Self::new(value)
224 }
225}
226
227#[derive(Debug, Clone)]
228pub struct BlockProxy {
229 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
230}
231
232impl fidl::endpoints::Proxy for BlockProxy {
233 type Protocol = BlockMarker;
234
235 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
236 Self::new(inner)
237 }
238
239 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
240 self.client.into_channel().map_err(|client| Self { client })
241 }
242
243 fn as_channel(&self) -> &::fidl::AsyncChannel {
244 self.client.as_channel()
245 }
246}
247
248impl BlockProxy {
249 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
251 let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
252 Self { client: fidl::client::Client::new(channel, protocol_name) }
253 }
254
255 pub fn take_event_stream(&self) -> BlockEventStream {
261 BlockEventStream { event_receiver: self.client.take_event_receiver() }
262 }
263
264 pub fn r#get_info(
266 &self,
267 ) -> fidl::client::QueryResponseFut<
268 BlockGetInfoResult,
269 fidl::encoding::DefaultFuchsiaResourceDialect,
270 > {
271 BlockProxyInterface::r#get_info(self)
272 }
273
274 pub fn r#get_stats(
276 &self,
277 mut clear: bool,
278 ) -> fidl::client::QueryResponseFut<
279 BlockGetStatsResult,
280 fidl::encoding::DefaultFuchsiaResourceDialect,
281 > {
282 BlockProxyInterface::r#get_stats(self, clear)
283 }
284
285 pub fn r#open_session(
287 &self,
288 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
289 ) -> Result<(), fidl::Error> {
290 BlockProxyInterface::r#open_session(self, session)
291 }
292
293 pub fn r#open_session_with_offset_map(
313 &self,
314 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
315 mut offset_map: Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
316 mut initial_mappings: Option<&[BlockOffsetMapping]>,
317 ) -> Result<(), fidl::Error> {
318 BlockProxyInterface::r#open_session_with_offset_map(
319 self,
320 session,
321 offset_map,
322 initial_mappings,
323 )
324 }
325}
326
327impl BlockProxyInterface for BlockProxy {
328 type GetInfoResponseFut = fidl::client::QueryResponseFut<
329 BlockGetInfoResult,
330 fidl::encoding::DefaultFuchsiaResourceDialect,
331 >;
332 fn r#get_info(&self) -> Self::GetInfoResponseFut {
333 fn _decode(
334 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
335 ) -> Result<BlockGetInfoResult, fidl::Error> {
336 let _response = fidl::client::decode_transaction_body::<
337 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
338 fidl::encoding::DefaultFuchsiaResourceDialect,
339 0x79df1a5cdb6cc6a3,
340 >(_buf?)?;
341 Ok(_response.map(|x| x.info))
342 }
343 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetInfoResult>(
344 (),
345 0x79df1a5cdb6cc6a3,
346 fidl::encoding::DynamicFlags::empty(),
347 _decode,
348 )
349 }
350
351 type GetStatsResponseFut = fidl::client::QueryResponseFut<
352 BlockGetStatsResult,
353 fidl::encoding::DefaultFuchsiaResourceDialect,
354 >;
355 fn r#get_stats(&self, mut clear: bool) -> Self::GetStatsResponseFut {
356 fn _decode(
357 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
358 ) -> Result<BlockGetStatsResult, fidl::Error> {
359 let _response = fidl::client::decode_transaction_body::<
360 fidl::encoding::ResultType<BlockGetStatsResponse, i32>,
361 fidl::encoding::DefaultFuchsiaResourceDialect,
362 0x53d9542a778385ae,
363 >(_buf?)?;
364 Ok(_response.map(|x| x.stats))
365 }
366 self.client.send_query_and_decode::<BlockGetStatsRequest, BlockGetStatsResult>(
367 (clear,),
368 0x53d9542a778385ae,
369 fidl::encoding::DynamicFlags::empty(),
370 _decode,
371 )
372 }
373
374 fn r#open_session(
375 &self,
376 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
377 ) -> Result<(), fidl::Error> {
378 self.client.send::<BlockOpenSessionRequest>(
379 (session,),
380 0x7241c68d17614a31,
381 fidl::encoding::DynamicFlags::empty(),
382 )
383 }
384
385 fn r#open_session_with_offset_map(
386 &self,
387 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
388 mut offset_map: Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
389 mut initial_mappings: Option<&[BlockOffsetMapping]>,
390 ) -> Result<(), fidl::Error> {
391 self.client.send::<BlockOpenSessionWithOffsetMapRequest>(
392 (session, offset_map, initial_mappings),
393 0x7a8d3ba3d8bfa10f,
394 fidl::encoding::DynamicFlags::empty(),
395 )
396 }
397}
398
399pub struct BlockEventStream {
400 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
401}
402
403impl std::marker::Unpin for BlockEventStream {}
404
405impl futures::stream::FusedStream for BlockEventStream {
406 fn is_terminated(&self) -> bool {
407 self.event_receiver.is_terminated()
408 }
409}
410
411impl futures::Stream for BlockEventStream {
412 type Item = Result<BlockEvent, fidl::Error>;
413
414 fn poll_next(
415 mut self: std::pin::Pin<&mut Self>,
416 cx: &mut std::task::Context<'_>,
417 ) -> std::task::Poll<Option<Self::Item>> {
418 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
419 &mut self.event_receiver,
420 cx
421 )?) {
422 Some(buf) => std::task::Poll::Ready(Some(BlockEvent::decode(buf))),
423 None => std::task::Poll::Ready(None),
424 }
425 }
426}
427
428#[derive(Debug)]
429pub enum BlockEvent {}
430
431impl BlockEvent {
432 fn decode(
434 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
435 ) -> Result<BlockEvent, fidl::Error> {
436 let (bytes, _handles) = buf.split_mut();
437 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
438 debug_assert_eq!(tx_header.tx_id, 0);
439 match tx_header.ordinal {
440 _ => Err(fidl::Error::UnknownOrdinal {
441 ordinal: tx_header.ordinal,
442 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
443 }),
444 }
445 }
446}
447
448pub struct BlockRequestStream {
450 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
451 is_terminated: bool,
452}
453
454impl std::marker::Unpin for BlockRequestStream {}
455
456impl futures::stream::FusedStream for BlockRequestStream {
457 fn is_terminated(&self) -> bool {
458 self.is_terminated
459 }
460}
461
462impl fidl::endpoints::RequestStream for BlockRequestStream {
463 type Protocol = BlockMarker;
464 type ControlHandle = BlockControlHandle;
465
466 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
467 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
468 }
469
470 fn control_handle(&self) -> Self::ControlHandle {
471 BlockControlHandle { inner: self.inner.clone() }
472 }
473
474 fn into_inner(
475 self,
476 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
477 {
478 (self.inner, self.is_terminated)
479 }
480
481 fn from_inner(
482 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
483 is_terminated: bool,
484 ) -> Self {
485 Self { inner, is_terminated }
486 }
487}
488
489impl futures::Stream for BlockRequestStream {
490 type Item = Result<BlockRequest, fidl::Error>;
491
492 fn poll_next(
493 mut self: std::pin::Pin<&mut Self>,
494 cx: &mut std::task::Context<'_>,
495 ) -> std::task::Poll<Option<Self::Item>> {
496 let this = &mut *self;
497 if this.inner.check_shutdown(cx) {
498 this.is_terminated = true;
499 return std::task::Poll::Ready(None);
500 }
501 if this.is_terminated {
502 panic!("polled BlockRequestStream after completion");
503 }
504 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
505 |bytes, handles| {
506 match this.inner.channel().read_etc(cx, bytes, handles) {
507 std::task::Poll::Ready(Ok(())) => {}
508 std::task::Poll::Pending => return std::task::Poll::Pending,
509 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
510 this.is_terminated = true;
511 return std::task::Poll::Ready(None);
512 }
513 std::task::Poll::Ready(Err(e)) => {
514 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
515 e.into(),
516 ))))
517 }
518 }
519
520 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
522
523 std::task::Poll::Ready(Some(match header.ordinal {
524 0x79df1a5cdb6cc6a3 => {
525 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
526 let mut req = fidl::new_empty!(
527 fidl::encoding::EmptyPayload,
528 fidl::encoding::DefaultFuchsiaResourceDialect
529 );
530 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
531 let control_handle = BlockControlHandle { inner: this.inner.clone() };
532 Ok(BlockRequest::GetInfo {
533 responder: BlockGetInfoResponder {
534 control_handle: std::mem::ManuallyDrop::new(control_handle),
535 tx_id: header.tx_id,
536 },
537 })
538 }
539 0x53d9542a778385ae => {
540 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
541 let mut req = fidl::new_empty!(
542 BlockGetStatsRequest,
543 fidl::encoding::DefaultFuchsiaResourceDialect
544 );
545 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockGetStatsRequest>(&header, _body_bytes, handles, &mut req)?;
546 let control_handle = BlockControlHandle { inner: this.inner.clone() };
547 Ok(BlockRequest::GetStats {
548 clear: req.clear,
549
550 responder: BlockGetStatsResponder {
551 control_handle: std::mem::ManuallyDrop::new(control_handle),
552 tx_id: header.tx_id,
553 },
554 })
555 }
556 0x7241c68d17614a31 => {
557 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
558 let mut req = fidl::new_empty!(
559 BlockOpenSessionRequest,
560 fidl::encoding::DefaultFuchsiaResourceDialect
561 );
562 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
563 let control_handle = BlockControlHandle { inner: this.inner.clone() };
564 Ok(BlockRequest::OpenSession { session: req.session, control_handle })
565 }
566 0x7a8d3ba3d8bfa10f => {
567 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
568 let mut req = fidl::new_empty!(
569 BlockOpenSessionWithOffsetMapRequest,
570 fidl::encoding::DefaultFuchsiaResourceDialect
571 );
572 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
573 let control_handle = BlockControlHandle { inner: this.inner.clone() };
574 Ok(BlockRequest::OpenSessionWithOffsetMap {
575 session: req.session,
576 offset_map: req.offset_map,
577 initial_mappings: req.initial_mappings,
578
579 control_handle,
580 })
581 }
582 _ => Err(fidl::Error::UnknownOrdinal {
583 ordinal: header.ordinal,
584 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
585 }),
586 }))
587 },
588 )
589 }
590}
591
592#[derive(Debug)]
595pub enum BlockRequest {
596 GetInfo { responder: BlockGetInfoResponder },
598 GetStats { clear: bool, responder: BlockGetStatsResponder },
600 OpenSession {
602 session: fidl::endpoints::ServerEnd<SessionMarker>,
603 control_handle: BlockControlHandle,
604 },
605 OpenSessionWithOffsetMap {
625 session: fidl::endpoints::ServerEnd<SessionMarker>,
626 offset_map: Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
627 initial_mappings: Option<Vec<BlockOffsetMapping>>,
628 control_handle: BlockControlHandle,
629 },
630}
631
632impl BlockRequest {
633 #[allow(irrefutable_let_patterns)]
634 pub fn into_get_info(self) -> Option<(BlockGetInfoResponder)> {
635 if let BlockRequest::GetInfo { responder } = self {
636 Some((responder))
637 } else {
638 None
639 }
640 }
641
642 #[allow(irrefutable_let_patterns)]
643 pub fn into_get_stats(self) -> Option<(bool, BlockGetStatsResponder)> {
644 if let BlockRequest::GetStats { clear, responder } = self {
645 Some((clear, responder))
646 } else {
647 None
648 }
649 }
650
651 #[allow(irrefutable_let_patterns)]
652 pub fn into_open_session(
653 self,
654 ) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockControlHandle)> {
655 if let BlockRequest::OpenSession { session, control_handle } = self {
656 Some((session, control_handle))
657 } else {
658 None
659 }
660 }
661
662 #[allow(irrefutable_let_patterns)]
663 pub fn into_open_session_with_offset_map(
664 self,
665 ) -> Option<(
666 fidl::endpoints::ServerEnd<SessionMarker>,
667 Option<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
668 Option<Vec<BlockOffsetMapping>>,
669 BlockControlHandle,
670 )> {
671 if let BlockRequest::OpenSessionWithOffsetMap {
672 session,
673 offset_map,
674 initial_mappings,
675 control_handle,
676 } = self
677 {
678 Some((session, offset_map, initial_mappings, control_handle))
679 } else {
680 None
681 }
682 }
683
684 pub fn method_name(&self) -> &'static str {
686 match *self {
687 BlockRequest::GetInfo { .. } => "get_info",
688 BlockRequest::GetStats { .. } => "get_stats",
689 BlockRequest::OpenSession { .. } => "open_session",
690 BlockRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
691 }
692 }
693}
694
695#[derive(Debug, Clone)]
696pub struct BlockControlHandle {
697 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
698}
699
700impl fidl::endpoints::ControlHandle for BlockControlHandle {
701 fn shutdown(&self) {
702 self.inner.shutdown()
703 }
704 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
705 self.inner.shutdown_with_epitaph(status)
706 }
707
708 fn is_closed(&self) -> bool {
709 self.inner.channel().is_closed()
710 }
711 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
712 self.inner.channel().on_closed()
713 }
714
715 #[cfg(target_os = "fuchsia")]
716 fn signal_peer(
717 &self,
718 clear_mask: zx::Signals,
719 set_mask: zx::Signals,
720 ) -> Result<(), zx_status::Status> {
721 use fidl::Peered;
722 self.inner.channel().signal_peer(clear_mask, set_mask)
723 }
724}
725
726impl BlockControlHandle {}
727
728#[must_use = "FIDL methods require a response to be sent"]
729#[derive(Debug)]
730pub struct BlockGetInfoResponder {
731 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
732 tx_id: u32,
733}
734
735impl std::ops::Drop for BlockGetInfoResponder {
739 fn drop(&mut self) {
740 self.control_handle.shutdown();
741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
743 }
744}
745
746impl fidl::endpoints::Responder for BlockGetInfoResponder {
747 type ControlHandle = BlockControlHandle;
748
749 fn control_handle(&self) -> &BlockControlHandle {
750 &self.control_handle
751 }
752
753 fn drop_without_shutdown(mut self) {
754 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
756 std::mem::forget(self);
758 }
759}
760
761impl BlockGetInfoResponder {
762 pub fn send(self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
766 let _result = self.send_raw(result);
767 if _result.is_err() {
768 self.control_handle.shutdown();
769 }
770 self.drop_without_shutdown();
771 _result
772 }
773
774 pub fn send_no_shutdown_on_err(
776 self,
777 mut result: Result<&BlockInfo, i32>,
778 ) -> Result<(), fidl::Error> {
779 let _result = self.send_raw(result);
780 self.drop_without_shutdown();
781 _result
782 }
783
784 fn send_raw(&self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
785 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetInfoResponse, i32>>(
786 result.map(|info| (info,)),
787 self.tx_id,
788 0x79df1a5cdb6cc6a3,
789 fidl::encoding::DynamicFlags::empty(),
790 )
791 }
792}
793
794#[must_use = "FIDL methods require a response to be sent"]
795#[derive(Debug)]
796pub struct BlockGetStatsResponder {
797 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
798 tx_id: u32,
799}
800
801impl std::ops::Drop for BlockGetStatsResponder {
805 fn drop(&mut self) {
806 self.control_handle.shutdown();
807 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
809 }
810}
811
812impl fidl::endpoints::Responder for BlockGetStatsResponder {
813 type ControlHandle = BlockControlHandle;
814
815 fn control_handle(&self) -> &BlockControlHandle {
816 &self.control_handle
817 }
818
819 fn drop_without_shutdown(mut self) {
820 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
822 std::mem::forget(self);
824 }
825}
826
827impl BlockGetStatsResponder {
828 pub fn send(self, mut result: Result<&BlockStats, i32>) -> Result<(), fidl::Error> {
832 let _result = self.send_raw(result);
833 if _result.is_err() {
834 self.control_handle.shutdown();
835 }
836 self.drop_without_shutdown();
837 _result
838 }
839
840 pub fn send_no_shutdown_on_err(
842 self,
843 mut result: Result<&BlockStats, i32>,
844 ) -> Result<(), fidl::Error> {
845 let _result = self.send_raw(result);
846 self.drop_without_shutdown();
847 _result
848 }
849
850 fn send_raw(&self, mut result: Result<&BlockStats, i32>) -> Result<(), fidl::Error> {
851 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetStatsResponse, i32>>(
852 result.map(|stats| (stats,)),
853 self.tx_id,
854 0x53d9542a778385ae,
855 fidl::encoding::DynamicFlags::empty(),
856 )
857 }
858}
859
860#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
861pub struct FtlMarker;
862
863impl fidl::endpoints::ProtocolMarker for FtlMarker {
864 type Proxy = FtlProxy;
865 type RequestStream = FtlRequestStream;
866 #[cfg(target_os = "fuchsia")]
867 type SynchronousProxy = FtlSynchronousProxy;
868
869 const DEBUG_NAME: &'static str = "(anonymous) Ftl";
870}
871
872pub trait FtlProxyInterface: Send + Sync {
873 type GetVmoResponseFut: std::future::Future<Output = Result<InspectVmoProviderGetVmoResult, fidl::Error>>
874 + Send;
875 fn r#get_vmo(&self) -> Self::GetVmoResponseFut;
876 type FormatResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
877 fn r#format(&self) -> Self::FormatResponseFut;
878}
879#[derive(Debug)]
880#[cfg(target_os = "fuchsia")]
881pub struct FtlSynchronousProxy {
882 client: fidl::client::sync::Client,
883}
884
885#[cfg(target_os = "fuchsia")]
886impl fidl::endpoints::SynchronousProxy for FtlSynchronousProxy {
887 type Proxy = FtlProxy;
888 type Protocol = FtlMarker;
889
890 fn from_channel(inner: fidl::Channel) -> Self {
891 Self::new(inner)
892 }
893
894 fn into_channel(self) -> fidl::Channel {
895 self.client.into_channel()
896 }
897
898 fn as_channel(&self) -> &fidl::Channel {
899 self.client.as_channel()
900 }
901}
902
903#[cfg(target_os = "fuchsia")]
904impl FtlSynchronousProxy {
905 pub fn new(channel: fidl::Channel) -> Self {
906 let protocol_name = <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
907 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
908 }
909
910 pub fn into_channel(self) -> fidl::Channel {
911 self.client.into_channel()
912 }
913
914 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<FtlEvent, fidl::Error> {
917 FtlEvent::decode(self.client.wait_for_event(deadline)?)
918 }
919
920 pub fn r#get_vmo(
923 &self,
924 ___deadline: zx::MonotonicInstant,
925 ) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
926 let _response = self.client.send_query::<
927 fidl::encoding::EmptyPayload,
928 fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
929 >(
930 (),
931 0xf523185c6e67738,
932 fidl::encoding::DynamicFlags::empty(),
933 ___deadline,
934 )?;
935 Ok(_response.map(|x| x.vmo))
936 }
937
938 pub fn r#format(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
940 let _response = self.client.send_query::<fidl::encoding::EmptyPayload, FtlFormatResponse>(
941 (),
942 0x79751d9c0b48a0d6,
943 fidl::encoding::DynamicFlags::empty(),
944 ___deadline,
945 )?;
946 Ok(_response.status)
947 }
948}
949
950#[cfg(target_os = "fuchsia")]
951impl From<FtlSynchronousProxy> for zx::Handle {
952 fn from(value: FtlSynchronousProxy) -> Self {
953 value.into_channel().into()
954 }
955}
956
957#[cfg(target_os = "fuchsia")]
958impl From<fidl::Channel> for FtlSynchronousProxy {
959 fn from(value: fidl::Channel) -> Self {
960 Self::new(value)
961 }
962}
963
964#[derive(Debug, Clone)]
965pub struct FtlProxy {
966 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
967}
968
969impl fidl::endpoints::Proxy for FtlProxy {
970 type Protocol = FtlMarker;
971
972 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
973 Self::new(inner)
974 }
975
976 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
977 self.client.into_channel().map_err(|client| Self { client })
978 }
979
980 fn as_channel(&self) -> &::fidl::AsyncChannel {
981 self.client.as_channel()
982 }
983}
984
985impl FtlProxy {
986 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
988 let protocol_name = <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
989 Self { client: fidl::client::Client::new(channel, protocol_name) }
990 }
991
992 pub fn take_event_stream(&self) -> FtlEventStream {
998 FtlEventStream { event_receiver: self.client.take_event_receiver() }
999 }
1000
1001 pub fn r#get_vmo(
1004 &self,
1005 ) -> fidl::client::QueryResponseFut<
1006 InspectVmoProviderGetVmoResult,
1007 fidl::encoding::DefaultFuchsiaResourceDialect,
1008 > {
1009 FtlProxyInterface::r#get_vmo(self)
1010 }
1011
1012 pub fn r#format(
1014 &self,
1015 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1016 FtlProxyInterface::r#format(self)
1017 }
1018}
1019
1020impl FtlProxyInterface for FtlProxy {
1021 type GetVmoResponseFut = fidl::client::QueryResponseFut<
1022 InspectVmoProviderGetVmoResult,
1023 fidl::encoding::DefaultFuchsiaResourceDialect,
1024 >;
1025 fn r#get_vmo(&self) -> Self::GetVmoResponseFut {
1026 fn _decode(
1027 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1028 ) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
1029 let _response = fidl::client::decode_transaction_body::<
1030 fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
1031 fidl::encoding::DefaultFuchsiaResourceDialect,
1032 0xf523185c6e67738,
1033 >(_buf?)?;
1034 Ok(_response.map(|x| x.vmo))
1035 }
1036 self.client
1037 .send_query_and_decode::<fidl::encoding::EmptyPayload, InspectVmoProviderGetVmoResult>(
1038 (),
1039 0xf523185c6e67738,
1040 fidl::encoding::DynamicFlags::empty(),
1041 _decode,
1042 )
1043 }
1044
1045 type FormatResponseFut =
1046 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1047 fn r#format(&self) -> Self::FormatResponseFut {
1048 fn _decode(
1049 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1050 ) -> Result<i32, fidl::Error> {
1051 let _response = fidl::client::decode_transaction_body::<
1052 FtlFormatResponse,
1053 fidl::encoding::DefaultFuchsiaResourceDialect,
1054 0x79751d9c0b48a0d6,
1055 >(_buf?)?;
1056 Ok(_response.status)
1057 }
1058 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
1059 (),
1060 0x79751d9c0b48a0d6,
1061 fidl::encoding::DynamicFlags::empty(),
1062 _decode,
1063 )
1064 }
1065}
1066
1067pub struct FtlEventStream {
1068 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1069}
1070
1071impl std::marker::Unpin for FtlEventStream {}
1072
1073impl futures::stream::FusedStream for FtlEventStream {
1074 fn is_terminated(&self) -> bool {
1075 self.event_receiver.is_terminated()
1076 }
1077}
1078
1079impl futures::Stream for FtlEventStream {
1080 type Item = Result<FtlEvent, fidl::Error>;
1081
1082 fn poll_next(
1083 mut self: std::pin::Pin<&mut Self>,
1084 cx: &mut std::task::Context<'_>,
1085 ) -> std::task::Poll<Option<Self::Item>> {
1086 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1087 &mut self.event_receiver,
1088 cx
1089 )?) {
1090 Some(buf) => std::task::Poll::Ready(Some(FtlEvent::decode(buf))),
1091 None => std::task::Poll::Ready(None),
1092 }
1093 }
1094}
1095
1096#[derive(Debug)]
1097pub enum FtlEvent {}
1098
1099impl FtlEvent {
1100 fn decode(
1102 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1103 ) -> Result<FtlEvent, fidl::Error> {
1104 let (bytes, _handles) = buf.split_mut();
1105 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1106 debug_assert_eq!(tx_header.tx_id, 0);
1107 match tx_header.ordinal {
1108 _ => Err(fidl::Error::UnknownOrdinal {
1109 ordinal: tx_header.ordinal,
1110 protocol_name: <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1111 }),
1112 }
1113 }
1114}
1115
1116pub struct FtlRequestStream {
1118 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1119 is_terminated: bool,
1120}
1121
1122impl std::marker::Unpin for FtlRequestStream {}
1123
1124impl futures::stream::FusedStream for FtlRequestStream {
1125 fn is_terminated(&self) -> bool {
1126 self.is_terminated
1127 }
1128}
1129
1130impl fidl::endpoints::RequestStream for FtlRequestStream {
1131 type Protocol = FtlMarker;
1132 type ControlHandle = FtlControlHandle;
1133
1134 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1135 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1136 }
1137
1138 fn control_handle(&self) -> Self::ControlHandle {
1139 FtlControlHandle { inner: self.inner.clone() }
1140 }
1141
1142 fn into_inner(
1143 self,
1144 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1145 {
1146 (self.inner, self.is_terminated)
1147 }
1148
1149 fn from_inner(
1150 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1151 is_terminated: bool,
1152 ) -> Self {
1153 Self { inner, is_terminated }
1154 }
1155}
1156
1157impl futures::Stream for FtlRequestStream {
1158 type Item = Result<FtlRequest, fidl::Error>;
1159
1160 fn poll_next(
1161 mut self: std::pin::Pin<&mut Self>,
1162 cx: &mut std::task::Context<'_>,
1163 ) -> std::task::Poll<Option<Self::Item>> {
1164 let this = &mut *self;
1165 if this.inner.check_shutdown(cx) {
1166 this.is_terminated = true;
1167 return std::task::Poll::Ready(None);
1168 }
1169 if this.is_terminated {
1170 panic!("polled FtlRequestStream after completion");
1171 }
1172 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1173 |bytes, handles| {
1174 match this.inner.channel().read_etc(cx, bytes, handles) {
1175 std::task::Poll::Ready(Ok(())) => {}
1176 std::task::Poll::Pending => return std::task::Poll::Pending,
1177 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1178 this.is_terminated = true;
1179 return std::task::Poll::Ready(None);
1180 }
1181 std::task::Poll::Ready(Err(e)) => {
1182 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1183 e.into(),
1184 ))))
1185 }
1186 }
1187
1188 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1190
1191 std::task::Poll::Ready(Some(match header.ordinal {
1192 0xf523185c6e67738 => {
1193 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1194 let mut req = fidl::new_empty!(
1195 fidl::encoding::EmptyPayload,
1196 fidl::encoding::DefaultFuchsiaResourceDialect
1197 );
1198 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1199 let control_handle = FtlControlHandle { inner: this.inner.clone() };
1200 Ok(FtlRequest::GetVmo {
1201 responder: FtlGetVmoResponder {
1202 control_handle: std::mem::ManuallyDrop::new(control_handle),
1203 tx_id: header.tx_id,
1204 },
1205 })
1206 }
1207 0x79751d9c0b48a0d6 => {
1208 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1209 let mut req = fidl::new_empty!(
1210 fidl::encoding::EmptyPayload,
1211 fidl::encoding::DefaultFuchsiaResourceDialect
1212 );
1213 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1214 let control_handle = FtlControlHandle { inner: this.inner.clone() };
1215 Ok(FtlRequest::Format {
1216 responder: FtlFormatResponder {
1217 control_handle: std::mem::ManuallyDrop::new(control_handle),
1218 tx_id: header.tx_id,
1219 },
1220 })
1221 }
1222 _ => Err(fidl::Error::UnknownOrdinal {
1223 ordinal: header.ordinal,
1224 protocol_name: <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1225 }),
1226 }))
1227 },
1228 )
1229 }
1230}
1231
1232#[derive(Debug)]
1233pub enum FtlRequest {
1234 GetVmo { responder: FtlGetVmoResponder },
1237 Format { responder: FtlFormatResponder },
1239}
1240
1241impl FtlRequest {
1242 #[allow(irrefutable_let_patterns)]
1243 pub fn into_get_vmo(self) -> Option<(FtlGetVmoResponder)> {
1244 if let FtlRequest::GetVmo { responder } = self {
1245 Some((responder))
1246 } else {
1247 None
1248 }
1249 }
1250
1251 #[allow(irrefutable_let_patterns)]
1252 pub fn into_format(self) -> Option<(FtlFormatResponder)> {
1253 if let FtlRequest::Format { responder } = self {
1254 Some((responder))
1255 } else {
1256 None
1257 }
1258 }
1259
1260 pub fn method_name(&self) -> &'static str {
1262 match *self {
1263 FtlRequest::GetVmo { .. } => "get_vmo",
1264 FtlRequest::Format { .. } => "format",
1265 }
1266 }
1267}
1268
1269#[derive(Debug, Clone)]
1270pub struct FtlControlHandle {
1271 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1272}
1273
1274impl fidl::endpoints::ControlHandle for FtlControlHandle {
1275 fn shutdown(&self) {
1276 self.inner.shutdown()
1277 }
1278 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1279 self.inner.shutdown_with_epitaph(status)
1280 }
1281
1282 fn is_closed(&self) -> bool {
1283 self.inner.channel().is_closed()
1284 }
1285 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1286 self.inner.channel().on_closed()
1287 }
1288
1289 #[cfg(target_os = "fuchsia")]
1290 fn signal_peer(
1291 &self,
1292 clear_mask: zx::Signals,
1293 set_mask: zx::Signals,
1294 ) -> Result<(), zx_status::Status> {
1295 use fidl::Peered;
1296 self.inner.channel().signal_peer(clear_mask, set_mask)
1297 }
1298}
1299
1300impl FtlControlHandle {}
1301
1302#[must_use = "FIDL methods require a response to be sent"]
1303#[derive(Debug)]
1304pub struct FtlGetVmoResponder {
1305 control_handle: std::mem::ManuallyDrop<FtlControlHandle>,
1306 tx_id: u32,
1307}
1308
1309impl std::ops::Drop for FtlGetVmoResponder {
1313 fn drop(&mut self) {
1314 self.control_handle.shutdown();
1315 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317 }
1318}
1319
1320impl fidl::endpoints::Responder for FtlGetVmoResponder {
1321 type ControlHandle = FtlControlHandle;
1322
1323 fn control_handle(&self) -> &FtlControlHandle {
1324 &self.control_handle
1325 }
1326
1327 fn drop_without_shutdown(mut self) {
1328 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1330 std::mem::forget(self);
1332 }
1333}
1334
1335impl FtlGetVmoResponder {
1336 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1340 let _result = self.send_raw(result);
1341 if _result.is_err() {
1342 self.control_handle.shutdown();
1343 }
1344 self.drop_without_shutdown();
1345 _result
1346 }
1347
1348 pub fn send_no_shutdown_on_err(
1350 self,
1351 mut result: Result<fidl::Vmo, i32>,
1352 ) -> Result<(), fidl::Error> {
1353 let _result = self.send_raw(result);
1354 self.drop_without_shutdown();
1355 _result
1356 }
1357
1358 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1359 self.control_handle
1360 .inner
1361 .send::<fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>>(
1362 result.map(|vmo| (vmo,)),
1363 self.tx_id,
1364 0xf523185c6e67738,
1365 fidl::encoding::DynamicFlags::empty(),
1366 )
1367 }
1368}
1369
1370#[must_use = "FIDL methods require a response to be sent"]
1371#[derive(Debug)]
1372pub struct FtlFormatResponder {
1373 control_handle: std::mem::ManuallyDrop<FtlControlHandle>,
1374 tx_id: u32,
1375}
1376
1377impl std::ops::Drop for FtlFormatResponder {
1381 fn drop(&mut self) {
1382 self.control_handle.shutdown();
1383 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1385 }
1386}
1387
1388impl fidl::endpoints::Responder for FtlFormatResponder {
1389 type ControlHandle = FtlControlHandle;
1390
1391 fn control_handle(&self) -> &FtlControlHandle {
1392 &self.control_handle
1393 }
1394
1395 fn drop_without_shutdown(mut self) {
1396 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1398 std::mem::forget(self);
1400 }
1401}
1402
1403impl FtlFormatResponder {
1404 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1408 let _result = self.send_raw(status);
1409 if _result.is_err() {
1410 self.control_handle.shutdown();
1411 }
1412 self.drop_without_shutdown();
1413 _result
1414 }
1415
1416 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1418 let _result = self.send_raw(status);
1419 self.drop_without_shutdown();
1420 _result
1421 }
1422
1423 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1424 self.control_handle.inner.send::<FtlFormatResponse>(
1425 (status,),
1426 self.tx_id,
1427 0x79751d9c0b48a0d6,
1428 fidl::encoding::DynamicFlags::empty(),
1429 )
1430 }
1431}
1432
1433#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1434pub struct InspectVmoProviderMarker;
1435
1436impl fidl::endpoints::ProtocolMarker for InspectVmoProviderMarker {
1437 type Proxy = InspectVmoProviderProxy;
1438 type RequestStream = InspectVmoProviderRequestStream;
1439 #[cfg(target_os = "fuchsia")]
1440 type SynchronousProxy = InspectVmoProviderSynchronousProxy;
1441
1442 const DEBUG_NAME: &'static str = "(anonymous) InspectVmoProvider";
1443}
1444pub type InspectVmoProviderGetVmoResult = Result<fidl::Vmo, i32>;
1445
1446pub trait InspectVmoProviderProxyInterface: Send + Sync {
1447 type GetVmoResponseFut: std::future::Future<Output = Result<InspectVmoProviderGetVmoResult, fidl::Error>>
1448 + Send;
1449 fn r#get_vmo(&self) -> Self::GetVmoResponseFut;
1450}
1451#[derive(Debug)]
1452#[cfg(target_os = "fuchsia")]
1453pub struct InspectVmoProviderSynchronousProxy {
1454 client: fidl::client::sync::Client,
1455}
1456
1457#[cfg(target_os = "fuchsia")]
1458impl fidl::endpoints::SynchronousProxy for InspectVmoProviderSynchronousProxy {
1459 type Proxy = InspectVmoProviderProxy;
1460 type Protocol = InspectVmoProviderMarker;
1461
1462 fn from_channel(inner: fidl::Channel) -> Self {
1463 Self::new(inner)
1464 }
1465
1466 fn into_channel(self) -> fidl::Channel {
1467 self.client.into_channel()
1468 }
1469
1470 fn as_channel(&self) -> &fidl::Channel {
1471 self.client.as_channel()
1472 }
1473}
1474
1475#[cfg(target_os = "fuchsia")]
1476impl InspectVmoProviderSynchronousProxy {
1477 pub fn new(channel: fidl::Channel) -> Self {
1478 let protocol_name =
1479 <InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1480 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1481 }
1482
1483 pub fn into_channel(self) -> fidl::Channel {
1484 self.client.into_channel()
1485 }
1486
1487 pub fn wait_for_event(
1490 &self,
1491 deadline: zx::MonotonicInstant,
1492 ) -> Result<InspectVmoProviderEvent, fidl::Error> {
1493 InspectVmoProviderEvent::decode(self.client.wait_for_event(deadline)?)
1494 }
1495
1496 pub fn r#get_vmo(
1499 &self,
1500 ___deadline: zx::MonotonicInstant,
1501 ) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
1502 let _response = self.client.send_query::<
1503 fidl::encoding::EmptyPayload,
1504 fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
1505 >(
1506 (),
1507 0xf523185c6e67738,
1508 fidl::encoding::DynamicFlags::empty(),
1509 ___deadline,
1510 )?;
1511 Ok(_response.map(|x| x.vmo))
1512 }
1513}
1514
1515#[cfg(target_os = "fuchsia")]
1516impl From<InspectVmoProviderSynchronousProxy> for zx::Handle {
1517 fn from(value: InspectVmoProviderSynchronousProxy) -> Self {
1518 value.into_channel().into()
1519 }
1520}
1521
1522#[cfg(target_os = "fuchsia")]
1523impl From<fidl::Channel> for InspectVmoProviderSynchronousProxy {
1524 fn from(value: fidl::Channel) -> Self {
1525 Self::new(value)
1526 }
1527}
1528
1529#[derive(Debug, Clone)]
1530pub struct InspectVmoProviderProxy {
1531 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1532}
1533
1534impl fidl::endpoints::Proxy for InspectVmoProviderProxy {
1535 type Protocol = InspectVmoProviderMarker;
1536
1537 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1538 Self::new(inner)
1539 }
1540
1541 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1542 self.client.into_channel().map_err(|client| Self { client })
1543 }
1544
1545 fn as_channel(&self) -> &::fidl::AsyncChannel {
1546 self.client.as_channel()
1547 }
1548}
1549
1550impl InspectVmoProviderProxy {
1551 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1553 let protocol_name =
1554 <InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1555 Self { client: fidl::client::Client::new(channel, protocol_name) }
1556 }
1557
1558 pub fn take_event_stream(&self) -> InspectVmoProviderEventStream {
1564 InspectVmoProviderEventStream { event_receiver: self.client.take_event_receiver() }
1565 }
1566
1567 pub fn r#get_vmo(
1570 &self,
1571 ) -> fidl::client::QueryResponseFut<
1572 InspectVmoProviderGetVmoResult,
1573 fidl::encoding::DefaultFuchsiaResourceDialect,
1574 > {
1575 InspectVmoProviderProxyInterface::r#get_vmo(self)
1576 }
1577}
1578
1579impl InspectVmoProviderProxyInterface for InspectVmoProviderProxy {
1580 type GetVmoResponseFut = fidl::client::QueryResponseFut<
1581 InspectVmoProviderGetVmoResult,
1582 fidl::encoding::DefaultFuchsiaResourceDialect,
1583 >;
1584 fn r#get_vmo(&self) -> Self::GetVmoResponseFut {
1585 fn _decode(
1586 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1587 ) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
1588 let _response = fidl::client::decode_transaction_body::<
1589 fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
1590 fidl::encoding::DefaultFuchsiaResourceDialect,
1591 0xf523185c6e67738,
1592 >(_buf?)?;
1593 Ok(_response.map(|x| x.vmo))
1594 }
1595 self.client
1596 .send_query_and_decode::<fidl::encoding::EmptyPayload, InspectVmoProviderGetVmoResult>(
1597 (),
1598 0xf523185c6e67738,
1599 fidl::encoding::DynamicFlags::empty(),
1600 _decode,
1601 )
1602 }
1603}
1604
1605pub struct InspectVmoProviderEventStream {
1606 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1607}
1608
1609impl std::marker::Unpin for InspectVmoProviderEventStream {}
1610
1611impl futures::stream::FusedStream for InspectVmoProviderEventStream {
1612 fn is_terminated(&self) -> bool {
1613 self.event_receiver.is_terminated()
1614 }
1615}
1616
1617impl futures::Stream for InspectVmoProviderEventStream {
1618 type Item = Result<InspectVmoProviderEvent, fidl::Error>;
1619
1620 fn poll_next(
1621 mut self: std::pin::Pin<&mut Self>,
1622 cx: &mut std::task::Context<'_>,
1623 ) -> std::task::Poll<Option<Self::Item>> {
1624 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1625 &mut self.event_receiver,
1626 cx
1627 )?) {
1628 Some(buf) => std::task::Poll::Ready(Some(InspectVmoProviderEvent::decode(buf))),
1629 None => std::task::Poll::Ready(None),
1630 }
1631 }
1632}
1633
1634#[derive(Debug)]
1635pub enum InspectVmoProviderEvent {}
1636
1637impl InspectVmoProviderEvent {
1638 fn decode(
1640 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1641 ) -> Result<InspectVmoProviderEvent, fidl::Error> {
1642 let (bytes, _handles) = buf.split_mut();
1643 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1644 debug_assert_eq!(tx_header.tx_id, 0);
1645 match tx_header.ordinal {
1646 _ => Err(fidl::Error::UnknownOrdinal {
1647 ordinal: tx_header.ordinal,
1648 protocol_name:
1649 <InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1650 }),
1651 }
1652 }
1653}
1654
1655pub struct InspectVmoProviderRequestStream {
1657 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1658 is_terminated: bool,
1659}
1660
1661impl std::marker::Unpin for InspectVmoProviderRequestStream {}
1662
1663impl futures::stream::FusedStream for InspectVmoProviderRequestStream {
1664 fn is_terminated(&self) -> bool {
1665 self.is_terminated
1666 }
1667}
1668
1669impl fidl::endpoints::RequestStream for InspectVmoProviderRequestStream {
1670 type Protocol = InspectVmoProviderMarker;
1671 type ControlHandle = InspectVmoProviderControlHandle;
1672
1673 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1674 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1675 }
1676
1677 fn control_handle(&self) -> Self::ControlHandle {
1678 InspectVmoProviderControlHandle { inner: self.inner.clone() }
1679 }
1680
1681 fn into_inner(
1682 self,
1683 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1684 {
1685 (self.inner, self.is_terminated)
1686 }
1687
1688 fn from_inner(
1689 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1690 is_terminated: bool,
1691 ) -> Self {
1692 Self { inner, is_terminated }
1693 }
1694}
1695
1696impl futures::Stream for InspectVmoProviderRequestStream {
1697 type Item = Result<InspectVmoProviderRequest, fidl::Error>;
1698
1699 fn poll_next(
1700 mut self: std::pin::Pin<&mut Self>,
1701 cx: &mut std::task::Context<'_>,
1702 ) -> std::task::Poll<Option<Self::Item>> {
1703 let this = &mut *self;
1704 if this.inner.check_shutdown(cx) {
1705 this.is_terminated = true;
1706 return std::task::Poll::Ready(None);
1707 }
1708 if this.is_terminated {
1709 panic!("polled InspectVmoProviderRequestStream after completion");
1710 }
1711 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1712 |bytes, handles| {
1713 match this.inner.channel().read_etc(cx, bytes, handles) {
1714 std::task::Poll::Ready(Ok(())) => {}
1715 std::task::Poll::Pending => return std::task::Poll::Pending,
1716 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1717 this.is_terminated = true;
1718 return std::task::Poll::Ready(None);
1719 }
1720 std::task::Poll::Ready(Err(e)) => {
1721 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1722 e.into(),
1723 ))))
1724 }
1725 }
1726
1727 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1729
1730 std::task::Poll::Ready(Some(match header.ordinal {
1731 0xf523185c6e67738 => {
1732 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1733 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1734 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1735 let control_handle = InspectVmoProviderControlHandle {
1736 inner: this.inner.clone(),
1737 };
1738 Ok(InspectVmoProviderRequest::GetVmo {
1739 responder: InspectVmoProviderGetVmoResponder {
1740 control_handle: std::mem::ManuallyDrop::new(control_handle),
1741 tx_id: header.tx_id,
1742 },
1743 })
1744 }
1745 _ => Err(fidl::Error::UnknownOrdinal {
1746 ordinal: header.ordinal,
1747 protocol_name: <InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1748 }),
1749 }))
1750 },
1751 )
1752 }
1753}
1754
1755#[derive(Debug)]
1757pub enum InspectVmoProviderRequest {
1758 GetVmo { responder: InspectVmoProviderGetVmoResponder },
1761}
1762
1763impl InspectVmoProviderRequest {
1764 #[allow(irrefutable_let_patterns)]
1765 pub fn into_get_vmo(self) -> Option<(InspectVmoProviderGetVmoResponder)> {
1766 if let InspectVmoProviderRequest::GetVmo { responder } = self {
1767 Some((responder))
1768 } else {
1769 None
1770 }
1771 }
1772
1773 pub fn method_name(&self) -> &'static str {
1775 match *self {
1776 InspectVmoProviderRequest::GetVmo { .. } => "get_vmo",
1777 }
1778 }
1779}
1780
1781#[derive(Debug, Clone)]
1782pub struct InspectVmoProviderControlHandle {
1783 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1784}
1785
1786impl fidl::endpoints::ControlHandle for InspectVmoProviderControlHandle {
1787 fn shutdown(&self) {
1788 self.inner.shutdown()
1789 }
1790 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1791 self.inner.shutdown_with_epitaph(status)
1792 }
1793
1794 fn is_closed(&self) -> bool {
1795 self.inner.channel().is_closed()
1796 }
1797 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1798 self.inner.channel().on_closed()
1799 }
1800
1801 #[cfg(target_os = "fuchsia")]
1802 fn signal_peer(
1803 &self,
1804 clear_mask: zx::Signals,
1805 set_mask: zx::Signals,
1806 ) -> Result<(), zx_status::Status> {
1807 use fidl::Peered;
1808 self.inner.channel().signal_peer(clear_mask, set_mask)
1809 }
1810}
1811
1812impl InspectVmoProviderControlHandle {}
1813
1814#[must_use = "FIDL methods require a response to be sent"]
1815#[derive(Debug)]
1816pub struct InspectVmoProviderGetVmoResponder {
1817 control_handle: std::mem::ManuallyDrop<InspectVmoProviderControlHandle>,
1818 tx_id: u32,
1819}
1820
1821impl std::ops::Drop for InspectVmoProviderGetVmoResponder {
1825 fn drop(&mut self) {
1826 self.control_handle.shutdown();
1827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1829 }
1830}
1831
1832impl fidl::endpoints::Responder for InspectVmoProviderGetVmoResponder {
1833 type ControlHandle = InspectVmoProviderControlHandle;
1834
1835 fn control_handle(&self) -> &InspectVmoProviderControlHandle {
1836 &self.control_handle
1837 }
1838
1839 fn drop_without_shutdown(mut self) {
1840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1842 std::mem::forget(self);
1844 }
1845}
1846
1847impl InspectVmoProviderGetVmoResponder {
1848 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1852 let _result = self.send_raw(result);
1853 if _result.is_err() {
1854 self.control_handle.shutdown();
1855 }
1856 self.drop_without_shutdown();
1857 _result
1858 }
1859
1860 pub fn send_no_shutdown_on_err(
1862 self,
1863 mut result: Result<fidl::Vmo, i32>,
1864 ) -> Result<(), fidl::Error> {
1865 let _result = self.send_raw(result);
1866 self.drop_without_shutdown();
1867 _result
1868 }
1869
1870 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1871 self.control_handle
1872 .inner
1873 .send::<fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>>(
1874 result.map(|vmo| (vmo,)),
1875 self.tx_id,
1876 0xf523185c6e67738,
1877 fidl::encoding::DynamicFlags::empty(),
1878 )
1879 }
1880}
1881
1882#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1883pub struct OffsetMapMarker;
1884
1885impl fidl::endpoints::ProtocolMarker for OffsetMapMarker {
1886 type Proxy = OffsetMapProxy;
1887 type RequestStream = OffsetMapRequestStream;
1888 #[cfg(target_os = "fuchsia")]
1889 type SynchronousProxy = OffsetMapSynchronousProxy;
1890
1891 const DEBUG_NAME: &'static str = "(anonymous) OffsetMap";
1892}
1893pub type OffsetMapQueryResult = Result<Vec<BlockOffsetMapping>, i32>;
1894
1895pub trait OffsetMapProxyInterface: Send + Sync {
1896 type QueryResponseFut: std::future::Future<Output = Result<OffsetMapQueryResult, fidl::Error>>
1897 + Send;
1898 fn r#query(&self, source_block_offset: u64, length: u64) -> Self::QueryResponseFut;
1899}
1900#[derive(Debug)]
1901#[cfg(target_os = "fuchsia")]
1902pub struct OffsetMapSynchronousProxy {
1903 client: fidl::client::sync::Client,
1904}
1905
1906#[cfg(target_os = "fuchsia")]
1907impl fidl::endpoints::SynchronousProxy for OffsetMapSynchronousProxy {
1908 type Proxy = OffsetMapProxy;
1909 type Protocol = OffsetMapMarker;
1910
1911 fn from_channel(inner: fidl::Channel) -> Self {
1912 Self::new(inner)
1913 }
1914
1915 fn into_channel(self) -> fidl::Channel {
1916 self.client.into_channel()
1917 }
1918
1919 fn as_channel(&self) -> &fidl::Channel {
1920 self.client.as_channel()
1921 }
1922}
1923
1924#[cfg(target_os = "fuchsia")]
1925impl OffsetMapSynchronousProxy {
1926 pub fn new(channel: fidl::Channel) -> Self {
1927 let protocol_name = <OffsetMapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1928 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1929 }
1930
1931 pub fn into_channel(self) -> fidl::Channel {
1932 self.client.into_channel()
1933 }
1934
1935 pub fn wait_for_event(
1938 &self,
1939 deadline: zx::MonotonicInstant,
1940 ) -> Result<OffsetMapEvent, fidl::Error> {
1941 OffsetMapEvent::decode(self.client.wait_for_event(deadline)?)
1942 }
1943
1944 pub fn r#query(
1951 &self,
1952 mut source_block_offset: u64,
1953 mut length: u64,
1954 ___deadline: zx::MonotonicInstant,
1955 ) -> Result<OffsetMapQueryResult, fidl::Error> {
1956 let _response = self.client.send_query::<
1957 OffsetMapQueryRequest,
1958 fidl::encoding::ResultType<OffsetMapQueryResponse, i32>,
1959 >(
1960 (source_block_offset, length,),
1961 0x18471939852e45a4,
1962 fidl::encoding::DynamicFlags::empty(),
1963 ___deadline,
1964 )?;
1965 Ok(_response.map(|x| x.mappings))
1966 }
1967}
1968
1969#[cfg(target_os = "fuchsia")]
1970impl From<OffsetMapSynchronousProxy> for zx::Handle {
1971 fn from(value: OffsetMapSynchronousProxy) -> Self {
1972 value.into_channel().into()
1973 }
1974}
1975
1976#[cfg(target_os = "fuchsia")]
1977impl From<fidl::Channel> for OffsetMapSynchronousProxy {
1978 fn from(value: fidl::Channel) -> Self {
1979 Self::new(value)
1980 }
1981}
1982
1983#[derive(Debug, Clone)]
1984pub struct OffsetMapProxy {
1985 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1986}
1987
1988impl fidl::endpoints::Proxy for OffsetMapProxy {
1989 type Protocol = OffsetMapMarker;
1990
1991 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1992 Self::new(inner)
1993 }
1994
1995 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1996 self.client.into_channel().map_err(|client| Self { client })
1997 }
1998
1999 fn as_channel(&self) -> &::fidl::AsyncChannel {
2000 self.client.as_channel()
2001 }
2002}
2003
2004impl OffsetMapProxy {
2005 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2007 let protocol_name = <OffsetMapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2008 Self { client: fidl::client::Client::new(channel, protocol_name) }
2009 }
2010
2011 pub fn take_event_stream(&self) -> OffsetMapEventStream {
2017 OffsetMapEventStream { event_receiver: self.client.take_event_receiver() }
2018 }
2019
2020 pub fn r#query(
2027 &self,
2028 mut source_block_offset: u64,
2029 mut length: u64,
2030 ) -> fidl::client::QueryResponseFut<
2031 OffsetMapQueryResult,
2032 fidl::encoding::DefaultFuchsiaResourceDialect,
2033 > {
2034 OffsetMapProxyInterface::r#query(self, source_block_offset, length)
2035 }
2036}
2037
2038impl OffsetMapProxyInterface for OffsetMapProxy {
2039 type QueryResponseFut = fidl::client::QueryResponseFut<
2040 OffsetMapQueryResult,
2041 fidl::encoding::DefaultFuchsiaResourceDialect,
2042 >;
2043 fn r#query(&self, mut source_block_offset: u64, mut length: u64) -> Self::QueryResponseFut {
2044 fn _decode(
2045 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2046 ) -> Result<OffsetMapQueryResult, fidl::Error> {
2047 let _response = fidl::client::decode_transaction_body::<
2048 fidl::encoding::ResultType<OffsetMapQueryResponse, i32>,
2049 fidl::encoding::DefaultFuchsiaResourceDialect,
2050 0x18471939852e45a4,
2051 >(_buf?)?;
2052 Ok(_response.map(|x| x.mappings))
2053 }
2054 self.client.send_query_and_decode::<OffsetMapQueryRequest, OffsetMapQueryResult>(
2055 (source_block_offset, length),
2056 0x18471939852e45a4,
2057 fidl::encoding::DynamicFlags::empty(),
2058 _decode,
2059 )
2060 }
2061}
2062
2063pub struct OffsetMapEventStream {
2064 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2065}
2066
2067impl std::marker::Unpin for OffsetMapEventStream {}
2068
2069impl futures::stream::FusedStream for OffsetMapEventStream {
2070 fn is_terminated(&self) -> bool {
2071 self.event_receiver.is_terminated()
2072 }
2073}
2074
2075impl futures::Stream for OffsetMapEventStream {
2076 type Item = Result<OffsetMapEvent, fidl::Error>;
2077
2078 fn poll_next(
2079 mut self: std::pin::Pin<&mut Self>,
2080 cx: &mut std::task::Context<'_>,
2081 ) -> std::task::Poll<Option<Self::Item>> {
2082 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2083 &mut self.event_receiver,
2084 cx
2085 )?) {
2086 Some(buf) => std::task::Poll::Ready(Some(OffsetMapEvent::decode(buf))),
2087 None => std::task::Poll::Ready(None),
2088 }
2089 }
2090}
2091
2092#[derive(Debug)]
2093pub enum OffsetMapEvent {}
2094
2095impl OffsetMapEvent {
2096 fn decode(
2098 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2099 ) -> Result<OffsetMapEvent, fidl::Error> {
2100 let (bytes, _handles) = buf.split_mut();
2101 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2102 debug_assert_eq!(tx_header.tx_id, 0);
2103 match tx_header.ordinal {
2104 _ => Err(fidl::Error::UnknownOrdinal {
2105 ordinal: tx_header.ordinal,
2106 protocol_name: <OffsetMapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2107 }),
2108 }
2109 }
2110}
2111
2112pub struct OffsetMapRequestStream {
2114 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2115 is_terminated: bool,
2116}
2117
2118impl std::marker::Unpin for OffsetMapRequestStream {}
2119
2120impl futures::stream::FusedStream for OffsetMapRequestStream {
2121 fn is_terminated(&self) -> bool {
2122 self.is_terminated
2123 }
2124}
2125
2126impl fidl::endpoints::RequestStream for OffsetMapRequestStream {
2127 type Protocol = OffsetMapMarker;
2128 type ControlHandle = OffsetMapControlHandle;
2129
2130 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2131 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2132 }
2133
2134 fn control_handle(&self) -> Self::ControlHandle {
2135 OffsetMapControlHandle { inner: self.inner.clone() }
2136 }
2137
2138 fn into_inner(
2139 self,
2140 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2141 {
2142 (self.inner, self.is_terminated)
2143 }
2144
2145 fn from_inner(
2146 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2147 is_terminated: bool,
2148 ) -> Self {
2149 Self { inner, is_terminated }
2150 }
2151}
2152
2153impl futures::Stream for OffsetMapRequestStream {
2154 type Item = Result<OffsetMapRequest, fidl::Error>;
2155
2156 fn poll_next(
2157 mut self: std::pin::Pin<&mut Self>,
2158 cx: &mut std::task::Context<'_>,
2159 ) -> std::task::Poll<Option<Self::Item>> {
2160 let this = &mut *self;
2161 if this.inner.check_shutdown(cx) {
2162 this.is_terminated = true;
2163 return std::task::Poll::Ready(None);
2164 }
2165 if this.is_terminated {
2166 panic!("polled OffsetMapRequestStream after completion");
2167 }
2168 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2169 |bytes, handles| {
2170 match this.inner.channel().read_etc(cx, bytes, handles) {
2171 std::task::Poll::Ready(Ok(())) => {}
2172 std::task::Poll::Pending => return std::task::Poll::Pending,
2173 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2174 this.is_terminated = true;
2175 return std::task::Poll::Ready(None);
2176 }
2177 std::task::Poll::Ready(Err(e)) => {
2178 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2179 e.into(),
2180 ))))
2181 }
2182 }
2183
2184 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2186
2187 std::task::Poll::Ready(Some(match header.ordinal {
2188 0x18471939852e45a4 => {
2189 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2190 let mut req = fidl::new_empty!(
2191 OffsetMapQueryRequest,
2192 fidl::encoding::DefaultFuchsiaResourceDialect
2193 );
2194 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<OffsetMapQueryRequest>(&header, _body_bytes, handles, &mut req)?;
2195 let control_handle = OffsetMapControlHandle { inner: this.inner.clone() };
2196 Ok(OffsetMapRequest::Query {
2197 source_block_offset: req.source_block_offset,
2198 length: req.length,
2199
2200 responder: OffsetMapQueryResponder {
2201 control_handle: std::mem::ManuallyDrop::new(control_handle),
2202 tx_id: header.tx_id,
2203 },
2204 })
2205 }
2206 _ => Err(fidl::Error::UnknownOrdinal {
2207 ordinal: header.ordinal,
2208 protocol_name:
2209 <OffsetMapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2210 }),
2211 }))
2212 },
2213 )
2214 }
2215}
2216
2217#[derive(Debug)]
2219pub enum OffsetMapRequest {
2220 Query { source_block_offset: u64, length: u64, responder: OffsetMapQueryResponder },
2227}
2228
2229impl OffsetMapRequest {
2230 #[allow(irrefutable_let_patterns)]
2231 pub fn into_query(self) -> Option<(u64, u64, OffsetMapQueryResponder)> {
2232 if let OffsetMapRequest::Query { source_block_offset, length, responder } = self {
2233 Some((source_block_offset, length, responder))
2234 } else {
2235 None
2236 }
2237 }
2238
2239 pub fn method_name(&self) -> &'static str {
2241 match *self {
2242 OffsetMapRequest::Query { .. } => "query",
2243 }
2244 }
2245}
2246
2247#[derive(Debug, Clone)]
2248pub struct OffsetMapControlHandle {
2249 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2250}
2251
2252impl fidl::endpoints::ControlHandle for OffsetMapControlHandle {
2253 fn shutdown(&self) {
2254 self.inner.shutdown()
2255 }
2256 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2257 self.inner.shutdown_with_epitaph(status)
2258 }
2259
2260 fn is_closed(&self) -> bool {
2261 self.inner.channel().is_closed()
2262 }
2263 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2264 self.inner.channel().on_closed()
2265 }
2266
2267 #[cfg(target_os = "fuchsia")]
2268 fn signal_peer(
2269 &self,
2270 clear_mask: zx::Signals,
2271 set_mask: zx::Signals,
2272 ) -> Result<(), zx_status::Status> {
2273 use fidl::Peered;
2274 self.inner.channel().signal_peer(clear_mask, set_mask)
2275 }
2276}
2277
2278impl OffsetMapControlHandle {}
2279
2280#[must_use = "FIDL methods require a response to be sent"]
2281#[derive(Debug)]
2282pub struct OffsetMapQueryResponder {
2283 control_handle: std::mem::ManuallyDrop<OffsetMapControlHandle>,
2284 tx_id: u32,
2285}
2286
2287impl std::ops::Drop for OffsetMapQueryResponder {
2291 fn drop(&mut self) {
2292 self.control_handle.shutdown();
2293 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2295 }
2296}
2297
2298impl fidl::endpoints::Responder for OffsetMapQueryResponder {
2299 type ControlHandle = OffsetMapControlHandle;
2300
2301 fn control_handle(&self) -> &OffsetMapControlHandle {
2302 &self.control_handle
2303 }
2304
2305 fn drop_without_shutdown(mut self) {
2306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2308 std::mem::forget(self);
2310 }
2311}
2312
2313impl OffsetMapQueryResponder {
2314 pub fn send(self, mut result: Result<&[BlockOffsetMapping], i32>) -> Result<(), fidl::Error> {
2318 let _result = self.send_raw(result);
2319 if _result.is_err() {
2320 self.control_handle.shutdown();
2321 }
2322 self.drop_without_shutdown();
2323 _result
2324 }
2325
2326 pub fn send_no_shutdown_on_err(
2328 self,
2329 mut result: Result<&[BlockOffsetMapping], i32>,
2330 ) -> Result<(), fidl::Error> {
2331 let _result = self.send_raw(result);
2332 self.drop_without_shutdown();
2333 _result
2334 }
2335
2336 fn send_raw(&self, mut result: Result<&[BlockOffsetMapping], i32>) -> Result<(), fidl::Error> {
2337 self.control_handle.inner.send::<fidl::encoding::ResultType<OffsetMapQueryResponse, i32>>(
2338 result.map(|mappings| (mappings,)),
2339 self.tx_id,
2340 0x18471939852e45a4,
2341 fidl::encoding::DynamicFlags::empty(),
2342 )
2343 }
2344}
2345
2346#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2347pub struct SessionMarker;
2348
2349impl fidl::endpoints::ProtocolMarker for SessionMarker {
2350 type Proxy = SessionProxy;
2351 type RequestStream = SessionRequestStream;
2352 #[cfg(target_os = "fuchsia")]
2353 type SynchronousProxy = SessionSynchronousProxy;
2354
2355 const DEBUG_NAME: &'static str = "(anonymous) Session";
2356}
2357pub type SessionGetFifoResult = Result<fidl::Fifo, i32>;
2358pub type SessionAttachVmoResult = Result<VmoId, i32>;
2359
2360pub trait SessionProxyInterface: Send + Sync {
2361 type CloseResponseFut: std::future::Future<
2362 Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
2363 > + Send;
2364 fn r#close(&self) -> Self::CloseResponseFut;
2365 type GetFifoResponseFut: std::future::Future<Output = Result<SessionGetFifoResult, fidl::Error>>
2366 + Send;
2367 fn r#get_fifo(&self) -> Self::GetFifoResponseFut;
2368 type AttachVmoResponseFut: std::future::Future<Output = Result<SessionAttachVmoResult, fidl::Error>>
2369 + Send;
2370 fn r#attach_vmo(&self, vmo: fidl::Vmo) -> Self::AttachVmoResponseFut;
2371}
2372#[derive(Debug)]
2373#[cfg(target_os = "fuchsia")]
2374pub struct SessionSynchronousProxy {
2375 client: fidl::client::sync::Client,
2376}
2377
2378#[cfg(target_os = "fuchsia")]
2379impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
2380 type Proxy = SessionProxy;
2381 type Protocol = SessionMarker;
2382
2383 fn from_channel(inner: fidl::Channel) -> Self {
2384 Self::new(inner)
2385 }
2386
2387 fn into_channel(self) -> fidl::Channel {
2388 self.client.into_channel()
2389 }
2390
2391 fn as_channel(&self) -> &fidl::Channel {
2392 self.client.as_channel()
2393 }
2394}
2395
2396#[cfg(target_os = "fuchsia")]
2397impl SessionSynchronousProxy {
2398 pub fn new(channel: fidl::Channel) -> Self {
2399 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2400 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2401 }
2402
2403 pub fn into_channel(self) -> fidl::Channel {
2404 self.client.into_channel()
2405 }
2406
2407 pub fn wait_for_event(
2410 &self,
2411 deadline: zx::MonotonicInstant,
2412 ) -> Result<SessionEvent, fidl::Error> {
2413 SessionEvent::decode(self.client.wait_for_event(deadline)?)
2414 }
2415
2416 pub fn r#close(
2427 &self,
2428 ___deadline: zx::MonotonicInstant,
2429 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2430 let _response = self.client.send_query::<
2431 fidl::encoding::EmptyPayload,
2432 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2433 >(
2434 (),
2435 0x5ac5d459ad7f657e,
2436 fidl::encoding::DynamicFlags::empty(),
2437 ___deadline,
2438 )?;
2439 Ok(_response.map(|x| x))
2440 }
2441
2442 pub fn r#get_fifo(
2444 &self,
2445 ___deadline: zx::MonotonicInstant,
2446 ) -> Result<SessionGetFifoResult, fidl::Error> {
2447 let _response = self.client.send_query::<
2448 fidl::encoding::EmptyPayload,
2449 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
2450 >(
2451 (),
2452 0x61a31a92a206b7d5,
2453 fidl::encoding::DynamicFlags::empty(),
2454 ___deadline,
2455 )?;
2456 Ok(_response.map(|x| x.fifo))
2457 }
2458
2459 pub fn r#attach_vmo(
2463 &self,
2464 mut vmo: fidl::Vmo,
2465 ___deadline: zx::MonotonicInstant,
2466 ) -> Result<SessionAttachVmoResult, fidl::Error> {
2467 let _response = self.client.send_query::<
2468 SessionAttachVmoRequest,
2469 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
2470 >(
2471 (vmo,),
2472 0x54edc4641d9569f5,
2473 fidl::encoding::DynamicFlags::empty(),
2474 ___deadline,
2475 )?;
2476 Ok(_response.map(|x| x.vmoid))
2477 }
2478}
2479
2480#[cfg(target_os = "fuchsia")]
2481impl From<SessionSynchronousProxy> for zx::Handle {
2482 fn from(value: SessionSynchronousProxy) -> Self {
2483 value.into_channel().into()
2484 }
2485}
2486
2487#[cfg(target_os = "fuchsia")]
2488impl From<fidl::Channel> for SessionSynchronousProxy {
2489 fn from(value: fidl::Channel) -> Self {
2490 Self::new(value)
2491 }
2492}
2493
2494#[derive(Debug, Clone)]
2495pub struct SessionProxy {
2496 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2497}
2498
2499impl fidl::endpoints::Proxy for SessionProxy {
2500 type Protocol = SessionMarker;
2501
2502 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2503 Self::new(inner)
2504 }
2505
2506 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2507 self.client.into_channel().map_err(|client| Self { client })
2508 }
2509
2510 fn as_channel(&self) -> &::fidl::AsyncChannel {
2511 self.client.as_channel()
2512 }
2513}
2514
2515impl SessionProxy {
2516 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2518 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2519 Self { client: fidl::client::Client::new(channel, protocol_name) }
2520 }
2521
2522 pub fn take_event_stream(&self) -> SessionEventStream {
2528 SessionEventStream { event_receiver: self.client.take_event_receiver() }
2529 }
2530
2531 pub fn r#close(
2542 &self,
2543 ) -> fidl::client::QueryResponseFut<
2544 fidl_fuchsia_unknown::CloseableCloseResult,
2545 fidl::encoding::DefaultFuchsiaResourceDialect,
2546 > {
2547 SessionProxyInterface::r#close(self)
2548 }
2549
2550 pub fn r#get_fifo(
2552 &self,
2553 ) -> fidl::client::QueryResponseFut<
2554 SessionGetFifoResult,
2555 fidl::encoding::DefaultFuchsiaResourceDialect,
2556 > {
2557 SessionProxyInterface::r#get_fifo(self)
2558 }
2559
2560 pub fn r#attach_vmo(
2564 &self,
2565 mut vmo: fidl::Vmo,
2566 ) -> fidl::client::QueryResponseFut<
2567 SessionAttachVmoResult,
2568 fidl::encoding::DefaultFuchsiaResourceDialect,
2569 > {
2570 SessionProxyInterface::r#attach_vmo(self, vmo)
2571 }
2572}
2573
2574impl SessionProxyInterface for SessionProxy {
2575 type CloseResponseFut = fidl::client::QueryResponseFut<
2576 fidl_fuchsia_unknown::CloseableCloseResult,
2577 fidl::encoding::DefaultFuchsiaResourceDialect,
2578 >;
2579 fn r#close(&self) -> Self::CloseResponseFut {
2580 fn _decode(
2581 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2582 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2583 let _response = fidl::client::decode_transaction_body::<
2584 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2585 fidl::encoding::DefaultFuchsiaResourceDialect,
2586 0x5ac5d459ad7f657e,
2587 >(_buf?)?;
2588 Ok(_response.map(|x| x))
2589 }
2590 self.client.send_query_and_decode::<
2591 fidl::encoding::EmptyPayload,
2592 fidl_fuchsia_unknown::CloseableCloseResult,
2593 >(
2594 (),
2595 0x5ac5d459ad7f657e,
2596 fidl::encoding::DynamicFlags::empty(),
2597 _decode,
2598 )
2599 }
2600
2601 type GetFifoResponseFut = fidl::client::QueryResponseFut<
2602 SessionGetFifoResult,
2603 fidl::encoding::DefaultFuchsiaResourceDialect,
2604 >;
2605 fn r#get_fifo(&self) -> Self::GetFifoResponseFut {
2606 fn _decode(
2607 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2608 ) -> Result<SessionGetFifoResult, fidl::Error> {
2609 let _response = fidl::client::decode_transaction_body::<
2610 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
2611 fidl::encoding::DefaultFuchsiaResourceDialect,
2612 0x61a31a92a206b7d5,
2613 >(_buf?)?;
2614 Ok(_response.map(|x| x.fifo))
2615 }
2616 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionGetFifoResult>(
2617 (),
2618 0x61a31a92a206b7d5,
2619 fidl::encoding::DynamicFlags::empty(),
2620 _decode,
2621 )
2622 }
2623
2624 type AttachVmoResponseFut = fidl::client::QueryResponseFut<
2625 SessionAttachVmoResult,
2626 fidl::encoding::DefaultFuchsiaResourceDialect,
2627 >;
2628 fn r#attach_vmo(&self, mut vmo: fidl::Vmo) -> Self::AttachVmoResponseFut {
2629 fn _decode(
2630 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2631 ) -> Result<SessionAttachVmoResult, fidl::Error> {
2632 let _response = fidl::client::decode_transaction_body::<
2633 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
2634 fidl::encoding::DefaultFuchsiaResourceDialect,
2635 0x54edc4641d9569f5,
2636 >(_buf?)?;
2637 Ok(_response.map(|x| x.vmoid))
2638 }
2639 self.client.send_query_and_decode::<SessionAttachVmoRequest, SessionAttachVmoResult>(
2640 (vmo,),
2641 0x54edc4641d9569f5,
2642 fidl::encoding::DynamicFlags::empty(),
2643 _decode,
2644 )
2645 }
2646}
2647
2648pub struct SessionEventStream {
2649 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2650}
2651
2652impl std::marker::Unpin for SessionEventStream {}
2653
2654impl futures::stream::FusedStream for SessionEventStream {
2655 fn is_terminated(&self) -> bool {
2656 self.event_receiver.is_terminated()
2657 }
2658}
2659
2660impl futures::Stream for SessionEventStream {
2661 type Item = Result<SessionEvent, fidl::Error>;
2662
2663 fn poll_next(
2664 mut self: std::pin::Pin<&mut Self>,
2665 cx: &mut std::task::Context<'_>,
2666 ) -> std::task::Poll<Option<Self::Item>> {
2667 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2668 &mut self.event_receiver,
2669 cx
2670 )?) {
2671 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
2672 None => std::task::Poll::Ready(None),
2673 }
2674 }
2675}
2676
2677#[derive(Debug)]
2678pub enum SessionEvent {}
2679
2680impl SessionEvent {
2681 fn decode(
2683 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2684 ) -> Result<SessionEvent, fidl::Error> {
2685 let (bytes, _handles) = buf.split_mut();
2686 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2687 debug_assert_eq!(tx_header.tx_id, 0);
2688 match tx_header.ordinal {
2689 _ => Err(fidl::Error::UnknownOrdinal {
2690 ordinal: tx_header.ordinal,
2691 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2692 }),
2693 }
2694 }
2695}
2696
2697pub struct SessionRequestStream {
2699 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2700 is_terminated: bool,
2701}
2702
2703impl std::marker::Unpin for SessionRequestStream {}
2704
2705impl futures::stream::FusedStream for SessionRequestStream {
2706 fn is_terminated(&self) -> bool {
2707 self.is_terminated
2708 }
2709}
2710
2711impl fidl::endpoints::RequestStream for SessionRequestStream {
2712 type Protocol = SessionMarker;
2713 type ControlHandle = SessionControlHandle;
2714
2715 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2716 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2717 }
2718
2719 fn control_handle(&self) -> Self::ControlHandle {
2720 SessionControlHandle { inner: self.inner.clone() }
2721 }
2722
2723 fn into_inner(
2724 self,
2725 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2726 {
2727 (self.inner, self.is_terminated)
2728 }
2729
2730 fn from_inner(
2731 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2732 is_terminated: bool,
2733 ) -> Self {
2734 Self { inner, is_terminated }
2735 }
2736}
2737
2738impl futures::Stream for SessionRequestStream {
2739 type Item = Result<SessionRequest, fidl::Error>;
2740
2741 fn poll_next(
2742 mut self: std::pin::Pin<&mut Self>,
2743 cx: &mut std::task::Context<'_>,
2744 ) -> std::task::Poll<Option<Self::Item>> {
2745 let this = &mut *self;
2746 if this.inner.check_shutdown(cx) {
2747 this.is_terminated = true;
2748 return std::task::Poll::Ready(None);
2749 }
2750 if this.is_terminated {
2751 panic!("polled SessionRequestStream after completion");
2752 }
2753 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2754 |bytes, handles| {
2755 match this.inner.channel().read_etc(cx, bytes, handles) {
2756 std::task::Poll::Ready(Ok(())) => {}
2757 std::task::Poll::Pending => return std::task::Poll::Pending,
2758 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2759 this.is_terminated = true;
2760 return std::task::Poll::Ready(None);
2761 }
2762 std::task::Poll::Ready(Err(e)) => {
2763 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2764 e.into(),
2765 ))))
2766 }
2767 }
2768
2769 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2771
2772 std::task::Poll::Ready(Some(match header.ordinal {
2773 0x5ac5d459ad7f657e => {
2774 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2775 let mut req = fidl::new_empty!(
2776 fidl::encoding::EmptyPayload,
2777 fidl::encoding::DefaultFuchsiaResourceDialect
2778 );
2779 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2780 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2781 Ok(SessionRequest::Close {
2782 responder: SessionCloseResponder {
2783 control_handle: std::mem::ManuallyDrop::new(control_handle),
2784 tx_id: header.tx_id,
2785 },
2786 })
2787 }
2788 0x61a31a92a206b7d5 => {
2789 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2790 let mut req = fidl::new_empty!(
2791 fidl::encoding::EmptyPayload,
2792 fidl::encoding::DefaultFuchsiaResourceDialect
2793 );
2794 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2795 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2796 Ok(SessionRequest::GetFifo {
2797 responder: SessionGetFifoResponder {
2798 control_handle: std::mem::ManuallyDrop::new(control_handle),
2799 tx_id: header.tx_id,
2800 },
2801 })
2802 }
2803 0x54edc4641d9569f5 => {
2804 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2805 let mut req = fidl::new_empty!(
2806 SessionAttachVmoRequest,
2807 fidl::encoding::DefaultFuchsiaResourceDialect
2808 );
2809 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachVmoRequest>(&header, _body_bytes, handles, &mut req)?;
2810 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2811 Ok(SessionRequest::AttachVmo {
2812 vmo: req.vmo,
2813
2814 responder: SessionAttachVmoResponder {
2815 control_handle: std::mem::ManuallyDrop::new(control_handle),
2816 tx_id: header.tx_id,
2817 },
2818 })
2819 }
2820 _ => Err(fidl::Error::UnknownOrdinal {
2821 ordinal: header.ordinal,
2822 protocol_name:
2823 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2824 }),
2825 }))
2826 },
2827 )
2828 }
2829}
2830
2831#[derive(Debug)]
2841pub enum SessionRequest {
2842 Close { responder: SessionCloseResponder },
2853 GetFifo { responder: SessionGetFifoResponder },
2855 AttachVmo { vmo: fidl::Vmo, responder: SessionAttachVmoResponder },
2859}
2860
2861impl SessionRequest {
2862 #[allow(irrefutable_let_patterns)]
2863 pub fn into_close(self) -> Option<(SessionCloseResponder)> {
2864 if let SessionRequest::Close { responder } = self {
2865 Some((responder))
2866 } else {
2867 None
2868 }
2869 }
2870
2871 #[allow(irrefutable_let_patterns)]
2872 pub fn into_get_fifo(self) -> Option<(SessionGetFifoResponder)> {
2873 if let SessionRequest::GetFifo { responder } = self {
2874 Some((responder))
2875 } else {
2876 None
2877 }
2878 }
2879
2880 #[allow(irrefutable_let_patterns)]
2881 pub fn into_attach_vmo(self) -> Option<(fidl::Vmo, SessionAttachVmoResponder)> {
2882 if let SessionRequest::AttachVmo { vmo, responder } = self {
2883 Some((vmo, responder))
2884 } else {
2885 None
2886 }
2887 }
2888
2889 pub fn method_name(&self) -> &'static str {
2891 match *self {
2892 SessionRequest::Close { .. } => "close",
2893 SessionRequest::GetFifo { .. } => "get_fifo",
2894 SessionRequest::AttachVmo { .. } => "attach_vmo",
2895 }
2896 }
2897}
2898
2899#[derive(Debug, Clone)]
2900pub struct SessionControlHandle {
2901 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2902}
2903
2904impl fidl::endpoints::ControlHandle for SessionControlHandle {
2905 fn shutdown(&self) {
2906 self.inner.shutdown()
2907 }
2908 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2909 self.inner.shutdown_with_epitaph(status)
2910 }
2911
2912 fn is_closed(&self) -> bool {
2913 self.inner.channel().is_closed()
2914 }
2915 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2916 self.inner.channel().on_closed()
2917 }
2918
2919 #[cfg(target_os = "fuchsia")]
2920 fn signal_peer(
2921 &self,
2922 clear_mask: zx::Signals,
2923 set_mask: zx::Signals,
2924 ) -> Result<(), zx_status::Status> {
2925 use fidl::Peered;
2926 self.inner.channel().signal_peer(clear_mask, set_mask)
2927 }
2928}
2929
2930impl SessionControlHandle {}
2931
2932#[must_use = "FIDL methods require a response to be sent"]
2933#[derive(Debug)]
2934pub struct SessionCloseResponder {
2935 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2936 tx_id: u32,
2937}
2938
2939impl std::ops::Drop for SessionCloseResponder {
2943 fn drop(&mut self) {
2944 self.control_handle.shutdown();
2945 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2947 }
2948}
2949
2950impl fidl::endpoints::Responder for SessionCloseResponder {
2951 type ControlHandle = SessionControlHandle;
2952
2953 fn control_handle(&self) -> &SessionControlHandle {
2954 &self.control_handle
2955 }
2956
2957 fn drop_without_shutdown(mut self) {
2958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2960 std::mem::forget(self);
2962 }
2963}
2964
2965impl SessionCloseResponder {
2966 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2970 let _result = self.send_raw(result);
2971 if _result.is_err() {
2972 self.control_handle.shutdown();
2973 }
2974 self.drop_without_shutdown();
2975 _result
2976 }
2977
2978 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2980 let _result = self.send_raw(result);
2981 self.drop_without_shutdown();
2982 _result
2983 }
2984
2985 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2986 self.control_handle
2987 .inner
2988 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2989 result,
2990 self.tx_id,
2991 0x5ac5d459ad7f657e,
2992 fidl::encoding::DynamicFlags::empty(),
2993 )
2994 }
2995}
2996
2997#[must_use = "FIDL methods require a response to be sent"]
2998#[derive(Debug)]
2999pub struct SessionGetFifoResponder {
3000 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
3001 tx_id: u32,
3002}
3003
3004impl std::ops::Drop for SessionGetFifoResponder {
3008 fn drop(&mut self) {
3009 self.control_handle.shutdown();
3010 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3012 }
3013}
3014
3015impl fidl::endpoints::Responder for SessionGetFifoResponder {
3016 type ControlHandle = SessionControlHandle;
3017
3018 fn control_handle(&self) -> &SessionControlHandle {
3019 &self.control_handle
3020 }
3021
3022 fn drop_without_shutdown(mut self) {
3023 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3025 std::mem::forget(self);
3027 }
3028}
3029
3030impl SessionGetFifoResponder {
3031 pub fn send(self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
3035 let _result = self.send_raw(result);
3036 if _result.is_err() {
3037 self.control_handle.shutdown();
3038 }
3039 self.drop_without_shutdown();
3040 _result
3041 }
3042
3043 pub fn send_no_shutdown_on_err(
3045 self,
3046 mut result: Result<fidl::Fifo, i32>,
3047 ) -> Result<(), fidl::Error> {
3048 let _result = self.send_raw(result);
3049 self.drop_without_shutdown();
3050 _result
3051 }
3052
3053 fn send_raw(&self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
3054 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionGetFifoResponse, i32>>(
3055 result.map(|fifo| (fifo,)),
3056 self.tx_id,
3057 0x61a31a92a206b7d5,
3058 fidl::encoding::DynamicFlags::empty(),
3059 )
3060 }
3061}
3062
3063#[must_use = "FIDL methods require a response to be sent"]
3064#[derive(Debug)]
3065pub struct SessionAttachVmoResponder {
3066 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
3067 tx_id: u32,
3068}
3069
3070impl std::ops::Drop for SessionAttachVmoResponder {
3074 fn drop(&mut self) {
3075 self.control_handle.shutdown();
3076 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3078 }
3079}
3080
3081impl fidl::endpoints::Responder for SessionAttachVmoResponder {
3082 type ControlHandle = SessionControlHandle;
3083
3084 fn control_handle(&self) -> &SessionControlHandle {
3085 &self.control_handle
3086 }
3087
3088 fn drop_without_shutdown(mut self) {
3089 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3091 std::mem::forget(self);
3093 }
3094}
3095
3096impl SessionAttachVmoResponder {
3097 pub fn send(self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
3101 let _result = self.send_raw(result);
3102 if _result.is_err() {
3103 self.control_handle.shutdown();
3104 }
3105 self.drop_without_shutdown();
3106 _result
3107 }
3108
3109 pub fn send_no_shutdown_on_err(
3111 self,
3112 mut result: Result<&VmoId, i32>,
3113 ) -> Result<(), fidl::Error> {
3114 let _result = self.send_raw(result);
3115 self.drop_without_shutdown();
3116 _result
3117 }
3118
3119 fn send_raw(&self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
3120 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionAttachVmoResponse, i32>>(
3121 result.map(|vmoid| (vmoid,)),
3122 self.tx_id,
3123 0x54edc4641d9569f5,
3124 fidl::encoding::DynamicFlags::empty(),
3125 )
3126 }
3127}
3128
3129mod internal {
3130 use super::*;
3131
3132 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionRequest {
3133 type Borrowed<'a> = &'a mut Self;
3134 fn take_or_borrow<'a>(
3135 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3136 ) -> Self::Borrowed<'a> {
3137 value
3138 }
3139 }
3140
3141 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionRequest {
3142 type Owned = Self;
3143
3144 #[inline(always)]
3145 fn inline_align(_context: fidl::encoding::Context) -> usize {
3146 4
3147 }
3148
3149 #[inline(always)]
3150 fn inline_size(_context: fidl::encoding::Context) -> usize {
3151 4
3152 }
3153 }
3154
3155 unsafe impl
3156 fidl::encoding::Encode<
3157 BlockOpenSessionRequest,
3158 fidl::encoding::DefaultFuchsiaResourceDialect,
3159 > for &mut BlockOpenSessionRequest
3160 {
3161 #[inline]
3162 unsafe fn encode(
3163 self,
3164 encoder: &mut fidl::encoding::Encoder<
3165 '_,
3166 fidl::encoding::DefaultFuchsiaResourceDialect,
3167 >,
3168 offset: usize,
3169 _depth: fidl::encoding::Depth,
3170 ) -> fidl::Result<()> {
3171 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
3172 fidl::encoding::Encode::<BlockOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3174 (
3175 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
3176 ),
3177 encoder, offset, _depth
3178 )
3179 }
3180 }
3181 unsafe impl<
3182 T0: fidl::encoding::Encode<
3183 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3184 fidl::encoding::DefaultFuchsiaResourceDialect,
3185 >,
3186 >
3187 fidl::encoding::Encode<
3188 BlockOpenSessionRequest,
3189 fidl::encoding::DefaultFuchsiaResourceDialect,
3190 > for (T0,)
3191 {
3192 #[inline]
3193 unsafe fn encode(
3194 self,
3195 encoder: &mut fidl::encoding::Encoder<
3196 '_,
3197 fidl::encoding::DefaultFuchsiaResourceDialect,
3198 >,
3199 offset: usize,
3200 depth: fidl::encoding::Depth,
3201 ) -> fidl::Result<()> {
3202 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
3203 self.0.encode(encoder, offset + 0, depth)?;
3207 Ok(())
3208 }
3209 }
3210
3211 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3212 for BlockOpenSessionRequest
3213 {
3214 #[inline(always)]
3215 fn new_empty() -> Self {
3216 Self {
3217 session: fidl::new_empty!(
3218 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3219 fidl::encoding::DefaultFuchsiaResourceDialect
3220 ),
3221 }
3222 }
3223
3224 #[inline]
3225 unsafe fn decode(
3226 &mut self,
3227 decoder: &mut fidl::encoding::Decoder<
3228 '_,
3229 fidl::encoding::DefaultFuchsiaResourceDialect,
3230 >,
3231 offset: usize,
3232 _depth: fidl::encoding::Depth,
3233 ) -> fidl::Result<()> {
3234 decoder.debug_check_bounds::<Self>(offset);
3235 fidl::decode!(
3237 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3238 fidl::encoding::DefaultFuchsiaResourceDialect,
3239 &mut self.session,
3240 decoder,
3241 offset + 0,
3242 _depth
3243 )?;
3244 Ok(())
3245 }
3246 }
3247
3248 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionWithOffsetMapRequest {
3249 type Borrowed<'a> = &'a mut Self;
3250 fn take_or_borrow<'a>(
3251 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3252 ) -> Self::Borrowed<'a> {
3253 value
3254 }
3255 }
3256
3257 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionWithOffsetMapRequest {
3258 type Owned = Self;
3259
3260 #[inline(always)]
3261 fn inline_align(_context: fidl::encoding::Context) -> usize {
3262 8
3263 }
3264
3265 #[inline(always)]
3266 fn inline_size(_context: fidl::encoding::Context) -> usize {
3267 24
3268 }
3269 }
3270
3271 unsafe impl
3272 fidl::encoding::Encode<
3273 BlockOpenSessionWithOffsetMapRequest,
3274 fidl::encoding::DefaultFuchsiaResourceDialect,
3275 > for &mut BlockOpenSessionWithOffsetMapRequest
3276 {
3277 #[inline]
3278 unsafe fn encode(
3279 self,
3280 encoder: &mut fidl::encoding::Encoder<
3281 '_,
3282 fidl::encoding::DefaultFuchsiaResourceDialect,
3283 >,
3284 offset: usize,
3285 _depth: fidl::encoding::Depth,
3286 ) -> fidl::Result<()> {
3287 encoder.debug_check_bounds::<BlockOpenSessionWithOffsetMapRequest>(offset);
3288 fidl::encoding::Encode::<BlockOpenSessionWithOffsetMapRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3290 (
3291 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
3292 <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<OffsetMapMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.offset_map),
3293 <fidl::encoding::Optional<fidl::encoding::Vector<BlockOffsetMapping, 64>> as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_mappings),
3294 ),
3295 encoder, offset, _depth
3296 )
3297 }
3298 }
3299 unsafe impl<
3300 T0: fidl::encoding::Encode<
3301 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3302 fidl::encoding::DefaultFuchsiaResourceDialect,
3303 >,
3304 T1: fidl::encoding::Encode<
3305 fidl::encoding::Optional<
3306 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
3307 >,
3308 fidl::encoding::DefaultFuchsiaResourceDialect,
3309 >,
3310 T2: fidl::encoding::Encode<
3311 fidl::encoding::Optional<fidl::encoding::Vector<BlockOffsetMapping, 64>>,
3312 fidl::encoding::DefaultFuchsiaResourceDialect,
3313 >,
3314 >
3315 fidl::encoding::Encode<
3316 BlockOpenSessionWithOffsetMapRequest,
3317 fidl::encoding::DefaultFuchsiaResourceDialect,
3318 > for (T0, T1, T2)
3319 {
3320 #[inline]
3321 unsafe fn encode(
3322 self,
3323 encoder: &mut fidl::encoding::Encoder<
3324 '_,
3325 fidl::encoding::DefaultFuchsiaResourceDialect,
3326 >,
3327 offset: usize,
3328 depth: fidl::encoding::Depth,
3329 ) -> fidl::Result<()> {
3330 encoder.debug_check_bounds::<BlockOpenSessionWithOffsetMapRequest>(offset);
3331 self.0.encode(encoder, offset + 0, depth)?;
3335 self.1.encode(encoder, offset + 4, depth)?;
3336 self.2.encode(encoder, offset + 8, depth)?;
3337 Ok(())
3338 }
3339 }
3340
3341 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3342 for BlockOpenSessionWithOffsetMapRequest
3343 {
3344 #[inline(always)]
3345 fn new_empty() -> Self {
3346 Self {
3347 session: fidl::new_empty!(
3348 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3349 fidl::encoding::DefaultFuchsiaResourceDialect
3350 ),
3351 offset_map: fidl::new_empty!(
3352 fidl::encoding::Optional<
3353 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
3354 >,
3355 fidl::encoding::DefaultFuchsiaResourceDialect
3356 ),
3357 initial_mappings: fidl::new_empty!(
3358 fidl::encoding::Optional<fidl::encoding::Vector<BlockOffsetMapping, 64>>,
3359 fidl::encoding::DefaultFuchsiaResourceDialect
3360 ),
3361 }
3362 }
3363
3364 #[inline]
3365 unsafe fn decode(
3366 &mut self,
3367 decoder: &mut fidl::encoding::Decoder<
3368 '_,
3369 fidl::encoding::DefaultFuchsiaResourceDialect,
3370 >,
3371 offset: usize,
3372 _depth: fidl::encoding::Depth,
3373 ) -> fidl::Result<()> {
3374 decoder.debug_check_bounds::<Self>(offset);
3375 fidl::decode!(
3377 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3378 fidl::encoding::DefaultFuchsiaResourceDialect,
3379 &mut self.session,
3380 decoder,
3381 offset + 0,
3382 _depth
3383 )?;
3384 fidl::decode!(
3385 fidl::encoding::Optional<
3386 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<OffsetMapMarker>>,
3387 >,
3388 fidl::encoding::DefaultFuchsiaResourceDialect,
3389 &mut self.offset_map,
3390 decoder,
3391 offset + 4,
3392 _depth
3393 )?;
3394 fidl::decode!(
3395 fidl::encoding::Optional<fidl::encoding::Vector<BlockOffsetMapping, 64>>,
3396 fidl::encoding::DefaultFuchsiaResourceDialect,
3397 &mut self.initial_mappings,
3398 decoder,
3399 offset + 8,
3400 _depth
3401 )?;
3402 Ok(())
3403 }
3404 }
3405
3406 impl fidl::encoding::ResourceTypeMarker for InspectVmoProviderGetVmoResponse {
3407 type Borrowed<'a> = &'a mut Self;
3408 fn take_or_borrow<'a>(
3409 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3410 ) -> Self::Borrowed<'a> {
3411 value
3412 }
3413 }
3414
3415 unsafe impl fidl::encoding::TypeMarker for InspectVmoProviderGetVmoResponse {
3416 type Owned = Self;
3417
3418 #[inline(always)]
3419 fn inline_align(_context: fidl::encoding::Context) -> usize {
3420 4
3421 }
3422
3423 #[inline(always)]
3424 fn inline_size(_context: fidl::encoding::Context) -> usize {
3425 4
3426 }
3427 }
3428
3429 unsafe impl
3430 fidl::encoding::Encode<
3431 InspectVmoProviderGetVmoResponse,
3432 fidl::encoding::DefaultFuchsiaResourceDialect,
3433 > for &mut InspectVmoProviderGetVmoResponse
3434 {
3435 #[inline]
3436 unsafe fn encode(
3437 self,
3438 encoder: &mut fidl::encoding::Encoder<
3439 '_,
3440 fidl::encoding::DefaultFuchsiaResourceDialect,
3441 >,
3442 offset: usize,
3443 _depth: fidl::encoding::Depth,
3444 ) -> fidl::Result<()> {
3445 encoder.debug_check_bounds::<InspectVmoProviderGetVmoResponse>(offset);
3446 fidl::encoding::Encode::<
3448 InspectVmoProviderGetVmoResponse,
3449 fidl::encoding::DefaultFuchsiaResourceDialect,
3450 >::encode(
3451 (<fidl::encoding::HandleType<
3452 fidl::Vmo,
3453 { fidl::ObjectType::VMO.into_raw() },
3454 2147483648,
3455 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3456 &mut self.vmo
3457 ),),
3458 encoder,
3459 offset,
3460 _depth,
3461 )
3462 }
3463 }
3464 unsafe impl<
3465 T0: fidl::encoding::Encode<
3466 fidl::encoding::HandleType<
3467 fidl::Vmo,
3468 { fidl::ObjectType::VMO.into_raw() },
3469 2147483648,
3470 >,
3471 fidl::encoding::DefaultFuchsiaResourceDialect,
3472 >,
3473 >
3474 fidl::encoding::Encode<
3475 InspectVmoProviderGetVmoResponse,
3476 fidl::encoding::DefaultFuchsiaResourceDialect,
3477 > for (T0,)
3478 {
3479 #[inline]
3480 unsafe fn encode(
3481 self,
3482 encoder: &mut fidl::encoding::Encoder<
3483 '_,
3484 fidl::encoding::DefaultFuchsiaResourceDialect,
3485 >,
3486 offset: usize,
3487 depth: fidl::encoding::Depth,
3488 ) -> fidl::Result<()> {
3489 encoder.debug_check_bounds::<InspectVmoProviderGetVmoResponse>(offset);
3490 self.0.encode(encoder, offset + 0, depth)?;
3494 Ok(())
3495 }
3496 }
3497
3498 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3499 for InspectVmoProviderGetVmoResponse
3500 {
3501 #[inline(always)]
3502 fn new_empty() -> Self {
3503 Self {
3504 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3505 }
3506 }
3507
3508 #[inline]
3509 unsafe fn decode(
3510 &mut self,
3511 decoder: &mut fidl::encoding::Decoder<
3512 '_,
3513 fidl::encoding::DefaultFuchsiaResourceDialect,
3514 >,
3515 offset: usize,
3516 _depth: fidl::encoding::Depth,
3517 ) -> fidl::Result<()> {
3518 decoder.debug_check_bounds::<Self>(offset);
3519 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
3521 Ok(())
3522 }
3523 }
3524
3525 impl fidl::encoding::ResourceTypeMarker for SessionAttachVmoRequest {
3526 type Borrowed<'a> = &'a mut Self;
3527 fn take_or_borrow<'a>(
3528 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3529 ) -> Self::Borrowed<'a> {
3530 value
3531 }
3532 }
3533
3534 unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoRequest {
3535 type Owned = Self;
3536
3537 #[inline(always)]
3538 fn inline_align(_context: fidl::encoding::Context) -> usize {
3539 4
3540 }
3541
3542 #[inline(always)]
3543 fn inline_size(_context: fidl::encoding::Context) -> usize {
3544 4
3545 }
3546 }
3547
3548 unsafe impl
3549 fidl::encoding::Encode<
3550 SessionAttachVmoRequest,
3551 fidl::encoding::DefaultFuchsiaResourceDialect,
3552 > for &mut SessionAttachVmoRequest
3553 {
3554 #[inline]
3555 unsafe fn encode(
3556 self,
3557 encoder: &mut fidl::encoding::Encoder<
3558 '_,
3559 fidl::encoding::DefaultFuchsiaResourceDialect,
3560 >,
3561 offset: usize,
3562 _depth: fidl::encoding::Depth,
3563 ) -> fidl::Result<()> {
3564 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
3565 fidl::encoding::Encode::<
3567 SessionAttachVmoRequest,
3568 fidl::encoding::DefaultFuchsiaResourceDialect,
3569 >::encode(
3570 (<fidl::encoding::HandleType<
3571 fidl::Vmo,
3572 { fidl::ObjectType::VMO.into_raw() },
3573 2147483648,
3574 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3575 &mut self.vmo
3576 ),),
3577 encoder,
3578 offset,
3579 _depth,
3580 )
3581 }
3582 }
3583 unsafe impl<
3584 T0: fidl::encoding::Encode<
3585 fidl::encoding::HandleType<
3586 fidl::Vmo,
3587 { fidl::ObjectType::VMO.into_raw() },
3588 2147483648,
3589 >,
3590 fidl::encoding::DefaultFuchsiaResourceDialect,
3591 >,
3592 >
3593 fidl::encoding::Encode<
3594 SessionAttachVmoRequest,
3595 fidl::encoding::DefaultFuchsiaResourceDialect,
3596 > for (T0,)
3597 {
3598 #[inline]
3599 unsafe fn encode(
3600 self,
3601 encoder: &mut fidl::encoding::Encoder<
3602 '_,
3603 fidl::encoding::DefaultFuchsiaResourceDialect,
3604 >,
3605 offset: usize,
3606 depth: fidl::encoding::Depth,
3607 ) -> fidl::Result<()> {
3608 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
3609 self.0.encode(encoder, offset + 0, depth)?;
3613 Ok(())
3614 }
3615 }
3616
3617 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3618 for SessionAttachVmoRequest
3619 {
3620 #[inline(always)]
3621 fn new_empty() -> Self {
3622 Self {
3623 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3624 }
3625 }
3626
3627 #[inline]
3628 unsafe fn decode(
3629 &mut self,
3630 decoder: &mut fidl::encoding::Decoder<
3631 '_,
3632 fidl::encoding::DefaultFuchsiaResourceDialect,
3633 >,
3634 offset: usize,
3635 _depth: fidl::encoding::Depth,
3636 ) -> fidl::Result<()> {
3637 decoder.debug_check_bounds::<Self>(offset);
3638 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
3640 Ok(())
3641 }
3642 }
3643
3644 impl fidl::encoding::ResourceTypeMarker for SessionGetFifoResponse {
3645 type Borrowed<'a> = &'a mut Self;
3646 fn take_or_borrow<'a>(
3647 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3648 ) -> Self::Borrowed<'a> {
3649 value
3650 }
3651 }
3652
3653 unsafe impl fidl::encoding::TypeMarker for SessionGetFifoResponse {
3654 type Owned = Self;
3655
3656 #[inline(always)]
3657 fn inline_align(_context: fidl::encoding::Context) -> usize {
3658 4
3659 }
3660
3661 #[inline(always)]
3662 fn inline_size(_context: fidl::encoding::Context) -> usize {
3663 4
3664 }
3665 }
3666
3667 unsafe impl
3668 fidl::encoding::Encode<
3669 SessionGetFifoResponse,
3670 fidl::encoding::DefaultFuchsiaResourceDialect,
3671 > for &mut SessionGetFifoResponse
3672 {
3673 #[inline]
3674 unsafe fn encode(
3675 self,
3676 encoder: &mut fidl::encoding::Encoder<
3677 '_,
3678 fidl::encoding::DefaultFuchsiaResourceDialect,
3679 >,
3680 offset: usize,
3681 _depth: fidl::encoding::Depth,
3682 ) -> fidl::Result<()> {
3683 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
3684 fidl::encoding::Encode::<
3686 SessionGetFifoResponse,
3687 fidl::encoding::DefaultFuchsiaResourceDialect,
3688 >::encode(
3689 (<fidl::encoding::HandleType<
3690 fidl::Fifo,
3691 { fidl::ObjectType::FIFO.into_raw() },
3692 2147483648,
3693 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3694 &mut self.fifo
3695 ),),
3696 encoder,
3697 offset,
3698 _depth,
3699 )
3700 }
3701 }
3702 unsafe impl<
3703 T0: fidl::encoding::Encode<
3704 fidl::encoding::HandleType<
3705 fidl::Fifo,
3706 { fidl::ObjectType::FIFO.into_raw() },
3707 2147483648,
3708 >,
3709 fidl::encoding::DefaultFuchsiaResourceDialect,
3710 >,
3711 >
3712 fidl::encoding::Encode<
3713 SessionGetFifoResponse,
3714 fidl::encoding::DefaultFuchsiaResourceDialect,
3715 > for (T0,)
3716 {
3717 #[inline]
3718 unsafe fn encode(
3719 self,
3720 encoder: &mut fidl::encoding::Encoder<
3721 '_,
3722 fidl::encoding::DefaultFuchsiaResourceDialect,
3723 >,
3724 offset: usize,
3725 depth: fidl::encoding::Depth,
3726 ) -> fidl::Result<()> {
3727 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
3728 self.0.encode(encoder, offset + 0, depth)?;
3732 Ok(())
3733 }
3734 }
3735
3736 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3737 for SessionGetFifoResponse
3738 {
3739 #[inline(always)]
3740 fn new_empty() -> Self {
3741 Self {
3742 fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3743 }
3744 }
3745
3746 #[inline]
3747 unsafe fn decode(
3748 &mut self,
3749 decoder: &mut fidl::encoding::Decoder<
3750 '_,
3751 fidl::encoding::DefaultFuchsiaResourceDialect,
3752 >,
3753 offset: usize,
3754 _depth: fidl::encoding::Depth,
3755 ) -> fidl::Result<()> {
3756 decoder.debug_check_bounds::<Self>(offset);
3757 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fifo, decoder, offset + 0, _depth)?;
3759 Ok(())
3760 }
3761 }
3762}