1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_storage_block_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct BlockConnectMapperRequest {
16 pub server_end: fidl::endpoints::ServerEnd<MapperMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockConnectMapperRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct BlockOpenSessionRequest {
23 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockOpenSessionRequest {}
27
28#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct BlockOpenSessionWithOptionsRequest {
30 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
31 pub mappings: Vec<BlockOffsetMapping>,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
35 for BlockOpenSessionWithOptionsRequest
36{
37}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct MapperOpenSessionRequest {
41 pub session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
42 pub mapping_vmo: fidl::Vmo,
44 pub port: Option<fidl::Port>,
46 pub delivery_queue: Option<fidl::Vmo>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MapperOpenSessionRequest {}
51
52#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
53pub struct MapperSessionOpenChildSessionRequest {
54 pub session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
55 pub mapping_vmo: fidl::Vmo,
57 pub parent_key: u64,
59 pub port: Option<fidl::Port>,
61 pub delivery_queue: Option<fidl::Vmo>,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66 for MapperSessionOpenChildSessionRequest
67{
68}
69
70#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71pub struct MapperSessionCreateVmoResponse {
72 pub vmo: fidl::Vmo,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
76 for MapperSessionCreateVmoResponse
77{
78}
79
80#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81pub struct SessionAttachVmoRequest {
82 pub vmo: fidl::Vmo,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionAttachVmoRequest {}
86
87#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct SessionGetFifoResponse {
89 pub fifo: fidl::Fifo,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionGetFifoResponse {}
93
94#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
95pub struct BlockMarker;
96
97impl fidl::endpoints::ProtocolMarker for BlockMarker {
98 type Proxy = BlockProxy;
99 type RequestStream = BlockRequestStream;
100 #[cfg(target_os = "fuchsia")]
101 type SynchronousProxy = BlockSynchronousProxy;
102
103 const DEBUG_NAME: &'static str = "fuchsia.storage.block.Block";
104}
105impl fidl::endpoints::DiscoverableProtocolMarker for BlockMarker {}
106pub type BlockGetInfoResult = Result<BlockInfo, i32>;
107pub type BlockConnectMapperResult = Result<(), i32>;
108pub type BlockGetMetadataResult = Result<PartitionInfo, i32>;
109
110pub trait BlockProxyInterface: Send + Sync {
111 type GetInfoResponseFut: std::future::Future<Output = Result<BlockGetInfoResult, fidl::Error>>
112 + Send;
113 fn r#get_info(&self) -> Self::GetInfoResponseFut;
114 fn r#open_session(
115 &self,
116 session: fidl::endpoints::ServerEnd<SessionMarker>,
117 ) -> Result<(), fidl::Error>;
118 fn r#open_session_with_options(
119 &self,
120 session: fidl::endpoints::ServerEnd<SessionMarker>,
121 mappings: &[BlockOffsetMapping],
122 ) -> Result<(), fidl::Error>;
123 type ConnectMapperResponseFut: std::future::Future<Output = Result<BlockConnectMapperResult, fidl::Error>>
124 + Send;
125 fn r#connect_mapper(
126 &self,
127 server_end: fidl::endpoints::ServerEnd<MapperMarker>,
128 ) -> Self::ConnectMapperResponseFut;
129 type GetTypeGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
130 + Send;
131 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
132 type GetInstanceGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
133 + Send;
134 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
135 type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
136 + Send;
137 fn r#get_name(&self) -> Self::GetNameResponseFut;
138 type GetMetadataResponseFut: std::future::Future<Output = Result<BlockGetMetadataResult, fidl::Error>>
139 + Send;
140 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
141 type QuerySlicesResponseFut: std::future::Future<Output = Result<(i32, [VsliceRange; 16], u64), fidl::Error>>
142 + Send;
143 fn r#query_slices(&self, start_slices: &[u64]) -> Self::QuerySlicesResponseFut;
144 type GetVolumeInfoResponseFut: std::future::Future<
145 Output = Result<
146 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
147 fidl::Error,
148 >,
149 > + Send;
150 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut;
151 type ExtendResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
152 fn r#extend(&self, start_slice: u64, slice_count: u64) -> Self::ExtendResponseFut;
153 type ShrinkResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
154 fn r#shrink(&self, start_slice: u64, slice_count: u64) -> Self::ShrinkResponseFut;
155 type DestroyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
156 fn r#destroy(&self) -> Self::DestroyResponseFut;
157}
158#[derive(Debug)]
159#[cfg(target_os = "fuchsia")]
160pub struct BlockSynchronousProxy {
161 client: fidl::client::sync::Client,
162}
163
164#[cfg(target_os = "fuchsia")]
165impl fidl::endpoints::SynchronousProxy for BlockSynchronousProxy {
166 type Proxy = BlockProxy;
167 type Protocol = BlockMarker;
168
169 fn from_channel(inner: fidl::Channel) -> Self {
170 Self::new(inner)
171 }
172
173 fn into_channel(self) -> fidl::Channel {
174 self.client.into_channel()
175 }
176
177 fn as_channel(&self) -> &fidl::Channel {
178 self.client.as_channel()
179 }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl BlockSynchronousProxy {
184 pub fn new(channel: fidl::Channel) -> Self {
185 Self { client: fidl::client::sync::Client::new(channel) }
186 }
187
188 pub fn into_channel(self) -> fidl::Channel {
189 self.client.into_channel()
190 }
191
192 pub fn wait_for_event(
195 &self,
196 deadline: zx::MonotonicInstant,
197 ) -> Result<BlockEvent, fidl::Error> {
198 BlockEvent::decode(self.client.wait_for_event::<BlockMarker>(deadline)?)
199 }
200
201 pub fn r#get_info(
203 &self,
204 ___deadline: zx::MonotonicInstant,
205 ) -> Result<BlockGetInfoResult, fidl::Error> {
206 let _response = self.client.send_query::<
207 fidl::encoding::EmptyPayload,
208 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
209 BlockMarker,
210 >(
211 (),
212 0x58777a4a31cc9a47,
213 fidl::encoding::DynamicFlags::empty(),
214 ___deadline,
215 )?;
216 Ok(_response.map(|x| x.info))
217 }
218
219 pub fn r#open_session(
221 &self,
222 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
223 ) -> Result<(), fidl::Error> {
224 self.client.send::<BlockOpenSessionRequest>(
225 (session,),
226 0x2ca32f8c64f1d6c8,
227 fidl::encoding::DynamicFlags::empty(),
228 )
229 }
230
231 pub fn r#open_session_with_options(
252 &self,
253 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
254 mut mappings: &[BlockOffsetMapping],
255 ) -> Result<(), fidl::Error> {
256 self.client.send::<BlockOpenSessionWithOptionsRequest>(
257 (session, mappings),
258 0x1974e5f7b9de6f0c,
259 fidl::encoding::DynamicFlags::empty(),
260 )
261 }
262
263 pub fn r#connect_mapper(
271 &self,
272 mut server_end: fidl::endpoints::ServerEnd<MapperMarker>,
273 ___deadline: zx::MonotonicInstant,
274 ) -> Result<BlockConnectMapperResult, fidl::Error> {
275 let _response = self.client.send_query::<
276 BlockConnectMapperRequest,
277 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
278 BlockMarker,
279 >(
280 (server_end,),
281 0xa38a3fbbe3412c3,
282 fidl::encoding::DynamicFlags::empty(),
283 ___deadline,
284 )?;
285 Ok(_response.map(|x| x))
286 }
287
288 pub fn r#get_type_guid(
291 &self,
292 ___deadline: zx::MonotonicInstant,
293 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
294 let _response = self
295 .client
296 .send_query::<fidl::encoding::EmptyPayload, BlockGetTypeGuidResponse, BlockMarker>(
297 (),
298 0xefe4e41dafce4cc,
299 fidl::encoding::DynamicFlags::empty(),
300 ___deadline,
301 )?;
302 Ok((_response.status, _response.guid))
303 }
304
305 pub fn r#get_instance_guid(
308 &self,
309 ___deadline: zx::MonotonicInstant,
310 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
311 let _response = self
312 .client
313 .send_query::<fidl::encoding::EmptyPayload, BlockGetInstanceGuidResponse, BlockMarker>(
314 (),
315 0x2e85011aabeb87fb,
316 fidl::encoding::DynamicFlags::empty(),
317 ___deadline,
318 )?;
319 Ok((_response.status, _response.guid))
320 }
321
322 pub fn r#get_name(
325 &self,
326 ___deadline: zx::MonotonicInstant,
327 ) -> Result<(i32, Option<String>), fidl::Error> {
328 let _response = self
329 .client
330 .send_query::<fidl::encoding::EmptyPayload, BlockGetNameResponse, BlockMarker>(
331 (),
332 0x630be18badedbb05,
333 fidl::encoding::DynamicFlags::empty(),
334 ___deadline,
335 )?;
336 Ok((_response.status, _response.name))
337 }
338
339 pub fn r#get_metadata(
343 &self,
344 ___deadline: zx::MonotonicInstant,
345 ) -> Result<BlockGetMetadataResult, fidl::Error> {
346 let _response = self.client.send_query::<
347 fidl::encoding::EmptyPayload,
348 fidl::encoding::ResultType<PartitionInfo, i32>,
349 BlockMarker,
350 >(
351 (),
352 0x2c76b02ef9382533,
353 fidl::encoding::DynamicFlags::empty(),
354 ___deadline,
355 )?;
356 Ok(_response.map(|x| x))
357 }
358
359 pub fn r#query_slices(
364 &self,
365 mut start_slices: &[u64],
366 ___deadline: zx::MonotonicInstant,
367 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
368 let _response = self
369 .client
370 .send_query::<BlockQuerySlicesRequest, BlockQuerySlicesResponse, BlockMarker>(
371 (start_slices,),
372 0x289240ac4fbaa190,
373 fidl::encoding::DynamicFlags::empty(),
374 ___deadline,
375 )?;
376 Ok((_response.status, _response.response, _response.response_count))
377 }
378
379 pub fn r#get_volume_info(
383 &self,
384 ___deadline: zx::MonotonicInstant,
385 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error> {
386 let _response = self
387 .client
388 .send_query::<fidl::encoding::EmptyPayload, BlockGetVolumeInfoResponse, BlockMarker>(
389 (),
390 0x3a7dc69ea5d788d4,
391 fidl::encoding::DynamicFlags::empty(),
392 ___deadline,
393 )?;
394 Ok((_response.status, _response.manager, _response.volume))
395 }
396
397 pub fn r#extend(
405 &self,
406 mut start_slice: u64,
407 mut slice_count: u64,
408 ___deadline: zx::MonotonicInstant,
409 ) -> Result<i32, fidl::Error> {
410 let _response =
411 self.client.send_query::<BlockExtendRequest, BlockExtendResponse, BlockMarker>(
412 (start_slice, slice_count),
413 0x273fb2980ff24157,
414 fidl::encoding::DynamicFlags::empty(),
415 ___deadline,
416 )?;
417 Ok(_response.status)
418 }
419
420 pub fn r#shrink(
425 &self,
426 mut start_slice: u64,
427 mut slice_count: u64,
428 ___deadline: zx::MonotonicInstant,
429 ) -> Result<i32, fidl::Error> {
430 let _response =
431 self.client.send_query::<BlockShrinkRequest, BlockShrinkResponse, BlockMarker>(
432 (start_slice, slice_count),
433 0x73da6de865600a8b,
434 fidl::encoding::DynamicFlags::empty(),
435 ___deadline,
436 )?;
437 Ok(_response.status)
438 }
439
440 pub fn r#destroy(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
445 let _response = self
446 .client
447 .send_query::<fidl::encoding::EmptyPayload, BlockDestroyResponse, BlockMarker>(
448 (),
449 0x5866ba764e05a68e,
450 fidl::encoding::DynamicFlags::empty(),
451 ___deadline,
452 )?;
453 Ok(_response.status)
454 }
455}
456
457#[cfg(target_os = "fuchsia")]
458impl From<BlockSynchronousProxy> for zx::NullableHandle {
459 fn from(value: BlockSynchronousProxy) -> Self {
460 value.into_channel().into()
461 }
462}
463
464#[cfg(target_os = "fuchsia")]
465impl From<fidl::Channel> for BlockSynchronousProxy {
466 fn from(value: fidl::Channel) -> Self {
467 Self::new(value)
468 }
469}
470
471#[cfg(target_os = "fuchsia")]
472impl fidl::endpoints::FromClient for BlockSynchronousProxy {
473 type Protocol = BlockMarker;
474
475 fn from_client(value: fidl::endpoints::ClientEnd<BlockMarker>) -> Self {
476 Self::new(value.into_channel())
477 }
478}
479
480#[derive(Debug, Clone)]
481pub struct BlockProxy {
482 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
483}
484
485impl fidl::endpoints::Proxy for BlockProxy {
486 type Protocol = BlockMarker;
487
488 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
489 Self::new(inner)
490 }
491
492 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
493 self.client.into_channel().map_err(|client| Self { client })
494 }
495
496 fn as_channel(&self) -> &::fidl::AsyncChannel {
497 self.client.as_channel()
498 }
499}
500
501impl BlockProxy {
502 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
504 let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
505 Self { client: fidl::client::Client::new(channel, protocol_name) }
506 }
507
508 pub fn take_event_stream(&self) -> BlockEventStream {
514 BlockEventStream { event_receiver: self.client.take_event_receiver() }
515 }
516
517 pub fn r#get_info(
519 &self,
520 ) -> fidl::client::QueryResponseFut<
521 BlockGetInfoResult,
522 fidl::encoding::DefaultFuchsiaResourceDialect,
523 > {
524 BlockProxyInterface::r#get_info(self)
525 }
526
527 pub fn r#open_session(
529 &self,
530 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
531 ) -> Result<(), fidl::Error> {
532 BlockProxyInterface::r#open_session(self, session)
533 }
534
535 pub fn r#open_session_with_options(
556 &self,
557 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
558 mut mappings: &[BlockOffsetMapping],
559 ) -> Result<(), fidl::Error> {
560 BlockProxyInterface::r#open_session_with_options(self, session, mappings)
561 }
562
563 pub fn r#connect_mapper(
571 &self,
572 mut server_end: fidl::endpoints::ServerEnd<MapperMarker>,
573 ) -> fidl::client::QueryResponseFut<
574 BlockConnectMapperResult,
575 fidl::encoding::DefaultFuchsiaResourceDialect,
576 > {
577 BlockProxyInterface::r#connect_mapper(self, server_end)
578 }
579
580 pub fn r#get_type_guid(
583 &self,
584 ) -> fidl::client::QueryResponseFut<
585 (i32, Option<Box<Guid>>),
586 fidl::encoding::DefaultFuchsiaResourceDialect,
587 > {
588 BlockProxyInterface::r#get_type_guid(self)
589 }
590
591 pub fn r#get_instance_guid(
594 &self,
595 ) -> fidl::client::QueryResponseFut<
596 (i32, Option<Box<Guid>>),
597 fidl::encoding::DefaultFuchsiaResourceDialect,
598 > {
599 BlockProxyInterface::r#get_instance_guid(self)
600 }
601
602 pub fn r#get_name(
605 &self,
606 ) -> fidl::client::QueryResponseFut<
607 (i32, Option<String>),
608 fidl::encoding::DefaultFuchsiaResourceDialect,
609 > {
610 BlockProxyInterface::r#get_name(self)
611 }
612
613 pub fn r#get_metadata(
617 &self,
618 ) -> fidl::client::QueryResponseFut<
619 BlockGetMetadataResult,
620 fidl::encoding::DefaultFuchsiaResourceDialect,
621 > {
622 BlockProxyInterface::r#get_metadata(self)
623 }
624
625 pub fn r#query_slices(
630 &self,
631 mut start_slices: &[u64],
632 ) -> fidl::client::QueryResponseFut<
633 (i32, [VsliceRange; 16], u64),
634 fidl::encoding::DefaultFuchsiaResourceDialect,
635 > {
636 BlockProxyInterface::r#query_slices(self, start_slices)
637 }
638
639 pub fn r#get_volume_info(
643 &self,
644 ) -> fidl::client::QueryResponseFut<
645 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
646 fidl::encoding::DefaultFuchsiaResourceDialect,
647 > {
648 BlockProxyInterface::r#get_volume_info(self)
649 }
650
651 pub fn r#extend(
659 &self,
660 mut start_slice: u64,
661 mut slice_count: u64,
662 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
663 BlockProxyInterface::r#extend(self, start_slice, slice_count)
664 }
665
666 pub fn r#shrink(
671 &self,
672 mut start_slice: u64,
673 mut slice_count: u64,
674 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
675 BlockProxyInterface::r#shrink(self, start_slice, slice_count)
676 }
677
678 pub fn r#destroy(
683 &self,
684 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
685 BlockProxyInterface::r#destroy(self)
686 }
687}
688
689impl BlockProxyInterface for BlockProxy {
690 type GetInfoResponseFut = fidl::client::QueryResponseFut<
691 BlockGetInfoResult,
692 fidl::encoding::DefaultFuchsiaResourceDialect,
693 >;
694 fn r#get_info(&self) -> Self::GetInfoResponseFut {
695 fn _decode(
696 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
697 ) -> Result<BlockGetInfoResult, fidl::Error> {
698 let _response = fidl::client::decode_transaction_body::<
699 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
700 fidl::encoding::DefaultFuchsiaResourceDialect,
701 0x58777a4a31cc9a47,
702 >(_buf?)?;
703 Ok(_response.map(|x| x.info))
704 }
705 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetInfoResult>(
706 (),
707 0x58777a4a31cc9a47,
708 fidl::encoding::DynamicFlags::empty(),
709 _decode,
710 )
711 }
712
713 fn r#open_session(
714 &self,
715 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
716 ) -> Result<(), fidl::Error> {
717 self.client.send::<BlockOpenSessionRequest>(
718 (session,),
719 0x2ca32f8c64f1d6c8,
720 fidl::encoding::DynamicFlags::empty(),
721 )
722 }
723
724 fn r#open_session_with_options(
725 &self,
726 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
727 mut mappings: &[BlockOffsetMapping],
728 ) -> Result<(), fidl::Error> {
729 self.client.send::<BlockOpenSessionWithOptionsRequest>(
730 (session, mappings),
731 0x1974e5f7b9de6f0c,
732 fidl::encoding::DynamicFlags::empty(),
733 )
734 }
735
736 type ConnectMapperResponseFut = fidl::client::QueryResponseFut<
737 BlockConnectMapperResult,
738 fidl::encoding::DefaultFuchsiaResourceDialect,
739 >;
740 fn r#connect_mapper(
741 &self,
742 mut server_end: fidl::endpoints::ServerEnd<MapperMarker>,
743 ) -> Self::ConnectMapperResponseFut {
744 fn _decode(
745 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
746 ) -> Result<BlockConnectMapperResult, fidl::Error> {
747 let _response = fidl::client::decode_transaction_body::<
748 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
749 fidl::encoding::DefaultFuchsiaResourceDialect,
750 0xa38a3fbbe3412c3,
751 >(_buf?)?;
752 Ok(_response.map(|x| x))
753 }
754 self.client.send_query_and_decode::<BlockConnectMapperRequest, BlockConnectMapperResult>(
755 (server_end,),
756 0xa38a3fbbe3412c3,
757 fidl::encoding::DynamicFlags::empty(),
758 _decode,
759 )
760 }
761
762 type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
763 (i32, Option<Box<Guid>>),
764 fidl::encoding::DefaultFuchsiaResourceDialect,
765 >;
766 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
767 fn _decode(
768 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
769 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
770 let _response = fidl::client::decode_transaction_body::<
771 BlockGetTypeGuidResponse,
772 fidl::encoding::DefaultFuchsiaResourceDialect,
773 0xefe4e41dafce4cc,
774 >(_buf?)?;
775 Ok((_response.status, _response.guid))
776 }
777 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
778 (),
779 0xefe4e41dafce4cc,
780 fidl::encoding::DynamicFlags::empty(),
781 _decode,
782 )
783 }
784
785 type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
786 (i32, Option<Box<Guid>>),
787 fidl::encoding::DefaultFuchsiaResourceDialect,
788 >;
789 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
790 fn _decode(
791 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
792 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
793 let _response = fidl::client::decode_transaction_body::<
794 BlockGetInstanceGuidResponse,
795 fidl::encoding::DefaultFuchsiaResourceDialect,
796 0x2e85011aabeb87fb,
797 >(_buf?)?;
798 Ok((_response.status, _response.guid))
799 }
800 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
801 (),
802 0x2e85011aabeb87fb,
803 fidl::encoding::DynamicFlags::empty(),
804 _decode,
805 )
806 }
807
808 type GetNameResponseFut = fidl::client::QueryResponseFut<
809 (i32, Option<String>),
810 fidl::encoding::DefaultFuchsiaResourceDialect,
811 >;
812 fn r#get_name(&self) -> Self::GetNameResponseFut {
813 fn _decode(
814 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
815 ) -> Result<(i32, Option<String>), fidl::Error> {
816 let _response = fidl::client::decode_transaction_body::<
817 BlockGetNameResponse,
818 fidl::encoding::DefaultFuchsiaResourceDialect,
819 0x630be18badedbb05,
820 >(_buf?)?;
821 Ok((_response.status, _response.name))
822 }
823 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
824 (),
825 0x630be18badedbb05,
826 fidl::encoding::DynamicFlags::empty(),
827 _decode,
828 )
829 }
830
831 type GetMetadataResponseFut = fidl::client::QueryResponseFut<
832 BlockGetMetadataResult,
833 fidl::encoding::DefaultFuchsiaResourceDialect,
834 >;
835 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
836 fn _decode(
837 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
838 ) -> Result<BlockGetMetadataResult, fidl::Error> {
839 let _response = fidl::client::decode_transaction_body::<
840 fidl::encoding::ResultType<PartitionInfo, i32>,
841 fidl::encoding::DefaultFuchsiaResourceDialect,
842 0x2c76b02ef9382533,
843 >(_buf?)?;
844 Ok(_response.map(|x| x))
845 }
846 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetMetadataResult>(
847 (),
848 0x2c76b02ef9382533,
849 fidl::encoding::DynamicFlags::empty(),
850 _decode,
851 )
852 }
853
854 type QuerySlicesResponseFut = fidl::client::QueryResponseFut<
855 (i32, [VsliceRange; 16], u64),
856 fidl::encoding::DefaultFuchsiaResourceDialect,
857 >;
858 fn r#query_slices(&self, mut start_slices: &[u64]) -> Self::QuerySlicesResponseFut {
859 fn _decode(
860 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
861 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
862 let _response = fidl::client::decode_transaction_body::<
863 BlockQuerySlicesResponse,
864 fidl::encoding::DefaultFuchsiaResourceDialect,
865 0x289240ac4fbaa190,
866 >(_buf?)?;
867 Ok((_response.status, _response.response, _response.response_count))
868 }
869 self.client.send_query_and_decode::<BlockQuerySlicesRequest, (i32, [VsliceRange; 16], u64)>(
870 (start_slices,),
871 0x289240ac4fbaa190,
872 fidl::encoding::DynamicFlags::empty(),
873 _decode,
874 )
875 }
876
877 type GetVolumeInfoResponseFut = fidl::client::QueryResponseFut<
878 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
879 fidl::encoding::DefaultFuchsiaResourceDialect,
880 >;
881 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut {
882 fn _decode(
883 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
884 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error>
885 {
886 let _response = fidl::client::decode_transaction_body::<
887 BlockGetVolumeInfoResponse,
888 fidl::encoding::DefaultFuchsiaResourceDialect,
889 0x3a7dc69ea5d788d4,
890 >(_buf?)?;
891 Ok((_response.status, _response.manager, _response.volume))
892 }
893 self.client.send_query_and_decode::<
894 fidl::encoding::EmptyPayload,
895 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
896 >(
897 (),
898 0x3a7dc69ea5d788d4,
899 fidl::encoding::DynamicFlags::empty(),
900 _decode,
901 )
902 }
903
904 type ExtendResponseFut =
905 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
906 fn r#extend(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ExtendResponseFut {
907 fn _decode(
908 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
909 ) -> Result<i32, fidl::Error> {
910 let _response = fidl::client::decode_transaction_body::<
911 BlockExtendResponse,
912 fidl::encoding::DefaultFuchsiaResourceDialect,
913 0x273fb2980ff24157,
914 >(_buf?)?;
915 Ok(_response.status)
916 }
917 self.client.send_query_and_decode::<BlockExtendRequest, i32>(
918 (start_slice, slice_count),
919 0x273fb2980ff24157,
920 fidl::encoding::DynamicFlags::empty(),
921 _decode,
922 )
923 }
924
925 type ShrinkResponseFut =
926 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
927 fn r#shrink(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ShrinkResponseFut {
928 fn _decode(
929 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
930 ) -> Result<i32, fidl::Error> {
931 let _response = fidl::client::decode_transaction_body::<
932 BlockShrinkResponse,
933 fidl::encoding::DefaultFuchsiaResourceDialect,
934 0x73da6de865600a8b,
935 >(_buf?)?;
936 Ok(_response.status)
937 }
938 self.client.send_query_and_decode::<BlockShrinkRequest, i32>(
939 (start_slice, slice_count),
940 0x73da6de865600a8b,
941 fidl::encoding::DynamicFlags::empty(),
942 _decode,
943 )
944 }
945
946 type DestroyResponseFut =
947 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
948 fn r#destroy(&self) -> Self::DestroyResponseFut {
949 fn _decode(
950 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
951 ) -> Result<i32, fidl::Error> {
952 let _response = fidl::client::decode_transaction_body::<
953 BlockDestroyResponse,
954 fidl::encoding::DefaultFuchsiaResourceDialect,
955 0x5866ba764e05a68e,
956 >(_buf?)?;
957 Ok(_response.status)
958 }
959 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
960 (),
961 0x5866ba764e05a68e,
962 fidl::encoding::DynamicFlags::empty(),
963 _decode,
964 )
965 }
966}
967
968pub struct BlockEventStream {
969 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
970}
971
972impl std::marker::Unpin for BlockEventStream {}
973
974impl futures::stream::FusedStream for BlockEventStream {
975 fn is_terminated(&self) -> bool {
976 self.event_receiver.is_terminated()
977 }
978}
979
980impl futures::Stream for BlockEventStream {
981 type Item = Result<BlockEvent, fidl::Error>;
982
983 fn poll_next(
984 mut self: std::pin::Pin<&mut Self>,
985 cx: &mut std::task::Context<'_>,
986 ) -> std::task::Poll<Option<Self::Item>> {
987 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
988 &mut self.event_receiver,
989 cx
990 )?) {
991 Some(buf) => std::task::Poll::Ready(Some(BlockEvent::decode(buf))),
992 None => std::task::Poll::Ready(None),
993 }
994 }
995}
996
997#[derive(Debug)]
998pub enum BlockEvent {}
999
1000impl BlockEvent {
1001 fn decode(
1003 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1004 ) -> Result<BlockEvent, fidl::Error> {
1005 let (bytes, _handles) = buf.split_mut();
1006 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1007 debug_assert_eq!(tx_header.tx_id, 0);
1008 match tx_header.ordinal {
1009 _ => Err(fidl::Error::UnknownOrdinal {
1010 ordinal: tx_header.ordinal,
1011 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1012 }),
1013 }
1014 }
1015}
1016
1017pub struct BlockRequestStream {
1019 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1020 is_terminated: bool,
1021}
1022
1023impl std::marker::Unpin for BlockRequestStream {}
1024
1025impl futures::stream::FusedStream for BlockRequestStream {
1026 fn is_terminated(&self) -> bool {
1027 self.is_terminated
1028 }
1029}
1030
1031impl fidl::endpoints::RequestStream for BlockRequestStream {
1032 type Protocol = BlockMarker;
1033 type ControlHandle = BlockControlHandle;
1034
1035 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1036 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1037 }
1038
1039 fn control_handle(&self) -> Self::ControlHandle {
1040 BlockControlHandle { inner: self.inner.clone() }
1041 }
1042
1043 fn into_inner(
1044 self,
1045 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1046 {
1047 (self.inner, self.is_terminated)
1048 }
1049
1050 fn from_inner(
1051 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1052 is_terminated: bool,
1053 ) -> Self {
1054 Self { inner, is_terminated }
1055 }
1056}
1057
1058impl futures::Stream for BlockRequestStream {
1059 type Item = Result<BlockRequest, fidl::Error>;
1060
1061 fn poll_next(
1062 mut self: std::pin::Pin<&mut Self>,
1063 cx: &mut std::task::Context<'_>,
1064 ) -> std::task::Poll<Option<Self::Item>> {
1065 let this = &mut *self;
1066 if this.inner.check_shutdown(cx) {
1067 this.is_terminated = true;
1068 return std::task::Poll::Ready(None);
1069 }
1070 if this.is_terminated {
1071 panic!("polled BlockRequestStream after completion");
1072 }
1073 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1074 |bytes, handles| {
1075 match this.inner.channel().read_etc(cx, bytes, handles) {
1076 std::task::Poll::Ready(Ok(())) => {}
1077 std::task::Poll::Pending => return std::task::Poll::Pending,
1078 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1079 this.is_terminated = true;
1080 return std::task::Poll::Ready(None);
1081 }
1082 std::task::Poll::Ready(Err(e)) => {
1083 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1084 e.into(),
1085 ))));
1086 }
1087 }
1088
1089 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1091
1092 std::task::Poll::Ready(Some(match header.ordinal {
1093 0x58777a4a31cc9a47 => {
1094 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1095 let mut req = fidl::new_empty!(
1096 fidl::encoding::EmptyPayload,
1097 fidl::encoding::DefaultFuchsiaResourceDialect
1098 );
1099 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1100 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1101 Ok(BlockRequest::GetInfo {
1102 responder: BlockGetInfoResponder {
1103 control_handle: std::mem::ManuallyDrop::new(control_handle),
1104 tx_id: header.tx_id,
1105 },
1106 })
1107 }
1108 0x2ca32f8c64f1d6c8 => {
1109 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1110 let mut req = fidl::new_empty!(
1111 BlockOpenSessionRequest,
1112 fidl::encoding::DefaultFuchsiaResourceDialect
1113 );
1114 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1115 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1116 Ok(BlockRequest::OpenSession { session: req.session, control_handle })
1117 }
1118 0x1974e5f7b9de6f0c => {
1119 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1120 let mut req = fidl::new_empty!(
1121 BlockOpenSessionWithOptionsRequest,
1122 fidl::encoding::DefaultFuchsiaResourceDialect
1123 );
1124 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionWithOptionsRequest>(&header, _body_bytes, handles, &mut req)?;
1125 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1126 Ok(BlockRequest::OpenSessionWithOptions {
1127 session: req.session,
1128 mappings: req.mappings,
1129
1130 control_handle,
1131 })
1132 }
1133 0xa38a3fbbe3412c3 => {
1134 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1135 let mut req = fidl::new_empty!(
1136 BlockConnectMapperRequest,
1137 fidl::encoding::DefaultFuchsiaResourceDialect
1138 );
1139 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockConnectMapperRequest>(&header, _body_bytes, handles, &mut req)?;
1140 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1141 Ok(BlockRequest::ConnectMapper {
1142 server_end: req.server_end,
1143
1144 responder: BlockConnectMapperResponder {
1145 control_handle: std::mem::ManuallyDrop::new(control_handle),
1146 tx_id: header.tx_id,
1147 },
1148 })
1149 }
1150 0xefe4e41dafce4cc => {
1151 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1152 let mut req = fidl::new_empty!(
1153 fidl::encoding::EmptyPayload,
1154 fidl::encoding::DefaultFuchsiaResourceDialect
1155 );
1156 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1157 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1158 Ok(BlockRequest::GetTypeGuid {
1159 responder: BlockGetTypeGuidResponder {
1160 control_handle: std::mem::ManuallyDrop::new(control_handle),
1161 tx_id: header.tx_id,
1162 },
1163 })
1164 }
1165 0x2e85011aabeb87fb => {
1166 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1167 let mut req = fidl::new_empty!(
1168 fidl::encoding::EmptyPayload,
1169 fidl::encoding::DefaultFuchsiaResourceDialect
1170 );
1171 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1172 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1173 Ok(BlockRequest::GetInstanceGuid {
1174 responder: BlockGetInstanceGuidResponder {
1175 control_handle: std::mem::ManuallyDrop::new(control_handle),
1176 tx_id: header.tx_id,
1177 },
1178 })
1179 }
1180 0x630be18badedbb05 => {
1181 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1182 let mut req = fidl::new_empty!(
1183 fidl::encoding::EmptyPayload,
1184 fidl::encoding::DefaultFuchsiaResourceDialect
1185 );
1186 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1187 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1188 Ok(BlockRequest::GetName {
1189 responder: BlockGetNameResponder {
1190 control_handle: std::mem::ManuallyDrop::new(control_handle),
1191 tx_id: header.tx_id,
1192 },
1193 })
1194 }
1195 0x2c76b02ef9382533 => {
1196 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1197 let mut req = fidl::new_empty!(
1198 fidl::encoding::EmptyPayload,
1199 fidl::encoding::DefaultFuchsiaResourceDialect
1200 );
1201 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1202 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1203 Ok(BlockRequest::GetMetadata {
1204 responder: BlockGetMetadataResponder {
1205 control_handle: std::mem::ManuallyDrop::new(control_handle),
1206 tx_id: header.tx_id,
1207 },
1208 })
1209 }
1210 0x289240ac4fbaa190 => {
1211 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1212 let mut req = fidl::new_empty!(
1213 BlockQuerySlicesRequest,
1214 fidl::encoding::DefaultFuchsiaResourceDialect
1215 );
1216 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockQuerySlicesRequest>(&header, _body_bytes, handles, &mut req)?;
1217 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1218 Ok(BlockRequest::QuerySlices {
1219 start_slices: req.start_slices,
1220
1221 responder: BlockQuerySlicesResponder {
1222 control_handle: std::mem::ManuallyDrop::new(control_handle),
1223 tx_id: header.tx_id,
1224 },
1225 })
1226 }
1227 0x3a7dc69ea5d788d4 => {
1228 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1229 let mut req = fidl::new_empty!(
1230 fidl::encoding::EmptyPayload,
1231 fidl::encoding::DefaultFuchsiaResourceDialect
1232 );
1233 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1234 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1235 Ok(BlockRequest::GetVolumeInfo {
1236 responder: BlockGetVolumeInfoResponder {
1237 control_handle: std::mem::ManuallyDrop::new(control_handle),
1238 tx_id: header.tx_id,
1239 },
1240 })
1241 }
1242 0x273fb2980ff24157 => {
1243 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1244 let mut req = fidl::new_empty!(
1245 BlockExtendRequest,
1246 fidl::encoding::DefaultFuchsiaResourceDialect
1247 );
1248 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockExtendRequest>(&header, _body_bytes, handles, &mut req)?;
1249 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1250 Ok(BlockRequest::Extend {
1251 start_slice: req.start_slice,
1252 slice_count: req.slice_count,
1253
1254 responder: BlockExtendResponder {
1255 control_handle: std::mem::ManuallyDrop::new(control_handle),
1256 tx_id: header.tx_id,
1257 },
1258 })
1259 }
1260 0x73da6de865600a8b => {
1261 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1262 let mut req = fidl::new_empty!(
1263 BlockShrinkRequest,
1264 fidl::encoding::DefaultFuchsiaResourceDialect
1265 );
1266 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockShrinkRequest>(&header, _body_bytes, handles, &mut req)?;
1267 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1268 Ok(BlockRequest::Shrink {
1269 start_slice: req.start_slice,
1270 slice_count: req.slice_count,
1271
1272 responder: BlockShrinkResponder {
1273 control_handle: std::mem::ManuallyDrop::new(control_handle),
1274 tx_id: header.tx_id,
1275 },
1276 })
1277 }
1278 0x5866ba764e05a68e => {
1279 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1280 let mut req = fidl::new_empty!(
1281 fidl::encoding::EmptyPayload,
1282 fidl::encoding::DefaultFuchsiaResourceDialect
1283 );
1284 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1285 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1286 Ok(BlockRequest::Destroy {
1287 responder: BlockDestroyResponder {
1288 control_handle: std::mem::ManuallyDrop::new(control_handle),
1289 tx_id: header.tx_id,
1290 },
1291 })
1292 }
1293 _ => Err(fidl::Error::UnknownOrdinal {
1294 ordinal: header.ordinal,
1295 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1296 }),
1297 }))
1298 },
1299 )
1300 }
1301}
1302
1303#[derive(Debug)]
1306pub enum BlockRequest {
1307 GetInfo { responder: BlockGetInfoResponder },
1309 OpenSession {
1311 session: fidl::endpoints::ServerEnd<SessionMarker>,
1312 control_handle: BlockControlHandle,
1313 },
1314 OpenSessionWithOptions {
1335 session: fidl::endpoints::ServerEnd<SessionMarker>,
1336 mappings: Vec<BlockOffsetMapping>,
1337 control_handle: BlockControlHandle,
1338 },
1339 ConnectMapper {
1347 server_end: fidl::endpoints::ServerEnd<MapperMarker>,
1348 responder: BlockConnectMapperResponder,
1349 },
1350 GetTypeGuid { responder: BlockGetTypeGuidResponder },
1353 GetInstanceGuid { responder: BlockGetInstanceGuidResponder },
1356 GetName { responder: BlockGetNameResponder },
1359 GetMetadata { responder: BlockGetMetadataResponder },
1363 QuerySlices { start_slices: Vec<u64>, responder: BlockQuerySlicesResponder },
1368 GetVolumeInfo { responder: BlockGetVolumeInfoResponder },
1372 Extend { start_slice: u64, slice_count: u64, responder: BlockExtendResponder },
1380 Shrink { start_slice: u64, slice_count: u64, responder: BlockShrinkResponder },
1385 Destroy { responder: BlockDestroyResponder },
1390}
1391
1392impl BlockRequest {
1393 #[allow(irrefutable_let_patterns)]
1394 pub fn into_get_info(self) -> Option<(BlockGetInfoResponder)> {
1395 if let BlockRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1396 }
1397
1398 #[allow(irrefutable_let_patterns)]
1399 pub fn into_open_session(
1400 self,
1401 ) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockControlHandle)> {
1402 if let BlockRequest::OpenSession { session, control_handle } = self {
1403 Some((session, control_handle))
1404 } else {
1405 None
1406 }
1407 }
1408
1409 #[allow(irrefutable_let_patterns)]
1410 pub fn into_open_session_with_options(
1411 self,
1412 ) -> Option<(
1413 fidl::endpoints::ServerEnd<SessionMarker>,
1414 Vec<BlockOffsetMapping>,
1415 BlockControlHandle,
1416 )> {
1417 if let BlockRequest::OpenSessionWithOptions { session, mappings, control_handle } = self {
1418 Some((session, mappings, control_handle))
1419 } else {
1420 None
1421 }
1422 }
1423
1424 #[allow(irrefutable_let_patterns)]
1425 pub fn into_connect_mapper(
1426 self,
1427 ) -> Option<(fidl::endpoints::ServerEnd<MapperMarker>, BlockConnectMapperResponder)> {
1428 if let BlockRequest::ConnectMapper { server_end, responder } = self {
1429 Some((server_end, responder))
1430 } else {
1431 None
1432 }
1433 }
1434
1435 #[allow(irrefutable_let_patterns)]
1436 pub fn into_get_type_guid(self) -> Option<(BlockGetTypeGuidResponder)> {
1437 if let BlockRequest::GetTypeGuid { responder } = self { Some((responder)) } else { None }
1438 }
1439
1440 #[allow(irrefutable_let_patterns)]
1441 pub fn into_get_instance_guid(self) -> Option<(BlockGetInstanceGuidResponder)> {
1442 if let BlockRequest::GetInstanceGuid { responder } = self {
1443 Some((responder))
1444 } else {
1445 None
1446 }
1447 }
1448
1449 #[allow(irrefutable_let_patterns)]
1450 pub fn into_get_name(self) -> Option<(BlockGetNameResponder)> {
1451 if let BlockRequest::GetName { responder } = self { Some((responder)) } else { None }
1452 }
1453
1454 #[allow(irrefutable_let_patterns)]
1455 pub fn into_get_metadata(self) -> Option<(BlockGetMetadataResponder)> {
1456 if let BlockRequest::GetMetadata { responder } = self { Some((responder)) } else { None }
1457 }
1458
1459 #[allow(irrefutable_let_patterns)]
1460 pub fn into_query_slices(self) -> Option<(Vec<u64>, BlockQuerySlicesResponder)> {
1461 if let BlockRequest::QuerySlices { start_slices, responder } = self {
1462 Some((start_slices, responder))
1463 } else {
1464 None
1465 }
1466 }
1467
1468 #[allow(irrefutable_let_patterns)]
1469 pub fn into_get_volume_info(self) -> Option<(BlockGetVolumeInfoResponder)> {
1470 if let BlockRequest::GetVolumeInfo { responder } = self { Some((responder)) } else { None }
1471 }
1472
1473 #[allow(irrefutable_let_patterns)]
1474 pub fn into_extend(self) -> Option<(u64, u64, BlockExtendResponder)> {
1475 if let BlockRequest::Extend { start_slice, slice_count, responder } = self {
1476 Some((start_slice, slice_count, responder))
1477 } else {
1478 None
1479 }
1480 }
1481
1482 #[allow(irrefutable_let_patterns)]
1483 pub fn into_shrink(self) -> Option<(u64, u64, BlockShrinkResponder)> {
1484 if let BlockRequest::Shrink { start_slice, slice_count, responder } = self {
1485 Some((start_slice, slice_count, responder))
1486 } else {
1487 None
1488 }
1489 }
1490
1491 #[allow(irrefutable_let_patterns)]
1492 pub fn into_destroy(self) -> Option<(BlockDestroyResponder)> {
1493 if let BlockRequest::Destroy { responder } = self { Some((responder)) } else { None }
1494 }
1495
1496 pub fn method_name(&self) -> &'static str {
1498 match *self {
1499 BlockRequest::GetInfo { .. } => "get_info",
1500 BlockRequest::OpenSession { .. } => "open_session",
1501 BlockRequest::OpenSessionWithOptions { .. } => "open_session_with_options",
1502 BlockRequest::ConnectMapper { .. } => "connect_mapper",
1503 BlockRequest::GetTypeGuid { .. } => "get_type_guid",
1504 BlockRequest::GetInstanceGuid { .. } => "get_instance_guid",
1505 BlockRequest::GetName { .. } => "get_name",
1506 BlockRequest::GetMetadata { .. } => "get_metadata",
1507 BlockRequest::QuerySlices { .. } => "query_slices",
1508 BlockRequest::GetVolumeInfo { .. } => "get_volume_info",
1509 BlockRequest::Extend { .. } => "extend",
1510 BlockRequest::Shrink { .. } => "shrink",
1511 BlockRequest::Destroy { .. } => "destroy",
1512 }
1513 }
1514}
1515
1516#[derive(Debug, Clone)]
1517pub struct BlockControlHandle {
1518 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1519}
1520
1521impl BlockControlHandle {
1522 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1523 self.inner.shutdown_with_epitaph(status.into())
1524 }
1525}
1526
1527impl fidl::endpoints::ControlHandle for BlockControlHandle {
1528 fn shutdown(&self) {
1529 self.inner.shutdown()
1530 }
1531
1532 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1533 self.inner.shutdown_with_epitaph(status)
1534 }
1535
1536 fn is_closed(&self) -> bool {
1537 self.inner.channel().is_closed()
1538 }
1539 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1540 self.inner.channel().on_closed()
1541 }
1542
1543 #[cfg(target_os = "fuchsia")]
1544 fn signal_peer(
1545 &self,
1546 clear_mask: zx::Signals,
1547 set_mask: zx::Signals,
1548 ) -> Result<(), zx_status::Status> {
1549 use fidl::Peered;
1550 self.inner.channel().signal_peer(clear_mask, set_mask)
1551 }
1552}
1553
1554impl BlockControlHandle {}
1555
1556#[must_use = "FIDL methods require a response to be sent"]
1557#[derive(Debug)]
1558pub struct BlockGetInfoResponder {
1559 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1560 tx_id: u32,
1561}
1562
1563impl std::ops::Drop for BlockGetInfoResponder {
1567 fn drop(&mut self) {
1568 self.control_handle.shutdown();
1569 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1571 }
1572}
1573
1574impl fidl::endpoints::Responder for BlockGetInfoResponder {
1575 type ControlHandle = BlockControlHandle;
1576
1577 fn control_handle(&self) -> &BlockControlHandle {
1578 &self.control_handle
1579 }
1580
1581 fn drop_without_shutdown(mut self) {
1582 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1584 std::mem::forget(self);
1586 }
1587}
1588
1589impl BlockGetInfoResponder {
1590 pub fn send(self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1594 let _result = self.send_raw(result);
1595 if _result.is_err() {
1596 self.control_handle.shutdown();
1597 }
1598 self.drop_without_shutdown();
1599 _result
1600 }
1601
1602 pub fn send_no_shutdown_on_err(
1604 self,
1605 mut result: Result<&BlockInfo, i32>,
1606 ) -> Result<(), fidl::Error> {
1607 let _result = self.send_raw(result);
1608 self.drop_without_shutdown();
1609 _result
1610 }
1611
1612 fn send_raw(&self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1613 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetInfoResponse, i32>>(
1614 result.map(|info| (info,)),
1615 self.tx_id,
1616 0x58777a4a31cc9a47,
1617 fidl::encoding::DynamicFlags::empty(),
1618 )
1619 }
1620}
1621
1622#[must_use = "FIDL methods require a response to be sent"]
1623#[derive(Debug)]
1624pub struct BlockConnectMapperResponder {
1625 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1626 tx_id: u32,
1627}
1628
1629impl std::ops::Drop for BlockConnectMapperResponder {
1633 fn drop(&mut self) {
1634 self.control_handle.shutdown();
1635 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1637 }
1638}
1639
1640impl fidl::endpoints::Responder for BlockConnectMapperResponder {
1641 type ControlHandle = BlockControlHandle;
1642
1643 fn control_handle(&self) -> &BlockControlHandle {
1644 &self.control_handle
1645 }
1646
1647 fn drop_without_shutdown(mut self) {
1648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1650 std::mem::forget(self);
1652 }
1653}
1654
1655impl BlockConnectMapperResponder {
1656 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1660 let _result = self.send_raw(result);
1661 if _result.is_err() {
1662 self.control_handle.shutdown();
1663 }
1664 self.drop_without_shutdown();
1665 _result
1666 }
1667
1668 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1670 let _result = self.send_raw(result);
1671 self.drop_without_shutdown();
1672 _result
1673 }
1674
1675 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1676 self.control_handle
1677 .inner
1678 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1679 result,
1680 self.tx_id,
1681 0xa38a3fbbe3412c3,
1682 fidl::encoding::DynamicFlags::empty(),
1683 )
1684 }
1685}
1686
1687#[must_use = "FIDL methods require a response to be sent"]
1688#[derive(Debug)]
1689pub struct BlockGetTypeGuidResponder {
1690 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1691 tx_id: u32,
1692}
1693
1694impl std::ops::Drop for BlockGetTypeGuidResponder {
1698 fn drop(&mut self) {
1699 self.control_handle.shutdown();
1700 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1702 }
1703}
1704
1705impl fidl::endpoints::Responder for BlockGetTypeGuidResponder {
1706 type ControlHandle = BlockControlHandle;
1707
1708 fn control_handle(&self) -> &BlockControlHandle {
1709 &self.control_handle
1710 }
1711
1712 fn drop_without_shutdown(mut self) {
1713 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1715 std::mem::forget(self);
1717 }
1718}
1719
1720impl BlockGetTypeGuidResponder {
1721 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1725 let _result = self.send_raw(status, guid);
1726 if _result.is_err() {
1727 self.control_handle.shutdown();
1728 }
1729 self.drop_without_shutdown();
1730 _result
1731 }
1732
1733 pub fn send_no_shutdown_on_err(
1735 self,
1736 mut status: i32,
1737 mut guid: Option<&Guid>,
1738 ) -> Result<(), fidl::Error> {
1739 let _result = self.send_raw(status, guid);
1740 self.drop_without_shutdown();
1741 _result
1742 }
1743
1744 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1745 self.control_handle.inner.send::<BlockGetTypeGuidResponse>(
1746 (status, guid),
1747 self.tx_id,
1748 0xefe4e41dafce4cc,
1749 fidl::encoding::DynamicFlags::empty(),
1750 )
1751 }
1752}
1753
1754#[must_use = "FIDL methods require a response to be sent"]
1755#[derive(Debug)]
1756pub struct BlockGetInstanceGuidResponder {
1757 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1758 tx_id: u32,
1759}
1760
1761impl std::ops::Drop for BlockGetInstanceGuidResponder {
1765 fn drop(&mut self) {
1766 self.control_handle.shutdown();
1767 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1769 }
1770}
1771
1772impl fidl::endpoints::Responder for BlockGetInstanceGuidResponder {
1773 type ControlHandle = BlockControlHandle;
1774
1775 fn control_handle(&self) -> &BlockControlHandle {
1776 &self.control_handle
1777 }
1778
1779 fn drop_without_shutdown(mut self) {
1780 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1782 std::mem::forget(self);
1784 }
1785}
1786
1787impl BlockGetInstanceGuidResponder {
1788 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1792 let _result = self.send_raw(status, guid);
1793 if _result.is_err() {
1794 self.control_handle.shutdown();
1795 }
1796 self.drop_without_shutdown();
1797 _result
1798 }
1799
1800 pub fn send_no_shutdown_on_err(
1802 self,
1803 mut status: i32,
1804 mut guid: Option<&Guid>,
1805 ) -> Result<(), fidl::Error> {
1806 let _result = self.send_raw(status, guid);
1807 self.drop_without_shutdown();
1808 _result
1809 }
1810
1811 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1812 self.control_handle.inner.send::<BlockGetInstanceGuidResponse>(
1813 (status, guid),
1814 self.tx_id,
1815 0x2e85011aabeb87fb,
1816 fidl::encoding::DynamicFlags::empty(),
1817 )
1818 }
1819}
1820
1821#[must_use = "FIDL methods require a response to be sent"]
1822#[derive(Debug)]
1823pub struct BlockGetNameResponder {
1824 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1825 tx_id: u32,
1826}
1827
1828impl std::ops::Drop for BlockGetNameResponder {
1832 fn drop(&mut self) {
1833 self.control_handle.shutdown();
1834 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1836 }
1837}
1838
1839impl fidl::endpoints::Responder for BlockGetNameResponder {
1840 type ControlHandle = BlockControlHandle;
1841
1842 fn control_handle(&self) -> &BlockControlHandle {
1843 &self.control_handle
1844 }
1845
1846 fn drop_without_shutdown(mut self) {
1847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1849 std::mem::forget(self);
1851 }
1852}
1853
1854impl BlockGetNameResponder {
1855 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1859 let _result = self.send_raw(status, name);
1860 if _result.is_err() {
1861 self.control_handle.shutdown();
1862 }
1863 self.drop_without_shutdown();
1864 _result
1865 }
1866
1867 pub fn send_no_shutdown_on_err(
1869 self,
1870 mut status: i32,
1871 mut name: Option<&str>,
1872 ) -> Result<(), fidl::Error> {
1873 let _result = self.send_raw(status, name);
1874 self.drop_without_shutdown();
1875 _result
1876 }
1877
1878 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1879 self.control_handle.inner.send::<BlockGetNameResponse>(
1880 (status, name),
1881 self.tx_id,
1882 0x630be18badedbb05,
1883 fidl::encoding::DynamicFlags::empty(),
1884 )
1885 }
1886}
1887
1888#[must_use = "FIDL methods require a response to be sent"]
1889#[derive(Debug)]
1890pub struct BlockGetMetadataResponder {
1891 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1892 tx_id: u32,
1893}
1894
1895impl std::ops::Drop for BlockGetMetadataResponder {
1899 fn drop(&mut self) {
1900 self.control_handle.shutdown();
1901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1903 }
1904}
1905
1906impl fidl::endpoints::Responder for BlockGetMetadataResponder {
1907 type ControlHandle = BlockControlHandle;
1908
1909 fn control_handle(&self) -> &BlockControlHandle {
1910 &self.control_handle
1911 }
1912
1913 fn drop_without_shutdown(mut self) {
1914 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1916 std::mem::forget(self);
1918 }
1919}
1920
1921impl BlockGetMetadataResponder {
1922 pub fn send(self, mut result: Result<&PartitionInfo, i32>) -> Result<(), fidl::Error> {
1926 let _result = self.send_raw(result);
1927 if _result.is_err() {
1928 self.control_handle.shutdown();
1929 }
1930 self.drop_without_shutdown();
1931 _result
1932 }
1933
1934 pub fn send_no_shutdown_on_err(
1936 self,
1937 mut result: Result<&PartitionInfo, i32>,
1938 ) -> Result<(), fidl::Error> {
1939 let _result = self.send_raw(result);
1940 self.drop_without_shutdown();
1941 _result
1942 }
1943
1944 fn send_raw(&self, mut result: Result<&PartitionInfo, i32>) -> Result<(), fidl::Error> {
1945 self.control_handle.inner.send::<fidl::encoding::ResultType<PartitionInfo, i32>>(
1946 result,
1947 self.tx_id,
1948 0x2c76b02ef9382533,
1949 fidl::encoding::DynamicFlags::empty(),
1950 )
1951 }
1952}
1953
1954#[must_use = "FIDL methods require a response to be sent"]
1955#[derive(Debug)]
1956pub struct BlockQuerySlicesResponder {
1957 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1958 tx_id: u32,
1959}
1960
1961impl std::ops::Drop for BlockQuerySlicesResponder {
1965 fn drop(&mut self) {
1966 self.control_handle.shutdown();
1967 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1969 }
1970}
1971
1972impl fidl::endpoints::Responder for BlockQuerySlicesResponder {
1973 type ControlHandle = BlockControlHandle;
1974
1975 fn control_handle(&self) -> &BlockControlHandle {
1976 &self.control_handle
1977 }
1978
1979 fn drop_without_shutdown(mut self) {
1980 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1982 std::mem::forget(self);
1984 }
1985}
1986
1987impl BlockQuerySlicesResponder {
1988 pub fn send(
1992 self,
1993 mut status: i32,
1994 mut response: &[VsliceRange; 16],
1995 mut response_count: u64,
1996 ) -> Result<(), fidl::Error> {
1997 let _result = self.send_raw(status, response, response_count);
1998 if _result.is_err() {
1999 self.control_handle.shutdown();
2000 }
2001 self.drop_without_shutdown();
2002 _result
2003 }
2004
2005 pub fn send_no_shutdown_on_err(
2007 self,
2008 mut status: i32,
2009 mut response: &[VsliceRange; 16],
2010 mut response_count: u64,
2011 ) -> Result<(), fidl::Error> {
2012 let _result = self.send_raw(status, response, response_count);
2013 self.drop_without_shutdown();
2014 _result
2015 }
2016
2017 fn send_raw(
2018 &self,
2019 mut status: i32,
2020 mut response: &[VsliceRange; 16],
2021 mut response_count: u64,
2022 ) -> Result<(), fidl::Error> {
2023 self.control_handle.inner.send::<BlockQuerySlicesResponse>(
2024 (status, response, response_count),
2025 self.tx_id,
2026 0x289240ac4fbaa190,
2027 fidl::encoding::DynamicFlags::empty(),
2028 )
2029 }
2030}
2031
2032#[must_use = "FIDL methods require a response to be sent"]
2033#[derive(Debug)]
2034pub struct BlockGetVolumeInfoResponder {
2035 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
2036 tx_id: u32,
2037}
2038
2039impl std::ops::Drop for BlockGetVolumeInfoResponder {
2043 fn drop(&mut self) {
2044 self.control_handle.shutdown();
2045 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2047 }
2048}
2049
2050impl fidl::endpoints::Responder for BlockGetVolumeInfoResponder {
2051 type ControlHandle = BlockControlHandle;
2052
2053 fn control_handle(&self) -> &BlockControlHandle {
2054 &self.control_handle
2055 }
2056
2057 fn drop_without_shutdown(mut self) {
2058 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2060 std::mem::forget(self);
2062 }
2063}
2064
2065impl BlockGetVolumeInfoResponder {
2066 pub fn send(
2070 self,
2071 mut status: i32,
2072 mut manager: Option<&VolumeManagerInfo>,
2073 mut volume: Option<&VolumeInfo>,
2074 ) -> Result<(), fidl::Error> {
2075 let _result = self.send_raw(status, manager, volume);
2076 if _result.is_err() {
2077 self.control_handle.shutdown();
2078 }
2079 self.drop_without_shutdown();
2080 _result
2081 }
2082
2083 pub fn send_no_shutdown_on_err(
2085 self,
2086 mut status: i32,
2087 mut manager: Option<&VolumeManagerInfo>,
2088 mut volume: Option<&VolumeInfo>,
2089 ) -> Result<(), fidl::Error> {
2090 let _result = self.send_raw(status, manager, volume);
2091 self.drop_without_shutdown();
2092 _result
2093 }
2094
2095 fn send_raw(
2096 &self,
2097 mut status: i32,
2098 mut manager: Option<&VolumeManagerInfo>,
2099 mut volume: Option<&VolumeInfo>,
2100 ) -> Result<(), fidl::Error> {
2101 self.control_handle.inner.send::<BlockGetVolumeInfoResponse>(
2102 (status, manager, volume),
2103 self.tx_id,
2104 0x3a7dc69ea5d788d4,
2105 fidl::encoding::DynamicFlags::empty(),
2106 )
2107 }
2108}
2109
2110#[must_use = "FIDL methods require a response to be sent"]
2111#[derive(Debug)]
2112pub struct BlockExtendResponder {
2113 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
2114 tx_id: u32,
2115}
2116
2117impl std::ops::Drop for BlockExtendResponder {
2121 fn drop(&mut self) {
2122 self.control_handle.shutdown();
2123 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2125 }
2126}
2127
2128impl fidl::endpoints::Responder for BlockExtendResponder {
2129 type ControlHandle = BlockControlHandle;
2130
2131 fn control_handle(&self) -> &BlockControlHandle {
2132 &self.control_handle
2133 }
2134
2135 fn drop_without_shutdown(mut self) {
2136 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2138 std::mem::forget(self);
2140 }
2141}
2142
2143impl BlockExtendResponder {
2144 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2148 let _result = self.send_raw(status);
2149 if _result.is_err() {
2150 self.control_handle.shutdown();
2151 }
2152 self.drop_without_shutdown();
2153 _result
2154 }
2155
2156 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2158 let _result = self.send_raw(status);
2159 self.drop_without_shutdown();
2160 _result
2161 }
2162
2163 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2164 self.control_handle.inner.send::<BlockExtendResponse>(
2165 (status,),
2166 self.tx_id,
2167 0x273fb2980ff24157,
2168 fidl::encoding::DynamicFlags::empty(),
2169 )
2170 }
2171}
2172
2173#[must_use = "FIDL methods require a response to be sent"]
2174#[derive(Debug)]
2175pub struct BlockShrinkResponder {
2176 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
2177 tx_id: u32,
2178}
2179
2180impl std::ops::Drop for BlockShrinkResponder {
2184 fn drop(&mut self) {
2185 self.control_handle.shutdown();
2186 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2188 }
2189}
2190
2191impl fidl::endpoints::Responder for BlockShrinkResponder {
2192 type ControlHandle = BlockControlHandle;
2193
2194 fn control_handle(&self) -> &BlockControlHandle {
2195 &self.control_handle
2196 }
2197
2198 fn drop_without_shutdown(mut self) {
2199 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2201 std::mem::forget(self);
2203 }
2204}
2205
2206impl BlockShrinkResponder {
2207 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2211 let _result = self.send_raw(status);
2212 if _result.is_err() {
2213 self.control_handle.shutdown();
2214 }
2215 self.drop_without_shutdown();
2216 _result
2217 }
2218
2219 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2221 let _result = self.send_raw(status);
2222 self.drop_without_shutdown();
2223 _result
2224 }
2225
2226 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2227 self.control_handle.inner.send::<BlockShrinkResponse>(
2228 (status,),
2229 self.tx_id,
2230 0x73da6de865600a8b,
2231 fidl::encoding::DynamicFlags::empty(),
2232 )
2233 }
2234}
2235
2236#[must_use = "FIDL methods require a response to be sent"]
2237#[derive(Debug)]
2238pub struct BlockDestroyResponder {
2239 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
2240 tx_id: u32,
2241}
2242
2243impl std::ops::Drop for BlockDestroyResponder {
2247 fn drop(&mut self) {
2248 self.control_handle.shutdown();
2249 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2251 }
2252}
2253
2254impl fidl::endpoints::Responder for BlockDestroyResponder {
2255 type ControlHandle = BlockControlHandle;
2256
2257 fn control_handle(&self) -> &BlockControlHandle {
2258 &self.control_handle
2259 }
2260
2261 fn drop_without_shutdown(mut self) {
2262 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2264 std::mem::forget(self);
2266 }
2267}
2268
2269impl BlockDestroyResponder {
2270 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2274 let _result = self.send_raw(status);
2275 if _result.is_err() {
2276 self.control_handle.shutdown();
2277 }
2278 self.drop_without_shutdown();
2279 _result
2280 }
2281
2282 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2284 let _result = self.send_raw(status);
2285 self.drop_without_shutdown();
2286 _result
2287 }
2288
2289 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2290 self.control_handle.inner.send::<BlockDestroyResponse>(
2291 (status,),
2292 self.tx_id,
2293 0x5866ba764e05a68e,
2294 fidl::encoding::DynamicFlags::empty(),
2295 )
2296 }
2297}
2298
2299#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2300pub struct MapperMarker;
2301
2302impl fidl::endpoints::ProtocolMarker for MapperMarker {
2303 type Proxy = MapperProxy;
2304 type RequestStream = MapperRequestStream;
2305 #[cfg(target_os = "fuchsia")]
2306 type SynchronousProxy = MapperSynchronousProxy;
2307
2308 const DEBUG_NAME: &'static str = "fuchsia.storage.block.Mapper";
2309}
2310impl fidl::endpoints::DiscoverableProtocolMarker for MapperMarker {}
2311pub type MapperOpenSessionResult = Result<(), i32>;
2312
2313pub trait MapperProxyInterface: Send + Sync {
2314 type OpenSessionResponseFut: std::future::Future<Output = Result<MapperOpenSessionResult, fidl::Error>>
2315 + Send;
2316 fn r#open_session(
2317 &self,
2318 session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2319 mapping_vmo: fidl::Vmo,
2320 port: Option<fidl::Port>,
2321 delivery_queue: Option<fidl::Vmo>,
2322 ) -> Self::OpenSessionResponseFut;
2323}
2324#[derive(Debug)]
2325#[cfg(target_os = "fuchsia")]
2326pub struct MapperSynchronousProxy {
2327 client: fidl::client::sync::Client,
2328}
2329
2330#[cfg(target_os = "fuchsia")]
2331impl fidl::endpoints::SynchronousProxy for MapperSynchronousProxy {
2332 type Proxy = MapperProxy;
2333 type Protocol = MapperMarker;
2334
2335 fn from_channel(inner: fidl::Channel) -> Self {
2336 Self::new(inner)
2337 }
2338
2339 fn into_channel(self) -> fidl::Channel {
2340 self.client.into_channel()
2341 }
2342
2343 fn as_channel(&self) -> &fidl::Channel {
2344 self.client.as_channel()
2345 }
2346}
2347
2348#[cfg(target_os = "fuchsia")]
2349impl MapperSynchronousProxy {
2350 pub fn new(channel: fidl::Channel) -> Self {
2351 Self { client: fidl::client::sync::Client::new(channel) }
2352 }
2353
2354 pub fn into_channel(self) -> fidl::Channel {
2355 self.client.into_channel()
2356 }
2357
2358 pub fn wait_for_event(
2361 &self,
2362 deadline: zx::MonotonicInstant,
2363 ) -> Result<MapperEvent, fidl::Error> {
2364 MapperEvent::decode(self.client.wait_for_event::<MapperMarker>(deadline)?)
2365 }
2366
2367 pub fn r#open_session(
2369 &self,
2370 mut session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2371 mut mapping_vmo: fidl::Vmo,
2372 mut port: Option<fidl::Port>,
2373 mut delivery_queue: Option<fidl::Vmo>,
2374 ___deadline: zx::MonotonicInstant,
2375 ) -> Result<MapperOpenSessionResult, fidl::Error> {
2376 let _response = self.client.send_query::<
2377 MapperOpenSessionRequest,
2378 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2379 MapperMarker,
2380 >(
2381 (session, mapping_vmo, port, delivery_queue,),
2382 0x638c49dbdff13a9c,
2383 fidl::encoding::DynamicFlags::FLEXIBLE,
2384 ___deadline,
2385 )?
2386 .into_result::<MapperMarker>("open_session")?;
2387 Ok(_response.map(|x| x))
2388 }
2389}
2390
2391#[cfg(target_os = "fuchsia")]
2392impl From<MapperSynchronousProxy> for zx::NullableHandle {
2393 fn from(value: MapperSynchronousProxy) -> Self {
2394 value.into_channel().into()
2395 }
2396}
2397
2398#[cfg(target_os = "fuchsia")]
2399impl From<fidl::Channel> for MapperSynchronousProxy {
2400 fn from(value: fidl::Channel) -> Self {
2401 Self::new(value)
2402 }
2403}
2404
2405#[cfg(target_os = "fuchsia")]
2406impl fidl::endpoints::FromClient for MapperSynchronousProxy {
2407 type Protocol = MapperMarker;
2408
2409 fn from_client(value: fidl::endpoints::ClientEnd<MapperMarker>) -> Self {
2410 Self::new(value.into_channel())
2411 }
2412}
2413
2414#[derive(Debug, Clone)]
2415pub struct MapperProxy {
2416 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2417}
2418
2419impl fidl::endpoints::Proxy for MapperProxy {
2420 type Protocol = MapperMarker;
2421
2422 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2423 Self::new(inner)
2424 }
2425
2426 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2427 self.client.into_channel().map_err(|client| Self { client })
2428 }
2429
2430 fn as_channel(&self) -> &::fidl::AsyncChannel {
2431 self.client.as_channel()
2432 }
2433}
2434
2435impl MapperProxy {
2436 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2438 let protocol_name = <MapperMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2439 Self { client: fidl::client::Client::new(channel, protocol_name) }
2440 }
2441
2442 pub fn take_event_stream(&self) -> MapperEventStream {
2448 MapperEventStream { event_receiver: self.client.take_event_receiver() }
2449 }
2450
2451 pub fn r#open_session(
2453 &self,
2454 mut session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2455 mut mapping_vmo: fidl::Vmo,
2456 mut port: Option<fidl::Port>,
2457 mut delivery_queue: Option<fidl::Vmo>,
2458 ) -> fidl::client::QueryResponseFut<
2459 MapperOpenSessionResult,
2460 fidl::encoding::DefaultFuchsiaResourceDialect,
2461 > {
2462 MapperProxyInterface::r#open_session(self, session, mapping_vmo, port, delivery_queue)
2463 }
2464}
2465
2466impl MapperProxyInterface for MapperProxy {
2467 type OpenSessionResponseFut = fidl::client::QueryResponseFut<
2468 MapperOpenSessionResult,
2469 fidl::encoding::DefaultFuchsiaResourceDialect,
2470 >;
2471 fn r#open_session(
2472 &self,
2473 mut session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2474 mut mapping_vmo: fidl::Vmo,
2475 mut port: Option<fidl::Port>,
2476 mut delivery_queue: Option<fidl::Vmo>,
2477 ) -> Self::OpenSessionResponseFut {
2478 fn _decode(
2479 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2480 ) -> Result<MapperOpenSessionResult, fidl::Error> {
2481 let _response = fidl::client::decode_transaction_body::<
2482 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2483 fidl::encoding::DefaultFuchsiaResourceDialect,
2484 0x638c49dbdff13a9c,
2485 >(_buf?)?
2486 .into_result::<MapperMarker>("open_session")?;
2487 Ok(_response.map(|x| x))
2488 }
2489 self.client.send_query_and_decode::<MapperOpenSessionRequest, MapperOpenSessionResult>(
2490 (session, mapping_vmo, port, delivery_queue),
2491 0x638c49dbdff13a9c,
2492 fidl::encoding::DynamicFlags::FLEXIBLE,
2493 _decode,
2494 )
2495 }
2496}
2497
2498pub struct MapperEventStream {
2499 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2500}
2501
2502impl std::marker::Unpin for MapperEventStream {}
2503
2504impl futures::stream::FusedStream for MapperEventStream {
2505 fn is_terminated(&self) -> bool {
2506 self.event_receiver.is_terminated()
2507 }
2508}
2509
2510impl futures::Stream for MapperEventStream {
2511 type Item = Result<MapperEvent, fidl::Error>;
2512
2513 fn poll_next(
2514 mut self: std::pin::Pin<&mut Self>,
2515 cx: &mut std::task::Context<'_>,
2516 ) -> std::task::Poll<Option<Self::Item>> {
2517 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2518 &mut self.event_receiver,
2519 cx
2520 )?) {
2521 Some(buf) => std::task::Poll::Ready(Some(MapperEvent::decode(buf))),
2522 None => std::task::Poll::Ready(None),
2523 }
2524 }
2525}
2526
2527#[derive(Debug)]
2528pub enum MapperEvent {
2529 #[non_exhaustive]
2530 _UnknownEvent {
2531 ordinal: u64,
2533 },
2534}
2535
2536impl MapperEvent {
2537 fn decode(
2539 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2540 ) -> Result<MapperEvent, fidl::Error> {
2541 let (bytes, _handles) = buf.split_mut();
2542 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2543 debug_assert_eq!(tx_header.tx_id, 0);
2544 match tx_header.ordinal {
2545 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2546 Ok(MapperEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2547 }
2548 _ => Err(fidl::Error::UnknownOrdinal {
2549 ordinal: tx_header.ordinal,
2550 protocol_name: <MapperMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2551 }),
2552 }
2553 }
2554}
2555
2556pub struct MapperRequestStream {
2558 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2559 is_terminated: bool,
2560}
2561
2562impl std::marker::Unpin for MapperRequestStream {}
2563
2564impl futures::stream::FusedStream for MapperRequestStream {
2565 fn is_terminated(&self) -> bool {
2566 self.is_terminated
2567 }
2568}
2569
2570impl fidl::endpoints::RequestStream for MapperRequestStream {
2571 type Protocol = MapperMarker;
2572 type ControlHandle = MapperControlHandle;
2573
2574 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2575 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2576 }
2577
2578 fn control_handle(&self) -> Self::ControlHandle {
2579 MapperControlHandle { inner: self.inner.clone() }
2580 }
2581
2582 fn into_inner(
2583 self,
2584 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2585 {
2586 (self.inner, self.is_terminated)
2587 }
2588
2589 fn from_inner(
2590 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2591 is_terminated: bool,
2592 ) -> Self {
2593 Self { inner, is_terminated }
2594 }
2595}
2596
2597impl futures::Stream for MapperRequestStream {
2598 type Item = Result<MapperRequest, fidl::Error>;
2599
2600 fn poll_next(
2601 mut self: std::pin::Pin<&mut Self>,
2602 cx: &mut std::task::Context<'_>,
2603 ) -> std::task::Poll<Option<Self::Item>> {
2604 let this = &mut *self;
2605 if this.inner.check_shutdown(cx) {
2606 this.is_terminated = true;
2607 return std::task::Poll::Ready(None);
2608 }
2609 if this.is_terminated {
2610 panic!("polled MapperRequestStream after completion");
2611 }
2612 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2613 |bytes, handles| {
2614 match this.inner.channel().read_etc(cx, bytes, handles) {
2615 std::task::Poll::Ready(Ok(())) => {}
2616 std::task::Poll::Pending => return std::task::Poll::Pending,
2617 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2618 this.is_terminated = true;
2619 return std::task::Poll::Ready(None);
2620 }
2621 std::task::Poll::Ready(Err(e)) => {
2622 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2623 e.into(),
2624 ))));
2625 }
2626 }
2627
2628 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2630
2631 std::task::Poll::Ready(Some(match header.ordinal {
2632 0x638c49dbdff13a9c => {
2633 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2634 let mut req = fidl::new_empty!(
2635 MapperOpenSessionRequest,
2636 fidl::encoding::DefaultFuchsiaResourceDialect
2637 );
2638 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MapperOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2639 let control_handle = MapperControlHandle { inner: this.inner.clone() };
2640 Ok(MapperRequest::OpenSession {
2641 session: req.session,
2642 mapping_vmo: req.mapping_vmo,
2643 port: req.port,
2644 delivery_queue: req.delivery_queue,
2645
2646 responder: MapperOpenSessionResponder {
2647 control_handle: std::mem::ManuallyDrop::new(control_handle),
2648 tx_id: header.tx_id,
2649 },
2650 })
2651 }
2652 _ if header.tx_id == 0
2653 && header
2654 .dynamic_flags()
2655 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2656 {
2657 Ok(MapperRequest::_UnknownMethod {
2658 ordinal: header.ordinal,
2659 control_handle: MapperControlHandle { inner: this.inner.clone() },
2660 method_type: fidl::MethodType::OneWay,
2661 })
2662 }
2663 _ if header
2664 .dynamic_flags()
2665 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2666 {
2667 this.inner.send_framework_err(
2668 fidl::encoding::FrameworkErr::UnknownMethod,
2669 header.tx_id,
2670 header.ordinal,
2671 header.dynamic_flags(),
2672 (bytes, handles),
2673 )?;
2674 Ok(MapperRequest::_UnknownMethod {
2675 ordinal: header.ordinal,
2676 control_handle: MapperControlHandle { inner: this.inner.clone() },
2677 method_type: fidl::MethodType::TwoWay,
2678 })
2679 }
2680 _ => Err(fidl::Error::UnknownOrdinal {
2681 ordinal: header.ordinal,
2682 protocol_name:
2683 <MapperMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2684 }),
2685 }))
2686 },
2687 )
2688 }
2689}
2690
2691#[derive(Debug)]
2693pub enum MapperRequest {
2694 OpenSession {
2696 session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2697 mapping_vmo: fidl::Vmo,
2698 port: Option<fidl::Port>,
2699 delivery_queue: Option<fidl::Vmo>,
2700 responder: MapperOpenSessionResponder,
2701 },
2702 #[non_exhaustive]
2704 _UnknownMethod {
2705 ordinal: u64,
2707 control_handle: MapperControlHandle,
2708 method_type: fidl::MethodType,
2709 },
2710}
2711
2712impl MapperRequest {
2713 #[allow(irrefutable_let_patterns)]
2714 pub fn into_open_session(
2715 self,
2716 ) -> Option<(
2717 fidl::endpoints::ServerEnd<MapperSessionMarker>,
2718 fidl::Vmo,
2719 Option<fidl::Port>,
2720 Option<fidl::Vmo>,
2721 MapperOpenSessionResponder,
2722 )> {
2723 if let MapperRequest::OpenSession {
2724 session,
2725 mapping_vmo,
2726 port,
2727 delivery_queue,
2728 responder,
2729 } = self
2730 {
2731 Some((session, mapping_vmo, port, delivery_queue, responder))
2732 } else {
2733 None
2734 }
2735 }
2736
2737 pub fn method_name(&self) -> &'static str {
2739 match *self {
2740 MapperRequest::OpenSession { .. } => "open_session",
2741 MapperRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2742 "unknown one-way method"
2743 }
2744 MapperRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2745 "unknown two-way method"
2746 }
2747 }
2748 }
2749}
2750
2751#[derive(Debug, Clone)]
2752pub struct MapperControlHandle {
2753 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2754}
2755
2756impl MapperControlHandle {
2757 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2758 self.inner.shutdown_with_epitaph(status.into())
2759 }
2760}
2761
2762impl fidl::endpoints::ControlHandle for MapperControlHandle {
2763 fn shutdown(&self) {
2764 self.inner.shutdown()
2765 }
2766
2767 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2768 self.inner.shutdown_with_epitaph(status)
2769 }
2770
2771 fn is_closed(&self) -> bool {
2772 self.inner.channel().is_closed()
2773 }
2774 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2775 self.inner.channel().on_closed()
2776 }
2777
2778 #[cfg(target_os = "fuchsia")]
2779 fn signal_peer(
2780 &self,
2781 clear_mask: zx::Signals,
2782 set_mask: zx::Signals,
2783 ) -> Result<(), zx_status::Status> {
2784 use fidl::Peered;
2785 self.inner.channel().signal_peer(clear_mask, set_mask)
2786 }
2787}
2788
2789impl MapperControlHandle {}
2790
2791#[must_use = "FIDL methods require a response to be sent"]
2792#[derive(Debug)]
2793pub struct MapperOpenSessionResponder {
2794 control_handle: std::mem::ManuallyDrop<MapperControlHandle>,
2795 tx_id: u32,
2796}
2797
2798impl std::ops::Drop for MapperOpenSessionResponder {
2802 fn drop(&mut self) {
2803 self.control_handle.shutdown();
2804 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2806 }
2807}
2808
2809impl fidl::endpoints::Responder for MapperOpenSessionResponder {
2810 type ControlHandle = MapperControlHandle;
2811
2812 fn control_handle(&self) -> &MapperControlHandle {
2813 &self.control_handle
2814 }
2815
2816 fn drop_without_shutdown(mut self) {
2817 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2819 std::mem::forget(self);
2821 }
2822}
2823
2824impl MapperOpenSessionResponder {
2825 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2829 let _result = self.send_raw(result);
2830 if _result.is_err() {
2831 self.control_handle.shutdown();
2832 }
2833 self.drop_without_shutdown();
2834 _result
2835 }
2836
2837 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2839 let _result = self.send_raw(result);
2840 self.drop_without_shutdown();
2841 _result
2842 }
2843
2844 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2845 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2846 fidl::encoding::EmptyStruct,
2847 i32,
2848 >>(
2849 fidl::encoding::FlexibleResult::new(result),
2850 self.tx_id,
2851 0x638c49dbdff13a9c,
2852 fidl::encoding::DynamicFlags::FLEXIBLE,
2853 )
2854 }
2855}
2856
2857#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2858pub struct MapperSessionMarker;
2859
2860impl fidl::endpoints::ProtocolMarker for MapperSessionMarker {
2861 type Proxy = MapperSessionProxy;
2862 type RequestStream = MapperSessionRequestStream;
2863 #[cfg(target_os = "fuchsia")]
2864 type SynchronousProxy = MapperSessionSynchronousProxy;
2865
2866 const DEBUG_NAME: &'static str = "(anonymous) MapperSession";
2867}
2868pub type MapperSessionCreateVmoResult = Result<fidl::Vmo, i32>;
2869pub type MapperSessionOpenChildSessionResult = Result<(), i32>;
2870
2871pub trait MapperSessionProxyInterface: Send + Sync {
2872 type CloseResponseFut: std::future::Future<
2873 Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
2874 > + Send;
2875 fn r#close(&self) -> Self::CloseResponseFut;
2876 type CreateVmoResponseFut: std::future::Future<Output = Result<MapperSessionCreateVmoResult, fidl::Error>>
2877 + Send;
2878 fn r#create_vmo(
2879 &self,
2880 key: u64,
2881 size: u64,
2882 options: CreateVmoOptions,
2883 ) -> Self::CreateVmoResponseFut;
2884 type OpenChildSessionResponseFut: std::future::Future<Output = Result<MapperSessionOpenChildSessionResult, fidl::Error>>
2885 + Send;
2886 fn r#open_child_session(
2887 &self,
2888 session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2889 mapping_vmo: fidl::Vmo,
2890 parent_key: u64,
2891 port: Option<fidl::Port>,
2892 delivery_queue: Option<fidl::Vmo>,
2893 ) -> Self::OpenChildSessionResponseFut;
2894}
2895#[derive(Debug)]
2896#[cfg(target_os = "fuchsia")]
2897pub struct MapperSessionSynchronousProxy {
2898 client: fidl::client::sync::Client,
2899}
2900
2901#[cfg(target_os = "fuchsia")]
2902impl fidl::endpoints::SynchronousProxy for MapperSessionSynchronousProxy {
2903 type Proxy = MapperSessionProxy;
2904 type Protocol = MapperSessionMarker;
2905
2906 fn from_channel(inner: fidl::Channel) -> Self {
2907 Self::new(inner)
2908 }
2909
2910 fn into_channel(self) -> fidl::Channel {
2911 self.client.into_channel()
2912 }
2913
2914 fn as_channel(&self) -> &fidl::Channel {
2915 self.client.as_channel()
2916 }
2917}
2918
2919#[cfg(target_os = "fuchsia")]
2920impl MapperSessionSynchronousProxy {
2921 pub fn new(channel: fidl::Channel) -> Self {
2922 Self { client: fidl::client::sync::Client::new(channel) }
2923 }
2924
2925 pub fn into_channel(self) -> fidl::Channel {
2926 self.client.into_channel()
2927 }
2928
2929 pub fn wait_for_event(
2932 &self,
2933 deadline: zx::MonotonicInstant,
2934 ) -> Result<MapperSessionEvent, fidl::Error> {
2935 MapperSessionEvent::decode(self.client.wait_for_event::<MapperSessionMarker>(deadline)?)
2936 }
2937
2938 pub fn r#close(
2949 &self,
2950 ___deadline: zx::MonotonicInstant,
2951 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2952 let _response = self.client.send_query::<
2953 fidl::encoding::EmptyPayload,
2954 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2955 MapperSessionMarker,
2956 >(
2957 (),
2958 0x5ac5d459ad7f657e,
2959 fidl::encoding::DynamicFlags::empty(),
2960 ___deadline,
2961 )?;
2962 Ok(_response.map(|x| x))
2963 }
2964
2965 pub fn r#create_vmo(
2968 &self,
2969 mut key: u64,
2970 mut size: u64,
2971 mut options: CreateVmoOptions,
2972 ___deadline: zx::MonotonicInstant,
2973 ) -> Result<MapperSessionCreateVmoResult, fidl::Error> {
2974 let _response = self.client.send_query::<
2975 MapperSessionCreateVmoRequest,
2976 fidl::encoding::FlexibleResultType<MapperSessionCreateVmoResponse, i32>,
2977 MapperSessionMarker,
2978 >(
2979 (key, size, options,),
2980 0x35be1bf1bd0f9e1d,
2981 fidl::encoding::DynamicFlags::FLEXIBLE,
2982 ___deadline,
2983 )?
2984 .into_result::<MapperSessionMarker>("create_vmo")?;
2985 Ok(_response.map(|x| x.vmo))
2986 }
2987
2988 pub fn r#open_child_session(
2991 &self,
2992 mut session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
2993 mut mapping_vmo: fidl::Vmo,
2994 mut parent_key: u64,
2995 mut port: Option<fidl::Port>,
2996 mut delivery_queue: Option<fidl::Vmo>,
2997 ___deadline: zx::MonotonicInstant,
2998 ) -> Result<MapperSessionOpenChildSessionResult, fidl::Error> {
2999 let _response = self.client.send_query::<
3000 MapperSessionOpenChildSessionRequest,
3001 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
3002 MapperSessionMarker,
3003 >(
3004 (session, mapping_vmo, parent_key, port, delivery_queue,),
3005 0x7b80686acf9dcca3,
3006 fidl::encoding::DynamicFlags::FLEXIBLE,
3007 ___deadline,
3008 )?
3009 .into_result::<MapperSessionMarker>("open_child_session")?;
3010 Ok(_response.map(|x| x))
3011 }
3012}
3013
3014#[cfg(target_os = "fuchsia")]
3015impl From<MapperSessionSynchronousProxy> for zx::NullableHandle {
3016 fn from(value: MapperSessionSynchronousProxy) -> Self {
3017 value.into_channel().into()
3018 }
3019}
3020
3021#[cfg(target_os = "fuchsia")]
3022impl From<fidl::Channel> for MapperSessionSynchronousProxy {
3023 fn from(value: fidl::Channel) -> Self {
3024 Self::new(value)
3025 }
3026}
3027
3028#[cfg(target_os = "fuchsia")]
3029impl fidl::endpoints::FromClient for MapperSessionSynchronousProxy {
3030 type Protocol = MapperSessionMarker;
3031
3032 fn from_client(value: fidl::endpoints::ClientEnd<MapperSessionMarker>) -> Self {
3033 Self::new(value.into_channel())
3034 }
3035}
3036
3037#[derive(Debug, Clone)]
3038pub struct MapperSessionProxy {
3039 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3040}
3041
3042impl fidl::endpoints::Proxy for MapperSessionProxy {
3043 type Protocol = MapperSessionMarker;
3044
3045 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3046 Self::new(inner)
3047 }
3048
3049 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3050 self.client.into_channel().map_err(|client| Self { client })
3051 }
3052
3053 fn as_channel(&self) -> &::fidl::AsyncChannel {
3054 self.client.as_channel()
3055 }
3056}
3057
3058impl MapperSessionProxy {
3059 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3061 let protocol_name = <MapperSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3062 Self { client: fidl::client::Client::new(channel, protocol_name) }
3063 }
3064
3065 pub fn take_event_stream(&self) -> MapperSessionEventStream {
3071 MapperSessionEventStream { event_receiver: self.client.take_event_receiver() }
3072 }
3073
3074 pub fn r#close(
3085 &self,
3086 ) -> fidl::client::QueryResponseFut<
3087 fidl_fuchsia_unknown::CloseableCloseResult,
3088 fidl::encoding::DefaultFuchsiaResourceDialect,
3089 > {
3090 MapperSessionProxyInterface::r#close(self)
3091 }
3092
3093 pub fn r#create_vmo(
3096 &self,
3097 mut key: u64,
3098 mut size: u64,
3099 mut options: CreateVmoOptions,
3100 ) -> fidl::client::QueryResponseFut<
3101 MapperSessionCreateVmoResult,
3102 fidl::encoding::DefaultFuchsiaResourceDialect,
3103 > {
3104 MapperSessionProxyInterface::r#create_vmo(self, key, size, options)
3105 }
3106
3107 pub fn r#open_child_session(
3110 &self,
3111 mut session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
3112 mut mapping_vmo: fidl::Vmo,
3113 mut parent_key: u64,
3114 mut port: Option<fidl::Port>,
3115 mut delivery_queue: Option<fidl::Vmo>,
3116 ) -> fidl::client::QueryResponseFut<
3117 MapperSessionOpenChildSessionResult,
3118 fidl::encoding::DefaultFuchsiaResourceDialect,
3119 > {
3120 MapperSessionProxyInterface::r#open_child_session(
3121 self,
3122 session,
3123 mapping_vmo,
3124 parent_key,
3125 port,
3126 delivery_queue,
3127 )
3128 }
3129}
3130
3131impl MapperSessionProxyInterface for MapperSessionProxy {
3132 type CloseResponseFut = fidl::client::QueryResponseFut<
3133 fidl_fuchsia_unknown::CloseableCloseResult,
3134 fidl::encoding::DefaultFuchsiaResourceDialect,
3135 >;
3136 fn r#close(&self) -> Self::CloseResponseFut {
3137 fn _decode(
3138 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3139 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
3140 let _response = fidl::client::decode_transaction_body::<
3141 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3142 fidl::encoding::DefaultFuchsiaResourceDialect,
3143 0x5ac5d459ad7f657e,
3144 >(_buf?)?;
3145 Ok(_response.map(|x| x))
3146 }
3147 self.client.send_query_and_decode::<
3148 fidl::encoding::EmptyPayload,
3149 fidl_fuchsia_unknown::CloseableCloseResult,
3150 >(
3151 (),
3152 0x5ac5d459ad7f657e,
3153 fidl::encoding::DynamicFlags::empty(),
3154 _decode,
3155 )
3156 }
3157
3158 type CreateVmoResponseFut = fidl::client::QueryResponseFut<
3159 MapperSessionCreateVmoResult,
3160 fidl::encoding::DefaultFuchsiaResourceDialect,
3161 >;
3162 fn r#create_vmo(
3163 &self,
3164 mut key: u64,
3165 mut size: u64,
3166 mut options: CreateVmoOptions,
3167 ) -> Self::CreateVmoResponseFut {
3168 fn _decode(
3169 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3170 ) -> Result<MapperSessionCreateVmoResult, fidl::Error> {
3171 let _response = fidl::client::decode_transaction_body::<
3172 fidl::encoding::FlexibleResultType<MapperSessionCreateVmoResponse, i32>,
3173 fidl::encoding::DefaultFuchsiaResourceDialect,
3174 0x35be1bf1bd0f9e1d,
3175 >(_buf?)?
3176 .into_result::<MapperSessionMarker>("create_vmo")?;
3177 Ok(_response.map(|x| x.vmo))
3178 }
3179 self.client
3180 .send_query_and_decode::<MapperSessionCreateVmoRequest, MapperSessionCreateVmoResult>(
3181 (key, size, options),
3182 0x35be1bf1bd0f9e1d,
3183 fidl::encoding::DynamicFlags::FLEXIBLE,
3184 _decode,
3185 )
3186 }
3187
3188 type OpenChildSessionResponseFut = fidl::client::QueryResponseFut<
3189 MapperSessionOpenChildSessionResult,
3190 fidl::encoding::DefaultFuchsiaResourceDialect,
3191 >;
3192 fn r#open_child_session(
3193 &self,
3194 mut session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
3195 mut mapping_vmo: fidl::Vmo,
3196 mut parent_key: u64,
3197 mut port: Option<fidl::Port>,
3198 mut delivery_queue: Option<fidl::Vmo>,
3199 ) -> Self::OpenChildSessionResponseFut {
3200 fn _decode(
3201 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3202 ) -> Result<MapperSessionOpenChildSessionResult, fidl::Error> {
3203 let _response = fidl::client::decode_transaction_body::<
3204 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
3205 fidl::encoding::DefaultFuchsiaResourceDialect,
3206 0x7b80686acf9dcca3,
3207 >(_buf?)?
3208 .into_result::<MapperSessionMarker>("open_child_session")?;
3209 Ok(_response.map(|x| x))
3210 }
3211 self.client.send_query_and_decode::<
3212 MapperSessionOpenChildSessionRequest,
3213 MapperSessionOpenChildSessionResult,
3214 >(
3215 (session, mapping_vmo, parent_key, port, delivery_queue,),
3216 0x7b80686acf9dcca3,
3217 fidl::encoding::DynamicFlags::FLEXIBLE,
3218 _decode,
3219 )
3220 }
3221}
3222
3223pub struct MapperSessionEventStream {
3224 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3225}
3226
3227impl std::marker::Unpin for MapperSessionEventStream {}
3228
3229impl futures::stream::FusedStream for MapperSessionEventStream {
3230 fn is_terminated(&self) -> bool {
3231 self.event_receiver.is_terminated()
3232 }
3233}
3234
3235impl futures::Stream for MapperSessionEventStream {
3236 type Item = Result<MapperSessionEvent, fidl::Error>;
3237
3238 fn poll_next(
3239 mut self: std::pin::Pin<&mut Self>,
3240 cx: &mut std::task::Context<'_>,
3241 ) -> std::task::Poll<Option<Self::Item>> {
3242 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3243 &mut self.event_receiver,
3244 cx
3245 )?) {
3246 Some(buf) => std::task::Poll::Ready(Some(MapperSessionEvent::decode(buf))),
3247 None => std::task::Poll::Ready(None),
3248 }
3249 }
3250}
3251
3252#[derive(Debug)]
3253pub enum MapperSessionEvent {
3254 #[non_exhaustive]
3255 _UnknownEvent {
3256 ordinal: u64,
3258 },
3259}
3260
3261impl MapperSessionEvent {
3262 fn decode(
3264 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3265 ) -> Result<MapperSessionEvent, fidl::Error> {
3266 let (bytes, _handles) = buf.split_mut();
3267 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3268 debug_assert_eq!(tx_header.tx_id, 0);
3269 match tx_header.ordinal {
3270 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3271 Ok(MapperSessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3272 }
3273 _ => Err(fidl::Error::UnknownOrdinal {
3274 ordinal: tx_header.ordinal,
3275 protocol_name: <MapperSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3276 }),
3277 }
3278 }
3279}
3280
3281pub struct MapperSessionRequestStream {
3283 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3284 is_terminated: bool,
3285}
3286
3287impl std::marker::Unpin for MapperSessionRequestStream {}
3288
3289impl futures::stream::FusedStream for MapperSessionRequestStream {
3290 fn is_terminated(&self) -> bool {
3291 self.is_terminated
3292 }
3293}
3294
3295impl fidl::endpoints::RequestStream for MapperSessionRequestStream {
3296 type Protocol = MapperSessionMarker;
3297 type ControlHandle = MapperSessionControlHandle;
3298
3299 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3300 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3301 }
3302
3303 fn control_handle(&self) -> Self::ControlHandle {
3304 MapperSessionControlHandle { inner: self.inner.clone() }
3305 }
3306
3307 fn into_inner(
3308 self,
3309 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3310 {
3311 (self.inner, self.is_terminated)
3312 }
3313
3314 fn from_inner(
3315 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3316 is_terminated: bool,
3317 ) -> Self {
3318 Self { inner, is_terminated }
3319 }
3320}
3321
3322impl futures::Stream for MapperSessionRequestStream {
3323 type Item = Result<MapperSessionRequest, fidl::Error>;
3324
3325 fn poll_next(
3326 mut self: std::pin::Pin<&mut Self>,
3327 cx: &mut std::task::Context<'_>,
3328 ) -> std::task::Poll<Option<Self::Item>> {
3329 let this = &mut *self;
3330 if this.inner.check_shutdown(cx) {
3331 this.is_terminated = true;
3332 return std::task::Poll::Ready(None);
3333 }
3334 if this.is_terminated {
3335 panic!("polled MapperSessionRequestStream after completion");
3336 }
3337 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3338 |bytes, handles| {
3339 match this.inner.channel().read_etc(cx, bytes, handles) {
3340 std::task::Poll::Ready(Ok(())) => {}
3341 std::task::Poll::Pending => return std::task::Poll::Pending,
3342 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3343 this.is_terminated = true;
3344 return std::task::Poll::Ready(None);
3345 }
3346 std::task::Poll::Ready(Err(e)) => {
3347 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3348 e.into(),
3349 ))));
3350 }
3351 }
3352
3353 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3355
3356 std::task::Poll::Ready(Some(match header.ordinal {
3357 0x5ac5d459ad7f657e => {
3358 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3359 let mut req = fidl::new_empty!(
3360 fidl::encoding::EmptyPayload,
3361 fidl::encoding::DefaultFuchsiaResourceDialect
3362 );
3363 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3364 let control_handle =
3365 MapperSessionControlHandle { inner: this.inner.clone() };
3366 Ok(MapperSessionRequest::Close {
3367 responder: MapperSessionCloseResponder {
3368 control_handle: std::mem::ManuallyDrop::new(control_handle),
3369 tx_id: header.tx_id,
3370 },
3371 })
3372 }
3373 0x35be1bf1bd0f9e1d => {
3374 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3375 let mut req = fidl::new_empty!(
3376 MapperSessionCreateVmoRequest,
3377 fidl::encoding::DefaultFuchsiaResourceDialect
3378 );
3379 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MapperSessionCreateVmoRequest>(&header, _body_bytes, handles, &mut req)?;
3380 let control_handle =
3381 MapperSessionControlHandle { inner: this.inner.clone() };
3382 Ok(MapperSessionRequest::CreateVmo {
3383 key: req.key,
3384 size: req.size,
3385 options: req.options,
3386
3387 responder: MapperSessionCreateVmoResponder {
3388 control_handle: std::mem::ManuallyDrop::new(control_handle),
3389 tx_id: header.tx_id,
3390 },
3391 })
3392 }
3393 0x7b80686acf9dcca3 => {
3394 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3395 let mut req = fidl::new_empty!(
3396 MapperSessionOpenChildSessionRequest,
3397 fidl::encoding::DefaultFuchsiaResourceDialect
3398 );
3399 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MapperSessionOpenChildSessionRequest>(&header, _body_bytes, handles, &mut req)?;
3400 let control_handle =
3401 MapperSessionControlHandle { inner: this.inner.clone() };
3402 Ok(MapperSessionRequest::OpenChildSession {
3403 session: req.session,
3404 mapping_vmo: req.mapping_vmo,
3405 parent_key: req.parent_key,
3406 port: req.port,
3407 delivery_queue: req.delivery_queue,
3408
3409 responder: MapperSessionOpenChildSessionResponder {
3410 control_handle: std::mem::ManuallyDrop::new(control_handle),
3411 tx_id: header.tx_id,
3412 },
3413 })
3414 }
3415 _ if header.tx_id == 0
3416 && header
3417 .dynamic_flags()
3418 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3419 {
3420 Ok(MapperSessionRequest::_UnknownMethod {
3421 ordinal: header.ordinal,
3422 control_handle: MapperSessionControlHandle {
3423 inner: this.inner.clone(),
3424 },
3425 method_type: fidl::MethodType::OneWay,
3426 })
3427 }
3428 _ if header
3429 .dynamic_flags()
3430 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3431 {
3432 this.inner.send_framework_err(
3433 fidl::encoding::FrameworkErr::UnknownMethod,
3434 header.tx_id,
3435 header.ordinal,
3436 header.dynamic_flags(),
3437 (bytes, handles),
3438 )?;
3439 Ok(MapperSessionRequest::_UnknownMethod {
3440 ordinal: header.ordinal,
3441 control_handle: MapperSessionControlHandle {
3442 inner: this.inner.clone(),
3443 },
3444 method_type: fidl::MethodType::TwoWay,
3445 })
3446 }
3447 _ => Err(fidl::Error::UnknownOrdinal {
3448 ordinal: header.ordinal,
3449 protocol_name:
3450 <MapperSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3451 }),
3452 }))
3453 },
3454 )
3455 }
3456}
3457
3458#[derive(Debug)]
3460pub enum MapperSessionRequest {
3461 Close { responder: MapperSessionCloseResponder },
3472 CreateVmo {
3475 key: u64,
3476 size: u64,
3477 options: CreateVmoOptions,
3478 responder: MapperSessionCreateVmoResponder,
3479 },
3480 OpenChildSession {
3483 session: fidl::endpoints::ServerEnd<MapperSessionMarker>,
3484 mapping_vmo: fidl::Vmo,
3485 parent_key: u64,
3486 port: Option<fidl::Port>,
3487 delivery_queue: Option<fidl::Vmo>,
3488 responder: MapperSessionOpenChildSessionResponder,
3489 },
3490 #[non_exhaustive]
3492 _UnknownMethod {
3493 ordinal: u64,
3495 control_handle: MapperSessionControlHandle,
3496 method_type: fidl::MethodType,
3497 },
3498}
3499
3500impl MapperSessionRequest {
3501 #[allow(irrefutable_let_patterns)]
3502 pub fn into_close(self) -> Option<(MapperSessionCloseResponder)> {
3503 if let MapperSessionRequest::Close { responder } = self { Some((responder)) } else { None }
3504 }
3505
3506 #[allow(irrefutable_let_patterns)]
3507 pub fn into_create_vmo(
3508 self,
3509 ) -> Option<(u64, u64, CreateVmoOptions, MapperSessionCreateVmoResponder)> {
3510 if let MapperSessionRequest::CreateVmo { key, size, options, responder } = self {
3511 Some((key, size, options, responder))
3512 } else {
3513 None
3514 }
3515 }
3516
3517 #[allow(irrefutable_let_patterns)]
3518 pub fn into_open_child_session(
3519 self,
3520 ) -> Option<(
3521 fidl::endpoints::ServerEnd<MapperSessionMarker>,
3522 fidl::Vmo,
3523 u64,
3524 Option<fidl::Port>,
3525 Option<fidl::Vmo>,
3526 MapperSessionOpenChildSessionResponder,
3527 )> {
3528 if let MapperSessionRequest::OpenChildSession {
3529 session,
3530 mapping_vmo,
3531 parent_key,
3532 port,
3533 delivery_queue,
3534 responder,
3535 } = self
3536 {
3537 Some((session, mapping_vmo, parent_key, port, delivery_queue, responder))
3538 } else {
3539 None
3540 }
3541 }
3542
3543 pub fn method_name(&self) -> &'static str {
3545 match *self {
3546 MapperSessionRequest::Close { .. } => "close",
3547 MapperSessionRequest::CreateVmo { .. } => "create_vmo",
3548 MapperSessionRequest::OpenChildSession { .. } => "open_child_session",
3549 MapperSessionRequest::_UnknownMethod {
3550 method_type: fidl::MethodType::OneWay, ..
3551 } => "unknown one-way method",
3552 MapperSessionRequest::_UnknownMethod {
3553 method_type: fidl::MethodType::TwoWay, ..
3554 } => "unknown two-way method",
3555 }
3556 }
3557}
3558
3559#[derive(Debug, Clone)]
3560pub struct MapperSessionControlHandle {
3561 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3562}
3563
3564impl MapperSessionControlHandle {
3565 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3566 self.inner.shutdown_with_epitaph(status.into())
3567 }
3568}
3569
3570impl fidl::endpoints::ControlHandle for MapperSessionControlHandle {
3571 fn shutdown(&self) {
3572 self.inner.shutdown()
3573 }
3574
3575 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3576 self.inner.shutdown_with_epitaph(status)
3577 }
3578
3579 fn is_closed(&self) -> bool {
3580 self.inner.channel().is_closed()
3581 }
3582 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3583 self.inner.channel().on_closed()
3584 }
3585
3586 #[cfg(target_os = "fuchsia")]
3587 fn signal_peer(
3588 &self,
3589 clear_mask: zx::Signals,
3590 set_mask: zx::Signals,
3591 ) -> Result<(), zx_status::Status> {
3592 use fidl::Peered;
3593 self.inner.channel().signal_peer(clear_mask, set_mask)
3594 }
3595}
3596
3597impl MapperSessionControlHandle {}
3598
3599#[must_use = "FIDL methods require a response to be sent"]
3600#[derive(Debug)]
3601pub struct MapperSessionCloseResponder {
3602 control_handle: std::mem::ManuallyDrop<MapperSessionControlHandle>,
3603 tx_id: u32,
3604}
3605
3606impl std::ops::Drop for MapperSessionCloseResponder {
3610 fn drop(&mut self) {
3611 self.control_handle.shutdown();
3612 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3614 }
3615}
3616
3617impl fidl::endpoints::Responder for MapperSessionCloseResponder {
3618 type ControlHandle = MapperSessionControlHandle;
3619
3620 fn control_handle(&self) -> &MapperSessionControlHandle {
3621 &self.control_handle
3622 }
3623
3624 fn drop_without_shutdown(mut self) {
3625 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3627 std::mem::forget(self);
3629 }
3630}
3631
3632impl MapperSessionCloseResponder {
3633 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3637 let _result = self.send_raw(result);
3638 if _result.is_err() {
3639 self.control_handle.shutdown();
3640 }
3641 self.drop_without_shutdown();
3642 _result
3643 }
3644
3645 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3647 let _result = self.send_raw(result);
3648 self.drop_without_shutdown();
3649 _result
3650 }
3651
3652 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3653 self.control_handle
3654 .inner
3655 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3656 result,
3657 self.tx_id,
3658 0x5ac5d459ad7f657e,
3659 fidl::encoding::DynamicFlags::empty(),
3660 )
3661 }
3662}
3663
3664#[must_use = "FIDL methods require a response to be sent"]
3665#[derive(Debug)]
3666pub struct MapperSessionCreateVmoResponder {
3667 control_handle: std::mem::ManuallyDrop<MapperSessionControlHandle>,
3668 tx_id: u32,
3669}
3670
3671impl std::ops::Drop for MapperSessionCreateVmoResponder {
3675 fn drop(&mut self) {
3676 self.control_handle.shutdown();
3677 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3679 }
3680}
3681
3682impl fidl::endpoints::Responder for MapperSessionCreateVmoResponder {
3683 type ControlHandle = MapperSessionControlHandle;
3684
3685 fn control_handle(&self) -> &MapperSessionControlHandle {
3686 &self.control_handle
3687 }
3688
3689 fn drop_without_shutdown(mut self) {
3690 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3692 std::mem::forget(self);
3694 }
3695}
3696
3697impl MapperSessionCreateVmoResponder {
3698 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
3702 let _result = self.send_raw(result);
3703 if _result.is_err() {
3704 self.control_handle.shutdown();
3705 }
3706 self.drop_without_shutdown();
3707 _result
3708 }
3709
3710 pub fn send_no_shutdown_on_err(
3712 self,
3713 mut result: Result<fidl::Vmo, i32>,
3714 ) -> Result<(), fidl::Error> {
3715 let _result = self.send_raw(result);
3716 self.drop_without_shutdown();
3717 _result
3718 }
3719
3720 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
3721 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3722 MapperSessionCreateVmoResponse,
3723 i32,
3724 >>(
3725 fidl::encoding::FlexibleResult::new(result.map(|vmo| (vmo,))),
3726 self.tx_id,
3727 0x35be1bf1bd0f9e1d,
3728 fidl::encoding::DynamicFlags::FLEXIBLE,
3729 )
3730 }
3731}
3732
3733#[must_use = "FIDL methods require a response to be sent"]
3734#[derive(Debug)]
3735pub struct MapperSessionOpenChildSessionResponder {
3736 control_handle: std::mem::ManuallyDrop<MapperSessionControlHandle>,
3737 tx_id: u32,
3738}
3739
3740impl std::ops::Drop for MapperSessionOpenChildSessionResponder {
3744 fn drop(&mut self) {
3745 self.control_handle.shutdown();
3746 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3748 }
3749}
3750
3751impl fidl::endpoints::Responder for MapperSessionOpenChildSessionResponder {
3752 type ControlHandle = MapperSessionControlHandle;
3753
3754 fn control_handle(&self) -> &MapperSessionControlHandle {
3755 &self.control_handle
3756 }
3757
3758 fn drop_without_shutdown(mut self) {
3759 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3761 std::mem::forget(self);
3763 }
3764}
3765
3766impl MapperSessionOpenChildSessionResponder {
3767 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3771 let _result = self.send_raw(result);
3772 if _result.is_err() {
3773 self.control_handle.shutdown();
3774 }
3775 self.drop_without_shutdown();
3776 _result
3777 }
3778
3779 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3781 let _result = self.send_raw(result);
3782 self.drop_without_shutdown();
3783 _result
3784 }
3785
3786 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3787 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3788 fidl::encoding::EmptyStruct,
3789 i32,
3790 >>(
3791 fidl::encoding::FlexibleResult::new(result),
3792 self.tx_id,
3793 0x7b80686acf9dcca3,
3794 fidl::encoding::DynamicFlags::FLEXIBLE,
3795 )
3796 }
3797}
3798
3799#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3800pub struct SessionMarker;
3801
3802impl fidl::endpoints::ProtocolMarker for SessionMarker {
3803 type Proxy = SessionProxy;
3804 type RequestStream = SessionRequestStream;
3805 #[cfg(target_os = "fuchsia")]
3806 type SynchronousProxy = SessionSynchronousProxy;
3807
3808 const DEBUG_NAME: &'static str = "(anonymous) Session";
3809}
3810pub type SessionGetFifoResult = Result<fidl::Fifo, i32>;
3811pub type SessionAttachVmoResult = Result<VmoId, i32>;
3812
3813pub trait SessionProxyInterface: Send + Sync {
3814 type CloseResponseFut: std::future::Future<
3815 Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
3816 > + Send;
3817 fn r#close(&self) -> Self::CloseResponseFut;
3818 type GetFifoResponseFut: std::future::Future<Output = Result<SessionGetFifoResult, fidl::Error>>
3819 + Send;
3820 fn r#get_fifo(&self) -> Self::GetFifoResponseFut;
3821 type AttachVmoResponseFut: std::future::Future<Output = Result<SessionAttachVmoResult, fidl::Error>>
3822 + Send;
3823 fn r#attach_vmo(&self, vmo: fidl::Vmo) -> Self::AttachVmoResponseFut;
3824}
3825#[derive(Debug)]
3826#[cfg(target_os = "fuchsia")]
3827pub struct SessionSynchronousProxy {
3828 client: fidl::client::sync::Client,
3829}
3830
3831#[cfg(target_os = "fuchsia")]
3832impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
3833 type Proxy = SessionProxy;
3834 type Protocol = SessionMarker;
3835
3836 fn from_channel(inner: fidl::Channel) -> Self {
3837 Self::new(inner)
3838 }
3839
3840 fn into_channel(self) -> fidl::Channel {
3841 self.client.into_channel()
3842 }
3843
3844 fn as_channel(&self) -> &fidl::Channel {
3845 self.client.as_channel()
3846 }
3847}
3848
3849#[cfg(target_os = "fuchsia")]
3850impl SessionSynchronousProxy {
3851 pub fn new(channel: fidl::Channel) -> Self {
3852 Self { client: fidl::client::sync::Client::new(channel) }
3853 }
3854
3855 pub fn into_channel(self) -> fidl::Channel {
3856 self.client.into_channel()
3857 }
3858
3859 pub fn wait_for_event(
3862 &self,
3863 deadline: zx::MonotonicInstant,
3864 ) -> Result<SessionEvent, fidl::Error> {
3865 SessionEvent::decode(self.client.wait_for_event::<SessionMarker>(deadline)?)
3866 }
3867
3868 pub fn r#close(
3879 &self,
3880 ___deadline: zx::MonotonicInstant,
3881 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
3882 let _response = self.client.send_query::<
3883 fidl::encoding::EmptyPayload,
3884 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3885 SessionMarker,
3886 >(
3887 (),
3888 0x5ac5d459ad7f657e,
3889 fidl::encoding::DynamicFlags::empty(),
3890 ___deadline,
3891 )?;
3892 Ok(_response.map(|x| x))
3893 }
3894
3895 pub fn r#get_fifo(
3897 &self,
3898 ___deadline: zx::MonotonicInstant,
3899 ) -> Result<SessionGetFifoResult, fidl::Error> {
3900 let _response = self.client.send_query::<
3901 fidl::encoding::EmptyPayload,
3902 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
3903 SessionMarker,
3904 >(
3905 (),
3906 0x7a6c7610912aaa98,
3907 fidl::encoding::DynamicFlags::empty(),
3908 ___deadline,
3909 )?;
3910 Ok(_response.map(|x| x.fifo))
3911 }
3912
3913 pub fn r#attach_vmo(
3918 &self,
3919 mut vmo: fidl::Vmo,
3920 ___deadline: zx::MonotonicInstant,
3921 ) -> Result<SessionAttachVmoResult, fidl::Error> {
3922 let _response = self.client.send_query::<
3923 SessionAttachVmoRequest,
3924 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
3925 SessionMarker,
3926 >(
3927 (vmo,),
3928 0x677a0f6fd1a370b2,
3929 fidl::encoding::DynamicFlags::empty(),
3930 ___deadline,
3931 )?;
3932 Ok(_response.map(|x| x.vmoid))
3933 }
3934}
3935
3936#[cfg(target_os = "fuchsia")]
3937impl From<SessionSynchronousProxy> for zx::NullableHandle {
3938 fn from(value: SessionSynchronousProxy) -> Self {
3939 value.into_channel().into()
3940 }
3941}
3942
3943#[cfg(target_os = "fuchsia")]
3944impl From<fidl::Channel> for SessionSynchronousProxy {
3945 fn from(value: fidl::Channel) -> Self {
3946 Self::new(value)
3947 }
3948}
3949
3950#[cfg(target_os = "fuchsia")]
3951impl fidl::endpoints::FromClient for SessionSynchronousProxy {
3952 type Protocol = SessionMarker;
3953
3954 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
3955 Self::new(value.into_channel())
3956 }
3957}
3958
3959#[derive(Debug, Clone)]
3960pub struct SessionProxy {
3961 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3962}
3963
3964impl fidl::endpoints::Proxy for SessionProxy {
3965 type Protocol = SessionMarker;
3966
3967 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3968 Self::new(inner)
3969 }
3970
3971 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3972 self.client.into_channel().map_err(|client| Self { client })
3973 }
3974
3975 fn as_channel(&self) -> &::fidl::AsyncChannel {
3976 self.client.as_channel()
3977 }
3978}
3979
3980impl SessionProxy {
3981 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3983 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3984 Self { client: fidl::client::Client::new(channel, protocol_name) }
3985 }
3986
3987 pub fn take_event_stream(&self) -> SessionEventStream {
3993 SessionEventStream { event_receiver: self.client.take_event_receiver() }
3994 }
3995
3996 pub fn r#close(
4007 &self,
4008 ) -> fidl::client::QueryResponseFut<
4009 fidl_fuchsia_unknown::CloseableCloseResult,
4010 fidl::encoding::DefaultFuchsiaResourceDialect,
4011 > {
4012 SessionProxyInterface::r#close(self)
4013 }
4014
4015 pub fn r#get_fifo(
4017 &self,
4018 ) -> fidl::client::QueryResponseFut<
4019 SessionGetFifoResult,
4020 fidl::encoding::DefaultFuchsiaResourceDialect,
4021 > {
4022 SessionProxyInterface::r#get_fifo(self)
4023 }
4024
4025 pub fn r#attach_vmo(
4030 &self,
4031 mut vmo: fidl::Vmo,
4032 ) -> fidl::client::QueryResponseFut<
4033 SessionAttachVmoResult,
4034 fidl::encoding::DefaultFuchsiaResourceDialect,
4035 > {
4036 SessionProxyInterface::r#attach_vmo(self, vmo)
4037 }
4038}
4039
4040impl SessionProxyInterface for SessionProxy {
4041 type CloseResponseFut = fidl::client::QueryResponseFut<
4042 fidl_fuchsia_unknown::CloseableCloseResult,
4043 fidl::encoding::DefaultFuchsiaResourceDialect,
4044 >;
4045 fn r#close(&self) -> Self::CloseResponseFut {
4046 fn _decode(
4047 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4048 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
4049 let _response = fidl::client::decode_transaction_body::<
4050 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4051 fidl::encoding::DefaultFuchsiaResourceDialect,
4052 0x5ac5d459ad7f657e,
4053 >(_buf?)?;
4054 Ok(_response.map(|x| x))
4055 }
4056 self.client.send_query_and_decode::<
4057 fidl::encoding::EmptyPayload,
4058 fidl_fuchsia_unknown::CloseableCloseResult,
4059 >(
4060 (),
4061 0x5ac5d459ad7f657e,
4062 fidl::encoding::DynamicFlags::empty(),
4063 _decode,
4064 )
4065 }
4066
4067 type GetFifoResponseFut = fidl::client::QueryResponseFut<
4068 SessionGetFifoResult,
4069 fidl::encoding::DefaultFuchsiaResourceDialect,
4070 >;
4071 fn r#get_fifo(&self) -> Self::GetFifoResponseFut {
4072 fn _decode(
4073 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4074 ) -> Result<SessionGetFifoResult, fidl::Error> {
4075 let _response = fidl::client::decode_transaction_body::<
4076 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
4077 fidl::encoding::DefaultFuchsiaResourceDialect,
4078 0x7a6c7610912aaa98,
4079 >(_buf?)?;
4080 Ok(_response.map(|x| x.fifo))
4081 }
4082 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionGetFifoResult>(
4083 (),
4084 0x7a6c7610912aaa98,
4085 fidl::encoding::DynamicFlags::empty(),
4086 _decode,
4087 )
4088 }
4089
4090 type AttachVmoResponseFut = fidl::client::QueryResponseFut<
4091 SessionAttachVmoResult,
4092 fidl::encoding::DefaultFuchsiaResourceDialect,
4093 >;
4094 fn r#attach_vmo(&self, mut vmo: fidl::Vmo) -> Self::AttachVmoResponseFut {
4095 fn _decode(
4096 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4097 ) -> Result<SessionAttachVmoResult, fidl::Error> {
4098 let _response = fidl::client::decode_transaction_body::<
4099 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
4100 fidl::encoding::DefaultFuchsiaResourceDialect,
4101 0x677a0f6fd1a370b2,
4102 >(_buf?)?;
4103 Ok(_response.map(|x| x.vmoid))
4104 }
4105 self.client.send_query_and_decode::<SessionAttachVmoRequest, SessionAttachVmoResult>(
4106 (vmo,),
4107 0x677a0f6fd1a370b2,
4108 fidl::encoding::DynamicFlags::empty(),
4109 _decode,
4110 )
4111 }
4112}
4113
4114pub struct SessionEventStream {
4115 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4116}
4117
4118impl std::marker::Unpin for SessionEventStream {}
4119
4120impl futures::stream::FusedStream for SessionEventStream {
4121 fn is_terminated(&self) -> bool {
4122 self.event_receiver.is_terminated()
4123 }
4124}
4125
4126impl futures::Stream for SessionEventStream {
4127 type Item = Result<SessionEvent, fidl::Error>;
4128
4129 fn poll_next(
4130 mut self: std::pin::Pin<&mut Self>,
4131 cx: &mut std::task::Context<'_>,
4132 ) -> std::task::Poll<Option<Self::Item>> {
4133 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4134 &mut self.event_receiver,
4135 cx
4136 )?) {
4137 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
4138 None => std::task::Poll::Ready(None),
4139 }
4140 }
4141}
4142
4143#[derive(Debug)]
4144pub enum SessionEvent {}
4145
4146impl SessionEvent {
4147 fn decode(
4149 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4150 ) -> Result<SessionEvent, fidl::Error> {
4151 let (bytes, _handles) = buf.split_mut();
4152 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4153 debug_assert_eq!(tx_header.tx_id, 0);
4154 match tx_header.ordinal {
4155 _ => Err(fidl::Error::UnknownOrdinal {
4156 ordinal: tx_header.ordinal,
4157 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4158 }),
4159 }
4160 }
4161}
4162
4163pub struct SessionRequestStream {
4165 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4166 is_terminated: bool,
4167}
4168
4169impl std::marker::Unpin for SessionRequestStream {}
4170
4171impl futures::stream::FusedStream for SessionRequestStream {
4172 fn is_terminated(&self) -> bool {
4173 self.is_terminated
4174 }
4175}
4176
4177impl fidl::endpoints::RequestStream for SessionRequestStream {
4178 type Protocol = SessionMarker;
4179 type ControlHandle = SessionControlHandle;
4180
4181 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4182 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4183 }
4184
4185 fn control_handle(&self) -> Self::ControlHandle {
4186 SessionControlHandle { inner: self.inner.clone() }
4187 }
4188
4189 fn into_inner(
4190 self,
4191 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4192 {
4193 (self.inner, self.is_terminated)
4194 }
4195
4196 fn from_inner(
4197 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4198 is_terminated: bool,
4199 ) -> Self {
4200 Self { inner, is_terminated }
4201 }
4202}
4203
4204impl futures::Stream for SessionRequestStream {
4205 type Item = Result<SessionRequest, fidl::Error>;
4206
4207 fn poll_next(
4208 mut self: std::pin::Pin<&mut Self>,
4209 cx: &mut std::task::Context<'_>,
4210 ) -> std::task::Poll<Option<Self::Item>> {
4211 let this = &mut *self;
4212 if this.inner.check_shutdown(cx) {
4213 this.is_terminated = true;
4214 return std::task::Poll::Ready(None);
4215 }
4216 if this.is_terminated {
4217 panic!("polled SessionRequestStream after completion");
4218 }
4219 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4220 |bytes, handles| {
4221 match this.inner.channel().read_etc(cx, bytes, handles) {
4222 std::task::Poll::Ready(Ok(())) => {}
4223 std::task::Poll::Pending => return std::task::Poll::Pending,
4224 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4225 this.is_terminated = true;
4226 return std::task::Poll::Ready(None);
4227 }
4228 std::task::Poll::Ready(Err(e)) => {
4229 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4230 e.into(),
4231 ))));
4232 }
4233 }
4234
4235 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4237
4238 std::task::Poll::Ready(Some(match header.ordinal {
4239 0x5ac5d459ad7f657e => {
4240 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4241 let mut req = fidl::new_empty!(
4242 fidl::encoding::EmptyPayload,
4243 fidl::encoding::DefaultFuchsiaResourceDialect
4244 );
4245 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4246 let control_handle = SessionControlHandle { inner: this.inner.clone() };
4247 Ok(SessionRequest::Close {
4248 responder: SessionCloseResponder {
4249 control_handle: std::mem::ManuallyDrop::new(control_handle),
4250 tx_id: header.tx_id,
4251 },
4252 })
4253 }
4254 0x7a6c7610912aaa98 => {
4255 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4256 let mut req = fidl::new_empty!(
4257 fidl::encoding::EmptyPayload,
4258 fidl::encoding::DefaultFuchsiaResourceDialect
4259 );
4260 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4261 let control_handle = SessionControlHandle { inner: this.inner.clone() };
4262 Ok(SessionRequest::GetFifo {
4263 responder: SessionGetFifoResponder {
4264 control_handle: std::mem::ManuallyDrop::new(control_handle),
4265 tx_id: header.tx_id,
4266 },
4267 })
4268 }
4269 0x677a0f6fd1a370b2 => {
4270 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4271 let mut req = fidl::new_empty!(
4272 SessionAttachVmoRequest,
4273 fidl::encoding::DefaultFuchsiaResourceDialect
4274 );
4275 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachVmoRequest>(&header, _body_bytes, handles, &mut req)?;
4276 let control_handle = SessionControlHandle { inner: this.inner.clone() };
4277 Ok(SessionRequest::AttachVmo {
4278 vmo: req.vmo,
4279
4280 responder: SessionAttachVmoResponder {
4281 control_handle: std::mem::ManuallyDrop::new(control_handle),
4282 tx_id: header.tx_id,
4283 },
4284 })
4285 }
4286 _ => Err(fidl::Error::UnknownOrdinal {
4287 ordinal: header.ordinal,
4288 protocol_name:
4289 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4290 }),
4291 }))
4292 },
4293 )
4294 }
4295}
4296
4297#[derive(Debug)]
4307pub enum SessionRequest {
4308 Close { responder: SessionCloseResponder },
4319 GetFifo { responder: SessionGetFifoResponder },
4321 AttachVmo { vmo: fidl::Vmo, responder: SessionAttachVmoResponder },
4326}
4327
4328impl SessionRequest {
4329 #[allow(irrefutable_let_patterns)]
4330 pub fn into_close(self) -> Option<(SessionCloseResponder)> {
4331 if let SessionRequest::Close { responder } = self { Some((responder)) } else { None }
4332 }
4333
4334 #[allow(irrefutable_let_patterns)]
4335 pub fn into_get_fifo(self) -> Option<(SessionGetFifoResponder)> {
4336 if let SessionRequest::GetFifo { responder } = self { Some((responder)) } else { None }
4337 }
4338
4339 #[allow(irrefutable_let_patterns)]
4340 pub fn into_attach_vmo(self) -> Option<(fidl::Vmo, SessionAttachVmoResponder)> {
4341 if let SessionRequest::AttachVmo { vmo, responder } = self {
4342 Some((vmo, responder))
4343 } else {
4344 None
4345 }
4346 }
4347
4348 pub fn method_name(&self) -> &'static str {
4350 match *self {
4351 SessionRequest::Close { .. } => "close",
4352 SessionRequest::GetFifo { .. } => "get_fifo",
4353 SessionRequest::AttachVmo { .. } => "attach_vmo",
4354 }
4355 }
4356}
4357
4358#[derive(Debug, Clone)]
4359pub struct SessionControlHandle {
4360 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4361}
4362
4363impl SessionControlHandle {
4364 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4365 self.inner.shutdown_with_epitaph(status.into())
4366 }
4367}
4368
4369impl fidl::endpoints::ControlHandle for SessionControlHandle {
4370 fn shutdown(&self) {
4371 self.inner.shutdown()
4372 }
4373
4374 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4375 self.inner.shutdown_with_epitaph(status)
4376 }
4377
4378 fn is_closed(&self) -> bool {
4379 self.inner.channel().is_closed()
4380 }
4381 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4382 self.inner.channel().on_closed()
4383 }
4384
4385 #[cfg(target_os = "fuchsia")]
4386 fn signal_peer(
4387 &self,
4388 clear_mask: zx::Signals,
4389 set_mask: zx::Signals,
4390 ) -> Result<(), zx_status::Status> {
4391 use fidl::Peered;
4392 self.inner.channel().signal_peer(clear_mask, set_mask)
4393 }
4394}
4395
4396impl SessionControlHandle {}
4397
4398#[must_use = "FIDL methods require a response to be sent"]
4399#[derive(Debug)]
4400pub struct SessionCloseResponder {
4401 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
4402 tx_id: u32,
4403}
4404
4405impl std::ops::Drop for SessionCloseResponder {
4409 fn drop(&mut self) {
4410 self.control_handle.shutdown();
4411 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4413 }
4414}
4415
4416impl fidl::endpoints::Responder for SessionCloseResponder {
4417 type ControlHandle = SessionControlHandle;
4418
4419 fn control_handle(&self) -> &SessionControlHandle {
4420 &self.control_handle
4421 }
4422
4423 fn drop_without_shutdown(mut self) {
4424 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4426 std::mem::forget(self);
4428 }
4429}
4430
4431impl SessionCloseResponder {
4432 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4436 let _result = self.send_raw(result);
4437 if _result.is_err() {
4438 self.control_handle.shutdown();
4439 }
4440 self.drop_without_shutdown();
4441 _result
4442 }
4443
4444 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4446 let _result = self.send_raw(result);
4447 self.drop_without_shutdown();
4448 _result
4449 }
4450
4451 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4452 self.control_handle
4453 .inner
4454 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4455 result,
4456 self.tx_id,
4457 0x5ac5d459ad7f657e,
4458 fidl::encoding::DynamicFlags::empty(),
4459 )
4460 }
4461}
4462
4463#[must_use = "FIDL methods require a response to be sent"]
4464#[derive(Debug)]
4465pub struct SessionGetFifoResponder {
4466 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
4467 tx_id: u32,
4468}
4469
4470impl std::ops::Drop for SessionGetFifoResponder {
4474 fn drop(&mut self) {
4475 self.control_handle.shutdown();
4476 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4478 }
4479}
4480
4481impl fidl::endpoints::Responder for SessionGetFifoResponder {
4482 type ControlHandle = SessionControlHandle;
4483
4484 fn control_handle(&self) -> &SessionControlHandle {
4485 &self.control_handle
4486 }
4487
4488 fn drop_without_shutdown(mut self) {
4489 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4491 std::mem::forget(self);
4493 }
4494}
4495
4496impl SessionGetFifoResponder {
4497 pub fn send(self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
4501 let _result = self.send_raw(result);
4502 if _result.is_err() {
4503 self.control_handle.shutdown();
4504 }
4505 self.drop_without_shutdown();
4506 _result
4507 }
4508
4509 pub fn send_no_shutdown_on_err(
4511 self,
4512 mut result: Result<fidl::Fifo, i32>,
4513 ) -> Result<(), fidl::Error> {
4514 let _result = self.send_raw(result);
4515 self.drop_without_shutdown();
4516 _result
4517 }
4518
4519 fn send_raw(&self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
4520 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionGetFifoResponse, i32>>(
4521 result.map(|fifo| (fifo,)),
4522 self.tx_id,
4523 0x7a6c7610912aaa98,
4524 fidl::encoding::DynamicFlags::empty(),
4525 )
4526 }
4527}
4528
4529#[must_use = "FIDL methods require a response to be sent"]
4530#[derive(Debug)]
4531pub struct SessionAttachVmoResponder {
4532 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
4533 tx_id: u32,
4534}
4535
4536impl std::ops::Drop for SessionAttachVmoResponder {
4540 fn drop(&mut self) {
4541 self.control_handle.shutdown();
4542 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4544 }
4545}
4546
4547impl fidl::endpoints::Responder for SessionAttachVmoResponder {
4548 type ControlHandle = SessionControlHandle;
4549
4550 fn control_handle(&self) -> &SessionControlHandle {
4551 &self.control_handle
4552 }
4553
4554 fn drop_without_shutdown(mut self) {
4555 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4557 std::mem::forget(self);
4559 }
4560}
4561
4562impl SessionAttachVmoResponder {
4563 pub fn send(self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
4567 let _result = self.send_raw(result);
4568 if _result.is_err() {
4569 self.control_handle.shutdown();
4570 }
4571 self.drop_without_shutdown();
4572 _result
4573 }
4574
4575 pub fn send_no_shutdown_on_err(
4577 self,
4578 mut result: Result<&VmoId, i32>,
4579 ) -> Result<(), fidl::Error> {
4580 let _result = self.send_raw(result);
4581 self.drop_without_shutdown();
4582 _result
4583 }
4584
4585 fn send_raw(&self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
4586 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionAttachVmoResponse, i32>>(
4587 result.map(|vmoid| (vmoid,)),
4588 self.tx_id,
4589 0x677a0f6fd1a370b2,
4590 fidl::encoding::DynamicFlags::empty(),
4591 )
4592 }
4593}
4594
4595#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4596pub struct VolumeManagerMarker;
4597
4598impl fidl::endpoints::ProtocolMarker for VolumeManagerMarker {
4599 type Proxy = VolumeManagerProxy;
4600 type RequestStream = VolumeManagerRequestStream;
4601 #[cfg(target_os = "fuchsia")]
4602 type SynchronousProxy = VolumeManagerSynchronousProxy;
4603
4604 const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
4605}
4606pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
4607
4608pub trait VolumeManagerProxyInterface: Send + Sync {
4609 type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
4610 fn r#allocate_partition(
4611 &self,
4612 slice_count: u64,
4613 type_: &Guid,
4614 instance: &Guid,
4615 name: &str,
4616 flags: u32,
4617 ) -> Self::AllocatePartitionResponseFut;
4618 type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
4619 + Send;
4620 fn r#get_info(&self) -> Self::GetInfoResponseFut;
4621 type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
4622 fn r#activate(&self, old_guid: &Guid, new_guid: &Guid) -> Self::ActivateResponseFut;
4623 type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
4624 + Send;
4625 fn r#get_partition_limit(&self, guid: &Guid) -> Self::GetPartitionLimitResponseFut;
4626 type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
4627 fn r#set_partition_limit(
4628 &self,
4629 guid: &Guid,
4630 slice_count: u64,
4631 ) -> Self::SetPartitionLimitResponseFut;
4632 type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
4633 + Send;
4634 fn r#set_partition_name(&self, guid: &Guid, name: &str) -> Self::SetPartitionNameResponseFut;
4635}
4636#[derive(Debug)]
4637#[cfg(target_os = "fuchsia")]
4638pub struct VolumeManagerSynchronousProxy {
4639 client: fidl::client::sync::Client,
4640}
4641
4642#[cfg(target_os = "fuchsia")]
4643impl fidl::endpoints::SynchronousProxy for VolumeManagerSynchronousProxy {
4644 type Proxy = VolumeManagerProxy;
4645 type Protocol = VolumeManagerMarker;
4646
4647 fn from_channel(inner: fidl::Channel) -> Self {
4648 Self::new(inner)
4649 }
4650
4651 fn into_channel(self) -> fidl::Channel {
4652 self.client.into_channel()
4653 }
4654
4655 fn as_channel(&self) -> &fidl::Channel {
4656 self.client.as_channel()
4657 }
4658}
4659
4660#[cfg(target_os = "fuchsia")]
4661impl VolumeManagerSynchronousProxy {
4662 pub fn new(channel: fidl::Channel) -> Self {
4663 Self { client: fidl::client::sync::Client::new(channel) }
4664 }
4665
4666 pub fn into_channel(self) -> fidl::Channel {
4667 self.client.into_channel()
4668 }
4669
4670 pub fn wait_for_event(
4673 &self,
4674 deadline: zx::MonotonicInstant,
4675 ) -> Result<VolumeManagerEvent, fidl::Error> {
4676 VolumeManagerEvent::decode(self.client.wait_for_event::<VolumeManagerMarker>(deadline)?)
4677 }
4678
4679 pub fn r#allocate_partition(
4686 &self,
4687 mut slice_count: u64,
4688 mut type_: &Guid,
4689 mut instance: &Guid,
4690 mut name: &str,
4691 mut flags: u32,
4692 ___deadline: zx::MonotonicInstant,
4693 ) -> Result<i32, fidl::Error> {
4694 let _response = self.client.send_query::<
4695 VolumeManagerAllocatePartitionRequest,
4696 VolumeManagerAllocatePartitionResponse,
4697 VolumeManagerMarker,
4698 >(
4699 (slice_count, type_, instance, name, flags,),
4700 0x5db528bfc287b696,
4701 fidl::encoding::DynamicFlags::empty(),
4702 ___deadline,
4703 )?;
4704 Ok(_response.status)
4705 }
4706
4707 pub fn r#get_info(
4715 &self,
4716 ___deadline: zx::MonotonicInstant,
4717 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
4718 let _response = self.client.send_query::<
4719 fidl::encoding::EmptyPayload,
4720 VolumeManagerGetInfoResponse,
4721 VolumeManagerMarker,
4722 >(
4723 (),
4724 0x2611214dcca5b064,
4725 fidl::encoding::DynamicFlags::empty(),
4726 ___deadline,
4727 )?;
4728 Ok((_response.status, _response.info))
4729 }
4730
4731 pub fn r#activate(
4747 &self,
4748 mut old_guid: &Guid,
4749 mut new_guid: &Guid,
4750 ___deadline: zx::MonotonicInstant,
4751 ) -> Result<i32, fidl::Error> {
4752 let _response = self.client.send_query::<
4753 VolumeManagerActivateRequest,
4754 VolumeManagerActivateResponse,
4755 VolumeManagerMarker,
4756 >(
4757 (old_guid, new_guid,),
4758 0x182238d40c275be,
4759 fidl::encoding::DynamicFlags::empty(),
4760 ___deadline,
4761 )?;
4762 Ok(_response.status)
4763 }
4764
4765 pub fn r#get_partition_limit(
4775 &self,
4776 mut guid: &Guid,
4777 ___deadline: zx::MonotonicInstant,
4778 ) -> Result<(i32, u64), fidl::Error> {
4779 let _response = self.client.send_query::<
4780 VolumeManagerGetPartitionLimitRequest,
4781 VolumeManagerGetPartitionLimitResponse,
4782 VolumeManagerMarker,
4783 >(
4784 (guid,),
4785 0x5bc9d21ea8bd52db,
4786 fidl::encoding::DynamicFlags::empty(),
4787 ___deadline,
4788 )?;
4789 Ok((_response.status, _response.slice_count))
4790 }
4791
4792 pub fn r#set_partition_limit(
4804 &self,
4805 mut guid: &Guid,
4806 mut slice_count: u64,
4807 ___deadline: zx::MonotonicInstant,
4808 ) -> Result<i32, fidl::Error> {
4809 let _response = self.client.send_query::<
4810 VolumeManagerSetPartitionLimitRequest,
4811 VolumeManagerSetPartitionLimitResponse,
4812 VolumeManagerMarker,
4813 >(
4814 (guid, slice_count,),
4815 0x3a4903076534c093,
4816 fidl::encoding::DynamicFlags::empty(),
4817 ___deadline,
4818 )?;
4819 Ok(_response.status)
4820 }
4821
4822 pub fn r#set_partition_name(
4826 &self,
4827 mut guid: &Guid,
4828 mut name: &str,
4829 ___deadline: zx::MonotonicInstant,
4830 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
4831 let _response = self.client.send_query::<
4832 VolumeManagerSetPartitionNameRequest,
4833 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4834 VolumeManagerMarker,
4835 >(
4836 (guid, name,),
4837 0x26afb07b9d70ff1a,
4838 fidl::encoding::DynamicFlags::empty(),
4839 ___deadline,
4840 )?;
4841 Ok(_response.map(|x| x))
4842 }
4843}
4844
4845#[cfg(target_os = "fuchsia")]
4846impl From<VolumeManagerSynchronousProxy> for zx::NullableHandle {
4847 fn from(value: VolumeManagerSynchronousProxy) -> Self {
4848 value.into_channel().into()
4849 }
4850}
4851
4852#[cfg(target_os = "fuchsia")]
4853impl From<fidl::Channel> for VolumeManagerSynchronousProxy {
4854 fn from(value: fidl::Channel) -> Self {
4855 Self::new(value)
4856 }
4857}
4858
4859#[cfg(target_os = "fuchsia")]
4860impl fidl::endpoints::FromClient for VolumeManagerSynchronousProxy {
4861 type Protocol = VolumeManagerMarker;
4862
4863 fn from_client(value: fidl::endpoints::ClientEnd<VolumeManagerMarker>) -> Self {
4864 Self::new(value.into_channel())
4865 }
4866}
4867
4868#[derive(Debug, Clone)]
4869pub struct VolumeManagerProxy {
4870 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4871}
4872
4873impl fidl::endpoints::Proxy for VolumeManagerProxy {
4874 type Protocol = VolumeManagerMarker;
4875
4876 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4877 Self::new(inner)
4878 }
4879
4880 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4881 self.client.into_channel().map_err(|client| Self { client })
4882 }
4883
4884 fn as_channel(&self) -> &::fidl::AsyncChannel {
4885 self.client.as_channel()
4886 }
4887}
4888
4889impl VolumeManagerProxy {
4890 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4892 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4893 Self { client: fidl::client::Client::new(channel, protocol_name) }
4894 }
4895
4896 pub fn take_event_stream(&self) -> VolumeManagerEventStream {
4902 VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
4903 }
4904
4905 pub fn r#allocate_partition(
4912 &self,
4913 mut slice_count: u64,
4914 mut type_: &Guid,
4915 mut instance: &Guid,
4916 mut name: &str,
4917 mut flags: u32,
4918 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4919 VolumeManagerProxyInterface::r#allocate_partition(
4920 self,
4921 slice_count,
4922 type_,
4923 instance,
4924 name,
4925 flags,
4926 )
4927 }
4928
4929 pub fn r#get_info(
4937 &self,
4938 ) -> fidl::client::QueryResponseFut<
4939 (i32, Option<Box<VolumeManagerInfo>>),
4940 fidl::encoding::DefaultFuchsiaResourceDialect,
4941 > {
4942 VolumeManagerProxyInterface::r#get_info(self)
4943 }
4944
4945 pub fn r#activate(
4961 &self,
4962 mut old_guid: &Guid,
4963 mut new_guid: &Guid,
4964 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4965 VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
4966 }
4967
4968 pub fn r#get_partition_limit(
4978 &self,
4979 mut guid: &Guid,
4980 ) -> fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
4981 {
4982 VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
4983 }
4984
4985 pub fn r#set_partition_limit(
4997 &self,
4998 mut guid: &Guid,
4999 mut slice_count: u64,
5000 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5001 VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
5002 }
5003
5004 pub fn r#set_partition_name(
5008 &self,
5009 mut guid: &Guid,
5010 mut name: &str,
5011 ) -> fidl::client::QueryResponseFut<
5012 VolumeManagerSetPartitionNameResult,
5013 fidl::encoding::DefaultFuchsiaResourceDialect,
5014 > {
5015 VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
5016 }
5017}
5018
5019impl VolumeManagerProxyInterface for VolumeManagerProxy {
5020 type AllocatePartitionResponseFut =
5021 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5022 fn r#allocate_partition(
5023 &self,
5024 mut slice_count: u64,
5025 mut type_: &Guid,
5026 mut instance: &Guid,
5027 mut name: &str,
5028 mut flags: u32,
5029 ) -> Self::AllocatePartitionResponseFut {
5030 fn _decode(
5031 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5032 ) -> Result<i32, fidl::Error> {
5033 let _response = fidl::client::decode_transaction_body::<
5034 VolumeManagerAllocatePartitionResponse,
5035 fidl::encoding::DefaultFuchsiaResourceDialect,
5036 0x5db528bfc287b696,
5037 >(_buf?)?;
5038 Ok(_response.status)
5039 }
5040 self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
5041 (slice_count, type_, instance, name, flags),
5042 0x5db528bfc287b696,
5043 fidl::encoding::DynamicFlags::empty(),
5044 _decode,
5045 )
5046 }
5047
5048 type GetInfoResponseFut = fidl::client::QueryResponseFut<
5049 (i32, Option<Box<VolumeManagerInfo>>),
5050 fidl::encoding::DefaultFuchsiaResourceDialect,
5051 >;
5052 fn r#get_info(&self) -> Self::GetInfoResponseFut {
5053 fn _decode(
5054 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5055 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
5056 let _response = fidl::client::decode_transaction_body::<
5057 VolumeManagerGetInfoResponse,
5058 fidl::encoding::DefaultFuchsiaResourceDialect,
5059 0x2611214dcca5b064,
5060 >(_buf?)?;
5061 Ok((_response.status, _response.info))
5062 }
5063 self.client.send_query_and_decode::<
5064 fidl::encoding::EmptyPayload,
5065 (i32, Option<Box<VolumeManagerInfo>>),
5066 >(
5067 (),
5068 0x2611214dcca5b064,
5069 fidl::encoding::DynamicFlags::empty(),
5070 _decode,
5071 )
5072 }
5073
5074 type ActivateResponseFut =
5075 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5076 fn r#activate(&self, mut old_guid: &Guid, mut new_guid: &Guid) -> Self::ActivateResponseFut {
5077 fn _decode(
5078 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5079 ) -> Result<i32, fidl::Error> {
5080 let _response = fidl::client::decode_transaction_body::<
5081 VolumeManagerActivateResponse,
5082 fidl::encoding::DefaultFuchsiaResourceDialect,
5083 0x182238d40c275be,
5084 >(_buf?)?;
5085 Ok(_response.status)
5086 }
5087 self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
5088 (old_guid, new_guid),
5089 0x182238d40c275be,
5090 fidl::encoding::DynamicFlags::empty(),
5091 _decode,
5092 )
5093 }
5094
5095 type GetPartitionLimitResponseFut =
5096 fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>;
5097 fn r#get_partition_limit(&self, mut guid: &Guid) -> Self::GetPartitionLimitResponseFut {
5098 fn _decode(
5099 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5100 ) -> Result<(i32, u64), fidl::Error> {
5101 let _response = fidl::client::decode_transaction_body::<
5102 VolumeManagerGetPartitionLimitResponse,
5103 fidl::encoding::DefaultFuchsiaResourceDialect,
5104 0x5bc9d21ea8bd52db,
5105 >(_buf?)?;
5106 Ok((_response.status, _response.slice_count))
5107 }
5108 self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
5109 (guid,),
5110 0x5bc9d21ea8bd52db,
5111 fidl::encoding::DynamicFlags::empty(),
5112 _decode,
5113 )
5114 }
5115
5116 type SetPartitionLimitResponseFut =
5117 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5118 fn r#set_partition_limit(
5119 &self,
5120 mut guid: &Guid,
5121 mut slice_count: u64,
5122 ) -> Self::SetPartitionLimitResponseFut {
5123 fn _decode(
5124 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5125 ) -> Result<i32, fidl::Error> {
5126 let _response = fidl::client::decode_transaction_body::<
5127 VolumeManagerSetPartitionLimitResponse,
5128 fidl::encoding::DefaultFuchsiaResourceDialect,
5129 0x3a4903076534c093,
5130 >(_buf?)?;
5131 Ok(_response.status)
5132 }
5133 self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
5134 (guid, slice_count),
5135 0x3a4903076534c093,
5136 fidl::encoding::DynamicFlags::empty(),
5137 _decode,
5138 )
5139 }
5140
5141 type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
5142 VolumeManagerSetPartitionNameResult,
5143 fidl::encoding::DefaultFuchsiaResourceDialect,
5144 >;
5145 fn r#set_partition_name(
5146 &self,
5147 mut guid: &Guid,
5148 mut name: &str,
5149 ) -> Self::SetPartitionNameResponseFut {
5150 fn _decode(
5151 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5152 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
5153 let _response = fidl::client::decode_transaction_body::<
5154 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5155 fidl::encoding::DefaultFuchsiaResourceDialect,
5156 0x26afb07b9d70ff1a,
5157 >(_buf?)?;
5158 Ok(_response.map(|x| x))
5159 }
5160 self.client.send_query_and_decode::<
5161 VolumeManagerSetPartitionNameRequest,
5162 VolumeManagerSetPartitionNameResult,
5163 >(
5164 (guid, name,),
5165 0x26afb07b9d70ff1a,
5166 fidl::encoding::DynamicFlags::empty(),
5167 _decode,
5168 )
5169 }
5170}
5171
5172pub struct VolumeManagerEventStream {
5173 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5174}
5175
5176impl std::marker::Unpin for VolumeManagerEventStream {}
5177
5178impl futures::stream::FusedStream for VolumeManagerEventStream {
5179 fn is_terminated(&self) -> bool {
5180 self.event_receiver.is_terminated()
5181 }
5182}
5183
5184impl futures::Stream for VolumeManagerEventStream {
5185 type Item = Result<VolumeManagerEvent, fidl::Error>;
5186
5187 fn poll_next(
5188 mut self: std::pin::Pin<&mut Self>,
5189 cx: &mut std::task::Context<'_>,
5190 ) -> std::task::Poll<Option<Self::Item>> {
5191 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5192 &mut self.event_receiver,
5193 cx
5194 )?) {
5195 Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
5196 None => std::task::Poll::Ready(None),
5197 }
5198 }
5199}
5200
5201#[derive(Debug)]
5202pub enum VolumeManagerEvent {}
5203
5204impl VolumeManagerEvent {
5205 fn decode(
5207 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5208 ) -> Result<VolumeManagerEvent, fidl::Error> {
5209 let (bytes, _handles) = buf.split_mut();
5210 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5211 debug_assert_eq!(tx_header.tx_id, 0);
5212 match tx_header.ordinal {
5213 _ => Err(fidl::Error::UnknownOrdinal {
5214 ordinal: tx_header.ordinal,
5215 protocol_name: <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5216 }),
5217 }
5218 }
5219}
5220
5221pub struct VolumeManagerRequestStream {
5223 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5224 is_terminated: bool,
5225}
5226
5227impl std::marker::Unpin for VolumeManagerRequestStream {}
5228
5229impl futures::stream::FusedStream for VolumeManagerRequestStream {
5230 fn is_terminated(&self) -> bool {
5231 self.is_terminated
5232 }
5233}
5234
5235impl fidl::endpoints::RequestStream for VolumeManagerRequestStream {
5236 type Protocol = VolumeManagerMarker;
5237 type ControlHandle = VolumeManagerControlHandle;
5238
5239 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5240 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5241 }
5242
5243 fn control_handle(&self) -> Self::ControlHandle {
5244 VolumeManagerControlHandle { inner: self.inner.clone() }
5245 }
5246
5247 fn into_inner(
5248 self,
5249 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5250 {
5251 (self.inner, self.is_terminated)
5252 }
5253
5254 fn from_inner(
5255 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5256 is_terminated: bool,
5257 ) -> Self {
5258 Self { inner, is_terminated }
5259 }
5260}
5261
5262impl futures::Stream for VolumeManagerRequestStream {
5263 type Item = Result<VolumeManagerRequest, fidl::Error>;
5264
5265 fn poll_next(
5266 mut self: std::pin::Pin<&mut Self>,
5267 cx: &mut std::task::Context<'_>,
5268 ) -> std::task::Poll<Option<Self::Item>> {
5269 let this = &mut *self;
5270 if this.inner.check_shutdown(cx) {
5271 this.is_terminated = true;
5272 return std::task::Poll::Ready(None);
5273 }
5274 if this.is_terminated {
5275 panic!("polled VolumeManagerRequestStream after completion");
5276 }
5277 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5278 |bytes, handles| {
5279 match this.inner.channel().read_etc(cx, bytes, handles) {
5280 std::task::Poll::Ready(Ok(())) => {}
5281 std::task::Poll::Pending => return std::task::Poll::Pending,
5282 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5283 this.is_terminated = true;
5284 return std::task::Poll::Ready(None);
5285 }
5286 std::task::Poll::Ready(Err(e)) => {
5287 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5288 e.into(),
5289 ))));
5290 }
5291 }
5292
5293 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5295
5296 std::task::Poll::Ready(Some(match header.ordinal {
5297 0x5db528bfc287b696 => {
5298 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5299 let mut req = fidl::new_empty!(
5300 VolumeManagerAllocatePartitionRequest,
5301 fidl::encoding::DefaultFuchsiaResourceDialect
5302 );
5303 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
5304 let control_handle =
5305 VolumeManagerControlHandle { inner: this.inner.clone() };
5306 Ok(VolumeManagerRequest::AllocatePartition {
5307 slice_count: req.slice_count,
5308 type_: req.type_,
5309 instance: req.instance,
5310 name: req.name,
5311 flags: req.flags,
5312
5313 responder: VolumeManagerAllocatePartitionResponder {
5314 control_handle: std::mem::ManuallyDrop::new(control_handle),
5315 tx_id: header.tx_id,
5316 },
5317 })
5318 }
5319 0x2611214dcca5b064 => {
5320 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5321 let mut req = fidl::new_empty!(
5322 fidl::encoding::EmptyPayload,
5323 fidl::encoding::DefaultFuchsiaResourceDialect
5324 );
5325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5326 let control_handle =
5327 VolumeManagerControlHandle { inner: this.inner.clone() };
5328 Ok(VolumeManagerRequest::GetInfo {
5329 responder: VolumeManagerGetInfoResponder {
5330 control_handle: std::mem::ManuallyDrop::new(control_handle),
5331 tx_id: header.tx_id,
5332 },
5333 })
5334 }
5335 0x182238d40c275be => {
5336 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5337 let mut req = fidl::new_empty!(
5338 VolumeManagerActivateRequest,
5339 fidl::encoding::DefaultFuchsiaResourceDialect
5340 );
5341 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
5342 let control_handle =
5343 VolumeManagerControlHandle { inner: this.inner.clone() };
5344 Ok(VolumeManagerRequest::Activate {
5345 old_guid: req.old_guid,
5346 new_guid: req.new_guid,
5347
5348 responder: VolumeManagerActivateResponder {
5349 control_handle: std::mem::ManuallyDrop::new(control_handle),
5350 tx_id: header.tx_id,
5351 },
5352 })
5353 }
5354 0x5bc9d21ea8bd52db => {
5355 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5356 let mut req = fidl::new_empty!(
5357 VolumeManagerGetPartitionLimitRequest,
5358 fidl::encoding::DefaultFuchsiaResourceDialect
5359 );
5360 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
5361 let control_handle =
5362 VolumeManagerControlHandle { inner: this.inner.clone() };
5363 Ok(VolumeManagerRequest::GetPartitionLimit {
5364 guid: req.guid,
5365
5366 responder: VolumeManagerGetPartitionLimitResponder {
5367 control_handle: std::mem::ManuallyDrop::new(control_handle),
5368 tx_id: header.tx_id,
5369 },
5370 })
5371 }
5372 0x3a4903076534c093 => {
5373 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5374 let mut req = fidl::new_empty!(
5375 VolumeManagerSetPartitionLimitRequest,
5376 fidl::encoding::DefaultFuchsiaResourceDialect
5377 );
5378 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
5379 let control_handle =
5380 VolumeManagerControlHandle { inner: this.inner.clone() };
5381 Ok(VolumeManagerRequest::SetPartitionLimit {
5382 guid: req.guid,
5383 slice_count: req.slice_count,
5384
5385 responder: VolumeManagerSetPartitionLimitResponder {
5386 control_handle: std::mem::ManuallyDrop::new(control_handle),
5387 tx_id: header.tx_id,
5388 },
5389 })
5390 }
5391 0x26afb07b9d70ff1a => {
5392 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5393 let mut req = fidl::new_empty!(
5394 VolumeManagerSetPartitionNameRequest,
5395 fidl::encoding::DefaultFuchsiaResourceDialect
5396 );
5397 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
5398 let control_handle =
5399 VolumeManagerControlHandle { inner: this.inner.clone() };
5400 Ok(VolumeManagerRequest::SetPartitionName {
5401 guid: req.guid,
5402 name: req.name,
5403
5404 responder: VolumeManagerSetPartitionNameResponder {
5405 control_handle: std::mem::ManuallyDrop::new(control_handle),
5406 tx_id: header.tx_id,
5407 },
5408 })
5409 }
5410 _ => Err(fidl::Error::UnknownOrdinal {
5411 ordinal: header.ordinal,
5412 protocol_name:
5413 <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5414 }),
5415 }))
5416 },
5417 )
5418 }
5419}
5420
5421#[derive(Debug)]
5423pub enum VolumeManagerRequest {
5424 AllocatePartition {
5431 slice_count: u64,
5432 type_: Guid,
5433 instance: Guid,
5434 name: String,
5435 flags: u32,
5436 responder: VolumeManagerAllocatePartitionResponder,
5437 },
5438 GetInfo { responder: VolumeManagerGetInfoResponder },
5446 Activate { old_guid: Guid, new_guid: Guid, responder: VolumeManagerActivateResponder },
5462 GetPartitionLimit { guid: Guid, responder: VolumeManagerGetPartitionLimitResponder },
5472 SetPartitionLimit {
5484 guid: Guid,
5485 slice_count: u64,
5486 responder: VolumeManagerSetPartitionLimitResponder,
5487 },
5488 SetPartitionName { guid: Guid, name: String, responder: VolumeManagerSetPartitionNameResponder },
5492}
5493
5494impl VolumeManagerRequest {
5495 #[allow(irrefutable_let_patterns)]
5496 pub fn into_allocate_partition(
5497 self,
5498 ) -> Option<(u64, Guid, Guid, String, u32, VolumeManagerAllocatePartitionResponder)> {
5499 if let VolumeManagerRequest::AllocatePartition {
5500 slice_count,
5501 type_,
5502 instance,
5503 name,
5504 flags,
5505 responder,
5506 } = self
5507 {
5508 Some((slice_count, type_, instance, name, flags, responder))
5509 } else {
5510 None
5511 }
5512 }
5513
5514 #[allow(irrefutable_let_patterns)]
5515 pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
5516 if let VolumeManagerRequest::GetInfo { responder } = self {
5517 Some((responder))
5518 } else {
5519 None
5520 }
5521 }
5522
5523 #[allow(irrefutable_let_patterns)]
5524 pub fn into_activate(self) -> Option<(Guid, Guid, VolumeManagerActivateResponder)> {
5525 if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
5526 Some((old_guid, new_guid, responder))
5527 } else {
5528 None
5529 }
5530 }
5531
5532 #[allow(irrefutable_let_patterns)]
5533 pub fn into_get_partition_limit(
5534 self,
5535 ) -> Option<(Guid, VolumeManagerGetPartitionLimitResponder)> {
5536 if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
5537 Some((guid, responder))
5538 } else {
5539 None
5540 }
5541 }
5542
5543 #[allow(irrefutable_let_patterns)]
5544 pub fn into_set_partition_limit(
5545 self,
5546 ) -> Option<(Guid, u64, VolumeManagerSetPartitionLimitResponder)> {
5547 if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
5548 Some((guid, slice_count, responder))
5549 } else {
5550 None
5551 }
5552 }
5553
5554 #[allow(irrefutable_let_patterns)]
5555 pub fn into_set_partition_name(
5556 self,
5557 ) -> Option<(Guid, String, VolumeManagerSetPartitionNameResponder)> {
5558 if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
5559 Some((guid, name, responder))
5560 } else {
5561 None
5562 }
5563 }
5564
5565 pub fn method_name(&self) -> &'static str {
5567 match *self {
5568 VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
5569 VolumeManagerRequest::GetInfo { .. } => "get_info",
5570 VolumeManagerRequest::Activate { .. } => "activate",
5571 VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
5572 VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
5573 VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
5574 }
5575 }
5576}
5577
5578#[derive(Debug, Clone)]
5579pub struct VolumeManagerControlHandle {
5580 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5581}
5582
5583impl VolumeManagerControlHandle {
5584 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5585 self.inner.shutdown_with_epitaph(status.into())
5586 }
5587}
5588
5589impl fidl::endpoints::ControlHandle for VolumeManagerControlHandle {
5590 fn shutdown(&self) {
5591 self.inner.shutdown()
5592 }
5593
5594 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5595 self.inner.shutdown_with_epitaph(status)
5596 }
5597
5598 fn is_closed(&self) -> bool {
5599 self.inner.channel().is_closed()
5600 }
5601 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5602 self.inner.channel().on_closed()
5603 }
5604
5605 #[cfg(target_os = "fuchsia")]
5606 fn signal_peer(
5607 &self,
5608 clear_mask: zx::Signals,
5609 set_mask: zx::Signals,
5610 ) -> Result<(), zx_status::Status> {
5611 use fidl::Peered;
5612 self.inner.channel().signal_peer(clear_mask, set_mask)
5613 }
5614}
5615
5616impl VolumeManagerControlHandle {}
5617
5618#[must_use = "FIDL methods require a response to be sent"]
5619#[derive(Debug)]
5620pub struct VolumeManagerAllocatePartitionResponder {
5621 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
5622 tx_id: u32,
5623}
5624
5625impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
5629 fn drop(&mut self) {
5630 self.control_handle.shutdown();
5631 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5633 }
5634}
5635
5636impl fidl::endpoints::Responder for VolumeManagerAllocatePartitionResponder {
5637 type ControlHandle = VolumeManagerControlHandle;
5638
5639 fn control_handle(&self) -> &VolumeManagerControlHandle {
5640 &self.control_handle
5641 }
5642
5643 fn drop_without_shutdown(mut self) {
5644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5646 std::mem::forget(self);
5648 }
5649}
5650
5651impl VolumeManagerAllocatePartitionResponder {
5652 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5656 let _result = self.send_raw(status);
5657 if _result.is_err() {
5658 self.control_handle.shutdown();
5659 }
5660 self.drop_without_shutdown();
5661 _result
5662 }
5663
5664 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5666 let _result = self.send_raw(status);
5667 self.drop_without_shutdown();
5668 _result
5669 }
5670
5671 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5672 self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
5673 (status,),
5674 self.tx_id,
5675 0x5db528bfc287b696,
5676 fidl::encoding::DynamicFlags::empty(),
5677 )
5678 }
5679}
5680
5681#[must_use = "FIDL methods require a response to be sent"]
5682#[derive(Debug)]
5683pub struct VolumeManagerGetInfoResponder {
5684 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
5685 tx_id: u32,
5686}
5687
5688impl std::ops::Drop for VolumeManagerGetInfoResponder {
5692 fn drop(&mut self) {
5693 self.control_handle.shutdown();
5694 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5696 }
5697}
5698
5699impl fidl::endpoints::Responder for VolumeManagerGetInfoResponder {
5700 type ControlHandle = VolumeManagerControlHandle;
5701
5702 fn control_handle(&self) -> &VolumeManagerControlHandle {
5703 &self.control_handle
5704 }
5705
5706 fn drop_without_shutdown(mut self) {
5707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5709 std::mem::forget(self);
5711 }
5712}
5713
5714impl VolumeManagerGetInfoResponder {
5715 pub fn send(
5719 self,
5720 mut status: i32,
5721 mut info: Option<&VolumeManagerInfo>,
5722 ) -> Result<(), fidl::Error> {
5723 let _result = self.send_raw(status, info);
5724 if _result.is_err() {
5725 self.control_handle.shutdown();
5726 }
5727 self.drop_without_shutdown();
5728 _result
5729 }
5730
5731 pub fn send_no_shutdown_on_err(
5733 self,
5734 mut status: i32,
5735 mut info: Option<&VolumeManagerInfo>,
5736 ) -> Result<(), fidl::Error> {
5737 let _result = self.send_raw(status, info);
5738 self.drop_without_shutdown();
5739 _result
5740 }
5741
5742 fn send_raw(
5743 &self,
5744 mut status: i32,
5745 mut info: Option<&VolumeManagerInfo>,
5746 ) -> Result<(), fidl::Error> {
5747 self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
5748 (status, info),
5749 self.tx_id,
5750 0x2611214dcca5b064,
5751 fidl::encoding::DynamicFlags::empty(),
5752 )
5753 }
5754}
5755
5756#[must_use = "FIDL methods require a response to be sent"]
5757#[derive(Debug)]
5758pub struct VolumeManagerActivateResponder {
5759 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
5760 tx_id: u32,
5761}
5762
5763impl std::ops::Drop for VolumeManagerActivateResponder {
5767 fn drop(&mut self) {
5768 self.control_handle.shutdown();
5769 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5771 }
5772}
5773
5774impl fidl::endpoints::Responder for VolumeManagerActivateResponder {
5775 type ControlHandle = VolumeManagerControlHandle;
5776
5777 fn control_handle(&self) -> &VolumeManagerControlHandle {
5778 &self.control_handle
5779 }
5780
5781 fn drop_without_shutdown(mut self) {
5782 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5784 std::mem::forget(self);
5786 }
5787}
5788
5789impl VolumeManagerActivateResponder {
5790 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5794 let _result = self.send_raw(status);
5795 if _result.is_err() {
5796 self.control_handle.shutdown();
5797 }
5798 self.drop_without_shutdown();
5799 _result
5800 }
5801
5802 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5804 let _result = self.send_raw(status);
5805 self.drop_without_shutdown();
5806 _result
5807 }
5808
5809 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5810 self.control_handle.inner.send::<VolumeManagerActivateResponse>(
5811 (status,),
5812 self.tx_id,
5813 0x182238d40c275be,
5814 fidl::encoding::DynamicFlags::empty(),
5815 )
5816 }
5817}
5818
5819#[must_use = "FIDL methods require a response to be sent"]
5820#[derive(Debug)]
5821pub struct VolumeManagerGetPartitionLimitResponder {
5822 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
5823 tx_id: u32,
5824}
5825
5826impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
5830 fn drop(&mut self) {
5831 self.control_handle.shutdown();
5832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5834 }
5835}
5836
5837impl fidl::endpoints::Responder for VolumeManagerGetPartitionLimitResponder {
5838 type ControlHandle = VolumeManagerControlHandle;
5839
5840 fn control_handle(&self) -> &VolumeManagerControlHandle {
5841 &self.control_handle
5842 }
5843
5844 fn drop_without_shutdown(mut self) {
5845 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5847 std::mem::forget(self);
5849 }
5850}
5851
5852impl VolumeManagerGetPartitionLimitResponder {
5853 pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
5857 let _result = self.send_raw(status, slice_count);
5858 if _result.is_err() {
5859 self.control_handle.shutdown();
5860 }
5861 self.drop_without_shutdown();
5862 _result
5863 }
5864
5865 pub fn send_no_shutdown_on_err(
5867 self,
5868 mut status: i32,
5869 mut slice_count: u64,
5870 ) -> Result<(), fidl::Error> {
5871 let _result = self.send_raw(status, slice_count);
5872 self.drop_without_shutdown();
5873 _result
5874 }
5875
5876 fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
5877 self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
5878 (status, slice_count),
5879 self.tx_id,
5880 0x5bc9d21ea8bd52db,
5881 fidl::encoding::DynamicFlags::empty(),
5882 )
5883 }
5884}
5885
5886#[must_use = "FIDL methods require a response to be sent"]
5887#[derive(Debug)]
5888pub struct VolumeManagerSetPartitionLimitResponder {
5889 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
5890 tx_id: u32,
5891}
5892
5893impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
5897 fn drop(&mut self) {
5898 self.control_handle.shutdown();
5899 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5901 }
5902}
5903
5904impl fidl::endpoints::Responder for VolumeManagerSetPartitionLimitResponder {
5905 type ControlHandle = VolumeManagerControlHandle;
5906
5907 fn control_handle(&self) -> &VolumeManagerControlHandle {
5908 &self.control_handle
5909 }
5910
5911 fn drop_without_shutdown(mut self) {
5912 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5914 std::mem::forget(self);
5916 }
5917}
5918
5919impl VolumeManagerSetPartitionLimitResponder {
5920 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5924 let _result = self.send_raw(status);
5925 if _result.is_err() {
5926 self.control_handle.shutdown();
5927 }
5928 self.drop_without_shutdown();
5929 _result
5930 }
5931
5932 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5934 let _result = self.send_raw(status);
5935 self.drop_without_shutdown();
5936 _result
5937 }
5938
5939 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5940 self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
5941 (status,),
5942 self.tx_id,
5943 0x3a4903076534c093,
5944 fidl::encoding::DynamicFlags::empty(),
5945 )
5946 }
5947}
5948
5949#[must_use = "FIDL methods require a response to be sent"]
5950#[derive(Debug)]
5951pub struct VolumeManagerSetPartitionNameResponder {
5952 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
5953 tx_id: u32,
5954}
5955
5956impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
5960 fn drop(&mut self) {
5961 self.control_handle.shutdown();
5962 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5964 }
5965}
5966
5967impl fidl::endpoints::Responder for VolumeManagerSetPartitionNameResponder {
5968 type ControlHandle = VolumeManagerControlHandle;
5969
5970 fn control_handle(&self) -> &VolumeManagerControlHandle {
5971 &self.control_handle
5972 }
5973
5974 fn drop_without_shutdown(mut self) {
5975 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5977 std::mem::forget(self);
5979 }
5980}
5981
5982impl VolumeManagerSetPartitionNameResponder {
5983 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5987 let _result = self.send_raw(result);
5988 if _result.is_err() {
5989 self.control_handle.shutdown();
5990 }
5991 self.drop_without_shutdown();
5992 _result
5993 }
5994
5995 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5997 let _result = self.send_raw(result);
5998 self.drop_without_shutdown();
5999 _result
6000 }
6001
6002 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6003 self.control_handle
6004 .inner
6005 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6006 result,
6007 self.tx_id,
6008 0x26afb07b9d70ff1a,
6009 fidl::encoding::DynamicFlags::empty(),
6010 )
6011 }
6012}
6013
6014mod internal {
6015 use super::*;
6016
6017 impl fidl::encoding::ResourceTypeMarker for BlockConnectMapperRequest {
6018 type Borrowed<'a> = &'a mut Self;
6019 fn take_or_borrow<'a>(
6020 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6021 ) -> Self::Borrowed<'a> {
6022 value
6023 }
6024 }
6025
6026 unsafe impl fidl::encoding::TypeMarker for BlockConnectMapperRequest {
6027 type Owned = Self;
6028
6029 #[inline(always)]
6030 fn inline_align(_context: fidl::encoding::Context) -> usize {
6031 4
6032 }
6033
6034 #[inline(always)]
6035 fn inline_size(_context: fidl::encoding::Context) -> usize {
6036 4
6037 }
6038 }
6039
6040 unsafe impl
6041 fidl::encoding::Encode<
6042 BlockConnectMapperRequest,
6043 fidl::encoding::DefaultFuchsiaResourceDialect,
6044 > for &mut BlockConnectMapperRequest
6045 {
6046 #[inline]
6047 unsafe fn encode(
6048 self,
6049 encoder: &mut fidl::encoding::Encoder<
6050 '_,
6051 fidl::encoding::DefaultFuchsiaResourceDialect,
6052 >,
6053 offset: usize,
6054 _depth: fidl::encoding::Depth,
6055 ) -> fidl::Result<()> {
6056 encoder.debug_check_bounds::<BlockConnectMapperRequest>(offset);
6057 fidl::encoding::Encode::<BlockConnectMapperRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6059 (
6060 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
6061 ),
6062 encoder, offset, _depth
6063 )
6064 }
6065 }
6066 unsafe impl<
6067 T0: fidl::encoding::Encode<
6068 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperMarker>>,
6069 fidl::encoding::DefaultFuchsiaResourceDialect,
6070 >,
6071 >
6072 fidl::encoding::Encode<
6073 BlockConnectMapperRequest,
6074 fidl::encoding::DefaultFuchsiaResourceDialect,
6075 > for (T0,)
6076 {
6077 #[inline]
6078 unsafe fn encode(
6079 self,
6080 encoder: &mut fidl::encoding::Encoder<
6081 '_,
6082 fidl::encoding::DefaultFuchsiaResourceDialect,
6083 >,
6084 offset: usize,
6085 depth: fidl::encoding::Depth,
6086 ) -> fidl::Result<()> {
6087 encoder.debug_check_bounds::<BlockConnectMapperRequest>(offset);
6088 self.0.encode(encoder, offset + 0, depth)?;
6092 Ok(())
6093 }
6094 }
6095
6096 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6097 for BlockConnectMapperRequest
6098 {
6099 #[inline(always)]
6100 fn new_empty() -> Self {
6101 Self {
6102 server_end: fidl::new_empty!(
6103 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperMarker>>,
6104 fidl::encoding::DefaultFuchsiaResourceDialect
6105 ),
6106 }
6107 }
6108
6109 #[inline]
6110 unsafe fn decode(
6111 &mut self,
6112 decoder: &mut fidl::encoding::Decoder<
6113 '_,
6114 fidl::encoding::DefaultFuchsiaResourceDialect,
6115 >,
6116 offset: usize,
6117 _depth: fidl::encoding::Depth,
6118 ) -> fidl::Result<()> {
6119 decoder.debug_check_bounds::<Self>(offset);
6120 fidl::decode!(
6122 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperMarker>>,
6123 fidl::encoding::DefaultFuchsiaResourceDialect,
6124 &mut self.server_end,
6125 decoder,
6126 offset + 0,
6127 _depth
6128 )?;
6129 Ok(())
6130 }
6131 }
6132
6133 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionRequest {
6134 type Borrowed<'a> = &'a mut Self;
6135 fn take_or_borrow<'a>(
6136 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6137 ) -> Self::Borrowed<'a> {
6138 value
6139 }
6140 }
6141
6142 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionRequest {
6143 type Owned = Self;
6144
6145 #[inline(always)]
6146 fn inline_align(_context: fidl::encoding::Context) -> usize {
6147 4
6148 }
6149
6150 #[inline(always)]
6151 fn inline_size(_context: fidl::encoding::Context) -> usize {
6152 4
6153 }
6154 }
6155
6156 unsafe impl
6157 fidl::encoding::Encode<
6158 BlockOpenSessionRequest,
6159 fidl::encoding::DefaultFuchsiaResourceDialect,
6160 > for &mut BlockOpenSessionRequest
6161 {
6162 #[inline]
6163 unsafe fn encode(
6164 self,
6165 encoder: &mut fidl::encoding::Encoder<
6166 '_,
6167 fidl::encoding::DefaultFuchsiaResourceDialect,
6168 >,
6169 offset: usize,
6170 _depth: fidl::encoding::Depth,
6171 ) -> fidl::Result<()> {
6172 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
6173 fidl::encoding::Encode::<BlockOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6175 (
6176 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6177 ),
6178 encoder, offset, _depth
6179 )
6180 }
6181 }
6182 unsafe impl<
6183 T0: fidl::encoding::Encode<
6184 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
6185 fidl::encoding::DefaultFuchsiaResourceDialect,
6186 >,
6187 >
6188 fidl::encoding::Encode<
6189 BlockOpenSessionRequest,
6190 fidl::encoding::DefaultFuchsiaResourceDialect,
6191 > for (T0,)
6192 {
6193 #[inline]
6194 unsafe fn encode(
6195 self,
6196 encoder: &mut fidl::encoding::Encoder<
6197 '_,
6198 fidl::encoding::DefaultFuchsiaResourceDialect,
6199 >,
6200 offset: usize,
6201 depth: fidl::encoding::Depth,
6202 ) -> fidl::Result<()> {
6203 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
6204 self.0.encode(encoder, offset + 0, depth)?;
6208 Ok(())
6209 }
6210 }
6211
6212 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6213 for BlockOpenSessionRequest
6214 {
6215 #[inline(always)]
6216 fn new_empty() -> Self {
6217 Self {
6218 session: fidl::new_empty!(
6219 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
6220 fidl::encoding::DefaultFuchsiaResourceDialect
6221 ),
6222 }
6223 }
6224
6225 #[inline]
6226 unsafe fn decode(
6227 &mut self,
6228 decoder: &mut fidl::encoding::Decoder<
6229 '_,
6230 fidl::encoding::DefaultFuchsiaResourceDialect,
6231 >,
6232 offset: usize,
6233 _depth: fidl::encoding::Depth,
6234 ) -> fidl::Result<()> {
6235 decoder.debug_check_bounds::<Self>(offset);
6236 fidl::decode!(
6238 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
6239 fidl::encoding::DefaultFuchsiaResourceDialect,
6240 &mut self.session,
6241 decoder,
6242 offset + 0,
6243 _depth
6244 )?;
6245 Ok(())
6246 }
6247 }
6248
6249 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionWithOptionsRequest {
6250 type Borrowed<'a> = &'a mut Self;
6251 fn take_or_borrow<'a>(
6252 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6253 ) -> Self::Borrowed<'a> {
6254 value
6255 }
6256 }
6257
6258 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionWithOptionsRequest {
6259 type Owned = Self;
6260
6261 #[inline(always)]
6262 fn inline_align(_context: fidl::encoding::Context) -> usize {
6263 8
6264 }
6265
6266 #[inline(always)]
6267 fn inline_size(_context: fidl::encoding::Context) -> usize {
6268 24
6269 }
6270 }
6271
6272 unsafe impl
6273 fidl::encoding::Encode<
6274 BlockOpenSessionWithOptionsRequest,
6275 fidl::encoding::DefaultFuchsiaResourceDialect,
6276 > for &mut BlockOpenSessionWithOptionsRequest
6277 {
6278 #[inline]
6279 unsafe fn encode(
6280 self,
6281 encoder: &mut fidl::encoding::Encoder<
6282 '_,
6283 fidl::encoding::DefaultFuchsiaResourceDialect,
6284 >,
6285 offset: usize,
6286 _depth: fidl::encoding::Depth,
6287 ) -> fidl::Result<()> {
6288 encoder.debug_check_bounds::<BlockOpenSessionWithOptionsRequest>(offset);
6289 fidl::encoding::Encode::<BlockOpenSessionWithOptionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6291 (
6292 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6293 <fidl::encoding::Vector<BlockOffsetMapping, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.mappings),
6294 ),
6295 encoder, offset, _depth
6296 )
6297 }
6298 }
6299 unsafe impl<
6300 T0: fidl::encoding::Encode<
6301 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
6302 fidl::encoding::DefaultFuchsiaResourceDialect,
6303 >,
6304 T1: fidl::encoding::Encode<
6305 fidl::encoding::Vector<BlockOffsetMapping, 4>,
6306 fidl::encoding::DefaultFuchsiaResourceDialect,
6307 >,
6308 >
6309 fidl::encoding::Encode<
6310 BlockOpenSessionWithOptionsRequest,
6311 fidl::encoding::DefaultFuchsiaResourceDialect,
6312 > for (T0, T1)
6313 {
6314 #[inline]
6315 unsafe fn encode(
6316 self,
6317 encoder: &mut fidl::encoding::Encoder<
6318 '_,
6319 fidl::encoding::DefaultFuchsiaResourceDialect,
6320 >,
6321 offset: usize,
6322 depth: fidl::encoding::Depth,
6323 ) -> fidl::Result<()> {
6324 encoder.debug_check_bounds::<BlockOpenSessionWithOptionsRequest>(offset);
6325 unsafe {
6328 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6329 (ptr as *mut u64).write_unaligned(0);
6330 }
6331 self.0.encode(encoder, offset + 0, depth)?;
6333 self.1.encode(encoder, offset + 8, depth)?;
6334 Ok(())
6335 }
6336 }
6337
6338 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6339 for BlockOpenSessionWithOptionsRequest
6340 {
6341 #[inline(always)]
6342 fn new_empty() -> Self {
6343 Self {
6344 session: fidl::new_empty!(
6345 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
6346 fidl::encoding::DefaultFuchsiaResourceDialect
6347 ),
6348 mappings: fidl::new_empty!(fidl::encoding::Vector<BlockOffsetMapping, 4>, fidl::encoding::DefaultFuchsiaResourceDialect),
6349 }
6350 }
6351
6352 #[inline]
6353 unsafe fn decode(
6354 &mut self,
6355 decoder: &mut fidl::encoding::Decoder<
6356 '_,
6357 fidl::encoding::DefaultFuchsiaResourceDialect,
6358 >,
6359 offset: usize,
6360 _depth: fidl::encoding::Depth,
6361 ) -> fidl::Result<()> {
6362 decoder.debug_check_bounds::<Self>(offset);
6363 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6365 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6366 let mask = 0xffffffff00000000u64;
6367 let maskedval = padval & mask;
6368 if maskedval != 0 {
6369 return Err(fidl::Error::NonZeroPadding {
6370 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6371 });
6372 }
6373 fidl::decode!(
6374 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
6375 fidl::encoding::DefaultFuchsiaResourceDialect,
6376 &mut self.session,
6377 decoder,
6378 offset + 0,
6379 _depth
6380 )?;
6381 fidl::decode!(fidl::encoding::Vector<BlockOffsetMapping, 4>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.mappings, decoder, offset + 8, _depth)?;
6382 Ok(())
6383 }
6384 }
6385
6386 impl fidl::encoding::ResourceTypeMarker for MapperOpenSessionRequest {
6387 type Borrowed<'a> = &'a mut Self;
6388 fn take_or_borrow<'a>(
6389 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6390 ) -> Self::Borrowed<'a> {
6391 value
6392 }
6393 }
6394
6395 unsafe impl fidl::encoding::TypeMarker for MapperOpenSessionRequest {
6396 type Owned = Self;
6397
6398 #[inline(always)]
6399 fn inline_align(_context: fidl::encoding::Context) -> usize {
6400 4
6401 }
6402
6403 #[inline(always)]
6404 fn inline_size(_context: fidl::encoding::Context) -> usize {
6405 16
6406 }
6407 }
6408
6409 unsafe impl
6410 fidl::encoding::Encode<
6411 MapperOpenSessionRequest,
6412 fidl::encoding::DefaultFuchsiaResourceDialect,
6413 > for &mut MapperOpenSessionRequest
6414 {
6415 #[inline]
6416 unsafe fn encode(
6417 self,
6418 encoder: &mut fidl::encoding::Encoder<
6419 '_,
6420 fidl::encoding::DefaultFuchsiaResourceDialect,
6421 >,
6422 offset: usize,
6423 _depth: fidl::encoding::Depth,
6424 ) -> fidl::Result<()> {
6425 encoder.debug_check_bounds::<MapperOpenSessionRequest>(offset);
6426 fidl::encoding::Encode::<MapperOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6428 (
6429 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6430 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mapping_vmo),
6431 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Port, { fidl::ObjectType::PORT.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6432 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delivery_queue),
6433 ),
6434 encoder, offset, _depth
6435 )
6436 }
6437 }
6438 unsafe impl<
6439 T0: fidl::encoding::Encode<
6440 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>>,
6441 fidl::encoding::DefaultFuchsiaResourceDialect,
6442 >,
6443 T1: fidl::encoding::Encode<
6444 fidl::encoding::HandleType<
6445 fidl::Vmo,
6446 { fidl::ObjectType::VMO.into_raw() },
6447 2147483648,
6448 >,
6449 fidl::encoding::DefaultFuchsiaResourceDialect,
6450 >,
6451 T2: fidl::encoding::Encode<
6452 fidl::encoding::Optional<
6453 fidl::encoding::HandleType<
6454 fidl::Port,
6455 { fidl::ObjectType::PORT.into_raw() },
6456 2147483648,
6457 >,
6458 >,
6459 fidl::encoding::DefaultFuchsiaResourceDialect,
6460 >,
6461 T3: fidl::encoding::Encode<
6462 fidl::encoding::Optional<
6463 fidl::encoding::HandleType<
6464 fidl::Vmo,
6465 { fidl::ObjectType::VMO.into_raw() },
6466 2147483648,
6467 >,
6468 >,
6469 fidl::encoding::DefaultFuchsiaResourceDialect,
6470 >,
6471 >
6472 fidl::encoding::Encode<
6473 MapperOpenSessionRequest,
6474 fidl::encoding::DefaultFuchsiaResourceDialect,
6475 > for (T0, T1, T2, T3)
6476 {
6477 #[inline]
6478 unsafe fn encode(
6479 self,
6480 encoder: &mut fidl::encoding::Encoder<
6481 '_,
6482 fidl::encoding::DefaultFuchsiaResourceDialect,
6483 >,
6484 offset: usize,
6485 depth: fidl::encoding::Depth,
6486 ) -> fidl::Result<()> {
6487 encoder.debug_check_bounds::<MapperOpenSessionRequest>(offset);
6488 self.0.encode(encoder, offset + 0, depth)?;
6492 self.1.encode(encoder, offset + 4, depth)?;
6493 self.2.encode(encoder, offset + 8, depth)?;
6494 self.3.encode(encoder, offset + 12, depth)?;
6495 Ok(())
6496 }
6497 }
6498
6499 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6500 for MapperOpenSessionRequest
6501 {
6502 #[inline(always)]
6503 fn new_empty() -> Self {
6504 Self {
6505 session: fidl::new_empty!(
6506 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>>,
6507 fidl::encoding::DefaultFuchsiaResourceDialect
6508 ),
6509 mapping_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6510 port: fidl::new_empty!(
6511 fidl::encoding::Optional<
6512 fidl::encoding::HandleType<
6513 fidl::Port,
6514 { fidl::ObjectType::PORT.into_raw() },
6515 2147483648,
6516 >,
6517 >,
6518 fidl::encoding::DefaultFuchsiaResourceDialect
6519 ),
6520 delivery_queue: fidl::new_empty!(
6521 fidl::encoding::Optional<
6522 fidl::encoding::HandleType<
6523 fidl::Vmo,
6524 { fidl::ObjectType::VMO.into_raw() },
6525 2147483648,
6526 >,
6527 >,
6528 fidl::encoding::DefaultFuchsiaResourceDialect
6529 ),
6530 }
6531 }
6532
6533 #[inline]
6534 unsafe fn decode(
6535 &mut self,
6536 decoder: &mut fidl::encoding::Decoder<
6537 '_,
6538 fidl::encoding::DefaultFuchsiaResourceDialect,
6539 >,
6540 offset: usize,
6541 _depth: fidl::encoding::Depth,
6542 ) -> fidl::Result<()> {
6543 decoder.debug_check_bounds::<Self>(offset);
6544 fidl::decode!(
6546 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>>,
6547 fidl::encoding::DefaultFuchsiaResourceDialect,
6548 &mut self.session,
6549 decoder,
6550 offset + 0,
6551 _depth
6552 )?;
6553 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.mapping_vmo, decoder, offset + 4, _depth)?;
6554 fidl::decode!(
6555 fidl::encoding::Optional<
6556 fidl::encoding::HandleType<
6557 fidl::Port,
6558 { fidl::ObjectType::PORT.into_raw() },
6559 2147483648,
6560 >,
6561 >,
6562 fidl::encoding::DefaultFuchsiaResourceDialect,
6563 &mut self.port,
6564 decoder,
6565 offset + 8,
6566 _depth
6567 )?;
6568 fidl::decode!(
6569 fidl::encoding::Optional<
6570 fidl::encoding::HandleType<
6571 fidl::Vmo,
6572 { fidl::ObjectType::VMO.into_raw() },
6573 2147483648,
6574 >,
6575 >,
6576 fidl::encoding::DefaultFuchsiaResourceDialect,
6577 &mut self.delivery_queue,
6578 decoder,
6579 offset + 12,
6580 _depth
6581 )?;
6582 Ok(())
6583 }
6584 }
6585
6586 impl fidl::encoding::ResourceTypeMarker for MapperSessionOpenChildSessionRequest {
6587 type Borrowed<'a> = &'a mut Self;
6588 fn take_or_borrow<'a>(
6589 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6590 ) -> Self::Borrowed<'a> {
6591 value
6592 }
6593 }
6594
6595 unsafe impl fidl::encoding::TypeMarker for MapperSessionOpenChildSessionRequest {
6596 type Owned = Self;
6597
6598 #[inline(always)]
6599 fn inline_align(_context: fidl::encoding::Context) -> usize {
6600 8
6601 }
6602
6603 #[inline(always)]
6604 fn inline_size(_context: fidl::encoding::Context) -> usize {
6605 24
6606 }
6607 }
6608
6609 unsafe impl
6610 fidl::encoding::Encode<
6611 MapperSessionOpenChildSessionRequest,
6612 fidl::encoding::DefaultFuchsiaResourceDialect,
6613 > for &mut MapperSessionOpenChildSessionRequest
6614 {
6615 #[inline]
6616 unsafe fn encode(
6617 self,
6618 encoder: &mut fidl::encoding::Encoder<
6619 '_,
6620 fidl::encoding::DefaultFuchsiaResourceDialect,
6621 >,
6622 offset: usize,
6623 _depth: fidl::encoding::Depth,
6624 ) -> fidl::Result<()> {
6625 encoder.debug_check_bounds::<MapperSessionOpenChildSessionRequest>(offset);
6626 fidl::encoding::Encode::<MapperSessionOpenChildSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6628 (
6629 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
6630 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mapping_vmo),
6631 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent_key),
6632 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Port, { fidl::ObjectType::PORT.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
6633 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delivery_queue),
6634 ),
6635 encoder, offset, _depth
6636 )
6637 }
6638 }
6639 unsafe impl<
6640 T0: fidl::encoding::Encode<
6641 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>>,
6642 fidl::encoding::DefaultFuchsiaResourceDialect,
6643 >,
6644 T1: fidl::encoding::Encode<
6645 fidl::encoding::HandleType<
6646 fidl::Vmo,
6647 { fidl::ObjectType::VMO.into_raw() },
6648 2147483648,
6649 >,
6650 fidl::encoding::DefaultFuchsiaResourceDialect,
6651 >,
6652 T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
6653 T3: fidl::encoding::Encode<
6654 fidl::encoding::Optional<
6655 fidl::encoding::HandleType<
6656 fidl::Port,
6657 { fidl::ObjectType::PORT.into_raw() },
6658 2147483648,
6659 >,
6660 >,
6661 fidl::encoding::DefaultFuchsiaResourceDialect,
6662 >,
6663 T4: fidl::encoding::Encode<
6664 fidl::encoding::Optional<
6665 fidl::encoding::HandleType<
6666 fidl::Vmo,
6667 { fidl::ObjectType::VMO.into_raw() },
6668 2147483648,
6669 >,
6670 >,
6671 fidl::encoding::DefaultFuchsiaResourceDialect,
6672 >,
6673 >
6674 fidl::encoding::Encode<
6675 MapperSessionOpenChildSessionRequest,
6676 fidl::encoding::DefaultFuchsiaResourceDialect,
6677 > for (T0, T1, T2, T3, T4)
6678 {
6679 #[inline]
6680 unsafe fn encode(
6681 self,
6682 encoder: &mut fidl::encoding::Encoder<
6683 '_,
6684 fidl::encoding::DefaultFuchsiaResourceDialect,
6685 >,
6686 offset: usize,
6687 depth: fidl::encoding::Depth,
6688 ) -> fidl::Result<()> {
6689 encoder.debug_check_bounds::<MapperSessionOpenChildSessionRequest>(offset);
6690 self.0.encode(encoder, offset + 0, depth)?;
6694 self.1.encode(encoder, offset + 4, depth)?;
6695 self.2.encode(encoder, offset + 8, depth)?;
6696 self.3.encode(encoder, offset + 16, depth)?;
6697 self.4.encode(encoder, offset + 20, depth)?;
6698 Ok(())
6699 }
6700 }
6701
6702 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6703 for MapperSessionOpenChildSessionRequest
6704 {
6705 #[inline(always)]
6706 fn new_empty() -> Self {
6707 Self {
6708 session: fidl::new_empty!(
6709 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>>,
6710 fidl::encoding::DefaultFuchsiaResourceDialect
6711 ),
6712 mapping_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6713 parent_key: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
6714 port: fidl::new_empty!(
6715 fidl::encoding::Optional<
6716 fidl::encoding::HandleType<
6717 fidl::Port,
6718 { fidl::ObjectType::PORT.into_raw() },
6719 2147483648,
6720 >,
6721 >,
6722 fidl::encoding::DefaultFuchsiaResourceDialect
6723 ),
6724 delivery_queue: fidl::new_empty!(
6725 fidl::encoding::Optional<
6726 fidl::encoding::HandleType<
6727 fidl::Vmo,
6728 { fidl::ObjectType::VMO.into_raw() },
6729 2147483648,
6730 >,
6731 >,
6732 fidl::encoding::DefaultFuchsiaResourceDialect
6733 ),
6734 }
6735 }
6736
6737 #[inline]
6738 unsafe fn decode(
6739 &mut self,
6740 decoder: &mut fidl::encoding::Decoder<
6741 '_,
6742 fidl::encoding::DefaultFuchsiaResourceDialect,
6743 >,
6744 offset: usize,
6745 _depth: fidl::encoding::Depth,
6746 ) -> fidl::Result<()> {
6747 decoder.debug_check_bounds::<Self>(offset);
6748 fidl::decode!(
6750 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MapperSessionMarker>>,
6751 fidl::encoding::DefaultFuchsiaResourceDialect,
6752 &mut self.session,
6753 decoder,
6754 offset + 0,
6755 _depth
6756 )?;
6757 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.mapping_vmo, decoder, offset + 4, _depth)?;
6758 fidl::decode!(
6759 u64,
6760 fidl::encoding::DefaultFuchsiaResourceDialect,
6761 &mut self.parent_key,
6762 decoder,
6763 offset + 8,
6764 _depth
6765 )?;
6766 fidl::decode!(
6767 fidl::encoding::Optional<
6768 fidl::encoding::HandleType<
6769 fidl::Port,
6770 { fidl::ObjectType::PORT.into_raw() },
6771 2147483648,
6772 >,
6773 >,
6774 fidl::encoding::DefaultFuchsiaResourceDialect,
6775 &mut self.port,
6776 decoder,
6777 offset + 16,
6778 _depth
6779 )?;
6780 fidl::decode!(
6781 fidl::encoding::Optional<
6782 fidl::encoding::HandleType<
6783 fidl::Vmo,
6784 { fidl::ObjectType::VMO.into_raw() },
6785 2147483648,
6786 >,
6787 >,
6788 fidl::encoding::DefaultFuchsiaResourceDialect,
6789 &mut self.delivery_queue,
6790 decoder,
6791 offset + 20,
6792 _depth
6793 )?;
6794 Ok(())
6795 }
6796 }
6797
6798 impl fidl::encoding::ResourceTypeMarker for MapperSessionCreateVmoResponse {
6799 type Borrowed<'a> = &'a mut Self;
6800 fn take_or_borrow<'a>(
6801 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6802 ) -> Self::Borrowed<'a> {
6803 value
6804 }
6805 }
6806
6807 unsafe impl fidl::encoding::TypeMarker for MapperSessionCreateVmoResponse {
6808 type Owned = Self;
6809
6810 #[inline(always)]
6811 fn inline_align(_context: fidl::encoding::Context) -> usize {
6812 4
6813 }
6814
6815 #[inline(always)]
6816 fn inline_size(_context: fidl::encoding::Context) -> usize {
6817 4
6818 }
6819 }
6820
6821 unsafe impl
6822 fidl::encoding::Encode<
6823 MapperSessionCreateVmoResponse,
6824 fidl::encoding::DefaultFuchsiaResourceDialect,
6825 > for &mut MapperSessionCreateVmoResponse
6826 {
6827 #[inline]
6828 unsafe fn encode(
6829 self,
6830 encoder: &mut fidl::encoding::Encoder<
6831 '_,
6832 fidl::encoding::DefaultFuchsiaResourceDialect,
6833 >,
6834 offset: usize,
6835 _depth: fidl::encoding::Depth,
6836 ) -> fidl::Result<()> {
6837 encoder.debug_check_bounds::<MapperSessionCreateVmoResponse>(offset);
6838 fidl::encoding::Encode::<
6840 MapperSessionCreateVmoResponse,
6841 fidl::encoding::DefaultFuchsiaResourceDialect,
6842 >::encode(
6843 (<fidl::encoding::HandleType<
6844 fidl::Vmo,
6845 { fidl::ObjectType::VMO.into_raw() },
6846 2147483648,
6847 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6848 &mut self.vmo
6849 ),),
6850 encoder,
6851 offset,
6852 _depth,
6853 )
6854 }
6855 }
6856 unsafe impl<
6857 T0: fidl::encoding::Encode<
6858 fidl::encoding::HandleType<
6859 fidl::Vmo,
6860 { fidl::ObjectType::VMO.into_raw() },
6861 2147483648,
6862 >,
6863 fidl::encoding::DefaultFuchsiaResourceDialect,
6864 >,
6865 >
6866 fidl::encoding::Encode<
6867 MapperSessionCreateVmoResponse,
6868 fidl::encoding::DefaultFuchsiaResourceDialect,
6869 > for (T0,)
6870 {
6871 #[inline]
6872 unsafe fn encode(
6873 self,
6874 encoder: &mut fidl::encoding::Encoder<
6875 '_,
6876 fidl::encoding::DefaultFuchsiaResourceDialect,
6877 >,
6878 offset: usize,
6879 depth: fidl::encoding::Depth,
6880 ) -> fidl::Result<()> {
6881 encoder.debug_check_bounds::<MapperSessionCreateVmoResponse>(offset);
6882 self.0.encode(encoder, offset + 0, depth)?;
6886 Ok(())
6887 }
6888 }
6889
6890 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6891 for MapperSessionCreateVmoResponse
6892 {
6893 #[inline(always)]
6894 fn new_empty() -> Self {
6895 Self {
6896 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6897 }
6898 }
6899
6900 #[inline]
6901 unsafe fn decode(
6902 &mut self,
6903 decoder: &mut fidl::encoding::Decoder<
6904 '_,
6905 fidl::encoding::DefaultFuchsiaResourceDialect,
6906 >,
6907 offset: usize,
6908 _depth: fidl::encoding::Depth,
6909 ) -> fidl::Result<()> {
6910 decoder.debug_check_bounds::<Self>(offset);
6911 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
6913 Ok(())
6914 }
6915 }
6916
6917 impl fidl::encoding::ResourceTypeMarker for SessionAttachVmoRequest {
6918 type Borrowed<'a> = &'a mut Self;
6919 fn take_or_borrow<'a>(
6920 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6921 ) -> Self::Borrowed<'a> {
6922 value
6923 }
6924 }
6925
6926 unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoRequest {
6927 type Owned = Self;
6928
6929 #[inline(always)]
6930 fn inline_align(_context: fidl::encoding::Context) -> usize {
6931 4
6932 }
6933
6934 #[inline(always)]
6935 fn inline_size(_context: fidl::encoding::Context) -> usize {
6936 4
6937 }
6938 }
6939
6940 unsafe impl
6941 fidl::encoding::Encode<
6942 SessionAttachVmoRequest,
6943 fidl::encoding::DefaultFuchsiaResourceDialect,
6944 > for &mut SessionAttachVmoRequest
6945 {
6946 #[inline]
6947 unsafe fn encode(
6948 self,
6949 encoder: &mut fidl::encoding::Encoder<
6950 '_,
6951 fidl::encoding::DefaultFuchsiaResourceDialect,
6952 >,
6953 offset: usize,
6954 _depth: fidl::encoding::Depth,
6955 ) -> fidl::Result<()> {
6956 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
6957 fidl::encoding::Encode::<
6959 SessionAttachVmoRequest,
6960 fidl::encoding::DefaultFuchsiaResourceDialect,
6961 >::encode(
6962 (<fidl::encoding::HandleType<
6963 fidl::Vmo,
6964 { fidl::ObjectType::VMO.into_raw() },
6965 2147483648,
6966 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6967 &mut self.vmo
6968 ),),
6969 encoder,
6970 offset,
6971 _depth,
6972 )
6973 }
6974 }
6975 unsafe impl<
6976 T0: fidl::encoding::Encode<
6977 fidl::encoding::HandleType<
6978 fidl::Vmo,
6979 { fidl::ObjectType::VMO.into_raw() },
6980 2147483648,
6981 >,
6982 fidl::encoding::DefaultFuchsiaResourceDialect,
6983 >,
6984 >
6985 fidl::encoding::Encode<
6986 SessionAttachVmoRequest,
6987 fidl::encoding::DefaultFuchsiaResourceDialect,
6988 > for (T0,)
6989 {
6990 #[inline]
6991 unsafe fn encode(
6992 self,
6993 encoder: &mut fidl::encoding::Encoder<
6994 '_,
6995 fidl::encoding::DefaultFuchsiaResourceDialect,
6996 >,
6997 offset: usize,
6998 depth: fidl::encoding::Depth,
6999 ) -> fidl::Result<()> {
7000 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
7001 self.0.encode(encoder, offset + 0, depth)?;
7005 Ok(())
7006 }
7007 }
7008
7009 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7010 for SessionAttachVmoRequest
7011 {
7012 #[inline(always)]
7013 fn new_empty() -> Self {
7014 Self {
7015 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
7016 }
7017 }
7018
7019 #[inline]
7020 unsafe fn decode(
7021 &mut self,
7022 decoder: &mut fidl::encoding::Decoder<
7023 '_,
7024 fidl::encoding::DefaultFuchsiaResourceDialect,
7025 >,
7026 offset: usize,
7027 _depth: fidl::encoding::Depth,
7028 ) -> fidl::Result<()> {
7029 decoder.debug_check_bounds::<Self>(offset);
7030 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
7032 Ok(())
7033 }
7034 }
7035
7036 impl fidl::encoding::ResourceTypeMarker for SessionGetFifoResponse {
7037 type Borrowed<'a> = &'a mut Self;
7038 fn take_or_borrow<'a>(
7039 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7040 ) -> Self::Borrowed<'a> {
7041 value
7042 }
7043 }
7044
7045 unsafe impl fidl::encoding::TypeMarker for SessionGetFifoResponse {
7046 type Owned = Self;
7047
7048 #[inline(always)]
7049 fn inline_align(_context: fidl::encoding::Context) -> usize {
7050 4
7051 }
7052
7053 #[inline(always)]
7054 fn inline_size(_context: fidl::encoding::Context) -> usize {
7055 4
7056 }
7057 }
7058
7059 unsafe impl
7060 fidl::encoding::Encode<
7061 SessionGetFifoResponse,
7062 fidl::encoding::DefaultFuchsiaResourceDialect,
7063 > for &mut SessionGetFifoResponse
7064 {
7065 #[inline]
7066 unsafe fn encode(
7067 self,
7068 encoder: &mut fidl::encoding::Encoder<
7069 '_,
7070 fidl::encoding::DefaultFuchsiaResourceDialect,
7071 >,
7072 offset: usize,
7073 _depth: fidl::encoding::Depth,
7074 ) -> fidl::Result<()> {
7075 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
7076 fidl::encoding::Encode::<
7078 SessionGetFifoResponse,
7079 fidl::encoding::DefaultFuchsiaResourceDialect,
7080 >::encode(
7081 (<fidl::encoding::HandleType<
7082 fidl::Fifo,
7083 { fidl::ObjectType::FIFO.into_raw() },
7084 2147483648,
7085 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7086 &mut self.fifo
7087 ),),
7088 encoder,
7089 offset,
7090 _depth,
7091 )
7092 }
7093 }
7094 unsafe impl<
7095 T0: fidl::encoding::Encode<
7096 fidl::encoding::HandleType<
7097 fidl::Fifo,
7098 { fidl::ObjectType::FIFO.into_raw() },
7099 2147483648,
7100 >,
7101 fidl::encoding::DefaultFuchsiaResourceDialect,
7102 >,
7103 >
7104 fidl::encoding::Encode<
7105 SessionGetFifoResponse,
7106 fidl::encoding::DefaultFuchsiaResourceDialect,
7107 > for (T0,)
7108 {
7109 #[inline]
7110 unsafe fn encode(
7111 self,
7112 encoder: &mut fidl::encoding::Encoder<
7113 '_,
7114 fidl::encoding::DefaultFuchsiaResourceDialect,
7115 >,
7116 offset: usize,
7117 depth: fidl::encoding::Depth,
7118 ) -> fidl::Result<()> {
7119 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
7120 self.0.encode(encoder, offset + 0, depth)?;
7124 Ok(())
7125 }
7126 }
7127
7128 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7129 for SessionGetFifoResponse
7130 {
7131 #[inline(always)]
7132 fn new_empty() -> Self {
7133 Self {
7134 fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
7135 }
7136 }
7137
7138 #[inline]
7139 unsafe fn decode(
7140 &mut self,
7141 decoder: &mut fidl::encoding::Decoder<
7142 '_,
7143 fidl::encoding::DefaultFuchsiaResourceDialect,
7144 >,
7145 offset: usize,
7146 _depth: fidl::encoding::Depth,
7147 ) -> fidl::Result<()> {
7148 decoder.debug_check_bounds::<Self>(offset);
7149 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fifo, decoder, offset + 0, _depth)?;
7151 Ok(())
7152 }
7153 }
7154}