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::NullableHandle {
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
1302 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1303 self.inner.shutdown_with_epitaph(status)
1304 }
1305
1306 fn is_closed(&self) -> bool {
1307 self.inner.channel().is_closed()
1308 }
1309 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1310 self.inner.channel().on_closed()
1311 }
1312
1313 #[cfg(target_os = "fuchsia")]
1314 fn signal_peer(
1315 &self,
1316 clear_mask: zx::Signals,
1317 set_mask: zx::Signals,
1318 ) -> Result<(), zx_status::Status> {
1319 use fidl::Peered;
1320 self.inner.channel().signal_peer(clear_mask, set_mask)
1321 }
1322}
1323
1324impl VolumeControlHandle {}
1325
1326#[must_use = "FIDL methods require a response to be sent"]
1327#[derive(Debug)]
1328pub struct VolumeGetInfoResponder {
1329 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1330 tx_id: u32,
1331}
1332
1333impl std::ops::Drop for VolumeGetInfoResponder {
1337 fn drop(&mut self) {
1338 self.control_handle.shutdown();
1339 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1341 }
1342}
1343
1344impl fidl::endpoints::Responder for VolumeGetInfoResponder {
1345 type ControlHandle = VolumeControlHandle;
1346
1347 fn control_handle(&self) -> &VolumeControlHandle {
1348 &self.control_handle
1349 }
1350
1351 fn drop_without_shutdown(mut self) {
1352 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1354 std::mem::forget(self);
1356 }
1357}
1358
1359impl VolumeGetInfoResponder {
1360 pub fn send(
1364 self,
1365 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1366 ) -> Result<(), fidl::Error> {
1367 let _result = self.send_raw(result);
1368 if _result.is_err() {
1369 self.control_handle.shutdown();
1370 }
1371 self.drop_without_shutdown();
1372 _result
1373 }
1374
1375 pub fn send_no_shutdown_on_err(
1377 self,
1378 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1379 ) -> Result<(), fidl::Error> {
1380 let _result = self.send_raw(result);
1381 self.drop_without_shutdown();
1382 _result
1383 }
1384
1385 fn send_raw(
1386 &self,
1387 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1388 ) -> Result<(), fidl::Error> {
1389 self.control_handle.inner.send::<fidl::encoding::ResultType<
1390 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
1391 i32,
1392 >>(
1393 result.map(|info| (info,)),
1394 self.tx_id,
1395 0x79df1a5cdb6cc6a3,
1396 fidl::encoding::DynamicFlags::empty(),
1397 )
1398 }
1399}
1400
1401#[must_use = "FIDL methods require a response to be sent"]
1402#[derive(Debug)]
1403pub struct VolumeGetTypeGuidResponder {
1404 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1405 tx_id: u32,
1406}
1407
1408impl std::ops::Drop for VolumeGetTypeGuidResponder {
1412 fn drop(&mut self) {
1413 self.control_handle.shutdown();
1414 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1416 }
1417}
1418
1419impl fidl::endpoints::Responder for VolumeGetTypeGuidResponder {
1420 type ControlHandle = VolumeControlHandle;
1421
1422 fn control_handle(&self) -> &VolumeControlHandle {
1423 &self.control_handle
1424 }
1425
1426 fn drop_without_shutdown(mut self) {
1427 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1429 std::mem::forget(self);
1431 }
1432}
1433
1434impl VolumeGetTypeGuidResponder {
1435 pub fn send(
1439 self,
1440 mut status: i32,
1441 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1442 ) -> Result<(), fidl::Error> {
1443 let _result = self.send_raw(status, guid);
1444 if _result.is_err() {
1445 self.control_handle.shutdown();
1446 }
1447 self.drop_without_shutdown();
1448 _result
1449 }
1450
1451 pub fn send_no_shutdown_on_err(
1453 self,
1454 mut status: i32,
1455 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1456 ) -> Result<(), fidl::Error> {
1457 let _result = self.send_raw(status, guid);
1458 self.drop_without_shutdown();
1459 _result
1460 }
1461
1462 fn send_raw(
1463 &self,
1464 mut status: i32,
1465 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1466 ) -> Result<(), fidl::Error> {
1467 self.control_handle
1468 .inner
1469 .send::<fidl_fuchsia_hardware_block_partition::PartitionGetTypeGuidResponse>(
1470 (status, guid),
1471 self.tx_id,
1472 0x111843d737a9b847,
1473 fidl::encoding::DynamicFlags::empty(),
1474 )
1475 }
1476}
1477
1478#[must_use = "FIDL methods require a response to be sent"]
1479#[derive(Debug)]
1480pub struct VolumeGetInstanceGuidResponder {
1481 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1482 tx_id: u32,
1483}
1484
1485impl std::ops::Drop for VolumeGetInstanceGuidResponder {
1489 fn drop(&mut self) {
1490 self.control_handle.shutdown();
1491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1493 }
1494}
1495
1496impl fidl::endpoints::Responder for VolumeGetInstanceGuidResponder {
1497 type ControlHandle = VolumeControlHandle;
1498
1499 fn control_handle(&self) -> &VolumeControlHandle {
1500 &self.control_handle
1501 }
1502
1503 fn drop_without_shutdown(mut self) {
1504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506 std::mem::forget(self);
1508 }
1509}
1510
1511impl VolumeGetInstanceGuidResponder {
1512 pub fn send(
1516 self,
1517 mut status: i32,
1518 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1519 ) -> Result<(), fidl::Error> {
1520 let _result = self.send_raw(status, guid);
1521 if _result.is_err() {
1522 self.control_handle.shutdown();
1523 }
1524 self.drop_without_shutdown();
1525 _result
1526 }
1527
1528 pub fn send_no_shutdown_on_err(
1530 self,
1531 mut status: i32,
1532 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1533 ) -> Result<(), fidl::Error> {
1534 let _result = self.send_raw(status, guid);
1535 self.drop_without_shutdown();
1536 _result
1537 }
1538
1539 fn send_raw(
1540 &self,
1541 mut status: i32,
1542 mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1543 ) -> Result<(), fidl::Error> {
1544 self.control_handle
1545 .inner
1546 .send::<fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse>(
1547 (status, guid),
1548 self.tx_id,
1549 0x14a5a573b275d435,
1550 fidl::encoding::DynamicFlags::empty(),
1551 )
1552 }
1553}
1554
1555#[must_use = "FIDL methods require a response to be sent"]
1556#[derive(Debug)]
1557pub struct VolumeGetNameResponder {
1558 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1559 tx_id: u32,
1560}
1561
1562impl std::ops::Drop for VolumeGetNameResponder {
1566 fn drop(&mut self) {
1567 self.control_handle.shutdown();
1568 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1570 }
1571}
1572
1573impl fidl::endpoints::Responder for VolumeGetNameResponder {
1574 type ControlHandle = VolumeControlHandle;
1575
1576 fn control_handle(&self) -> &VolumeControlHandle {
1577 &self.control_handle
1578 }
1579
1580 fn drop_without_shutdown(mut self) {
1581 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1583 std::mem::forget(self);
1585 }
1586}
1587
1588impl VolumeGetNameResponder {
1589 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1593 let _result = self.send_raw(status, name);
1594 if _result.is_err() {
1595 self.control_handle.shutdown();
1596 }
1597 self.drop_without_shutdown();
1598 _result
1599 }
1600
1601 pub fn send_no_shutdown_on_err(
1603 self,
1604 mut status: i32,
1605 mut name: Option<&str>,
1606 ) -> Result<(), fidl::Error> {
1607 let _result = self.send_raw(status, name);
1608 self.drop_without_shutdown();
1609 _result
1610 }
1611
1612 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1613 self.control_handle
1614 .inner
1615 .send::<fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse>(
1616 (status, name),
1617 self.tx_id,
1618 0x7e3c6f0b0937fc02,
1619 fidl::encoding::DynamicFlags::empty(),
1620 )
1621 }
1622}
1623
1624#[must_use = "FIDL methods require a response to be sent"]
1625#[derive(Debug)]
1626pub struct VolumeGetMetadataResponder {
1627 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1628 tx_id: u32,
1629}
1630
1631impl std::ops::Drop for VolumeGetMetadataResponder {
1635 fn drop(&mut self) {
1636 self.control_handle.shutdown();
1637 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1639 }
1640}
1641
1642impl fidl::endpoints::Responder for VolumeGetMetadataResponder {
1643 type ControlHandle = VolumeControlHandle;
1644
1645 fn control_handle(&self) -> &VolumeControlHandle {
1646 &self.control_handle
1647 }
1648
1649 fn drop_without_shutdown(mut self) {
1650 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1652 std::mem::forget(self);
1654 }
1655}
1656
1657impl VolumeGetMetadataResponder {
1658 pub fn send(
1662 self,
1663 mut result: Result<
1664 &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1665 i32,
1666 >,
1667 ) -> Result<(), fidl::Error> {
1668 let _result = self.send_raw(result);
1669 if _result.is_err() {
1670 self.control_handle.shutdown();
1671 }
1672 self.drop_without_shutdown();
1673 _result
1674 }
1675
1676 pub fn send_no_shutdown_on_err(
1678 self,
1679 mut result: Result<
1680 &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1681 i32,
1682 >,
1683 ) -> Result<(), fidl::Error> {
1684 let _result = self.send_raw(result);
1685 self.drop_without_shutdown();
1686 _result
1687 }
1688
1689 fn send_raw(
1690 &self,
1691 mut result: Result<
1692 &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1693 i32,
1694 >,
1695 ) -> Result<(), fidl::Error> {
1696 self.control_handle.inner.send::<fidl::encoding::ResultType<
1697 fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1698 i32,
1699 >>(
1700 result,
1701 self.tx_id,
1702 0x42d1464c96c3f3ff,
1703 fidl::encoding::DynamicFlags::empty(),
1704 )
1705 }
1706}
1707
1708#[must_use = "FIDL methods require a response to be sent"]
1709#[derive(Debug)]
1710pub struct VolumeQuerySlicesResponder {
1711 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1712 tx_id: u32,
1713}
1714
1715impl std::ops::Drop for VolumeQuerySlicesResponder {
1719 fn drop(&mut self) {
1720 self.control_handle.shutdown();
1721 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1723 }
1724}
1725
1726impl fidl::endpoints::Responder for VolumeQuerySlicesResponder {
1727 type ControlHandle = VolumeControlHandle;
1728
1729 fn control_handle(&self) -> &VolumeControlHandle {
1730 &self.control_handle
1731 }
1732
1733 fn drop_without_shutdown(mut self) {
1734 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1736 std::mem::forget(self);
1738 }
1739}
1740
1741impl VolumeQuerySlicesResponder {
1742 pub fn send(
1746 self,
1747 mut status: i32,
1748 mut response: &[VsliceRange; 16],
1749 mut response_count: u64,
1750 ) -> Result<(), fidl::Error> {
1751 let _result = self.send_raw(status, response, response_count);
1752 if _result.is_err() {
1753 self.control_handle.shutdown();
1754 }
1755 self.drop_without_shutdown();
1756 _result
1757 }
1758
1759 pub fn send_no_shutdown_on_err(
1761 self,
1762 mut status: i32,
1763 mut response: &[VsliceRange; 16],
1764 mut response_count: u64,
1765 ) -> Result<(), fidl::Error> {
1766 let _result = self.send_raw(status, response, response_count);
1767 self.drop_without_shutdown();
1768 _result
1769 }
1770
1771 fn send_raw(
1772 &self,
1773 mut status: i32,
1774 mut response: &[VsliceRange; 16],
1775 mut response_count: u64,
1776 ) -> Result<(), fidl::Error> {
1777 self.control_handle.inner.send::<VolumeQuerySlicesResponse>(
1778 (status, response, response_count),
1779 self.tx_id,
1780 0x589a96828a3e2aa1,
1781 fidl::encoding::DynamicFlags::empty(),
1782 )
1783 }
1784}
1785
1786#[must_use = "FIDL methods require a response to be sent"]
1787#[derive(Debug)]
1788pub struct VolumeGetVolumeInfoResponder {
1789 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1790 tx_id: u32,
1791}
1792
1793impl std::ops::Drop for VolumeGetVolumeInfoResponder {
1797 fn drop(&mut self) {
1798 self.control_handle.shutdown();
1799 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1801 }
1802}
1803
1804impl fidl::endpoints::Responder for VolumeGetVolumeInfoResponder {
1805 type ControlHandle = VolumeControlHandle;
1806
1807 fn control_handle(&self) -> &VolumeControlHandle {
1808 &self.control_handle
1809 }
1810
1811 fn drop_without_shutdown(mut self) {
1812 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1814 std::mem::forget(self);
1816 }
1817}
1818
1819impl VolumeGetVolumeInfoResponder {
1820 pub fn send(
1824 self,
1825 mut status: i32,
1826 mut manager: Option<&VolumeManagerInfo>,
1827 mut volume: Option<&VolumeInfo>,
1828 ) -> Result<(), fidl::Error> {
1829 let _result = self.send_raw(status, manager, volume);
1830 if _result.is_err() {
1831 self.control_handle.shutdown();
1832 }
1833 self.drop_without_shutdown();
1834 _result
1835 }
1836
1837 pub fn send_no_shutdown_on_err(
1839 self,
1840 mut status: i32,
1841 mut manager: Option<&VolumeManagerInfo>,
1842 mut volume: Option<&VolumeInfo>,
1843 ) -> Result<(), fidl::Error> {
1844 let _result = self.send_raw(status, manager, volume);
1845 self.drop_without_shutdown();
1846 _result
1847 }
1848
1849 fn send_raw(
1850 &self,
1851 mut status: i32,
1852 mut manager: Option<&VolumeManagerInfo>,
1853 mut volume: Option<&VolumeInfo>,
1854 ) -> Result<(), fidl::Error> {
1855 self.control_handle.inner.send::<VolumeGetVolumeInfoResponse>(
1856 (status, manager, volume),
1857 self.tx_id,
1858 0x60417b6cf9e34c80,
1859 fidl::encoding::DynamicFlags::empty(),
1860 )
1861 }
1862}
1863
1864#[must_use = "FIDL methods require a response to be sent"]
1865#[derive(Debug)]
1866pub struct VolumeExtendResponder {
1867 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1868 tx_id: u32,
1869}
1870
1871impl std::ops::Drop for VolumeExtendResponder {
1875 fn drop(&mut self) {
1876 self.control_handle.shutdown();
1877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1879 }
1880}
1881
1882impl fidl::endpoints::Responder for VolumeExtendResponder {
1883 type ControlHandle = VolumeControlHandle;
1884
1885 fn control_handle(&self) -> &VolumeControlHandle {
1886 &self.control_handle
1887 }
1888
1889 fn drop_without_shutdown(mut self) {
1890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1892 std::mem::forget(self);
1894 }
1895}
1896
1897impl VolumeExtendResponder {
1898 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1902 let _result = self.send_raw(status);
1903 if _result.is_err() {
1904 self.control_handle.shutdown();
1905 }
1906 self.drop_without_shutdown();
1907 _result
1908 }
1909
1910 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1912 let _result = self.send_raw(status);
1913 self.drop_without_shutdown();
1914 _result
1915 }
1916
1917 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1918 self.control_handle.inner.send::<VolumeExtendResponse>(
1919 (status,),
1920 self.tx_id,
1921 0xdddf872f5039d37,
1922 fidl::encoding::DynamicFlags::empty(),
1923 )
1924 }
1925}
1926
1927#[must_use = "FIDL methods require a response to be sent"]
1928#[derive(Debug)]
1929pub struct VolumeShrinkResponder {
1930 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1931 tx_id: u32,
1932}
1933
1934impl std::ops::Drop for VolumeShrinkResponder {
1938 fn drop(&mut self) {
1939 self.control_handle.shutdown();
1940 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1942 }
1943}
1944
1945impl fidl::endpoints::Responder for VolumeShrinkResponder {
1946 type ControlHandle = VolumeControlHandle;
1947
1948 fn control_handle(&self) -> &VolumeControlHandle {
1949 &self.control_handle
1950 }
1951
1952 fn drop_without_shutdown(mut self) {
1953 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1955 std::mem::forget(self);
1957 }
1958}
1959
1960impl VolumeShrinkResponder {
1961 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1965 let _result = self.send_raw(status);
1966 if _result.is_err() {
1967 self.control_handle.shutdown();
1968 }
1969 self.drop_without_shutdown();
1970 _result
1971 }
1972
1973 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1975 let _result = self.send_raw(status);
1976 self.drop_without_shutdown();
1977 _result
1978 }
1979
1980 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1981 self.control_handle.inner.send::<VolumeShrinkResponse>(
1982 (status,),
1983 self.tx_id,
1984 0x27ab5ed4f6fdcd29,
1985 fidl::encoding::DynamicFlags::empty(),
1986 )
1987 }
1988}
1989
1990#[must_use = "FIDL methods require a response to be sent"]
1991#[derive(Debug)]
1992pub struct VolumeDestroyResponder {
1993 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1994 tx_id: u32,
1995}
1996
1997impl std::ops::Drop for VolumeDestroyResponder {
2001 fn drop(&mut self) {
2002 self.control_handle.shutdown();
2003 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2005 }
2006}
2007
2008impl fidl::endpoints::Responder for VolumeDestroyResponder {
2009 type ControlHandle = VolumeControlHandle;
2010
2011 fn control_handle(&self) -> &VolumeControlHandle {
2012 &self.control_handle
2013 }
2014
2015 fn drop_without_shutdown(mut self) {
2016 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2018 std::mem::forget(self);
2020 }
2021}
2022
2023impl VolumeDestroyResponder {
2024 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2028 let _result = self.send_raw(status);
2029 if _result.is_err() {
2030 self.control_handle.shutdown();
2031 }
2032 self.drop_without_shutdown();
2033 _result
2034 }
2035
2036 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2038 let _result = self.send_raw(status);
2039 self.drop_without_shutdown();
2040 _result
2041 }
2042
2043 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2044 self.control_handle.inner.send::<VolumeDestroyResponse>(
2045 (status,),
2046 self.tx_id,
2047 0x732bf4bea39b5e87,
2048 fidl::encoding::DynamicFlags::empty(),
2049 )
2050 }
2051}
2052
2053#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2054pub struct VolumeManagerMarker;
2055
2056impl fidl::endpoints::ProtocolMarker for VolumeManagerMarker {
2057 type Proxy = VolumeManagerProxy;
2058 type RequestStream = VolumeManagerRequestStream;
2059 #[cfg(target_os = "fuchsia")]
2060 type SynchronousProxy = VolumeManagerSynchronousProxy;
2061
2062 const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
2063}
2064pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
2065
2066pub trait VolumeManagerProxyInterface: Send + Sync {
2067 type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2068 fn r#allocate_partition(
2069 &self,
2070 slice_count: u64,
2071 type_: &fidl_fuchsia_hardware_block_partition::Guid,
2072 instance: &fidl_fuchsia_hardware_block_partition::Guid,
2073 name: &str,
2074 flags: u32,
2075 ) -> Self::AllocatePartitionResponseFut;
2076 type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
2077 + Send;
2078 fn r#get_info(&self) -> Self::GetInfoResponseFut;
2079 type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2080 fn r#activate(
2081 &self,
2082 old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2083 new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2084 ) -> Self::ActivateResponseFut;
2085 type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
2086 + Send;
2087 fn r#get_partition_limit(
2088 &self,
2089 guid: &fidl_fuchsia_hardware_block_partition::Guid,
2090 ) -> Self::GetPartitionLimitResponseFut;
2091 type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2092 fn r#set_partition_limit(
2093 &self,
2094 guid: &fidl_fuchsia_hardware_block_partition::Guid,
2095 slice_count: u64,
2096 ) -> Self::SetPartitionLimitResponseFut;
2097 type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
2098 + Send;
2099 fn r#set_partition_name(
2100 &self,
2101 guid: &fidl_fuchsia_hardware_block_partition::Guid,
2102 name: &str,
2103 ) -> Self::SetPartitionNameResponseFut;
2104}
2105#[derive(Debug)]
2106#[cfg(target_os = "fuchsia")]
2107pub struct VolumeManagerSynchronousProxy {
2108 client: fidl::client::sync::Client,
2109}
2110
2111#[cfg(target_os = "fuchsia")]
2112impl fidl::endpoints::SynchronousProxy for VolumeManagerSynchronousProxy {
2113 type Proxy = VolumeManagerProxy;
2114 type Protocol = VolumeManagerMarker;
2115
2116 fn from_channel(inner: fidl::Channel) -> Self {
2117 Self::new(inner)
2118 }
2119
2120 fn into_channel(self) -> fidl::Channel {
2121 self.client.into_channel()
2122 }
2123
2124 fn as_channel(&self) -> &fidl::Channel {
2125 self.client.as_channel()
2126 }
2127}
2128
2129#[cfg(target_os = "fuchsia")]
2130impl VolumeManagerSynchronousProxy {
2131 pub fn new(channel: fidl::Channel) -> Self {
2132 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2133 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2134 }
2135
2136 pub fn into_channel(self) -> fidl::Channel {
2137 self.client.into_channel()
2138 }
2139
2140 pub fn wait_for_event(
2143 &self,
2144 deadline: zx::MonotonicInstant,
2145 ) -> Result<VolumeManagerEvent, fidl::Error> {
2146 VolumeManagerEvent::decode(self.client.wait_for_event(deadline)?)
2147 }
2148
2149 pub fn r#allocate_partition(
2156 &self,
2157 mut slice_count: u64,
2158 mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2159 mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2160 mut name: &str,
2161 mut flags: u32,
2162 ___deadline: zx::MonotonicInstant,
2163 ) -> Result<i32, fidl::Error> {
2164 let _response = self.client.send_query::<
2165 VolumeManagerAllocatePartitionRequest,
2166 VolumeManagerAllocatePartitionResponse,
2167 >(
2168 (slice_count, type_, instance, name, flags,),
2169 0x4e79f24ed059e394,
2170 fidl::encoding::DynamicFlags::empty(),
2171 ___deadline,
2172 )?;
2173 Ok(_response.status)
2174 }
2175
2176 pub fn r#get_info(
2184 &self,
2185 ___deadline: zx::MonotonicInstant,
2186 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2187 let _response =
2188 self.client.send_query::<fidl::encoding::EmptyPayload, VolumeManagerGetInfoResponse>(
2189 (),
2190 0x735b3548582b2c9,
2191 fidl::encoding::DynamicFlags::empty(),
2192 ___deadline,
2193 )?;
2194 Ok((_response.status, _response.info))
2195 }
2196
2197 pub fn r#activate(
2213 &self,
2214 mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2215 mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2216 ___deadline: zx::MonotonicInstant,
2217 ) -> Result<i32, fidl::Error> {
2218 let _response =
2219 self.client.send_query::<VolumeManagerActivateRequest, VolumeManagerActivateResponse>(
2220 (old_guid, new_guid),
2221 0xc8cef57012874d0,
2222 fidl::encoding::DynamicFlags::empty(),
2223 ___deadline,
2224 )?;
2225 Ok(_response.status)
2226 }
2227
2228 pub fn r#get_partition_limit(
2238 &self,
2239 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2240 ___deadline: zx::MonotonicInstant,
2241 ) -> Result<(i32, u64), fidl::Error> {
2242 let _response = self.client.send_query::<
2243 VolumeManagerGetPartitionLimitRequest,
2244 VolumeManagerGetPartitionLimitResponse,
2245 >(
2246 (guid,),
2247 0x6e32f6df9fa2a919,
2248 fidl::encoding::DynamicFlags::empty(),
2249 ___deadline,
2250 )?;
2251 Ok((_response.status, _response.slice_count))
2252 }
2253
2254 pub fn r#set_partition_limit(
2266 &self,
2267 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2268 mut slice_count: u64,
2269 ___deadline: zx::MonotonicInstant,
2270 ) -> Result<i32, fidl::Error> {
2271 let _response = self.client.send_query::<
2272 VolumeManagerSetPartitionLimitRequest,
2273 VolumeManagerSetPartitionLimitResponse,
2274 >(
2275 (guid, slice_count,),
2276 0x2e09076ef266fa35,
2277 fidl::encoding::DynamicFlags::empty(),
2278 ___deadline,
2279 )?;
2280 Ok(_response.status)
2281 }
2282
2283 pub fn r#set_partition_name(
2287 &self,
2288 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2289 mut name: &str,
2290 ___deadline: zx::MonotonicInstant,
2291 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
2292 let _response = self.client.send_query::<
2293 VolumeManagerSetPartitionNameRequest,
2294 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2295 >(
2296 (guid, name,),
2297 0x4539a9b95cba0397,
2298 fidl::encoding::DynamicFlags::empty(),
2299 ___deadline,
2300 )?;
2301 Ok(_response.map(|x| x))
2302 }
2303}
2304
2305#[cfg(target_os = "fuchsia")]
2306impl From<VolumeManagerSynchronousProxy> for zx::NullableHandle {
2307 fn from(value: VolumeManagerSynchronousProxy) -> Self {
2308 value.into_channel().into()
2309 }
2310}
2311
2312#[cfg(target_os = "fuchsia")]
2313impl From<fidl::Channel> for VolumeManagerSynchronousProxy {
2314 fn from(value: fidl::Channel) -> Self {
2315 Self::new(value)
2316 }
2317}
2318
2319#[cfg(target_os = "fuchsia")]
2320impl fidl::endpoints::FromClient for VolumeManagerSynchronousProxy {
2321 type Protocol = VolumeManagerMarker;
2322
2323 fn from_client(value: fidl::endpoints::ClientEnd<VolumeManagerMarker>) -> Self {
2324 Self::new(value.into_channel())
2325 }
2326}
2327
2328#[derive(Debug, Clone)]
2329pub struct VolumeManagerProxy {
2330 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2331}
2332
2333impl fidl::endpoints::Proxy for VolumeManagerProxy {
2334 type Protocol = VolumeManagerMarker;
2335
2336 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2337 Self::new(inner)
2338 }
2339
2340 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2341 self.client.into_channel().map_err(|client| Self { client })
2342 }
2343
2344 fn as_channel(&self) -> &::fidl::AsyncChannel {
2345 self.client.as_channel()
2346 }
2347}
2348
2349impl VolumeManagerProxy {
2350 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2352 let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2353 Self { client: fidl::client::Client::new(channel, protocol_name) }
2354 }
2355
2356 pub fn take_event_stream(&self) -> VolumeManagerEventStream {
2362 VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
2363 }
2364
2365 pub fn r#allocate_partition(
2372 &self,
2373 mut slice_count: u64,
2374 mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2375 mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2376 mut name: &str,
2377 mut flags: u32,
2378 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2379 VolumeManagerProxyInterface::r#allocate_partition(
2380 self,
2381 slice_count,
2382 type_,
2383 instance,
2384 name,
2385 flags,
2386 )
2387 }
2388
2389 pub fn r#get_info(
2397 &self,
2398 ) -> fidl::client::QueryResponseFut<
2399 (i32, Option<Box<VolumeManagerInfo>>),
2400 fidl::encoding::DefaultFuchsiaResourceDialect,
2401 > {
2402 VolumeManagerProxyInterface::r#get_info(self)
2403 }
2404
2405 pub fn r#activate(
2421 &self,
2422 mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2423 mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2424 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2425 VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
2426 }
2427
2428 pub fn r#get_partition_limit(
2438 &self,
2439 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2440 ) -> fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
2441 {
2442 VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
2443 }
2444
2445 pub fn r#set_partition_limit(
2457 &self,
2458 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2459 mut slice_count: u64,
2460 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2461 VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
2462 }
2463
2464 pub fn r#set_partition_name(
2468 &self,
2469 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2470 mut name: &str,
2471 ) -> fidl::client::QueryResponseFut<
2472 VolumeManagerSetPartitionNameResult,
2473 fidl::encoding::DefaultFuchsiaResourceDialect,
2474 > {
2475 VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
2476 }
2477}
2478
2479impl VolumeManagerProxyInterface for VolumeManagerProxy {
2480 type AllocatePartitionResponseFut =
2481 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2482 fn r#allocate_partition(
2483 &self,
2484 mut slice_count: u64,
2485 mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2486 mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2487 mut name: &str,
2488 mut flags: u32,
2489 ) -> Self::AllocatePartitionResponseFut {
2490 fn _decode(
2491 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2492 ) -> Result<i32, fidl::Error> {
2493 let _response = fidl::client::decode_transaction_body::<
2494 VolumeManagerAllocatePartitionResponse,
2495 fidl::encoding::DefaultFuchsiaResourceDialect,
2496 0x4e79f24ed059e394,
2497 >(_buf?)?;
2498 Ok(_response.status)
2499 }
2500 self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
2501 (slice_count, type_, instance, name, flags),
2502 0x4e79f24ed059e394,
2503 fidl::encoding::DynamicFlags::empty(),
2504 _decode,
2505 )
2506 }
2507
2508 type GetInfoResponseFut = fidl::client::QueryResponseFut<
2509 (i32, Option<Box<VolumeManagerInfo>>),
2510 fidl::encoding::DefaultFuchsiaResourceDialect,
2511 >;
2512 fn r#get_info(&self) -> Self::GetInfoResponseFut {
2513 fn _decode(
2514 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2515 ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2516 let _response = fidl::client::decode_transaction_body::<
2517 VolumeManagerGetInfoResponse,
2518 fidl::encoding::DefaultFuchsiaResourceDialect,
2519 0x735b3548582b2c9,
2520 >(_buf?)?;
2521 Ok((_response.status, _response.info))
2522 }
2523 self.client.send_query_and_decode::<
2524 fidl::encoding::EmptyPayload,
2525 (i32, Option<Box<VolumeManagerInfo>>),
2526 >(
2527 (),
2528 0x735b3548582b2c9,
2529 fidl::encoding::DynamicFlags::empty(),
2530 _decode,
2531 )
2532 }
2533
2534 type ActivateResponseFut =
2535 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2536 fn r#activate(
2537 &self,
2538 mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2539 mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2540 ) -> Self::ActivateResponseFut {
2541 fn _decode(
2542 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2543 ) -> Result<i32, fidl::Error> {
2544 let _response = fidl::client::decode_transaction_body::<
2545 VolumeManagerActivateResponse,
2546 fidl::encoding::DefaultFuchsiaResourceDialect,
2547 0xc8cef57012874d0,
2548 >(_buf?)?;
2549 Ok(_response.status)
2550 }
2551 self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
2552 (old_guid, new_guid),
2553 0xc8cef57012874d0,
2554 fidl::encoding::DynamicFlags::empty(),
2555 _decode,
2556 )
2557 }
2558
2559 type GetPartitionLimitResponseFut =
2560 fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>;
2561 fn r#get_partition_limit(
2562 &self,
2563 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2564 ) -> Self::GetPartitionLimitResponseFut {
2565 fn _decode(
2566 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2567 ) -> Result<(i32, u64), fidl::Error> {
2568 let _response = fidl::client::decode_transaction_body::<
2569 VolumeManagerGetPartitionLimitResponse,
2570 fidl::encoding::DefaultFuchsiaResourceDialect,
2571 0x6e32f6df9fa2a919,
2572 >(_buf?)?;
2573 Ok((_response.status, _response.slice_count))
2574 }
2575 self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
2576 (guid,),
2577 0x6e32f6df9fa2a919,
2578 fidl::encoding::DynamicFlags::empty(),
2579 _decode,
2580 )
2581 }
2582
2583 type SetPartitionLimitResponseFut =
2584 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2585 fn r#set_partition_limit(
2586 &self,
2587 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2588 mut slice_count: u64,
2589 ) -> Self::SetPartitionLimitResponseFut {
2590 fn _decode(
2591 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2592 ) -> Result<i32, fidl::Error> {
2593 let _response = fidl::client::decode_transaction_body::<
2594 VolumeManagerSetPartitionLimitResponse,
2595 fidl::encoding::DefaultFuchsiaResourceDialect,
2596 0x2e09076ef266fa35,
2597 >(_buf?)?;
2598 Ok(_response.status)
2599 }
2600 self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
2601 (guid, slice_count),
2602 0x2e09076ef266fa35,
2603 fidl::encoding::DynamicFlags::empty(),
2604 _decode,
2605 )
2606 }
2607
2608 type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
2609 VolumeManagerSetPartitionNameResult,
2610 fidl::encoding::DefaultFuchsiaResourceDialect,
2611 >;
2612 fn r#set_partition_name(
2613 &self,
2614 mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2615 mut name: &str,
2616 ) -> Self::SetPartitionNameResponseFut {
2617 fn _decode(
2618 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2619 ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
2620 let _response = fidl::client::decode_transaction_body::<
2621 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2622 fidl::encoding::DefaultFuchsiaResourceDialect,
2623 0x4539a9b95cba0397,
2624 >(_buf?)?;
2625 Ok(_response.map(|x| x))
2626 }
2627 self.client.send_query_and_decode::<
2628 VolumeManagerSetPartitionNameRequest,
2629 VolumeManagerSetPartitionNameResult,
2630 >(
2631 (guid, name,),
2632 0x4539a9b95cba0397,
2633 fidl::encoding::DynamicFlags::empty(),
2634 _decode,
2635 )
2636 }
2637}
2638
2639pub struct VolumeManagerEventStream {
2640 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2641}
2642
2643impl std::marker::Unpin for VolumeManagerEventStream {}
2644
2645impl futures::stream::FusedStream for VolumeManagerEventStream {
2646 fn is_terminated(&self) -> bool {
2647 self.event_receiver.is_terminated()
2648 }
2649}
2650
2651impl futures::Stream for VolumeManagerEventStream {
2652 type Item = Result<VolumeManagerEvent, fidl::Error>;
2653
2654 fn poll_next(
2655 mut self: std::pin::Pin<&mut Self>,
2656 cx: &mut std::task::Context<'_>,
2657 ) -> std::task::Poll<Option<Self::Item>> {
2658 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2659 &mut self.event_receiver,
2660 cx
2661 )?) {
2662 Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
2663 None => std::task::Poll::Ready(None),
2664 }
2665 }
2666}
2667
2668#[derive(Debug)]
2669pub enum VolumeManagerEvent {}
2670
2671impl VolumeManagerEvent {
2672 fn decode(
2674 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2675 ) -> Result<VolumeManagerEvent, fidl::Error> {
2676 let (bytes, _handles) = buf.split_mut();
2677 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2678 debug_assert_eq!(tx_header.tx_id, 0);
2679 match tx_header.ordinal {
2680 _ => Err(fidl::Error::UnknownOrdinal {
2681 ordinal: tx_header.ordinal,
2682 protocol_name: <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2683 }),
2684 }
2685 }
2686}
2687
2688pub struct VolumeManagerRequestStream {
2690 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2691 is_terminated: bool,
2692}
2693
2694impl std::marker::Unpin for VolumeManagerRequestStream {}
2695
2696impl futures::stream::FusedStream for VolumeManagerRequestStream {
2697 fn is_terminated(&self) -> bool {
2698 self.is_terminated
2699 }
2700}
2701
2702impl fidl::endpoints::RequestStream for VolumeManagerRequestStream {
2703 type Protocol = VolumeManagerMarker;
2704 type ControlHandle = VolumeManagerControlHandle;
2705
2706 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2707 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2708 }
2709
2710 fn control_handle(&self) -> Self::ControlHandle {
2711 VolumeManagerControlHandle { inner: self.inner.clone() }
2712 }
2713
2714 fn into_inner(
2715 self,
2716 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2717 {
2718 (self.inner, self.is_terminated)
2719 }
2720
2721 fn from_inner(
2722 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2723 is_terminated: bool,
2724 ) -> Self {
2725 Self { inner, is_terminated }
2726 }
2727}
2728
2729impl futures::Stream for VolumeManagerRequestStream {
2730 type Item = Result<VolumeManagerRequest, fidl::Error>;
2731
2732 fn poll_next(
2733 mut self: std::pin::Pin<&mut Self>,
2734 cx: &mut std::task::Context<'_>,
2735 ) -> std::task::Poll<Option<Self::Item>> {
2736 let this = &mut *self;
2737 if this.inner.check_shutdown(cx) {
2738 this.is_terminated = true;
2739 return std::task::Poll::Ready(None);
2740 }
2741 if this.is_terminated {
2742 panic!("polled VolumeManagerRequestStream after completion");
2743 }
2744 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2745 |bytes, handles| {
2746 match this.inner.channel().read_etc(cx, bytes, handles) {
2747 std::task::Poll::Ready(Ok(())) => {}
2748 std::task::Poll::Pending => return std::task::Poll::Pending,
2749 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2750 this.is_terminated = true;
2751 return std::task::Poll::Ready(None);
2752 }
2753 std::task::Poll::Ready(Err(e)) => {
2754 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2755 e.into(),
2756 ))));
2757 }
2758 }
2759
2760 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2762
2763 std::task::Poll::Ready(Some(match header.ordinal {
2764 0x4e79f24ed059e394 => {
2765 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2766 let mut req = fidl::new_empty!(
2767 VolumeManagerAllocatePartitionRequest,
2768 fidl::encoding::DefaultFuchsiaResourceDialect
2769 );
2770 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
2771 let control_handle =
2772 VolumeManagerControlHandle { inner: this.inner.clone() };
2773 Ok(VolumeManagerRequest::AllocatePartition {
2774 slice_count: req.slice_count,
2775 type_: req.type_,
2776 instance: req.instance,
2777 name: req.name,
2778 flags: req.flags,
2779
2780 responder: VolumeManagerAllocatePartitionResponder {
2781 control_handle: std::mem::ManuallyDrop::new(control_handle),
2782 tx_id: header.tx_id,
2783 },
2784 })
2785 }
2786 0x735b3548582b2c9 => {
2787 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2788 let mut req = fidl::new_empty!(
2789 fidl::encoding::EmptyPayload,
2790 fidl::encoding::DefaultFuchsiaResourceDialect
2791 );
2792 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2793 let control_handle =
2794 VolumeManagerControlHandle { inner: this.inner.clone() };
2795 Ok(VolumeManagerRequest::GetInfo {
2796 responder: VolumeManagerGetInfoResponder {
2797 control_handle: std::mem::ManuallyDrop::new(control_handle),
2798 tx_id: header.tx_id,
2799 },
2800 })
2801 }
2802 0xc8cef57012874d0 => {
2803 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2804 let mut req = fidl::new_empty!(
2805 VolumeManagerActivateRequest,
2806 fidl::encoding::DefaultFuchsiaResourceDialect
2807 );
2808 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
2809 let control_handle =
2810 VolumeManagerControlHandle { inner: this.inner.clone() };
2811 Ok(VolumeManagerRequest::Activate {
2812 old_guid: req.old_guid,
2813 new_guid: req.new_guid,
2814
2815 responder: VolumeManagerActivateResponder {
2816 control_handle: std::mem::ManuallyDrop::new(control_handle),
2817 tx_id: header.tx_id,
2818 },
2819 })
2820 }
2821 0x6e32f6df9fa2a919 => {
2822 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2823 let mut req = fidl::new_empty!(
2824 VolumeManagerGetPartitionLimitRequest,
2825 fidl::encoding::DefaultFuchsiaResourceDialect
2826 );
2827 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
2828 let control_handle =
2829 VolumeManagerControlHandle { inner: this.inner.clone() };
2830 Ok(VolumeManagerRequest::GetPartitionLimit {
2831 guid: req.guid,
2832
2833 responder: VolumeManagerGetPartitionLimitResponder {
2834 control_handle: std::mem::ManuallyDrop::new(control_handle),
2835 tx_id: header.tx_id,
2836 },
2837 })
2838 }
2839 0x2e09076ef266fa35 => {
2840 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2841 let mut req = fidl::new_empty!(
2842 VolumeManagerSetPartitionLimitRequest,
2843 fidl::encoding::DefaultFuchsiaResourceDialect
2844 );
2845 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
2846 let control_handle =
2847 VolumeManagerControlHandle { inner: this.inner.clone() };
2848 Ok(VolumeManagerRequest::SetPartitionLimit {
2849 guid: req.guid,
2850 slice_count: req.slice_count,
2851
2852 responder: VolumeManagerSetPartitionLimitResponder {
2853 control_handle: std::mem::ManuallyDrop::new(control_handle),
2854 tx_id: header.tx_id,
2855 },
2856 })
2857 }
2858 0x4539a9b95cba0397 => {
2859 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2860 let mut req = fidl::new_empty!(
2861 VolumeManagerSetPartitionNameRequest,
2862 fidl::encoding::DefaultFuchsiaResourceDialect
2863 );
2864 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
2865 let control_handle =
2866 VolumeManagerControlHandle { inner: this.inner.clone() };
2867 Ok(VolumeManagerRequest::SetPartitionName {
2868 guid: req.guid,
2869 name: req.name,
2870
2871 responder: VolumeManagerSetPartitionNameResponder {
2872 control_handle: std::mem::ManuallyDrop::new(control_handle),
2873 tx_id: header.tx_id,
2874 },
2875 })
2876 }
2877 _ => Err(fidl::Error::UnknownOrdinal {
2878 ordinal: header.ordinal,
2879 protocol_name:
2880 <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2881 }),
2882 }))
2883 },
2884 )
2885 }
2886}
2887
2888#[derive(Debug)]
2890pub enum VolumeManagerRequest {
2891 AllocatePartition {
2898 slice_count: u64,
2899 type_: fidl_fuchsia_hardware_block_partition::Guid,
2900 instance: fidl_fuchsia_hardware_block_partition::Guid,
2901 name: String,
2902 flags: u32,
2903 responder: VolumeManagerAllocatePartitionResponder,
2904 },
2905 GetInfo { responder: VolumeManagerGetInfoResponder },
2913 Activate {
2929 old_guid: fidl_fuchsia_hardware_block_partition::Guid,
2930 new_guid: fidl_fuchsia_hardware_block_partition::Guid,
2931 responder: VolumeManagerActivateResponder,
2932 },
2933 GetPartitionLimit {
2943 guid: fidl_fuchsia_hardware_block_partition::Guid,
2944 responder: VolumeManagerGetPartitionLimitResponder,
2945 },
2946 SetPartitionLimit {
2958 guid: fidl_fuchsia_hardware_block_partition::Guid,
2959 slice_count: u64,
2960 responder: VolumeManagerSetPartitionLimitResponder,
2961 },
2962 SetPartitionName {
2966 guid: fidl_fuchsia_hardware_block_partition::Guid,
2967 name: String,
2968 responder: VolumeManagerSetPartitionNameResponder,
2969 },
2970}
2971
2972impl VolumeManagerRequest {
2973 #[allow(irrefutable_let_patterns)]
2974 pub fn into_allocate_partition(
2975 self,
2976 ) -> Option<(
2977 u64,
2978 fidl_fuchsia_hardware_block_partition::Guid,
2979 fidl_fuchsia_hardware_block_partition::Guid,
2980 String,
2981 u32,
2982 VolumeManagerAllocatePartitionResponder,
2983 )> {
2984 if let VolumeManagerRequest::AllocatePartition {
2985 slice_count,
2986 type_,
2987 instance,
2988 name,
2989 flags,
2990 responder,
2991 } = self
2992 {
2993 Some((slice_count, type_, instance, name, flags, responder))
2994 } else {
2995 None
2996 }
2997 }
2998
2999 #[allow(irrefutable_let_patterns)]
3000 pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
3001 if let VolumeManagerRequest::GetInfo { responder } = self {
3002 Some((responder))
3003 } else {
3004 None
3005 }
3006 }
3007
3008 #[allow(irrefutable_let_patterns)]
3009 pub fn into_activate(
3010 self,
3011 ) -> Option<(
3012 fidl_fuchsia_hardware_block_partition::Guid,
3013 fidl_fuchsia_hardware_block_partition::Guid,
3014 VolumeManagerActivateResponder,
3015 )> {
3016 if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
3017 Some((old_guid, new_guid, responder))
3018 } else {
3019 None
3020 }
3021 }
3022
3023 #[allow(irrefutable_let_patterns)]
3024 pub fn into_get_partition_limit(
3025 self,
3026 ) -> Option<(
3027 fidl_fuchsia_hardware_block_partition::Guid,
3028 VolumeManagerGetPartitionLimitResponder,
3029 )> {
3030 if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
3031 Some((guid, responder))
3032 } else {
3033 None
3034 }
3035 }
3036
3037 #[allow(irrefutable_let_patterns)]
3038 pub fn into_set_partition_limit(
3039 self,
3040 ) -> Option<(
3041 fidl_fuchsia_hardware_block_partition::Guid,
3042 u64,
3043 VolumeManagerSetPartitionLimitResponder,
3044 )> {
3045 if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
3046 Some((guid, slice_count, responder))
3047 } else {
3048 None
3049 }
3050 }
3051
3052 #[allow(irrefutable_let_patterns)]
3053 pub fn into_set_partition_name(
3054 self,
3055 ) -> Option<(
3056 fidl_fuchsia_hardware_block_partition::Guid,
3057 String,
3058 VolumeManagerSetPartitionNameResponder,
3059 )> {
3060 if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
3061 Some((guid, name, responder))
3062 } else {
3063 None
3064 }
3065 }
3066
3067 pub fn method_name(&self) -> &'static str {
3069 match *self {
3070 VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
3071 VolumeManagerRequest::GetInfo { .. } => "get_info",
3072 VolumeManagerRequest::Activate { .. } => "activate",
3073 VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
3074 VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
3075 VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
3076 }
3077 }
3078}
3079
3080#[derive(Debug, Clone)]
3081pub struct VolumeManagerControlHandle {
3082 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3083}
3084
3085impl fidl::endpoints::ControlHandle for VolumeManagerControlHandle {
3086 fn shutdown(&self) {
3087 self.inner.shutdown()
3088 }
3089
3090 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3091 self.inner.shutdown_with_epitaph(status)
3092 }
3093
3094 fn is_closed(&self) -> bool {
3095 self.inner.channel().is_closed()
3096 }
3097 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3098 self.inner.channel().on_closed()
3099 }
3100
3101 #[cfg(target_os = "fuchsia")]
3102 fn signal_peer(
3103 &self,
3104 clear_mask: zx::Signals,
3105 set_mask: zx::Signals,
3106 ) -> Result<(), zx_status::Status> {
3107 use fidl::Peered;
3108 self.inner.channel().signal_peer(clear_mask, set_mask)
3109 }
3110}
3111
3112impl VolumeManagerControlHandle {}
3113
3114#[must_use = "FIDL methods require a response to be sent"]
3115#[derive(Debug)]
3116pub struct VolumeManagerAllocatePartitionResponder {
3117 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3118 tx_id: u32,
3119}
3120
3121impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
3125 fn drop(&mut self) {
3126 self.control_handle.shutdown();
3127 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3129 }
3130}
3131
3132impl fidl::endpoints::Responder for VolumeManagerAllocatePartitionResponder {
3133 type ControlHandle = VolumeManagerControlHandle;
3134
3135 fn control_handle(&self) -> &VolumeManagerControlHandle {
3136 &self.control_handle
3137 }
3138
3139 fn drop_without_shutdown(mut self) {
3140 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3142 std::mem::forget(self);
3144 }
3145}
3146
3147impl VolumeManagerAllocatePartitionResponder {
3148 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3152 let _result = self.send_raw(status);
3153 if _result.is_err() {
3154 self.control_handle.shutdown();
3155 }
3156 self.drop_without_shutdown();
3157 _result
3158 }
3159
3160 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3162 let _result = self.send_raw(status);
3163 self.drop_without_shutdown();
3164 _result
3165 }
3166
3167 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3168 self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
3169 (status,),
3170 self.tx_id,
3171 0x4e79f24ed059e394,
3172 fidl::encoding::DynamicFlags::empty(),
3173 )
3174 }
3175}
3176
3177#[must_use = "FIDL methods require a response to be sent"]
3178#[derive(Debug)]
3179pub struct VolumeManagerGetInfoResponder {
3180 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3181 tx_id: u32,
3182}
3183
3184impl std::ops::Drop for VolumeManagerGetInfoResponder {
3188 fn drop(&mut self) {
3189 self.control_handle.shutdown();
3190 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3192 }
3193}
3194
3195impl fidl::endpoints::Responder for VolumeManagerGetInfoResponder {
3196 type ControlHandle = VolumeManagerControlHandle;
3197
3198 fn control_handle(&self) -> &VolumeManagerControlHandle {
3199 &self.control_handle
3200 }
3201
3202 fn drop_without_shutdown(mut self) {
3203 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3205 std::mem::forget(self);
3207 }
3208}
3209
3210impl VolumeManagerGetInfoResponder {
3211 pub fn send(
3215 self,
3216 mut status: i32,
3217 mut info: Option<&VolumeManagerInfo>,
3218 ) -> Result<(), fidl::Error> {
3219 let _result = self.send_raw(status, info);
3220 if _result.is_err() {
3221 self.control_handle.shutdown();
3222 }
3223 self.drop_without_shutdown();
3224 _result
3225 }
3226
3227 pub fn send_no_shutdown_on_err(
3229 self,
3230 mut status: i32,
3231 mut info: Option<&VolumeManagerInfo>,
3232 ) -> Result<(), fidl::Error> {
3233 let _result = self.send_raw(status, info);
3234 self.drop_without_shutdown();
3235 _result
3236 }
3237
3238 fn send_raw(
3239 &self,
3240 mut status: i32,
3241 mut info: Option<&VolumeManagerInfo>,
3242 ) -> Result<(), fidl::Error> {
3243 self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
3244 (status, info),
3245 self.tx_id,
3246 0x735b3548582b2c9,
3247 fidl::encoding::DynamicFlags::empty(),
3248 )
3249 }
3250}
3251
3252#[must_use = "FIDL methods require a response to be sent"]
3253#[derive(Debug)]
3254pub struct VolumeManagerActivateResponder {
3255 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3256 tx_id: u32,
3257}
3258
3259impl std::ops::Drop for VolumeManagerActivateResponder {
3263 fn drop(&mut self) {
3264 self.control_handle.shutdown();
3265 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3267 }
3268}
3269
3270impl fidl::endpoints::Responder for VolumeManagerActivateResponder {
3271 type ControlHandle = VolumeManagerControlHandle;
3272
3273 fn control_handle(&self) -> &VolumeManagerControlHandle {
3274 &self.control_handle
3275 }
3276
3277 fn drop_without_shutdown(mut self) {
3278 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3280 std::mem::forget(self);
3282 }
3283}
3284
3285impl VolumeManagerActivateResponder {
3286 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3290 let _result = self.send_raw(status);
3291 if _result.is_err() {
3292 self.control_handle.shutdown();
3293 }
3294 self.drop_without_shutdown();
3295 _result
3296 }
3297
3298 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3300 let _result = self.send_raw(status);
3301 self.drop_without_shutdown();
3302 _result
3303 }
3304
3305 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3306 self.control_handle.inner.send::<VolumeManagerActivateResponse>(
3307 (status,),
3308 self.tx_id,
3309 0xc8cef57012874d0,
3310 fidl::encoding::DynamicFlags::empty(),
3311 )
3312 }
3313}
3314
3315#[must_use = "FIDL methods require a response to be sent"]
3316#[derive(Debug)]
3317pub struct VolumeManagerGetPartitionLimitResponder {
3318 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3319 tx_id: u32,
3320}
3321
3322impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
3326 fn drop(&mut self) {
3327 self.control_handle.shutdown();
3328 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3330 }
3331}
3332
3333impl fidl::endpoints::Responder for VolumeManagerGetPartitionLimitResponder {
3334 type ControlHandle = VolumeManagerControlHandle;
3335
3336 fn control_handle(&self) -> &VolumeManagerControlHandle {
3337 &self.control_handle
3338 }
3339
3340 fn drop_without_shutdown(mut self) {
3341 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3343 std::mem::forget(self);
3345 }
3346}
3347
3348impl VolumeManagerGetPartitionLimitResponder {
3349 pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
3353 let _result = self.send_raw(status, slice_count);
3354 if _result.is_err() {
3355 self.control_handle.shutdown();
3356 }
3357 self.drop_without_shutdown();
3358 _result
3359 }
3360
3361 pub fn send_no_shutdown_on_err(
3363 self,
3364 mut status: i32,
3365 mut slice_count: u64,
3366 ) -> Result<(), fidl::Error> {
3367 let _result = self.send_raw(status, slice_count);
3368 self.drop_without_shutdown();
3369 _result
3370 }
3371
3372 fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
3373 self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
3374 (status, slice_count),
3375 self.tx_id,
3376 0x6e32f6df9fa2a919,
3377 fidl::encoding::DynamicFlags::empty(),
3378 )
3379 }
3380}
3381
3382#[must_use = "FIDL methods require a response to be sent"]
3383#[derive(Debug)]
3384pub struct VolumeManagerSetPartitionLimitResponder {
3385 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3386 tx_id: u32,
3387}
3388
3389impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
3393 fn drop(&mut self) {
3394 self.control_handle.shutdown();
3395 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3397 }
3398}
3399
3400impl fidl::endpoints::Responder for VolumeManagerSetPartitionLimitResponder {
3401 type ControlHandle = VolumeManagerControlHandle;
3402
3403 fn control_handle(&self) -> &VolumeManagerControlHandle {
3404 &self.control_handle
3405 }
3406
3407 fn drop_without_shutdown(mut self) {
3408 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3410 std::mem::forget(self);
3412 }
3413}
3414
3415impl VolumeManagerSetPartitionLimitResponder {
3416 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3420 let _result = self.send_raw(status);
3421 if _result.is_err() {
3422 self.control_handle.shutdown();
3423 }
3424 self.drop_without_shutdown();
3425 _result
3426 }
3427
3428 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3430 let _result = self.send_raw(status);
3431 self.drop_without_shutdown();
3432 _result
3433 }
3434
3435 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3436 self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
3437 (status,),
3438 self.tx_id,
3439 0x2e09076ef266fa35,
3440 fidl::encoding::DynamicFlags::empty(),
3441 )
3442 }
3443}
3444
3445#[must_use = "FIDL methods require a response to be sent"]
3446#[derive(Debug)]
3447pub struct VolumeManagerSetPartitionNameResponder {
3448 control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3449 tx_id: u32,
3450}
3451
3452impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
3456 fn drop(&mut self) {
3457 self.control_handle.shutdown();
3458 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3460 }
3461}
3462
3463impl fidl::endpoints::Responder for VolumeManagerSetPartitionNameResponder {
3464 type ControlHandle = VolumeManagerControlHandle;
3465
3466 fn control_handle(&self) -> &VolumeManagerControlHandle {
3467 &self.control_handle
3468 }
3469
3470 fn drop_without_shutdown(mut self) {
3471 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3473 std::mem::forget(self);
3475 }
3476}
3477
3478impl VolumeManagerSetPartitionNameResponder {
3479 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3483 let _result = self.send_raw(result);
3484 if _result.is_err() {
3485 self.control_handle.shutdown();
3486 }
3487 self.drop_without_shutdown();
3488 _result
3489 }
3490
3491 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3493 let _result = self.send_raw(result);
3494 self.drop_without_shutdown();
3495 _result
3496 }
3497
3498 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3499 self.control_handle
3500 .inner
3501 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3502 result,
3503 self.tx_id,
3504 0x4539a9b95cba0397,
3505 fidl::encoding::DynamicFlags::empty(),
3506 )
3507 }
3508}
3509
3510#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3511pub struct ServiceMarker;
3512
3513#[cfg(target_os = "fuchsia")]
3514impl fidl::endpoints::ServiceMarker for ServiceMarker {
3515 type Proxy = ServiceProxy;
3516 type Request = ServiceRequest;
3517 const SERVICE_NAME: &'static str = "fuchsia.hardware.block.volume.Service";
3518}
3519
3520#[cfg(target_os = "fuchsia")]
3523pub enum ServiceRequest {
3524 Volume(VolumeRequestStream),
3525}
3526
3527#[cfg(target_os = "fuchsia")]
3528impl fidl::endpoints::ServiceRequest for ServiceRequest {
3529 type Service = ServiceMarker;
3530
3531 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
3532 match name {
3533 "volume" => Self::Volume(
3534 <VolumeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
3535 ),
3536 _ => panic!("no such member protocol name for service Service"),
3537 }
3538 }
3539
3540 fn member_names() -> &'static [&'static str] {
3541 &["volume"]
3542 }
3543}
3544#[cfg(target_os = "fuchsia")]
3545pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
3546
3547#[cfg(target_os = "fuchsia")]
3548impl fidl::endpoints::ServiceProxy for ServiceProxy {
3549 type Service = ServiceMarker;
3550
3551 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
3552 Self(opener)
3553 }
3554}
3555
3556#[cfg(target_os = "fuchsia")]
3557impl ServiceProxy {
3558 pub fn connect_to_volume(&self) -> Result<VolumeProxy, fidl::Error> {
3559 let (proxy, server_end) = fidl::endpoints::create_proxy::<VolumeMarker>();
3560 self.connect_channel_to_volume(server_end)?;
3561 Ok(proxy)
3562 }
3563
3564 pub fn connect_to_volume_sync(&self) -> Result<VolumeSynchronousProxy, fidl::Error> {
3567 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<VolumeMarker>();
3568 self.connect_channel_to_volume(server_end)?;
3569 Ok(proxy)
3570 }
3571
3572 pub fn connect_channel_to_volume(
3575 &self,
3576 server_end: fidl::endpoints::ServerEnd<VolumeMarker>,
3577 ) -> Result<(), fidl::Error> {
3578 self.0.open_member("volume", server_end.into_channel())
3579 }
3580
3581 pub fn instance_name(&self) -> &str {
3582 self.0.instance_name()
3583 }
3584}
3585
3586mod internal {
3587 use super::*;
3588}