1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_block_volume__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct VolumeMarker;
16
17impl fidl::endpoints::ProtocolMarker for VolumeMarker {
18 type Proxy = VolumeProxy;
19 type RequestStream = VolumeRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = VolumeSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.hardware.block.volume.Volume";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for VolumeMarker {}
26
27pub trait VolumeProxyInterface: Send + Sync {
28 type GetInfoResponseFut: std::future::Future<
29 Output = Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error>,
30 > + Send;
31 fn r#get_info(&self) -> Self::GetInfoResponseFut;
32 fn r#open_session(
33 &self,
34 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
35 ) -> Result<(), fidl::Error>;
36 fn r#open_session_with_offset_map(
37 &self,
38 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
39 mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
40 ) -> Result<(), fidl::Error>;
41 type GetTypeGuidResponseFut: std::future::Future<
42 Output = Result<
43 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
44 fidl::Error,
45 >,
46 > + Send;
47 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
48 type GetInstanceGuidResponseFut: std::future::Future<
49 Output = Result<
50 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
51 fidl::Error,
52 >,
53 > + Send;
54 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
55 type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
56 + Send;
57 fn r#get_name(&self) -> Self::GetNameResponseFut;
58 type GetMetadataResponseFut: std::future::Future<
59 Output = Result<
60 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
61 fidl::Error,
62 >,
63 > + Send;
64 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
65 type QuerySlicesResponseFut: std::future::Future<Output = Result<(i32, [VsliceRange; 16], u64), fidl::Error>>
66 + Send;
67 fn r#query_slices(&self, start_slices: &[u64]) -> Self::QuerySlicesResponseFut;
68 type GetVolumeInfoResponseFut: std::future::Future<
69 Output = Result<
70 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
71 fidl::Error,
72 >,
73 > + Send;
74 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut;
75 type ExtendResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
76 fn r#extend(&self, start_slice: u64, slice_count: u64) -> Self::ExtendResponseFut;
77 type ShrinkResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
78 fn r#shrink(&self, start_slice: u64, slice_count: u64) -> Self::ShrinkResponseFut;
79 type DestroyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
80 fn r#destroy(&self) -> Self::DestroyResponseFut;
81}
82#[derive(Debug)]
83#[cfg(target_os = "fuchsia")]
84pub struct VolumeSynchronousProxy {
85 client: fidl::client::sync::Client,
86}
87
88#[cfg(target_os = "fuchsia")]
89impl fidl::endpoints::SynchronousProxy for VolumeSynchronousProxy {
90 type Proxy = VolumeProxy;
91 type Protocol = VolumeMarker;
92
93 fn from_channel(inner: fidl::Channel) -> Self {
94 Self::new(inner)
95 }
96
97 fn into_channel(self) -> fidl::Channel {
98 self.client.into_channel()
99 }
100
101 fn as_channel(&self) -> &fidl::Channel {
102 self.client.as_channel()
103 }
104}
105
106#[cfg(target_os = "fuchsia")]
107impl VolumeSynchronousProxy {
108 pub fn new(channel: fidl::Channel) -> Self {
109 let protocol_name = <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
110 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
111 }
112
113 pub fn into_channel(self) -> fidl::Channel {
114 self.client.into_channel()
115 }
116
117 pub fn wait_for_event(
120 &self,
121 deadline: zx::MonotonicInstant,
122 ) -> Result<VolumeEvent, fidl::Error> {
123 VolumeEvent::decode(self.client.wait_for_event(deadline)?)
124 }
125
126 pub fn r#get_info(
128 &self,
129 ___deadline: zx::MonotonicInstant,
130 ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
131 let _response =
132 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
133 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
134 i32,
135 >>(
136 (),
137 0x79df1a5cdb6cc6a3,
138 fidl::encoding::DynamicFlags::empty(),
139 ___deadline,
140 )?;
141 Ok(_response.map(|x| x.info))
142 }
143
144 pub fn r#open_session(
146 &self,
147 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
148 ) -> Result<(), fidl::Error> {
149 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
150 (session,),
151 0x7241c68d17614a31,
152 fidl::encoding::DynamicFlags::empty(),
153 )
154 }
155
156 pub fn r#open_session_with_offset_map(
167 &self,
168 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
169 mut mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
170 ) -> Result<(), fidl::Error> {
171 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
172 (session, mapping),
173 0x7a8d3ba3d8bfa10f,
174 fidl::encoding::DynamicFlags::empty(),
175 )
176 }
177
178 pub fn r#get_type_guid(
181 &self,
182 ___deadline: zx::MonotonicInstant,
183 ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error> {
184 let _response = self.client.send_query::<
185 fidl::encoding::EmptyPayload,
186 fidl_fuchsia_hardware_block_partition::PartitionGetTypeGuidResponse,
187 >(
188 (),
189 0x111843d737a9b847,
190 fidl::encoding::DynamicFlags::empty(),
191 ___deadline,
192 )?;
193 Ok((_response.status, _response.guid))
194 }
195
196 pub fn r#get_instance_guid(
199 &self,
200 ___deadline: zx::MonotonicInstant,
201 ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error> {
202 let _response = self.client.send_query::<
203 fidl::encoding::EmptyPayload,
204 fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse,
205 >(
206 (),
207 0x14a5a573b275d435,
208 fidl::encoding::DynamicFlags::empty(),
209 ___deadline,
210 )?;
211 Ok((_response.status, _response.guid))
212 }
213
214 pub fn r#get_name(
217 &self,
218 ___deadline: zx::MonotonicInstant,
219 ) -> Result<(i32, Option<String>), fidl::Error> {
220 let _response = self.client.send_query::<
221 fidl::encoding::EmptyPayload,
222 fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse,
223 >(
224 (),
225 0x7e3c6f0b0937fc02,
226 fidl::encoding::DynamicFlags::empty(),
227 ___deadline,
228 )?;
229 Ok((_response.status, _response.name))
230 }
231
232 pub fn r#get_metadata(
236 &self,
237 ___deadline: zx::MonotonicInstant,
238 ) -> Result<fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult, fidl::Error>
239 {
240 let _response = self
241 .client
242 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
243 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
244 i32,
245 >>(
246 (), 0x42d1464c96c3f3ff, fidl::encoding::DynamicFlags::empty(), ___deadline
247 )?;
248 Ok(_response.map(|x| x))
249 }
250
251 pub fn r#query_slices(
254 &self,
255 mut start_slices: &[u64],
256 ___deadline: zx::MonotonicInstant,
257 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
258 let _response =
259 self.client.send_query::<VolumeQuerySlicesRequest, VolumeQuerySlicesResponse>(
260 (start_slices,),
261 0x589a96828a3e2aa1,
262 fidl::encoding::DynamicFlags::empty(),
263 ___deadline,
264 )?;
265 Ok((_response.status, _response.response, _response.response_count))
266 }
267
268 pub fn r#get_volume_info(
270 &self,
271 ___deadline: zx::MonotonicInstant,
272 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error> {
273 let _response =
274 self.client.send_query::<fidl::encoding::EmptyPayload, VolumeGetVolumeInfoResponse>(
275 (),
276 0x60417b6cf9e34c80,
277 fidl::encoding::DynamicFlags::empty(),
278 ___deadline,
279 )?;
280 Ok((_response.status, _response.manager, _response.volume))
281 }
282
283 pub fn r#extend(
289 &self,
290 mut start_slice: u64,
291 mut slice_count: u64,
292 ___deadline: zx::MonotonicInstant,
293 ) -> Result<i32, fidl::Error> {
294 let _response = self.client.send_query::<VolumeExtendRequest, VolumeExtendResponse>(
295 (start_slice, slice_count),
296 0xdddf872f5039d37,
297 fidl::encoding::DynamicFlags::empty(),
298 ___deadline,
299 )?;
300 Ok(_response.status)
301 }
302
303 pub fn r#shrink(
306 &self,
307 mut start_slice: u64,
308 mut slice_count: u64,
309 ___deadline: zx::MonotonicInstant,
310 ) -> Result<i32, fidl::Error> {
311 let _response = self.client.send_query::<VolumeShrinkRequest, VolumeShrinkResponse>(
312 (start_slice, slice_count),
313 0x27ab5ed4f6fdcd29,
314 fidl::encoding::DynamicFlags::empty(),
315 ___deadline,
316 )?;
317 Ok(_response.status)
318 }
319
320 pub fn r#destroy(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
323 let _response =
324 self.client.send_query::<fidl::encoding::EmptyPayload, VolumeDestroyResponse>(
325 (),
326 0x732bf4bea39b5e87,
327 fidl::encoding::DynamicFlags::empty(),
328 ___deadline,
329 )?;
330 Ok(_response.status)
331 }
332}
333
334#[cfg(target_os = "fuchsia")]
335impl From<VolumeSynchronousProxy> for zx::Handle {
336 fn from(value: VolumeSynchronousProxy) -> Self {
337 value.into_channel().into()
338 }
339}
340
341#[cfg(target_os = "fuchsia")]
342impl From<fidl::Channel> for VolumeSynchronousProxy {
343 fn from(value: fidl::Channel) -> Self {
344 Self::new(value)
345 }
346}
347
348#[cfg(target_os = "fuchsia")]
349impl fidl::endpoints::FromClient for VolumeSynchronousProxy {
350 type Protocol = VolumeMarker;
351
352 fn from_client(value: fidl::endpoints::ClientEnd<VolumeMarker>) -> Self {
353 Self::new(value.into_channel())
354 }
355}
356
357#[derive(Debug, Clone)]
358pub struct VolumeProxy {
359 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
360}
361
362impl fidl::endpoints::Proxy for VolumeProxy {
363 type Protocol = VolumeMarker;
364
365 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
366 Self::new(inner)
367 }
368
369 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
370 self.client.into_channel().map_err(|client| Self { client })
371 }
372
373 fn as_channel(&self) -> &::fidl::AsyncChannel {
374 self.client.as_channel()
375 }
376}
377
378impl VolumeProxy {
379 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
381 let protocol_name = <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
382 Self { client: fidl::client::Client::new(channel, protocol_name) }
383 }
384
385 pub fn take_event_stream(&self) -> VolumeEventStream {
391 VolumeEventStream { event_receiver: self.client.take_event_receiver() }
392 }
393
394 pub fn r#get_info(
396 &self,
397 ) -> fidl::client::QueryResponseFut<
398 fidl_fuchsia_hardware_block::BlockGetInfoResult,
399 fidl::encoding::DefaultFuchsiaResourceDialect,
400 > {
401 VolumeProxyInterface::r#get_info(self)
402 }
403
404 pub fn r#open_session(
406 &self,
407 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
408 ) -> Result<(), fidl::Error> {
409 VolumeProxyInterface::r#open_session(self, session)
410 }
411
412 pub fn r#open_session_with_offset_map(
423 &self,
424 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
425 mut mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
426 ) -> Result<(), fidl::Error> {
427 VolumeProxyInterface::r#open_session_with_offset_map(self, session, mapping)
428 }
429
430 pub fn r#get_type_guid(
433 &self,
434 ) -> fidl::client::QueryResponseFut<
435 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
436 fidl::encoding::DefaultFuchsiaResourceDialect,
437 > {
438 VolumeProxyInterface::r#get_type_guid(self)
439 }
440
441 pub fn r#get_instance_guid(
444 &self,
445 ) -> fidl::client::QueryResponseFut<
446 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
447 fidl::encoding::DefaultFuchsiaResourceDialect,
448 > {
449 VolumeProxyInterface::r#get_instance_guid(self)
450 }
451
452 pub fn r#get_name(
455 &self,
456 ) -> fidl::client::QueryResponseFut<
457 (i32, Option<String>),
458 fidl::encoding::DefaultFuchsiaResourceDialect,
459 > {
460 VolumeProxyInterface::r#get_name(self)
461 }
462
463 pub fn r#get_metadata(
467 &self,
468 ) -> fidl::client::QueryResponseFut<
469 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
470 fidl::encoding::DefaultFuchsiaResourceDialect,
471 > {
472 VolumeProxyInterface::r#get_metadata(self)
473 }
474
475 pub fn r#query_slices(
478 &self,
479 mut start_slices: &[u64],
480 ) -> fidl::client::QueryResponseFut<
481 (i32, [VsliceRange; 16], u64),
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 > {
484 VolumeProxyInterface::r#query_slices(self, start_slices)
485 }
486
487 pub fn r#get_volume_info(
489 &self,
490 ) -> fidl::client::QueryResponseFut<
491 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
492 fidl::encoding::DefaultFuchsiaResourceDialect,
493 > {
494 VolumeProxyInterface::r#get_volume_info(self)
495 }
496
497 pub fn r#extend(
503 &self,
504 mut start_slice: u64,
505 mut slice_count: u64,
506 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
507 VolumeProxyInterface::r#extend(self, start_slice, slice_count)
508 }
509
510 pub fn r#shrink(
513 &self,
514 mut start_slice: u64,
515 mut slice_count: u64,
516 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
517 VolumeProxyInterface::r#shrink(self, start_slice, slice_count)
518 }
519
520 pub fn r#destroy(
523 &self,
524 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
525 VolumeProxyInterface::r#destroy(self)
526 }
527}
528
529impl VolumeProxyInterface for VolumeProxy {
530 type GetInfoResponseFut = fidl::client::QueryResponseFut<
531 fidl_fuchsia_hardware_block::BlockGetInfoResult,
532 fidl::encoding::DefaultFuchsiaResourceDialect,
533 >;
534 fn r#get_info(&self) -> Self::GetInfoResponseFut {
535 fn _decode(
536 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
537 ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
538 let _response = fidl::client::decode_transaction_body::<
539 fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetInfoResponse, i32>,
540 fidl::encoding::DefaultFuchsiaResourceDialect,
541 0x79df1a5cdb6cc6a3,
542 >(_buf?)?;
543 Ok(_response.map(|x| x.info))
544 }
545 self.client.send_query_and_decode::<
546 fidl::encoding::EmptyPayload,
547 fidl_fuchsia_hardware_block::BlockGetInfoResult,
548 >(
549 (),
550 0x79df1a5cdb6cc6a3,
551 fidl::encoding::DynamicFlags::empty(),
552 _decode,
553 )
554 }
555
556 fn r#open_session(
557 &self,
558 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
559 ) -> Result<(), fidl::Error> {
560 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
561 (session,),
562 0x7241c68d17614a31,
563 fidl::encoding::DynamicFlags::empty(),
564 )
565 }
566
567 fn r#open_session_with_offset_map(
568 &self,
569 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
570 mut mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
571 ) -> Result<(), fidl::Error> {
572 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
573 (session, mapping),
574 0x7a8d3ba3d8bfa10f,
575 fidl::encoding::DynamicFlags::empty(),
576 )
577 }
578
579 type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
580 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
581 fidl::encoding::DefaultFuchsiaResourceDialect,
582 >;
583 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
584 fn _decode(
585 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
586 ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error>
587 {
588 let _response = fidl::client::decode_transaction_body::<
589 fidl_fuchsia_hardware_block_partition::PartitionGetTypeGuidResponse,
590 fidl::encoding::DefaultFuchsiaResourceDialect,
591 0x111843d737a9b847,
592 >(_buf?)?;
593 Ok((_response.status, _response.guid))
594 }
595 self.client.send_query_and_decode::<
596 fidl::encoding::EmptyPayload,
597 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
598 >(
599 (),
600 0x111843d737a9b847,
601 fidl::encoding::DynamicFlags::empty(),
602 _decode,
603 )
604 }
605
606 type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
607 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
608 fidl::encoding::DefaultFuchsiaResourceDialect,
609 >;
610 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
611 fn _decode(
612 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
613 ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error>
614 {
615 let _response = fidl::client::decode_transaction_body::<
616 fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse,
617 fidl::encoding::DefaultFuchsiaResourceDialect,
618 0x14a5a573b275d435,
619 >(_buf?)?;
620 Ok((_response.status, _response.guid))
621 }
622 self.client.send_query_and_decode::<
623 fidl::encoding::EmptyPayload,
624 (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
625 >(
626 (),
627 0x14a5a573b275d435,
628 fidl::encoding::DynamicFlags::empty(),
629 _decode,
630 )
631 }
632
633 type GetNameResponseFut = fidl::client::QueryResponseFut<
634 (i32, Option<String>),
635 fidl::encoding::DefaultFuchsiaResourceDialect,
636 >;
637 fn r#get_name(&self) -> Self::GetNameResponseFut {
638 fn _decode(
639 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
640 ) -> Result<(i32, Option<String>), fidl::Error> {
641 let _response = fidl::client::decode_transaction_body::<
642 fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse,
643 fidl::encoding::DefaultFuchsiaResourceDialect,
644 0x7e3c6f0b0937fc02,
645 >(_buf?)?;
646 Ok((_response.status, _response.name))
647 }
648 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
649 (),
650 0x7e3c6f0b0937fc02,
651 fidl::encoding::DynamicFlags::empty(),
652 _decode,
653 )
654 }
655
656 type GetMetadataResponseFut = fidl::client::QueryResponseFut<
657 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
658 fidl::encoding::DefaultFuchsiaResourceDialect,
659 >;
660 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
661 fn _decode(
662 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
663 ) -> Result<fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult, fidl::Error>
664 {
665 let _response = fidl::client::decode_transaction_body::<
666 fidl::encoding::ResultType<
667 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
668 i32,
669 >,
670 fidl::encoding::DefaultFuchsiaResourceDialect,
671 0x42d1464c96c3f3ff,
672 >(_buf?)?;
673 Ok(_response.map(|x| x))
674 }
675 self.client.send_query_and_decode::<
676 fidl::encoding::EmptyPayload,
677 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
678 >(
679 (),
680 0x42d1464c96c3f3ff,
681 fidl::encoding::DynamicFlags::empty(),
682 _decode,
683 )
684 }
685
686 type QuerySlicesResponseFut = fidl::client::QueryResponseFut<
687 (i32, [VsliceRange; 16], u64),
688 fidl::encoding::DefaultFuchsiaResourceDialect,
689 >;
690 fn r#query_slices(&self, mut start_slices: &[u64]) -> Self::QuerySlicesResponseFut {
691 fn _decode(
692 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
693 ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
694 let _response = fidl::client::decode_transaction_body::<
695 VolumeQuerySlicesResponse,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 0x589a96828a3e2aa1,
698 >(_buf?)?;
699 Ok((_response.status, _response.response, _response.response_count))
700 }
701 self.client
702 .send_query_and_decode::<VolumeQuerySlicesRequest, (i32, [VsliceRange; 16], u64)>(
703 (start_slices,),
704 0x589a96828a3e2aa1,
705 fidl::encoding::DynamicFlags::empty(),
706 _decode,
707 )
708 }
709
710 type GetVolumeInfoResponseFut = fidl::client::QueryResponseFut<
711 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
712 fidl::encoding::DefaultFuchsiaResourceDialect,
713 >;
714 fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut {
715 fn _decode(
716 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
717 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error>
718 {
719 let _response = fidl::client::decode_transaction_body::<
720 VolumeGetVolumeInfoResponse,
721 fidl::encoding::DefaultFuchsiaResourceDialect,
722 0x60417b6cf9e34c80,
723 >(_buf?)?;
724 Ok((_response.status, _response.manager, _response.volume))
725 }
726 self.client.send_query_and_decode::<
727 fidl::encoding::EmptyPayload,
728 (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
729 >(
730 (),
731 0x60417b6cf9e34c80,
732 fidl::encoding::DynamicFlags::empty(),
733 _decode,
734 )
735 }
736
737 type ExtendResponseFut =
738 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
739 fn r#extend(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ExtendResponseFut {
740 fn _decode(
741 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
742 ) -> Result<i32, fidl::Error> {
743 let _response = fidl::client::decode_transaction_body::<
744 VolumeExtendResponse,
745 fidl::encoding::DefaultFuchsiaResourceDialect,
746 0xdddf872f5039d37,
747 >(_buf?)?;
748 Ok(_response.status)
749 }
750 self.client.send_query_and_decode::<VolumeExtendRequest, i32>(
751 (start_slice, slice_count),
752 0xdddf872f5039d37,
753 fidl::encoding::DynamicFlags::empty(),
754 _decode,
755 )
756 }
757
758 type ShrinkResponseFut =
759 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
760 fn r#shrink(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ShrinkResponseFut {
761 fn _decode(
762 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
763 ) -> Result<i32, fidl::Error> {
764 let _response = fidl::client::decode_transaction_body::<
765 VolumeShrinkResponse,
766 fidl::encoding::DefaultFuchsiaResourceDialect,
767 0x27ab5ed4f6fdcd29,
768 >(_buf?)?;
769 Ok(_response.status)
770 }
771 self.client.send_query_and_decode::<VolumeShrinkRequest, i32>(
772 (start_slice, slice_count),
773 0x27ab5ed4f6fdcd29,
774 fidl::encoding::DynamicFlags::empty(),
775 _decode,
776 )
777 }
778
779 type DestroyResponseFut =
780 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
781 fn r#destroy(&self) -> Self::DestroyResponseFut {
782 fn _decode(
783 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
784 ) -> Result<i32, fidl::Error> {
785 let _response = fidl::client::decode_transaction_body::<
786 VolumeDestroyResponse,
787 fidl::encoding::DefaultFuchsiaResourceDialect,
788 0x732bf4bea39b5e87,
789 >(_buf?)?;
790 Ok(_response.status)
791 }
792 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
793 (),
794 0x732bf4bea39b5e87,
795 fidl::encoding::DynamicFlags::empty(),
796 _decode,
797 )
798 }
799}
800
801pub struct VolumeEventStream {
802 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
803}
804
805impl std::marker::Unpin for VolumeEventStream {}
806
807impl futures::stream::FusedStream for VolumeEventStream {
808 fn is_terminated(&self) -> bool {
809 self.event_receiver.is_terminated()
810 }
811}
812
813impl futures::Stream for VolumeEventStream {
814 type Item = Result<VolumeEvent, fidl::Error>;
815
816 fn poll_next(
817 mut self: std::pin::Pin<&mut Self>,
818 cx: &mut std::task::Context<'_>,
819 ) -> std::task::Poll<Option<Self::Item>> {
820 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
821 &mut self.event_receiver,
822 cx
823 )?) {
824 Some(buf) => std::task::Poll::Ready(Some(VolumeEvent::decode(buf))),
825 None => std::task::Poll::Ready(None),
826 }
827 }
828}
829
830#[derive(Debug)]
831pub enum VolumeEvent {}
832
833impl VolumeEvent {
834 fn decode(
836 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
837 ) -> Result<VolumeEvent, fidl::Error> {
838 let (bytes, _handles) = buf.split_mut();
839 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
840 debug_assert_eq!(tx_header.tx_id, 0);
841 match tx_header.ordinal {
842 _ => Err(fidl::Error::UnknownOrdinal {
843 ordinal: tx_header.ordinal,
844 protocol_name: <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
845 }),
846 }
847 }
848}
849
850pub struct VolumeRequestStream {
852 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
853 is_terminated: bool,
854}
855
856impl std::marker::Unpin for VolumeRequestStream {}
857
858impl futures::stream::FusedStream for VolumeRequestStream {
859 fn is_terminated(&self) -> bool {
860 self.is_terminated
861 }
862}
863
864impl fidl::endpoints::RequestStream for VolumeRequestStream {
865 type Protocol = VolumeMarker;
866 type ControlHandle = VolumeControlHandle;
867
868 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
869 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
870 }
871
872 fn control_handle(&self) -> Self::ControlHandle {
873 VolumeControlHandle { inner: self.inner.clone() }
874 }
875
876 fn into_inner(
877 self,
878 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
879 {
880 (self.inner, self.is_terminated)
881 }
882
883 fn from_inner(
884 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
885 is_terminated: bool,
886 ) -> Self {
887 Self { inner, is_terminated }
888 }
889}
890
891impl futures::Stream for VolumeRequestStream {
892 type Item = Result<VolumeRequest, fidl::Error>;
893
894 fn poll_next(
895 mut self: std::pin::Pin<&mut Self>,
896 cx: &mut std::task::Context<'_>,
897 ) -> std::task::Poll<Option<Self::Item>> {
898 let this = &mut *self;
899 if this.inner.check_shutdown(cx) {
900 this.is_terminated = true;
901 return std::task::Poll::Ready(None);
902 }
903 if this.is_terminated {
904 panic!("polled VolumeRequestStream after completion");
905 }
906 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
907 |bytes, handles| {
908 match this.inner.channel().read_etc(cx, bytes, handles) {
909 std::task::Poll::Ready(Ok(())) => {}
910 std::task::Poll::Pending => return std::task::Poll::Pending,
911 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
912 this.is_terminated = true;
913 return std::task::Poll::Ready(None);
914 }
915 std::task::Poll::Ready(Err(e)) => {
916 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
917 e.into(),
918 ))));
919 }
920 }
921
922 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
924
925 std::task::Poll::Ready(Some(match header.ordinal {
926 0x79df1a5cdb6cc6a3 => {
927 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
928 let mut req = fidl::new_empty!(
929 fidl::encoding::EmptyPayload,
930 fidl::encoding::DefaultFuchsiaResourceDialect
931 );
932 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
933 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
934 Ok(VolumeRequest::GetInfo {
935 responder: VolumeGetInfoResponder {
936 control_handle: std::mem::ManuallyDrop::new(control_handle),
937 tx_id: header.tx_id,
938 },
939 })
940 }
941 0x7241c68d17614a31 => {
942 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
943 let mut req = fidl::new_empty!(
944 fidl_fuchsia_hardware_block::BlockOpenSessionRequest,
945 fidl::encoding::DefaultFuchsiaResourceDialect
946 );
947 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
948 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
949 Ok(VolumeRequest::OpenSession { session: req.session, control_handle })
950 }
951 0x7a8d3ba3d8bfa10f => {
952 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
953 let mut req = fidl::new_empty!(
954 fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest,
955 fidl::encoding::DefaultFuchsiaResourceDialect
956 );
957 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
958 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
959 Ok(VolumeRequest::OpenSessionWithOffsetMap {
960 session: req.session,
961 mapping: req.mapping,
962
963 control_handle,
964 })
965 }
966 0x111843d737a9b847 => {
967 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
968 let mut req = fidl::new_empty!(
969 fidl::encoding::EmptyPayload,
970 fidl::encoding::DefaultFuchsiaResourceDialect
971 );
972 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
973 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
974 Ok(VolumeRequest::GetTypeGuid {
975 responder: VolumeGetTypeGuidResponder {
976 control_handle: std::mem::ManuallyDrop::new(control_handle),
977 tx_id: header.tx_id,
978 },
979 })
980 }
981 0x14a5a573b275d435 => {
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 = VolumeControlHandle { inner: this.inner.clone() };
989 Ok(VolumeRequest::GetInstanceGuid {
990 responder: VolumeGetInstanceGuidResponder {
991 control_handle: std::mem::ManuallyDrop::new(control_handle),
992 tx_id: header.tx_id,
993 },
994 })
995 }
996 0x7e3c6f0b0937fc02 => {
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 = VolumeControlHandle { inner: this.inner.clone() };
1004 Ok(VolumeRequest::GetName {
1005 responder: VolumeGetNameResponder {
1006 control_handle: std::mem::ManuallyDrop::new(control_handle),
1007 tx_id: header.tx_id,
1008 },
1009 })
1010 }
1011 0x42d1464c96c3f3ff => {
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 = VolumeControlHandle { inner: this.inner.clone() };
1019 Ok(VolumeRequest::GetMetadata {
1020 responder: VolumeGetMetadataResponder {
1021 control_handle: std::mem::ManuallyDrop::new(control_handle),
1022 tx_id: header.tx_id,
1023 },
1024 })
1025 }
1026 0x589a96828a3e2aa1 => {
1027 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1028 let mut req = fidl::new_empty!(
1029 VolumeQuerySlicesRequest,
1030 fidl::encoding::DefaultFuchsiaResourceDialect
1031 );
1032 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeQuerySlicesRequest>(&header, _body_bytes, handles, &mut req)?;
1033 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1034 Ok(VolumeRequest::QuerySlices {
1035 start_slices: req.start_slices,
1036
1037 responder: VolumeQuerySlicesResponder {
1038 control_handle: std::mem::ManuallyDrop::new(control_handle),
1039 tx_id: header.tx_id,
1040 },
1041 })
1042 }
1043 0x60417b6cf9e34c80 => {
1044 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1045 let mut req = fidl::new_empty!(
1046 fidl::encoding::EmptyPayload,
1047 fidl::encoding::DefaultFuchsiaResourceDialect
1048 );
1049 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1050 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1051 Ok(VolumeRequest::GetVolumeInfo {
1052 responder: VolumeGetVolumeInfoResponder {
1053 control_handle: std::mem::ManuallyDrop::new(control_handle),
1054 tx_id: header.tx_id,
1055 },
1056 })
1057 }
1058 0xdddf872f5039d37 => {
1059 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1060 let mut req = fidl::new_empty!(
1061 VolumeExtendRequest,
1062 fidl::encoding::DefaultFuchsiaResourceDialect
1063 );
1064 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeExtendRequest>(&header, _body_bytes, handles, &mut req)?;
1065 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1066 Ok(VolumeRequest::Extend {
1067 start_slice: req.start_slice,
1068 slice_count: req.slice_count,
1069
1070 responder: VolumeExtendResponder {
1071 control_handle: std::mem::ManuallyDrop::new(control_handle),
1072 tx_id: header.tx_id,
1073 },
1074 })
1075 }
1076 0x27ab5ed4f6fdcd29 => {
1077 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1078 let mut req = fidl::new_empty!(
1079 VolumeShrinkRequest,
1080 fidl::encoding::DefaultFuchsiaResourceDialect
1081 );
1082 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeShrinkRequest>(&header, _body_bytes, handles, &mut req)?;
1083 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1084 Ok(VolumeRequest::Shrink {
1085 start_slice: req.start_slice,
1086 slice_count: req.slice_count,
1087
1088 responder: VolumeShrinkResponder {
1089 control_handle: std::mem::ManuallyDrop::new(control_handle),
1090 tx_id: header.tx_id,
1091 },
1092 })
1093 }
1094 0x732bf4bea39b5e87 => {
1095 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1096 let mut req = fidl::new_empty!(
1097 fidl::encoding::EmptyPayload,
1098 fidl::encoding::DefaultFuchsiaResourceDialect
1099 );
1100 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1101 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1102 Ok(VolumeRequest::Destroy {
1103 responder: VolumeDestroyResponder {
1104 control_handle: std::mem::ManuallyDrop::new(control_handle),
1105 tx_id: header.tx_id,
1106 },
1107 })
1108 }
1109 _ => Err(fidl::Error::UnknownOrdinal {
1110 ordinal: header.ordinal,
1111 protocol_name:
1112 <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1113 }),
1114 }))
1115 },
1116 )
1117 }
1118}
1119
1120#[derive(Debug)]
1122pub enum VolumeRequest {
1123 GetInfo { responder: VolumeGetInfoResponder },
1125 OpenSession {
1127 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1128 control_handle: VolumeControlHandle,
1129 },
1130 OpenSessionWithOffsetMap {
1141 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1142 mapping: fidl_fuchsia_hardware_block::BlockOffsetMapping,
1143 control_handle: VolumeControlHandle,
1144 },
1145 GetTypeGuid { responder: VolumeGetTypeGuidResponder },
1148 GetInstanceGuid { responder: VolumeGetInstanceGuidResponder },
1151 GetName { responder: VolumeGetNameResponder },
1154 GetMetadata { responder: VolumeGetMetadataResponder },
1158 QuerySlices { start_slices: Vec<u64>, responder: VolumeQuerySlicesResponder },
1161 GetVolumeInfo { responder: VolumeGetVolumeInfoResponder },
1163 Extend { start_slice: u64, slice_count: u64, responder: VolumeExtendResponder },
1169 Shrink { start_slice: u64, slice_count: u64, responder: VolumeShrinkResponder },
1172 Destroy { responder: VolumeDestroyResponder },
1175}
1176
1177impl VolumeRequest {
1178 #[allow(irrefutable_let_patterns)]
1179 pub fn into_get_info(self) -> Option<(VolumeGetInfoResponder)> {
1180 if let VolumeRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1181 }
1182
1183 #[allow(irrefutable_let_patterns)]
1184 pub fn into_open_session(
1185 self,
1186 ) -> Option<(
1187 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1188 VolumeControlHandle,
1189 )> {
1190 if let VolumeRequest::OpenSession { session, control_handle } = self {
1191 Some((session, control_handle))
1192 } else {
1193 None
1194 }
1195 }
1196
1197 #[allow(irrefutable_let_patterns)]
1198 pub fn into_open_session_with_offset_map(
1199 self,
1200 ) -> Option<(
1201 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1202 fidl_fuchsia_hardware_block::BlockOffsetMapping,
1203 VolumeControlHandle,
1204 )> {
1205 if let VolumeRequest::OpenSessionWithOffsetMap { session, mapping, control_handle } = self {
1206 Some((session, mapping, control_handle))
1207 } else {
1208 None
1209 }
1210 }
1211
1212 #[allow(irrefutable_let_patterns)]
1213 pub fn into_get_type_guid(self) -> Option<(VolumeGetTypeGuidResponder)> {
1214 if let VolumeRequest::GetTypeGuid { responder } = self { Some((responder)) } else { None }
1215 }
1216
1217 #[allow(irrefutable_let_patterns)]
1218 pub fn into_get_instance_guid(self) -> Option<(VolumeGetInstanceGuidResponder)> {
1219 if let VolumeRequest::GetInstanceGuid { responder } = self {
1220 Some((responder))
1221 } else {
1222 None
1223 }
1224 }
1225
1226 #[allow(irrefutable_let_patterns)]
1227 pub fn into_get_name(self) -> Option<(VolumeGetNameResponder)> {
1228 if let VolumeRequest::GetName { responder } = self { Some((responder)) } else { None }
1229 }
1230
1231 #[allow(irrefutable_let_patterns)]
1232 pub fn into_get_metadata(self) -> Option<(VolumeGetMetadataResponder)> {
1233 if let VolumeRequest::GetMetadata { responder } = self { Some((responder)) } else { None }
1234 }
1235
1236 #[allow(irrefutable_let_patterns)]
1237 pub fn into_query_slices(self) -> Option<(Vec<u64>, VolumeQuerySlicesResponder)> {
1238 if let VolumeRequest::QuerySlices { start_slices, responder } = self {
1239 Some((start_slices, responder))
1240 } else {
1241 None
1242 }
1243 }
1244
1245 #[allow(irrefutable_let_patterns)]
1246 pub fn into_get_volume_info(self) -> Option<(VolumeGetVolumeInfoResponder)> {
1247 if let VolumeRequest::GetVolumeInfo { responder } = self { Some((responder)) } else { None }
1248 }
1249
1250 #[allow(irrefutable_let_patterns)]
1251 pub fn into_extend(self) -> Option<(u64, u64, VolumeExtendResponder)> {
1252 if let VolumeRequest::Extend { start_slice, slice_count, responder } = self {
1253 Some((start_slice, slice_count, responder))
1254 } else {
1255 None
1256 }
1257 }
1258
1259 #[allow(irrefutable_let_patterns)]
1260 pub fn into_shrink(self) -> Option<(u64, u64, VolumeShrinkResponder)> {
1261 if let VolumeRequest::Shrink { start_slice, slice_count, responder } = self {
1262 Some((start_slice, slice_count, responder))
1263 } else {
1264 None
1265 }
1266 }
1267
1268 #[allow(irrefutable_let_patterns)]
1269 pub fn into_destroy(self) -> Option<(VolumeDestroyResponder)> {
1270 if let VolumeRequest::Destroy { responder } = self { Some((responder)) } else { None }
1271 }
1272
1273 pub fn method_name(&self) -> &'static str {
1275 match *self {
1276 VolumeRequest::GetInfo { .. } => "get_info",
1277 VolumeRequest::OpenSession { .. } => "open_session",
1278 VolumeRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
1279 VolumeRequest::GetTypeGuid { .. } => "get_type_guid",
1280 VolumeRequest::GetInstanceGuid { .. } => "get_instance_guid",
1281 VolumeRequest::GetName { .. } => "get_name",
1282 VolumeRequest::GetMetadata { .. } => "get_metadata",
1283 VolumeRequest::QuerySlices { .. } => "query_slices",
1284 VolumeRequest::GetVolumeInfo { .. } => "get_volume_info",
1285 VolumeRequest::Extend { .. } => "extend",
1286 VolumeRequest::Shrink { .. } => "shrink",
1287 VolumeRequest::Destroy { .. } => "destroy",
1288 }
1289 }
1290}
1291
1292#[derive(Debug, Clone)]
1293pub struct VolumeControlHandle {
1294 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1295}
1296
1297impl fidl::endpoints::ControlHandle for VolumeControlHandle {
1298 fn shutdown(&self) {
1299 self.inner.shutdown()
1300 }
1301 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1302 self.inner.shutdown_with_epitaph(status)
1303 }
1304
1305 fn is_closed(&self) -> bool {
1306 self.inner.channel().is_closed()
1307 }
1308 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1309 self.inner.channel().on_closed()
1310 }
1311
1312 #[cfg(target_os = "fuchsia")]
1313 fn signal_peer(
1314 &self,
1315 clear_mask: zx::Signals,
1316 set_mask: zx::Signals,
1317 ) -> Result<(), zx_status::Status> {
1318 use fidl::Peered;
1319 self.inner.channel().signal_peer(clear_mask, set_mask)
1320 }
1321}
1322
1323impl VolumeControlHandle {}
1324
1325#[must_use = "FIDL methods require a response to be sent"]
1326#[derive(Debug)]
1327pub struct VolumeGetInfoResponder {
1328 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1329 tx_id: u32,
1330}
1331
1332impl std::ops::Drop for VolumeGetInfoResponder {
1336 fn drop(&mut self) {
1337 self.control_handle.shutdown();
1338 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1340 }
1341}
1342
1343impl fidl::endpoints::Responder for VolumeGetInfoResponder {
1344 type ControlHandle = VolumeControlHandle;
1345
1346 fn control_handle(&self) -> &VolumeControlHandle {
1347 &self.control_handle
1348 }
1349
1350 fn drop_without_shutdown(mut self) {
1351 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1353 std::mem::forget(self);
1355 }
1356}
1357
1358impl VolumeGetInfoResponder {
1359 pub fn send(
1363 self,
1364 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1365 ) -> Result<(), fidl::Error> {
1366 let _result = self.send_raw(result);
1367 if _result.is_err() {
1368 self.control_handle.shutdown();
1369 }
1370 self.drop_without_shutdown();
1371 _result
1372 }
1373
1374 pub fn send_no_shutdown_on_err(
1376 self,
1377 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1378 ) -> Result<(), fidl::Error> {
1379 let _result = self.send_raw(result);
1380 self.drop_without_shutdown();
1381 _result
1382 }
1383
1384 fn send_raw(
1385 &self,
1386 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1387 ) -> Result<(), fidl::Error> {
1388 self.control_handle.inner.send::<fidl::encoding::ResultType<
1389 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
1390 i32,
1391 >>(
1392 result.map(|info| (info,)),
1393 self.tx_id,
1394 0x79df1a5cdb6cc6a3,
1395 fidl::encoding::DynamicFlags::empty(),
1396 )
1397 }
1398}
1399
1400#[must_use = "FIDL methods require a response to be sent"]
1401#[derive(Debug)]
1402pub struct VolumeGetTypeGuidResponder {
1403 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1404 tx_id: u32,
1405}
1406
1407impl std::ops::Drop for VolumeGetTypeGuidResponder {
1411 fn drop(&mut self) {
1412 self.control_handle.shutdown();
1413 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1415 }
1416}
1417
1418impl fidl::endpoints::Responder for VolumeGetTypeGuidResponder {
1419 type ControlHandle = VolumeControlHandle;
1420
1421 fn control_handle(&self) -> &VolumeControlHandle {
1422 &self.control_handle
1423 }
1424
1425 fn drop_without_shutdown(mut self) {
1426 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1428 std::mem::forget(self);
1430 }
1431}
1432
1433impl VolumeGetTypeGuidResponder {
1434 pub fn send(
1438 self,
1439 mut status: i32,
1440 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1441 ) -> Result<(), fidl::Error> {
1442 let _result = self.send_raw(status, guid);
1443 if _result.is_err() {
1444 self.control_handle.shutdown();
1445 }
1446 self.drop_without_shutdown();
1447 _result
1448 }
1449
1450 pub fn send_no_shutdown_on_err(
1452 self,
1453 mut status: i32,
1454 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1455 ) -> Result<(), fidl::Error> {
1456 let _result = self.send_raw(status, guid);
1457 self.drop_without_shutdown();
1458 _result
1459 }
1460
1461 fn send_raw(
1462 &self,
1463 mut status: i32,
1464 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1465 ) -> Result<(), fidl::Error> {
1466 self.control_handle
1467 .inner
1468 .send::<fidl_fuchsia_hardware_block_partition::PartitionGetTypeGuidResponse>(
1469 (status, guid),
1470 self.tx_id,
1471 0x111843d737a9b847,
1472 fidl::encoding::DynamicFlags::empty(),
1473 )
1474 }
1475}
1476
1477#[must_use = "FIDL methods require a response to be sent"]
1478#[derive(Debug)]
1479pub struct VolumeGetInstanceGuidResponder {
1480 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1481 tx_id: u32,
1482}
1483
1484impl std::ops::Drop for VolumeGetInstanceGuidResponder {
1488 fn drop(&mut self) {
1489 self.control_handle.shutdown();
1490 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1492 }
1493}
1494
1495impl fidl::endpoints::Responder for VolumeGetInstanceGuidResponder {
1496 type ControlHandle = VolumeControlHandle;
1497
1498 fn control_handle(&self) -> &VolumeControlHandle {
1499 &self.control_handle
1500 }
1501
1502 fn drop_without_shutdown(mut self) {
1503 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1505 std::mem::forget(self);
1507 }
1508}
1509
1510impl VolumeGetInstanceGuidResponder {
1511 pub fn send(
1515 self,
1516 mut status: i32,
1517 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1518 ) -> Result<(), fidl::Error> {
1519 let _result = self.send_raw(status, guid);
1520 if _result.is_err() {
1521 self.control_handle.shutdown();
1522 }
1523 self.drop_without_shutdown();
1524 _result
1525 }
1526
1527 pub fn send_no_shutdown_on_err(
1529 self,
1530 mut status: i32,
1531 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1532 ) -> Result<(), fidl::Error> {
1533 let _result = self.send_raw(status, guid);
1534 self.drop_without_shutdown();
1535 _result
1536 }
1537
1538 fn send_raw(
1539 &self,
1540 mut status: i32,
1541 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1542 ) -> Result<(), fidl::Error> {
1543 self.control_handle
1544 .inner
1545 .send::<fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse>(
1546 (status, guid),
1547 self.tx_id,
1548 0x14a5a573b275d435,
1549 fidl::encoding::DynamicFlags::empty(),
1550 )
1551 }
1552}
1553
1554#[must_use = "FIDL methods require a response to be sent"]
1555#[derive(Debug)]
1556pub struct VolumeGetNameResponder {
1557 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1558 tx_id: u32,
1559}
1560
1561impl std::ops::Drop for VolumeGetNameResponder {
1565 fn drop(&mut self) {
1566 self.control_handle.shutdown();
1567 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569 }
1570}
1571
1572impl fidl::endpoints::Responder for VolumeGetNameResponder {
1573 type ControlHandle = VolumeControlHandle;
1574
1575 fn control_handle(&self) -> &VolumeControlHandle {
1576 &self.control_handle
1577 }
1578
1579 fn drop_without_shutdown(mut self) {
1580 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1582 std::mem::forget(self);
1584 }
1585}
1586
1587impl VolumeGetNameResponder {
1588 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1592 let _result = self.send_raw(status, name);
1593 if _result.is_err() {
1594 self.control_handle.shutdown();
1595 }
1596 self.drop_without_shutdown();
1597 _result
1598 }
1599
1600 pub fn send_no_shutdown_on_err(
1602 self,
1603 mut status: i32,
1604 mut name: Option<&str>,
1605 ) -> Result<(), fidl::Error> {
1606 let _result = self.send_raw(status, name);
1607 self.drop_without_shutdown();
1608 _result
1609 }
1610
1611 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1612 self.control_handle
1613 .inner
1614 .send::<fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse>(
1615 (status, name),
1616 self.tx_id,
1617 0x7e3c6f0b0937fc02,
1618 fidl::encoding::DynamicFlags::empty(),
1619 )
1620 }
1621}
1622
1623#[must_use = "FIDL methods require a response to be sent"]
1624#[derive(Debug)]
1625pub struct VolumeGetMetadataResponder {
1626 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1627 tx_id: u32,
1628}
1629
1630impl std::ops::Drop for VolumeGetMetadataResponder {
1634 fn drop(&mut self) {
1635 self.control_handle.shutdown();
1636 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1638 }
1639}
1640
1641impl fidl::endpoints::Responder for VolumeGetMetadataResponder {
1642 type ControlHandle = VolumeControlHandle;
1643
1644 fn control_handle(&self) -> &VolumeControlHandle {
1645 &self.control_handle
1646 }
1647
1648 fn drop_without_shutdown(mut self) {
1649 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1651 std::mem::forget(self);
1653 }
1654}
1655
1656impl VolumeGetMetadataResponder {
1657 pub fn send(
1661 self,
1662 mut result: Result<
1663 &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1664 i32,
1665 >,
1666 ) -> Result<(), fidl::Error> {
1667 let _result = self.send_raw(result);
1668 if _result.is_err() {
1669 self.control_handle.shutdown();
1670 }
1671 self.drop_without_shutdown();
1672 _result
1673 }
1674
1675 pub fn send_no_shutdown_on_err(
1677 self,
1678 mut result: Result<
1679 &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1680 i32,
1681 >,
1682 ) -> Result<(), fidl::Error> {
1683 let _result = self.send_raw(result);
1684 self.drop_without_shutdown();
1685 _result
1686 }
1687
1688 fn send_raw(
1689 &self,
1690 mut result: Result<
1691 &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1692 i32,
1693 >,
1694 ) -> Result<(), fidl::Error> {
1695 self.control_handle.inner.send::<fidl::encoding::ResultType<
1696 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1697 i32,
1698 >>(
1699 result,
1700 self.tx_id,
1701 0x42d1464c96c3f3ff,
1702 fidl::encoding::DynamicFlags::empty(),
1703 )
1704 }
1705}
1706
1707#[must_use = "FIDL methods require a response to be sent"]
1708#[derive(Debug)]
1709pub struct VolumeQuerySlicesResponder {
1710 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1711 tx_id: u32,
1712}
1713
1714impl std::ops::Drop for VolumeQuerySlicesResponder {
1718 fn drop(&mut self) {
1719 self.control_handle.shutdown();
1720 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1722 }
1723}
1724
1725impl fidl::endpoints::Responder for VolumeQuerySlicesResponder {
1726 type ControlHandle = VolumeControlHandle;
1727
1728 fn control_handle(&self) -> &VolumeControlHandle {
1729 &self.control_handle
1730 }
1731
1732 fn drop_without_shutdown(mut self) {
1733 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1735 std::mem::forget(self);
1737 }
1738}
1739
1740impl VolumeQuerySlicesResponder {
1741 pub fn send(
1745 self,
1746 mut status: i32,
1747 mut response: &[VsliceRange; 16],
1748 mut response_count: u64,
1749 ) -> Result<(), fidl::Error> {
1750 let _result = self.send_raw(status, response, response_count);
1751 if _result.is_err() {
1752 self.control_handle.shutdown();
1753 }
1754 self.drop_without_shutdown();
1755 _result
1756 }
1757
1758 pub fn send_no_shutdown_on_err(
1760 self,
1761 mut status: i32,
1762 mut response: &[VsliceRange; 16],
1763 mut response_count: u64,
1764 ) -> Result<(), fidl::Error> {
1765 let _result = self.send_raw(status, response, response_count);
1766 self.drop_without_shutdown();
1767 _result
1768 }
1769
1770 fn send_raw(
1771 &self,
1772 mut status: i32,
1773 mut response: &[VsliceRange; 16],
1774 mut response_count: u64,
1775 ) -> Result<(), fidl::Error> {
1776 self.control_handle.inner.send::<VolumeQuerySlicesResponse>(
1777 (status, response, response_count),
1778 self.tx_id,
1779 0x589a96828a3e2aa1,
1780 fidl::encoding::DynamicFlags::empty(),
1781 )
1782 }
1783}
1784
1785#[must_use = "FIDL methods require a response to be sent"]
1786#[derive(Debug)]
1787pub struct VolumeGetVolumeInfoResponder {
1788 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1789 tx_id: u32,
1790}
1791
1792impl std::ops::Drop for VolumeGetVolumeInfoResponder {
1796 fn drop(&mut self) {
1797 self.control_handle.shutdown();
1798 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1800 }
1801}
1802
1803impl fidl::endpoints::Responder for VolumeGetVolumeInfoResponder {
1804 type ControlHandle = VolumeControlHandle;
1805
1806 fn control_handle(&self) -> &VolumeControlHandle {
1807 &self.control_handle
1808 }
1809
1810 fn drop_without_shutdown(mut self) {
1811 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1813 std::mem::forget(self);
1815 }
1816}
1817
1818impl VolumeGetVolumeInfoResponder {
1819 pub fn send(
1823 self,
1824 mut status: i32,
1825 mut manager: Option<&VolumeManagerInfo>,
1826 mut volume: Option<&VolumeInfo>,
1827 ) -> Result<(), fidl::Error> {
1828 let _result = self.send_raw(status, manager, volume);
1829 if _result.is_err() {
1830 self.control_handle.shutdown();
1831 }
1832 self.drop_without_shutdown();
1833 _result
1834 }
1835
1836 pub fn send_no_shutdown_on_err(
1838 self,
1839 mut status: i32,
1840 mut manager: Option<&VolumeManagerInfo>,
1841 mut volume: Option<&VolumeInfo>,
1842 ) -> Result<(), fidl::Error> {
1843 let _result = self.send_raw(status, manager, volume);
1844 self.drop_without_shutdown();
1845 _result
1846 }
1847
1848 fn send_raw(
1849 &self,
1850 mut status: i32,
1851 mut manager: Option<&VolumeManagerInfo>,
1852 mut volume: Option<&VolumeInfo>,
1853 ) -> Result<(), fidl::Error> {
1854 self.control_handle.inner.send::<VolumeGetVolumeInfoResponse>(
1855 (status, manager, volume),
1856 self.tx_id,
1857 0x60417b6cf9e34c80,
1858 fidl::encoding::DynamicFlags::empty(),
1859 )
1860 }
1861}
1862
1863#[must_use = "FIDL methods require a response to be sent"]
1864#[derive(Debug)]
1865pub struct VolumeExtendResponder {
1866 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1867 tx_id: u32,
1868}
1869
1870impl std::ops::Drop for VolumeExtendResponder {
1874 fn drop(&mut self) {
1875 self.control_handle.shutdown();
1876 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1878 }
1879}
1880
1881impl fidl::endpoints::Responder for VolumeExtendResponder {
1882 type ControlHandle = VolumeControlHandle;
1883
1884 fn control_handle(&self) -> &VolumeControlHandle {
1885 &self.control_handle
1886 }
1887
1888 fn drop_without_shutdown(mut self) {
1889 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1891 std::mem::forget(self);
1893 }
1894}
1895
1896impl VolumeExtendResponder {
1897 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1901 let _result = self.send_raw(status);
1902 if _result.is_err() {
1903 self.control_handle.shutdown();
1904 }
1905 self.drop_without_shutdown();
1906 _result
1907 }
1908
1909 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1911 let _result = self.send_raw(status);
1912 self.drop_without_shutdown();
1913 _result
1914 }
1915
1916 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1917 self.control_handle.inner.send::<VolumeExtendResponse>(
1918 (status,),
1919 self.tx_id,
1920 0xdddf872f5039d37,
1921 fidl::encoding::DynamicFlags::empty(),
1922 )
1923 }
1924}
1925
1926#[must_use = "FIDL methods require a response to be sent"]
1927#[derive(Debug)]
1928pub struct VolumeShrinkResponder {
1929 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1930 tx_id: u32,
1931}
1932
1933impl std::ops::Drop for VolumeShrinkResponder {
1937 fn drop(&mut self) {
1938 self.control_handle.shutdown();
1939 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1941 }
1942}
1943
1944impl fidl::endpoints::Responder for VolumeShrinkResponder {
1945 type ControlHandle = VolumeControlHandle;
1946
1947 fn control_handle(&self) -> &VolumeControlHandle {
1948 &self.control_handle
1949 }
1950
1951 fn drop_without_shutdown(mut self) {
1952 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1954 std::mem::forget(self);
1956 }
1957}
1958
1959impl VolumeShrinkResponder {
1960 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1964 let _result = self.send_raw(status);
1965 if _result.is_err() {
1966 self.control_handle.shutdown();
1967 }
1968 self.drop_without_shutdown();
1969 _result
1970 }
1971
1972 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1974 let _result = self.send_raw(status);
1975 self.drop_without_shutdown();
1976 _result
1977 }
1978
1979 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1980 self.control_handle.inner.send::<VolumeShrinkResponse>(
1981 (status,),
1982 self.tx_id,
1983 0x27ab5ed4f6fdcd29,
1984 fidl::encoding::DynamicFlags::empty(),
1985 )
1986 }
1987}
1988
1989#[must_use = "FIDL methods require a response to be sent"]
1990#[derive(Debug)]
1991pub struct VolumeDestroyResponder {
1992 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1993 tx_id: u32,
1994}
1995
1996impl std::ops::Drop for VolumeDestroyResponder {
2000 fn drop(&mut self) {
2001 self.control_handle.shutdown();
2002 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2004 }
2005}
2006
2007impl fidl::endpoints::Responder for VolumeDestroyResponder {
2008 type ControlHandle = VolumeControlHandle;
2009
2010 fn control_handle(&self) -> &VolumeControlHandle {
2011 &self.control_handle
2012 }
2013
2014 fn drop_without_shutdown(mut self) {
2015 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2017 std::mem::forget(self);
2019 }
2020}
2021
2022impl VolumeDestroyResponder {
2023 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2027 let _result = self.send_raw(status);
2028 if _result.is_err() {
2029 self.control_handle.shutdown();
2030 }
2031 self.drop_without_shutdown();
2032 _result
2033 }
2034
2035 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2037 let _result = self.send_raw(status);
2038 self.drop_without_shutdown();
2039 _result
2040 }
2041
2042 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2043 self.control_handle.inner.send::<VolumeDestroyResponse>(
2044 (status,),
2045 self.tx_id,
2046 0x732bf4bea39b5e87,
2047 fidl::encoding::DynamicFlags::empty(),
2048 )
2049 }
2050}
2051
2052#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2053pub struct VolumeManagerMarker;
2054
2055impl fidl::endpoints::ProtocolMarker for VolumeManagerMarker {
2056 type Proxy = VolumeManagerProxy;
2057 type RequestStream = VolumeManagerRequestStream;
2058 #[cfg(target_os = "fuchsia")]
2059 type SynchronousProxy = VolumeManagerSynchronousProxy;
2060
2061 const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
2062}
2063pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
2064
2065pub trait VolumeManagerProxyInterface: Send + Sync {
2066 type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2067 fn r#allocate_partition(
2068 &self,
2069 slice_count: u64,
2070 type_: &fidl_fuchsia_hardware_block_partition::Guid,
2071 instance: &fidl_fuchsia_hardware_block_partition::Guid,
2072 name: &str,
2073 flags: u32,
2074 ) -> Self::AllocatePartitionResponseFut;
2075 type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
2076 + Send;
2077 fn r#get_info(&self) -> Self::GetInfoResponseFut;
2078 type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2079 fn r#activate(
2080 &self,
2081 old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2082 new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2083 ) -> Self::ActivateResponseFut;
2084 type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
2085 + Send;
2086 fn r#get_partition_limit(
2087 &self,
2088 guid: &fidl_fuchsia_hardware_block_partition::Guid,
2089 ) -> Self::GetPartitionLimitResponseFut;
2090 type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2091 fn r#set_partition_limit(
2092 &self,
2093 guid: &fidl_fuchsia_hardware_block_partition::Guid,
2094 slice_count: u64,
2095 ) -> Self::SetPartitionLimitResponseFut;
2096 type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
2097 + Send;
2098 fn r#set_partition_name(
2099 &self,
2100 guid: &fidl_fuchsia_hardware_block_partition::Guid,
2101 name: &str,
2102 ) -> Self::SetPartitionNameResponseFut;
2103}
2104#[derive(Debug)]
2105#[cfg(target_os = "fuchsia")]
2106pub struct VolumeManagerSynchronousProxy {
2107 client: fidl::client::sync::Client,
2108}
2109
2110#[cfg(target_os = "fuchsia")]
2111impl fidl::endpoints::SynchronousProxy for VolumeManagerSynchronousProxy {
2112 type Proxy = VolumeManagerProxy;
2113 type Protocol = VolumeManagerMarker;
2114
2115 fn from_channel(inner: fidl::Channel) -> Self {
2116 Self::new(inner)
2117 }
2118
2119 fn into_channel(self) -> fidl::Channel {
2120 self.client.into_channel()
2121 }
2122
2123 fn as_channel(&self) -> &fidl::Channel {
2124 self.client.as_channel()
2125 }
2126}
2127
2128#[cfg(target_os = "fuchsia")]
2129impl VolumeManagerSynchronousProxy {
2130 pub fn new(channel: fidl::Channel) -> Self {
2131 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2132 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2133 }
2134
2135 pub fn into_channel(self) -> fidl::Channel {
2136 self.client.into_channel()
2137 }
2138
2139 pub fn wait_for_event(
2142 &self,
2143 deadline: zx::MonotonicInstant,
2144 ) -> Result<VolumeManagerEvent, fidl::Error> {
2145 VolumeManagerEvent::decode(self.client.wait_for_event(deadline)?)
2146 }
2147
2148 pub fn r#allocate_partition(
2155 &self,
2156 mut slice_count: u64,
2157 mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2158 mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2159 mut name: &str,
2160 mut flags: u32,
2161 ___deadline: zx::MonotonicInstant,
2162 ) -> Result<i32, fidl::Error> {
2163 let _response = self.client.send_query::<
2164 VolumeManagerAllocatePartitionRequest,
2165 VolumeManagerAllocatePartitionResponse,
2166 >(
2167 (slice_count, type_, instance, name, flags,),
2168 0x4e79f24ed059e394,
2169 fidl::encoding::DynamicFlags::empty(),
2170 ___deadline,
2171 )?;
2172 Ok(_response.status)
2173 }
2174
2175 pub fn r#get_info(
2183 &self,
2184 ___deadline: zx::MonotonicInstant,
2185 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2186 let _response =
2187 self.client.send_query::<fidl::encoding::EmptyPayload, VolumeManagerGetInfoResponse>(
2188 (),
2189 0x735b3548582b2c9,
2190 fidl::encoding::DynamicFlags::empty(),
2191 ___deadline,
2192 )?;
2193 Ok((_response.status, _response.info))
2194 }
2195
2196 pub fn r#activate(
2212 &self,
2213 mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2214 mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2215 ___deadline: zx::MonotonicInstant,
2216 ) -> Result<i32, fidl::Error> {
2217 let _response =
2218 self.client.send_query::<VolumeManagerActivateRequest, VolumeManagerActivateResponse>(
2219 (old_guid, new_guid),
2220 0xc8cef57012874d0,
2221 fidl::encoding::DynamicFlags::empty(),
2222 ___deadline,
2223 )?;
2224 Ok(_response.status)
2225 }
2226
2227 pub fn r#get_partition_limit(
2237 &self,
2238 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2239 ___deadline: zx::MonotonicInstant,
2240 ) -> Result<(i32, u64), fidl::Error> {
2241 let _response = self.client.send_query::<
2242 VolumeManagerGetPartitionLimitRequest,
2243 VolumeManagerGetPartitionLimitResponse,
2244 >(
2245 (guid,),
2246 0x6e32f6df9fa2a919,
2247 fidl::encoding::DynamicFlags::empty(),
2248 ___deadline,
2249 )?;
2250 Ok((_response.status, _response.slice_count))
2251 }
2252
2253 pub fn r#set_partition_limit(
2265 &self,
2266 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2267 mut slice_count: u64,
2268 ___deadline: zx::MonotonicInstant,
2269 ) -> Result<i32, fidl::Error> {
2270 let _response = self.client.send_query::<
2271 VolumeManagerSetPartitionLimitRequest,
2272 VolumeManagerSetPartitionLimitResponse,
2273 >(
2274 (guid, slice_count,),
2275 0x2e09076ef266fa35,
2276 fidl::encoding::DynamicFlags::empty(),
2277 ___deadline,
2278 )?;
2279 Ok(_response.status)
2280 }
2281
2282 pub fn r#set_partition_name(
2286 &self,
2287 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2288 mut name: &str,
2289 ___deadline: zx::MonotonicInstant,
2290 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
2291 let _response = self.client.send_query::<
2292 VolumeManagerSetPartitionNameRequest,
2293 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2294 >(
2295 (guid, name,),
2296 0x4539a9b95cba0397,
2297 fidl::encoding::DynamicFlags::empty(),
2298 ___deadline,
2299 )?;
2300 Ok(_response.map(|x| x))
2301 }
2302}
2303
2304#[cfg(target_os = "fuchsia")]
2305impl From<VolumeManagerSynchronousProxy> for zx::Handle {
2306 fn from(value: VolumeManagerSynchronousProxy) -> Self {
2307 value.into_channel().into()
2308 }
2309}
2310
2311#[cfg(target_os = "fuchsia")]
2312impl From<fidl::Channel> for VolumeManagerSynchronousProxy {
2313 fn from(value: fidl::Channel) -> Self {
2314 Self::new(value)
2315 }
2316}
2317
2318#[cfg(target_os = "fuchsia")]
2319impl fidl::endpoints::FromClient for VolumeManagerSynchronousProxy {
2320 type Protocol = VolumeManagerMarker;
2321
2322 fn from_client(value: fidl::endpoints::ClientEnd<VolumeManagerMarker>) -> Self {
2323 Self::new(value.into_channel())
2324 }
2325}
2326
2327#[derive(Debug, Clone)]
2328pub struct VolumeManagerProxy {
2329 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2330}
2331
2332impl fidl::endpoints::Proxy for VolumeManagerProxy {
2333 type Protocol = VolumeManagerMarker;
2334
2335 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2336 Self::new(inner)
2337 }
2338
2339 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2340 self.client.into_channel().map_err(|client| Self { client })
2341 }
2342
2343 fn as_channel(&self) -> &::fidl::AsyncChannel {
2344 self.client.as_channel()
2345 }
2346}
2347
2348impl VolumeManagerProxy {
2349 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2351 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2352 Self { client: fidl::client::Client::new(channel, protocol_name) }
2353 }
2354
2355 pub fn take_event_stream(&self) -> VolumeManagerEventStream {
2361 VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
2362 }
2363
2364 pub fn r#allocate_partition(
2371 &self,
2372 mut slice_count: u64,
2373 mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2374 mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2375 mut name: &str,
2376 mut flags: u32,
2377 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2378 VolumeManagerProxyInterface::r#allocate_partition(
2379 self,
2380 slice_count,
2381 type_,
2382 instance,
2383 name,
2384 flags,
2385 )
2386 }
2387
2388 pub fn r#get_info(
2396 &self,
2397 ) -> fidl::client::QueryResponseFut<
2398 (i32, Option<Box<VolumeManagerInfo>>),
2399 fidl::encoding::DefaultFuchsiaResourceDialect,
2400 > {
2401 VolumeManagerProxyInterface::r#get_info(self)
2402 }
2403
2404 pub fn r#activate(
2420 &self,
2421 mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2422 mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2423 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2424 VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
2425 }
2426
2427 pub fn r#get_partition_limit(
2437 &self,
2438 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2439 ) -> fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
2440 {
2441 VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
2442 }
2443
2444 pub fn r#set_partition_limit(
2456 &self,
2457 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2458 mut slice_count: u64,
2459 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2460 VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
2461 }
2462
2463 pub fn r#set_partition_name(
2467 &self,
2468 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2469 mut name: &str,
2470 ) -> fidl::client::QueryResponseFut<
2471 VolumeManagerSetPartitionNameResult,
2472 fidl::encoding::DefaultFuchsiaResourceDialect,
2473 > {
2474 VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
2475 }
2476}
2477
2478impl VolumeManagerProxyInterface for VolumeManagerProxy {
2479 type AllocatePartitionResponseFut =
2480 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2481 fn r#allocate_partition(
2482 &self,
2483 mut slice_count: u64,
2484 mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2485 mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2486 mut name: &str,
2487 mut flags: u32,
2488 ) -> Self::AllocatePartitionResponseFut {
2489 fn _decode(
2490 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2491 ) -> Result<i32, fidl::Error> {
2492 let _response = fidl::client::decode_transaction_body::<
2493 VolumeManagerAllocatePartitionResponse,
2494 fidl::encoding::DefaultFuchsiaResourceDialect,
2495 0x4e79f24ed059e394,
2496 >(_buf?)?;
2497 Ok(_response.status)
2498 }
2499 self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
2500 (slice_count, type_, instance, name, flags),
2501 0x4e79f24ed059e394,
2502 fidl::encoding::DynamicFlags::empty(),
2503 _decode,
2504 )
2505 }
2506
2507 type GetInfoResponseFut = fidl::client::QueryResponseFut<
2508 (i32, Option<Box<VolumeManagerInfo>>),
2509 fidl::encoding::DefaultFuchsiaResourceDialect,
2510 >;
2511 fn r#get_info(&self) -> Self::GetInfoResponseFut {
2512 fn _decode(
2513 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2514 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2515 let _response = fidl::client::decode_transaction_body::<
2516 VolumeManagerGetInfoResponse,
2517 fidl::encoding::DefaultFuchsiaResourceDialect,
2518 0x735b3548582b2c9,
2519 >(_buf?)?;
2520 Ok((_response.status, _response.info))
2521 }
2522 self.client.send_query_and_decode::<
2523 fidl::encoding::EmptyPayload,
2524 (i32, Option<Box<VolumeManagerInfo>>),
2525 >(
2526 (),
2527 0x735b3548582b2c9,
2528 fidl::encoding::DynamicFlags::empty(),
2529 _decode,
2530 )
2531 }
2532
2533 type ActivateResponseFut =
2534 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2535 fn r#activate(
2536 &self,
2537 mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2538 mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2539 ) -> Self::ActivateResponseFut {
2540 fn _decode(
2541 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2542 ) -> Result<i32, fidl::Error> {
2543 let _response = fidl::client::decode_transaction_body::<
2544 VolumeManagerActivateResponse,
2545 fidl::encoding::DefaultFuchsiaResourceDialect,
2546 0xc8cef57012874d0,
2547 >(_buf?)?;
2548 Ok(_response.status)
2549 }
2550 self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
2551 (old_guid, new_guid),
2552 0xc8cef57012874d0,
2553 fidl::encoding::DynamicFlags::empty(),
2554 _decode,
2555 )
2556 }
2557
2558 type GetPartitionLimitResponseFut =
2559 fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>;
2560 fn r#get_partition_limit(
2561 &self,
2562 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2563 ) -> Self::GetPartitionLimitResponseFut {
2564 fn _decode(
2565 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2566 ) -> Result<(i32, u64), fidl::Error> {
2567 let _response = fidl::client::decode_transaction_body::<
2568 VolumeManagerGetPartitionLimitResponse,
2569 fidl::encoding::DefaultFuchsiaResourceDialect,
2570 0x6e32f6df9fa2a919,
2571 >(_buf?)?;
2572 Ok((_response.status, _response.slice_count))
2573 }
2574 self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
2575 (guid,),
2576 0x6e32f6df9fa2a919,
2577 fidl::encoding::DynamicFlags::empty(),
2578 _decode,
2579 )
2580 }
2581
2582 type SetPartitionLimitResponseFut =
2583 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2584 fn r#set_partition_limit(
2585 &self,
2586 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2587 mut slice_count: u64,
2588 ) -> Self::SetPartitionLimitResponseFut {
2589 fn _decode(
2590 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2591 ) -> Result<i32, fidl::Error> {
2592 let _response = fidl::client::decode_transaction_body::<
2593 VolumeManagerSetPartitionLimitResponse,
2594 fidl::encoding::DefaultFuchsiaResourceDialect,
2595 0x2e09076ef266fa35,
2596 >(_buf?)?;
2597 Ok(_response.status)
2598 }
2599 self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
2600 (guid, slice_count),
2601 0x2e09076ef266fa35,
2602 fidl::encoding::DynamicFlags::empty(),
2603 _decode,
2604 )
2605 }
2606
2607 type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
2608 VolumeManagerSetPartitionNameResult,
2609 fidl::encoding::DefaultFuchsiaResourceDialect,
2610 >;
2611 fn r#set_partition_name(
2612 &self,
2613 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2614 mut name: &str,
2615 ) -> Self::SetPartitionNameResponseFut {
2616 fn _decode(
2617 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2618 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
2619 let _response = fidl::client::decode_transaction_body::<
2620 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2621 fidl::encoding::DefaultFuchsiaResourceDialect,
2622 0x4539a9b95cba0397,
2623 >(_buf?)?;
2624 Ok(_response.map(|x| x))
2625 }
2626 self.client.send_query_and_decode::<
2627 VolumeManagerSetPartitionNameRequest,
2628 VolumeManagerSetPartitionNameResult,
2629 >(
2630 (guid, name,),
2631 0x4539a9b95cba0397,
2632 fidl::encoding::DynamicFlags::empty(),
2633 _decode,
2634 )
2635 }
2636}
2637
2638pub struct VolumeManagerEventStream {
2639 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2640}
2641
2642impl std::marker::Unpin for VolumeManagerEventStream {}
2643
2644impl futures::stream::FusedStream for VolumeManagerEventStream {
2645 fn is_terminated(&self) -> bool {
2646 self.event_receiver.is_terminated()
2647 }
2648}
2649
2650impl futures::Stream for VolumeManagerEventStream {
2651 type Item = Result<VolumeManagerEvent, fidl::Error>;
2652
2653 fn poll_next(
2654 mut self: std::pin::Pin<&mut Self>,
2655 cx: &mut std::task::Context<'_>,
2656 ) -> std::task::Poll<Option<Self::Item>> {
2657 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2658 &mut self.event_receiver,
2659 cx
2660 )?) {
2661 Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
2662 None => std::task::Poll::Ready(None),
2663 }
2664 }
2665}
2666
2667#[derive(Debug)]
2668pub enum VolumeManagerEvent {}
2669
2670impl VolumeManagerEvent {
2671 fn decode(
2673 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2674 ) -> Result<VolumeManagerEvent, fidl::Error> {
2675 let (bytes, _handles) = buf.split_mut();
2676 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2677 debug_assert_eq!(tx_header.tx_id, 0);
2678 match tx_header.ordinal {
2679 _ => Err(fidl::Error::UnknownOrdinal {
2680 ordinal: tx_header.ordinal,
2681 protocol_name: <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2682 }),
2683 }
2684 }
2685}
2686
2687pub struct VolumeManagerRequestStream {
2689 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2690 is_terminated: bool,
2691}
2692
2693impl std::marker::Unpin for VolumeManagerRequestStream {}
2694
2695impl futures::stream::FusedStream for VolumeManagerRequestStream {
2696 fn is_terminated(&self) -> bool {
2697 self.is_terminated
2698 }
2699}
2700
2701impl fidl::endpoints::RequestStream for VolumeManagerRequestStream {
2702 type Protocol = VolumeManagerMarker;
2703 type ControlHandle = VolumeManagerControlHandle;
2704
2705 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2706 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2707 }
2708
2709 fn control_handle(&self) -> Self::ControlHandle {
2710 VolumeManagerControlHandle { inner: self.inner.clone() }
2711 }
2712
2713 fn into_inner(
2714 self,
2715 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2716 {
2717 (self.inner, self.is_terminated)
2718 }
2719
2720 fn from_inner(
2721 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2722 is_terminated: bool,
2723 ) -> Self {
2724 Self { inner, is_terminated }
2725 }
2726}
2727
2728impl futures::Stream for VolumeManagerRequestStream {
2729 type Item = Result<VolumeManagerRequest, fidl::Error>;
2730
2731 fn poll_next(
2732 mut self: std::pin::Pin<&mut Self>,
2733 cx: &mut std::task::Context<'_>,
2734 ) -> std::task::Poll<Option<Self::Item>> {
2735 let this = &mut *self;
2736 if this.inner.check_shutdown(cx) {
2737 this.is_terminated = true;
2738 return std::task::Poll::Ready(None);
2739 }
2740 if this.is_terminated {
2741 panic!("polled VolumeManagerRequestStream after completion");
2742 }
2743 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2744 |bytes, handles| {
2745 match this.inner.channel().read_etc(cx, bytes, handles) {
2746 std::task::Poll::Ready(Ok(())) => {}
2747 std::task::Poll::Pending => return std::task::Poll::Pending,
2748 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2749 this.is_terminated = true;
2750 return std::task::Poll::Ready(None);
2751 }
2752 std::task::Poll::Ready(Err(e)) => {
2753 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2754 e.into(),
2755 ))));
2756 }
2757 }
2758
2759 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2761
2762 std::task::Poll::Ready(Some(match header.ordinal {
2763 0x4e79f24ed059e394 => {
2764 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2765 let mut req = fidl::new_empty!(
2766 VolumeManagerAllocatePartitionRequest,
2767 fidl::encoding::DefaultFuchsiaResourceDialect
2768 );
2769 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
2770 let control_handle =
2771 VolumeManagerControlHandle { inner: this.inner.clone() };
2772 Ok(VolumeManagerRequest::AllocatePartition {
2773 slice_count: req.slice_count,
2774 type_: req.type_,
2775 instance: req.instance,
2776 name: req.name,
2777 flags: req.flags,
2778
2779 responder: VolumeManagerAllocatePartitionResponder {
2780 control_handle: std::mem::ManuallyDrop::new(control_handle),
2781 tx_id: header.tx_id,
2782 },
2783 })
2784 }
2785 0x735b3548582b2c9 => {
2786 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2787 let mut req = fidl::new_empty!(
2788 fidl::encoding::EmptyPayload,
2789 fidl::encoding::DefaultFuchsiaResourceDialect
2790 );
2791 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2792 let control_handle =
2793 VolumeManagerControlHandle { inner: this.inner.clone() };
2794 Ok(VolumeManagerRequest::GetInfo {
2795 responder: VolumeManagerGetInfoResponder {
2796 control_handle: std::mem::ManuallyDrop::new(control_handle),
2797 tx_id: header.tx_id,
2798 },
2799 })
2800 }
2801 0xc8cef57012874d0 => {
2802 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2803 let mut req = fidl::new_empty!(
2804 VolumeManagerActivateRequest,
2805 fidl::encoding::DefaultFuchsiaResourceDialect
2806 );
2807 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
2808 let control_handle =
2809 VolumeManagerControlHandle { inner: this.inner.clone() };
2810 Ok(VolumeManagerRequest::Activate {
2811 old_guid: req.old_guid,
2812 new_guid: req.new_guid,
2813
2814 responder: VolumeManagerActivateResponder {
2815 control_handle: std::mem::ManuallyDrop::new(control_handle),
2816 tx_id: header.tx_id,
2817 },
2818 })
2819 }
2820 0x6e32f6df9fa2a919 => {
2821 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2822 let mut req = fidl::new_empty!(
2823 VolumeManagerGetPartitionLimitRequest,
2824 fidl::encoding::DefaultFuchsiaResourceDialect
2825 );
2826 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
2827 let control_handle =
2828 VolumeManagerControlHandle { inner: this.inner.clone() };
2829 Ok(VolumeManagerRequest::GetPartitionLimit {
2830 guid: req.guid,
2831
2832 responder: VolumeManagerGetPartitionLimitResponder {
2833 control_handle: std::mem::ManuallyDrop::new(control_handle),
2834 tx_id: header.tx_id,
2835 },
2836 })
2837 }
2838 0x2e09076ef266fa35 => {
2839 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2840 let mut req = fidl::new_empty!(
2841 VolumeManagerSetPartitionLimitRequest,
2842 fidl::encoding::DefaultFuchsiaResourceDialect
2843 );
2844 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
2845 let control_handle =
2846 VolumeManagerControlHandle { inner: this.inner.clone() };
2847 Ok(VolumeManagerRequest::SetPartitionLimit {
2848 guid: req.guid,
2849 slice_count: req.slice_count,
2850
2851 responder: VolumeManagerSetPartitionLimitResponder {
2852 control_handle: std::mem::ManuallyDrop::new(control_handle),
2853 tx_id: header.tx_id,
2854 },
2855 })
2856 }
2857 0x4539a9b95cba0397 => {
2858 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2859 let mut req = fidl::new_empty!(
2860 VolumeManagerSetPartitionNameRequest,
2861 fidl::encoding::DefaultFuchsiaResourceDialect
2862 );
2863 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
2864 let control_handle =
2865 VolumeManagerControlHandle { inner: this.inner.clone() };
2866 Ok(VolumeManagerRequest::SetPartitionName {
2867 guid: req.guid,
2868 name: req.name,
2869
2870 responder: VolumeManagerSetPartitionNameResponder {
2871 control_handle: std::mem::ManuallyDrop::new(control_handle),
2872 tx_id: header.tx_id,
2873 },
2874 })
2875 }
2876 _ => Err(fidl::Error::UnknownOrdinal {
2877 ordinal: header.ordinal,
2878 protocol_name:
2879 <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2880 }),
2881 }))
2882 },
2883 )
2884 }
2885}
2886
2887#[derive(Debug)]
2889pub enum VolumeManagerRequest {
2890 AllocatePartition {
2897 slice_count: u64,
2898 type_: fidl_fuchsia_hardware_block_partition::Guid,
2899 instance: fidl_fuchsia_hardware_block_partition::Guid,
2900 name: String,
2901 flags: u32,
2902 responder: VolumeManagerAllocatePartitionResponder,
2903 },
2904 GetInfo { responder: VolumeManagerGetInfoResponder },
2912 Activate {
2928 old_guid: fidl_fuchsia_hardware_block_partition::Guid,
2929 new_guid: fidl_fuchsia_hardware_block_partition::Guid,
2930 responder: VolumeManagerActivateResponder,
2931 },
2932 GetPartitionLimit {
2942 guid: fidl_fuchsia_hardware_block_partition::Guid,
2943 responder: VolumeManagerGetPartitionLimitResponder,
2944 },
2945 SetPartitionLimit {
2957 guid: fidl_fuchsia_hardware_block_partition::Guid,
2958 slice_count: u64,
2959 responder: VolumeManagerSetPartitionLimitResponder,
2960 },
2961 SetPartitionName {
2965 guid: fidl_fuchsia_hardware_block_partition::Guid,
2966 name: String,
2967 responder: VolumeManagerSetPartitionNameResponder,
2968 },
2969}
2970
2971impl VolumeManagerRequest {
2972 #[allow(irrefutable_let_patterns)]
2973 pub fn into_allocate_partition(
2974 self,
2975 ) -> Option<(
2976 u64,
2977 fidl_fuchsia_hardware_block_partition::Guid,
2978 fidl_fuchsia_hardware_block_partition::Guid,
2979 String,
2980 u32,
2981 VolumeManagerAllocatePartitionResponder,
2982 )> {
2983 if let VolumeManagerRequest::AllocatePartition {
2984 slice_count,
2985 type_,
2986 instance,
2987 name,
2988 flags,
2989 responder,
2990 } = self
2991 {
2992 Some((slice_count, type_, instance, name, flags, responder))
2993 } else {
2994 None
2995 }
2996 }
2997
2998 #[allow(irrefutable_let_patterns)]
2999 pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
3000 if let VolumeManagerRequest::GetInfo { responder } = self {
3001 Some((responder))
3002 } else {
3003 None
3004 }
3005 }
3006
3007 #[allow(irrefutable_let_patterns)]
3008 pub fn into_activate(
3009 self,
3010 ) -> Option<(
3011 fidl_fuchsia_hardware_block_partition::Guid,
3012 fidl_fuchsia_hardware_block_partition::Guid,
3013 VolumeManagerActivateResponder,
3014 )> {
3015 if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
3016 Some((old_guid, new_guid, responder))
3017 } else {
3018 None
3019 }
3020 }
3021
3022 #[allow(irrefutable_let_patterns)]
3023 pub fn into_get_partition_limit(
3024 self,
3025 ) -> Option<(
3026 fidl_fuchsia_hardware_block_partition::Guid,
3027 VolumeManagerGetPartitionLimitResponder,
3028 )> {
3029 if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
3030 Some((guid, responder))
3031 } else {
3032 None
3033 }
3034 }
3035
3036 #[allow(irrefutable_let_patterns)]
3037 pub fn into_set_partition_limit(
3038 self,
3039 ) -> Option<(
3040 fidl_fuchsia_hardware_block_partition::Guid,
3041 u64,
3042 VolumeManagerSetPartitionLimitResponder,
3043 )> {
3044 if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
3045 Some((guid, slice_count, responder))
3046 } else {
3047 None
3048 }
3049 }
3050
3051 #[allow(irrefutable_let_patterns)]
3052 pub fn into_set_partition_name(
3053 self,
3054 ) -> Option<(
3055 fidl_fuchsia_hardware_block_partition::Guid,
3056 String,
3057 VolumeManagerSetPartitionNameResponder,
3058 )> {
3059 if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
3060 Some((guid, name, responder))
3061 } else {
3062 None
3063 }
3064 }
3065
3066 pub fn method_name(&self) -> &'static str {
3068 match *self {
3069 VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
3070 VolumeManagerRequest::GetInfo { .. } => "get_info",
3071 VolumeManagerRequest::Activate { .. } => "activate",
3072 VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
3073 VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
3074 VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
3075 }
3076 }
3077}
3078
3079#[derive(Debug, Clone)]
3080pub struct VolumeManagerControlHandle {
3081 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3082}
3083
3084impl fidl::endpoints::ControlHandle for VolumeManagerControlHandle {
3085 fn shutdown(&self) {
3086 self.inner.shutdown()
3087 }
3088 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3089 self.inner.shutdown_with_epitaph(status)
3090 }
3091
3092 fn is_closed(&self) -> bool {
3093 self.inner.channel().is_closed()
3094 }
3095 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3096 self.inner.channel().on_closed()
3097 }
3098
3099 #[cfg(target_os = "fuchsia")]
3100 fn signal_peer(
3101 &self,
3102 clear_mask: zx::Signals,
3103 set_mask: zx::Signals,
3104 ) -> Result<(), zx_status::Status> {
3105 use fidl::Peered;
3106 self.inner.channel().signal_peer(clear_mask, set_mask)
3107 }
3108}
3109
3110impl VolumeManagerControlHandle {}
3111
3112#[must_use = "FIDL methods require a response to be sent"]
3113#[derive(Debug)]
3114pub struct VolumeManagerAllocatePartitionResponder {
3115 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3116 tx_id: u32,
3117}
3118
3119impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
3123 fn drop(&mut self) {
3124 self.control_handle.shutdown();
3125 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3127 }
3128}
3129
3130impl fidl::endpoints::Responder for VolumeManagerAllocatePartitionResponder {
3131 type ControlHandle = VolumeManagerControlHandle;
3132
3133 fn control_handle(&self) -> &VolumeManagerControlHandle {
3134 &self.control_handle
3135 }
3136
3137 fn drop_without_shutdown(mut self) {
3138 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3140 std::mem::forget(self);
3142 }
3143}
3144
3145impl VolumeManagerAllocatePartitionResponder {
3146 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3150 let _result = self.send_raw(status);
3151 if _result.is_err() {
3152 self.control_handle.shutdown();
3153 }
3154 self.drop_without_shutdown();
3155 _result
3156 }
3157
3158 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3160 let _result = self.send_raw(status);
3161 self.drop_without_shutdown();
3162 _result
3163 }
3164
3165 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3166 self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
3167 (status,),
3168 self.tx_id,
3169 0x4e79f24ed059e394,
3170 fidl::encoding::DynamicFlags::empty(),
3171 )
3172 }
3173}
3174
3175#[must_use = "FIDL methods require a response to be sent"]
3176#[derive(Debug)]
3177pub struct VolumeManagerGetInfoResponder {
3178 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3179 tx_id: u32,
3180}
3181
3182impl std::ops::Drop for VolumeManagerGetInfoResponder {
3186 fn drop(&mut self) {
3187 self.control_handle.shutdown();
3188 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3190 }
3191}
3192
3193impl fidl::endpoints::Responder for VolumeManagerGetInfoResponder {
3194 type ControlHandle = VolumeManagerControlHandle;
3195
3196 fn control_handle(&self) -> &VolumeManagerControlHandle {
3197 &self.control_handle
3198 }
3199
3200 fn drop_without_shutdown(mut self) {
3201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3203 std::mem::forget(self);
3205 }
3206}
3207
3208impl VolumeManagerGetInfoResponder {
3209 pub fn send(
3213 self,
3214 mut status: i32,
3215 mut info: Option<&VolumeManagerInfo>,
3216 ) -> Result<(), fidl::Error> {
3217 let _result = self.send_raw(status, info);
3218 if _result.is_err() {
3219 self.control_handle.shutdown();
3220 }
3221 self.drop_without_shutdown();
3222 _result
3223 }
3224
3225 pub fn send_no_shutdown_on_err(
3227 self,
3228 mut status: i32,
3229 mut info: Option<&VolumeManagerInfo>,
3230 ) -> Result<(), fidl::Error> {
3231 let _result = self.send_raw(status, info);
3232 self.drop_without_shutdown();
3233 _result
3234 }
3235
3236 fn send_raw(
3237 &self,
3238 mut status: i32,
3239 mut info: Option<&VolumeManagerInfo>,
3240 ) -> Result<(), fidl::Error> {
3241 self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
3242 (status, info),
3243 self.tx_id,
3244 0x735b3548582b2c9,
3245 fidl::encoding::DynamicFlags::empty(),
3246 )
3247 }
3248}
3249
3250#[must_use = "FIDL methods require a response to be sent"]
3251#[derive(Debug)]
3252pub struct VolumeManagerActivateResponder {
3253 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3254 tx_id: u32,
3255}
3256
3257impl std::ops::Drop for VolumeManagerActivateResponder {
3261 fn drop(&mut self) {
3262 self.control_handle.shutdown();
3263 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3265 }
3266}
3267
3268impl fidl::endpoints::Responder for VolumeManagerActivateResponder {
3269 type ControlHandle = VolumeManagerControlHandle;
3270
3271 fn control_handle(&self) -> &VolumeManagerControlHandle {
3272 &self.control_handle
3273 }
3274
3275 fn drop_without_shutdown(mut self) {
3276 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3278 std::mem::forget(self);
3280 }
3281}
3282
3283impl VolumeManagerActivateResponder {
3284 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3288 let _result = self.send_raw(status);
3289 if _result.is_err() {
3290 self.control_handle.shutdown();
3291 }
3292 self.drop_without_shutdown();
3293 _result
3294 }
3295
3296 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3298 let _result = self.send_raw(status);
3299 self.drop_without_shutdown();
3300 _result
3301 }
3302
3303 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3304 self.control_handle.inner.send::<VolumeManagerActivateResponse>(
3305 (status,),
3306 self.tx_id,
3307 0xc8cef57012874d0,
3308 fidl::encoding::DynamicFlags::empty(),
3309 )
3310 }
3311}
3312
3313#[must_use = "FIDL methods require a response to be sent"]
3314#[derive(Debug)]
3315pub struct VolumeManagerGetPartitionLimitResponder {
3316 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3317 tx_id: u32,
3318}
3319
3320impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
3324 fn drop(&mut self) {
3325 self.control_handle.shutdown();
3326 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3328 }
3329}
3330
3331impl fidl::endpoints::Responder for VolumeManagerGetPartitionLimitResponder {
3332 type ControlHandle = VolumeManagerControlHandle;
3333
3334 fn control_handle(&self) -> &VolumeManagerControlHandle {
3335 &self.control_handle
3336 }
3337
3338 fn drop_without_shutdown(mut self) {
3339 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3341 std::mem::forget(self);
3343 }
3344}
3345
3346impl VolumeManagerGetPartitionLimitResponder {
3347 pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
3351 let _result = self.send_raw(status, slice_count);
3352 if _result.is_err() {
3353 self.control_handle.shutdown();
3354 }
3355 self.drop_without_shutdown();
3356 _result
3357 }
3358
3359 pub fn send_no_shutdown_on_err(
3361 self,
3362 mut status: i32,
3363 mut slice_count: u64,
3364 ) -> Result<(), fidl::Error> {
3365 let _result = self.send_raw(status, slice_count);
3366 self.drop_without_shutdown();
3367 _result
3368 }
3369
3370 fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
3371 self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
3372 (status, slice_count),
3373 self.tx_id,
3374 0x6e32f6df9fa2a919,
3375 fidl::encoding::DynamicFlags::empty(),
3376 )
3377 }
3378}
3379
3380#[must_use = "FIDL methods require a response to be sent"]
3381#[derive(Debug)]
3382pub struct VolumeManagerSetPartitionLimitResponder {
3383 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3384 tx_id: u32,
3385}
3386
3387impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
3391 fn drop(&mut self) {
3392 self.control_handle.shutdown();
3393 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3395 }
3396}
3397
3398impl fidl::endpoints::Responder for VolumeManagerSetPartitionLimitResponder {
3399 type ControlHandle = VolumeManagerControlHandle;
3400
3401 fn control_handle(&self) -> &VolumeManagerControlHandle {
3402 &self.control_handle
3403 }
3404
3405 fn drop_without_shutdown(mut self) {
3406 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3408 std::mem::forget(self);
3410 }
3411}
3412
3413impl VolumeManagerSetPartitionLimitResponder {
3414 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3418 let _result = self.send_raw(status);
3419 if _result.is_err() {
3420 self.control_handle.shutdown();
3421 }
3422 self.drop_without_shutdown();
3423 _result
3424 }
3425
3426 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3428 let _result = self.send_raw(status);
3429 self.drop_without_shutdown();
3430 _result
3431 }
3432
3433 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3434 self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
3435 (status,),
3436 self.tx_id,
3437 0x2e09076ef266fa35,
3438 fidl::encoding::DynamicFlags::empty(),
3439 )
3440 }
3441}
3442
3443#[must_use = "FIDL methods require a response to be sent"]
3444#[derive(Debug)]
3445pub struct VolumeManagerSetPartitionNameResponder {
3446 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3447 tx_id: u32,
3448}
3449
3450impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
3454 fn drop(&mut self) {
3455 self.control_handle.shutdown();
3456 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3458 }
3459}
3460
3461impl fidl::endpoints::Responder for VolumeManagerSetPartitionNameResponder {
3462 type ControlHandle = VolumeManagerControlHandle;
3463
3464 fn control_handle(&self) -> &VolumeManagerControlHandle {
3465 &self.control_handle
3466 }
3467
3468 fn drop_without_shutdown(mut self) {
3469 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3471 std::mem::forget(self);
3473 }
3474}
3475
3476impl VolumeManagerSetPartitionNameResponder {
3477 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3481 let _result = self.send_raw(result);
3482 if _result.is_err() {
3483 self.control_handle.shutdown();
3484 }
3485 self.drop_without_shutdown();
3486 _result
3487 }
3488
3489 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3491 let _result = self.send_raw(result);
3492 self.drop_without_shutdown();
3493 _result
3494 }
3495
3496 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3497 self.control_handle
3498 .inner
3499 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3500 result,
3501 self.tx_id,
3502 0x4539a9b95cba0397,
3503 fidl::encoding::DynamicFlags::empty(),
3504 )
3505 }
3506}
3507
3508#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3509pub struct ServiceMarker;
3510
3511#[cfg(target_os = "fuchsia")]
3512impl fidl::endpoints::ServiceMarker for ServiceMarker {
3513 type Proxy = ServiceProxy;
3514 type Request = ServiceRequest;
3515 const SERVICE_NAME: &'static str = "fuchsia.hardware.block.volume.Service";
3516}
3517
3518#[cfg(target_os = "fuchsia")]
3521pub enum ServiceRequest {
3522 Volume(VolumeRequestStream),
3523}
3524
3525#[cfg(target_os = "fuchsia")]
3526impl fidl::endpoints::ServiceRequest for ServiceRequest {
3527 type Service = ServiceMarker;
3528
3529 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
3530 match name {
3531 "volume" => Self::Volume(
3532 <VolumeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
3533 ),
3534 _ => panic!("no such member protocol name for service Service"),
3535 }
3536 }
3537
3538 fn member_names() -> &'static [&'static str] {
3539 &["volume"]
3540 }
3541}
3542#[cfg(target_os = "fuchsia")]
3543pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
3544
3545#[cfg(target_os = "fuchsia")]
3546impl fidl::endpoints::ServiceProxy for ServiceProxy {
3547 type Service = ServiceMarker;
3548
3549 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
3550 Self(opener)
3551 }
3552}
3553
3554#[cfg(target_os = "fuchsia")]
3555impl ServiceProxy {
3556 pub fn connect_to_volume(&self) -> Result<VolumeProxy, fidl::Error> {
3557 let (proxy, server_end) = fidl::endpoints::create_proxy::<VolumeMarker>();
3558 self.connect_channel_to_volume(server_end)?;
3559 Ok(proxy)
3560 }
3561
3562 pub fn connect_to_volume_sync(&self) -> Result<VolumeSynchronousProxy, fidl::Error> {
3565 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<VolumeMarker>();
3566 self.connect_channel_to_volume(server_end)?;
3567 Ok(proxy)
3568 }
3569
3570 pub fn connect_channel_to_volume(
3573 &self,
3574 server_end: fidl::endpoints::ServerEnd<VolumeMarker>,
3575 ) -> Result<(), fidl::Error> {
3576 self.0.open_member("volume", server_end.into_channel())
3577 }
3578
3579 pub fn instance_name(&self) -> &str {
3580 self.0.instance_name()
3581 }
3582}
3583
3584mod internal {
3585 use super::*;
3586}