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 let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
131 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
132 }
133
134 pub fn into_channel(self) -> fidl::Channel {
135 self.client.into_channel()
136 }
137
138 pub fn wait_for_event(
141 &self,
142 deadline: zx::MonotonicInstant,
143 ) -> Result<BlockEvent, fidl::Error> {
144 BlockEvent::decode(self.client.wait_for_event(deadline)?)
145 }
146
147 pub fn r#get_info(
149 &self,
150 ___deadline: zx::MonotonicInstant,
151 ) -> Result<BlockGetInfoResult, fidl::Error> {
152 let _response = self.client.send_query::<
153 fidl::encoding::EmptyPayload,
154 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
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 =
205 self.client.send_query::<fidl::encoding::EmptyPayload, BlockGetTypeGuidResponse>(
206 (),
207 0xefe4e41dafce4cc,
208 fidl::encoding::DynamicFlags::empty(),
209 ___deadline,
210 )?;
211 Ok((_response.status, _response.guid))
212 }
213
214 pub fn r#get_instance_guid(
217 &self,
218 ___deadline: zx::MonotonicInstant,
219 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
220 let _response =
221 self.client.send_query::<fidl::encoding::EmptyPayload, BlockGetInstanceGuidResponse>(
222 (),
223 0x2e85011aabeb87fb,
224 fidl::encoding::DynamicFlags::empty(),
225 ___deadline,
226 )?;
227 Ok((_response.status, _response.guid))
228 }
229
230 pub fn r#get_name(
233 &self,
234 ___deadline: zx::MonotonicInstant,
235 ) -> Result<(i32, Option<String>), fidl::Error> {
236 let _response =
237 self.client.send_query::<fidl::encoding::EmptyPayload, BlockGetNameResponse>(
238 (),
239 0x630be18badedbb05,
240 fidl::encoding::DynamicFlags::empty(),
241 ___deadline,
242 )?;
243 Ok((_response.status, _response.name))
244 }
245
246 pub fn r#get_metadata(
250 &self,
251 ___deadline: zx::MonotonicInstant,
252 ) -> Result<BlockGetMetadataResult, fidl::Error> {
253 let _response = self.client.send_query::<
254 fidl::encoding::EmptyPayload,
255 fidl::encoding::ResultType<BlockGetMetadataResponse, i32>,
256 >(
257 (),
258 0x2c76b02ef9382533,
259 fidl::encoding::DynamicFlags::empty(),
260 ___deadline,
261 )?;
262 Ok(_response.map(|x| x))
263 }
264
265 pub fn r#query_slices(
270 &self,
271 mut start_slices: &[u64],
272 ___deadline: zx::MonotonicInstant,
273 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
274 let _response =
275 self.client.send_query::<BlockQuerySlicesRequest, BlockQuerySlicesResponse>(
276 (start_slices,),
277 0x289240ac4fbaa190,
278 fidl::encoding::DynamicFlags::empty(),
279 ___deadline,
280 )?;
281 Ok((_response.status, _response.response, _response.response_count))
282 }
283
284 pub fn r#get_volume_info(
288 &self,
289 ___deadline: zx::MonotonicInstant,
290 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error> {
291 let _response =
292 self.client.send_query::<fidl::encoding::EmptyPayload, BlockGetVolumeInfoResponse>(
293 (),
294 0x3a7dc69ea5d788d4,
295 fidl::encoding::DynamicFlags::empty(),
296 ___deadline,
297 )?;
298 Ok((_response.status, _response.manager, _response.volume))
299 }
300
301 pub fn r#extend(
309 &self,
310 mut start_slice: u64,
311 mut slice_count: u64,
312 ___deadline: zx::MonotonicInstant,
313 ) -> Result<i32, fidl::Error> {
314 let _response = self.client.send_query::<BlockExtendRequest, BlockExtendResponse>(
315 (start_slice, slice_count),
316 0x273fb2980ff24157,
317 fidl::encoding::DynamicFlags::empty(),
318 ___deadline,
319 )?;
320 Ok(_response.status)
321 }
322
323 pub fn r#shrink(
328 &self,
329 mut start_slice: u64,
330 mut slice_count: u64,
331 ___deadline: zx::MonotonicInstant,
332 ) -> Result<i32, fidl::Error> {
333 let _response = self.client.send_query::<BlockShrinkRequest, BlockShrinkResponse>(
334 (start_slice, slice_count),
335 0x73da6de865600a8b,
336 fidl::encoding::DynamicFlags::empty(),
337 ___deadline,
338 )?;
339 Ok(_response.status)
340 }
341
342 pub fn r#destroy(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
347 let _response =
348 self.client.send_query::<fidl::encoding::EmptyPayload, BlockDestroyResponse>(
349 (),
350 0x5866ba764e05a68e,
351 fidl::encoding::DynamicFlags::empty(),
352 ___deadline,
353 )?;
354 Ok(_response.status)
355 }
356}
357
358#[cfg(target_os = "fuchsia")]
359impl From<BlockSynchronousProxy> for zx::NullableHandle {
360 fn from(value: BlockSynchronousProxy) -> Self {
361 value.into_channel().into()
362 }
363}
364
365#[cfg(target_os = "fuchsia")]
366impl From<fidl::Channel> for BlockSynchronousProxy {
367 fn from(value: fidl::Channel) -> Self {
368 Self::new(value)
369 }
370}
371
372#[cfg(target_os = "fuchsia")]
373impl fidl::endpoints::FromClient for BlockSynchronousProxy {
374 type Protocol = BlockMarker;
375
376 fn from_client(value: fidl::endpoints::ClientEnd<BlockMarker>) -> Self {
377 Self::new(value.into_channel())
378 }
379}
380
381#[derive(Debug, Clone)]
382pub struct BlockProxy {
383 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
384}
385
386impl fidl::endpoints::Proxy for BlockProxy {
387 type Protocol = BlockMarker;
388
389 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
390 Self::new(inner)
391 }
392
393 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
394 self.client.into_channel().map_err(|client| Self { client })
395 }
396
397 fn as_channel(&self) -> &::fidl::AsyncChannel {
398 self.client.as_channel()
399 }
400}
401
402impl BlockProxy {
403 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
405 let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
406 Self { client: fidl::client::Client::new(channel, protocol_name) }
407 }
408
409 pub fn take_event_stream(&self) -> BlockEventStream {
415 BlockEventStream { event_receiver: self.client.take_event_receiver() }
416 }
417
418 pub fn r#get_info(
420 &self,
421 ) -> fidl::client::QueryResponseFut<
422 BlockGetInfoResult,
423 fidl::encoding::DefaultFuchsiaResourceDialect,
424 > {
425 BlockProxyInterface::r#get_info(self)
426 }
427
428 pub fn r#open_session(
430 &self,
431 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
432 ) -> Result<(), fidl::Error> {
433 BlockProxyInterface::r#open_session(self, session)
434 }
435
436 pub fn r#open_session_with_offset_map(
447 &self,
448 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
449 mut mapping: &BlockOffsetMapping,
450 ) -> Result<(), fidl::Error> {
451 BlockProxyInterface::r#open_session_with_offset_map(self, session, mapping)
452 }
453
454 pub fn r#get_type_guid(
457 &self,
458 ) -> fidl::client::QueryResponseFut<
459 (i32, Option<Box<Guid>>),
460 fidl::encoding::DefaultFuchsiaResourceDialect,
461 > {
462 BlockProxyInterface::r#get_type_guid(self)
463 }
464
465 pub fn r#get_instance_guid(
468 &self,
469 ) -> fidl::client::QueryResponseFut<
470 (i32, Option<Box<Guid>>),
471 fidl::encoding::DefaultFuchsiaResourceDialect,
472 > {
473 BlockProxyInterface::r#get_instance_guid(self)
474 }
475
476 pub fn r#get_name(
479 &self,
480 ) -> fidl::client::QueryResponseFut<
481 (i32, Option<String>),
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 > {
484 BlockProxyInterface::r#get_name(self)
485 }
486
487 pub fn r#get_metadata(
491 &self,
492 ) -> fidl::client::QueryResponseFut<
493 BlockGetMetadataResult,
494 fidl::encoding::DefaultFuchsiaResourceDialect,
495 > {
496 BlockProxyInterface::r#get_metadata(self)
497 }
498
499 pub fn r#query_slices(
504 &self,
505 mut start_slices: &[u64],
506 ) -> fidl::client::QueryResponseFut<
507 (i32, [VsliceRange; 16], u64),
508 fidl::encoding::DefaultFuchsiaResourceDialect,
509 > {
510 BlockProxyInterface::r#query_slices(self, start_slices)
511 }
512
513 pub fn r#get_volume_info(
517 &self,
518 ) -> fidl::client::QueryResponseFut<
519 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
520 fidl::encoding::DefaultFuchsiaResourceDialect,
521 > {
522 BlockProxyInterface::r#get_volume_info(self)
523 }
524
525 pub fn r#extend(
533 &self,
534 mut start_slice: u64,
535 mut slice_count: u64,
536 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
537 BlockProxyInterface::r#extend(self, start_slice, slice_count)
538 }
539
540 pub fn r#shrink(
545 &self,
546 mut start_slice: u64,
547 mut slice_count: u64,
548 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
549 BlockProxyInterface::r#shrink(self, start_slice, slice_count)
550 }
551
552 pub fn r#destroy(
557 &self,
558 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
559 BlockProxyInterface::r#destroy(self)
560 }
561}
562
563impl BlockProxyInterface for BlockProxy {
564 type GetInfoResponseFut = fidl::client::QueryResponseFut<
565 BlockGetInfoResult,
566 fidl::encoding::DefaultFuchsiaResourceDialect,
567 >;
568 fn r#get_info(&self) -> Self::GetInfoResponseFut {
569 fn _decode(
570 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
571 ) -> Result<BlockGetInfoResult, fidl::Error> {
572 let _response = fidl::client::decode_transaction_body::<
573 fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
574 fidl::encoding::DefaultFuchsiaResourceDialect,
575 0x58777a4a31cc9a47,
576 >(_buf?)?;
577 Ok(_response.map(|x| x.info))
578 }
579 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetInfoResult>(
580 (),
581 0x58777a4a31cc9a47,
582 fidl::encoding::DynamicFlags::empty(),
583 _decode,
584 )
585 }
586
587 fn r#open_session(
588 &self,
589 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
590 ) -> Result<(), fidl::Error> {
591 self.client.send::<BlockOpenSessionRequest>(
592 (session,),
593 0x2ca32f8c64f1d6c8,
594 fidl::encoding::DynamicFlags::empty(),
595 )
596 }
597
598 fn r#open_session_with_offset_map(
599 &self,
600 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
601 mut mapping: &BlockOffsetMapping,
602 ) -> Result<(), fidl::Error> {
603 self.client.send::<BlockOpenSessionWithOffsetMapRequest>(
604 (session, mapping),
605 0x4417dc2d57b4b574,
606 fidl::encoding::DynamicFlags::empty(),
607 )
608 }
609
610 type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
611 (i32, Option<Box<Guid>>),
612 fidl::encoding::DefaultFuchsiaResourceDialect,
613 >;
614 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
615 fn _decode(
616 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
617 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
618 let _response = fidl::client::decode_transaction_body::<
619 BlockGetTypeGuidResponse,
620 fidl::encoding::DefaultFuchsiaResourceDialect,
621 0xefe4e41dafce4cc,
622 >(_buf?)?;
623 Ok((_response.status, _response.guid))
624 }
625 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
626 (),
627 0xefe4e41dafce4cc,
628 fidl::encoding::DynamicFlags::empty(),
629 _decode,
630 )
631 }
632
633 type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
634 (i32, Option<Box<Guid>>),
635 fidl::encoding::DefaultFuchsiaResourceDialect,
636 >;
637 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
638 fn _decode(
639 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
640 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
641 let _response = fidl::client::decode_transaction_body::<
642 BlockGetInstanceGuidResponse,
643 fidl::encoding::DefaultFuchsiaResourceDialect,
644 0x2e85011aabeb87fb,
645 >(_buf?)?;
646 Ok((_response.status, _response.guid))
647 }
648 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
649 (),
650 0x2e85011aabeb87fb,
651 fidl::encoding::DynamicFlags::empty(),
652 _decode,
653 )
654 }
655
656 type GetNameResponseFut = fidl::client::QueryResponseFut<
657 (i32, Option<String>),
658 fidl::encoding::DefaultFuchsiaResourceDialect,
659 >;
660 fn r#get_name(&self) -> Self::GetNameResponseFut {
661 fn _decode(
662 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
663 ) -> Result<(i32, Option<String>), fidl::Error> {
664 let _response = fidl::client::decode_transaction_body::<
665 BlockGetNameResponse,
666 fidl::encoding::DefaultFuchsiaResourceDialect,
667 0x630be18badedbb05,
668 >(_buf?)?;
669 Ok((_response.status, _response.name))
670 }
671 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
672 (),
673 0x630be18badedbb05,
674 fidl::encoding::DynamicFlags::empty(),
675 _decode,
676 )
677 }
678
679 type GetMetadataResponseFut = fidl::client::QueryResponseFut<
680 BlockGetMetadataResult,
681 fidl::encoding::DefaultFuchsiaResourceDialect,
682 >;
683 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
684 fn _decode(
685 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
686 ) -> Result<BlockGetMetadataResult, fidl::Error> {
687 let _response = fidl::client::decode_transaction_body::<
688 fidl::encoding::ResultType<BlockGetMetadataResponse, i32>,
689 fidl::encoding::DefaultFuchsiaResourceDialect,
690 0x2c76b02ef9382533,
691 >(_buf?)?;
692 Ok(_response.map(|x| x))
693 }
694 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetMetadataResult>(
695 (),
696 0x2c76b02ef9382533,
697 fidl::encoding::DynamicFlags::empty(),
698 _decode,
699 )
700 }
701
702 type QuerySlicesResponseFut = fidl::client::QueryResponseFut<
703 (i32, [VsliceRange; 16], u64),
704 fidl::encoding::DefaultFuchsiaResourceDialect,
705 >;
706 fn r#query_slices(&self, mut start_slices: &[u64]) -> Self::QuerySlicesResponseFut {
707 fn _decode(
708 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
709 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
710 let _response = fidl::client::decode_transaction_body::<
711 BlockQuerySlicesResponse,
712 fidl::encoding::DefaultFuchsiaResourceDialect,
713 0x289240ac4fbaa190,
714 >(_buf?)?;
715 Ok((_response.status, _response.response, _response.response_count))
716 }
717 self.client.send_query_and_decode::<BlockQuerySlicesRequest, (i32, [VsliceRange; 16], u64)>(
718 (start_slices,),
719 0x289240ac4fbaa190,
720 fidl::encoding::DynamicFlags::empty(),
721 _decode,
722 )
723 }
724
725 type GetVolumeInfoResponseFut = fidl::client::QueryResponseFut<
726 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
727 fidl::encoding::DefaultFuchsiaResourceDialect,
728 >;
729 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut {
730 fn _decode(
731 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
732 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error>
733 {
734 let _response = fidl::client::decode_transaction_body::<
735 BlockGetVolumeInfoResponse,
736 fidl::encoding::DefaultFuchsiaResourceDialect,
737 0x3a7dc69ea5d788d4,
738 >(_buf?)?;
739 Ok((_response.status, _response.manager, _response.volume))
740 }
741 self.client.send_query_and_decode::<
742 fidl::encoding::EmptyPayload,
743 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
744 >(
745 (),
746 0x3a7dc69ea5d788d4,
747 fidl::encoding::DynamicFlags::empty(),
748 _decode,
749 )
750 }
751
752 type ExtendResponseFut =
753 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
754 fn r#extend(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ExtendResponseFut {
755 fn _decode(
756 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
757 ) -> Result<i32, fidl::Error> {
758 let _response = fidl::client::decode_transaction_body::<
759 BlockExtendResponse,
760 fidl::encoding::DefaultFuchsiaResourceDialect,
761 0x273fb2980ff24157,
762 >(_buf?)?;
763 Ok(_response.status)
764 }
765 self.client.send_query_and_decode::<BlockExtendRequest, i32>(
766 (start_slice, slice_count),
767 0x273fb2980ff24157,
768 fidl::encoding::DynamicFlags::empty(),
769 _decode,
770 )
771 }
772
773 type ShrinkResponseFut =
774 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
775 fn r#shrink(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ShrinkResponseFut {
776 fn _decode(
777 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
778 ) -> Result<i32, fidl::Error> {
779 let _response = fidl::client::decode_transaction_body::<
780 BlockShrinkResponse,
781 fidl::encoding::DefaultFuchsiaResourceDialect,
782 0x73da6de865600a8b,
783 >(_buf?)?;
784 Ok(_response.status)
785 }
786 self.client.send_query_and_decode::<BlockShrinkRequest, i32>(
787 (start_slice, slice_count),
788 0x73da6de865600a8b,
789 fidl::encoding::DynamicFlags::empty(),
790 _decode,
791 )
792 }
793
794 type DestroyResponseFut =
795 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
796 fn r#destroy(&self) -> Self::DestroyResponseFut {
797 fn _decode(
798 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
799 ) -> Result<i32, fidl::Error> {
800 let _response = fidl::client::decode_transaction_body::<
801 BlockDestroyResponse,
802 fidl::encoding::DefaultFuchsiaResourceDialect,
803 0x5866ba764e05a68e,
804 >(_buf?)?;
805 Ok(_response.status)
806 }
807 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
808 (),
809 0x5866ba764e05a68e,
810 fidl::encoding::DynamicFlags::empty(),
811 _decode,
812 )
813 }
814}
815
816pub struct BlockEventStream {
817 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
818}
819
820impl std::marker::Unpin for BlockEventStream {}
821
822impl futures::stream::FusedStream for BlockEventStream {
823 fn is_terminated(&self) -> bool {
824 self.event_receiver.is_terminated()
825 }
826}
827
828impl futures::Stream for BlockEventStream {
829 type Item = Result<BlockEvent, fidl::Error>;
830
831 fn poll_next(
832 mut self: std::pin::Pin<&mut Self>,
833 cx: &mut std::task::Context<'_>,
834 ) -> std::task::Poll<Option<Self::Item>> {
835 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
836 &mut self.event_receiver,
837 cx
838 )?) {
839 Some(buf) => std::task::Poll::Ready(Some(BlockEvent::decode(buf))),
840 None => std::task::Poll::Ready(None),
841 }
842 }
843}
844
845#[derive(Debug)]
846pub enum BlockEvent {}
847
848impl BlockEvent {
849 fn decode(
851 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
852 ) -> Result<BlockEvent, fidl::Error> {
853 let (bytes, _handles) = buf.split_mut();
854 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
855 debug_assert_eq!(tx_header.tx_id, 0);
856 match tx_header.ordinal {
857 _ => Err(fidl::Error::UnknownOrdinal {
858 ordinal: tx_header.ordinal,
859 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
860 }),
861 }
862 }
863}
864
865pub struct BlockRequestStream {
867 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
868 is_terminated: bool,
869}
870
871impl std::marker::Unpin for BlockRequestStream {}
872
873impl futures::stream::FusedStream for BlockRequestStream {
874 fn is_terminated(&self) -> bool {
875 self.is_terminated
876 }
877}
878
879impl fidl::endpoints::RequestStream for BlockRequestStream {
880 type Protocol = BlockMarker;
881 type ControlHandle = BlockControlHandle;
882
883 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
884 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
885 }
886
887 fn control_handle(&self) -> Self::ControlHandle {
888 BlockControlHandle { inner: self.inner.clone() }
889 }
890
891 fn into_inner(
892 self,
893 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
894 {
895 (self.inner, self.is_terminated)
896 }
897
898 fn from_inner(
899 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
900 is_terminated: bool,
901 ) -> Self {
902 Self { inner, is_terminated }
903 }
904}
905
906impl futures::Stream for BlockRequestStream {
907 type Item = Result<BlockRequest, fidl::Error>;
908
909 fn poll_next(
910 mut self: std::pin::Pin<&mut Self>,
911 cx: &mut std::task::Context<'_>,
912 ) -> std::task::Poll<Option<Self::Item>> {
913 let this = &mut *self;
914 if this.inner.check_shutdown(cx) {
915 this.is_terminated = true;
916 return std::task::Poll::Ready(None);
917 }
918 if this.is_terminated {
919 panic!("polled BlockRequestStream after completion");
920 }
921 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
922 |bytes, handles| {
923 match this.inner.channel().read_etc(cx, bytes, handles) {
924 std::task::Poll::Ready(Ok(())) => {}
925 std::task::Poll::Pending => return std::task::Poll::Pending,
926 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
927 this.is_terminated = true;
928 return std::task::Poll::Ready(None);
929 }
930 std::task::Poll::Ready(Err(e)) => {
931 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
932 e.into(),
933 ))));
934 }
935 }
936
937 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
939
940 std::task::Poll::Ready(Some(match header.ordinal {
941 0x58777a4a31cc9a47 => {
942 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
943 let mut req = fidl::new_empty!(
944 fidl::encoding::EmptyPayload,
945 fidl::encoding::DefaultFuchsiaResourceDialect
946 );
947 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
948 let control_handle = BlockControlHandle { inner: this.inner.clone() };
949 Ok(BlockRequest::GetInfo {
950 responder: BlockGetInfoResponder {
951 control_handle: std::mem::ManuallyDrop::new(control_handle),
952 tx_id: header.tx_id,
953 },
954 })
955 }
956 0x2ca32f8c64f1d6c8 => {
957 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
958 let mut req = fidl::new_empty!(
959 BlockOpenSessionRequest,
960 fidl::encoding::DefaultFuchsiaResourceDialect
961 );
962 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
963 let control_handle = BlockControlHandle { inner: this.inner.clone() };
964 Ok(BlockRequest::OpenSession { session: req.session, control_handle })
965 }
966 0x4417dc2d57b4b574 => {
967 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
968 let mut req = fidl::new_empty!(
969 BlockOpenSessionWithOffsetMapRequest,
970 fidl::encoding::DefaultFuchsiaResourceDialect
971 );
972 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
973 let control_handle = BlockControlHandle { inner: this.inner.clone() };
974 Ok(BlockRequest::OpenSessionWithOffsetMap {
975 session: req.session,
976 mapping: req.mapping,
977
978 control_handle,
979 })
980 }
981 0xefe4e41dafce4cc => {
982 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
983 let mut req = fidl::new_empty!(
984 fidl::encoding::EmptyPayload,
985 fidl::encoding::DefaultFuchsiaResourceDialect
986 );
987 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
988 let control_handle = BlockControlHandle { inner: this.inner.clone() };
989 Ok(BlockRequest::GetTypeGuid {
990 responder: BlockGetTypeGuidResponder {
991 control_handle: std::mem::ManuallyDrop::new(control_handle),
992 tx_id: header.tx_id,
993 },
994 })
995 }
996 0x2e85011aabeb87fb => {
997 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
998 let mut req = fidl::new_empty!(
999 fidl::encoding::EmptyPayload,
1000 fidl::encoding::DefaultFuchsiaResourceDialect
1001 );
1002 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1003 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1004 Ok(BlockRequest::GetInstanceGuid {
1005 responder: BlockGetInstanceGuidResponder {
1006 control_handle: std::mem::ManuallyDrop::new(control_handle),
1007 tx_id: header.tx_id,
1008 },
1009 })
1010 }
1011 0x630be18badedbb05 => {
1012 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1013 let mut req = fidl::new_empty!(
1014 fidl::encoding::EmptyPayload,
1015 fidl::encoding::DefaultFuchsiaResourceDialect
1016 );
1017 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1018 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1019 Ok(BlockRequest::GetName {
1020 responder: BlockGetNameResponder {
1021 control_handle: std::mem::ManuallyDrop::new(control_handle),
1022 tx_id: header.tx_id,
1023 },
1024 })
1025 }
1026 0x2c76b02ef9382533 => {
1027 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1028 let mut req = fidl::new_empty!(
1029 fidl::encoding::EmptyPayload,
1030 fidl::encoding::DefaultFuchsiaResourceDialect
1031 );
1032 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1033 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1034 Ok(BlockRequest::GetMetadata {
1035 responder: BlockGetMetadataResponder {
1036 control_handle: std::mem::ManuallyDrop::new(control_handle),
1037 tx_id: header.tx_id,
1038 },
1039 })
1040 }
1041 0x289240ac4fbaa190 => {
1042 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1043 let mut req = fidl::new_empty!(
1044 BlockQuerySlicesRequest,
1045 fidl::encoding::DefaultFuchsiaResourceDialect
1046 );
1047 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockQuerySlicesRequest>(&header, _body_bytes, handles, &mut req)?;
1048 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1049 Ok(BlockRequest::QuerySlices {
1050 start_slices: req.start_slices,
1051
1052 responder: BlockQuerySlicesResponder {
1053 control_handle: std::mem::ManuallyDrop::new(control_handle),
1054 tx_id: header.tx_id,
1055 },
1056 })
1057 }
1058 0x3a7dc69ea5d788d4 => {
1059 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1060 let mut req = fidl::new_empty!(
1061 fidl::encoding::EmptyPayload,
1062 fidl::encoding::DefaultFuchsiaResourceDialect
1063 );
1064 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1065 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1066 Ok(BlockRequest::GetVolumeInfo {
1067 responder: BlockGetVolumeInfoResponder {
1068 control_handle: std::mem::ManuallyDrop::new(control_handle),
1069 tx_id: header.tx_id,
1070 },
1071 })
1072 }
1073 0x273fb2980ff24157 => {
1074 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1075 let mut req = fidl::new_empty!(
1076 BlockExtendRequest,
1077 fidl::encoding::DefaultFuchsiaResourceDialect
1078 );
1079 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockExtendRequest>(&header, _body_bytes, handles, &mut req)?;
1080 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1081 Ok(BlockRequest::Extend {
1082 start_slice: req.start_slice,
1083 slice_count: req.slice_count,
1084
1085 responder: BlockExtendResponder {
1086 control_handle: std::mem::ManuallyDrop::new(control_handle),
1087 tx_id: header.tx_id,
1088 },
1089 })
1090 }
1091 0x73da6de865600a8b => {
1092 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1093 let mut req = fidl::new_empty!(
1094 BlockShrinkRequest,
1095 fidl::encoding::DefaultFuchsiaResourceDialect
1096 );
1097 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlockShrinkRequest>(&header, _body_bytes, handles, &mut req)?;
1098 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1099 Ok(BlockRequest::Shrink {
1100 start_slice: req.start_slice,
1101 slice_count: req.slice_count,
1102
1103 responder: BlockShrinkResponder {
1104 control_handle: std::mem::ManuallyDrop::new(control_handle),
1105 tx_id: header.tx_id,
1106 },
1107 })
1108 }
1109 0x5866ba764e05a68e => {
1110 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1111 let mut req = fidl::new_empty!(
1112 fidl::encoding::EmptyPayload,
1113 fidl::encoding::DefaultFuchsiaResourceDialect
1114 );
1115 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1116 let control_handle = BlockControlHandle { inner: this.inner.clone() };
1117 Ok(BlockRequest::Destroy {
1118 responder: BlockDestroyResponder {
1119 control_handle: std::mem::ManuallyDrop::new(control_handle),
1120 tx_id: header.tx_id,
1121 },
1122 })
1123 }
1124 _ => Err(fidl::Error::UnknownOrdinal {
1125 ordinal: header.ordinal,
1126 protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1127 }),
1128 }))
1129 },
1130 )
1131 }
1132}
1133
1134#[derive(Debug)]
1137pub enum BlockRequest {
1138 GetInfo { responder: BlockGetInfoResponder },
1140 OpenSession {
1142 session: fidl::endpoints::ServerEnd<SessionMarker>,
1143 control_handle: BlockControlHandle,
1144 },
1145 OpenSessionWithOffsetMap {
1156 session: fidl::endpoints::ServerEnd<SessionMarker>,
1157 mapping: BlockOffsetMapping,
1158 control_handle: BlockControlHandle,
1159 },
1160 GetTypeGuid { responder: BlockGetTypeGuidResponder },
1163 GetInstanceGuid { responder: BlockGetInstanceGuidResponder },
1166 GetName { responder: BlockGetNameResponder },
1169 GetMetadata { responder: BlockGetMetadataResponder },
1173 QuerySlices { start_slices: Vec<u64>, responder: BlockQuerySlicesResponder },
1178 GetVolumeInfo { responder: BlockGetVolumeInfoResponder },
1182 Extend { start_slice: u64, slice_count: u64, responder: BlockExtendResponder },
1190 Shrink { start_slice: u64, slice_count: u64, responder: BlockShrinkResponder },
1195 Destroy { responder: BlockDestroyResponder },
1200}
1201
1202impl BlockRequest {
1203 #[allow(irrefutable_let_patterns)]
1204 pub fn into_get_info(self) -> Option<(BlockGetInfoResponder)> {
1205 if let BlockRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1206 }
1207
1208 #[allow(irrefutable_let_patterns)]
1209 pub fn into_open_session(
1210 self,
1211 ) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockControlHandle)> {
1212 if let BlockRequest::OpenSession { session, control_handle } = self {
1213 Some((session, control_handle))
1214 } else {
1215 None
1216 }
1217 }
1218
1219 #[allow(irrefutable_let_patterns)]
1220 pub fn into_open_session_with_offset_map(
1221 self,
1222 ) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockOffsetMapping, BlockControlHandle)>
1223 {
1224 if let BlockRequest::OpenSessionWithOffsetMap { session, mapping, control_handle } = self {
1225 Some((session, mapping, control_handle))
1226 } else {
1227 None
1228 }
1229 }
1230
1231 #[allow(irrefutable_let_patterns)]
1232 pub fn into_get_type_guid(self) -> Option<(BlockGetTypeGuidResponder)> {
1233 if let BlockRequest::GetTypeGuid { responder } = self { Some((responder)) } else { None }
1234 }
1235
1236 #[allow(irrefutable_let_patterns)]
1237 pub fn into_get_instance_guid(self) -> Option<(BlockGetInstanceGuidResponder)> {
1238 if let BlockRequest::GetInstanceGuid { responder } = self {
1239 Some((responder))
1240 } else {
1241 None
1242 }
1243 }
1244
1245 #[allow(irrefutable_let_patterns)]
1246 pub fn into_get_name(self) -> Option<(BlockGetNameResponder)> {
1247 if let BlockRequest::GetName { responder } = self { Some((responder)) } else { None }
1248 }
1249
1250 #[allow(irrefutable_let_patterns)]
1251 pub fn into_get_metadata(self) -> Option<(BlockGetMetadataResponder)> {
1252 if let BlockRequest::GetMetadata { responder } = self { Some((responder)) } else { None }
1253 }
1254
1255 #[allow(irrefutable_let_patterns)]
1256 pub fn into_query_slices(self) -> Option<(Vec<u64>, BlockQuerySlicesResponder)> {
1257 if let BlockRequest::QuerySlices { start_slices, responder } = self {
1258 Some((start_slices, responder))
1259 } else {
1260 None
1261 }
1262 }
1263
1264 #[allow(irrefutable_let_patterns)]
1265 pub fn into_get_volume_info(self) -> Option<(BlockGetVolumeInfoResponder)> {
1266 if let BlockRequest::GetVolumeInfo { responder } = self { Some((responder)) } else { None }
1267 }
1268
1269 #[allow(irrefutable_let_patterns)]
1270 pub fn into_extend(self) -> Option<(u64, u64, BlockExtendResponder)> {
1271 if let BlockRequest::Extend { start_slice, slice_count, responder } = self {
1272 Some((start_slice, slice_count, responder))
1273 } else {
1274 None
1275 }
1276 }
1277
1278 #[allow(irrefutable_let_patterns)]
1279 pub fn into_shrink(self) -> Option<(u64, u64, BlockShrinkResponder)> {
1280 if let BlockRequest::Shrink { 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_destroy(self) -> Option<(BlockDestroyResponder)> {
1289 if let BlockRequest::Destroy { responder } = self { Some((responder)) } else { None }
1290 }
1291
1292 pub fn method_name(&self) -> &'static str {
1294 match *self {
1295 BlockRequest::GetInfo { .. } => "get_info",
1296 BlockRequest::OpenSession { .. } => "open_session",
1297 BlockRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
1298 BlockRequest::GetTypeGuid { .. } => "get_type_guid",
1299 BlockRequest::GetInstanceGuid { .. } => "get_instance_guid",
1300 BlockRequest::GetName { .. } => "get_name",
1301 BlockRequest::GetMetadata { .. } => "get_metadata",
1302 BlockRequest::QuerySlices { .. } => "query_slices",
1303 BlockRequest::GetVolumeInfo { .. } => "get_volume_info",
1304 BlockRequest::Extend { .. } => "extend",
1305 BlockRequest::Shrink { .. } => "shrink",
1306 BlockRequest::Destroy { .. } => "destroy",
1307 }
1308 }
1309}
1310
1311#[derive(Debug, Clone)]
1312pub struct BlockControlHandle {
1313 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1314}
1315
1316impl fidl::endpoints::ControlHandle for BlockControlHandle {
1317 fn shutdown(&self) {
1318 self.inner.shutdown()
1319 }
1320
1321 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1322 self.inner.shutdown_with_epitaph(status)
1323 }
1324
1325 fn is_closed(&self) -> bool {
1326 self.inner.channel().is_closed()
1327 }
1328 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1329 self.inner.channel().on_closed()
1330 }
1331
1332 #[cfg(target_os = "fuchsia")]
1333 fn signal_peer(
1334 &self,
1335 clear_mask: zx::Signals,
1336 set_mask: zx::Signals,
1337 ) -> Result<(), zx_status::Status> {
1338 use fidl::Peered;
1339 self.inner.channel().signal_peer(clear_mask, set_mask)
1340 }
1341}
1342
1343impl BlockControlHandle {}
1344
1345#[must_use = "FIDL methods require a response to be sent"]
1346#[derive(Debug)]
1347pub struct BlockGetInfoResponder {
1348 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1349 tx_id: u32,
1350}
1351
1352impl std::ops::Drop for BlockGetInfoResponder {
1356 fn drop(&mut self) {
1357 self.control_handle.shutdown();
1358 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1360 }
1361}
1362
1363impl fidl::endpoints::Responder for BlockGetInfoResponder {
1364 type ControlHandle = BlockControlHandle;
1365
1366 fn control_handle(&self) -> &BlockControlHandle {
1367 &self.control_handle
1368 }
1369
1370 fn drop_without_shutdown(mut self) {
1371 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1373 std::mem::forget(self);
1375 }
1376}
1377
1378impl BlockGetInfoResponder {
1379 pub fn send(self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1383 let _result = self.send_raw(result);
1384 if _result.is_err() {
1385 self.control_handle.shutdown();
1386 }
1387 self.drop_without_shutdown();
1388 _result
1389 }
1390
1391 pub fn send_no_shutdown_on_err(
1393 self,
1394 mut result: Result<&BlockInfo, i32>,
1395 ) -> Result<(), fidl::Error> {
1396 let _result = self.send_raw(result);
1397 self.drop_without_shutdown();
1398 _result
1399 }
1400
1401 fn send_raw(&self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1402 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetInfoResponse, i32>>(
1403 result.map(|info| (info,)),
1404 self.tx_id,
1405 0x58777a4a31cc9a47,
1406 fidl::encoding::DynamicFlags::empty(),
1407 )
1408 }
1409}
1410
1411#[must_use = "FIDL methods require a response to be sent"]
1412#[derive(Debug)]
1413pub struct BlockGetTypeGuidResponder {
1414 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1415 tx_id: u32,
1416}
1417
1418impl std::ops::Drop for BlockGetTypeGuidResponder {
1422 fn drop(&mut self) {
1423 self.control_handle.shutdown();
1424 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1426 }
1427}
1428
1429impl fidl::endpoints::Responder for BlockGetTypeGuidResponder {
1430 type ControlHandle = BlockControlHandle;
1431
1432 fn control_handle(&self) -> &BlockControlHandle {
1433 &self.control_handle
1434 }
1435
1436 fn drop_without_shutdown(mut self) {
1437 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1439 std::mem::forget(self);
1441 }
1442}
1443
1444impl BlockGetTypeGuidResponder {
1445 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1449 let _result = self.send_raw(status, guid);
1450 if _result.is_err() {
1451 self.control_handle.shutdown();
1452 }
1453 self.drop_without_shutdown();
1454 _result
1455 }
1456
1457 pub fn send_no_shutdown_on_err(
1459 self,
1460 mut status: i32,
1461 mut guid: Option<&Guid>,
1462 ) -> Result<(), fidl::Error> {
1463 let _result = self.send_raw(status, guid);
1464 self.drop_without_shutdown();
1465 _result
1466 }
1467
1468 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1469 self.control_handle.inner.send::<BlockGetTypeGuidResponse>(
1470 (status, guid),
1471 self.tx_id,
1472 0xefe4e41dafce4cc,
1473 fidl::encoding::DynamicFlags::empty(),
1474 )
1475 }
1476}
1477
1478#[must_use = "FIDL methods require a response to be sent"]
1479#[derive(Debug)]
1480pub struct BlockGetInstanceGuidResponder {
1481 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1482 tx_id: u32,
1483}
1484
1485impl std::ops::Drop for BlockGetInstanceGuidResponder {
1489 fn drop(&mut self) {
1490 self.control_handle.shutdown();
1491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1493 }
1494}
1495
1496impl fidl::endpoints::Responder for BlockGetInstanceGuidResponder {
1497 type ControlHandle = BlockControlHandle;
1498
1499 fn control_handle(&self) -> &BlockControlHandle {
1500 &self.control_handle
1501 }
1502
1503 fn drop_without_shutdown(mut self) {
1504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506 std::mem::forget(self);
1508 }
1509}
1510
1511impl BlockGetInstanceGuidResponder {
1512 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1516 let _result = self.send_raw(status, guid);
1517 if _result.is_err() {
1518 self.control_handle.shutdown();
1519 }
1520 self.drop_without_shutdown();
1521 _result
1522 }
1523
1524 pub fn send_no_shutdown_on_err(
1526 self,
1527 mut status: i32,
1528 mut guid: Option<&Guid>,
1529 ) -> Result<(), fidl::Error> {
1530 let _result = self.send_raw(status, guid);
1531 self.drop_without_shutdown();
1532 _result
1533 }
1534
1535 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1536 self.control_handle.inner.send::<BlockGetInstanceGuidResponse>(
1537 (status, guid),
1538 self.tx_id,
1539 0x2e85011aabeb87fb,
1540 fidl::encoding::DynamicFlags::empty(),
1541 )
1542 }
1543}
1544
1545#[must_use = "FIDL methods require a response to be sent"]
1546#[derive(Debug)]
1547pub struct BlockGetNameResponder {
1548 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1549 tx_id: u32,
1550}
1551
1552impl std::ops::Drop for BlockGetNameResponder {
1556 fn drop(&mut self) {
1557 self.control_handle.shutdown();
1558 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1560 }
1561}
1562
1563impl fidl::endpoints::Responder for BlockGetNameResponder {
1564 type ControlHandle = BlockControlHandle;
1565
1566 fn control_handle(&self) -> &BlockControlHandle {
1567 &self.control_handle
1568 }
1569
1570 fn drop_without_shutdown(mut self) {
1571 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1573 std::mem::forget(self);
1575 }
1576}
1577
1578impl BlockGetNameResponder {
1579 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1583 let _result = self.send_raw(status, name);
1584 if _result.is_err() {
1585 self.control_handle.shutdown();
1586 }
1587 self.drop_without_shutdown();
1588 _result
1589 }
1590
1591 pub fn send_no_shutdown_on_err(
1593 self,
1594 mut status: i32,
1595 mut name: Option<&str>,
1596 ) -> Result<(), fidl::Error> {
1597 let _result = self.send_raw(status, name);
1598 self.drop_without_shutdown();
1599 _result
1600 }
1601
1602 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1603 self.control_handle.inner.send::<BlockGetNameResponse>(
1604 (status, name),
1605 self.tx_id,
1606 0x630be18badedbb05,
1607 fidl::encoding::DynamicFlags::empty(),
1608 )
1609 }
1610}
1611
1612#[must_use = "FIDL methods require a response to be sent"]
1613#[derive(Debug)]
1614pub struct BlockGetMetadataResponder {
1615 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1616 tx_id: u32,
1617}
1618
1619impl std::ops::Drop for BlockGetMetadataResponder {
1623 fn drop(&mut self) {
1624 self.control_handle.shutdown();
1625 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1627 }
1628}
1629
1630impl fidl::endpoints::Responder for BlockGetMetadataResponder {
1631 type ControlHandle = BlockControlHandle;
1632
1633 fn control_handle(&self) -> &BlockControlHandle {
1634 &self.control_handle
1635 }
1636
1637 fn drop_without_shutdown(mut self) {
1638 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1640 std::mem::forget(self);
1642 }
1643}
1644
1645impl BlockGetMetadataResponder {
1646 pub fn send(
1650 self,
1651 mut result: Result<&BlockGetMetadataResponse, i32>,
1652 ) -> Result<(), fidl::Error> {
1653 let _result = self.send_raw(result);
1654 if _result.is_err() {
1655 self.control_handle.shutdown();
1656 }
1657 self.drop_without_shutdown();
1658 _result
1659 }
1660
1661 pub fn send_no_shutdown_on_err(
1663 self,
1664 mut result: Result<&BlockGetMetadataResponse, i32>,
1665 ) -> Result<(), fidl::Error> {
1666 let _result = self.send_raw(result);
1667 self.drop_without_shutdown();
1668 _result
1669 }
1670
1671 fn send_raw(
1672 &self,
1673 mut result: Result<&BlockGetMetadataResponse, i32>,
1674 ) -> Result<(), fidl::Error> {
1675 self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetMetadataResponse, i32>>(
1676 result,
1677 self.tx_id,
1678 0x2c76b02ef9382533,
1679 fidl::encoding::DynamicFlags::empty(),
1680 )
1681 }
1682}
1683
1684#[must_use = "FIDL methods require a response to be sent"]
1685#[derive(Debug)]
1686pub struct BlockQuerySlicesResponder {
1687 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1688 tx_id: u32,
1689}
1690
1691impl std::ops::Drop for BlockQuerySlicesResponder {
1695 fn drop(&mut self) {
1696 self.control_handle.shutdown();
1697 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1699 }
1700}
1701
1702impl fidl::endpoints::Responder for BlockQuerySlicesResponder {
1703 type ControlHandle = BlockControlHandle;
1704
1705 fn control_handle(&self) -> &BlockControlHandle {
1706 &self.control_handle
1707 }
1708
1709 fn drop_without_shutdown(mut self) {
1710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1712 std::mem::forget(self);
1714 }
1715}
1716
1717impl BlockQuerySlicesResponder {
1718 pub fn send(
1722 self,
1723 mut status: i32,
1724 mut response: &[VsliceRange; 16],
1725 mut response_count: u64,
1726 ) -> Result<(), fidl::Error> {
1727 let _result = self.send_raw(status, response, response_count);
1728 if _result.is_err() {
1729 self.control_handle.shutdown();
1730 }
1731 self.drop_without_shutdown();
1732 _result
1733 }
1734
1735 pub fn send_no_shutdown_on_err(
1737 self,
1738 mut status: i32,
1739 mut response: &[VsliceRange; 16],
1740 mut response_count: u64,
1741 ) -> Result<(), fidl::Error> {
1742 let _result = self.send_raw(status, response, response_count);
1743 self.drop_without_shutdown();
1744 _result
1745 }
1746
1747 fn send_raw(
1748 &self,
1749 mut status: i32,
1750 mut response: &[VsliceRange; 16],
1751 mut response_count: u64,
1752 ) -> Result<(), fidl::Error> {
1753 self.control_handle.inner.send::<BlockQuerySlicesResponse>(
1754 (status, response, response_count),
1755 self.tx_id,
1756 0x289240ac4fbaa190,
1757 fidl::encoding::DynamicFlags::empty(),
1758 )
1759 }
1760}
1761
1762#[must_use = "FIDL methods require a response to be sent"]
1763#[derive(Debug)]
1764pub struct BlockGetVolumeInfoResponder {
1765 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1766 tx_id: u32,
1767}
1768
1769impl std::ops::Drop for BlockGetVolumeInfoResponder {
1773 fn drop(&mut self) {
1774 self.control_handle.shutdown();
1775 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1777 }
1778}
1779
1780impl fidl::endpoints::Responder for BlockGetVolumeInfoResponder {
1781 type ControlHandle = BlockControlHandle;
1782
1783 fn control_handle(&self) -> &BlockControlHandle {
1784 &self.control_handle
1785 }
1786
1787 fn drop_without_shutdown(mut self) {
1788 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1790 std::mem::forget(self);
1792 }
1793}
1794
1795impl BlockGetVolumeInfoResponder {
1796 pub fn send(
1800 self,
1801 mut status: i32,
1802 mut manager: Option<&VolumeManagerInfo>,
1803 mut volume: Option<&VolumeInfo>,
1804 ) -> Result<(), fidl::Error> {
1805 let _result = self.send_raw(status, manager, volume);
1806 if _result.is_err() {
1807 self.control_handle.shutdown();
1808 }
1809 self.drop_without_shutdown();
1810 _result
1811 }
1812
1813 pub fn send_no_shutdown_on_err(
1815 self,
1816 mut status: i32,
1817 mut manager: Option<&VolumeManagerInfo>,
1818 mut volume: Option<&VolumeInfo>,
1819 ) -> Result<(), fidl::Error> {
1820 let _result = self.send_raw(status, manager, volume);
1821 self.drop_without_shutdown();
1822 _result
1823 }
1824
1825 fn send_raw(
1826 &self,
1827 mut status: i32,
1828 mut manager: Option<&VolumeManagerInfo>,
1829 mut volume: Option<&VolumeInfo>,
1830 ) -> Result<(), fidl::Error> {
1831 self.control_handle.inner.send::<BlockGetVolumeInfoResponse>(
1832 (status, manager, volume),
1833 self.tx_id,
1834 0x3a7dc69ea5d788d4,
1835 fidl::encoding::DynamicFlags::empty(),
1836 )
1837 }
1838}
1839
1840#[must_use = "FIDL methods require a response to be sent"]
1841#[derive(Debug)]
1842pub struct BlockExtendResponder {
1843 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1844 tx_id: u32,
1845}
1846
1847impl std::ops::Drop for BlockExtendResponder {
1851 fn drop(&mut self) {
1852 self.control_handle.shutdown();
1853 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1855 }
1856}
1857
1858impl fidl::endpoints::Responder for BlockExtendResponder {
1859 type ControlHandle = BlockControlHandle;
1860
1861 fn control_handle(&self) -> &BlockControlHandle {
1862 &self.control_handle
1863 }
1864
1865 fn drop_without_shutdown(mut self) {
1866 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1868 std::mem::forget(self);
1870 }
1871}
1872
1873impl BlockExtendResponder {
1874 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1878 let _result = self.send_raw(status);
1879 if _result.is_err() {
1880 self.control_handle.shutdown();
1881 }
1882 self.drop_without_shutdown();
1883 _result
1884 }
1885
1886 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1888 let _result = self.send_raw(status);
1889 self.drop_without_shutdown();
1890 _result
1891 }
1892
1893 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1894 self.control_handle.inner.send::<BlockExtendResponse>(
1895 (status,),
1896 self.tx_id,
1897 0x273fb2980ff24157,
1898 fidl::encoding::DynamicFlags::empty(),
1899 )
1900 }
1901}
1902
1903#[must_use = "FIDL methods require a response to be sent"]
1904#[derive(Debug)]
1905pub struct BlockShrinkResponder {
1906 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1907 tx_id: u32,
1908}
1909
1910impl std::ops::Drop for BlockShrinkResponder {
1914 fn drop(&mut self) {
1915 self.control_handle.shutdown();
1916 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1918 }
1919}
1920
1921impl fidl::endpoints::Responder for BlockShrinkResponder {
1922 type ControlHandle = BlockControlHandle;
1923
1924 fn control_handle(&self) -> &BlockControlHandle {
1925 &self.control_handle
1926 }
1927
1928 fn drop_without_shutdown(mut self) {
1929 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1931 std::mem::forget(self);
1933 }
1934}
1935
1936impl BlockShrinkResponder {
1937 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1941 let _result = self.send_raw(status);
1942 if _result.is_err() {
1943 self.control_handle.shutdown();
1944 }
1945 self.drop_without_shutdown();
1946 _result
1947 }
1948
1949 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1951 let _result = self.send_raw(status);
1952 self.drop_without_shutdown();
1953 _result
1954 }
1955
1956 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1957 self.control_handle.inner.send::<BlockShrinkResponse>(
1958 (status,),
1959 self.tx_id,
1960 0x73da6de865600a8b,
1961 fidl::encoding::DynamicFlags::empty(),
1962 )
1963 }
1964}
1965
1966#[must_use = "FIDL methods require a response to be sent"]
1967#[derive(Debug)]
1968pub struct BlockDestroyResponder {
1969 control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1970 tx_id: u32,
1971}
1972
1973impl std::ops::Drop for BlockDestroyResponder {
1977 fn drop(&mut self) {
1978 self.control_handle.shutdown();
1979 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1981 }
1982}
1983
1984impl fidl::endpoints::Responder for BlockDestroyResponder {
1985 type ControlHandle = BlockControlHandle;
1986
1987 fn control_handle(&self) -> &BlockControlHandle {
1988 &self.control_handle
1989 }
1990
1991 fn drop_without_shutdown(mut self) {
1992 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1994 std::mem::forget(self);
1996 }
1997}
1998
1999impl BlockDestroyResponder {
2000 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2004 let _result = self.send_raw(status);
2005 if _result.is_err() {
2006 self.control_handle.shutdown();
2007 }
2008 self.drop_without_shutdown();
2009 _result
2010 }
2011
2012 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2014 let _result = self.send_raw(status);
2015 self.drop_without_shutdown();
2016 _result
2017 }
2018
2019 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2020 self.control_handle.inner.send::<BlockDestroyResponse>(
2021 (status,),
2022 self.tx_id,
2023 0x5866ba764e05a68e,
2024 fidl::encoding::DynamicFlags::empty(),
2025 )
2026 }
2027}
2028
2029#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2030pub struct SessionMarker;
2031
2032impl fidl::endpoints::ProtocolMarker for SessionMarker {
2033 type Proxy = SessionProxy;
2034 type RequestStream = SessionRequestStream;
2035 #[cfg(target_os = "fuchsia")]
2036 type SynchronousProxy = SessionSynchronousProxy;
2037
2038 const DEBUG_NAME: &'static str = "(anonymous) Session";
2039}
2040pub type SessionGetFifoResult = Result<fidl::Fifo, i32>;
2041pub type SessionAttachVmoResult = Result<VmoId, i32>;
2042
2043pub trait SessionProxyInterface: Send + Sync {
2044 type CloseResponseFut: std::future::Future<
2045 Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
2046 > + Send;
2047 fn r#close(&self) -> Self::CloseResponseFut;
2048 type GetFifoResponseFut: std::future::Future<Output = Result<SessionGetFifoResult, fidl::Error>>
2049 + Send;
2050 fn r#get_fifo(&self) -> Self::GetFifoResponseFut;
2051 type AttachVmoResponseFut: std::future::Future<Output = Result<SessionAttachVmoResult, fidl::Error>>
2052 + Send;
2053 fn r#attach_vmo(&self, vmo: fidl::Vmo) -> Self::AttachVmoResponseFut;
2054}
2055#[derive(Debug)]
2056#[cfg(target_os = "fuchsia")]
2057pub struct SessionSynchronousProxy {
2058 client: fidl::client::sync::Client,
2059}
2060
2061#[cfg(target_os = "fuchsia")]
2062impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
2063 type Proxy = SessionProxy;
2064 type Protocol = SessionMarker;
2065
2066 fn from_channel(inner: fidl::Channel) -> Self {
2067 Self::new(inner)
2068 }
2069
2070 fn into_channel(self) -> fidl::Channel {
2071 self.client.into_channel()
2072 }
2073
2074 fn as_channel(&self) -> &fidl::Channel {
2075 self.client.as_channel()
2076 }
2077}
2078
2079#[cfg(target_os = "fuchsia")]
2080impl SessionSynchronousProxy {
2081 pub fn new(channel: fidl::Channel) -> Self {
2082 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2083 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2084 }
2085
2086 pub fn into_channel(self) -> fidl::Channel {
2087 self.client.into_channel()
2088 }
2089
2090 pub fn wait_for_event(
2093 &self,
2094 deadline: zx::MonotonicInstant,
2095 ) -> Result<SessionEvent, fidl::Error> {
2096 SessionEvent::decode(self.client.wait_for_event(deadline)?)
2097 }
2098
2099 pub fn r#close(
2110 &self,
2111 ___deadline: zx::MonotonicInstant,
2112 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2113 let _response = self.client.send_query::<
2114 fidl::encoding::EmptyPayload,
2115 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2116 >(
2117 (),
2118 0x5ac5d459ad7f657e,
2119 fidl::encoding::DynamicFlags::empty(),
2120 ___deadline,
2121 )?;
2122 Ok(_response.map(|x| x))
2123 }
2124
2125 pub fn r#get_fifo(
2127 &self,
2128 ___deadline: zx::MonotonicInstant,
2129 ) -> Result<SessionGetFifoResult, fidl::Error> {
2130 let _response = self.client.send_query::<
2131 fidl::encoding::EmptyPayload,
2132 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
2133 >(
2134 (),
2135 0x7a6c7610912aaa98,
2136 fidl::encoding::DynamicFlags::empty(),
2137 ___deadline,
2138 )?;
2139 Ok(_response.map(|x| x.fifo))
2140 }
2141
2142 pub fn r#attach_vmo(
2146 &self,
2147 mut vmo: fidl::Vmo,
2148 ___deadline: zx::MonotonicInstant,
2149 ) -> Result<SessionAttachVmoResult, fidl::Error> {
2150 let _response = self.client.send_query::<
2151 SessionAttachVmoRequest,
2152 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
2153 >(
2154 (vmo,),
2155 0x677a0f6fd1a370b2,
2156 fidl::encoding::DynamicFlags::empty(),
2157 ___deadline,
2158 )?;
2159 Ok(_response.map(|x| x.vmoid))
2160 }
2161}
2162
2163#[cfg(target_os = "fuchsia")]
2164impl From<SessionSynchronousProxy> for zx::NullableHandle {
2165 fn from(value: SessionSynchronousProxy) -> Self {
2166 value.into_channel().into()
2167 }
2168}
2169
2170#[cfg(target_os = "fuchsia")]
2171impl From<fidl::Channel> for SessionSynchronousProxy {
2172 fn from(value: fidl::Channel) -> Self {
2173 Self::new(value)
2174 }
2175}
2176
2177#[cfg(target_os = "fuchsia")]
2178impl fidl::endpoints::FromClient for SessionSynchronousProxy {
2179 type Protocol = SessionMarker;
2180
2181 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
2182 Self::new(value.into_channel())
2183 }
2184}
2185
2186#[derive(Debug, Clone)]
2187pub struct SessionProxy {
2188 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2189}
2190
2191impl fidl::endpoints::Proxy for SessionProxy {
2192 type Protocol = SessionMarker;
2193
2194 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2195 Self::new(inner)
2196 }
2197
2198 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2199 self.client.into_channel().map_err(|client| Self { client })
2200 }
2201
2202 fn as_channel(&self) -> &::fidl::AsyncChannel {
2203 self.client.as_channel()
2204 }
2205}
2206
2207impl SessionProxy {
2208 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2210 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2211 Self { client: fidl::client::Client::new(channel, protocol_name) }
2212 }
2213
2214 pub fn take_event_stream(&self) -> SessionEventStream {
2220 SessionEventStream { event_receiver: self.client.take_event_receiver() }
2221 }
2222
2223 pub fn r#close(
2234 &self,
2235 ) -> fidl::client::QueryResponseFut<
2236 fidl_fuchsia_unknown::CloseableCloseResult,
2237 fidl::encoding::DefaultFuchsiaResourceDialect,
2238 > {
2239 SessionProxyInterface::r#close(self)
2240 }
2241
2242 pub fn r#get_fifo(
2244 &self,
2245 ) -> fidl::client::QueryResponseFut<
2246 SessionGetFifoResult,
2247 fidl::encoding::DefaultFuchsiaResourceDialect,
2248 > {
2249 SessionProxyInterface::r#get_fifo(self)
2250 }
2251
2252 pub fn r#attach_vmo(
2256 &self,
2257 mut vmo: fidl::Vmo,
2258 ) -> fidl::client::QueryResponseFut<
2259 SessionAttachVmoResult,
2260 fidl::encoding::DefaultFuchsiaResourceDialect,
2261 > {
2262 SessionProxyInterface::r#attach_vmo(self, vmo)
2263 }
2264}
2265
2266impl SessionProxyInterface for SessionProxy {
2267 type CloseResponseFut = fidl::client::QueryResponseFut<
2268 fidl_fuchsia_unknown::CloseableCloseResult,
2269 fidl::encoding::DefaultFuchsiaResourceDialect,
2270 >;
2271 fn r#close(&self) -> Self::CloseResponseFut {
2272 fn _decode(
2273 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2274 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2275 let _response = fidl::client::decode_transaction_body::<
2276 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2277 fidl::encoding::DefaultFuchsiaResourceDialect,
2278 0x5ac5d459ad7f657e,
2279 >(_buf?)?;
2280 Ok(_response.map(|x| x))
2281 }
2282 self.client.send_query_and_decode::<
2283 fidl::encoding::EmptyPayload,
2284 fidl_fuchsia_unknown::CloseableCloseResult,
2285 >(
2286 (),
2287 0x5ac5d459ad7f657e,
2288 fidl::encoding::DynamicFlags::empty(),
2289 _decode,
2290 )
2291 }
2292
2293 type GetFifoResponseFut = fidl::client::QueryResponseFut<
2294 SessionGetFifoResult,
2295 fidl::encoding::DefaultFuchsiaResourceDialect,
2296 >;
2297 fn r#get_fifo(&self) -> Self::GetFifoResponseFut {
2298 fn _decode(
2299 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2300 ) -> Result<SessionGetFifoResult, fidl::Error> {
2301 let _response = fidl::client::decode_transaction_body::<
2302 fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
2303 fidl::encoding::DefaultFuchsiaResourceDialect,
2304 0x7a6c7610912aaa98,
2305 >(_buf?)?;
2306 Ok(_response.map(|x| x.fifo))
2307 }
2308 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionGetFifoResult>(
2309 (),
2310 0x7a6c7610912aaa98,
2311 fidl::encoding::DynamicFlags::empty(),
2312 _decode,
2313 )
2314 }
2315
2316 type AttachVmoResponseFut = fidl::client::QueryResponseFut<
2317 SessionAttachVmoResult,
2318 fidl::encoding::DefaultFuchsiaResourceDialect,
2319 >;
2320 fn r#attach_vmo(&self, mut vmo: fidl::Vmo) -> Self::AttachVmoResponseFut {
2321 fn _decode(
2322 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2323 ) -> Result<SessionAttachVmoResult, fidl::Error> {
2324 let _response = fidl::client::decode_transaction_body::<
2325 fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
2326 fidl::encoding::DefaultFuchsiaResourceDialect,
2327 0x677a0f6fd1a370b2,
2328 >(_buf?)?;
2329 Ok(_response.map(|x| x.vmoid))
2330 }
2331 self.client.send_query_and_decode::<SessionAttachVmoRequest, SessionAttachVmoResult>(
2332 (vmo,),
2333 0x677a0f6fd1a370b2,
2334 fidl::encoding::DynamicFlags::empty(),
2335 _decode,
2336 )
2337 }
2338}
2339
2340pub struct SessionEventStream {
2341 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2342}
2343
2344impl std::marker::Unpin for SessionEventStream {}
2345
2346impl futures::stream::FusedStream for SessionEventStream {
2347 fn is_terminated(&self) -> bool {
2348 self.event_receiver.is_terminated()
2349 }
2350}
2351
2352impl futures::Stream for SessionEventStream {
2353 type Item = Result<SessionEvent, fidl::Error>;
2354
2355 fn poll_next(
2356 mut self: std::pin::Pin<&mut Self>,
2357 cx: &mut std::task::Context<'_>,
2358 ) -> std::task::Poll<Option<Self::Item>> {
2359 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2360 &mut self.event_receiver,
2361 cx
2362 )?) {
2363 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
2364 None => std::task::Poll::Ready(None),
2365 }
2366 }
2367}
2368
2369#[derive(Debug)]
2370pub enum SessionEvent {}
2371
2372impl SessionEvent {
2373 fn decode(
2375 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2376 ) -> Result<SessionEvent, fidl::Error> {
2377 let (bytes, _handles) = buf.split_mut();
2378 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2379 debug_assert_eq!(tx_header.tx_id, 0);
2380 match tx_header.ordinal {
2381 _ => Err(fidl::Error::UnknownOrdinal {
2382 ordinal: tx_header.ordinal,
2383 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2384 }),
2385 }
2386 }
2387}
2388
2389pub struct SessionRequestStream {
2391 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2392 is_terminated: bool,
2393}
2394
2395impl std::marker::Unpin for SessionRequestStream {}
2396
2397impl futures::stream::FusedStream for SessionRequestStream {
2398 fn is_terminated(&self) -> bool {
2399 self.is_terminated
2400 }
2401}
2402
2403impl fidl::endpoints::RequestStream for SessionRequestStream {
2404 type Protocol = SessionMarker;
2405 type ControlHandle = SessionControlHandle;
2406
2407 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2408 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2409 }
2410
2411 fn control_handle(&self) -> Self::ControlHandle {
2412 SessionControlHandle { inner: self.inner.clone() }
2413 }
2414
2415 fn into_inner(
2416 self,
2417 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2418 {
2419 (self.inner, self.is_terminated)
2420 }
2421
2422 fn from_inner(
2423 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2424 is_terminated: bool,
2425 ) -> Self {
2426 Self { inner, is_terminated }
2427 }
2428}
2429
2430impl futures::Stream for SessionRequestStream {
2431 type Item = Result<SessionRequest, fidl::Error>;
2432
2433 fn poll_next(
2434 mut self: std::pin::Pin<&mut Self>,
2435 cx: &mut std::task::Context<'_>,
2436 ) -> std::task::Poll<Option<Self::Item>> {
2437 let this = &mut *self;
2438 if this.inner.check_shutdown(cx) {
2439 this.is_terminated = true;
2440 return std::task::Poll::Ready(None);
2441 }
2442 if this.is_terminated {
2443 panic!("polled SessionRequestStream after completion");
2444 }
2445 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2446 |bytes, handles| {
2447 match this.inner.channel().read_etc(cx, bytes, handles) {
2448 std::task::Poll::Ready(Ok(())) => {}
2449 std::task::Poll::Pending => return std::task::Poll::Pending,
2450 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2451 this.is_terminated = true;
2452 return std::task::Poll::Ready(None);
2453 }
2454 std::task::Poll::Ready(Err(e)) => {
2455 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2456 e.into(),
2457 ))));
2458 }
2459 }
2460
2461 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2463
2464 std::task::Poll::Ready(Some(match header.ordinal {
2465 0x5ac5d459ad7f657e => {
2466 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2467 let mut req = fidl::new_empty!(
2468 fidl::encoding::EmptyPayload,
2469 fidl::encoding::DefaultFuchsiaResourceDialect
2470 );
2471 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2472 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2473 Ok(SessionRequest::Close {
2474 responder: SessionCloseResponder {
2475 control_handle: std::mem::ManuallyDrop::new(control_handle),
2476 tx_id: header.tx_id,
2477 },
2478 })
2479 }
2480 0x7a6c7610912aaa98 => {
2481 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2482 let mut req = fidl::new_empty!(
2483 fidl::encoding::EmptyPayload,
2484 fidl::encoding::DefaultFuchsiaResourceDialect
2485 );
2486 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2487 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2488 Ok(SessionRequest::GetFifo {
2489 responder: SessionGetFifoResponder {
2490 control_handle: std::mem::ManuallyDrop::new(control_handle),
2491 tx_id: header.tx_id,
2492 },
2493 })
2494 }
2495 0x677a0f6fd1a370b2 => {
2496 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2497 let mut req = fidl::new_empty!(
2498 SessionAttachVmoRequest,
2499 fidl::encoding::DefaultFuchsiaResourceDialect
2500 );
2501 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionAttachVmoRequest>(&header, _body_bytes, handles, &mut req)?;
2502 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2503 Ok(SessionRequest::AttachVmo {
2504 vmo: req.vmo,
2505
2506 responder: SessionAttachVmoResponder {
2507 control_handle: std::mem::ManuallyDrop::new(control_handle),
2508 tx_id: header.tx_id,
2509 },
2510 })
2511 }
2512 _ => Err(fidl::Error::UnknownOrdinal {
2513 ordinal: header.ordinal,
2514 protocol_name:
2515 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2516 }),
2517 }))
2518 },
2519 )
2520 }
2521}
2522
2523#[derive(Debug)]
2533pub enum SessionRequest {
2534 Close { responder: SessionCloseResponder },
2545 GetFifo { responder: SessionGetFifoResponder },
2547 AttachVmo { vmo: fidl::Vmo, responder: SessionAttachVmoResponder },
2551}
2552
2553impl SessionRequest {
2554 #[allow(irrefutable_let_patterns)]
2555 pub fn into_close(self) -> Option<(SessionCloseResponder)> {
2556 if let SessionRequest::Close { responder } = self { Some((responder)) } else { None }
2557 }
2558
2559 #[allow(irrefutable_let_patterns)]
2560 pub fn into_get_fifo(self) -> Option<(SessionGetFifoResponder)> {
2561 if let SessionRequest::GetFifo { responder } = self { Some((responder)) } else { None }
2562 }
2563
2564 #[allow(irrefutable_let_patterns)]
2565 pub fn into_attach_vmo(self) -> Option<(fidl::Vmo, SessionAttachVmoResponder)> {
2566 if let SessionRequest::AttachVmo { vmo, responder } = self {
2567 Some((vmo, responder))
2568 } else {
2569 None
2570 }
2571 }
2572
2573 pub fn method_name(&self) -> &'static str {
2575 match *self {
2576 SessionRequest::Close { .. } => "close",
2577 SessionRequest::GetFifo { .. } => "get_fifo",
2578 SessionRequest::AttachVmo { .. } => "attach_vmo",
2579 }
2580 }
2581}
2582
2583#[derive(Debug, Clone)]
2584pub struct SessionControlHandle {
2585 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2586}
2587
2588impl fidl::endpoints::ControlHandle for SessionControlHandle {
2589 fn shutdown(&self) {
2590 self.inner.shutdown()
2591 }
2592
2593 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2594 self.inner.shutdown_with_epitaph(status)
2595 }
2596
2597 fn is_closed(&self) -> bool {
2598 self.inner.channel().is_closed()
2599 }
2600 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2601 self.inner.channel().on_closed()
2602 }
2603
2604 #[cfg(target_os = "fuchsia")]
2605 fn signal_peer(
2606 &self,
2607 clear_mask: zx::Signals,
2608 set_mask: zx::Signals,
2609 ) -> Result<(), zx_status::Status> {
2610 use fidl::Peered;
2611 self.inner.channel().signal_peer(clear_mask, set_mask)
2612 }
2613}
2614
2615impl SessionControlHandle {}
2616
2617#[must_use = "FIDL methods require a response to be sent"]
2618#[derive(Debug)]
2619pub struct SessionCloseResponder {
2620 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2621 tx_id: u32,
2622}
2623
2624impl std::ops::Drop for SessionCloseResponder {
2628 fn drop(&mut self) {
2629 self.control_handle.shutdown();
2630 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2632 }
2633}
2634
2635impl fidl::endpoints::Responder for SessionCloseResponder {
2636 type ControlHandle = SessionControlHandle;
2637
2638 fn control_handle(&self) -> &SessionControlHandle {
2639 &self.control_handle
2640 }
2641
2642 fn drop_without_shutdown(mut self) {
2643 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2645 std::mem::forget(self);
2647 }
2648}
2649
2650impl SessionCloseResponder {
2651 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2655 let _result = self.send_raw(result);
2656 if _result.is_err() {
2657 self.control_handle.shutdown();
2658 }
2659 self.drop_without_shutdown();
2660 _result
2661 }
2662
2663 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2665 let _result = self.send_raw(result);
2666 self.drop_without_shutdown();
2667 _result
2668 }
2669
2670 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2671 self.control_handle
2672 .inner
2673 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2674 result,
2675 self.tx_id,
2676 0x5ac5d459ad7f657e,
2677 fidl::encoding::DynamicFlags::empty(),
2678 )
2679 }
2680}
2681
2682#[must_use = "FIDL methods require a response to be sent"]
2683#[derive(Debug)]
2684pub struct SessionGetFifoResponder {
2685 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2686 tx_id: u32,
2687}
2688
2689impl std::ops::Drop for SessionGetFifoResponder {
2693 fn drop(&mut self) {
2694 self.control_handle.shutdown();
2695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2697 }
2698}
2699
2700impl fidl::endpoints::Responder for SessionGetFifoResponder {
2701 type ControlHandle = SessionControlHandle;
2702
2703 fn control_handle(&self) -> &SessionControlHandle {
2704 &self.control_handle
2705 }
2706
2707 fn drop_without_shutdown(mut self) {
2708 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2710 std::mem::forget(self);
2712 }
2713}
2714
2715impl SessionGetFifoResponder {
2716 pub fn send(self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
2720 let _result = self.send_raw(result);
2721 if _result.is_err() {
2722 self.control_handle.shutdown();
2723 }
2724 self.drop_without_shutdown();
2725 _result
2726 }
2727
2728 pub fn send_no_shutdown_on_err(
2730 self,
2731 mut result: Result<fidl::Fifo, i32>,
2732 ) -> Result<(), fidl::Error> {
2733 let _result = self.send_raw(result);
2734 self.drop_without_shutdown();
2735 _result
2736 }
2737
2738 fn send_raw(&self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
2739 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionGetFifoResponse, i32>>(
2740 result.map(|fifo| (fifo,)),
2741 self.tx_id,
2742 0x7a6c7610912aaa98,
2743 fidl::encoding::DynamicFlags::empty(),
2744 )
2745 }
2746}
2747
2748#[must_use = "FIDL methods require a response to be sent"]
2749#[derive(Debug)]
2750pub struct SessionAttachVmoResponder {
2751 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2752 tx_id: u32,
2753}
2754
2755impl std::ops::Drop for SessionAttachVmoResponder {
2759 fn drop(&mut self) {
2760 self.control_handle.shutdown();
2761 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2763 }
2764}
2765
2766impl fidl::endpoints::Responder for SessionAttachVmoResponder {
2767 type ControlHandle = SessionControlHandle;
2768
2769 fn control_handle(&self) -> &SessionControlHandle {
2770 &self.control_handle
2771 }
2772
2773 fn drop_without_shutdown(mut self) {
2774 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2776 std::mem::forget(self);
2778 }
2779}
2780
2781impl SessionAttachVmoResponder {
2782 pub fn send(self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
2786 let _result = self.send_raw(result);
2787 if _result.is_err() {
2788 self.control_handle.shutdown();
2789 }
2790 self.drop_without_shutdown();
2791 _result
2792 }
2793
2794 pub fn send_no_shutdown_on_err(
2796 self,
2797 mut result: Result<&VmoId, i32>,
2798 ) -> Result<(), fidl::Error> {
2799 let _result = self.send_raw(result);
2800 self.drop_without_shutdown();
2801 _result
2802 }
2803
2804 fn send_raw(&self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
2805 self.control_handle.inner.send::<fidl::encoding::ResultType<SessionAttachVmoResponse, i32>>(
2806 result.map(|vmoid| (vmoid,)),
2807 self.tx_id,
2808 0x677a0f6fd1a370b2,
2809 fidl::encoding::DynamicFlags::empty(),
2810 )
2811 }
2812}
2813
2814#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2815pub struct VolumeManagerMarker;
2816
2817impl fidl::endpoints::ProtocolMarker for VolumeManagerMarker {
2818 type Proxy = VolumeManagerProxy;
2819 type RequestStream = VolumeManagerRequestStream;
2820 #[cfg(target_os = "fuchsia")]
2821 type SynchronousProxy = VolumeManagerSynchronousProxy;
2822
2823 const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
2824}
2825pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
2826
2827pub trait VolumeManagerProxyInterface: Send + Sync {
2828 type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2829 fn r#allocate_partition(
2830 &self,
2831 slice_count: u64,
2832 type_: &Guid,
2833 instance: &Guid,
2834 name: &str,
2835 flags: u32,
2836 ) -> Self::AllocatePartitionResponseFut;
2837 type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
2838 + Send;
2839 fn r#get_info(&self) -> Self::GetInfoResponseFut;
2840 type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2841 fn r#activate(&self, old_guid: &Guid, new_guid: &Guid) -> Self::ActivateResponseFut;
2842 type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
2843 + Send;
2844 fn r#get_partition_limit(&self, guid: &Guid) -> Self::GetPartitionLimitResponseFut;
2845 type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2846 fn r#set_partition_limit(
2847 &self,
2848 guid: &Guid,
2849 slice_count: u64,
2850 ) -> Self::SetPartitionLimitResponseFut;
2851 type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
2852 + Send;
2853 fn r#set_partition_name(&self, guid: &Guid, name: &str) -> Self::SetPartitionNameResponseFut;
2854}
2855#[derive(Debug)]
2856#[cfg(target_os = "fuchsia")]
2857pub struct VolumeManagerSynchronousProxy {
2858 client: fidl::client::sync::Client,
2859}
2860
2861#[cfg(target_os = "fuchsia")]
2862impl fidl::endpoints::SynchronousProxy for VolumeManagerSynchronousProxy {
2863 type Proxy = VolumeManagerProxy;
2864 type Protocol = VolumeManagerMarker;
2865
2866 fn from_channel(inner: fidl::Channel) -> Self {
2867 Self::new(inner)
2868 }
2869
2870 fn into_channel(self) -> fidl::Channel {
2871 self.client.into_channel()
2872 }
2873
2874 fn as_channel(&self) -> &fidl::Channel {
2875 self.client.as_channel()
2876 }
2877}
2878
2879#[cfg(target_os = "fuchsia")]
2880impl VolumeManagerSynchronousProxy {
2881 pub fn new(channel: fidl::Channel) -> Self {
2882 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2883 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2884 }
2885
2886 pub fn into_channel(self) -> fidl::Channel {
2887 self.client.into_channel()
2888 }
2889
2890 pub fn wait_for_event(
2893 &self,
2894 deadline: zx::MonotonicInstant,
2895 ) -> Result<VolumeManagerEvent, fidl::Error> {
2896 VolumeManagerEvent::decode(self.client.wait_for_event(deadline)?)
2897 }
2898
2899 pub fn r#allocate_partition(
2906 &self,
2907 mut slice_count: u64,
2908 mut type_: &Guid,
2909 mut instance: &Guid,
2910 mut name: &str,
2911 mut flags: u32,
2912 ___deadline: zx::MonotonicInstant,
2913 ) -> Result<i32, fidl::Error> {
2914 let _response = self.client.send_query::<
2915 VolumeManagerAllocatePartitionRequest,
2916 VolumeManagerAllocatePartitionResponse,
2917 >(
2918 (slice_count, type_, instance, name, flags,),
2919 0x5db528bfc287b696,
2920 fidl::encoding::DynamicFlags::empty(),
2921 ___deadline,
2922 )?;
2923 Ok(_response.status)
2924 }
2925
2926 pub fn r#get_info(
2934 &self,
2935 ___deadline: zx::MonotonicInstant,
2936 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2937 let _response =
2938 self.client.send_query::<fidl::encoding::EmptyPayload, VolumeManagerGetInfoResponse>(
2939 (),
2940 0x2611214dcca5b064,
2941 fidl::encoding::DynamicFlags::empty(),
2942 ___deadline,
2943 )?;
2944 Ok((_response.status, _response.info))
2945 }
2946
2947 pub fn r#activate(
2963 &self,
2964 mut old_guid: &Guid,
2965 mut new_guid: &Guid,
2966 ___deadline: zx::MonotonicInstant,
2967 ) -> Result<i32, fidl::Error> {
2968 let _response =
2969 self.client.send_query::<VolumeManagerActivateRequest, VolumeManagerActivateResponse>(
2970 (old_guid, new_guid),
2971 0x182238d40c275be,
2972 fidl::encoding::DynamicFlags::empty(),
2973 ___deadline,
2974 )?;
2975 Ok(_response.status)
2976 }
2977
2978 pub fn r#get_partition_limit(
2988 &self,
2989 mut guid: &Guid,
2990 ___deadline: zx::MonotonicInstant,
2991 ) -> Result<(i32, u64), fidl::Error> {
2992 let _response = self.client.send_query::<
2993 VolumeManagerGetPartitionLimitRequest,
2994 VolumeManagerGetPartitionLimitResponse,
2995 >(
2996 (guid,),
2997 0x5bc9d21ea8bd52db,
2998 fidl::encoding::DynamicFlags::empty(),
2999 ___deadline,
3000 )?;
3001 Ok((_response.status, _response.slice_count))
3002 }
3003
3004 pub fn r#set_partition_limit(
3016 &self,
3017 mut guid: &Guid,
3018 mut slice_count: u64,
3019 ___deadline: zx::MonotonicInstant,
3020 ) -> Result<i32, fidl::Error> {
3021 let _response = self.client.send_query::<
3022 VolumeManagerSetPartitionLimitRequest,
3023 VolumeManagerSetPartitionLimitResponse,
3024 >(
3025 (guid, slice_count,),
3026 0x3a4903076534c093,
3027 fidl::encoding::DynamicFlags::empty(),
3028 ___deadline,
3029 )?;
3030 Ok(_response.status)
3031 }
3032
3033 pub fn r#set_partition_name(
3037 &self,
3038 mut guid: &Guid,
3039 mut name: &str,
3040 ___deadline: zx::MonotonicInstant,
3041 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
3042 let _response = self.client.send_query::<
3043 VolumeManagerSetPartitionNameRequest,
3044 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3045 >(
3046 (guid, name,),
3047 0x26afb07b9d70ff1a,
3048 fidl::encoding::DynamicFlags::empty(),
3049 ___deadline,
3050 )?;
3051 Ok(_response.map(|x| x))
3052 }
3053}
3054
3055#[cfg(target_os = "fuchsia")]
3056impl From<VolumeManagerSynchronousProxy> for zx::NullableHandle {
3057 fn from(value: VolumeManagerSynchronousProxy) -> Self {
3058 value.into_channel().into()
3059 }
3060}
3061
3062#[cfg(target_os = "fuchsia")]
3063impl From<fidl::Channel> for VolumeManagerSynchronousProxy {
3064 fn from(value: fidl::Channel) -> Self {
3065 Self::new(value)
3066 }
3067}
3068
3069#[cfg(target_os = "fuchsia")]
3070impl fidl::endpoints::FromClient for VolumeManagerSynchronousProxy {
3071 type Protocol = VolumeManagerMarker;
3072
3073 fn from_client(value: fidl::endpoints::ClientEnd<VolumeManagerMarker>) -> Self {
3074 Self::new(value.into_channel())
3075 }
3076}
3077
3078#[derive(Debug, Clone)]
3079pub struct VolumeManagerProxy {
3080 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3081}
3082
3083impl fidl::endpoints::Proxy for VolumeManagerProxy {
3084 type Protocol = VolumeManagerMarker;
3085
3086 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3087 Self::new(inner)
3088 }
3089
3090 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3091 self.client.into_channel().map_err(|client| Self { client })
3092 }
3093
3094 fn as_channel(&self) -> &::fidl::AsyncChannel {
3095 self.client.as_channel()
3096 }
3097}
3098
3099impl VolumeManagerProxy {
3100 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3102 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3103 Self { client: fidl::client::Client::new(channel, protocol_name) }
3104 }
3105
3106 pub fn take_event_stream(&self) -> VolumeManagerEventStream {
3112 VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
3113 }
3114
3115 pub fn r#allocate_partition(
3122 &self,
3123 mut slice_count: u64,
3124 mut type_: &Guid,
3125 mut instance: &Guid,
3126 mut name: &str,
3127 mut flags: u32,
3128 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3129 VolumeManagerProxyInterface::r#allocate_partition(
3130 self,
3131 slice_count,
3132 type_,
3133 instance,
3134 name,
3135 flags,
3136 )
3137 }
3138
3139 pub fn r#get_info(
3147 &self,
3148 ) -> fidl::client::QueryResponseFut<
3149 (i32, Option<Box<VolumeManagerInfo>>),
3150 fidl::encoding::DefaultFuchsiaResourceDialect,
3151 > {
3152 VolumeManagerProxyInterface::r#get_info(self)
3153 }
3154
3155 pub fn r#activate(
3171 &self,
3172 mut old_guid: &Guid,
3173 mut new_guid: &Guid,
3174 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3175 VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
3176 }
3177
3178 pub fn r#get_partition_limit(
3188 &self,
3189 mut guid: &Guid,
3190 ) -> fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
3191 {
3192 VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
3193 }
3194
3195 pub fn r#set_partition_limit(
3207 &self,
3208 mut guid: &Guid,
3209 mut slice_count: u64,
3210 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3211 VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
3212 }
3213
3214 pub fn r#set_partition_name(
3218 &self,
3219 mut guid: &Guid,
3220 mut name: &str,
3221 ) -> fidl::client::QueryResponseFut<
3222 VolumeManagerSetPartitionNameResult,
3223 fidl::encoding::DefaultFuchsiaResourceDialect,
3224 > {
3225 VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
3226 }
3227}
3228
3229impl VolumeManagerProxyInterface for VolumeManagerProxy {
3230 type AllocatePartitionResponseFut =
3231 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3232 fn r#allocate_partition(
3233 &self,
3234 mut slice_count: u64,
3235 mut type_: &Guid,
3236 mut instance: &Guid,
3237 mut name: &str,
3238 mut flags: u32,
3239 ) -> Self::AllocatePartitionResponseFut {
3240 fn _decode(
3241 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3242 ) -> Result<i32, fidl::Error> {
3243 let _response = fidl::client::decode_transaction_body::<
3244 VolumeManagerAllocatePartitionResponse,
3245 fidl::encoding::DefaultFuchsiaResourceDialect,
3246 0x5db528bfc287b696,
3247 >(_buf?)?;
3248 Ok(_response.status)
3249 }
3250 self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
3251 (slice_count, type_, instance, name, flags),
3252 0x5db528bfc287b696,
3253 fidl::encoding::DynamicFlags::empty(),
3254 _decode,
3255 )
3256 }
3257
3258 type GetInfoResponseFut = fidl::client::QueryResponseFut<
3259 (i32, Option<Box<VolumeManagerInfo>>),
3260 fidl::encoding::DefaultFuchsiaResourceDialect,
3261 >;
3262 fn r#get_info(&self) -> Self::GetInfoResponseFut {
3263 fn _decode(
3264 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3265 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
3266 let _response = fidl::client::decode_transaction_body::<
3267 VolumeManagerGetInfoResponse,
3268 fidl::encoding::DefaultFuchsiaResourceDialect,
3269 0x2611214dcca5b064,
3270 >(_buf?)?;
3271 Ok((_response.status, _response.info))
3272 }
3273 self.client.send_query_and_decode::<
3274 fidl::encoding::EmptyPayload,
3275 (i32, Option<Box<VolumeManagerInfo>>),
3276 >(
3277 (),
3278 0x2611214dcca5b064,
3279 fidl::encoding::DynamicFlags::empty(),
3280 _decode,
3281 )
3282 }
3283
3284 type ActivateResponseFut =
3285 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3286 fn r#activate(&self, mut old_guid: &Guid, mut new_guid: &Guid) -> Self::ActivateResponseFut {
3287 fn _decode(
3288 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3289 ) -> Result<i32, fidl::Error> {
3290 let _response = fidl::client::decode_transaction_body::<
3291 VolumeManagerActivateResponse,
3292 fidl::encoding::DefaultFuchsiaResourceDialect,
3293 0x182238d40c275be,
3294 >(_buf?)?;
3295 Ok(_response.status)
3296 }
3297 self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
3298 (old_guid, new_guid),
3299 0x182238d40c275be,
3300 fidl::encoding::DynamicFlags::empty(),
3301 _decode,
3302 )
3303 }
3304
3305 type GetPartitionLimitResponseFut =
3306 fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>;
3307 fn r#get_partition_limit(&self, mut guid: &Guid) -> Self::GetPartitionLimitResponseFut {
3308 fn _decode(
3309 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3310 ) -> Result<(i32, u64), fidl::Error> {
3311 let _response = fidl::client::decode_transaction_body::<
3312 VolumeManagerGetPartitionLimitResponse,
3313 fidl::encoding::DefaultFuchsiaResourceDialect,
3314 0x5bc9d21ea8bd52db,
3315 >(_buf?)?;
3316 Ok((_response.status, _response.slice_count))
3317 }
3318 self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
3319 (guid,),
3320 0x5bc9d21ea8bd52db,
3321 fidl::encoding::DynamicFlags::empty(),
3322 _decode,
3323 )
3324 }
3325
3326 type SetPartitionLimitResponseFut =
3327 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3328 fn r#set_partition_limit(
3329 &self,
3330 mut guid: &Guid,
3331 mut slice_count: u64,
3332 ) -> Self::SetPartitionLimitResponseFut {
3333 fn _decode(
3334 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3335 ) -> Result<i32, fidl::Error> {
3336 let _response = fidl::client::decode_transaction_body::<
3337 VolumeManagerSetPartitionLimitResponse,
3338 fidl::encoding::DefaultFuchsiaResourceDialect,
3339 0x3a4903076534c093,
3340 >(_buf?)?;
3341 Ok(_response.status)
3342 }
3343 self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
3344 (guid, slice_count),
3345 0x3a4903076534c093,
3346 fidl::encoding::DynamicFlags::empty(),
3347 _decode,
3348 )
3349 }
3350
3351 type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
3352 VolumeManagerSetPartitionNameResult,
3353 fidl::encoding::DefaultFuchsiaResourceDialect,
3354 >;
3355 fn r#set_partition_name(
3356 &self,
3357 mut guid: &Guid,
3358 mut name: &str,
3359 ) -> Self::SetPartitionNameResponseFut {
3360 fn _decode(
3361 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3362 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
3363 let _response = fidl::client::decode_transaction_body::<
3364 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3365 fidl::encoding::DefaultFuchsiaResourceDialect,
3366 0x26afb07b9d70ff1a,
3367 >(_buf?)?;
3368 Ok(_response.map(|x| x))
3369 }
3370 self.client.send_query_and_decode::<
3371 VolumeManagerSetPartitionNameRequest,
3372 VolumeManagerSetPartitionNameResult,
3373 >(
3374 (guid, name,),
3375 0x26afb07b9d70ff1a,
3376 fidl::encoding::DynamicFlags::empty(),
3377 _decode,
3378 )
3379 }
3380}
3381
3382pub struct VolumeManagerEventStream {
3383 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3384}
3385
3386impl std::marker::Unpin for VolumeManagerEventStream {}
3387
3388impl futures::stream::FusedStream for VolumeManagerEventStream {
3389 fn is_terminated(&self) -> bool {
3390 self.event_receiver.is_terminated()
3391 }
3392}
3393
3394impl futures::Stream for VolumeManagerEventStream {
3395 type Item = Result<VolumeManagerEvent, fidl::Error>;
3396
3397 fn poll_next(
3398 mut self: std::pin::Pin<&mut Self>,
3399 cx: &mut std::task::Context<'_>,
3400 ) -> std::task::Poll<Option<Self::Item>> {
3401 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3402 &mut self.event_receiver,
3403 cx
3404 )?) {
3405 Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
3406 None => std::task::Poll::Ready(None),
3407 }
3408 }
3409}
3410
3411#[derive(Debug)]
3412pub enum VolumeManagerEvent {}
3413
3414impl VolumeManagerEvent {
3415 fn decode(
3417 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3418 ) -> Result<VolumeManagerEvent, fidl::Error> {
3419 let (bytes, _handles) = buf.split_mut();
3420 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3421 debug_assert_eq!(tx_header.tx_id, 0);
3422 match tx_header.ordinal {
3423 _ => Err(fidl::Error::UnknownOrdinal {
3424 ordinal: tx_header.ordinal,
3425 protocol_name: <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3426 }),
3427 }
3428 }
3429}
3430
3431pub struct VolumeManagerRequestStream {
3433 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3434 is_terminated: bool,
3435}
3436
3437impl std::marker::Unpin for VolumeManagerRequestStream {}
3438
3439impl futures::stream::FusedStream for VolumeManagerRequestStream {
3440 fn is_terminated(&self) -> bool {
3441 self.is_terminated
3442 }
3443}
3444
3445impl fidl::endpoints::RequestStream for VolumeManagerRequestStream {
3446 type Protocol = VolumeManagerMarker;
3447 type ControlHandle = VolumeManagerControlHandle;
3448
3449 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3450 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3451 }
3452
3453 fn control_handle(&self) -> Self::ControlHandle {
3454 VolumeManagerControlHandle { inner: self.inner.clone() }
3455 }
3456
3457 fn into_inner(
3458 self,
3459 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3460 {
3461 (self.inner, self.is_terminated)
3462 }
3463
3464 fn from_inner(
3465 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3466 is_terminated: bool,
3467 ) -> Self {
3468 Self { inner, is_terminated }
3469 }
3470}
3471
3472impl futures::Stream for VolumeManagerRequestStream {
3473 type Item = Result<VolumeManagerRequest, fidl::Error>;
3474
3475 fn poll_next(
3476 mut self: std::pin::Pin<&mut Self>,
3477 cx: &mut std::task::Context<'_>,
3478 ) -> std::task::Poll<Option<Self::Item>> {
3479 let this = &mut *self;
3480 if this.inner.check_shutdown(cx) {
3481 this.is_terminated = true;
3482 return std::task::Poll::Ready(None);
3483 }
3484 if this.is_terminated {
3485 panic!("polled VolumeManagerRequestStream after completion");
3486 }
3487 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3488 |bytes, handles| {
3489 match this.inner.channel().read_etc(cx, bytes, handles) {
3490 std::task::Poll::Ready(Ok(())) => {}
3491 std::task::Poll::Pending => return std::task::Poll::Pending,
3492 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3493 this.is_terminated = true;
3494 return std::task::Poll::Ready(None);
3495 }
3496 std::task::Poll::Ready(Err(e)) => {
3497 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3498 e.into(),
3499 ))));
3500 }
3501 }
3502
3503 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3505
3506 std::task::Poll::Ready(Some(match header.ordinal {
3507 0x5db528bfc287b696 => {
3508 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3509 let mut req = fidl::new_empty!(
3510 VolumeManagerAllocatePartitionRequest,
3511 fidl::encoding::DefaultFuchsiaResourceDialect
3512 );
3513 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
3514 let control_handle =
3515 VolumeManagerControlHandle { inner: this.inner.clone() };
3516 Ok(VolumeManagerRequest::AllocatePartition {
3517 slice_count: req.slice_count,
3518 type_: req.type_,
3519 instance: req.instance,
3520 name: req.name,
3521 flags: req.flags,
3522
3523 responder: VolumeManagerAllocatePartitionResponder {
3524 control_handle: std::mem::ManuallyDrop::new(control_handle),
3525 tx_id: header.tx_id,
3526 },
3527 })
3528 }
3529 0x2611214dcca5b064 => {
3530 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3531 let mut req = fidl::new_empty!(
3532 fidl::encoding::EmptyPayload,
3533 fidl::encoding::DefaultFuchsiaResourceDialect
3534 );
3535 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3536 let control_handle =
3537 VolumeManagerControlHandle { inner: this.inner.clone() };
3538 Ok(VolumeManagerRequest::GetInfo {
3539 responder: VolumeManagerGetInfoResponder {
3540 control_handle: std::mem::ManuallyDrop::new(control_handle),
3541 tx_id: header.tx_id,
3542 },
3543 })
3544 }
3545 0x182238d40c275be => {
3546 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3547 let mut req = fidl::new_empty!(
3548 VolumeManagerActivateRequest,
3549 fidl::encoding::DefaultFuchsiaResourceDialect
3550 );
3551 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
3552 let control_handle =
3553 VolumeManagerControlHandle { inner: this.inner.clone() };
3554 Ok(VolumeManagerRequest::Activate {
3555 old_guid: req.old_guid,
3556 new_guid: req.new_guid,
3557
3558 responder: VolumeManagerActivateResponder {
3559 control_handle: std::mem::ManuallyDrop::new(control_handle),
3560 tx_id: header.tx_id,
3561 },
3562 })
3563 }
3564 0x5bc9d21ea8bd52db => {
3565 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3566 let mut req = fidl::new_empty!(
3567 VolumeManagerGetPartitionLimitRequest,
3568 fidl::encoding::DefaultFuchsiaResourceDialect
3569 );
3570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
3571 let control_handle =
3572 VolumeManagerControlHandle { inner: this.inner.clone() };
3573 Ok(VolumeManagerRequest::GetPartitionLimit {
3574 guid: req.guid,
3575
3576 responder: VolumeManagerGetPartitionLimitResponder {
3577 control_handle: std::mem::ManuallyDrop::new(control_handle),
3578 tx_id: header.tx_id,
3579 },
3580 })
3581 }
3582 0x3a4903076534c093 => {
3583 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3584 let mut req = fidl::new_empty!(
3585 VolumeManagerSetPartitionLimitRequest,
3586 fidl::encoding::DefaultFuchsiaResourceDialect
3587 );
3588 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
3589 let control_handle =
3590 VolumeManagerControlHandle { inner: this.inner.clone() };
3591 Ok(VolumeManagerRequest::SetPartitionLimit {
3592 guid: req.guid,
3593 slice_count: req.slice_count,
3594
3595 responder: VolumeManagerSetPartitionLimitResponder {
3596 control_handle: std::mem::ManuallyDrop::new(control_handle),
3597 tx_id: header.tx_id,
3598 },
3599 })
3600 }
3601 0x26afb07b9d70ff1a => {
3602 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3603 let mut req = fidl::new_empty!(
3604 VolumeManagerSetPartitionNameRequest,
3605 fidl::encoding::DefaultFuchsiaResourceDialect
3606 );
3607 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
3608 let control_handle =
3609 VolumeManagerControlHandle { inner: this.inner.clone() };
3610 Ok(VolumeManagerRequest::SetPartitionName {
3611 guid: req.guid,
3612 name: req.name,
3613
3614 responder: VolumeManagerSetPartitionNameResponder {
3615 control_handle: std::mem::ManuallyDrop::new(control_handle),
3616 tx_id: header.tx_id,
3617 },
3618 })
3619 }
3620 _ => Err(fidl::Error::UnknownOrdinal {
3621 ordinal: header.ordinal,
3622 protocol_name:
3623 <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3624 }),
3625 }))
3626 },
3627 )
3628 }
3629}
3630
3631#[derive(Debug)]
3633pub enum VolumeManagerRequest {
3634 AllocatePartition {
3641 slice_count: u64,
3642 type_: Guid,
3643 instance: Guid,
3644 name: String,
3645 flags: u32,
3646 responder: VolumeManagerAllocatePartitionResponder,
3647 },
3648 GetInfo { responder: VolumeManagerGetInfoResponder },
3656 Activate { old_guid: Guid, new_guid: Guid, responder: VolumeManagerActivateResponder },
3672 GetPartitionLimit { guid: Guid, responder: VolumeManagerGetPartitionLimitResponder },
3682 SetPartitionLimit {
3694 guid: Guid,
3695 slice_count: u64,
3696 responder: VolumeManagerSetPartitionLimitResponder,
3697 },
3698 SetPartitionName { guid: Guid, name: String, responder: VolumeManagerSetPartitionNameResponder },
3702}
3703
3704impl VolumeManagerRequest {
3705 #[allow(irrefutable_let_patterns)]
3706 pub fn into_allocate_partition(
3707 self,
3708 ) -> Option<(u64, Guid, Guid, String, u32, VolumeManagerAllocatePartitionResponder)> {
3709 if let VolumeManagerRequest::AllocatePartition {
3710 slice_count,
3711 type_,
3712 instance,
3713 name,
3714 flags,
3715 responder,
3716 } = self
3717 {
3718 Some((slice_count, type_, instance, name, flags, responder))
3719 } else {
3720 None
3721 }
3722 }
3723
3724 #[allow(irrefutable_let_patterns)]
3725 pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
3726 if let VolumeManagerRequest::GetInfo { responder } = self {
3727 Some((responder))
3728 } else {
3729 None
3730 }
3731 }
3732
3733 #[allow(irrefutable_let_patterns)]
3734 pub fn into_activate(self) -> Option<(Guid, Guid, VolumeManagerActivateResponder)> {
3735 if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
3736 Some((old_guid, new_guid, responder))
3737 } else {
3738 None
3739 }
3740 }
3741
3742 #[allow(irrefutable_let_patterns)]
3743 pub fn into_get_partition_limit(
3744 self,
3745 ) -> Option<(Guid, VolumeManagerGetPartitionLimitResponder)> {
3746 if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
3747 Some((guid, responder))
3748 } else {
3749 None
3750 }
3751 }
3752
3753 #[allow(irrefutable_let_patterns)]
3754 pub fn into_set_partition_limit(
3755 self,
3756 ) -> Option<(Guid, u64, VolumeManagerSetPartitionLimitResponder)> {
3757 if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
3758 Some((guid, slice_count, responder))
3759 } else {
3760 None
3761 }
3762 }
3763
3764 #[allow(irrefutable_let_patterns)]
3765 pub fn into_set_partition_name(
3766 self,
3767 ) -> Option<(Guid, String, VolumeManagerSetPartitionNameResponder)> {
3768 if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
3769 Some((guid, name, responder))
3770 } else {
3771 None
3772 }
3773 }
3774
3775 pub fn method_name(&self) -> &'static str {
3777 match *self {
3778 VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
3779 VolumeManagerRequest::GetInfo { .. } => "get_info",
3780 VolumeManagerRequest::Activate { .. } => "activate",
3781 VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
3782 VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
3783 VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
3784 }
3785 }
3786}
3787
3788#[derive(Debug, Clone)]
3789pub struct VolumeManagerControlHandle {
3790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3791}
3792
3793impl fidl::endpoints::ControlHandle for VolumeManagerControlHandle {
3794 fn shutdown(&self) {
3795 self.inner.shutdown()
3796 }
3797
3798 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3799 self.inner.shutdown_with_epitaph(status)
3800 }
3801
3802 fn is_closed(&self) -> bool {
3803 self.inner.channel().is_closed()
3804 }
3805 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3806 self.inner.channel().on_closed()
3807 }
3808
3809 #[cfg(target_os = "fuchsia")]
3810 fn signal_peer(
3811 &self,
3812 clear_mask: zx::Signals,
3813 set_mask: zx::Signals,
3814 ) -> Result<(), zx_status::Status> {
3815 use fidl::Peered;
3816 self.inner.channel().signal_peer(clear_mask, set_mask)
3817 }
3818}
3819
3820impl VolumeManagerControlHandle {}
3821
3822#[must_use = "FIDL methods require a response to be sent"]
3823#[derive(Debug)]
3824pub struct VolumeManagerAllocatePartitionResponder {
3825 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3826 tx_id: u32,
3827}
3828
3829impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
3833 fn drop(&mut self) {
3834 self.control_handle.shutdown();
3835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3837 }
3838}
3839
3840impl fidl::endpoints::Responder for VolumeManagerAllocatePartitionResponder {
3841 type ControlHandle = VolumeManagerControlHandle;
3842
3843 fn control_handle(&self) -> &VolumeManagerControlHandle {
3844 &self.control_handle
3845 }
3846
3847 fn drop_without_shutdown(mut self) {
3848 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3850 std::mem::forget(self);
3852 }
3853}
3854
3855impl VolumeManagerAllocatePartitionResponder {
3856 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3860 let _result = self.send_raw(status);
3861 if _result.is_err() {
3862 self.control_handle.shutdown();
3863 }
3864 self.drop_without_shutdown();
3865 _result
3866 }
3867
3868 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3870 let _result = self.send_raw(status);
3871 self.drop_without_shutdown();
3872 _result
3873 }
3874
3875 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3876 self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
3877 (status,),
3878 self.tx_id,
3879 0x5db528bfc287b696,
3880 fidl::encoding::DynamicFlags::empty(),
3881 )
3882 }
3883}
3884
3885#[must_use = "FIDL methods require a response to be sent"]
3886#[derive(Debug)]
3887pub struct VolumeManagerGetInfoResponder {
3888 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3889 tx_id: u32,
3890}
3891
3892impl std::ops::Drop for VolumeManagerGetInfoResponder {
3896 fn drop(&mut self) {
3897 self.control_handle.shutdown();
3898 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3900 }
3901}
3902
3903impl fidl::endpoints::Responder for VolumeManagerGetInfoResponder {
3904 type ControlHandle = VolumeManagerControlHandle;
3905
3906 fn control_handle(&self) -> &VolumeManagerControlHandle {
3907 &self.control_handle
3908 }
3909
3910 fn drop_without_shutdown(mut self) {
3911 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3913 std::mem::forget(self);
3915 }
3916}
3917
3918impl VolumeManagerGetInfoResponder {
3919 pub fn send(
3923 self,
3924 mut status: i32,
3925 mut info: Option<&VolumeManagerInfo>,
3926 ) -> Result<(), fidl::Error> {
3927 let _result = self.send_raw(status, info);
3928 if _result.is_err() {
3929 self.control_handle.shutdown();
3930 }
3931 self.drop_without_shutdown();
3932 _result
3933 }
3934
3935 pub fn send_no_shutdown_on_err(
3937 self,
3938 mut status: i32,
3939 mut info: Option<&VolumeManagerInfo>,
3940 ) -> Result<(), fidl::Error> {
3941 let _result = self.send_raw(status, info);
3942 self.drop_without_shutdown();
3943 _result
3944 }
3945
3946 fn send_raw(
3947 &self,
3948 mut status: i32,
3949 mut info: Option<&VolumeManagerInfo>,
3950 ) -> Result<(), fidl::Error> {
3951 self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
3952 (status, info),
3953 self.tx_id,
3954 0x2611214dcca5b064,
3955 fidl::encoding::DynamicFlags::empty(),
3956 )
3957 }
3958}
3959
3960#[must_use = "FIDL methods require a response to be sent"]
3961#[derive(Debug)]
3962pub struct VolumeManagerActivateResponder {
3963 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3964 tx_id: u32,
3965}
3966
3967impl std::ops::Drop for VolumeManagerActivateResponder {
3971 fn drop(&mut self) {
3972 self.control_handle.shutdown();
3973 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3975 }
3976}
3977
3978impl fidl::endpoints::Responder for VolumeManagerActivateResponder {
3979 type ControlHandle = VolumeManagerControlHandle;
3980
3981 fn control_handle(&self) -> &VolumeManagerControlHandle {
3982 &self.control_handle
3983 }
3984
3985 fn drop_without_shutdown(mut self) {
3986 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3988 std::mem::forget(self);
3990 }
3991}
3992
3993impl VolumeManagerActivateResponder {
3994 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3998 let _result = self.send_raw(status);
3999 if _result.is_err() {
4000 self.control_handle.shutdown();
4001 }
4002 self.drop_without_shutdown();
4003 _result
4004 }
4005
4006 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4008 let _result = self.send_raw(status);
4009 self.drop_without_shutdown();
4010 _result
4011 }
4012
4013 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4014 self.control_handle.inner.send::<VolumeManagerActivateResponse>(
4015 (status,),
4016 self.tx_id,
4017 0x182238d40c275be,
4018 fidl::encoding::DynamicFlags::empty(),
4019 )
4020 }
4021}
4022
4023#[must_use = "FIDL methods require a response to be sent"]
4024#[derive(Debug)]
4025pub struct VolumeManagerGetPartitionLimitResponder {
4026 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4027 tx_id: u32,
4028}
4029
4030impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
4034 fn drop(&mut self) {
4035 self.control_handle.shutdown();
4036 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4038 }
4039}
4040
4041impl fidl::endpoints::Responder for VolumeManagerGetPartitionLimitResponder {
4042 type ControlHandle = VolumeManagerControlHandle;
4043
4044 fn control_handle(&self) -> &VolumeManagerControlHandle {
4045 &self.control_handle
4046 }
4047
4048 fn drop_without_shutdown(mut self) {
4049 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4051 std::mem::forget(self);
4053 }
4054}
4055
4056impl VolumeManagerGetPartitionLimitResponder {
4057 pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
4061 let _result = self.send_raw(status, slice_count);
4062 if _result.is_err() {
4063 self.control_handle.shutdown();
4064 }
4065 self.drop_without_shutdown();
4066 _result
4067 }
4068
4069 pub fn send_no_shutdown_on_err(
4071 self,
4072 mut status: i32,
4073 mut slice_count: u64,
4074 ) -> Result<(), fidl::Error> {
4075 let _result = self.send_raw(status, slice_count);
4076 self.drop_without_shutdown();
4077 _result
4078 }
4079
4080 fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
4081 self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
4082 (status, slice_count),
4083 self.tx_id,
4084 0x5bc9d21ea8bd52db,
4085 fidl::encoding::DynamicFlags::empty(),
4086 )
4087 }
4088}
4089
4090#[must_use = "FIDL methods require a response to be sent"]
4091#[derive(Debug)]
4092pub struct VolumeManagerSetPartitionLimitResponder {
4093 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4094 tx_id: u32,
4095}
4096
4097impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
4101 fn drop(&mut self) {
4102 self.control_handle.shutdown();
4103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4105 }
4106}
4107
4108impl fidl::endpoints::Responder for VolumeManagerSetPartitionLimitResponder {
4109 type ControlHandle = VolumeManagerControlHandle;
4110
4111 fn control_handle(&self) -> &VolumeManagerControlHandle {
4112 &self.control_handle
4113 }
4114
4115 fn drop_without_shutdown(mut self) {
4116 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4118 std::mem::forget(self);
4120 }
4121}
4122
4123impl VolumeManagerSetPartitionLimitResponder {
4124 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4128 let _result = self.send_raw(status);
4129 if _result.is_err() {
4130 self.control_handle.shutdown();
4131 }
4132 self.drop_without_shutdown();
4133 _result
4134 }
4135
4136 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4138 let _result = self.send_raw(status);
4139 self.drop_without_shutdown();
4140 _result
4141 }
4142
4143 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4144 self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
4145 (status,),
4146 self.tx_id,
4147 0x3a4903076534c093,
4148 fidl::encoding::DynamicFlags::empty(),
4149 )
4150 }
4151}
4152
4153#[must_use = "FIDL methods require a response to be sent"]
4154#[derive(Debug)]
4155pub struct VolumeManagerSetPartitionNameResponder {
4156 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4157 tx_id: u32,
4158}
4159
4160impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
4164 fn drop(&mut self) {
4165 self.control_handle.shutdown();
4166 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4168 }
4169}
4170
4171impl fidl::endpoints::Responder for VolumeManagerSetPartitionNameResponder {
4172 type ControlHandle = VolumeManagerControlHandle;
4173
4174 fn control_handle(&self) -> &VolumeManagerControlHandle {
4175 &self.control_handle
4176 }
4177
4178 fn drop_without_shutdown(mut self) {
4179 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4181 std::mem::forget(self);
4183 }
4184}
4185
4186impl VolumeManagerSetPartitionNameResponder {
4187 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4191 let _result = self.send_raw(result);
4192 if _result.is_err() {
4193 self.control_handle.shutdown();
4194 }
4195 self.drop_without_shutdown();
4196 _result
4197 }
4198
4199 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4201 let _result = self.send_raw(result);
4202 self.drop_without_shutdown();
4203 _result
4204 }
4205
4206 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4207 self.control_handle
4208 .inner
4209 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4210 result,
4211 self.tx_id,
4212 0x26afb07b9d70ff1a,
4213 fidl::encoding::DynamicFlags::empty(),
4214 )
4215 }
4216}
4217
4218mod internal {
4219 use super::*;
4220
4221 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionRequest {
4222 type Borrowed<'a> = &'a mut Self;
4223 fn take_or_borrow<'a>(
4224 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4225 ) -> Self::Borrowed<'a> {
4226 value
4227 }
4228 }
4229
4230 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionRequest {
4231 type Owned = Self;
4232
4233 #[inline(always)]
4234 fn inline_align(_context: fidl::encoding::Context) -> usize {
4235 4
4236 }
4237
4238 #[inline(always)]
4239 fn inline_size(_context: fidl::encoding::Context) -> usize {
4240 4
4241 }
4242 }
4243
4244 unsafe impl
4245 fidl::encoding::Encode<
4246 BlockOpenSessionRequest,
4247 fidl::encoding::DefaultFuchsiaResourceDialect,
4248 > for &mut BlockOpenSessionRequest
4249 {
4250 #[inline]
4251 unsafe fn encode(
4252 self,
4253 encoder: &mut fidl::encoding::Encoder<
4254 '_,
4255 fidl::encoding::DefaultFuchsiaResourceDialect,
4256 >,
4257 offset: usize,
4258 _depth: fidl::encoding::Depth,
4259 ) -> fidl::Result<()> {
4260 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
4261 fidl::encoding::Encode::<BlockOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4263 (
4264 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
4265 ),
4266 encoder, offset, _depth
4267 )
4268 }
4269 }
4270 unsafe impl<
4271 T0: fidl::encoding::Encode<
4272 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4273 fidl::encoding::DefaultFuchsiaResourceDialect,
4274 >,
4275 >
4276 fidl::encoding::Encode<
4277 BlockOpenSessionRequest,
4278 fidl::encoding::DefaultFuchsiaResourceDialect,
4279 > for (T0,)
4280 {
4281 #[inline]
4282 unsafe fn encode(
4283 self,
4284 encoder: &mut fidl::encoding::Encoder<
4285 '_,
4286 fidl::encoding::DefaultFuchsiaResourceDialect,
4287 >,
4288 offset: usize,
4289 depth: fidl::encoding::Depth,
4290 ) -> fidl::Result<()> {
4291 encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
4292 self.0.encode(encoder, offset + 0, depth)?;
4296 Ok(())
4297 }
4298 }
4299
4300 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4301 for BlockOpenSessionRequest
4302 {
4303 #[inline(always)]
4304 fn new_empty() -> Self {
4305 Self {
4306 session: fidl::new_empty!(
4307 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4308 fidl::encoding::DefaultFuchsiaResourceDialect
4309 ),
4310 }
4311 }
4312
4313 #[inline]
4314 unsafe fn decode(
4315 &mut self,
4316 decoder: &mut fidl::encoding::Decoder<
4317 '_,
4318 fidl::encoding::DefaultFuchsiaResourceDialect,
4319 >,
4320 offset: usize,
4321 _depth: fidl::encoding::Depth,
4322 ) -> fidl::Result<()> {
4323 decoder.debug_check_bounds::<Self>(offset);
4324 fidl::decode!(
4326 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4327 fidl::encoding::DefaultFuchsiaResourceDialect,
4328 &mut self.session,
4329 decoder,
4330 offset + 0,
4331 _depth
4332 )?;
4333 Ok(())
4334 }
4335 }
4336
4337 impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionWithOffsetMapRequest {
4338 type Borrowed<'a> = &'a mut Self;
4339 fn take_or_borrow<'a>(
4340 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4341 ) -> Self::Borrowed<'a> {
4342 value
4343 }
4344 }
4345
4346 unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionWithOffsetMapRequest {
4347 type Owned = Self;
4348
4349 #[inline(always)]
4350 fn inline_align(_context: fidl::encoding::Context) -> usize {
4351 8
4352 }
4353
4354 #[inline(always)]
4355 fn inline_size(_context: fidl::encoding::Context) -> usize {
4356 32
4357 }
4358 }
4359
4360 unsafe impl
4361 fidl::encoding::Encode<
4362 BlockOpenSessionWithOffsetMapRequest,
4363 fidl::encoding::DefaultFuchsiaResourceDialect,
4364 > for &mut BlockOpenSessionWithOffsetMapRequest
4365 {
4366 #[inline]
4367 unsafe fn encode(
4368 self,
4369 encoder: &mut fidl::encoding::Encoder<
4370 '_,
4371 fidl::encoding::DefaultFuchsiaResourceDialect,
4372 >,
4373 offset: usize,
4374 _depth: fidl::encoding::Depth,
4375 ) -> fidl::Result<()> {
4376 encoder.debug_check_bounds::<BlockOpenSessionWithOffsetMapRequest>(offset);
4377 fidl::encoding::Encode::<BlockOpenSessionWithOffsetMapRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4379 (
4380 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
4381 <BlockOffsetMapping as fidl::encoding::ValueTypeMarker>::borrow(&self.mapping),
4382 ),
4383 encoder, offset, _depth
4384 )
4385 }
4386 }
4387 unsafe impl<
4388 T0: fidl::encoding::Encode<
4389 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4390 fidl::encoding::DefaultFuchsiaResourceDialect,
4391 >,
4392 T1: fidl::encoding::Encode<BlockOffsetMapping, fidl::encoding::DefaultFuchsiaResourceDialect>,
4393 >
4394 fidl::encoding::Encode<
4395 BlockOpenSessionWithOffsetMapRequest,
4396 fidl::encoding::DefaultFuchsiaResourceDialect,
4397 > for (T0, T1)
4398 {
4399 #[inline]
4400 unsafe fn encode(
4401 self,
4402 encoder: &mut fidl::encoding::Encoder<
4403 '_,
4404 fidl::encoding::DefaultFuchsiaResourceDialect,
4405 >,
4406 offset: usize,
4407 depth: fidl::encoding::Depth,
4408 ) -> fidl::Result<()> {
4409 encoder.debug_check_bounds::<BlockOpenSessionWithOffsetMapRequest>(offset);
4410 unsafe {
4413 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4414 (ptr as *mut u64).write_unaligned(0);
4415 }
4416 self.0.encode(encoder, offset + 0, depth)?;
4418 self.1.encode(encoder, offset + 8, depth)?;
4419 Ok(())
4420 }
4421 }
4422
4423 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4424 for BlockOpenSessionWithOffsetMapRequest
4425 {
4426 #[inline(always)]
4427 fn new_empty() -> Self {
4428 Self {
4429 session: fidl::new_empty!(
4430 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4431 fidl::encoding::DefaultFuchsiaResourceDialect
4432 ),
4433 mapping: fidl::new_empty!(
4434 BlockOffsetMapping,
4435 fidl::encoding::DefaultFuchsiaResourceDialect
4436 ),
4437 }
4438 }
4439
4440 #[inline]
4441 unsafe fn decode(
4442 &mut self,
4443 decoder: &mut fidl::encoding::Decoder<
4444 '_,
4445 fidl::encoding::DefaultFuchsiaResourceDialect,
4446 >,
4447 offset: usize,
4448 _depth: fidl::encoding::Depth,
4449 ) -> fidl::Result<()> {
4450 decoder.debug_check_bounds::<Self>(offset);
4451 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4453 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4454 let mask = 0xffffffff00000000u64;
4455 let maskedval = padval & mask;
4456 if maskedval != 0 {
4457 return Err(fidl::Error::NonZeroPadding {
4458 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4459 });
4460 }
4461 fidl::decode!(
4462 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
4463 fidl::encoding::DefaultFuchsiaResourceDialect,
4464 &mut self.session,
4465 decoder,
4466 offset + 0,
4467 _depth
4468 )?;
4469 fidl::decode!(
4470 BlockOffsetMapping,
4471 fidl::encoding::DefaultFuchsiaResourceDialect,
4472 &mut self.mapping,
4473 decoder,
4474 offset + 8,
4475 _depth
4476 )?;
4477 Ok(())
4478 }
4479 }
4480
4481 impl fidl::encoding::ResourceTypeMarker for SessionAttachVmoRequest {
4482 type Borrowed<'a> = &'a mut Self;
4483 fn take_or_borrow<'a>(
4484 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4485 ) -> Self::Borrowed<'a> {
4486 value
4487 }
4488 }
4489
4490 unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoRequest {
4491 type Owned = Self;
4492
4493 #[inline(always)]
4494 fn inline_align(_context: fidl::encoding::Context) -> usize {
4495 4
4496 }
4497
4498 #[inline(always)]
4499 fn inline_size(_context: fidl::encoding::Context) -> usize {
4500 4
4501 }
4502 }
4503
4504 unsafe impl
4505 fidl::encoding::Encode<
4506 SessionAttachVmoRequest,
4507 fidl::encoding::DefaultFuchsiaResourceDialect,
4508 > for &mut SessionAttachVmoRequest
4509 {
4510 #[inline]
4511 unsafe fn encode(
4512 self,
4513 encoder: &mut fidl::encoding::Encoder<
4514 '_,
4515 fidl::encoding::DefaultFuchsiaResourceDialect,
4516 >,
4517 offset: usize,
4518 _depth: fidl::encoding::Depth,
4519 ) -> fidl::Result<()> {
4520 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
4521 fidl::encoding::Encode::<
4523 SessionAttachVmoRequest,
4524 fidl::encoding::DefaultFuchsiaResourceDialect,
4525 >::encode(
4526 (<fidl::encoding::HandleType<
4527 fidl::Vmo,
4528 { fidl::ObjectType::VMO.into_raw() },
4529 2147483648,
4530 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4531 &mut self.vmo
4532 ),),
4533 encoder,
4534 offset,
4535 _depth,
4536 )
4537 }
4538 }
4539 unsafe impl<
4540 T0: fidl::encoding::Encode<
4541 fidl::encoding::HandleType<
4542 fidl::Vmo,
4543 { fidl::ObjectType::VMO.into_raw() },
4544 2147483648,
4545 >,
4546 fidl::encoding::DefaultFuchsiaResourceDialect,
4547 >,
4548 >
4549 fidl::encoding::Encode<
4550 SessionAttachVmoRequest,
4551 fidl::encoding::DefaultFuchsiaResourceDialect,
4552 > for (T0,)
4553 {
4554 #[inline]
4555 unsafe fn encode(
4556 self,
4557 encoder: &mut fidl::encoding::Encoder<
4558 '_,
4559 fidl::encoding::DefaultFuchsiaResourceDialect,
4560 >,
4561 offset: usize,
4562 depth: fidl::encoding::Depth,
4563 ) -> fidl::Result<()> {
4564 encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
4565 self.0.encode(encoder, offset + 0, depth)?;
4569 Ok(())
4570 }
4571 }
4572
4573 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4574 for SessionAttachVmoRequest
4575 {
4576 #[inline(always)]
4577 fn new_empty() -> Self {
4578 Self {
4579 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4580 }
4581 }
4582
4583 #[inline]
4584 unsafe fn decode(
4585 &mut self,
4586 decoder: &mut fidl::encoding::Decoder<
4587 '_,
4588 fidl::encoding::DefaultFuchsiaResourceDialect,
4589 >,
4590 offset: usize,
4591 _depth: fidl::encoding::Depth,
4592 ) -> fidl::Result<()> {
4593 decoder.debug_check_bounds::<Self>(offset);
4594 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
4596 Ok(())
4597 }
4598 }
4599
4600 impl fidl::encoding::ResourceTypeMarker for SessionGetFifoResponse {
4601 type Borrowed<'a> = &'a mut Self;
4602 fn take_or_borrow<'a>(
4603 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4604 ) -> Self::Borrowed<'a> {
4605 value
4606 }
4607 }
4608
4609 unsafe impl fidl::encoding::TypeMarker for SessionGetFifoResponse {
4610 type Owned = Self;
4611
4612 #[inline(always)]
4613 fn inline_align(_context: fidl::encoding::Context) -> usize {
4614 4
4615 }
4616
4617 #[inline(always)]
4618 fn inline_size(_context: fidl::encoding::Context) -> usize {
4619 4
4620 }
4621 }
4622
4623 unsafe impl
4624 fidl::encoding::Encode<
4625 SessionGetFifoResponse,
4626 fidl::encoding::DefaultFuchsiaResourceDialect,
4627 > for &mut SessionGetFifoResponse
4628 {
4629 #[inline]
4630 unsafe fn encode(
4631 self,
4632 encoder: &mut fidl::encoding::Encoder<
4633 '_,
4634 fidl::encoding::DefaultFuchsiaResourceDialect,
4635 >,
4636 offset: usize,
4637 _depth: fidl::encoding::Depth,
4638 ) -> fidl::Result<()> {
4639 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
4640 fidl::encoding::Encode::<
4642 SessionGetFifoResponse,
4643 fidl::encoding::DefaultFuchsiaResourceDialect,
4644 >::encode(
4645 (<fidl::encoding::HandleType<
4646 fidl::Fifo,
4647 { fidl::ObjectType::FIFO.into_raw() },
4648 2147483648,
4649 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4650 &mut self.fifo
4651 ),),
4652 encoder,
4653 offset,
4654 _depth,
4655 )
4656 }
4657 }
4658 unsafe impl<
4659 T0: fidl::encoding::Encode<
4660 fidl::encoding::HandleType<
4661 fidl::Fifo,
4662 { fidl::ObjectType::FIFO.into_raw() },
4663 2147483648,
4664 >,
4665 fidl::encoding::DefaultFuchsiaResourceDialect,
4666 >,
4667 >
4668 fidl::encoding::Encode<
4669 SessionGetFifoResponse,
4670 fidl::encoding::DefaultFuchsiaResourceDialect,
4671 > for (T0,)
4672 {
4673 #[inline]
4674 unsafe fn encode(
4675 self,
4676 encoder: &mut fidl::encoding::Encoder<
4677 '_,
4678 fidl::encoding::DefaultFuchsiaResourceDialect,
4679 >,
4680 offset: usize,
4681 depth: fidl::encoding::Depth,
4682 ) -> fidl::Result<()> {
4683 encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
4684 self.0.encode(encoder, offset + 0, depth)?;
4688 Ok(())
4689 }
4690 }
4691
4692 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4693 for SessionGetFifoResponse
4694 {
4695 #[inline(always)]
4696 fn new_empty() -> Self {
4697 Self {
4698 fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4699 }
4700 }
4701
4702 #[inline]
4703 unsafe fn decode(
4704 &mut self,
4705 decoder: &mut fidl::encoding::Decoder<
4706 '_,
4707 fidl::encoding::DefaultFuchsiaResourceDialect,
4708 >,
4709 offset: usize,
4710 _depth: fidl::encoding::Depth,
4711 ) -> fidl::Result<()> {
4712 decoder.debug_check_bounds::<Self>(offset);
4713 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fifo, decoder, offset + 0, _depth)?;
4715 Ok(())
4716 }
4717 }
4718}