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 BlockOpenSessionRequest {
16 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockOpenSessionRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct BlockOpenSessionWithOffsetMapRequest {
23 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
24 pub mapping: BlockOffsetMapping,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28 for BlockOpenSessionWithOffsetMapRequest
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct SessionAttachVmoRequest {
34 pub vmo: fidl::Vmo,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionAttachVmoRequest {}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct SessionGetFifoResponse {
41 pub fifo: fidl::Fifo,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionGetFifoResponse {}
45
46#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
47pub struct BlockMarker;
48
49impl fidl::endpoints::ProtocolMarker for BlockMarker {
50 type Proxy = BlockProxy;
51 type RequestStream = BlockRequestStream;
52 #[cfg(target_os = "fuchsia")]
53 type SynchronousProxy = BlockSynchronousProxy;
54
55 const DEBUG_NAME: &'static str = "fuchsia.storage.block.Block";
56}
57impl fidl::endpoints::DiscoverableProtocolMarker for BlockMarker {}
58pub type BlockGetInfoResult = Result<BlockInfo, i32>;
59pub type BlockGetMetadataResult = Result<BlockGetMetadataResponse, i32>;
60
61pub trait BlockProxyInterface: Send + Sync {
62 type GetInfoResponseFut: std::future::Future<Output = Result<BlockGetInfoResult, fidl::Error>>
63 + Send;
64 fn r#get_info(&self) -> Self::GetInfoResponseFut;
65 fn r#open_session(
66 &self,
67 session: fidl::endpoints::ServerEnd<SessionMarker>,
68 ) -> Result<(), fidl::Error>;
69 fn r#open_session_with_offset_map(
70 &self,
71 session: fidl::endpoints::ServerEnd<SessionMarker>,
72 mapping: &BlockOffsetMapping,
73 ) -> Result<(), fidl::Error>;
74 type GetTypeGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
75 + Send;
76 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
77 type GetInstanceGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
78 + Send;
79 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
80 type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
81 + Send;
82 fn r#get_name(&self) -> Self::GetNameResponseFut;
83 type GetMetadataResponseFut: std::future::Future<Output = Result<BlockGetMetadataResult, fidl::Error>>
84 + Send;
85 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
86 type QuerySlicesResponseFut: std::future::Future<Output = Result<(i32, [VsliceRange; 16], u64), fidl::Error>>
87 + Send;
88 fn r#query_slices(&self, start_slices: &[u64]) -> Self::QuerySlicesResponseFut;
89 type GetVolumeInfoResponseFut: std::future::Future<
90 Output = Result<
91 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
92 fidl::Error,
93 >,
94 > + Send;
95 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut;
96 type ExtendResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
97 fn r#extend(&self, start_slice: u64, slice_count: u64) -> Self::ExtendResponseFut;
98 type ShrinkResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
99 fn r#shrink(&self, start_slice: u64, slice_count: u64) -> Self::ShrinkResponseFut;
100 type DestroyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
101 fn r#destroy(&self) -> Self::DestroyResponseFut;
102}
103#[derive(Debug)]
104#[cfg(target_os = "fuchsia")]
105pub struct BlockSynchronousProxy {
106 client: fidl::client::sync::Client,
107}
108
109#[cfg(target_os = "fuchsia")]
110impl fidl::endpoints::SynchronousProxy for BlockSynchronousProxy {
111 type Proxy = BlockProxy;
112 type Protocol = BlockMarker;
113
114 fn from_channel(inner: fidl::Channel) -> Self {
115 Self::new(inner)
116 }
117
118 fn into_channel(self) -> fidl::Channel {
119 self.client.into_channel()
120 }
121
122 fn as_channel(&self) -> &fidl::Channel {
123 self.client.as_channel()
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl BlockSynchronousProxy {
129 pub fn new(channel: fidl::Channel) -> Self {
130 Self { client: fidl::client::sync::Client::new(channel) }
131 }
132
133 pub fn into_channel(self) -> fidl::Channel {
134 self.client.into_channel()
135 }
136
137 pub fn wait_for_event(
140 &self,
141 deadline: zx::MonotonicInstant,
142 ) -> Result<BlockEvent, fidl::Error> {
143 BlockEvent::decode(self.client.wait_for_event::<BlockMarker>(deadline)?)
144 }
145
146 pub fn r#get_info(
148 &self,
149 ___deadline: zx::MonotonicInstant,
150 ) -> Result<BlockGetInfoResult, fidl::Error> {
151 let _response = self.client.send_query::<
152 fidl::encoding::EmptyPayload,
153 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
154 BlockMarker,
155 >(
156 (),
157 0x58777a4a31cc9a47,
158 fidl::encoding::DynamicFlags::empty(),
159 ___deadline,
160 )?;
161 Ok(_response.map(|x| x.info))
162 }
163
164 pub fn r#open_session(
166 &self,
167 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
168 ) -> Result<(), fidl::Error> {
169 self.client.send::<BlockOpenSessionRequest>(
170 (session,),
171 0x2ca32f8c64f1d6c8,
172 fidl::encoding::DynamicFlags::empty(),
173 )
174 }
175
176 pub fn r#open_session_with_offset_map(
187 &self,
188 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
189 mut mapping: &BlockOffsetMapping,
190 ) -> Result<(), fidl::Error> {
191 self.client.send::<BlockOpenSessionWithOffsetMapRequest>(
192 (session, mapping),
193 0x4417dc2d57b4b574,
194 fidl::encoding::DynamicFlags::empty(),
195 )
196 }
197
198 pub fn r#get_type_guid(
201 &self,
202 ___deadline: zx::MonotonicInstant,
203 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
204 let _response = self
205 .client
206 .send_query::<fidl::encoding::EmptyPayload, BlockGetTypeGuidResponse, BlockMarker>(
207 (),
208 0xefe4e41dafce4cc,
209 fidl::encoding::DynamicFlags::empty(),
210 ___deadline,
211 )?;
212 Ok((_response.status, _response.guid))
213 }
214
215 pub fn r#get_instance_guid(
218 &self,
219 ___deadline: zx::MonotonicInstant,
220 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
221 let _response = self
222 .client
223 .send_query::<fidl::encoding::EmptyPayload, BlockGetInstanceGuidResponse, BlockMarker>(
224 (),
225 0x2e85011aabeb87fb,
226 fidl::encoding::DynamicFlags::empty(),
227 ___deadline,
228 )?;
229 Ok((_response.status, _response.guid))
230 }
231
232 pub fn r#get_name(
235 &self,
236 ___deadline: zx::MonotonicInstant,
237 ) -> Result<(i32, Option<String>), fidl::Error> {
238 let _response = self
239 .client
240 .send_query::<fidl::encoding::EmptyPayload, BlockGetNameResponse, BlockMarker>(
241 (),
242 0x630be18badedbb05,
243 fidl::encoding::DynamicFlags::empty(),
244 ___deadline,
245 )?;
246 Ok((_response.status, _response.name))
247 }
248
249 pub fn r#get_metadata(
253 &self,
254 ___deadline: zx::MonotonicInstant,
255 ) -> Result<BlockGetMetadataResult, fidl::Error> {
256 let _response = self.client.send_query::<
257 fidl::encoding::EmptyPayload,
258 fidl::encoding::ResultType<BlockGetMetadataResponse, i32>,
259 BlockMarker,
260 >(
261 (),
262 0x2c76b02ef9382533,
263 fidl::encoding::DynamicFlags::empty(),
264 ___deadline,
265 )?;
266 Ok(_response.map(|x| x))
267 }
268
269 pub fn r#query_slices(
274 &self,
275 mut start_slices: &[u64],
276 ___deadline: zx::MonotonicInstant,
277 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
278 let _response = self
279 .client
280 .send_query::<BlockQuerySlicesRequest, BlockQuerySlicesResponse, BlockMarker>(
281 (start_slices,),
282 0x289240ac4fbaa190,
283 fidl::encoding::DynamicFlags::empty(),
284 ___deadline,
285 )?;
286 Ok((_response.status, _response.response, _response.response_count))
287 }
288
289 pub fn r#get_volume_info(
293 &self,
294 ___deadline: zx::MonotonicInstant,
295 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error> {
296 let _response = self
297 .client
298 .send_query::<fidl::encoding::EmptyPayload, BlockGetVolumeInfoResponse, BlockMarker>(
299 (),
300 0x3a7dc69ea5d788d4,
301 fidl::encoding::DynamicFlags::empty(),
302 ___deadline,
303 )?;
304 Ok((_response.status, _response.manager, _response.volume))
305 }
306
307 pub fn r#extend(
315 &self,
316 mut start_slice: u64,
317 mut slice_count: u64,
318 ___deadline: zx::MonotonicInstant,
319 ) -> Result<i32, fidl::Error> {
320 let _response =
321 self.client.send_query::<BlockExtendRequest, BlockExtendResponse, BlockMarker>(
322 (start_slice, slice_count),
323 0x273fb2980ff24157,
324 fidl::encoding::DynamicFlags::empty(),
325 ___deadline,
326 )?;
327 Ok(_response.status)
328 }
329
330 pub fn r#shrink(
335 &self,
336 mut start_slice: u64,
337 mut slice_count: u64,
338 ___deadline: zx::MonotonicInstant,
339 ) -> Result<i32, fidl::Error> {
340 let _response =
341 self.client.send_query::<BlockShrinkRequest, BlockShrinkResponse, BlockMarker>(
342 (start_slice, slice_count),
343 0x73da6de865600a8b,
344 fidl::encoding::DynamicFlags::empty(),
345 ___deadline,
346 )?;
347 Ok(_response.status)
348 }
349
350 pub fn r#destroy(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
355 let _response = self
356 .client
357 .send_query::<fidl::encoding::EmptyPayload, BlockDestroyResponse, BlockMarker>(
358 (),
359 0x5866ba764e05a68e,
360 fidl::encoding::DynamicFlags::empty(),
361 ___deadline,
362 )?;
363 Ok(_response.status)
364 }
365}
366
367#[cfg(target_os = "fuchsia")]
368impl From<BlockSynchronousProxy> for zx::NullableHandle {
369 fn from(value: BlockSynchronousProxy) -> Self {
370 value.into_channel().into()
371 }
372}
373
374#[cfg(target_os = "fuchsia")]
375impl From<fidl::Channel> for BlockSynchronousProxy {
376 fn from(value: fidl::Channel) -> Self {
377 Self::new(value)
378 }
379}
380
381#[cfg(target_os = "fuchsia")]
382impl fidl::endpoints::FromClient for BlockSynchronousProxy {
383 type Protocol = BlockMarker;
384
385 fn from_client(value: fidl::endpoints::ClientEnd<BlockMarker>) -> Self {
386 Self::new(value.into_channel())
387 }
388}
389
390#[derive(Debug, Clone)]
391pub struct BlockProxy {
392 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
393}
394
395impl fidl::endpoints::Proxy for BlockProxy {
396 type Protocol = BlockMarker;
397
398 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
399 Self::new(inner)
400 }
401
402 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
403 self.client.into_channel().map_err(|client| Self { client })
404 }
405
406 fn as_channel(&self) -> &::fidl::AsyncChannel {
407 self.client.as_channel()
408 }
409}
410
411impl BlockProxy {
412 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
414 let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
415 Self { client: fidl::client::Client::new(channel, protocol_name) }
416 }
417
418 pub fn take_event_stream(&self) -> BlockEventStream {
424 BlockEventStream { event_receiver: self.client.take_event_receiver() }
425 }
426
427 pub fn r#get_info(
429 &self,
430 ) -> fidl::client::QueryResponseFut<
431 BlockGetInfoResult,
432 fidl::encoding::DefaultFuchsiaResourceDialect,
433 > {
434 BlockProxyInterface::r#get_info(self)
435 }
436
437 pub fn r#open_session(
439 &self,
440 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
441 ) -> Result<(), fidl::Error> {
442 BlockProxyInterface::r#open_session(self, session)
443 }
444
445 pub fn r#open_session_with_offset_map(
456 &self,
457 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
458 mut mapping: &BlockOffsetMapping,
459 ) -> Result<(), fidl::Error> {
460 BlockProxyInterface::r#open_session_with_offset_map(self, session, mapping)
461 }
462
463 pub fn r#get_type_guid(
466 &self,
467 ) -> fidl::client::QueryResponseFut<
468 (i32, Option<Box<Guid>>),
469 fidl::encoding::DefaultFuchsiaResourceDialect,
470 > {
471 BlockProxyInterface::r#get_type_guid(self)
472 }
473
474 pub fn r#get_instance_guid(
477 &self,
478 ) -> fidl::client::QueryResponseFut<
479 (i32, Option<Box<Guid>>),
480 fidl::encoding::DefaultFuchsiaResourceDialect,
481 > {
482 BlockProxyInterface::r#get_instance_guid(self)
483 }
484
485 pub fn r#get_name(
488 &self,
489 ) -> fidl::client::QueryResponseFut<
490 (i32, Option<String>),
491 fidl::encoding::DefaultFuchsiaResourceDialect,
492 > {
493 BlockProxyInterface::r#get_name(self)
494 }
495
496 pub fn r#get_metadata(
500 &self,
501 ) -> fidl::client::QueryResponseFut<
502 BlockGetMetadataResult,
503 fidl::encoding::DefaultFuchsiaResourceDialect,
504 > {
505 BlockProxyInterface::r#get_metadata(self)
506 }
507
508 pub fn r#query_slices(
513 &self,
514 mut start_slices: &[u64],
515 ) -> fidl::client::QueryResponseFut<
516 (i32, [VsliceRange; 16], u64),
517 fidl::encoding::DefaultFuchsiaResourceDialect,
518 > {
519 BlockProxyInterface::r#query_slices(self, start_slices)
520 }
521
522 pub fn r#get_volume_info(
526 &self,
527 ) -> fidl::client::QueryResponseFut<
528 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
529 fidl::encoding::DefaultFuchsiaResourceDialect,
530 > {
531 BlockProxyInterface::r#get_volume_info(self)
532 }
533
534 pub fn r#extend(
542 &self,
543 mut start_slice: u64,
544 mut slice_count: u64,
545 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
546 BlockProxyInterface::r#extend(self, start_slice, slice_count)
547 }
548
549 pub fn r#shrink(
554 &self,
555 mut start_slice: u64,
556 mut slice_count: u64,
557 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
558 BlockProxyInterface::r#shrink(self, start_slice, slice_count)
559 }
560
561 pub fn r#destroy(
566 &self,
567 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
568 BlockProxyInterface::r#destroy(self)
569 }
570}
571
572impl BlockProxyInterface for BlockProxy {
573 type GetInfoResponseFut = fidl::client::QueryResponseFut<
574 BlockGetInfoResult,
575 fidl::encoding::DefaultFuchsiaResourceDialect,
576 >;
577 fn r#get_info(&self) -> Self::GetInfoResponseFut {
578 fn _decode(
579 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
580 ) -> Result<BlockGetInfoResult, fidl::Error> {
581 let _response = fidl::client::decode_transaction_body::<
582 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
583 fidl::encoding::DefaultFuchsiaResourceDialect,
584 0x58777a4a31cc9a47,
585 >(_buf?)?;
586 Ok(_response.map(|x| x.info))
587 }
588 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetInfoResult>(
589 (),
590 0x58777a4a31cc9a47,
591 fidl::encoding::DynamicFlags::empty(),
592 _decode,
593 )
594 }
595
596 fn r#open_session(
597 &self,
598 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
599 ) -> Result<(), fidl::Error> {
600 self.client.send::<BlockOpenSessionRequest>(
601 (session,),
602 0x2ca32f8c64f1d6c8,
603 fidl::encoding::DynamicFlags::empty(),
604 )
605 }
606
607 fn r#open_session_with_offset_map(
608 &self,
609 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
610 mut mapping: &BlockOffsetMapping,
611 ) -> Result<(), fidl::Error> {
612 self.client.send::<BlockOpenSessionWithOffsetMapRequest>(
613 (session, mapping),
614 0x4417dc2d57b4b574,
615 fidl::encoding::DynamicFlags::empty(),
616 )
617 }
618
619 type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
620 (i32, Option<Box<Guid>>),
621 fidl::encoding::DefaultFuchsiaResourceDialect,
622 >;
623 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
624 fn _decode(
625 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
626 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
627 let _response = fidl::client::decode_transaction_body::<
628 BlockGetTypeGuidResponse,
629 fidl::encoding::DefaultFuchsiaResourceDialect,
630 0xefe4e41dafce4cc,
631 >(_buf?)?;
632 Ok((_response.status, _response.guid))
633 }
634 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
635 (),
636 0xefe4e41dafce4cc,
637 fidl::encoding::DynamicFlags::empty(),
638 _decode,
639 )
640 }
641
642 type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
643 (i32, Option<Box<Guid>>),
644 fidl::encoding::DefaultFuchsiaResourceDialect,
645 >;
646 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
647 fn _decode(
648 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
649 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
650 let _response = fidl::client::decode_transaction_body::<
651 BlockGetInstanceGuidResponse,
652 fidl::encoding::DefaultFuchsiaResourceDialect,
653 0x2e85011aabeb87fb,
654 >(_buf?)?;
655 Ok((_response.status, _response.guid))
656 }
657 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
658 (),
659 0x2e85011aabeb87fb,
660 fidl::encoding::DynamicFlags::empty(),
661 _decode,
662 )
663 }
664
665 type GetNameResponseFut = fidl::client::QueryResponseFut<
666 (i32, Option<String>),
667 fidl::encoding::DefaultFuchsiaResourceDialect,
668 >;
669 fn r#get_name(&self) -> Self::GetNameResponseFut {
670 fn _decode(
671 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
672 ) -> Result<(i32, Option<String>), fidl::Error> {
673 let _response = fidl::client::decode_transaction_body::<
674 BlockGetNameResponse,
675 fidl::encoding::DefaultFuchsiaResourceDialect,
676 0x630be18badedbb05,
677 >(_buf?)?;
678 Ok((_response.status, _response.name))
679 }
680 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
681 (),
682 0x630be18badedbb05,
683 fidl::encoding::DynamicFlags::empty(),
684 _decode,
685 )
686 }
687
688 type GetMetadataResponseFut = fidl::client::QueryResponseFut<
689 BlockGetMetadataResult,
690 fidl::encoding::DefaultFuchsiaResourceDialect,
691 >;
692 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
693 fn _decode(
694 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
695 ) -> Result<BlockGetMetadataResult, fidl::Error> {
696 let _response = fidl::client::decode_transaction_body::<
697 fidl::encoding::ResultType<BlockGetMetadataResponse, i32>,
698 fidl::encoding::DefaultFuchsiaResourceDialect,
699 0x2c76b02ef9382533,
700 >(_buf?)?;
701 Ok(_response.map(|x| x))
702 }
703 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetMetadataResult>(
704 (),
705 0x2c76b02ef9382533,
706 fidl::encoding::DynamicFlags::empty(),
707 _decode,
708 )
709 }
710
711 type QuerySlicesResponseFut = fidl::client::QueryResponseFut<
712 (i32, [VsliceRange; 16], u64),
713 fidl::encoding::DefaultFuchsiaResourceDialect,
714 >;
715 fn r#query_slices(&self, mut start_slices: &[u64]) -> Self::QuerySlicesResponseFut {
716 fn _decode(
717 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
718 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
719 let _response = fidl::client::decode_transaction_body::<
720 BlockQuerySlicesResponse,
721 fidl::encoding::DefaultFuchsiaResourceDialect,
722 0x289240ac4fbaa190,
723 >(_buf?)?;
724 Ok((_response.status, _response.response, _response.response_count))
725 }
726 self.client.send_query_and_decode::<BlockQuerySlicesRequest, (i32, [VsliceRange; 16], u64)>(
727 (start_slices,),
728 0x289240ac4fbaa190,
729 fidl::encoding::DynamicFlags::empty(),
730 _decode,
731 )
732 }
733
734 type GetVolumeInfoResponseFut = fidl::client::QueryResponseFut<
735 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
736 fidl::encoding::DefaultFuchsiaResourceDialect,
737 >;
738 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut {
739 fn _decode(
740 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
741 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error>
742 {
743 let _response = fidl::client::decode_transaction_body::<
744 BlockGetVolumeInfoResponse,
745 fidl::encoding::DefaultFuchsiaResourceDialect,
746 0x3a7dc69ea5d788d4,
747 >(_buf?)?;
748 Ok((_response.status, _response.manager, _response.volume))
749 }
750 self.client.send_query_and_decode::<
751 fidl::encoding::EmptyPayload,
752 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
753 >(
754 (),
755 0x3a7dc69ea5d788d4,
756 fidl::encoding::DynamicFlags::empty(),
757 _decode,
758 )
759 }
760
761 type ExtendResponseFut =
762 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
763 fn r#extend(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ExtendResponseFut {
764 fn _decode(
765 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
766 ) -> Result<i32, fidl::Error> {
767 let _response = fidl::client::decode_transaction_body::<
768 BlockExtendResponse,
769 fidl::encoding::DefaultFuchsiaResourceDialect,
770 0x273fb2980ff24157,
771 >(_buf?)?;
772 Ok(_response.status)
773 }
774 self.client.send_query_and_decode::<BlockExtendRequest, i32>(
775 (start_slice, slice_count),
776 0x273fb2980ff24157,
777 fidl::encoding::DynamicFlags::empty(),
778 _decode,
779 )
780 }
781
782 type ShrinkResponseFut =
783 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
784 fn r#shrink(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ShrinkResponseFut {
785 fn _decode(
786 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
787 ) -> Result<i32, fidl::Error> {
788 let _response = fidl::client::decode_transaction_body::<
789 BlockShrinkResponse,
790 fidl::encoding::DefaultFuchsiaResourceDialect,
791 0x73da6de865600a8b,
792 >(_buf?)?;
793 Ok(_response.status)
794 }
795 self.client.send_query_and_decode::<BlockShrinkRequest, i32>(
796 (start_slice, slice_count),
797 0x73da6de865600a8b,
798 fidl::encoding::DynamicFlags::empty(),
799 _decode,
800 )
801 }
802
803 type DestroyResponseFut =
804 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
805 fn r#destroy(&self) -> Self::DestroyResponseFut {
806 fn _decode(
807 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
808 ) -> Result<i32, fidl::Error> {
809 let _response = fidl::client::decode_transaction_body::<
810 BlockDestroyResponse,
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 0x5866ba764e05a68e,
813 >(_buf?)?;
814 Ok(_response.status)
815 }
816 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
817 (),
818 0x5866ba764e05a68e,
819 fidl::encoding::DynamicFlags::empty(),
820 _decode,
821 )
822 }
823}
824
825pub struct BlockEventStream {
826 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
827}
828
829impl std::marker::Unpin for BlockEventStream {}
830
831impl futures::stream::FusedStream for BlockEventStream {
832 fn is_terminated(&self) -> bool {
833 self.event_receiver.is_terminated()
834 }
835}
836
837impl futures::Stream for BlockEventStream {
838 type Item = Result<BlockEvent, fidl::Error>;
839
840 fn poll_next(
841 mut self: std::pin::Pin<&mut Self>,
842 cx: &mut std::task::Context<'_>,
843 ) -> std::task::Poll<Option<Self::Item>> {
844 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
845 &mut self.event_receiver,
846 cx
847 )?) {
848 Some(buf) => std::task::Poll::Ready(Some(BlockEvent::decode(buf))),
849 None => std::task::Poll::Ready(None),
850 }
851 }
852}
853
854#[derive(Debug)]
855pub enum BlockEvent {}
856
857impl BlockEvent {
858 fn decode(
860 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
861 ) -> Result<BlockEvent, fidl::Error> {
862 let (bytes, _handles) = buf.split_mut();
863 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
864 debug_assert_eq!(tx_header.tx_id, 0);
865 match tx_header.ordinal {
866 _ => Err(fidl::Error::UnknownOrdinal {
867 ordinal: tx_header.ordinal,
868 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
869 }),
870 }
871 }
872}
873
874pub struct BlockRequestStream {
876 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
877 is_terminated: bool,
878}
879
880impl std::marker::Unpin for BlockRequestStream {}
881
882impl futures::stream::FusedStream for BlockRequestStream {
883 fn is_terminated(&self) -> bool {
884 self.is_terminated
885 }
886}
887
888impl fidl::endpoints::RequestStream for BlockRequestStream {
889 type Protocol = BlockMarker;
890 type ControlHandle = BlockControlHandle;
891
892 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
893 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
894 }
895
896 fn control_handle(&self) -> Self::ControlHandle {
897 BlockControlHandle { inner: self.inner.clone() }
898 }
899
900 fn into_inner(
901 self,
902 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
903 {
904 (self.inner, self.is_terminated)
905 }
906
907 fn from_inner(
908 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
909 is_terminated: bool,
910 ) -> Self {
911 Self { inner, is_terminated }
912 }
913}
914
915impl futures::Stream for BlockRequestStream {
916 type Item = Result<BlockRequest, fidl::Error>;
917
918 fn poll_next(
919 mut self: std::pin::Pin<&mut Self>,
920 cx: &mut std::task::Context<'_>,
921 ) -> std::task::Poll<Option<Self::Item>> {
922 let this = &mut *self;
923 if this.inner.check_shutdown(cx) {
924 this.is_terminated = true;
925 return std::task::Poll::Ready(None);
926 }
927 if this.is_terminated {
928 panic!("polled BlockRequestStream after completion");
929 }
930 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
931 |bytes, handles| {
932 match this.inner.channel().read_etc(cx, bytes, handles) {
933 std::task::Poll::Ready(Ok(())) => {}
934 std::task::Poll::Pending => return std::task::Poll::Pending,
935 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
936 this.is_terminated = true;
937 return std::task::Poll::Ready(None);
938 }
939 std::task::Poll::Ready(Err(e)) => {
940 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
941 e.into(),
942 ))));
943 }
944 }
945
946 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
948
949 std::task::Poll::Ready(Some(match header.ordinal {
950 0x58777a4a31cc9a47 => {
951 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
952 let mut req = fidl::new_empty!(
953 fidl::encoding::EmptyPayload,
954 fidl::encoding::DefaultFuchsiaResourceDialect
955 );
956 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
957 let control_handle = BlockControlHandle { inner: this.inner.clone() };
958 Ok(BlockRequest::GetInfo {
959 responder: BlockGetInfoResponder {
960 control_handle: std::mem::ManuallyDrop::new(control_handle),
961 tx_id: header.tx_id,
962 },
963 })
964 }
965 0x2ca32f8c64f1d6c8 => {
966 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
967 let mut req = fidl::new_empty!(
968 BlockOpenSessionRequest,
969 fidl::encoding::DefaultFuchsiaResourceDialect
970 );
971 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
972 let control_handle = BlockControlHandle { inner: this.inner.clone() };
973 Ok(BlockRequest::OpenSession { session: req.session, control_handle })
974 }
975 0x4417dc2d57b4b574 => {
976 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
977 let mut req = fidl::new_empty!(
978 BlockOpenSessionWithOffsetMapRequest,
979 fidl::encoding::DefaultFuchsiaResourceDialect
980 );
981 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
982 let control_handle = BlockControlHandle { inner: this.inner.clone() };
983 Ok(BlockRequest::OpenSessionWithOffsetMap {
984 session: req.session,
985 mapping: req.mapping,
986
987 control_handle,
988 })
989 }
990 0xefe4e41dafce4cc => {
991 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
992 let mut req = fidl::new_empty!(
993 fidl::encoding::EmptyPayload,
994 fidl::encoding::DefaultFuchsiaResourceDialect
995 );
996 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
997 let control_handle = BlockControlHandle { inner: this.inner.clone() };
998 Ok(BlockRequest::GetTypeGuid {
999 responder: BlockGetTypeGuidResponder {
1000 control_handle: std::mem::ManuallyDrop::new(control_handle),
1001 tx_id: header.tx_id,
1002 },
1003 })
1004 }
1005 0x2e85011aabeb87fb => {
1006 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1007 let mut req = fidl::new_empty!(
1008 fidl::encoding::EmptyPayload,
1009 fidl::encoding::DefaultFuchsiaResourceDialect
1010 );
1011 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1012 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1013 Ok(BlockRequest::GetInstanceGuid {
1014 responder: BlockGetInstanceGuidResponder {
1015 control_handle: std::mem::ManuallyDrop::new(control_handle),
1016 tx_id: header.tx_id,
1017 },
1018 })
1019 }
1020 0x630be18badedbb05 => {
1021 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1022 let mut req = fidl::new_empty!(
1023 fidl::encoding::EmptyPayload,
1024 fidl::encoding::DefaultFuchsiaResourceDialect
1025 );
1026 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1027 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1028 Ok(BlockRequest::GetName {
1029 responder: BlockGetNameResponder {
1030 control_handle: std::mem::ManuallyDrop::new(control_handle),
1031 tx_id: header.tx_id,
1032 },
1033 })
1034 }
1035 0x2c76b02ef9382533 => {
1036 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1037 let mut req = fidl::new_empty!(
1038 fidl::encoding::EmptyPayload,
1039 fidl::encoding::DefaultFuchsiaResourceDialect
1040 );
1041 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1042 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1043 Ok(BlockRequest::GetMetadata {
1044 responder: BlockGetMetadataResponder {
1045 control_handle: std::mem::ManuallyDrop::new(control_handle),
1046 tx_id: header.tx_id,
1047 },
1048 })
1049 }
1050 0x289240ac4fbaa190 => {
1051 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1052 let mut req = fidl::new_empty!(
1053 BlockQuerySlicesRequest,
1054 fidl::encoding::DefaultFuchsiaResourceDialect
1055 );
1056 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockQuerySlicesRequest>(&header, _body_bytes, handles, &mut req)?;
1057 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1058 Ok(BlockRequest::QuerySlices {
1059 start_slices: req.start_slices,
1060
1061 responder: BlockQuerySlicesResponder {
1062 control_handle: std::mem::ManuallyDrop::new(control_handle),
1063 tx_id: header.tx_id,
1064 },
1065 })
1066 }
1067 0x3a7dc69ea5d788d4 => {
1068 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1069 let mut req = fidl::new_empty!(
1070 fidl::encoding::EmptyPayload,
1071 fidl::encoding::DefaultFuchsiaResourceDialect
1072 );
1073 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1074 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1075 Ok(BlockRequest::GetVolumeInfo {
1076 responder: BlockGetVolumeInfoResponder {
1077 control_handle: std::mem::ManuallyDrop::new(control_handle),
1078 tx_id: header.tx_id,
1079 },
1080 })
1081 }
1082 0x273fb2980ff24157 => {
1083 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1084 let mut req = fidl::new_empty!(
1085 BlockExtendRequest,
1086 fidl::encoding::DefaultFuchsiaResourceDialect
1087 );
1088 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockExtendRequest>(&header, _body_bytes, handles, &mut req)?;
1089 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1090 Ok(BlockRequest::Extend {
1091 start_slice: req.start_slice,
1092 slice_count: req.slice_count,
1093
1094 responder: BlockExtendResponder {
1095 control_handle: std::mem::ManuallyDrop::new(control_handle),
1096 tx_id: header.tx_id,
1097 },
1098 })
1099 }
1100 0x73da6de865600a8b => {
1101 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1102 let mut req = fidl::new_empty!(
1103 BlockShrinkRequest,
1104 fidl::encoding::DefaultFuchsiaResourceDialect
1105 );
1106 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockShrinkRequest>(&header, _body_bytes, handles, &mut req)?;
1107 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1108 Ok(BlockRequest::Shrink {
1109 start_slice: req.start_slice,
1110 slice_count: req.slice_count,
1111
1112 responder: BlockShrinkResponder {
1113 control_handle: std::mem::ManuallyDrop::new(control_handle),
1114 tx_id: header.tx_id,
1115 },
1116 })
1117 }
1118 0x5866ba764e05a68e => {
1119 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1120 let mut req = fidl::new_empty!(
1121 fidl::encoding::EmptyPayload,
1122 fidl::encoding::DefaultFuchsiaResourceDialect
1123 );
1124 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1125 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1126 Ok(BlockRequest::Destroy {
1127 responder: BlockDestroyResponder {
1128 control_handle: std::mem::ManuallyDrop::new(control_handle),
1129 tx_id: header.tx_id,
1130 },
1131 })
1132 }
1133 _ => Err(fidl::Error::UnknownOrdinal {
1134 ordinal: header.ordinal,
1135 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1136 }),
1137 }))
1138 },
1139 )
1140 }
1141}
1142
1143#[derive(Debug)]
1146pub enum BlockRequest {
1147 GetInfo { responder: BlockGetInfoResponder },
1149 OpenSession {
1151 session: fidl::endpoints::ServerEnd<SessionMarker>,
1152 control_handle: BlockControlHandle,
1153 },
1154 OpenSessionWithOffsetMap {
1165 session: fidl::endpoints::ServerEnd<SessionMarker>,
1166 mapping: BlockOffsetMapping,
1167 control_handle: BlockControlHandle,
1168 },
1169 GetTypeGuid { responder: BlockGetTypeGuidResponder },
1172 GetInstanceGuid { responder: BlockGetInstanceGuidResponder },
1175 GetName { responder: BlockGetNameResponder },
1178 GetMetadata { responder: BlockGetMetadataResponder },
1182 QuerySlices { start_slices: Vec<u64>, responder: BlockQuerySlicesResponder },
1187 GetVolumeInfo { responder: BlockGetVolumeInfoResponder },
1191 Extend { start_slice: u64, slice_count: u64, responder: BlockExtendResponder },
1199 Shrink { start_slice: u64, slice_count: u64, responder: BlockShrinkResponder },
1204 Destroy { responder: BlockDestroyResponder },
1209}
1210
1211impl BlockRequest {
1212 #[allow(irrefutable_let_patterns)]
1213 pub fn into_get_info(self) -> Option<(BlockGetInfoResponder)> {
1214 if let BlockRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1215 }
1216
1217 #[allow(irrefutable_let_patterns)]
1218 pub fn into_open_session(
1219 self,
1220 ) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockControlHandle)> {
1221 if let BlockRequest::OpenSession { session, control_handle } = self {
1222 Some((session, control_handle))
1223 } else {
1224 None
1225 }
1226 }
1227
1228 #[allow(irrefutable_let_patterns)]
1229 pub fn into_open_session_with_offset_map(
1230 self,
1231 ) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockOffsetMapping, BlockControlHandle)>
1232 {
1233 if let BlockRequest::OpenSessionWithOffsetMap { session, mapping, control_handle } = self {
1234 Some((session, mapping, control_handle))
1235 } else {
1236 None
1237 }
1238 }
1239
1240 #[allow(irrefutable_let_patterns)]
1241 pub fn into_get_type_guid(self) -> Option<(BlockGetTypeGuidResponder)> {
1242 if let BlockRequest::GetTypeGuid { responder } = self { Some((responder)) } else { None }
1243 }
1244
1245 #[allow(irrefutable_let_patterns)]
1246 pub fn into_get_instance_guid(self) -> Option<(BlockGetInstanceGuidResponder)> {
1247 if let BlockRequest::GetInstanceGuid { responder } = self {
1248 Some((responder))
1249 } else {
1250 None
1251 }
1252 }
1253
1254 #[allow(irrefutable_let_patterns)]
1255 pub fn into_get_name(self) -> Option<(BlockGetNameResponder)> {
1256 if let BlockRequest::GetName { responder } = self { Some((responder)) } else { None }
1257 }
1258
1259 #[allow(irrefutable_let_patterns)]
1260 pub fn into_get_metadata(self) -> Option<(BlockGetMetadataResponder)> {
1261 if let BlockRequest::GetMetadata { responder } = self { Some((responder)) } else { None }
1262 }
1263
1264 #[allow(irrefutable_let_patterns)]
1265 pub fn into_query_slices(self) -> Option<(Vec<u64>, BlockQuerySlicesResponder)> {
1266 if let BlockRequest::QuerySlices { start_slices, responder } = self {
1267 Some((start_slices, responder))
1268 } else {
1269 None
1270 }
1271 }
1272
1273 #[allow(irrefutable_let_patterns)]
1274 pub fn into_get_volume_info(self) -> Option<(BlockGetVolumeInfoResponder)> {
1275 if let BlockRequest::GetVolumeInfo { responder } = self { Some((responder)) } else { None }
1276 }
1277
1278 #[allow(irrefutable_let_patterns)]
1279 pub fn into_extend(self) -> Option<(u64, u64, BlockExtendResponder)> {
1280 if let BlockRequest::Extend { start_slice, slice_count, responder } = self {
1281 Some((start_slice, slice_count, responder))
1282 } else {
1283 None
1284 }
1285 }
1286
1287 #[allow(irrefutable_let_patterns)]
1288 pub fn into_shrink(self) -> Option<(u64, u64, BlockShrinkResponder)> {
1289 if let BlockRequest::Shrink { start_slice, slice_count, responder } = self {
1290 Some((start_slice, slice_count, responder))
1291 } else {
1292 None
1293 }
1294 }
1295
1296 #[allow(irrefutable_let_patterns)]
1297 pub fn into_destroy(self) -> Option<(BlockDestroyResponder)> {
1298 if let BlockRequest::Destroy { responder } = self { Some((responder)) } else { None }
1299 }
1300
1301 pub fn method_name(&self) -> &'static str {
1303 match *self {
1304 BlockRequest::GetInfo { .. } => "get_info",
1305 BlockRequest::OpenSession { .. } => "open_session",
1306 BlockRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
1307 BlockRequest::GetTypeGuid { .. } => "get_type_guid",
1308 BlockRequest::GetInstanceGuid { .. } => "get_instance_guid",
1309 BlockRequest::GetName { .. } => "get_name",
1310 BlockRequest::GetMetadata { .. } => "get_metadata",
1311 BlockRequest::QuerySlices { .. } => "query_slices",
1312 BlockRequest::GetVolumeInfo { .. } => "get_volume_info",
1313 BlockRequest::Extend { .. } => "extend",
1314 BlockRequest::Shrink { .. } => "shrink",
1315 BlockRequest::Destroy { .. } => "destroy",
1316 }
1317 }
1318}
1319
1320#[derive(Debug, Clone)]
1321pub struct BlockControlHandle {
1322 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1323}
1324
1325impl fidl::endpoints::ControlHandle for BlockControlHandle {
1326 fn shutdown(&self) {
1327 self.inner.shutdown()
1328 }
1329
1330 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1331 self.inner.shutdown_with_epitaph(status)
1332 }
1333
1334 fn is_closed(&self) -> bool {
1335 self.inner.channel().is_closed()
1336 }
1337 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1338 self.inner.channel().on_closed()
1339 }
1340
1341 #[cfg(target_os = "fuchsia")]
1342 fn signal_peer(
1343 &self,
1344 clear_mask: zx::Signals,
1345 set_mask: zx::Signals,
1346 ) -> Result<(), zx_status::Status> {
1347 use fidl::Peered;
1348 self.inner.channel().signal_peer(clear_mask, set_mask)
1349 }
1350}
1351
1352impl BlockControlHandle {}
1353
1354#[must_use = "FIDL methods require a response to be sent"]
1355#[derive(Debug)]
1356pub struct BlockGetInfoResponder {
1357 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1358 tx_id: u32,
1359}
1360
1361impl std::ops::Drop for BlockGetInfoResponder {
1365 fn drop(&mut self) {
1366 self.control_handle.shutdown();
1367 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1369 }
1370}
1371
1372impl fidl::endpoints::Responder for BlockGetInfoResponder {
1373 type ControlHandle = BlockControlHandle;
1374
1375 fn control_handle(&self) -> &BlockControlHandle {
1376 &self.control_handle
1377 }
1378
1379 fn drop_without_shutdown(mut self) {
1380 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1382 std::mem::forget(self);
1384 }
1385}
1386
1387impl BlockGetInfoResponder {
1388 pub fn send(self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1392 let _result = self.send_raw(result);
1393 if _result.is_err() {
1394 self.control_handle.shutdown();
1395 }
1396 self.drop_without_shutdown();
1397 _result
1398 }
1399
1400 pub fn send_no_shutdown_on_err(
1402 self,
1403 mut result: Result<&BlockInfo, i32>,
1404 ) -> Result<(), fidl::Error> {
1405 let _result = self.send_raw(result);
1406 self.drop_without_shutdown();
1407 _result
1408 }
1409
1410 fn send_raw(&self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1411 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetInfoResponse, i32>>(
1412 result.map(|info| (info,)),
1413 self.tx_id,
1414 0x58777a4a31cc9a47,
1415 fidl::encoding::DynamicFlags::empty(),
1416 )
1417 }
1418}
1419
1420#[must_use = "FIDL methods require a response to be sent"]
1421#[derive(Debug)]
1422pub struct BlockGetTypeGuidResponder {
1423 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1424 tx_id: u32,
1425}
1426
1427impl std::ops::Drop for BlockGetTypeGuidResponder {
1431 fn drop(&mut self) {
1432 self.control_handle.shutdown();
1433 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1435 }
1436}
1437
1438impl fidl::endpoints::Responder for BlockGetTypeGuidResponder {
1439 type ControlHandle = BlockControlHandle;
1440
1441 fn control_handle(&self) -> &BlockControlHandle {
1442 &self.control_handle
1443 }
1444
1445 fn drop_without_shutdown(mut self) {
1446 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1448 std::mem::forget(self);
1450 }
1451}
1452
1453impl BlockGetTypeGuidResponder {
1454 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1458 let _result = self.send_raw(status, guid);
1459 if _result.is_err() {
1460 self.control_handle.shutdown();
1461 }
1462 self.drop_without_shutdown();
1463 _result
1464 }
1465
1466 pub fn send_no_shutdown_on_err(
1468 self,
1469 mut status: i32,
1470 mut guid: Option<&Guid>,
1471 ) -> Result<(), fidl::Error> {
1472 let _result = self.send_raw(status, guid);
1473 self.drop_without_shutdown();
1474 _result
1475 }
1476
1477 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1478 self.control_handle.inner.send::<BlockGetTypeGuidResponse>(
1479 (status, guid),
1480 self.tx_id,
1481 0xefe4e41dafce4cc,
1482 fidl::encoding::DynamicFlags::empty(),
1483 )
1484 }
1485}
1486
1487#[must_use = "FIDL methods require a response to be sent"]
1488#[derive(Debug)]
1489pub struct BlockGetInstanceGuidResponder {
1490 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1491 tx_id: u32,
1492}
1493
1494impl std::ops::Drop for BlockGetInstanceGuidResponder {
1498 fn drop(&mut self) {
1499 self.control_handle.shutdown();
1500 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1502 }
1503}
1504
1505impl fidl::endpoints::Responder for BlockGetInstanceGuidResponder {
1506 type ControlHandle = BlockControlHandle;
1507
1508 fn control_handle(&self) -> &BlockControlHandle {
1509 &self.control_handle
1510 }
1511
1512 fn drop_without_shutdown(mut self) {
1513 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1515 std::mem::forget(self);
1517 }
1518}
1519
1520impl BlockGetInstanceGuidResponder {
1521 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1525 let _result = self.send_raw(status, guid);
1526 if _result.is_err() {
1527 self.control_handle.shutdown();
1528 }
1529 self.drop_without_shutdown();
1530 _result
1531 }
1532
1533 pub fn send_no_shutdown_on_err(
1535 self,
1536 mut status: i32,
1537 mut guid: Option<&Guid>,
1538 ) -> Result<(), fidl::Error> {
1539 let _result = self.send_raw(status, guid);
1540 self.drop_without_shutdown();
1541 _result
1542 }
1543
1544 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1545 self.control_handle.inner.send::<BlockGetInstanceGuidResponse>(
1546 (status, guid),
1547 self.tx_id,
1548 0x2e85011aabeb87fb,
1549 fidl::encoding::DynamicFlags::empty(),
1550 )
1551 }
1552}
1553
1554#[must_use = "FIDL methods require a response to be sent"]
1555#[derive(Debug)]
1556pub struct BlockGetNameResponder {
1557 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1558 tx_id: u32,
1559}
1560
1561impl std::ops::Drop for BlockGetNameResponder {
1565 fn drop(&mut self) {
1566 self.control_handle.shutdown();
1567 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569 }
1570}
1571
1572impl fidl::endpoints::Responder for BlockGetNameResponder {
1573 type ControlHandle = BlockControlHandle;
1574
1575 fn control_handle(&self) -> &BlockControlHandle {
1576 &self.control_handle
1577 }
1578
1579 fn drop_without_shutdown(mut self) {
1580 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1582 std::mem::forget(self);
1584 }
1585}
1586
1587impl BlockGetNameResponder {
1588 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1592 let _result = self.send_raw(status, name);
1593 if _result.is_err() {
1594 self.control_handle.shutdown();
1595 }
1596 self.drop_without_shutdown();
1597 _result
1598 }
1599
1600 pub fn send_no_shutdown_on_err(
1602 self,
1603 mut status: i32,
1604 mut name: Option<&str>,
1605 ) -> Result<(), fidl::Error> {
1606 let _result = self.send_raw(status, name);
1607 self.drop_without_shutdown();
1608 _result
1609 }
1610
1611 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1612 self.control_handle.inner.send::<BlockGetNameResponse>(
1613 (status, name),
1614 self.tx_id,
1615 0x630be18badedbb05,
1616 fidl::encoding::DynamicFlags::empty(),
1617 )
1618 }
1619}
1620
1621#[must_use = "FIDL methods require a response to be sent"]
1622#[derive(Debug)]
1623pub struct BlockGetMetadataResponder {
1624 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1625 tx_id: u32,
1626}
1627
1628impl std::ops::Drop for BlockGetMetadataResponder {
1632 fn drop(&mut self) {
1633 self.control_handle.shutdown();
1634 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1636 }
1637}
1638
1639impl fidl::endpoints::Responder for BlockGetMetadataResponder {
1640 type ControlHandle = BlockControlHandle;
1641
1642 fn control_handle(&self) -> &BlockControlHandle {
1643 &self.control_handle
1644 }
1645
1646 fn drop_without_shutdown(mut self) {
1647 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1649 std::mem::forget(self);
1651 }
1652}
1653
1654impl BlockGetMetadataResponder {
1655 pub fn send(
1659 self,
1660 mut result: Result<&BlockGetMetadataResponse, i32>,
1661 ) -> Result<(), fidl::Error> {
1662 let _result = self.send_raw(result);
1663 if _result.is_err() {
1664 self.control_handle.shutdown();
1665 }
1666 self.drop_without_shutdown();
1667 _result
1668 }
1669
1670 pub fn send_no_shutdown_on_err(
1672 self,
1673 mut result: Result<&BlockGetMetadataResponse, i32>,
1674 ) -> Result<(), fidl::Error> {
1675 let _result = self.send_raw(result);
1676 self.drop_without_shutdown();
1677 _result
1678 }
1679
1680 fn send_raw(
1681 &self,
1682 mut result: Result<&BlockGetMetadataResponse, i32>,
1683 ) -> Result<(), fidl::Error> {
1684 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetMetadataResponse, i32>>(
1685 result,
1686 self.tx_id,
1687 0x2c76b02ef9382533,
1688 fidl::encoding::DynamicFlags::empty(),
1689 )
1690 }
1691}
1692
1693#[must_use = "FIDL methods require a response to be sent"]
1694#[derive(Debug)]
1695pub struct BlockQuerySlicesResponder {
1696 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1697 tx_id: u32,
1698}
1699
1700impl std::ops::Drop for BlockQuerySlicesResponder {
1704 fn drop(&mut self) {
1705 self.control_handle.shutdown();
1706 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1708 }
1709}
1710
1711impl fidl::endpoints::Responder for BlockQuerySlicesResponder {
1712 type ControlHandle = BlockControlHandle;
1713
1714 fn control_handle(&self) -> &BlockControlHandle {
1715 &self.control_handle
1716 }
1717
1718 fn drop_without_shutdown(mut self) {
1719 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1721 std::mem::forget(self);
1723 }
1724}
1725
1726impl BlockQuerySlicesResponder {
1727 pub fn send(
1731 self,
1732 mut status: i32,
1733 mut response: &[VsliceRange; 16],
1734 mut response_count: u64,
1735 ) -> Result<(), fidl::Error> {
1736 let _result = self.send_raw(status, response, response_count);
1737 if _result.is_err() {
1738 self.control_handle.shutdown();
1739 }
1740 self.drop_without_shutdown();
1741 _result
1742 }
1743
1744 pub fn send_no_shutdown_on_err(
1746 self,
1747 mut status: i32,
1748 mut response: &[VsliceRange; 16],
1749 mut response_count: u64,
1750 ) -> Result<(), fidl::Error> {
1751 let _result = self.send_raw(status, response, response_count);
1752 self.drop_without_shutdown();
1753 _result
1754 }
1755
1756 fn send_raw(
1757 &self,
1758 mut status: i32,
1759 mut response: &[VsliceRange; 16],
1760 mut response_count: u64,
1761 ) -> Result<(), fidl::Error> {
1762 self.control_handle.inner.send::<BlockQuerySlicesResponse>(
1763 (status, response, response_count),
1764 self.tx_id,
1765 0x289240ac4fbaa190,
1766 fidl::encoding::DynamicFlags::empty(),
1767 )
1768 }
1769}
1770
1771#[must_use = "FIDL methods require a response to be sent"]
1772#[derive(Debug)]
1773pub struct BlockGetVolumeInfoResponder {
1774 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1775 tx_id: u32,
1776}
1777
1778impl std::ops::Drop for BlockGetVolumeInfoResponder {
1782 fn drop(&mut self) {
1783 self.control_handle.shutdown();
1784 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1786 }
1787}
1788
1789impl fidl::endpoints::Responder for BlockGetVolumeInfoResponder {
1790 type ControlHandle = BlockControlHandle;
1791
1792 fn control_handle(&self) -> &BlockControlHandle {
1793 &self.control_handle
1794 }
1795
1796 fn drop_without_shutdown(mut self) {
1797 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1799 std::mem::forget(self);
1801 }
1802}
1803
1804impl BlockGetVolumeInfoResponder {
1805 pub fn send(
1809 self,
1810 mut status: i32,
1811 mut manager: Option<&VolumeManagerInfo>,
1812 mut volume: Option<&VolumeInfo>,
1813 ) -> Result<(), fidl::Error> {
1814 let _result = self.send_raw(status, manager, volume);
1815 if _result.is_err() {
1816 self.control_handle.shutdown();
1817 }
1818 self.drop_without_shutdown();
1819 _result
1820 }
1821
1822 pub fn send_no_shutdown_on_err(
1824 self,
1825 mut status: i32,
1826 mut manager: Option<&VolumeManagerInfo>,
1827 mut volume: Option<&VolumeInfo>,
1828 ) -> Result<(), fidl::Error> {
1829 let _result = self.send_raw(status, manager, volume);
1830 self.drop_without_shutdown();
1831 _result
1832 }
1833
1834 fn send_raw(
1835 &self,
1836 mut status: i32,
1837 mut manager: Option<&VolumeManagerInfo>,
1838 mut volume: Option<&VolumeInfo>,
1839 ) -> Result<(), fidl::Error> {
1840 self.control_handle.inner.send::<BlockGetVolumeInfoResponse>(
1841 (status, manager, volume),
1842 self.tx_id,
1843 0x3a7dc69ea5d788d4,
1844 fidl::encoding::DynamicFlags::empty(),
1845 )
1846 }
1847}
1848
1849#[must_use = "FIDL methods require a response to be sent"]
1850#[derive(Debug)]
1851pub struct BlockExtendResponder {
1852 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1853 tx_id: u32,
1854}
1855
1856impl std::ops::Drop for BlockExtendResponder {
1860 fn drop(&mut self) {
1861 self.control_handle.shutdown();
1862 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1864 }
1865}
1866
1867impl fidl::endpoints::Responder for BlockExtendResponder {
1868 type ControlHandle = BlockControlHandle;
1869
1870 fn control_handle(&self) -> &BlockControlHandle {
1871 &self.control_handle
1872 }
1873
1874 fn drop_without_shutdown(mut self) {
1875 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1877 std::mem::forget(self);
1879 }
1880}
1881
1882impl BlockExtendResponder {
1883 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1887 let _result = self.send_raw(status);
1888 if _result.is_err() {
1889 self.control_handle.shutdown();
1890 }
1891 self.drop_without_shutdown();
1892 _result
1893 }
1894
1895 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1897 let _result = self.send_raw(status);
1898 self.drop_without_shutdown();
1899 _result
1900 }
1901
1902 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1903 self.control_handle.inner.send::<BlockExtendResponse>(
1904 (status,),
1905 self.tx_id,
1906 0x273fb2980ff24157,
1907 fidl::encoding::DynamicFlags::empty(),
1908 )
1909 }
1910}
1911
1912#[must_use = "FIDL methods require a response to be sent"]
1913#[derive(Debug)]
1914pub struct BlockShrinkResponder {
1915 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1916 tx_id: u32,
1917}
1918
1919impl std::ops::Drop for BlockShrinkResponder {
1923 fn drop(&mut self) {
1924 self.control_handle.shutdown();
1925 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1927 }
1928}
1929
1930impl fidl::endpoints::Responder for BlockShrinkResponder {
1931 type ControlHandle = BlockControlHandle;
1932
1933 fn control_handle(&self) -> &BlockControlHandle {
1934 &self.control_handle
1935 }
1936
1937 fn drop_without_shutdown(mut self) {
1938 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1940 std::mem::forget(self);
1942 }
1943}
1944
1945impl BlockShrinkResponder {
1946 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1950 let _result = self.send_raw(status);
1951 if _result.is_err() {
1952 self.control_handle.shutdown();
1953 }
1954 self.drop_without_shutdown();
1955 _result
1956 }
1957
1958 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1960 let _result = self.send_raw(status);
1961 self.drop_without_shutdown();
1962 _result
1963 }
1964
1965 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1966 self.control_handle.inner.send::<BlockShrinkResponse>(
1967 (status,),
1968 self.tx_id,
1969 0x73da6de865600a8b,
1970 fidl::encoding::DynamicFlags::empty(),
1971 )
1972 }
1973}
1974
1975#[must_use = "FIDL methods require a response to be sent"]
1976#[derive(Debug)]
1977pub struct BlockDestroyResponder {
1978 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1979 tx_id: u32,
1980}
1981
1982impl std::ops::Drop for BlockDestroyResponder {
1986 fn drop(&mut self) {
1987 self.control_handle.shutdown();
1988 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1990 }
1991}
1992
1993impl fidl::endpoints::Responder for BlockDestroyResponder {
1994 type ControlHandle = BlockControlHandle;
1995
1996 fn control_handle(&self) -> &BlockControlHandle {
1997 &self.control_handle
1998 }
1999
2000 fn drop_without_shutdown(mut self) {
2001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2003 std::mem::forget(self);
2005 }
2006}
2007
2008impl BlockDestroyResponder {
2009 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2013 let _result = self.send_raw(status);
2014 if _result.is_err() {
2015 self.control_handle.shutdown();
2016 }
2017 self.drop_without_shutdown();
2018 _result
2019 }
2020
2021 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2023 let _result = self.send_raw(status);
2024 self.drop_without_shutdown();
2025 _result
2026 }
2027
2028 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2029 self.control_handle.inner.send::<BlockDestroyResponse>(
2030 (status,),
2031 self.tx_id,
2032 0x5866ba764e05a68e,
2033 fidl::encoding::DynamicFlags::empty(),
2034 )
2035 }
2036}
2037
2038#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2039pub struct SessionMarker;
2040
2041impl fidl::endpoints::ProtocolMarker for SessionMarker {
2042 type Proxy = SessionProxy;
2043 type RequestStream = SessionRequestStream;
2044 #[cfg(target_os = "fuchsia")]
2045 type SynchronousProxy = SessionSynchronousProxy;
2046
2047 const DEBUG_NAME: &'static str = "(anonymous) Session";
2048}
2049pub type SessionGetFifoResult = Result<fidl::Fifo, i32>;
2050pub type SessionAttachVmoResult = Result<VmoId, i32>;
2051
2052pub trait SessionProxyInterface: Send + Sync {
2053 type CloseResponseFut: std::future::Future<
2054 Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
2055 > + Send;
2056 fn r#close(&self) -> Self::CloseResponseFut;
2057 type GetFifoResponseFut: std::future::Future<Output = Result<SessionGetFifoResult, fidl::Error>>
2058 + Send;
2059 fn r#get_fifo(&self) -> Self::GetFifoResponseFut;
2060 type AttachVmoResponseFut: std::future::Future<Output = Result<SessionAttachVmoResult, fidl::Error>>
2061 + Send;
2062 fn r#attach_vmo(&self, vmo: fidl::Vmo) -> Self::AttachVmoResponseFut;
2063}
2064#[derive(Debug)]
2065#[cfg(target_os = "fuchsia")]
2066pub struct SessionSynchronousProxy {
2067 client: fidl::client::sync::Client,
2068}
2069
2070#[cfg(target_os = "fuchsia")]
2071impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
2072 type Proxy = SessionProxy;
2073 type Protocol = SessionMarker;
2074
2075 fn from_channel(inner: fidl::Channel) -> Self {
2076 Self::new(inner)
2077 }
2078
2079 fn into_channel(self) -> fidl::Channel {
2080 self.client.into_channel()
2081 }
2082
2083 fn as_channel(&self) -> &fidl::Channel {
2084 self.client.as_channel()
2085 }
2086}
2087
2088#[cfg(target_os = "fuchsia")]
2089impl SessionSynchronousProxy {
2090 pub fn new(channel: fidl::Channel) -> Self {
2091 Self { client: fidl::client::sync::Client::new(channel) }
2092 }
2093
2094 pub fn into_channel(self) -> fidl::Channel {
2095 self.client.into_channel()
2096 }
2097
2098 pub fn wait_for_event(
2101 &self,
2102 deadline: zx::MonotonicInstant,
2103 ) -> Result<SessionEvent, fidl::Error> {
2104 SessionEvent::decode(self.client.wait_for_event::<SessionMarker>(deadline)?)
2105 }
2106
2107 pub fn r#close(
2118 &self,
2119 ___deadline: zx::MonotonicInstant,
2120 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2121 let _response = self.client.send_query::<
2122 fidl::encoding::EmptyPayload,
2123 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2124 SessionMarker,
2125 >(
2126 (),
2127 0x5ac5d459ad7f657e,
2128 fidl::encoding::DynamicFlags::empty(),
2129 ___deadline,
2130 )?;
2131 Ok(_response.map(|x| x))
2132 }
2133
2134 pub fn r#get_fifo(
2136 &self,
2137 ___deadline: zx::MonotonicInstant,
2138 ) -> Result<SessionGetFifoResult, fidl::Error> {
2139 let _response = self.client.send_query::<
2140 fidl::encoding::EmptyPayload,
2141 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
2142 SessionMarker,
2143 >(
2144 (),
2145 0x7a6c7610912aaa98,
2146 fidl::encoding::DynamicFlags::empty(),
2147 ___deadline,
2148 )?;
2149 Ok(_response.map(|x| x.fifo))
2150 }
2151
2152 pub fn r#attach_vmo(
2156 &self,
2157 mut vmo: fidl::Vmo,
2158 ___deadline: zx::MonotonicInstant,
2159 ) -> Result<SessionAttachVmoResult, fidl::Error> {
2160 let _response = self.client.send_query::<
2161 SessionAttachVmoRequest,
2162 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
2163 SessionMarker,
2164 >(
2165 (vmo,),
2166 0x677a0f6fd1a370b2,
2167 fidl::encoding::DynamicFlags::empty(),
2168 ___deadline,
2169 )?;
2170 Ok(_response.map(|x| x.vmoid))
2171 }
2172}
2173
2174#[cfg(target_os = "fuchsia")]
2175impl From<SessionSynchronousProxy> for zx::NullableHandle {
2176 fn from(value: SessionSynchronousProxy) -> Self {
2177 value.into_channel().into()
2178 }
2179}
2180
2181#[cfg(target_os = "fuchsia")]
2182impl From<fidl::Channel> for SessionSynchronousProxy {
2183 fn from(value: fidl::Channel) -> Self {
2184 Self::new(value)
2185 }
2186}
2187
2188#[cfg(target_os = "fuchsia")]
2189impl fidl::endpoints::FromClient for SessionSynchronousProxy {
2190 type Protocol = SessionMarker;
2191
2192 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
2193 Self::new(value.into_channel())
2194 }
2195}
2196
2197#[derive(Debug, Clone)]
2198pub struct SessionProxy {
2199 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2200}
2201
2202impl fidl::endpoints::Proxy for SessionProxy {
2203 type Protocol = SessionMarker;
2204
2205 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2206 Self::new(inner)
2207 }
2208
2209 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2210 self.client.into_channel().map_err(|client| Self { client })
2211 }
2212
2213 fn as_channel(&self) -> &::fidl::AsyncChannel {
2214 self.client.as_channel()
2215 }
2216}
2217
2218impl SessionProxy {
2219 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2221 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2222 Self { client: fidl::client::Client::new(channel, protocol_name) }
2223 }
2224
2225 pub fn take_event_stream(&self) -> SessionEventStream {
2231 SessionEventStream { event_receiver: self.client.take_event_receiver() }
2232 }
2233
2234 pub fn r#close(
2245 &self,
2246 ) -> fidl::client::QueryResponseFut<
2247 fidl_fuchsia_unknown::CloseableCloseResult,
2248 fidl::encoding::DefaultFuchsiaResourceDialect,
2249 > {
2250 SessionProxyInterface::r#close(self)
2251 }
2252
2253 pub fn r#get_fifo(
2255 &self,
2256 ) -> fidl::client::QueryResponseFut<
2257 SessionGetFifoResult,
2258 fidl::encoding::DefaultFuchsiaResourceDialect,
2259 > {
2260 SessionProxyInterface::r#get_fifo(self)
2261 }
2262
2263 pub fn r#attach_vmo(
2267 &self,
2268 mut vmo: fidl::Vmo,
2269 ) -> fidl::client::QueryResponseFut<
2270 SessionAttachVmoResult,
2271 fidl::encoding::DefaultFuchsiaResourceDialect,
2272 > {
2273 SessionProxyInterface::r#attach_vmo(self, vmo)
2274 }
2275}
2276
2277impl SessionProxyInterface for SessionProxy {
2278 type CloseResponseFut = fidl::client::QueryResponseFut<
2279 fidl_fuchsia_unknown::CloseableCloseResult,
2280 fidl::encoding::DefaultFuchsiaResourceDialect,
2281 >;
2282 fn r#close(&self) -> Self::CloseResponseFut {
2283 fn _decode(
2284 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2285 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2286 let _response = fidl::client::decode_transaction_body::<
2287 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2288 fidl::encoding::DefaultFuchsiaResourceDialect,
2289 0x5ac5d459ad7f657e,
2290 >(_buf?)?;
2291 Ok(_response.map(|x| x))
2292 }
2293 self.client.send_query_and_decode::<
2294 fidl::encoding::EmptyPayload,
2295 fidl_fuchsia_unknown::CloseableCloseResult,
2296 >(
2297 (),
2298 0x5ac5d459ad7f657e,
2299 fidl::encoding::DynamicFlags::empty(),
2300 _decode,
2301 )
2302 }
2303
2304 type GetFifoResponseFut = fidl::client::QueryResponseFut<
2305 SessionGetFifoResult,
2306 fidl::encoding::DefaultFuchsiaResourceDialect,
2307 >;
2308 fn r#get_fifo(&self) -> Self::GetFifoResponseFut {
2309 fn _decode(
2310 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2311 ) -> Result<SessionGetFifoResult, fidl::Error> {
2312 let _response = fidl::client::decode_transaction_body::<
2313 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
2314 fidl::encoding::DefaultFuchsiaResourceDialect,
2315 0x7a6c7610912aaa98,
2316 >(_buf?)?;
2317 Ok(_response.map(|x| x.fifo))
2318 }
2319 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionGetFifoResult>(
2320 (),
2321 0x7a6c7610912aaa98,
2322 fidl::encoding::DynamicFlags::empty(),
2323 _decode,
2324 )
2325 }
2326
2327 type AttachVmoResponseFut = fidl::client::QueryResponseFut<
2328 SessionAttachVmoResult,
2329 fidl::encoding::DefaultFuchsiaResourceDialect,
2330 >;
2331 fn r#attach_vmo(&self, mut vmo: fidl::Vmo) -> Self::AttachVmoResponseFut {
2332 fn _decode(
2333 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2334 ) -> Result<SessionAttachVmoResult, fidl::Error> {
2335 let _response = fidl::client::decode_transaction_body::<
2336 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
2337 fidl::encoding::DefaultFuchsiaResourceDialect,
2338 0x677a0f6fd1a370b2,
2339 >(_buf?)?;
2340 Ok(_response.map(|x| x.vmoid))
2341 }
2342 self.client.send_query_and_decode::<SessionAttachVmoRequest, SessionAttachVmoResult>(
2343 (vmo,),
2344 0x677a0f6fd1a370b2,
2345 fidl::encoding::DynamicFlags::empty(),
2346 _decode,
2347 )
2348 }
2349}
2350
2351pub struct SessionEventStream {
2352 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2353}
2354
2355impl std::marker::Unpin for SessionEventStream {}
2356
2357impl futures::stream::FusedStream for SessionEventStream {
2358 fn is_terminated(&self) -> bool {
2359 self.event_receiver.is_terminated()
2360 }
2361}
2362
2363impl futures::Stream for SessionEventStream {
2364 type Item = Result<SessionEvent, fidl::Error>;
2365
2366 fn poll_next(
2367 mut self: std::pin::Pin<&mut Self>,
2368 cx: &mut std::task::Context<'_>,
2369 ) -> std::task::Poll<Option<Self::Item>> {
2370 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2371 &mut self.event_receiver,
2372 cx
2373 )?) {
2374 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
2375 None => std::task::Poll::Ready(None),
2376 }
2377 }
2378}
2379
2380#[derive(Debug)]
2381pub enum SessionEvent {}
2382
2383impl SessionEvent {
2384 fn decode(
2386 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2387 ) -> Result<SessionEvent, fidl::Error> {
2388 let (bytes, _handles) = buf.split_mut();
2389 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2390 debug_assert_eq!(tx_header.tx_id, 0);
2391 match tx_header.ordinal {
2392 _ => Err(fidl::Error::UnknownOrdinal {
2393 ordinal: tx_header.ordinal,
2394 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2395 }),
2396 }
2397 }
2398}
2399
2400pub struct SessionRequestStream {
2402 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2403 is_terminated: bool,
2404}
2405
2406impl std::marker::Unpin for SessionRequestStream {}
2407
2408impl futures::stream::FusedStream for SessionRequestStream {
2409 fn is_terminated(&self) -> bool {
2410 self.is_terminated
2411 }
2412}
2413
2414impl fidl::endpoints::RequestStream for SessionRequestStream {
2415 type Protocol = SessionMarker;
2416 type ControlHandle = SessionControlHandle;
2417
2418 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2419 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2420 }
2421
2422 fn control_handle(&self) -> Self::ControlHandle {
2423 SessionControlHandle { inner: self.inner.clone() }
2424 }
2425
2426 fn into_inner(
2427 self,
2428 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2429 {
2430 (self.inner, self.is_terminated)
2431 }
2432
2433 fn from_inner(
2434 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2435 is_terminated: bool,
2436 ) -> Self {
2437 Self { inner, is_terminated }
2438 }
2439}
2440
2441impl futures::Stream for SessionRequestStream {
2442 type Item = Result<SessionRequest, fidl::Error>;
2443
2444 fn poll_next(
2445 mut self: std::pin::Pin<&mut Self>,
2446 cx: &mut std::task::Context<'_>,
2447 ) -> std::task::Poll<Option<Self::Item>> {
2448 let this = &mut *self;
2449 if this.inner.check_shutdown(cx) {
2450 this.is_terminated = true;
2451 return std::task::Poll::Ready(None);
2452 }
2453 if this.is_terminated {
2454 panic!("polled SessionRequestStream after completion");
2455 }
2456 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2457 |bytes, handles| {
2458 match this.inner.channel().read_etc(cx, bytes, handles) {
2459 std::task::Poll::Ready(Ok(())) => {}
2460 std::task::Poll::Pending => return std::task::Poll::Pending,
2461 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2462 this.is_terminated = true;
2463 return std::task::Poll::Ready(None);
2464 }
2465 std::task::Poll::Ready(Err(e)) => {
2466 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2467 e.into(),
2468 ))));
2469 }
2470 }
2471
2472 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2474
2475 std::task::Poll::Ready(Some(match header.ordinal {
2476 0x5ac5d459ad7f657e => {
2477 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2478 let mut req = fidl::new_empty!(
2479 fidl::encoding::EmptyPayload,
2480 fidl::encoding::DefaultFuchsiaResourceDialect
2481 );
2482 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2483 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2484 Ok(SessionRequest::Close {
2485 responder: SessionCloseResponder {
2486 control_handle: std::mem::ManuallyDrop::new(control_handle),
2487 tx_id: header.tx_id,
2488 },
2489 })
2490 }
2491 0x7a6c7610912aaa98 => {
2492 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2493 let mut req = fidl::new_empty!(
2494 fidl::encoding::EmptyPayload,
2495 fidl::encoding::DefaultFuchsiaResourceDialect
2496 );
2497 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2498 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2499 Ok(SessionRequest::GetFifo {
2500 responder: SessionGetFifoResponder {
2501 control_handle: std::mem::ManuallyDrop::new(control_handle),
2502 tx_id: header.tx_id,
2503 },
2504 })
2505 }
2506 0x677a0f6fd1a370b2 => {
2507 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2508 let mut req = fidl::new_empty!(
2509 SessionAttachVmoRequest,
2510 fidl::encoding::DefaultFuchsiaResourceDialect
2511 );
2512 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachVmoRequest>(&header, _body_bytes, handles, &mut req)?;
2513 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2514 Ok(SessionRequest::AttachVmo {
2515 vmo: req.vmo,
2516
2517 responder: SessionAttachVmoResponder {
2518 control_handle: std::mem::ManuallyDrop::new(control_handle),
2519 tx_id: header.tx_id,
2520 },
2521 })
2522 }
2523 _ => Err(fidl::Error::UnknownOrdinal {
2524 ordinal: header.ordinal,
2525 protocol_name:
2526 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2527 }),
2528 }))
2529 },
2530 )
2531 }
2532}
2533
2534#[derive(Debug)]
2544pub enum SessionRequest {
2545 Close { responder: SessionCloseResponder },
2556 GetFifo { responder: SessionGetFifoResponder },
2558 AttachVmo { vmo: fidl::Vmo, responder: SessionAttachVmoResponder },
2562}
2563
2564impl SessionRequest {
2565 #[allow(irrefutable_let_patterns)]
2566 pub fn into_close(self) -> Option<(SessionCloseResponder)> {
2567 if let SessionRequest::Close { responder } = self { Some((responder)) } else { None }
2568 }
2569
2570 #[allow(irrefutable_let_patterns)]
2571 pub fn into_get_fifo(self) -> Option<(SessionGetFifoResponder)> {
2572 if let SessionRequest::GetFifo { responder } = self { Some((responder)) } else { None }
2573 }
2574
2575 #[allow(irrefutable_let_patterns)]
2576 pub fn into_attach_vmo(self) -> Option<(fidl::Vmo, SessionAttachVmoResponder)> {
2577 if let SessionRequest::AttachVmo { vmo, responder } = self {
2578 Some((vmo, responder))
2579 } else {
2580 None
2581 }
2582 }
2583
2584 pub fn method_name(&self) -> &'static str {
2586 match *self {
2587 SessionRequest::Close { .. } => "close",
2588 SessionRequest::GetFifo { .. } => "get_fifo",
2589 SessionRequest::AttachVmo { .. } => "attach_vmo",
2590 }
2591 }
2592}
2593
2594#[derive(Debug, Clone)]
2595pub struct SessionControlHandle {
2596 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2597}
2598
2599impl fidl::endpoints::ControlHandle for SessionControlHandle {
2600 fn shutdown(&self) {
2601 self.inner.shutdown()
2602 }
2603
2604 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2605 self.inner.shutdown_with_epitaph(status)
2606 }
2607
2608 fn is_closed(&self) -> bool {
2609 self.inner.channel().is_closed()
2610 }
2611 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2612 self.inner.channel().on_closed()
2613 }
2614
2615 #[cfg(target_os = "fuchsia")]
2616 fn signal_peer(
2617 &self,
2618 clear_mask: zx::Signals,
2619 set_mask: zx::Signals,
2620 ) -> Result<(), zx_status::Status> {
2621 use fidl::Peered;
2622 self.inner.channel().signal_peer(clear_mask, set_mask)
2623 }
2624}
2625
2626impl SessionControlHandle {}
2627
2628#[must_use = "FIDL methods require a response to be sent"]
2629#[derive(Debug)]
2630pub struct SessionCloseResponder {
2631 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2632 tx_id: u32,
2633}
2634
2635impl std::ops::Drop for SessionCloseResponder {
2639 fn drop(&mut self) {
2640 self.control_handle.shutdown();
2641 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2643 }
2644}
2645
2646impl fidl::endpoints::Responder for SessionCloseResponder {
2647 type ControlHandle = SessionControlHandle;
2648
2649 fn control_handle(&self) -> &SessionControlHandle {
2650 &self.control_handle
2651 }
2652
2653 fn drop_without_shutdown(mut self) {
2654 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2656 std::mem::forget(self);
2658 }
2659}
2660
2661impl SessionCloseResponder {
2662 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2666 let _result = self.send_raw(result);
2667 if _result.is_err() {
2668 self.control_handle.shutdown();
2669 }
2670 self.drop_without_shutdown();
2671 _result
2672 }
2673
2674 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2676 let _result = self.send_raw(result);
2677 self.drop_without_shutdown();
2678 _result
2679 }
2680
2681 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2682 self.control_handle
2683 .inner
2684 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2685 result,
2686 self.tx_id,
2687 0x5ac5d459ad7f657e,
2688 fidl::encoding::DynamicFlags::empty(),
2689 )
2690 }
2691}
2692
2693#[must_use = "FIDL methods require a response to be sent"]
2694#[derive(Debug)]
2695pub struct SessionGetFifoResponder {
2696 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2697 tx_id: u32,
2698}
2699
2700impl std::ops::Drop for SessionGetFifoResponder {
2704 fn drop(&mut self) {
2705 self.control_handle.shutdown();
2706 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2708 }
2709}
2710
2711impl fidl::endpoints::Responder for SessionGetFifoResponder {
2712 type ControlHandle = SessionControlHandle;
2713
2714 fn control_handle(&self) -> &SessionControlHandle {
2715 &self.control_handle
2716 }
2717
2718 fn drop_without_shutdown(mut self) {
2719 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2721 std::mem::forget(self);
2723 }
2724}
2725
2726impl SessionGetFifoResponder {
2727 pub fn send(self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
2731 let _result = self.send_raw(result);
2732 if _result.is_err() {
2733 self.control_handle.shutdown();
2734 }
2735 self.drop_without_shutdown();
2736 _result
2737 }
2738
2739 pub fn send_no_shutdown_on_err(
2741 self,
2742 mut result: Result<fidl::Fifo, i32>,
2743 ) -> Result<(), fidl::Error> {
2744 let _result = self.send_raw(result);
2745 self.drop_without_shutdown();
2746 _result
2747 }
2748
2749 fn send_raw(&self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
2750 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionGetFifoResponse, i32>>(
2751 result.map(|fifo| (fifo,)),
2752 self.tx_id,
2753 0x7a6c7610912aaa98,
2754 fidl::encoding::DynamicFlags::empty(),
2755 )
2756 }
2757}
2758
2759#[must_use = "FIDL methods require a response to be sent"]
2760#[derive(Debug)]
2761pub struct SessionAttachVmoResponder {
2762 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2763 tx_id: u32,
2764}
2765
2766impl std::ops::Drop for SessionAttachVmoResponder {
2770 fn drop(&mut self) {
2771 self.control_handle.shutdown();
2772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2774 }
2775}
2776
2777impl fidl::endpoints::Responder for SessionAttachVmoResponder {
2778 type ControlHandle = SessionControlHandle;
2779
2780 fn control_handle(&self) -> &SessionControlHandle {
2781 &self.control_handle
2782 }
2783
2784 fn drop_without_shutdown(mut self) {
2785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2787 std::mem::forget(self);
2789 }
2790}
2791
2792impl SessionAttachVmoResponder {
2793 pub fn send(self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
2797 let _result = self.send_raw(result);
2798 if _result.is_err() {
2799 self.control_handle.shutdown();
2800 }
2801 self.drop_without_shutdown();
2802 _result
2803 }
2804
2805 pub fn send_no_shutdown_on_err(
2807 self,
2808 mut result: Result<&VmoId, i32>,
2809 ) -> Result<(), fidl::Error> {
2810 let _result = self.send_raw(result);
2811 self.drop_without_shutdown();
2812 _result
2813 }
2814
2815 fn send_raw(&self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
2816 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionAttachVmoResponse, i32>>(
2817 result.map(|vmoid| (vmoid,)),
2818 self.tx_id,
2819 0x677a0f6fd1a370b2,
2820 fidl::encoding::DynamicFlags::empty(),
2821 )
2822 }
2823}
2824
2825#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2826pub struct VolumeManagerMarker;
2827
2828impl fidl::endpoints::ProtocolMarker for VolumeManagerMarker {
2829 type Proxy = VolumeManagerProxy;
2830 type RequestStream = VolumeManagerRequestStream;
2831 #[cfg(target_os = "fuchsia")]
2832 type SynchronousProxy = VolumeManagerSynchronousProxy;
2833
2834 const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
2835}
2836pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
2837
2838pub trait VolumeManagerProxyInterface: Send + Sync {
2839 type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2840 fn r#allocate_partition(
2841 &self,
2842 slice_count: u64,
2843 type_: &Guid,
2844 instance: &Guid,
2845 name: &str,
2846 flags: u32,
2847 ) -> Self::AllocatePartitionResponseFut;
2848 type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
2849 + Send;
2850 fn r#get_info(&self) -> Self::GetInfoResponseFut;
2851 type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2852 fn r#activate(&self, old_guid: &Guid, new_guid: &Guid) -> Self::ActivateResponseFut;
2853 type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
2854 + Send;
2855 fn r#get_partition_limit(&self, guid: &Guid) -> Self::GetPartitionLimitResponseFut;
2856 type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2857 fn r#set_partition_limit(
2858 &self,
2859 guid: &Guid,
2860 slice_count: u64,
2861 ) -> Self::SetPartitionLimitResponseFut;
2862 type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
2863 + Send;
2864 fn r#set_partition_name(&self, guid: &Guid, name: &str) -> Self::SetPartitionNameResponseFut;
2865}
2866#[derive(Debug)]
2867#[cfg(target_os = "fuchsia")]
2868pub struct VolumeManagerSynchronousProxy {
2869 client: fidl::client::sync::Client,
2870}
2871
2872#[cfg(target_os = "fuchsia")]
2873impl fidl::endpoints::SynchronousProxy for VolumeManagerSynchronousProxy {
2874 type Proxy = VolumeManagerProxy;
2875 type Protocol = VolumeManagerMarker;
2876
2877 fn from_channel(inner: fidl::Channel) -> Self {
2878 Self::new(inner)
2879 }
2880
2881 fn into_channel(self) -> fidl::Channel {
2882 self.client.into_channel()
2883 }
2884
2885 fn as_channel(&self) -> &fidl::Channel {
2886 self.client.as_channel()
2887 }
2888}
2889
2890#[cfg(target_os = "fuchsia")]
2891impl VolumeManagerSynchronousProxy {
2892 pub fn new(channel: fidl::Channel) -> Self {
2893 Self { client: fidl::client::sync::Client::new(channel) }
2894 }
2895
2896 pub fn into_channel(self) -> fidl::Channel {
2897 self.client.into_channel()
2898 }
2899
2900 pub fn wait_for_event(
2903 &self,
2904 deadline: zx::MonotonicInstant,
2905 ) -> Result<VolumeManagerEvent, fidl::Error> {
2906 VolumeManagerEvent::decode(self.client.wait_for_event::<VolumeManagerMarker>(deadline)?)
2907 }
2908
2909 pub fn r#allocate_partition(
2916 &self,
2917 mut slice_count: u64,
2918 mut type_: &Guid,
2919 mut instance: &Guid,
2920 mut name: &str,
2921 mut flags: u32,
2922 ___deadline: zx::MonotonicInstant,
2923 ) -> Result<i32, fidl::Error> {
2924 let _response = self.client.send_query::<
2925 VolumeManagerAllocatePartitionRequest,
2926 VolumeManagerAllocatePartitionResponse,
2927 VolumeManagerMarker,
2928 >(
2929 (slice_count, type_, instance, name, flags,),
2930 0x5db528bfc287b696,
2931 fidl::encoding::DynamicFlags::empty(),
2932 ___deadline,
2933 )?;
2934 Ok(_response.status)
2935 }
2936
2937 pub fn r#get_info(
2945 &self,
2946 ___deadline: zx::MonotonicInstant,
2947 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2948 let _response = self.client.send_query::<
2949 fidl::encoding::EmptyPayload,
2950 VolumeManagerGetInfoResponse,
2951 VolumeManagerMarker,
2952 >(
2953 (),
2954 0x2611214dcca5b064,
2955 fidl::encoding::DynamicFlags::empty(),
2956 ___deadline,
2957 )?;
2958 Ok((_response.status, _response.info))
2959 }
2960
2961 pub fn r#activate(
2977 &self,
2978 mut old_guid: &Guid,
2979 mut new_guid: &Guid,
2980 ___deadline: zx::MonotonicInstant,
2981 ) -> Result<i32, fidl::Error> {
2982 let _response = self.client.send_query::<
2983 VolumeManagerActivateRequest,
2984 VolumeManagerActivateResponse,
2985 VolumeManagerMarker,
2986 >(
2987 (old_guid, new_guid,),
2988 0x182238d40c275be,
2989 fidl::encoding::DynamicFlags::empty(),
2990 ___deadline,
2991 )?;
2992 Ok(_response.status)
2993 }
2994
2995 pub fn r#get_partition_limit(
3005 &self,
3006 mut guid: &Guid,
3007 ___deadline: zx::MonotonicInstant,
3008 ) -> Result<(i32, u64), fidl::Error> {
3009 let _response = self.client.send_query::<
3010 VolumeManagerGetPartitionLimitRequest,
3011 VolumeManagerGetPartitionLimitResponse,
3012 VolumeManagerMarker,
3013 >(
3014 (guid,),
3015 0x5bc9d21ea8bd52db,
3016 fidl::encoding::DynamicFlags::empty(),
3017 ___deadline,
3018 )?;
3019 Ok((_response.status, _response.slice_count))
3020 }
3021
3022 pub fn r#set_partition_limit(
3034 &self,
3035 mut guid: &Guid,
3036 mut slice_count: u64,
3037 ___deadline: zx::MonotonicInstant,
3038 ) -> Result<i32, fidl::Error> {
3039 let _response = self.client.send_query::<
3040 VolumeManagerSetPartitionLimitRequest,
3041 VolumeManagerSetPartitionLimitResponse,
3042 VolumeManagerMarker,
3043 >(
3044 (guid, slice_count,),
3045 0x3a4903076534c093,
3046 fidl::encoding::DynamicFlags::empty(),
3047 ___deadline,
3048 )?;
3049 Ok(_response.status)
3050 }
3051
3052 pub fn r#set_partition_name(
3056 &self,
3057 mut guid: &Guid,
3058 mut name: &str,
3059 ___deadline: zx::MonotonicInstant,
3060 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
3061 let _response = self.client.send_query::<
3062 VolumeManagerSetPartitionNameRequest,
3063 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3064 VolumeManagerMarker,
3065 >(
3066 (guid, name,),
3067 0x26afb07b9d70ff1a,
3068 fidl::encoding::DynamicFlags::empty(),
3069 ___deadline,
3070 )?;
3071 Ok(_response.map(|x| x))
3072 }
3073}
3074
3075#[cfg(target_os = "fuchsia")]
3076impl From<VolumeManagerSynchronousProxy> for zx::NullableHandle {
3077 fn from(value: VolumeManagerSynchronousProxy) -> Self {
3078 value.into_channel().into()
3079 }
3080}
3081
3082#[cfg(target_os = "fuchsia")]
3083impl From<fidl::Channel> for VolumeManagerSynchronousProxy {
3084 fn from(value: fidl::Channel) -> Self {
3085 Self::new(value)
3086 }
3087}
3088
3089#[cfg(target_os = "fuchsia")]
3090impl fidl::endpoints::FromClient for VolumeManagerSynchronousProxy {
3091 type Protocol = VolumeManagerMarker;
3092
3093 fn from_client(value: fidl::endpoints::ClientEnd<VolumeManagerMarker>) -> Self {
3094 Self::new(value.into_channel())
3095 }
3096}
3097
3098#[derive(Debug, Clone)]
3099pub struct VolumeManagerProxy {
3100 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3101}
3102
3103impl fidl::endpoints::Proxy for VolumeManagerProxy {
3104 type Protocol = VolumeManagerMarker;
3105
3106 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3107 Self::new(inner)
3108 }
3109
3110 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3111 self.client.into_channel().map_err(|client| Self { client })
3112 }
3113
3114 fn as_channel(&self) -> &::fidl::AsyncChannel {
3115 self.client.as_channel()
3116 }
3117}
3118
3119impl VolumeManagerProxy {
3120 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3122 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3123 Self { client: fidl::client::Client::new(channel, protocol_name) }
3124 }
3125
3126 pub fn take_event_stream(&self) -> VolumeManagerEventStream {
3132 VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
3133 }
3134
3135 pub fn r#allocate_partition(
3142 &self,
3143 mut slice_count: u64,
3144 mut type_: &Guid,
3145 mut instance: &Guid,
3146 mut name: &str,
3147 mut flags: u32,
3148 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3149 VolumeManagerProxyInterface::r#allocate_partition(
3150 self,
3151 slice_count,
3152 type_,
3153 instance,
3154 name,
3155 flags,
3156 )
3157 }
3158
3159 pub fn r#get_info(
3167 &self,
3168 ) -> fidl::client::QueryResponseFut<
3169 (i32, Option<Box<VolumeManagerInfo>>),
3170 fidl::encoding::DefaultFuchsiaResourceDialect,
3171 > {
3172 VolumeManagerProxyInterface::r#get_info(self)
3173 }
3174
3175 pub fn r#activate(
3191 &self,
3192 mut old_guid: &Guid,
3193 mut new_guid: &Guid,
3194 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3195 VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
3196 }
3197
3198 pub fn r#get_partition_limit(
3208 &self,
3209 mut guid: &Guid,
3210 ) -> fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
3211 {
3212 VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
3213 }
3214
3215 pub fn r#set_partition_limit(
3227 &self,
3228 mut guid: &Guid,
3229 mut slice_count: u64,
3230 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3231 VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
3232 }
3233
3234 pub fn r#set_partition_name(
3238 &self,
3239 mut guid: &Guid,
3240 mut name: &str,
3241 ) -> fidl::client::QueryResponseFut<
3242 VolumeManagerSetPartitionNameResult,
3243 fidl::encoding::DefaultFuchsiaResourceDialect,
3244 > {
3245 VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
3246 }
3247}
3248
3249impl VolumeManagerProxyInterface for VolumeManagerProxy {
3250 type AllocatePartitionResponseFut =
3251 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3252 fn r#allocate_partition(
3253 &self,
3254 mut slice_count: u64,
3255 mut type_: &Guid,
3256 mut instance: &Guid,
3257 mut name: &str,
3258 mut flags: u32,
3259 ) -> Self::AllocatePartitionResponseFut {
3260 fn _decode(
3261 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3262 ) -> Result<i32, fidl::Error> {
3263 let _response = fidl::client::decode_transaction_body::<
3264 VolumeManagerAllocatePartitionResponse,
3265 fidl::encoding::DefaultFuchsiaResourceDialect,
3266 0x5db528bfc287b696,
3267 >(_buf?)?;
3268 Ok(_response.status)
3269 }
3270 self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
3271 (slice_count, type_, instance, name, flags),
3272 0x5db528bfc287b696,
3273 fidl::encoding::DynamicFlags::empty(),
3274 _decode,
3275 )
3276 }
3277
3278 type GetInfoResponseFut = fidl::client::QueryResponseFut<
3279 (i32, Option<Box<VolumeManagerInfo>>),
3280 fidl::encoding::DefaultFuchsiaResourceDialect,
3281 >;
3282 fn r#get_info(&self) -> Self::GetInfoResponseFut {
3283 fn _decode(
3284 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3285 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
3286 let _response = fidl::client::decode_transaction_body::<
3287 VolumeManagerGetInfoResponse,
3288 fidl::encoding::DefaultFuchsiaResourceDialect,
3289 0x2611214dcca5b064,
3290 >(_buf?)?;
3291 Ok((_response.status, _response.info))
3292 }
3293 self.client.send_query_and_decode::<
3294 fidl::encoding::EmptyPayload,
3295 (i32, Option<Box<VolumeManagerInfo>>),
3296 >(
3297 (),
3298 0x2611214dcca5b064,
3299 fidl::encoding::DynamicFlags::empty(),
3300 _decode,
3301 )
3302 }
3303
3304 type ActivateResponseFut =
3305 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3306 fn r#activate(&self, mut old_guid: &Guid, mut new_guid: &Guid) -> Self::ActivateResponseFut {
3307 fn _decode(
3308 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3309 ) -> Result<i32, fidl::Error> {
3310 let _response = fidl::client::decode_transaction_body::<
3311 VolumeManagerActivateResponse,
3312 fidl::encoding::DefaultFuchsiaResourceDialect,
3313 0x182238d40c275be,
3314 >(_buf?)?;
3315 Ok(_response.status)
3316 }
3317 self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
3318 (old_guid, new_guid),
3319 0x182238d40c275be,
3320 fidl::encoding::DynamicFlags::empty(),
3321 _decode,
3322 )
3323 }
3324
3325 type GetPartitionLimitResponseFut =
3326 fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>;
3327 fn r#get_partition_limit(&self, mut guid: &Guid) -> Self::GetPartitionLimitResponseFut {
3328 fn _decode(
3329 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3330 ) -> Result<(i32, u64), fidl::Error> {
3331 let _response = fidl::client::decode_transaction_body::<
3332 VolumeManagerGetPartitionLimitResponse,
3333 fidl::encoding::DefaultFuchsiaResourceDialect,
3334 0x5bc9d21ea8bd52db,
3335 >(_buf?)?;
3336 Ok((_response.status, _response.slice_count))
3337 }
3338 self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
3339 (guid,),
3340 0x5bc9d21ea8bd52db,
3341 fidl::encoding::DynamicFlags::empty(),
3342 _decode,
3343 )
3344 }
3345
3346 type SetPartitionLimitResponseFut =
3347 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3348 fn r#set_partition_limit(
3349 &self,
3350 mut guid: &Guid,
3351 mut slice_count: u64,
3352 ) -> Self::SetPartitionLimitResponseFut {
3353 fn _decode(
3354 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3355 ) -> Result<i32, fidl::Error> {
3356 let _response = fidl::client::decode_transaction_body::<
3357 VolumeManagerSetPartitionLimitResponse,
3358 fidl::encoding::DefaultFuchsiaResourceDialect,
3359 0x3a4903076534c093,
3360 >(_buf?)?;
3361 Ok(_response.status)
3362 }
3363 self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
3364 (guid, slice_count),
3365 0x3a4903076534c093,
3366 fidl::encoding::DynamicFlags::empty(),
3367 _decode,
3368 )
3369 }
3370
3371 type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
3372 VolumeManagerSetPartitionNameResult,
3373 fidl::encoding::DefaultFuchsiaResourceDialect,
3374 >;
3375 fn r#set_partition_name(
3376 &self,
3377 mut guid: &Guid,
3378 mut name: &str,
3379 ) -> Self::SetPartitionNameResponseFut {
3380 fn _decode(
3381 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3382 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
3383 let _response = fidl::client::decode_transaction_body::<
3384 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3385 fidl::encoding::DefaultFuchsiaResourceDialect,
3386 0x26afb07b9d70ff1a,
3387 >(_buf?)?;
3388 Ok(_response.map(|x| x))
3389 }
3390 self.client.send_query_and_decode::<
3391 VolumeManagerSetPartitionNameRequest,
3392 VolumeManagerSetPartitionNameResult,
3393 >(
3394 (guid, name,),
3395 0x26afb07b9d70ff1a,
3396 fidl::encoding::DynamicFlags::empty(),
3397 _decode,
3398 )
3399 }
3400}
3401
3402pub struct VolumeManagerEventStream {
3403 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3404}
3405
3406impl std::marker::Unpin for VolumeManagerEventStream {}
3407
3408impl futures::stream::FusedStream for VolumeManagerEventStream {
3409 fn is_terminated(&self) -> bool {
3410 self.event_receiver.is_terminated()
3411 }
3412}
3413
3414impl futures::Stream for VolumeManagerEventStream {
3415 type Item = Result<VolumeManagerEvent, fidl::Error>;
3416
3417 fn poll_next(
3418 mut self: std::pin::Pin<&mut Self>,
3419 cx: &mut std::task::Context<'_>,
3420 ) -> std::task::Poll<Option<Self::Item>> {
3421 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3422 &mut self.event_receiver,
3423 cx
3424 )?) {
3425 Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
3426 None => std::task::Poll::Ready(None),
3427 }
3428 }
3429}
3430
3431#[derive(Debug)]
3432pub enum VolumeManagerEvent {}
3433
3434impl VolumeManagerEvent {
3435 fn decode(
3437 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3438 ) -> Result<VolumeManagerEvent, fidl::Error> {
3439 let (bytes, _handles) = buf.split_mut();
3440 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3441 debug_assert_eq!(tx_header.tx_id, 0);
3442 match tx_header.ordinal {
3443 _ => Err(fidl::Error::UnknownOrdinal {
3444 ordinal: tx_header.ordinal,
3445 protocol_name: <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3446 }),
3447 }
3448 }
3449}
3450
3451pub struct VolumeManagerRequestStream {
3453 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3454 is_terminated: bool,
3455}
3456
3457impl std::marker::Unpin for VolumeManagerRequestStream {}
3458
3459impl futures::stream::FusedStream for VolumeManagerRequestStream {
3460 fn is_terminated(&self) -> bool {
3461 self.is_terminated
3462 }
3463}
3464
3465impl fidl::endpoints::RequestStream for VolumeManagerRequestStream {
3466 type Protocol = VolumeManagerMarker;
3467 type ControlHandle = VolumeManagerControlHandle;
3468
3469 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3470 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3471 }
3472
3473 fn control_handle(&self) -> Self::ControlHandle {
3474 VolumeManagerControlHandle { inner: self.inner.clone() }
3475 }
3476
3477 fn into_inner(
3478 self,
3479 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3480 {
3481 (self.inner, self.is_terminated)
3482 }
3483
3484 fn from_inner(
3485 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3486 is_terminated: bool,
3487 ) -> Self {
3488 Self { inner, is_terminated }
3489 }
3490}
3491
3492impl futures::Stream for VolumeManagerRequestStream {
3493 type Item = Result<VolumeManagerRequest, fidl::Error>;
3494
3495 fn poll_next(
3496 mut self: std::pin::Pin<&mut Self>,
3497 cx: &mut std::task::Context<'_>,
3498 ) -> std::task::Poll<Option<Self::Item>> {
3499 let this = &mut *self;
3500 if this.inner.check_shutdown(cx) {
3501 this.is_terminated = true;
3502 return std::task::Poll::Ready(None);
3503 }
3504 if this.is_terminated {
3505 panic!("polled VolumeManagerRequestStream after completion");
3506 }
3507 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3508 |bytes, handles| {
3509 match this.inner.channel().read_etc(cx, bytes, handles) {
3510 std::task::Poll::Ready(Ok(())) => {}
3511 std::task::Poll::Pending => return std::task::Poll::Pending,
3512 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3513 this.is_terminated = true;
3514 return std::task::Poll::Ready(None);
3515 }
3516 std::task::Poll::Ready(Err(e)) => {
3517 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3518 e.into(),
3519 ))));
3520 }
3521 }
3522
3523 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3525
3526 std::task::Poll::Ready(Some(match header.ordinal {
3527 0x5db528bfc287b696 => {
3528 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3529 let mut req = fidl::new_empty!(
3530 VolumeManagerAllocatePartitionRequest,
3531 fidl::encoding::DefaultFuchsiaResourceDialect
3532 );
3533 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
3534 let control_handle =
3535 VolumeManagerControlHandle { inner: this.inner.clone() };
3536 Ok(VolumeManagerRequest::AllocatePartition {
3537 slice_count: req.slice_count,
3538 type_: req.type_,
3539 instance: req.instance,
3540 name: req.name,
3541 flags: req.flags,
3542
3543 responder: VolumeManagerAllocatePartitionResponder {
3544 control_handle: std::mem::ManuallyDrop::new(control_handle),
3545 tx_id: header.tx_id,
3546 },
3547 })
3548 }
3549 0x2611214dcca5b064 => {
3550 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3551 let mut req = fidl::new_empty!(
3552 fidl::encoding::EmptyPayload,
3553 fidl::encoding::DefaultFuchsiaResourceDialect
3554 );
3555 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3556 let control_handle =
3557 VolumeManagerControlHandle { inner: this.inner.clone() };
3558 Ok(VolumeManagerRequest::GetInfo {
3559 responder: VolumeManagerGetInfoResponder {
3560 control_handle: std::mem::ManuallyDrop::new(control_handle),
3561 tx_id: header.tx_id,
3562 },
3563 })
3564 }
3565 0x182238d40c275be => {
3566 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3567 let mut req = fidl::new_empty!(
3568 VolumeManagerActivateRequest,
3569 fidl::encoding::DefaultFuchsiaResourceDialect
3570 );
3571 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
3572 let control_handle =
3573 VolumeManagerControlHandle { inner: this.inner.clone() };
3574 Ok(VolumeManagerRequest::Activate {
3575 old_guid: req.old_guid,
3576 new_guid: req.new_guid,
3577
3578 responder: VolumeManagerActivateResponder {
3579 control_handle: std::mem::ManuallyDrop::new(control_handle),
3580 tx_id: header.tx_id,
3581 },
3582 })
3583 }
3584 0x5bc9d21ea8bd52db => {
3585 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3586 let mut req = fidl::new_empty!(
3587 VolumeManagerGetPartitionLimitRequest,
3588 fidl::encoding::DefaultFuchsiaResourceDialect
3589 );
3590 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
3591 let control_handle =
3592 VolumeManagerControlHandle { inner: this.inner.clone() };
3593 Ok(VolumeManagerRequest::GetPartitionLimit {
3594 guid: req.guid,
3595
3596 responder: VolumeManagerGetPartitionLimitResponder {
3597 control_handle: std::mem::ManuallyDrop::new(control_handle),
3598 tx_id: header.tx_id,
3599 },
3600 })
3601 }
3602 0x3a4903076534c093 => {
3603 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3604 let mut req = fidl::new_empty!(
3605 VolumeManagerSetPartitionLimitRequest,
3606 fidl::encoding::DefaultFuchsiaResourceDialect
3607 );
3608 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
3609 let control_handle =
3610 VolumeManagerControlHandle { inner: this.inner.clone() };
3611 Ok(VolumeManagerRequest::SetPartitionLimit {
3612 guid: req.guid,
3613 slice_count: req.slice_count,
3614
3615 responder: VolumeManagerSetPartitionLimitResponder {
3616 control_handle: std::mem::ManuallyDrop::new(control_handle),
3617 tx_id: header.tx_id,
3618 },
3619 })
3620 }
3621 0x26afb07b9d70ff1a => {
3622 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3623 let mut req = fidl::new_empty!(
3624 VolumeManagerSetPartitionNameRequest,
3625 fidl::encoding::DefaultFuchsiaResourceDialect
3626 );
3627 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
3628 let control_handle =
3629 VolumeManagerControlHandle { inner: this.inner.clone() };
3630 Ok(VolumeManagerRequest::SetPartitionName {
3631 guid: req.guid,
3632 name: req.name,
3633
3634 responder: VolumeManagerSetPartitionNameResponder {
3635 control_handle: std::mem::ManuallyDrop::new(control_handle),
3636 tx_id: header.tx_id,
3637 },
3638 })
3639 }
3640 _ => Err(fidl::Error::UnknownOrdinal {
3641 ordinal: header.ordinal,
3642 protocol_name:
3643 <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3644 }),
3645 }))
3646 },
3647 )
3648 }
3649}
3650
3651#[derive(Debug)]
3653pub enum VolumeManagerRequest {
3654 AllocatePartition {
3661 slice_count: u64,
3662 type_: Guid,
3663 instance: Guid,
3664 name: String,
3665 flags: u32,
3666 responder: VolumeManagerAllocatePartitionResponder,
3667 },
3668 GetInfo { responder: VolumeManagerGetInfoResponder },
3676 Activate { old_guid: Guid, new_guid: Guid, responder: VolumeManagerActivateResponder },
3692 GetPartitionLimit { guid: Guid, responder: VolumeManagerGetPartitionLimitResponder },
3702 SetPartitionLimit {
3714 guid: Guid,
3715 slice_count: u64,
3716 responder: VolumeManagerSetPartitionLimitResponder,
3717 },
3718 SetPartitionName { guid: Guid, name: String, responder: VolumeManagerSetPartitionNameResponder },
3722}
3723
3724impl VolumeManagerRequest {
3725 #[allow(irrefutable_let_patterns)]
3726 pub fn into_allocate_partition(
3727 self,
3728 ) -> Option<(u64, Guid, Guid, String, u32, VolumeManagerAllocatePartitionResponder)> {
3729 if let VolumeManagerRequest::AllocatePartition {
3730 slice_count,
3731 type_,
3732 instance,
3733 name,
3734 flags,
3735 responder,
3736 } = self
3737 {
3738 Some((slice_count, type_, instance, name, flags, responder))
3739 } else {
3740 None
3741 }
3742 }
3743
3744 #[allow(irrefutable_let_patterns)]
3745 pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
3746 if let VolumeManagerRequest::GetInfo { responder } = self {
3747 Some((responder))
3748 } else {
3749 None
3750 }
3751 }
3752
3753 #[allow(irrefutable_let_patterns)]
3754 pub fn into_activate(self) -> Option<(Guid, Guid, VolumeManagerActivateResponder)> {
3755 if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
3756 Some((old_guid, new_guid, responder))
3757 } else {
3758 None
3759 }
3760 }
3761
3762 #[allow(irrefutable_let_patterns)]
3763 pub fn into_get_partition_limit(
3764 self,
3765 ) -> Option<(Guid, VolumeManagerGetPartitionLimitResponder)> {
3766 if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
3767 Some((guid, responder))
3768 } else {
3769 None
3770 }
3771 }
3772
3773 #[allow(irrefutable_let_patterns)]
3774 pub fn into_set_partition_limit(
3775 self,
3776 ) -> Option<(Guid, u64, VolumeManagerSetPartitionLimitResponder)> {
3777 if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
3778 Some((guid, slice_count, responder))
3779 } else {
3780 None
3781 }
3782 }
3783
3784 #[allow(irrefutable_let_patterns)]
3785 pub fn into_set_partition_name(
3786 self,
3787 ) -> Option<(Guid, String, VolumeManagerSetPartitionNameResponder)> {
3788 if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
3789 Some((guid, name, responder))
3790 } else {
3791 None
3792 }
3793 }
3794
3795 pub fn method_name(&self) -> &'static str {
3797 match *self {
3798 VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
3799 VolumeManagerRequest::GetInfo { .. } => "get_info",
3800 VolumeManagerRequest::Activate { .. } => "activate",
3801 VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
3802 VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
3803 VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
3804 }
3805 }
3806}
3807
3808#[derive(Debug, Clone)]
3809pub struct VolumeManagerControlHandle {
3810 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3811}
3812
3813impl fidl::endpoints::ControlHandle for VolumeManagerControlHandle {
3814 fn shutdown(&self) {
3815 self.inner.shutdown()
3816 }
3817
3818 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3819 self.inner.shutdown_with_epitaph(status)
3820 }
3821
3822 fn is_closed(&self) -> bool {
3823 self.inner.channel().is_closed()
3824 }
3825 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3826 self.inner.channel().on_closed()
3827 }
3828
3829 #[cfg(target_os = "fuchsia")]
3830 fn signal_peer(
3831 &self,
3832 clear_mask: zx::Signals,
3833 set_mask: zx::Signals,
3834 ) -> Result<(), zx_status::Status> {
3835 use fidl::Peered;
3836 self.inner.channel().signal_peer(clear_mask, set_mask)
3837 }
3838}
3839
3840impl VolumeManagerControlHandle {}
3841
3842#[must_use = "FIDL methods require a response to be sent"]
3843#[derive(Debug)]
3844pub struct VolumeManagerAllocatePartitionResponder {
3845 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3846 tx_id: u32,
3847}
3848
3849impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
3853 fn drop(&mut self) {
3854 self.control_handle.shutdown();
3855 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3857 }
3858}
3859
3860impl fidl::endpoints::Responder for VolumeManagerAllocatePartitionResponder {
3861 type ControlHandle = VolumeManagerControlHandle;
3862
3863 fn control_handle(&self) -> &VolumeManagerControlHandle {
3864 &self.control_handle
3865 }
3866
3867 fn drop_without_shutdown(mut self) {
3868 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3870 std::mem::forget(self);
3872 }
3873}
3874
3875impl VolumeManagerAllocatePartitionResponder {
3876 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3880 let _result = self.send_raw(status);
3881 if _result.is_err() {
3882 self.control_handle.shutdown();
3883 }
3884 self.drop_without_shutdown();
3885 _result
3886 }
3887
3888 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3890 let _result = self.send_raw(status);
3891 self.drop_without_shutdown();
3892 _result
3893 }
3894
3895 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3896 self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
3897 (status,),
3898 self.tx_id,
3899 0x5db528bfc287b696,
3900 fidl::encoding::DynamicFlags::empty(),
3901 )
3902 }
3903}
3904
3905#[must_use = "FIDL methods require a response to be sent"]
3906#[derive(Debug)]
3907pub struct VolumeManagerGetInfoResponder {
3908 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3909 tx_id: u32,
3910}
3911
3912impl std::ops::Drop for VolumeManagerGetInfoResponder {
3916 fn drop(&mut self) {
3917 self.control_handle.shutdown();
3918 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3920 }
3921}
3922
3923impl fidl::endpoints::Responder for VolumeManagerGetInfoResponder {
3924 type ControlHandle = VolumeManagerControlHandle;
3925
3926 fn control_handle(&self) -> &VolumeManagerControlHandle {
3927 &self.control_handle
3928 }
3929
3930 fn drop_without_shutdown(mut self) {
3931 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3933 std::mem::forget(self);
3935 }
3936}
3937
3938impl VolumeManagerGetInfoResponder {
3939 pub fn send(
3943 self,
3944 mut status: i32,
3945 mut info: Option<&VolumeManagerInfo>,
3946 ) -> Result<(), fidl::Error> {
3947 let _result = self.send_raw(status, info);
3948 if _result.is_err() {
3949 self.control_handle.shutdown();
3950 }
3951 self.drop_without_shutdown();
3952 _result
3953 }
3954
3955 pub fn send_no_shutdown_on_err(
3957 self,
3958 mut status: i32,
3959 mut info: Option<&VolumeManagerInfo>,
3960 ) -> Result<(), fidl::Error> {
3961 let _result = self.send_raw(status, info);
3962 self.drop_without_shutdown();
3963 _result
3964 }
3965
3966 fn send_raw(
3967 &self,
3968 mut status: i32,
3969 mut info: Option<&VolumeManagerInfo>,
3970 ) -> Result<(), fidl::Error> {
3971 self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
3972 (status, info),
3973 self.tx_id,
3974 0x2611214dcca5b064,
3975 fidl::encoding::DynamicFlags::empty(),
3976 )
3977 }
3978}
3979
3980#[must_use = "FIDL methods require a response to be sent"]
3981#[derive(Debug)]
3982pub struct VolumeManagerActivateResponder {
3983 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3984 tx_id: u32,
3985}
3986
3987impl std::ops::Drop for VolumeManagerActivateResponder {
3991 fn drop(&mut self) {
3992 self.control_handle.shutdown();
3993 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3995 }
3996}
3997
3998impl fidl::endpoints::Responder for VolumeManagerActivateResponder {
3999 type ControlHandle = VolumeManagerControlHandle;
4000
4001 fn control_handle(&self) -> &VolumeManagerControlHandle {
4002 &self.control_handle
4003 }
4004
4005 fn drop_without_shutdown(mut self) {
4006 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4008 std::mem::forget(self);
4010 }
4011}
4012
4013impl VolumeManagerActivateResponder {
4014 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4018 let _result = self.send_raw(status);
4019 if _result.is_err() {
4020 self.control_handle.shutdown();
4021 }
4022 self.drop_without_shutdown();
4023 _result
4024 }
4025
4026 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4028 let _result = self.send_raw(status);
4029 self.drop_without_shutdown();
4030 _result
4031 }
4032
4033 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4034 self.control_handle.inner.send::<VolumeManagerActivateResponse>(
4035 (status,),
4036 self.tx_id,
4037 0x182238d40c275be,
4038 fidl::encoding::DynamicFlags::empty(),
4039 )
4040 }
4041}
4042
4043#[must_use = "FIDL methods require a response to be sent"]
4044#[derive(Debug)]
4045pub struct VolumeManagerGetPartitionLimitResponder {
4046 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4047 tx_id: u32,
4048}
4049
4050impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
4054 fn drop(&mut self) {
4055 self.control_handle.shutdown();
4056 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4058 }
4059}
4060
4061impl fidl::endpoints::Responder for VolumeManagerGetPartitionLimitResponder {
4062 type ControlHandle = VolumeManagerControlHandle;
4063
4064 fn control_handle(&self) -> &VolumeManagerControlHandle {
4065 &self.control_handle
4066 }
4067
4068 fn drop_without_shutdown(mut self) {
4069 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4071 std::mem::forget(self);
4073 }
4074}
4075
4076impl VolumeManagerGetPartitionLimitResponder {
4077 pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
4081 let _result = self.send_raw(status, slice_count);
4082 if _result.is_err() {
4083 self.control_handle.shutdown();
4084 }
4085 self.drop_without_shutdown();
4086 _result
4087 }
4088
4089 pub fn send_no_shutdown_on_err(
4091 self,
4092 mut status: i32,
4093 mut slice_count: u64,
4094 ) -> Result<(), fidl::Error> {
4095 let _result = self.send_raw(status, slice_count);
4096 self.drop_without_shutdown();
4097 _result
4098 }
4099
4100 fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
4101 self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
4102 (status, slice_count),
4103 self.tx_id,
4104 0x5bc9d21ea8bd52db,
4105 fidl::encoding::DynamicFlags::empty(),
4106 )
4107 }
4108}
4109
4110#[must_use = "FIDL methods require a response to be sent"]
4111#[derive(Debug)]
4112pub struct VolumeManagerSetPartitionLimitResponder {
4113 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4114 tx_id: u32,
4115}
4116
4117impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
4121 fn drop(&mut self) {
4122 self.control_handle.shutdown();
4123 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4125 }
4126}
4127
4128impl fidl::endpoints::Responder for VolumeManagerSetPartitionLimitResponder {
4129 type ControlHandle = VolumeManagerControlHandle;
4130
4131 fn control_handle(&self) -> &VolumeManagerControlHandle {
4132 &self.control_handle
4133 }
4134
4135 fn drop_without_shutdown(mut self) {
4136 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4138 std::mem::forget(self);
4140 }
4141}
4142
4143impl VolumeManagerSetPartitionLimitResponder {
4144 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4148 let _result = self.send_raw(status);
4149 if _result.is_err() {
4150 self.control_handle.shutdown();
4151 }
4152 self.drop_without_shutdown();
4153 _result
4154 }
4155
4156 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4158 let _result = self.send_raw(status);
4159 self.drop_without_shutdown();
4160 _result
4161 }
4162
4163 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4164 self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
4165 (status,),
4166 self.tx_id,
4167 0x3a4903076534c093,
4168 fidl::encoding::DynamicFlags::empty(),
4169 )
4170 }
4171}
4172
4173#[must_use = "FIDL methods require a response to be sent"]
4174#[derive(Debug)]
4175pub struct VolumeManagerSetPartitionNameResponder {
4176 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4177 tx_id: u32,
4178}
4179
4180impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
4184 fn drop(&mut self) {
4185 self.control_handle.shutdown();
4186 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4188 }
4189}
4190
4191impl fidl::endpoints::Responder for VolumeManagerSetPartitionNameResponder {
4192 type ControlHandle = VolumeManagerControlHandle;
4193
4194 fn control_handle(&self) -> &VolumeManagerControlHandle {
4195 &self.control_handle
4196 }
4197
4198 fn drop_without_shutdown(mut self) {
4199 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4201 std::mem::forget(self);
4203 }
4204}
4205
4206impl VolumeManagerSetPartitionNameResponder {
4207 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4211 let _result = self.send_raw(result);
4212 if _result.is_err() {
4213 self.control_handle.shutdown();
4214 }
4215 self.drop_without_shutdown();
4216 _result
4217 }
4218
4219 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4221 let _result = self.send_raw(result);
4222 self.drop_without_shutdown();
4223 _result
4224 }
4225
4226 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4227 self.control_handle
4228 .inner
4229 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4230 result,
4231 self.tx_id,
4232 0x26afb07b9d70ff1a,
4233 fidl::encoding::DynamicFlags::empty(),
4234 )
4235 }
4236}
4237
4238mod internal {
4239 use super::*;
4240
4241 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionRequest {
4242 type Borrowed<'a> = &'a mut Self;
4243 fn take_or_borrow<'a>(
4244 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4245 ) -> Self::Borrowed<'a> {
4246 value
4247 }
4248 }
4249
4250 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionRequest {
4251 type Owned = Self;
4252
4253 #[inline(always)]
4254 fn inline_align(_context: fidl::encoding::Context) -> usize {
4255 4
4256 }
4257
4258 #[inline(always)]
4259 fn inline_size(_context: fidl::encoding::Context) -> usize {
4260 4
4261 }
4262 }
4263
4264 unsafe impl
4265 fidl::encoding::Encode<
4266 BlockOpenSessionRequest,
4267 fidl::encoding::DefaultFuchsiaResourceDialect,
4268 > for &mut BlockOpenSessionRequest
4269 {
4270 #[inline]
4271 unsafe fn encode(
4272 self,
4273 encoder: &mut fidl::encoding::Encoder<
4274 '_,
4275 fidl::encoding::DefaultFuchsiaResourceDialect,
4276 >,
4277 offset: usize,
4278 _depth: fidl::encoding::Depth,
4279 ) -> fidl::Result<()> {
4280 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
4281 fidl::encoding::Encode::<BlockOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4283 (
4284 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
4285 ),
4286 encoder, offset, _depth
4287 )
4288 }
4289 }
4290 unsafe impl<
4291 T0: fidl::encoding::Encode<
4292 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4293 fidl::encoding::DefaultFuchsiaResourceDialect,
4294 >,
4295 >
4296 fidl::encoding::Encode<
4297 BlockOpenSessionRequest,
4298 fidl::encoding::DefaultFuchsiaResourceDialect,
4299 > for (T0,)
4300 {
4301 #[inline]
4302 unsafe fn encode(
4303 self,
4304 encoder: &mut fidl::encoding::Encoder<
4305 '_,
4306 fidl::encoding::DefaultFuchsiaResourceDialect,
4307 >,
4308 offset: usize,
4309 depth: fidl::encoding::Depth,
4310 ) -> fidl::Result<()> {
4311 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
4312 self.0.encode(encoder, offset + 0, depth)?;
4316 Ok(())
4317 }
4318 }
4319
4320 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4321 for BlockOpenSessionRequest
4322 {
4323 #[inline(always)]
4324 fn new_empty() -> Self {
4325 Self {
4326 session: fidl::new_empty!(
4327 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4328 fidl::encoding::DefaultFuchsiaResourceDialect
4329 ),
4330 }
4331 }
4332
4333 #[inline]
4334 unsafe fn decode(
4335 &mut self,
4336 decoder: &mut fidl::encoding::Decoder<
4337 '_,
4338 fidl::encoding::DefaultFuchsiaResourceDialect,
4339 >,
4340 offset: usize,
4341 _depth: fidl::encoding::Depth,
4342 ) -> fidl::Result<()> {
4343 decoder.debug_check_bounds::<Self>(offset);
4344 fidl::decode!(
4346 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4347 fidl::encoding::DefaultFuchsiaResourceDialect,
4348 &mut self.session,
4349 decoder,
4350 offset + 0,
4351 _depth
4352 )?;
4353 Ok(())
4354 }
4355 }
4356
4357 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionWithOffsetMapRequest {
4358 type Borrowed<'a> = &'a mut Self;
4359 fn take_or_borrow<'a>(
4360 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4361 ) -> Self::Borrowed<'a> {
4362 value
4363 }
4364 }
4365
4366 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionWithOffsetMapRequest {
4367 type Owned = Self;
4368
4369 #[inline(always)]
4370 fn inline_align(_context: fidl::encoding::Context) -> usize {
4371 8
4372 }
4373
4374 #[inline(always)]
4375 fn inline_size(_context: fidl::encoding::Context) -> usize {
4376 32
4377 }
4378 }
4379
4380 unsafe impl
4381 fidl::encoding::Encode<
4382 BlockOpenSessionWithOffsetMapRequest,
4383 fidl::encoding::DefaultFuchsiaResourceDialect,
4384 > for &mut BlockOpenSessionWithOffsetMapRequest
4385 {
4386 #[inline]
4387 unsafe fn encode(
4388 self,
4389 encoder: &mut fidl::encoding::Encoder<
4390 '_,
4391 fidl::encoding::DefaultFuchsiaResourceDialect,
4392 >,
4393 offset: usize,
4394 _depth: fidl::encoding::Depth,
4395 ) -> fidl::Result<()> {
4396 encoder.debug_check_bounds::<BlockOpenSessionWithOffsetMapRequest>(offset);
4397 fidl::encoding::Encode::<BlockOpenSessionWithOffsetMapRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4399 (
4400 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
4401 <BlockOffsetMapping as fidl::encoding::ValueTypeMarker>::borrow(&self.mapping),
4402 ),
4403 encoder, offset, _depth
4404 )
4405 }
4406 }
4407 unsafe impl<
4408 T0: fidl::encoding::Encode<
4409 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4410 fidl::encoding::DefaultFuchsiaResourceDialect,
4411 >,
4412 T1: fidl::encoding::Encode<BlockOffsetMapping, fidl::encoding::DefaultFuchsiaResourceDialect>,
4413 >
4414 fidl::encoding::Encode<
4415 BlockOpenSessionWithOffsetMapRequest,
4416 fidl::encoding::DefaultFuchsiaResourceDialect,
4417 > for (T0, T1)
4418 {
4419 #[inline]
4420 unsafe fn encode(
4421 self,
4422 encoder: &mut fidl::encoding::Encoder<
4423 '_,
4424 fidl::encoding::DefaultFuchsiaResourceDialect,
4425 >,
4426 offset: usize,
4427 depth: fidl::encoding::Depth,
4428 ) -> fidl::Result<()> {
4429 encoder.debug_check_bounds::<BlockOpenSessionWithOffsetMapRequest>(offset);
4430 unsafe {
4433 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4434 (ptr as *mut u64).write_unaligned(0);
4435 }
4436 self.0.encode(encoder, offset + 0, depth)?;
4438 self.1.encode(encoder, offset + 8, depth)?;
4439 Ok(())
4440 }
4441 }
4442
4443 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4444 for BlockOpenSessionWithOffsetMapRequest
4445 {
4446 #[inline(always)]
4447 fn new_empty() -> Self {
4448 Self {
4449 session: fidl::new_empty!(
4450 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4451 fidl::encoding::DefaultFuchsiaResourceDialect
4452 ),
4453 mapping: fidl::new_empty!(
4454 BlockOffsetMapping,
4455 fidl::encoding::DefaultFuchsiaResourceDialect
4456 ),
4457 }
4458 }
4459
4460 #[inline]
4461 unsafe fn decode(
4462 &mut self,
4463 decoder: &mut fidl::encoding::Decoder<
4464 '_,
4465 fidl::encoding::DefaultFuchsiaResourceDialect,
4466 >,
4467 offset: usize,
4468 _depth: fidl::encoding::Depth,
4469 ) -> fidl::Result<()> {
4470 decoder.debug_check_bounds::<Self>(offset);
4471 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4473 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4474 let mask = 0xffffffff00000000u64;
4475 let maskedval = padval & mask;
4476 if maskedval != 0 {
4477 return Err(fidl::Error::NonZeroPadding {
4478 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4479 });
4480 }
4481 fidl::decode!(
4482 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4483 fidl::encoding::DefaultFuchsiaResourceDialect,
4484 &mut self.session,
4485 decoder,
4486 offset + 0,
4487 _depth
4488 )?;
4489 fidl::decode!(
4490 BlockOffsetMapping,
4491 fidl::encoding::DefaultFuchsiaResourceDialect,
4492 &mut self.mapping,
4493 decoder,
4494 offset + 8,
4495 _depth
4496 )?;
4497 Ok(())
4498 }
4499 }
4500
4501 impl fidl::encoding::ResourceTypeMarker for SessionAttachVmoRequest {
4502 type Borrowed<'a> = &'a mut Self;
4503 fn take_or_borrow<'a>(
4504 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4505 ) -> Self::Borrowed<'a> {
4506 value
4507 }
4508 }
4509
4510 unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoRequest {
4511 type Owned = Self;
4512
4513 #[inline(always)]
4514 fn inline_align(_context: fidl::encoding::Context) -> usize {
4515 4
4516 }
4517
4518 #[inline(always)]
4519 fn inline_size(_context: fidl::encoding::Context) -> usize {
4520 4
4521 }
4522 }
4523
4524 unsafe impl
4525 fidl::encoding::Encode<
4526 SessionAttachVmoRequest,
4527 fidl::encoding::DefaultFuchsiaResourceDialect,
4528 > for &mut SessionAttachVmoRequest
4529 {
4530 #[inline]
4531 unsafe fn encode(
4532 self,
4533 encoder: &mut fidl::encoding::Encoder<
4534 '_,
4535 fidl::encoding::DefaultFuchsiaResourceDialect,
4536 >,
4537 offset: usize,
4538 _depth: fidl::encoding::Depth,
4539 ) -> fidl::Result<()> {
4540 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
4541 fidl::encoding::Encode::<
4543 SessionAttachVmoRequest,
4544 fidl::encoding::DefaultFuchsiaResourceDialect,
4545 >::encode(
4546 (<fidl::encoding::HandleType<
4547 fidl::Vmo,
4548 { fidl::ObjectType::VMO.into_raw() },
4549 2147483648,
4550 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4551 &mut self.vmo
4552 ),),
4553 encoder,
4554 offset,
4555 _depth,
4556 )
4557 }
4558 }
4559 unsafe impl<
4560 T0: fidl::encoding::Encode<
4561 fidl::encoding::HandleType<
4562 fidl::Vmo,
4563 { fidl::ObjectType::VMO.into_raw() },
4564 2147483648,
4565 >,
4566 fidl::encoding::DefaultFuchsiaResourceDialect,
4567 >,
4568 >
4569 fidl::encoding::Encode<
4570 SessionAttachVmoRequest,
4571 fidl::encoding::DefaultFuchsiaResourceDialect,
4572 > for (T0,)
4573 {
4574 #[inline]
4575 unsafe fn encode(
4576 self,
4577 encoder: &mut fidl::encoding::Encoder<
4578 '_,
4579 fidl::encoding::DefaultFuchsiaResourceDialect,
4580 >,
4581 offset: usize,
4582 depth: fidl::encoding::Depth,
4583 ) -> fidl::Result<()> {
4584 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
4585 self.0.encode(encoder, offset + 0, depth)?;
4589 Ok(())
4590 }
4591 }
4592
4593 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4594 for SessionAttachVmoRequest
4595 {
4596 #[inline(always)]
4597 fn new_empty() -> Self {
4598 Self {
4599 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4600 }
4601 }
4602
4603 #[inline]
4604 unsafe fn decode(
4605 &mut self,
4606 decoder: &mut fidl::encoding::Decoder<
4607 '_,
4608 fidl::encoding::DefaultFuchsiaResourceDialect,
4609 >,
4610 offset: usize,
4611 _depth: fidl::encoding::Depth,
4612 ) -> fidl::Result<()> {
4613 decoder.debug_check_bounds::<Self>(offset);
4614 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
4616 Ok(())
4617 }
4618 }
4619
4620 impl fidl::encoding::ResourceTypeMarker for SessionGetFifoResponse {
4621 type Borrowed<'a> = &'a mut Self;
4622 fn take_or_borrow<'a>(
4623 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4624 ) -> Self::Borrowed<'a> {
4625 value
4626 }
4627 }
4628
4629 unsafe impl fidl::encoding::TypeMarker for SessionGetFifoResponse {
4630 type Owned = Self;
4631
4632 #[inline(always)]
4633 fn inline_align(_context: fidl::encoding::Context) -> usize {
4634 4
4635 }
4636
4637 #[inline(always)]
4638 fn inline_size(_context: fidl::encoding::Context) -> usize {
4639 4
4640 }
4641 }
4642
4643 unsafe impl
4644 fidl::encoding::Encode<
4645 SessionGetFifoResponse,
4646 fidl::encoding::DefaultFuchsiaResourceDialect,
4647 > for &mut SessionGetFifoResponse
4648 {
4649 #[inline]
4650 unsafe fn encode(
4651 self,
4652 encoder: &mut fidl::encoding::Encoder<
4653 '_,
4654 fidl::encoding::DefaultFuchsiaResourceDialect,
4655 >,
4656 offset: usize,
4657 _depth: fidl::encoding::Depth,
4658 ) -> fidl::Result<()> {
4659 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
4660 fidl::encoding::Encode::<
4662 SessionGetFifoResponse,
4663 fidl::encoding::DefaultFuchsiaResourceDialect,
4664 >::encode(
4665 (<fidl::encoding::HandleType<
4666 fidl::Fifo,
4667 { fidl::ObjectType::FIFO.into_raw() },
4668 2147483648,
4669 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4670 &mut self.fifo
4671 ),),
4672 encoder,
4673 offset,
4674 _depth,
4675 )
4676 }
4677 }
4678 unsafe impl<
4679 T0: fidl::encoding::Encode<
4680 fidl::encoding::HandleType<
4681 fidl::Fifo,
4682 { fidl::ObjectType::FIFO.into_raw() },
4683 2147483648,
4684 >,
4685 fidl::encoding::DefaultFuchsiaResourceDialect,
4686 >,
4687 >
4688 fidl::encoding::Encode<
4689 SessionGetFifoResponse,
4690 fidl::encoding::DefaultFuchsiaResourceDialect,
4691 > for (T0,)
4692 {
4693 #[inline]
4694 unsafe fn encode(
4695 self,
4696 encoder: &mut fidl::encoding::Encoder<
4697 '_,
4698 fidl::encoding::DefaultFuchsiaResourceDialect,
4699 >,
4700 offset: usize,
4701 depth: fidl::encoding::Depth,
4702 ) -> fidl::Result<()> {
4703 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
4704 self.0.encode(encoder, offset + 0, depth)?;
4708 Ok(())
4709 }
4710 }
4711
4712 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4713 for SessionGetFifoResponse
4714 {
4715 #[inline(always)]
4716 fn new_empty() -> Self {
4717 Self {
4718 fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4719 }
4720 }
4721
4722 #[inline]
4723 unsafe fn decode(
4724 &mut self,
4725 decoder: &mut fidl::encoding::Decoder<
4726 '_,
4727 fidl::encoding::DefaultFuchsiaResourceDialect,
4728 >,
4729 offset: usize,
4730 _depth: fidl::encoding::Depth,
4731 ) -> fidl::Result<()> {
4732 decoder.debug_check_bounds::<Self>(offset);
4733 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fifo, decoder, offset + 0, _depth)?;
4735 Ok(())
4736 }
4737 }
4738}