fidl_fuchsia_hardware_block_volume/
fidl_fuchsia_hardware_block_volume.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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        offset_map: Option<
40            fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
41        >,
42        initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
43    ) -> Result<(), fidl::Error>;
44    type GetTypeGuidResponseFut: std::future::Future<
45            Output = Result<
46                (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
47                fidl::Error,
48            >,
49        > + Send;
50    fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
51    type GetInstanceGuidResponseFut: std::future::Future<
52            Output = Result<
53                (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
54                fidl::Error,
55            >,
56        > + Send;
57    fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
58    type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
59        + Send;
60    fn r#get_name(&self) -> Self::GetNameResponseFut;
61    type GetMetadataResponseFut: std::future::Future<
62            Output = Result<
63                fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
64                fidl::Error,
65            >,
66        > + Send;
67    fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
68    type QuerySlicesResponseFut: std::future::Future<Output = Result<(i32, [VsliceRange; 16], u64), fidl::Error>>
69        + Send;
70    fn r#query_slices(&self, start_slices: &[u64]) -> Self::QuerySlicesResponseFut;
71    type GetVolumeInfoResponseFut: std::future::Future<
72            Output = Result<
73                (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
74                fidl::Error,
75            >,
76        > + Send;
77    fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut;
78    type ExtendResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
79    fn r#extend(&self, start_slice: u64, slice_count: u64) -> Self::ExtendResponseFut;
80    type ShrinkResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
81    fn r#shrink(&self, start_slice: u64, slice_count: u64) -> Self::ShrinkResponseFut;
82    type DestroyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
83    fn r#destroy(&self) -> Self::DestroyResponseFut;
84}
85#[derive(Debug)]
86#[cfg(target_os = "fuchsia")]
87pub struct VolumeSynchronousProxy {
88    client: fidl::client::sync::Client,
89}
90
91#[cfg(target_os = "fuchsia")]
92impl fidl::endpoints::SynchronousProxy for VolumeSynchronousProxy {
93    type Proxy = VolumeProxy;
94    type Protocol = VolumeMarker;
95
96    fn from_channel(inner: fidl::Channel) -> Self {
97        Self::new(inner)
98    }
99
100    fn into_channel(self) -> fidl::Channel {
101        self.client.into_channel()
102    }
103
104    fn as_channel(&self) -> &fidl::Channel {
105        self.client.as_channel()
106    }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl VolumeSynchronousProxy {
111    pub fn new(channel: fidl::Channel) -> Self {
112        let protocol_name = <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
113        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
114    }
115
116    pub fn into_channel(self) -> fidl::Channel {
117        self.client.into_channel()
118    }
119
120    /// Waits until an event arrives and returns it. It is safe for other
121    /// threads to make concurrent requests while waiting for an event.
122    pub fn wait_for_event(
123        &self,
124        deadline: zx::MonotonicInstant,
125    ) -> Result<VolumeEvent, fidl::Error> {
126        VolumeEvent::decode(self.client.wait_for_event(deadline)?)
127    }
128
129    /// Get information about the underlying block device.
130    pub fn r#get_info(
131        &self,
132        ___deadline: zx::MonotonicInstant,
133    ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
134        let _response =
135            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
136                fidl_fuchsia_hardware_block::BlockGetInfoResponse,
137                i32,
138            >>(
139                (),
140                0x79df1a5cdb6cc6a3,
141                fidl::encoding::DynamicFlags::empty(),
142                ___deadline,
143            )?;
144        Ok(_response.map(|x| x.info))
145    }
146
147    /// Opens a new FIFO-based session on the block device.
148    pub fn r#open_session(
149        &self,
150        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
151    ) -> Result<(), fidl::Error> {
152        self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
153            (session,),
154            0x7241c68d17614a31,
155            fidl::encoding::DynamicFlags::empty(),
156        )
157    }
158
159    /// Opens a new FIFO-based session on the block device, providing an offset lookup map which
160    /// transparently translates device offsets in block FIFO requests.
161    ///
162    /// `initial_mappings` is a static set of mappings which the server can immediately use.  If
163    /// `offset_map` is not provided, this must be non-empty, and requests that fall outside of the
164    /// mapped range will fail.
165    ///
166    /// If `offset_map` is provided, whenever the server receives a request with a dev_offset that
167    /// falls outside of the known range, it will consult `offset_map` to attempt to resolve the
168    /// offset.  Because these offset mappings must be stable for the duration of the session, the
169    /// server may cache any mappings.
170    ///
171    /// This interface is intended to be used internally between nested Block implementations, in
172    /// order to provide passthrough I/O.  For example, a fixed partition map (e.g. GPT) will serve
173    /// a Block protocol for each partition, and will respond to OpenSession requests by calling
174    /// OpenSessionWithOffsetMap on the underlying block device, establishing itself as the source
175    /// for translating client block offsets (relative to the partition start) to absolute offsets.
176    /// The client can then communicate directly with the underlying block device, and the partition
177    /// offsets can be transparently applied to requests.
178    pub fn r#open_session_with_offset_map(
179        &self,
180        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
181        mut offset_map: Option<
182            fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
183        >,
184        mut initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
185    ) -> Result<(), fidl::Error> {
186        self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
187            (session, offset_map, initial_mappings),
188            0x7a8d3ba3d8bfa10f,
189            fidl::encoding::DynamicFlags::empty(),
190        )
191    }
192
193    /// Gets the type GUID of the partition (if one exists).
194    /// If the partition has no type GUID, ZX_ERR_NOT_SUPPORTED is returned.
195    pub fn r#get_type_guid(
196        &self,
197        ___deadline: zx::MonotonicInstant,
198    ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error> {
199        let _response = self.client.send_query::<
200            fidl::encoding::EmptyPayload,
201            fidl_fuchsia_hardware_block_partition::PartitionGetTypeGuidResponse,
202        >(
203            (),
204            0x111843d737a9b847,
205            fidl::encoding::DynamicFlags::empty(),
206            ___deadline,
207        )?;
208        Ok((_response.status, _response.guid))
209    }
210
211    /// Gets the instance GUID of the partition (if one exists).
212    /// If the partition has no instance GUID, ZX_ERR_NOT_SUPPORTED is returned.
213    pub fn r#get_instance_guid(
214        &self,
215        ___deadline: zx::MonotonicInstant,
216    ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error> {
217        let _response = self.client.send_query::<
218            fidl::encoding::EmptyPayload,
219            fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse,
220        >(
221            (),
222            0x14a5a573b275d435,
223            fidl::encoding::DynamicFlags::empty(),
224            ___deadline,
225        )?;
226        Ok((_response.status, _response.guid))
227    }
228
229    /// Gets the name of the partition (if one exists).
230    /// If the partition has no name, ZX_ERR_NOT_SUPPORTED is returned.
231    pub fn r#get_name(
232        &self,
233        ___deadline: zx::MonotonicInstant,
234    ) -> Result<(i32, Option<String>), fidl::Error> {
235        let _response = self.client.send_query::<
236            fidl::encoding::EmptyPayload,
237            fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse,
238        >(
239            (),
240            0x7e3c6f0b0937fc02,
241            fidl::encoding::DynamicFlags::empty(),
242            ___deadline,
243        )?;
244        Ok((_response.status, _response.name))
245    }
246
247    /// Gets the metadata for the partition.
248    ///
249    /// Fields may be absent if the partition doesn't have the given metadata.
250    pub fn r#get_metadata(
251        &self,
252        ___deadline: zx::MonotonicInstant,
253    ) -> Result<fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult, fidl::Error>
254    {
255        let _response = self
256            .client
257            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
258                fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
259                i32,
260            >>(
261                (), 0x42d1464c96c3f3ff, fidl::encoding::DynamicFlags::empty(), ___deadline
262            )?;
263        Ok(_response.map(|x| x))
264    }
265
266    /// Returns the number of contiguous allocated (or unallocated) vslices
267    /// starting from each vslice.
268    pub fn r#query_slices(
269        &self,
270        mut start_slices: &[u64],
271        ___deadline: zx::MonotonicInstant,
272    ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
273        let _response =
274            self.client.send_query::<VolumeQuerySlicesRequest, VolumeQuerySlicesResponse>(
275                (start_slices,),
276                0x589a96828a3e2aa1,
277                fidl::encoding::DynamicFlags::empty(),
278                ___deadline,
279            )?;
280        Ok((_response.status, _response.response, _response.response_count))
281    }
282
283    /// Returns the information about this volume and the volume manager it is embedded in.
284    pub fn r#get_volume_info(
285        &self,
286        ___deadline: zx::MonotonicInstant,
287    ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error> {
288        let _response =
289            self.client.send_query::<fidl::encoding::EmptyPayload, VolumeGetVolumeInfoResponse>(
290                (),
291                0x60417b6cf9e34c80,
292                fidl::encoding::DynamicFlags::empty(),
293                ___deadline,
294            )?;
295        Ok((_response.status, _response.manager, _response.volume))
296    }
297
298    /// Extends the mapping of this partition.
299    ///
300    /// The ability to extend the partition is dependent on having sufficient free space on the
301    /// underlying device, having sufficient free slots for tracking the bytes in the volume
302    /// manager header, and the partition limit (see VolumeManager.SetPartitionLimit).
303    pub fn r#extend(
304        &self,
305        mut start_slice: u64,
306        mut slice_count: u64,
307        ___deadline: zx::MonotonicInstant,
308    ) -> Result<i32, fidl::Error> {
309        let _response = self.client.send_query::<VolumeExtendRequest, VolumeExtendResponse>(
310            (start_slice, slice_count),
311            0xdddf872f5039d37,
312            fidl::encoding::DynamicFlags::empty(),
313            ___deadline,
314        )?;
315        Ok(_response.status)
316    }
317
318    /// Shrinks a virtual partition. Returns `ZX_OK` if ANY slices are
319    /// freed, even if part of the requested range contains unallocated slices.
320    pub fn r#shrink(
321        &self,
322        mut start_slice: u64,
323        mut slice_count: u64,
324        ___deadline: zx::MonotonicInstant,
325    ) -> Result<i32, fidl::Error> {
326        let _response = self.client.send_query::<VolumeShrinkRequest, VolumeShrinkResponse>(
327            (start_slice, slice_count),
328            0x27ab5ed4f6fdcd29,
329            fidl::encoding::DynamicFlags::empty(),
330            ___deadline,
331        )?;
332        Ok(_response.status)
333    }
334
335    /// Destroys the current partition, removing it from the VolumeManager, and
336    /// freeing all underlying storage. The connection to the volume is also closed.
337    pub fn r#destroy(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
338        let _response =
339            self.client.send_query::<fidl::encoding::EmptyPayload, VolumeDestroyResponse>(
340                (),
341                0x732bf4bea39b5e87,
342                fidl::encoding::DynamicFlags::empty(),
343                ___deadline,
344            )?;
345        Ok(_response.status)
346    }
347}
348
349#[cfg(target_os = "fuchsia")]
350impl From<VolumeSynchronousProxy> for zx::Handle {
351    fn from(value: VolumeSynchronousProxy) -> Self {
352        value.into_channel().into()
353    }
354}
355
356#[cfg(target_os = "fuchsia")]
357impl From<fidl::Channel> for VolumeSynchronousProxy {
358    fn from(value: fidl::Channel) -> Self {
359        Self::new(value)
360    }
361}
362
363#[cfg(target_os = "fuchsia")]
364impl fidl::endpoints::FromClient for VolumeSynchronousProxy {
365    type Protocol = VolumeMarker;
366
367    fn from_client(value: fidl::endpoints::ClientEnd<VolumeMarker>) -> Self {
368        Self::new(value.into_channel())
369    }
370}
371
372#[derive(Debug, Clone)]
373pub struct VolumeProxy {
374    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
375}
376
377impl fidl::endpoints::Proxy for VolumeProxy {
378    type Protocol = VolumeMarker;
379
380    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
381        Self::new(inner)
382    }
383
384    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
385        self.client.into_channel().map_err(|client| Self { client })
386    }
387
388    fn as_channel(&self) -> &::fidl::AsyncChannel {
389        self.client.as_channel()
390    }
391}
392
393impl VolumeProxy {
394    /// Create a new Proxy for fuchsia.hardware.block.volume/Volume.
395    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
396        let protocol_name = <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
397        Self { client: fidl::client::Client::new(channel, protocol_name) }
398    }
399
400    /// Get a Stream of events from the remote end of the protocol.
401    ///
402    /// # Panics
403    ///
404    /// Panics if the event stream was already taken.
405    pub fn take_event_stream(&self) -> VolumeEventStream {
406        VolumeEventStream { event_receiver: self.client.take_event_receiver() }
407    }
408
409    /// Get information about the underlying block device.
410    pub fn r#get_info(
411        &self,
412    ) -> fidl::client::QueryResponseFut<
413        fidl_fuchsia_hardware_block::BlockGetInfoResult,
414        fidl::encoding::DefaultFuchsiaResourceDialect,
415    > {
416        VolumeProxyInterface::r#get_info(self)
417    }
418
419    /// Opens a new FIFO-based session on the block device.
420    pub fn r#open_session(
421        &self,
422        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
423    ) -> Result<(), fidl::Error> {
424        VolumeProxyInterface::r#open_session(self, session)
425    }
426
427    /// Opens a new FIFO-based session on the block device, providing an offset lookup map which
428    /// transparently translates device offsets in block FIFO requests.
429    ///
430    /// `initial_mappings` is a static set of mappings which the server can immediately use.  If
431    /// `offset_map` is not provided, this must be non-empty, and requests that fall outside of the
432    /// mapped range will fail.
433    ///
434    /// If `offset_map` is provided, whenever the server receives a request with a dev_offset that
435    /// falls outside of the known range, it will consult `offset_map` to attempt to resolve the
436    /// offset.  Because these offset mappings must be stable for the duration of the session, the
437    /// server may cache any mappings.
438    ///
439    /// This interface is intended to be used internally between nested Block implementations, in
440    /// order to provide passthrough I/O.  For example, a fixed partition map (e.g. GPT) will serve
441    /// a Block protocol for each partition, and will respond to OpenSession requests by calling
442    /// OpenSessionWithOffsetMap on the underlying block device, establishing itself as the source
443    /// for translating client block offsets (relative to the partition start) to absolute offsets.
444    /// The client can then communicate directly with the underlying block device, and the partition
445    /// offsets can be transparently applied to requests.
446    pub fn r#open_session_with_offset_map(
447        &self,
448        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
449        mut offset_map: Option<
450            fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
451        >,
452        mut initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
453    ) -> Result<(), fidl::Error> {
454        VolumeProxyInterface::r#open_session_with_offset_map(
455            self,
456            session,
457            offset_map,
458            initial_mappings,
459        )
460    }
461
462    /// Gets the type GUID of the partition (if one exists).
463    /// If the partition has no type GUID, ZX_ERR_NOT_SUPPORTED is returned.
464    pub fn r#get_type_guid(
465        &self,
466    ) -> fidl::client::QueryResponseFut<
467        (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
468        fidl::encoding::DefaultFuchsiaResourceDialect,
469    > {
470        VolumeProxyInterface::r#get_type_guid(self)
471    }
472
473    /// Gets the instance GUID of the partition (if one exists).
474    /// If the partition has no instance GUID, ZX_ERR_NOT_SUPPORTED is returned.
475    pub fn r#get_instance_guid(
476        &self,
477    ) -> fidl::client::QueryResponseFut<
478        (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
479        fidl::encoding::DefaultFuchsiaResourceDialect,
480    > {
481        VolumeProxyInterface::r#get_instance_guid(self)
482    }
483
484    /// Gets the name of the partition (if one exists).
485    /// If the partition has no name, ZX_ERR_NOT_SUPPORTED is returned.
486    pub fn r#get_name(
487        &self,
488    ) -> fidl::client::QueryResponseFut<
489        (i32, Option<String>),
490        fidl::encoding::DefaultFuchsiaResourceDialect,
491    > {
492        VolumeProxyInterface::r#get_name(self)
493    }
494
495    /// Gets the metadata for the partition.
496    ///
497    /// Fields may be absent if the partition doesn't have the given metadata.
498    pub fn r#get_metadata(
499        &self,
500    ) -> fidl::client::QueryResponseFut<
501        fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
502        fidl::encoding::DefaultFuchsiaResourceDialect,
503    > {
504        VolumeProxyInterface::r#get_metadata(self)
505    }
506
507    /// Returns the number of contiguous allocated (or unallocated) vslices
508    /// starting from each vslice.
509    pub fn r#query_slices(
510        &self,
511        mut start_slices: &[u64],
512    ) -> fidl::client::QueryResponseFut<
513        (i32, [VsliceRange; 16], u64),
514        fidl::encoding::DefaultFuchsiaResourceDialect,
515    > {
516        VolumeProxyInterface::r#query_slices(self, start_slices)
517    }
518
519    /// Returns the information about this volume and the volume manager it is embedded in.
520    pub fn r#get_volume_info(
521        &self,
522    ) -> fidl::client::QueryResponseFut<
523        (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
524        fidl::encoding::DefaultFuchsiaResourceDialect,
525    > {
526        VolumeProxyInterface::r#get_volume_info(self)
527    }
528
529    /// Extends the mapping of this partition.
530    ///
531    /// The ability to extend the partition is dependent on having sufficient free space on the
532    /// underlying device, having sufficient free slots for tracking the bytes in the volume
533    /// manager header, and the partition limit (see VolumeManager.SetPartitionLimit).
534    pub fn r#extend(
535        &self,
536        mut start_slice: u64,
537        mut slice_count: u64,
538    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
539        VolumeProxyInterface::r#extend(self, start_slice, slice_count)
540    }
541
542    /// Shrinks a virtual partition. Returns `ZX_OK` if ANY slices are
543    /// freed, even if part of the requested range contains unallocated slices.
544    pub fn r#shrink(
545        &self,
546        mut start_slice: u64,
547        mut slice_count: u64,
548    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
549        VolumeProxyInterface::r#shrink(self, start_slice, slice_count)
550    }
551
552    /// Destroys the current partition, removing it from the VolumeManager, and
553    /// freeing all underlying storage. The connection to the volume is also closed.
554    pub fn r#destroy(
555        &self,
556    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
557        VolumeProxyInterface::r#destroy(self)
558    }
559}
560
561impl VolumeProxyInterface for VolumeProxy {
562    type GetInfoResponseFut = fidl::client::QueryResponseFut<
563        fidl_fuchsia_hardware_block::BlockGetInfoResult,
564        fidl::encoding::DefaultFuchsiaResourceDialect,
565    >;
566    fn r#get_info(&self) -> Self::GetInfoResponseFut {
567        fn _decode(
568            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
569        ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
570            let _response = fidl::client::decode_transaction_body::<
571                fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetInfoResponse, i32>,
572                fidl::encoding::DefaultFuchsiaResourceDialect,
573                0x79df1a5cdb6cc6a3,
574            >(_buf?)?;
575            Ok(_response.map(|x| x.info))
576        }
577        self.client.send_query_and_decode::<
578            fidl::encoding::EmptyPayload,
579            fidl_fuchsia_hardware_block::BlockGetInfoResult,
580        >(
581            (),
582            0x79df1a5cdb6cc6a3,
583            fidl::encoding::DynamicFlags::empty(),
584            _decode,
585        )
586    }
587
588    fn r#open_session(
589        &self,
590        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
591    ) -> Result<(), fidl::Error> {
592        self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
593            (session,),
594            0x7241c68d17614a31,
595            fidl::encoding::DynamicFlags::empty(),
596        )
597    }
598
599    fn r#open_session_with_offset_map(
600        &self,
601        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
602        mut offset_map: Option<
603            fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
604        >,
605        mut initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
606    ) -> Result<(), fidl::Error> {
607        self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
608            (session, offset_map, initial_mappings),
609            0x7a8d3ba3d8bfa10f,
610            fidl::encoding::DynamicFlags::empty(),
611        )
612    }
613
614    type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
615        (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
616        fidl::encoding::DefaultFuchsiaResourceDialect,
617    >;
618    fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
619        fn _decode(
620            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
621        ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error>
622        {
623            let _response = fidl::client::decode_transaction_body::<
624                fidl_fuchsia_hardware_block_partition::PartitionGetTypeGuidResponse,
625                fidl::encoding::DefaultFuchsiaResourceDialect,
626                0x111843d737a9b847,
627            >(_buf?)?;
628            Ok((_response.status, _response.guid))
629        }
630        self.client.send_query_and_decode::<
631            fidl::encoding::EmptyPayload,
632            (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
633        >(
634            (),
635            0x111843d737a9b847,
636            fidl::encoding::DynamicFlags::empty(),
637            _decode,
638        )
639    }
640
641    type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
642        (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
643        fidl::encoding::DefaultFuchsiaResourceDialect,
644    >;
645    fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
646        fn _decode(
647            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
648        ) -> Result<(i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>), fidl::Error>
649        {
650            let _response = fidl::client::decode_transaction_body::<
651                fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse,
652                fidl::encoding::DefaultFuchsiaResourceDialect,
653                0x14a5a573b275d435,
654            >(_buf?)?;
655            Ok((_response.status, _response.guid))
656        }
657        self.client.send_query_and_decode::<
658            fidl::encoding::EmptyPayload,
659            (i32, Option<Box<fidl_fuchsia_hardware_block_partition::Guid>>),
660        >(
661            (),
662            0x14a5a573b275d435,
663            fidl::encoding::DynamicFlags::empty(),
664            _decode,
665        )
666    }
667
668    type GetNameResponseFut = fidl::client::QueryResponseFut<
669        (i32, Option<String>),
670        fidl::encoding::DefaultFuchsiaResourceDialect,
671    >;
672    fn r#get_name(&self) -> Self::GetNameResponseFut {
673        fn _decode(
674            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
675        ) -> Result<(i32, Option<String>), fidl::Error> {
676            let _response = fidl::client::decode_transaction_body::<
677                fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse,
678                fidl::encoding::DefaultFuchsiaResourceDialect,
679                0x7e3c6f0b0937fc02,
680            >(_buf?)?;
681            Ok((_response.status, _response.name))
682        }
683        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
684            (),
685            0x7e3c6f0b0937fc02,
686            fidl::encoding::DynamicFlags::empty(),
687            _decode,
688        )
689    }
690
691    type GetMetadataResponseFut = fidl::client::QueryResponseFut<
692        fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
693        fidl::encoding::DefaultFuchsiaResourceDialect,
694    >;
695    fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
696        fn _decode(
697            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
698        ) -> Result<fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult, fidl::Error>
699        {
700            let _response = fidl::client::decode_transaction_body::<
701                fidl::encoding::ResultType<
702                    fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
703                    i32,
704                >,
705                fidl::encoding::DefaultFuchsiaResourceDialect,
706                0x42d1464c96c3f3ff,
707            >(_buf?)?;
708            Ok(_response.map(|x| x))
709        }
710        self.client.send_query_and_decode::<
711            fidl::encoding::EmptyPayload,
712            fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResult,
713        >(
714            (),
715            0x42d1464c96c3f3ff,
716            fidl::encoding::DynamicFlags::empty(),
717            _decode,
718        )
719    }
720
721    type QuerySlicesResponseFut = fidl::client::QueryResponseFut<
722        (i32, [VsliceRange; 16], u64),
723        fidl::encoding::DefaultFuchsiaResourceDialect,
724    >;
725    fn r#query_slices(&self, mut start_slices: &[u64]) -> Self::QuerySlicesResponseFut {
726        fn _decode(
727            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
728        ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
729            let _response = fidl::client::decode_transaction_body::<
730                VolumeQuerySlicesResponse,
731                fidl::encoding::DefaultFuchsiaResourceDialect,
732                0x589a96828a3e2aa1,
733            >(_buf?)?;
734            Ok((_response.status, _response.response, _response.response_count))
735        }
736        self.client
737            .send_query_and_decode::<VolumeQuerySlicesRequest, (i32, [VsliceRange; 16], u64)>(
738                (start_slices,),
739                0x589a96828a3e2aa1,
740                fidl::encoding::DynamicFlags::empty(),
741                _decode,
742            )
743    }
744
745    type GetVolumeInfoResponseFut = fidl::client::QueryResponseFut<
746        (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
747        fidl::encoding::DefaultFuchsiaResourceDialect,
748    >;
749    fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut {
750        fn _decode(
751            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
752        ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error>
753        {
754            let _response = fidl::client::decode_transaction_body::<
755                VolumeGetVolumeInfoResponse,
756                fidl::encoding::DefaultFuchsiaResourceDialect,
757                0x60417b6cf9e34c80,
758            >(_buf?)?;
759            Ok((_response.status, _response.manager, _response.volume))
760        }
761        self.client.send_query_and_decode::<
762            fidl::encoding::EmptyPayload,
763            (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
764        >(
765            (),
766            0x60417b6cf9e34c80,
767            fidl::encoding::DynamicFlags::empty(),
768            _decode,
769        )
770    }
771
772    type ExtendResponseFut =
773        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
774    fn r#extend(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ExtendResponseFut {
775        fn _decode(
776            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
777        ) -> Result<i32, fidl::Error> {
778            let _response = fidl::client::decode_transaction_body::<
779                VolumeExtendResponse,
780                fidl::encoding::DefaultFuchsiaResourceDialect,
781                0xdddf872f5039d37,
782            >(_buf?)?;
783            Ok(_response.status)
784        }
785        self.client.send_query_and_decode::<VolumeExtendRequest, i32>(
786            (start_slice, slice_count),
787            0xdddf872f5039d37,
788            fidl::encoding::DynamicFlags::empty(),
789            _decode,
790        )
791    }
792
793    type ShrinkResponseFut =
794        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
795    fn r#shrink(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ShrinkResponseFut {
796        fn _decode(
797            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
798        ) -> Result<i32, fidl::Error> {
799            let _response = fidl::client::decode_transaction_body::<
800                VolumeShrinkResponse,
801                fidl::encoding::DefaultFuchsiaResourceDialect,
802                0x27ab5ed4f6fdcd29,
803            >(_buf?)?;
804            Ok(_response.status)
805        }
806        self.client.send_query_and_decode::<VolumeShrinkRequest, i32>(
807            (start_slice, slice_count),
808            0x27ab5ed4f6fdcd29,
809            fidl::encoding::DynamicFlags::empty(),
810            _decode,
811        )
812    }
813
814    type DestroyResponseFut =
815        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
816    fn r#destroy(&self) -> Self::DestroyResponseFut {
817        fn _decode(
818            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
819        ) -> Result<i32, fidl::Error> {
820            let _response = fidl::client::decode_transaction_body::<
821                VolumeDestroyResponse,
822                fidl::encoding::DefaultFuchsiaResourceDialect,
823                0x732bf4bea39b5e87,
824            >(_buf?)?;
825            Ok(_response.status)
826        }
827        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
828            (),
829            0x732bf4bea39b5e87,
830            fidl::encoding::DynamicFlags::empty(),
831            _decode,
832        )
833    }
834}
835
836pub struct VolumeEventStream {
837    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
838}
839
840impl std::marker::Unpin for VolumeEventStream {}
841
842impl futures::stream::FusedStream for VolumeEventStream {
843    fn is_terminated(&self) -> bool {
844        self.event_receiver.is_terminated()
845    }
846}
847
848impl futures::Stream for VolumeEventStream {
849    type Item = Result<VolumeEvent, fidl::Error>;
850
851    fn poll_next(
852        mut self: std::pin::Pin<&mut Self>,
853        cx: &mut std::task::Context<'_>,
854    ) -> std::task::Poll<Option<Self::Item>> {
855        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
856            &mut self.event_receiver,
857            cx
858        )?) {
859            Some(buf) => std::task::Poll::Ready(Some(VolumeEvent::decode(buf))),
860            None => std::task::Poll::Ready(None),
861        }
862    }
863}
864
865#[derive(Debug)]
866pub enum VolumeEvent {}
867
868impl VolumeEvent {
869    /// Decodes a message buffer as a [`VolumeEvent`].
870    fn decode(
871        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
872    ) -> Result<VolumeEvent, fidl::Error> {
873        let (bytes, _handles) = buf.split_mut();
874        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
875        debug_assert_eq!(tx_header.tx_id, 0);
876        match tx_header.ordinal {
877            _ => Err(fidl::Error::UnknownOrdinal {
878                ordinal: tx_header.ordinal,
879                protocol_name: <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
880            }),
881        }
882    }
883}
884
885/// A Stream of incoming requests for fuchsia.hardware.block.volume/Volume.
886pub struct VolumeRequestStream {
887    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
888    is_terminated: bool,
889}
890
891impl std::marker::Unpin for VolumeRequestStream {}
892
893impl futures::stream::FusedStream for VolumeRequestStream {
894    fn is_terminated(&self) -> bool {
895        self.is_terminated
896    }
897}
898
899impl fidl::endpoints::RequestStream for VolumeRequestStream {
900    type Protocol = VolumeMarker;
901    type ControlHandle = VolumeControlHandle;
902
903    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
904        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
905    }
906
907    fn control_handle(&self) -> Self::ControlHandle {
908        VolumeControlHandle { inner: self.inner.clone() }
909    }
910
911    fn into_inner(
912        self,
913    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
914    {
915        (self.inner, self.is_terminated)
916    }
917
918    fn from_inner(
919        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
920        is_terminated: bool,
921    ) -> Self {
922        Self { inner, is_terminated }
923    }
924}
925
926impl futures::Stream for VolumeRequestStream {
927    type Item = Result<VolumeRequest, fidl::Error>;
928
929    fn poll_next(
930        mut self: std::pin::Pin<&mut Self>,
931        cx: &mut std::task::Context<'_>,
932    ) -> std::task::Poll<Option<Self::Item>> {
933        let this = &mut *self;
934        if this.inner.check_shutdown(cx) {
935            this.is_terminated = true;
936            return std::task::Poll::Ready(None);
937        }
938        if this.is_terminated {
939            panic!("polled VolumeRequestStream after completion");
940        }
941        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
942            |bytes, handles| {
943                match this.inner.channel().read_etc(cx, bytes, handles) {
944                    std::task::Poll::Ready(Ok(())) => {}
945                    std::task::Poll::Pending => return std::task::Poll::Pending,
946                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
947                        this.is_terminated = true;
948                        return std::task::Poll::Ready(None);
949                    }
950                    std::task::Poll::Ready(Err(e)) => {
951                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
952                            e.into(),
953                        ))))
954                    }
955                }
956
957                // A message has been received from the channel
958                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959
960                std::task::Poll::Ready(Some(match header.ordinal {
961                    0x79df1a5cdb6cc6a3 => {
962                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
963                        let mut req = fidl::new_empty!(
964                            fidl::encoding::EmptyPayload,
965                            fidl::encoding::DefaultFuchsiaResourceDialect
966                        );
967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
968                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
969                        Ok(VolumeRequest::GetInfo {
970                            responder: VolumeGetInfoResponder {
971                                control_handle: std::mem::ManuallyDrop::new(control_handle),
972                                tx_id: header.tx_id,
973                            },
974                        })
975                    }
976                    0x7241c68d17614a31 => {
977                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
978                        let mut req = fidl::new_empty!(
979                            fidl_fuchsia_hardware_block::BlockOpenSessionRequest,
980                            fidl::encoding::DefaultFuchsiaResourceDialect
981                        );
982                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
983                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
984                        Ok(VolumeRequest::OpenSession { session: req.session, control_handle })
985                    }
986                    0x7a8d3ba3d8bfa10f => {
987                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
988                        let mut req = fidl::new_empty!(
989                            fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest,
990                            fidl::encoding::DefaultFuchsiaResourceDialect
991                        );
992                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
993                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
994                        Ok(VolumeRequest::OpenSessionWithOffsetMap {
995                            session: req.session,
996                            offset_map: req.offset_map,
997                            initial_mappings: req.initial_mappings,
998
999                            control_handle,
1000                        })
1001                    }
1002                    0x111843d737a9b847 => {
1003                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1004                        let mut req = fidl::new_empty!(
1005                            fidl::encoding::EmptyPayload,
1006                            fidl::encoding::DefaultFuchsiaResourceDialect
1007                        );
1008                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1009                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1010                        Ok(VolumeRequest::GetTypeGuid {
1011                            responder: VolumeGetTypeGuidResponder {
1012                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1013                                tx_id: header.tx_id,
1014                            },
1015                        })
1016                    }
1017                    0x14a5a573b275d435 => {
1018                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1019                        let mut req = fidl::new_empty!(
1020                            fidl::encoding::EmptyPayload,
1021                            fidl::encoding::DefaultFuchsiaResourceDialect
1022                        );
1023                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1024                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1025                        Ok(VolumeRequest::GetInstanceGuid {
1026                            responder: VolumeGetInstanceGuidResponder {
1027                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1028                                tx_id: header.tx_id,
1029                            },
1030                        })
1031                    }
1032                    0x7e3c6f0b0937fc02 => {
1033                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1034                        let mut req = fidl::new_empty!(
1035                            fidl::encoding::EmptyPayload,
1036                            fidl::encoding::DefaultFuchsiaResourceDialect
1037                        );
1038                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1039                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1040                        Ok(VolumeRequest::GetName {
1041                            responder: VolumeGetNameResponder {
1042                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1043                                tx_id: header.tx_id,
1044                            },
1045                        })
1046                    }
1047                    0x42d1464c96c3f3ff => {
1048                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1049                        let mut req = fidl::new_empty!(
1050                            fidl::encoding::EmptyPayload,
1051                            fidl::encoding::DefaultFuchsiaResourceDialect
1052                        );
1053                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1054                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1055                        Ok(VolumeRequest::GetMetadata {
1056                            responder: VolumeGetMetadataResponder {
1057                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1058                                tx_id: header.tx_id,
1059                            },
1060                        })
1061                    }
1062                    0x589a96828a3e2aa1 => {
1063                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1064                        let mut req = fidl::new_empty!(
1065                            VolumeQuerySlicesRequest,
1066                            fidl::encoding::DefaultFuchsiaResourceDialect
1067                        );
1068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeQuerySlicesRequest>(&header, _body_bytes, handles, &mut req)?;
1069                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1070                        Ok(VolumeRequest::QuerySlices {
1071                            start_slices: req.start_slices,
1072
1073                            responder: VolumeQuerySlicesResponder {
1074                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1075                                tx_id: header.tx_id,
1076                            },
1077                        })
1078                    }
1079                    0x60417b6cf9e34c80 => {
1080                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1081                        let mut req = fidl::new_empty!(
1082                            fidl::encoding::EmptyPayload,
1083                            fidl::encoding::DefaultFuchsiaResourceDialect
1084                        );
1085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1086                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1087                        Ok(VolumeRequest::GetVolumeInfo {
1088                            responder: VolumeGetVolumeInfoResponder {
1089                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1090                                tx_id: header.tx_id,
1091                            },
1092                        })
1093                    }
1094                    0xdddf872f5039d37 => {
1095                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1096                        let mut req = fidl::new_empty!(
1097                            VolumeExtendRequest,
1098                            fidl::encoding::DefaultFuchsiaResourceDialect
1099                        );
1100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeExtendRequest>(&header, _body_bytes, handles, &mut req)?;
1101                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1102                        Ok(VolumeRequest::Extend {
1103                            start_slice: req.start_slice,
1104                            slice_count: req.slice_count,
1105
1106                            responder: VolumeExtendResponder {
1107                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1108                                tx_id: header.tx_id,
1109                            },
1110                        })
1111                    }
1112                    0x27ab5ed4f6fdcd29 => {
1113                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1114                        let mut req = fidl::new_empty!(
1115                            VolumeShrinkRequest,
1116                            fidl::encoding::DefaultFuchsiaResourceDialect
1117                        );
1118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeShrinkRequest>(&header, _body_bytes, handles, &mut req)?;
1119                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1120                        Ok(VolumeRequest::Shrink {
1121                            start_slice: req.start_slice,
1122                            slice_count: req.slice_count,
1123
1124                            responder: VolumeShrinkResponder {
1125                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1126                                tx_id: header.tx_id,
1127                            },
1128                        })
1129                    }
1130                    0x732bf4bea39b5e87 => {
1131                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1132                        let mut req = fidl::new_empty!(
1133                            fidl::encoding::EmptyPayload,
1134                            fidl::encoding::DefaultFuchsiaResourceDialect
1135                        );
1136                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1137                        let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1138                        Ok(VolumeRequest::Destroy {
1139                            responder: VolumeDestroyResponder {
1140                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1141                                tx_id: header.tx_id,
1142                            },
1143                        })
1144                    }
1145                    _ => Err(fidl::Error::UnknownOrdinal {
1146                        ordinal: header.ordinal,
1147                        protocol_name:
1148                            <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1149                    }),
1150                }))
1151            },
1152        )
1153    }
1154}
1155
1156/// Volume is a partition which may access virtually-mapped blocks within a device.
1157#[derive(Debug)]
1158pub enum VolumeRequest {
1159    /// Get information about the underlying block device.
1160    GetInfo { responder: VolumeGetInfoResponder },
1161    /// Opens a new FIFO-based session on the block device.
1162    OpenSession {
1163        session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1164        control_handle: VolumeControlHandle,
1165    },
1166    /// Opens a new FIFO-based session on the block device, providing an offset lookup map which
1167    /// transparently translates device offsets in block FIFO requests.
1168    ///
1169    /// `initial_mappings` is a static set of mappings which the server can immediately use.  If
1170    /// `offset_map` is not provided, this must be non-empty, and requests that fall outside of the
1171    /// mapped range will fail.
1172    ///
1173    /// If `offset_map` is provided, whenever the server receives a request with a dev_offset that
1174    /// falls outside of the known range, it will consult `offset_map` to attempt to resolve the
1175    /// offset.  Because these offset mappings must be stable for the duration of the session, the
1176    /// server may cache any mappings.
1177    ///
1178    /// This interface is intended to be used internally between nested Block implementations, in
1179    /// order to provide passthrough I/O.  For example, a fixed partition map (e.g. GPT) will serve
1180    /// a Block protocol for each partition, and will respond to OpenSession requests by calling
1181    /// OpenSessionWithOffsetMap on the underlying block device, establishing itself as the source
1182    /// for translating client block offsets (relative to the partition start) to absolute offsets.
1183    /// The client can then communicate directly with the underlying block device, and the partition
1184    /// offsets can be transparently applied to requests.
1185    OpenSessionWithOffsetMap {
1186        session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1187        offset_map:
1188            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>>,
1189        initial_mappings: Option<Vec<fidl_fuchsia_hardware_block::BlockOffsetMapping>>,
1190        control_handle: VolumeControlHandle,
1191    },
1192    /// Gets the type GUID of the partition (if one exists).
1193    /// If the partition has no type GUID, ZX_ERR_NOT_SUPPORTED is returned.
1194    GetTypeGuid { responder: VolumeGetTypeGuidResponder },
1195    /// Gets the instance GUID of the partition (if one exists).
1196    /// If the partition has no instance GUID, ZX_ERR_NOT_SUPPORTED is returned.
1197    GetInstanceGuid { responder: VolumeGetInstanceGuidResponder },
1198    /// Gets the name of the partition (if one exists).
1199    /// If the partition has no name, ZX_ERR_NOT_SUPPORTED is returned.
1200    GetName { responder: VolumeGetNameResponder },
1201    /// Gets the metadata for the partition.
1202    ///
1203    /// Fields may be absent if the partition doesn't have the given metadata.
1204    GetMetadata { responder: VolumeGetMetadataResponder },
1205    /// Returns the number of contiguous allocated (or unallocated) vslices
1206    /// starting from each vslice.
1207    QuerySlices { start_slices: Vec<u64>, responder: VolumeQuerySlicesResponder },
1208    /// Returns the information about this volume and the volume manager it is embedded in.
1209    GetVolumeInfo { responder: VolumeGetVolumeInfoResponder },
1210    /// Extends the mapping of this partition.
1211    ///
1212    /// The ability to extend the partition is dependent on having sufficient free space on the
1213    /// underlying device, having sufficient free slots for tracking the bytes in the volume
1214    /// manager header, and the partition limit (see VolumeManager.SetPartitionLimit).
1215    Extend { start_slice: u64, slice_count: u64, responder: VolumeExtendResponder },
1216    /// Shrinks a virtual partition. Returns `ZX_OK` if ANY slices are
1217    /// freed, even if part of the requested range contains unallocated slices.
1218    Shrink { start_slice: u64, slice_count: u64, responder: VolumeShrinkResponder },
1219    /// Destroys the current partition, removing it from the VolumeManager, and
1220    /// freeing all underlying storage. The connection to the volume is also closed.
1221    Destroy { responder: VolumeDestroyResponder },
1222}
1223
1224impl VolumeRequest {
1225    #[allow(irrefutable_let_patterns)]
1226    pub fn into_get_info(self) -> Option<(VolumeGetInfoResponder)> {
1227        if let VolumeRequest::GetInfo { responder } = self {
1228            Some((responder))
1229        } else {
1230            None
1231        }
1232    }
1233
1234    #[allow(irrefutable_let_patterns)]
1235    pub fn into_open_session(
1236        self,
1237    ) -> Option<(
1238        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1239        VolumeControlHandle,
1240    )> {
1241        if let VolumeRequest::OpenSession { session, control_handle } = self {
1242            Some((session, control_handle))
1243        } else {
1244            None
1245        }
1246    }
1247
1248    #[allow(irrefutable_let_patterns)]
1249    pub fn into_open_session_with_offset_map(
1250        self,
1251    ) -> Option<(
1252        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
1253        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>>,
1254        Option<Vec<fidl_fuchsia_hardware_block::BlockOffsetMapping>>,
1255        VolumeControlHandle,
1256    )> {
1257        if let VolumeRequest::OpenSessionWithOffsetMap {
1258            session,
1259            offset_map,
1260            initial_mappings,
1261            control_handle,
1262        } = self
1263        {
1264            Some((session, offset_map, initial_mappings, control_handle))
1265        } else {
1266            None
1267        }
1268    }
1269
1270    #[allow(irrefutable_let_patterns)]
1271    pub fn into_get_type_guid(self) -> Option<(VolumeGetTypeGuidResponder)> {
1272        if let VolumeRequest::GetTypeGuid { responder } = self {
1273            Some((responder))
1274        } else {
1275            None
1276        }
1277    }
1278
1279    #[allow(irrefutable_let_patterns)]
1280    pub fn into_get_instance_guid(self) -> Option<(VolumeGetInstanceGuidResponder)> {
1281        if let VolumeRequest::GetInstanceGuid { responder } = self {
1282            Some((responder))
1283        } else {
1284            None
1285        }
1286    }
1287
1288    #[allow(irrefutable_let_patterns)]
1289    pub fn into_get_name(self) -> Option<(VolumeGetNameResponder)> {
1290        if let VolumeRequest::GetName { responder } = self {
1291            Some((responder))
1292        } else {
1293            None
1294        }
1295    }
1296
1297    #[allow(irrefutable_let_patterns)]
1298    pub fn into_get_metadata(self) -> Option<(VolumeGetMetadataResponder)> {
1299        if let VolumeRequest::GetMetadata { responder } = self {
1300            Some((responder))
1301        } else {
1302            None
1303        }
1304    }
1305
1306    #[allow(irrefutable_let_patterns)]
1307    pub fn into_query_slices(self) -> Option<(Vec<u64>, VolumeQuerySlicesResponder)> {
1308        if let VolumeRequest::QuerySlices { start_slices, responder } = self {
1309            Some((start_slices, responder))
1310        } else {
1311            None
1312        }
1313    }
1314
1315    #[allow(irrefutable_let_patterns)]
1316    pub fn into_get_volume_info(self) -> Option<(VolumeGetVolumeInfoResponder)> {
1317        if let VolumeRequest::GetVolumeInfo { responder } = self {
1318            Some((responder))
1319        } else {
1320            None
1321        }
1322    }
1323
1324    #[allow(irrefutable_let_patterns)]
1325    pub fn into_extend(self) -> Option<(u64, u64, VolumeExtendResponder)> {
1326        if let VolumeRequest::Extend { start_slice, slice_count, responder } = self {
1327            Some((start_slice, slice_count, responder))
1328        } else {
1329            None
1330        }
1331    }
1332
1333    #[allow(irrefutable_let_patterns)]
1334    pub fn into_shrink(self) -> Option<(u64, u64, VolumeShrinkResponder)> {
1335        if let VolumeRequest::Shrink { start_slice, slice_count, responder } = self {
1336            Some((start_slice, slice_count, responder))
1337        } else {
1338            None
1339        }
1340    }
1341
1342    #[allow(irrefutable_let_patterns)]
1343    pub fn into_destroy(self) -> Option<(VolumeDestroyResponder)> {
1344        if let VolumeRequest::Destroy { responder } = self {
1345            Some((responder))
1346        } else {
1347            None
1348        }
1349    }
1350
1351    /// Name of the method defined in FIDL
1352    pub fn method_name(&self) -> &'static str {
1353        match *self {
1354            VolumeRequest::GetInfo { .. } => "get_info",
1355            VolumeRequest::OpenSession { .. } => "open_session",
1356            VolumeRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
1357            VolumeRequest::GetTypeGuid { .. } => "get_type_guid",
1358            VolumeRequest::GetInstanceGuid { .. } => "get_instance_guid",
1359            VolumeRequest::GetName { .. } => "get_name",
1360            VolumeRequest::GetMetadata { .. } => "get_metadata",
1361            VolumeRequest::QuerySlices { .. } => "query_slices",
1362            VolumeRequest::GetVolumeInfo { .. } => "get_volume_info",
1363            VolumeRequest::Extend { .. } => "extend",
1364            VolumeRequest::Shrink { .. } => "shrink",
1365            VolumeRequest::Destroy { .. } => "destroy",
1366        }
1367    }
1368}
1369
1370#[derive(Debug, Clone)]
1371pub struct VolumeControlHandle {
1372    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1373}
1374
1375impl fidl::endpoints::ControlHandle for VolumeControlHandle {
1376    fn shutdown(&self) {
1377        self.inner.shutdown()
1378    }
1379    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1380        self.inner.shutdown_with_epitaph(status)
1381    }
1382
1383    fn is_closed(&self) -> bool {
1384        self.inner.channel().is_closed()
1385    }
1386    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1387        self.inner.channel().on_closed()
1388    }
1389
1390    #[cfg(target_os = "fuchsia")]
1391    fn signal_peer(
1392        &self,
1393        clear_mask: zx::Signals,
1394        set_mask: zx::Signals,
1395    ) -> Result<(), zx_status::Status> {
1396        use fidl::Peered;
1397        self.inner.channel().signal_peer(clear_mask, set_mask)
1398    }
1399}
1400
1401impl VolumeControlHandle {}
1402
1403#[must_use = "FIDL methods require a response to be sent"]
1404#[derive(Debug)]
1405pub struct VolumeGetInfoResponder {
1406    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1407    tx_id: u32,
1408}
1409
1410/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1411/// if the responder is dropped without sending a response, so that the client
1412/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1413impl std::ops::Drop for VolumeGetInfoResponder {
1414    fn drop(&mut self) {
1415        self.control_handle.shutdown();
1416        // Safety: drops once, never accessed again
1417        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1418    }
1419}
1420
1421impl fidl::endpoints::Responder for VolumeGetInfoResponder {
1422    type ControlHandle = VolumeControlHandle;
1423
1424    fn control_handle(&self) -> &VolumeControlHandle {
1425        &self.control_handle
1426    }
1427
1428    fn drop_without_shutdown(mut self) {
1429        // Safety: drops once, never accessed again due to mem::forget
1430        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1431        // Prevent Drop from running (which would shut down the channel)
1432        std::mem::forget(self);
1433    }
1434}
1435
1436impl VolumeGetInfoResponder {
1437    /// Sends a response to the FIDL transaction.
1438    ///
1439    /// Sets the channel to shutdown if an error occurs.
1440    pub fn send(
1441        self,
1442        mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1443    ) -> Result<(), fidl::Error> {
1444        let _result = self.send_raw(result);
1445        if _result.is_err() {
1446            self.control_handle.shutdown();
1447        }
1448        self.drop_without_shutdown();
1449        _result
1450    }
1451
1452    /// Similar to "send" but does not shutdown the channel if an error occurs.
1453    pub fn send_no_shutdown_on_err(
1454        self,
1455        mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1456    ) -> Result<(), fidl::Error> {
1457        let _result = self.send_raw(result);
1458        self.drop_without_shutdown();
1459        _result
1460    }
1461
1462    fn send_raw(
1463        &self,
1464        mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1465    ) -> Result<(), fidl::Error> {
1466        self.control_handle.inner.send::<fidl::encoding::ResultType<
1467            fidl_fuchsia_hardware_block::BlockGetInfoResponse,
1468            i32,
1469        >>(
1470            result.map(|info| (info,)),
1471            self.tx_id,
1472            0x79df1a5cdb6cc6a3,
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 VolumeGetTypeGuidResponder {
1481    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1482    tx_id: u32,
1483}
1484
1485/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1486/// if the responder is dropped without sending a response, so that the client
1487/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1488impl std::ops::Drop for VolumeGetTypeGuidResponder {
1489    fn drop(&mut self) {
1490        self.control_handle.shutdown();
1491        // Safety: drops once, never accessed again
1492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1493    }
1494}
1495
1496impl fidl::endpoints::Responder for VolumeGetTypeGuidResponder {
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        // Safety: drops once, never accessed again due to mem::forget
1505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506        // Prevent Drop from running (which would shut down the channel)
1507        std::mem::forget(self);
1508    }
1509}
1510
1511impl VolumeGetTypeGuidResponder {
1512    /// Sends a response to the FIDL transaction.
1513    ///
1514    /// Sets the channel to shutdown if an error occurs.
1515    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    /// Similar to "send" but does not shutdown the channel if an error occurs.
1529    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::PartitionGetTypeGuidResponse>(
1547                (status, guid),
1548                self.tx_id,
1549                0x111843d737a9b847,
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 VolumeGetInstanceGuidResponder {
1558    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1559    tx_id: u32,
1560}
1561
1562/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1563/// if the responder is dropped without sending a response, so that the client
1564/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1565impl std::ops::Drop for VolumeGetInstanceGuidResponder {
1566    fn drop(&mut self) {
1567        self.control_handle.shutdown();
1568        // Safety: drops once, never accessed again
1569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1570    }
1571}
1572
1573impl fidl::endpoints::Responder for VolumeGetInstanceGuidResponder {
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        // Safety: drops once, never accessed again due to mem::forget
1582        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1583        // Prevent Drop from running (which would shut down the channel)
1584        std::mem::forget(self);
1585    }
1586}
1587
1588impl VolumeGetInstanceGuidResponder {
1589    /// Sends a response to the FIDL transaction.
1590    ///
1591    /// Sets the channel to shutdown if an error occurs.
1592    pub fn send(
1593        self,
1594        mut status: i32,
1595        mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1596    ) -> Result<(), fidl::Error> {
1597        let _result = self.send_raw(status, guid);
1598        if _result.is_err() {
1599            self.control_handle.shutdown();
1600        }
1601        self.drop_without_shutdown();
1602        _result
1603    }
1604
1605    /// Similar to "send" but does not shutdown the channel if an error occurs.
1606    pub fn send_no_shutdown_on_err(
1607        self,
1608        mut status: i32,
1609        mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1610    ) -> Result<(), fidl::Error> {
1611        let _result = self.send_raw(status, guid);
1612        self.drop_without_shutdown();
1613        _result
1614    }
1615
1616    fn send_raw(
1617        &self,
1618        mut status: i32,
1619        mut guid: Option<&fidl_fuchsia_hardware_block_partition::Guid>,
1620    ) -> Result<(), fidl::Error> {
1621        self.control_handle
1622            .inner
1623            .send::<fidl_fuchsia_hardware_block_partition::PartitionGetInstanceGuidResponse>(
1624            (status, guid),
1625            self.tx_id,
1626            0x14a5a573b275d435,
1627            fidl::encoding::DynamicFlags::empty(),
1628        )
1629    }
1630}
1631
1632#[must_use = "FIDL methods require a response to be sent"]
1633#[derive(Debug)]
1634pub struct VolumeGetNameResponder {
1635    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1636    tx_id: u32,
1637}
1638
1639/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1640/// if the responder is dropped without sending a response, so that the client
1641/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1642impl std::ops::Drop for VolumeGetNameResponder {
1643    fn drop(&mut self) {
1644        self.control_handle.shutdown();
1645        // Safety: drops once, never accessed again
1646        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1647    }
1648}
1649
1650impl fidl::endpoints::Responder for VolumeGetNameResponder {
1651    type ControlHandle = VolumeControlHandle;
1652
1653    fn control_handle(&self) -> &VolumeControlHandle {
1654        &self.control_handle
1655    }
1656
1657    fn drop_without_shutdown(mut self) {
1658        // Safety: drops once, never accessed again due to mem::forget
1659        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1660        // Prevent Drop from running (which would shut down the channel)
1661        std::mem::forget(self);
1662    }
1663}
1664
1665impl VolumeGetNameResponder {
1666    /// Sends a response to the FIDL transaction.
1667    ///
1668    /// Sets the channel to shutdown if an error occurs.
1669    pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1670        let _result = self.send_raw(status, name);
1671        if _result.is_err() {
1672            self.control_handle.shutdown();
1673        }
1674        self.drop_without_shutdown();
1675        _result
1676    }
1677
1678    /// Similar to "send" but does not shutdown the channel if an error occurs.
1679    pub fn send_no_shutdown_on_err(
1680        self,
1681        mut status: i32,
1682        mut name: Option<&str>,
1683    ) -> Result<(), fidl::Error> {
1684        let _result = self.send_raw(status, name);
1685        self.drop_without_shutdown();
1686        _result
1687    }
1688
1689    fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1690        self.control_handle
1691            .inner
1692            .send::<fidl_fuchsia_hardware_block_partition::PartitionGetNameResponse>(
1693                (status, name),
1694                self.tx_id,
1695                0x7e3c6f0b0937fc02,
1696                fidl::encoding::DynamicFlags::empty(),
1697            )
1698    }
1699}
1700
1701#[must_use = "FIDL methods require a response to be sent"]
1702#[derive(Debug)]
1703pub struct VolumeGetMetadataResponder {
1704    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1705    tx_id: u32,
1706}
1707
1708/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1709/// if the responder is dropped without sending a response, so that the client
1710/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1711impl std::ops::Drop for VolumeGetMetadataResponder {
1712    fn drop(&mut self) {
1713        self.control_handle.shutdown();
1714        // Safety: drops once, never accessed again
1715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1716    }
1717}
1718
1719impl fidl::endpoints::Responder for VolumeGetMetadataResponder {
1720    type ControlHandle = VolumeControlHandle;
1721
1722    fn control_handle(&self) -> &VolumeControlHandle {
1723        &self.control_handle
1724    }
1725
1726    fn drop_without_shutdown(mut self) {
1727        // Safety: drops once, never accessed again due to mem::forget
1728        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1729        // Prevent Drop from running (which would shut down the channel)
1730        std::mem::forget(self);
1731    }
1732}
1733
1734impl VolumeGetMetadataResponder {
1735    /// Sends a response to the FIDL transaction.
1736    ///
1737    /// Sets the channel to shutdown if an error occurs.
1738    pub fn send(
1739        self,
1740        mut result: Result<
1741            &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1742            i32,
1743        >,
1744    ) -> Result<(), fidl::Error> {
1745        let _result = self.send_raw(result);
1746        if _result.is_err() {
1747            self.control_handle.shutdown();
1748        }
1749        self.drop_without_shutdown();
1750        _result
1751    }
1752
1753    /// Similar to "send" but does not shutdown the channel if an error occurs.
1754    pub fn send_no_shutdown_on_err(
1755        self,
1756        mut result: Result<
1757            &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1758            i32,
1759        >,
1760    ) -> Result<(), fidl::Error> {
1761        let _result = self.send_raw(result);
1762        self.drop_without_shutdown();
1763        _result
1764    }
1765
1766    fn send_raw(
1767        &self,
1768        mut result: Result<
1769            &fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1770            i32,
1771        >,
1772    ) -> Result<(), fidl::Error> {
1773        self.control_handle.inner.send::<fidl::encoding::ResultType<
1774            fidl_fuchsia_hardware_block_partition::PartitionGetMetadataResponse,
1775            i32,
1776        >>(
1777            result,
1778            self.tx_id,
1779            0x42d1464c96c3f3ff,
1780            fidl::encoding::DynamicFlags::empty(),
1781        )
1782    }
1783}
1784
1785#[must_use = "FIDL methods require a response to be sent"]
1786#[derive(Debug)]
1787pub struct VolumeQuerySlicesResponder {
1788    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1789    tx_id: u32,
1790}
1791
1792/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1793/// if the responder is dropped without sending a response, so that the client
1794/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1795impl std::ops::Drop for VolumeQuerySlicesResponder {
1796    fn drop(&mut self) {
1797        self.control_handle.shutdown();
1798        // Safety: drops once, never accessed again
1799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1800    }
1801}
1802
1803impl fidl::endpoints::Responder for VolumeQuerySlicesResponder {
1804    type ControlHandle = VolumeControlHandle;
1805
1806    fn control_handle(&self) -> &VolumeControlHandle {
1807        &self.control_handle
1808    }
1809
1810    fn drop_without_shutdown(mut self) {
1811        // Safety: drops once, never accessed again due to mem::forget
1812        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1813        // Prevent Drop from running (which would shut down the channel)
1814        std::mem::forget(self);
1815    }
1816}
1817
1818impl VolumeQuerySlicesResponder {
1819    /// Sends a response to the FIDL transaction.
1820    ///
1821    /// Sets the channel to shutdown if an error occurs.
1822    pub fn send(
1823        self,
1824        mut status: i32,
1825        mut response: &[VsliceRange; 16],
1826        mut response_count: u64,
1827    ) -> Result<(), fidl::Error> {
1828        let _result = self.send_raw(status, response, response_count);
1829        if _result.is_err() {
1830            self.control_handle.shutdown();
1831        }
1832        self.drop_without_shutdown();
1833        _result
1834    }
1835
1836    /// Similar to "send" but does not shutdown the channel if an error occurs.
1837    pub fn send_no_shutdown_on_err(
1838        self,
1839        mut status: i32,
1840        mut response: &[VsliceRange; 16],
1841        mut response_count: u64,
1842    ) -> Result<(), fidl::Error> {
1843        let _result = self.send_raw(status, response, response_count);
1844        self.drop_without_shutdown();
1845        _result
1846    }
1847
1848    fn send_raw(
1849        &self,
1850        mut status: i32,
1851        mut response: &[VsliceRange; 16],
1852        mut response_count: u64,
1853    ) -> Result<(), fidl::Error> {
1854        self.control_handle.inner.send::<VolumeQuerySlicesResponse>(
1855            (status, response, response_count),
1856            self.tx_id,
1857            0x589a96828a3e2aa1,
1858            fidl::encoding::DynamicFlags::empty(),
1859        )
1860    }
1861}
1862
1863#[must_use = "FIDL methods require a response to be sent"]
1864#[derive(Debug)]
1865pub struct VolumeGetVolumeInfoResponder {
1866    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1867    tx_id: u32,
1868}
1869
1870/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1871/// if the responder is dropped without sending a response, so that the client
1872/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1873impl std::ops::Drop for VolumeGetVolumeInfoResponder {
1874    fn drop(&mut self) {
1875        self.control_handle.shutdown();
1876        // Safety: drops once, never accessed again
1877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1878    }
1879}
1880
1881impl fidl::endpoints::Responder for VolumeGetVolumeInfoResponder {
1882    type ControlHandle = VolumeControlHandle;
1883
1884    fn control_handle(&self) -> &VolumeControlHandle {
1885        &self.control_handle
1886    }
1887
1888    fn drop_without_shutdown(mut self) {
1889        // Safety: drops once, never accessed again due to mem::forget
1890        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1891        // Prevent Drop from running (which would shut down the channel)
1892        std::mem::forget(self);
1893    }
1894}
1895
1896impl VolumeGetVolumeInfoResponder {
1897    /// Sends a response to the FIDL transaction.
1898    ///
1899    /// Sets the channel to shutdown if an error occurs.
1900    pub fn send(
1901        self,
1902        mut status: i32,
1903        mut manager: Option<&VolumeManagerInfo>,
1904        mut volume: Option<&VolumeInfo>,
1905    ) -> Result<(), fidl::Error> {
1906        let _result = self.send_raw(status, manager, volume);
1907        if _result.is_err() {
1908            self.control_handle.shutdown();
1909        }
1910        self.drop_without_shutdown();
1911        _result
1912    }
1913
1914    /// Similar to "send" but does not shutdown the channel if an error occurs.
1915    pub fn send_no_shutdown_on_err(
1916        self,
1917        mut status: i32,
1918        mut manager: Option<&VolumeManagerInfo>,
1919        mut volume: Option<&VolumeInfo>,
1920    ) -> Result<(), fidl::Error> {
1921        let _result = self.send_raw(status, manager, volume);
1922        self.drop_without_shutdown();
1923        _result
1924    }
1925
1926    fn send_raw(
1927        &self,
1928        mut status: i32,
1929        mut manager: Option<&VolumeManagerInfo>,
1930        mut volume: Option<&VolumeInfo>,
1931    ) -> Result<(), fidl::Error> {
1932        self.control_handle.inner.send::<VolumeGetVolumeInfoResponse>(
1933            (status, manager, volume),
1934            self.tx_id,
1935            0x60417b6cf9e34c80,
1936            fidl::encoding::DynamicFlags::empty(),
1937        )
1938    }
1939}
1940
1941#[must_use = "FIDL methods require a response to be sent"]
1942#[derive(Debug)]
1943pub struct VolumeExtendResponder {
1944    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1945    tx_id: u32,
1946}
1947
1948/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
1949/// if the responder is dropped without sending a response, so that the client
1950/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1951impl std::ops::Drop for VolumeExtendResponder {
1952    fn drop(&mut self) {
1953        self.control_handle.shutdown();
1954        // Safety: drops once, never accessed again
1955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1956    }
1957}
1958
1959impl fidl::endpoints::Responder for VolumeExtendResponder {
1960    type ControlHandle = VolumeControlHandle;
1961
1962    fn control_handle(&self) -> &VolumeControlHandle {
1963        &self.control_handle
1964    }
1965
1966    fn drop_without_shutdown(mut self) {
1967        // Safety: drops once, never accessed again due to mem::forget
1968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1969        // Prevent Drop from running (which would shut down the channel)
1970        std::mem::forget(self);
1971    }
1972}
1973
1974impl VolumeExtendResponder {
1975    /// Sends a response to the FIDL transaction.
1976    ///
1977    /// Sets the channel to shutdown if an error occurs.
1978    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1979        let _result = self.send_raw(status);
1980        if _result.is_err() {
1981            self.control_handle.shutdown();
1982        }
1983        self.drop_without_shutdown();
1984        _result
1985    }
1986
1987    /// Similar to "send" but does not shutdown the channel if an error occurs.
1988    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1989        let _result = self.send_raw(status);
1990        self.drop_without_shutdown();
1991        _result
1992    }
1993
1994    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1995        self.control_handle.inner.send::<VolumeExtendResponse>(
1996            (status,),
1997            self.tx_id,
1998            0xdddf872f5039d37,
1999            fidl::encoding::DynamicFlags::empty(),
2000        )
2001    }
2002}
2003
2004#[must_use = "FIDL methods require a response to be sent"]
2005#[derive(Debug)]
2006pub struct VolumeShrinkResponder {
2007    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
2008    tx_id: u32,
2009}
2010
2011/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
2012/// if the responder is dropped without sending a response, so that the client
2013/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2014impl std::ops::Drop for VolumeShrinkResponder {
2015    fn drop(&mut self) {
2016        self.control_handle.shutdown();
2017        // Safety: drops once, never accessed again
2018        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2019    }
2020}
2021
2022impl fidl::endpoints::Responder for VolumeShrinkResponder {
2023    type ControlHandle = VolumeControlHandle;
2024
2025    fn control_handle(&self) -> &VolumeControlHandle {
2026        &self.control_handle
2027    }
2028
2029    fn drop_without_shutdown(mut self) {
2030        // Safety: drops once, never accessed again due to mem::forget
2031        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2032        // Prevent Drop from running (which would shut down the channel)
2033        std::mem::forget(self);
2034    }
2035}
2036
2037impl VolumeShrinkResponder {
2038    /// Sends a response to the FIDL transaction.
2039    ///
2040    /// Sets the channel to shutdown if an error occurs.
2041    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2042        let _result = self.send_raw(status);
2043        if _result.is_err() {
2044            self.control_handle.shutdown();
2045        }
2046        self.drop_without_shutdown();
2047        _result
2048    }
2049
2050    /// Similar to "send" but does not shutdown the channel if an error occurs.
2051    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2052        let _result = self.send_raw(status);
2053        self.drop_without_shutdown();
2054        _result
2055    }
2056
2057    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2058        self.control_handle.inner.send::<VolumeShrinkResponse>(
2059            (status,),
2060            self.tx_id,
2061            0x27ab5ed4f6fdcd29,
2062            fidl::encoding::DynamicFlags::empty(),
2063        )
2064    }
2065}
2066
2067#[must_use = "FIDL methods require a response to be sent"]
2068#[derive(Debug)]
2069pub struct VolumeDestroyResponder {
2070    control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
2071    tx_id: u32,
2072}
2073
2074/// Set the the channel to be shutdown (see [`VolumeControlHandle::shutdown`])
2075/// if the responder is dropped without sending a response, so that the client
2076/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2077impl std::ops::Drop for VolumeDestroyResponder {
2078    fn drop(&mut self) {
2079        self.control_handle.shutdown();
2080        // Safety: drops once, never accessed again
2081        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2082    }
2083}
2084
2085impl fidl::endpoints::Responder for VolumeDestroyResponder {
2086    type ControlHandle = VolumeControlHandle;
2087
2088    fn control_handle(&self) -> &VolumeControlHandle {
2089        &self.control_handle
2090    }
2091
2092    fn drop_without_shutdown(mut self) {
2093        // Safety: drops once, never accessed again due to mem::forget
2094        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2095        // Prevent Drop from running (which would shut down the channel)
2096        std::mem::forget(self);
2097    }
2098}
2099
2100impl VolumeDestroyResponder {
2101    /// Sends a response to the FIDL transaction.
2102    ///
2103    /// Sets the channel to shutdown if an error occurs.
2104    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2105        let _result = self.send_raw(status);
2106        if _result.is_err() {
2107            self.control_handle.shutdown();
2108        }
2109        self.drop_without_shutdown();
2110        _result
2111    }
2112
2113    /// Similar to "send" but does not shutdown the channel if an error occurs.
2114    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2115        let _result = self.send_raw(status);
2116        self.drop_without_shutdown();
2117        _result
2118    }
2119
2120    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2121        self.control_handle.inner.send::<VolumeDestroyResponse>(
2122            (status,),
2123            self.tx_id,
2124            0x732bf4bea39b5e87,
2125            fidl::encoding::DynamicFlags::empty(),
2126        )
2127    }
2128}
2129
2130#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2131pub struct VolumeManagerMarker;
2132
2133impl fidl::endpoints::ProtocolMarker for VolumeManagerMarker {
2134    type Proxy = VolumeManagerProxy;
2135    type RequestStream = VolumeManagerRequestStream;
2136    #[cfg(target_os = "fuchsia")]
2137    type SynchronousProxy = VolumeManagerSynchronousProxy;
2138
2139    const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
2140}
2141pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
2142
2143pub trait VolumeManagerProxyInterface: Send + Sync {
2144    type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2145    fn r#allocate_partition(
2146        &self,
2147        slice_count: u64,
2148        type_: &fidl_fuchsia_hardware_block_partition::Guid,
2149        instance: &fidl_fuchsia_hardware_block_partition::Guid,
2150        name: &str,
2151        flags: u32,
2152    ) -> Self::AllocatePartitionResponseFut;
2153    type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
2154        + Send;
2155    fn r#get_info(&self) -> Self::GetInfoResponseFut;
2156    type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2157    fn r#activate(
2158        &self,
2159        old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2160        new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2161    ) -> Self::ActivateResponseFut;
2162    type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
2163        + Send;
2164    fn r#get_partition_limit(
2165        &self,
2166        guid: &fidl_fuchsia_hardware_block_partition::Guid,
2167    ) -> Self::GetPartitionLimitResponseFut;
2168    type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2169    fn r#set_partition_limit(
2170        &self,
2171        guid: &fidl_fuchsia_hardware_block_partition::Guid,
2172        slice_count: u64,
2173    ) -> Self::SetPartitionLimitResponseFut;
2174    type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
2175        + Send;
2176    fn r#set_partition_name(
2177        &self,
2178        guid: &fidl_fuchsia_hardware_block_partition::Guid,
2179        name: &str,
2180    ) -> Self::SetPartitionNameResponseFut;
2181}
2182#[derive(Debug)]
2183#[cfg(target_os = "fuchsia")]
2184pub struct VolumeManagerSynchronousProxy {
2185    client: fidl::client::sync::Client,
2186}
2187
2188#[cfg(target_os = "fuchsia")]
2189impl fidl::endpoints::SynchronousProxy for VolumeManagerSynchronousProxy {
2190    type Proxy = VolumeManagerProxy;
2191    type Protocol = VolumeManagerMarker;
2192
2193    fn from_channel(inner: fidl::Channel) -> Self {
2194        Self::new(inner)
2195    }
2196
2197    fn into_channel(self) -> fidl::Channel {
2198        self.client.into_channel()
2199    }
2200
2201    fn as_channel(&self) -> &fidl::Channel {
2202        self.client.as_channel()
2203    }
2204}
2205
2206#[cfg(target_os = "fuchsia")]
2207impl VolumeManagerSynchronousProxy {
2208    pub fn new(channel: fidl::Channel) -> Self {
2209        let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2210        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2211    }
2212
2213    pub fn into_channel(self) -> fidl::Channel {
2214        self.client.into_channel()
2215    }
2216
2217    /// Waits until an event arrives and returns it. It is safe for other
2218    /// threads to make concurrent requests while waiting for an event.
2219    pub fn wait_for_event(
2220        &self,
2221        deadline: zx::MonotonicInstant,
2222    ) -> Result<VolumeManagerEvent, fidl::Error> {
2223        VolumeManagerEvent::decode(self.client.wait_for_event(deadline)?)
2224    }
2225
2226    /// Allocates a virtual partition with the requested features.
2227    ///
2228    /// `slice_count` is the number of slices initially allocated to the partition, at
2229    /// offset zero. The number of slices allocated to a new partition must be at least one.
2230    /// `type` and `value` indicate type and instance GUIDs for the partition, respectively.
2231    /// `name` indicates the name of the new partition.
2232    pub fn r#allocate_partition(
2233        &self,
2234        mut slice_count: u64,
2235        mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2236        mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2237        mut name: &str,
2238        mut flags: u32,
2239        ___deadline: zx::MonotonicInstant,
2240    ) -> Result<i32, fidl::Error> {
2241        let _response = self.client.send_query::<
2242            VolumeManagerAllocatePartitionRequest,
2243            VolumeManagerAllocatePartitionResponse,
2244        >(
2245            (slice_count, type_, instance, name, flags,),
2246            0x4e79f24ed059e394,
2247            fidl::encoding::DynamicFlags::empty(),
2248            ___deadline,
2249        )?;
2250        Ok(_response.status)
2251    }
2252
2253    /// Gets the VolumeManagerInfo describing this instance of the `VolumeManager`.
2254    ///
2255    /// **NOTE**: GetInfo() is used to synchronize child partition device visibility with devfs.
2256    /// Implementations must only respond once all child partitions of `VolumeManager` have been
2257    /// added to devfs, to guarantee clients can safely enumerate them.
2258    ///
2259    /// See https://fxbug.dev/42077585 for more information.
2260    pub fn r#get_info(
2261        &self,
2262        ___deadline: zx::MonotonicInstant,
2263    ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2264        let _response =
2265            self.client.send_query::<fidl::encoding::EmptyPayload, VolumeManagerGetInfoResponse>(
2266                (),
2267                0x735b3548582b2c9,
2268                fidl::encoding::DynamicFlags::empty(),
2269                ___deadline,
2270            )?;
2271        Ok((_response.status, _response.info))
2272    }
2273
2274    /// Atomically marks a vpartition (by instance GUID) as inactive, while finding
2275    /// another partition (by instance GUID) and marking it as active.
2276    ///
2277    /// If the "old" partition does not exist, the GUID is ignored.
2278    /// If the "old" partition is the same as the "new" partition, the "old"
2279    /// GUID is ignored.
2280    /// If the "new" partition does not exist, `ZX_ERR_NOT_FOUND` is returned.
2281    ///
2282    /// This function does not destroy the "old" partition, it just marks it as
2283    /// inactive -- to reclaim that space, the "old" partition must be explicitly
2284    /// destroyed.  This destruction can also occur automatically when the FVM driver
2285    /// is rebound (i.e., on reboot).
2286    ///
2287    /// This function may be useful for A/B updates within the FVM,
2288    /// since it will allow activating updated partitions.
2289    pub fn r#activate(
2290        &self,
2291        mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2292        mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2293        ___deadline: zx::MonotonicInstant,
2294    ) -> Result<i32, fidl::Error> {
2295        let _response =
2296            self.client.send_query::<VolumeManagerActivateRequest, VolumeManagerActivateResponse>(
2297                (old_guid, new_guid),
2298                0xc8cef57012874d0,
2299                fidl::encoding::DynamicFlags::empty(),
2300                ___deadline,
2301            )?;
2302        Ok(_response.status)
2303    }
2304
2305    /// Retrieves the allocation limit for the partition. A return value of 0 indicates that there
2306    /// is no limit and the partition can be extended as long as there is available space on the
2307    /// device.
2308    ///
2309    /// The partition may be larger than this limit if a smaller limit was applied after the
2310    /// partition had already grown to the current size.
2311    ///
2312    /// Currently the partition limit is not persisted across reboots but this may change in the
2313    /// future.
2314    pub fn r#get_partition_limit(
2315        &self,
2316        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2317        ___deadline: zx::MonotonicInstant,
2318    ) -> Result<(i32, u64), fidl::Error> {
2319        let _response = self.client.send_query::<
2320            VolumeManagerGetPartitionLimitRequest,
2321            VolumeManagerGetPartitionLimitResponse,
2322        >(
2323            (guid,),
2324            0x6e32f6df9fa2a919,
2325            fidl::encoding::DynamicFlags::empty(),
2326            ___deadline,
2327        )?;
2328        Ok((_response.status, _response.slice_count))
2329    }
2330
2331    /// Sets the allocation limit for the partition. Partitions can not be extended beyond their
2332    /// allocation limit. The partition limit will never shrink partitions so if this value is
2333    /// less than the current partition size, it will keep the current size but prevent further
2334    /// growth.
2335    ///
2336    /// The allocation limits are on the VolumeManager API rather than on the partition because
2337    /// they represent a higher capability level. These limits are designed to put guards on
2338    /// users of the block device (and hence the Volume API).
2339    ///
2340    /// Currently the partition limit is not persisted across reboots but this may change in the
2341    /// future.
2342    pub fn r#set_partition_limit(
2343        &self,
2344        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2345        mut slice_count: u64,
2346        ___deadline: zx::MonotonicInstant,
2347    ) -> Result<i32, fidl::Error> {
2348        let _response = self.client.send_query::<
2349            VolumeManagerSetPartitionLimitRequest,
2350            VolumeManagerSetPartitionLimitResponse,
2351        >(
2352            (guid, slice_count,),
2353            0x2e09076ef266fa35,
2354            fidl::encoding::DynamicFlags::empty(),
2355            ___deadline,
2356        )?;
2357        Ok(_response.status)
2358    }
2359
2360    /// Renames the specified partition. Any existing devices that include the name of the partition
2361    /// in their topological path might *not* reflect the name change until the next time that the
2362    /// device is instantiated.
2363    pub fn r#set_partition_name(
2364        &self,
2365        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2366        mut name: &str,
2367        ___deadline: zx::MonotonicInstant,
2368    ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
2369        let _response = self.client.send_query::<
2370            VolumeManagerSetPartitionNameRequest,
2371            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2372        >(
2373            (guid, name,),
2374            0x4539a9b95cba0397,
2375            fidl::encoding::DynamicFlags::empty(),
2376            ___deadline,
2377        )?;
2378        Ok(_response.map(|x| x))
2379    }
2380}
2381
2382#[cfg(target_os = "fuchsia")]
2383impl From<VolumeManagerSynchronousProxy> for zx::Handle {
2384    fn from(value: VolumeManagerSynchronousProxy) -> Self {
2385        value.into_channel().into()
2386    }
2387}
2388
2389#[cfg(target_os = "fuchsia")]
2390impl From<fidl::Channel> for VolumeManagerSynchronousProxy {
2391    fn from(value: fidl::Channel) -> Self {
2392        Self::new(value)
2393    }
2394}
2395
2396#[cfg(target_os = "fuchsia")]
2397impl fidl::endpoints::FromClient for VolumeManagerSynchronousProxy {
2398    type Protocol = VolumeManagerMarker;
2399
2400    fn from_client(value: fidl::endpoints::ClientEnd<VolumeManagerMarker>) -> Self {
2401        Self::new(value.into_channel())
2402    }
2403}
2404
2405#[derive(Debug, Clone)]
2406pub struct VolumeManagerProxy {
2407    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2408}
2409
2410impl fidl::endpoints::Proxy for VolumeManagerProxy {
2411    type Protocol = VolumeManagerMarker;
2412
2413    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2414        Self::new(inner)
2415    }
2416
2417    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2418        self.client.into_channel().map_err(|client| Self { client })
2419    }
2420
2421    fn as_channel(&self) -> &::fidl::AsyncChannel {
2422        self.client.as_channel()
2423    }
2424}
2425
2426impl VolumeManagerProxy {
2427    /// Create a new Proxy for fuchsia.hardware.block.volume/VolumeManager.
2428    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2429        let protocol_name = <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2430        Self { client: fidl::client::Client::new(channel, protocol_name) }
2431    }
2432
2433    /// Get a Stream of events from the remote end of the protocol.
2434    ///
2435    /// # Panics
2436    ///
2437    /// Panics if the event stream was already taken.
2438    pub fn take_event_stream(&self) -> VolumeManagerEventStream {
2439        VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
2440    }
2441
2442    /// Allocates a virtual partition with the requested features.
2443    ///
2444    /// `slice_count` is the number of slices initially allocated to the partition, at
2445    /// offset zero. The number of slices allocated to a new partition must be at least one.
2446    /// `type` and `value` indicate type and instance GUIDs for the partition, respectively.
2447    /// `name` indicates the name of the new partition.
2448    pub fn r#allocate_partition(
2449        &self,
2450        mut slice_count: u64,
2451        mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2452        mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2453        mut name: &str,
2454        mut flags: u32,
2455    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2456        VolumeManagerProxyInterface::r#allocate_partition(
2457            self,
2458            slice_count,
2459            type_,
2460            instance,
2461            name,
2462            flags,
2463        )
2464    }
2465
2466    /// Gets the VolumeManagerInfo describing this instance of the `VolumeManager`.
2467    ///
2468    /// **NOTE**: GetInfo() is used to synchronize child partition device visibility with devfs.
2469    /// Implementations must only respond once all child partitions of `VolumeManager` have been
2470    /// added to devfs, to guarantee clients can safely enumerate them.
2471    ///
2472    /// See https://fxbug.dev/42077585 for more information.
2473    pub fn r#get_info(
2474        &self,
2475    ) -> fidl::client::QueryResponseFut<
2476        (i32, Option<Box<VolumeManagerInfo>>),
2477        fidl::encoding::DefaultFuchsiaResourceDialect,
2478    > {
2479        VolumeManagerProxyInterface::r#get_info(self)
2480    }
2481
2482    /// Atomically marks a vpartition (by instance GUID) as inactive, while finding
2483    /// another partition (by instance GUID) and marking it as active.
2484    ///
2485    /// If the "old" partition does not exist, the GUID is ignored.
2486    /// If the "old" partition is the same as the "new" partition, the "old"
2487    /// GUID is ignored.
2488    /// If the "new" partition does not exist, `ZX_ERR_NOT_FOUND` is returned.
2489    ///
2490    /// This function does not destroy the "old" partition, it just marks it as
2491    /// inactive -- to reclaim that space, the "old" partition must be explicitly
2492    /// destroyed.  This destruction can also occur automatically when the FVM driver
2493    /// is rebound (i.e., on reboot).
2494    ///
2495    /// This function may be useful for A/B updates within the FVM,
2496    /// since it will allow activating updated partitions.
2497    pub fn r#activate(
2498        &self,
2499        mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2500        mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2501    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2502        VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
2503    }
2504
2505    /// Retrieves the allocation limit for the partition. A return value of 0 indicates that there
2506    /// is no limit and the partition can be extended as long as there is available space on the
2507    /// device.
2508    ///
2509    /// The partition may be larger than this limit if a smaller limit was applied after the
2510    /// partition had already grown to the current size.
2511    ///
2512    /// Currently the partition limit is not persisted across reboots but this may change in the
2513    /// future.
2514    pub fn r#get_partition_limit(
2515        &self,
2516        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2517    ) -> fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>
2518    {
2519        VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
2520    }
2521
2522    /// Sets the allocation limit for the partition. Partitions can not be extended beyond their
2523    /// allocation limit. The partition limit will never shrink partitions so if this value is
2524    /// less than the current partition size, it will keep the current size but prevent further
2525    /// growth.
2526    ///
2527    /// The allocation limits are on the VolumeManager API rather than on the partition because
2528    /// they represent a higher capability level. These limits are designed to put guards on
2529    /// users of the block device (and hence the Volume API).
2530    ///
2531    /// Currently the partition limit is not persisted across reboots but this may change in the
2532    /// future.
2533    pub fn r#set_partition_limit(
2534        &self,
2535        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2536        mut slice_count: u64,
2537    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2538        VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
2539    }
2540
2541    /// Renames the specified partition. Any existing devices that include the name of the partition
2542    /// in their topological path might *not* reflect the name change until the next time that the
2543    /// device is instantiated.
2544    pub fn r#set_partition_name(
2545        &self,
2546        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2547        mut name: &str,
2548    ) -> fidl::client::QueryResponseFut<
2549        VolumeManagerSetPartitionNameResult,
2550        fidl::encoding::DefaultFuchsiaResourceDialect,
2551    > {
2552        VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
2553    }
2554}
2555
2556impl VolumeManagerProxyInterface for VolumeManagerProxy {
2557    type AllocatePartitionResponseFut =
2558        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2559    fn r#allocate_partition(
2560        &self,
2561        mut slice_count: u64,
2562        mut type_: &fidl_fuchsia_hardware_block_partition::Guid,
2563        mut instance: &fidl_fuchsia_hardware_block_partition::Guid,
2564        mut name: &str,
2565        mut flags: u32,
2566    ) -> Self::AllocatePartitionResponseFut {
2567        fn _decode(
2568            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2569        ) -> Result<i32, fidl::Error> {
2570            let _response = fidl::client::decode_transaction_body::<
2571                VolumeManagerAllocatePartitionResponse,
2572                fidl::encoding::DefaultFuchsiaResourceDialect,
2573                0x4e79f24ed059e394,
2574            >(_buf?)?;
2575            Ok(_response.status)
2576        }
2577        self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
2578            (slice_count, type_, instance, name, flags),
2579            0x4e79f24ed059e394,
2580            fidl::encoding::DynamicFlags::empty(),
2581            _decode,
2582        )
2583    }
2584
2585    type GetInfoResponseFut = fidl::client::QueryResponseFut<
2586        (i32, Option<Box<VolumeManagerInfo>>),
2587        fidl::encoding::DefaultFuchsiaResourceDialect,
2588    >;
2589    fn r#get_info(&self) -> Self::GetInfoResponseFut {
2590        fn _decode(
2591            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2592        ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
2593            let _response = fidl::client::decode_transaction_body::<
2594                VolumeManagerGetInfoResponse,
2595                fidl::encoding::DefaultFuchsiaResourceDialect,
2596                0x735b3548582b2c9,
2597            >(_buf?)?;
2598            Ok((_response.status, _response.info))
2599        }
2600        self.client.send_query_and_decode::<
2601            fidl::encoding::EmptyPayload,
2602            (i32, Option<Box<VolumeManagerInfo>>),
2603        >(
2604            (),
2605            0x735b3548582b2c9,
2606            fidl::encoding::DynamicFlags::empty(),
2607            _decode,
2608        )
2609    }
2610
2611    type ActivateResponseFut =
2612        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2613    fn r#activate(
2614        &self,
2615        mut old_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2616        mut new_guid: &fidl_fuchsia_hardware_block_partition::Guid,
2617    ) -> Self::ActivateResponseFut {
2618        fn _decode(
2619            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2620        ) -> Result<i32, fidl::Error> {
2621            let _response = fidl::client::decode_transaction_body::<
2622                VolumeManagerActivateResponse,
2623                fidl::encoding::DefaultFuchsiaResourceDialect,
2624                0xc8cef57012874d0,
2625            >(_buf?)?;
2626            Ok(_response.status)
2627        }
2628        self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
2629            (old_guid, new_guid),
2630            0xc8cef57012874d0,
2631            fidl::encoding::DynamicFlags::empty(),
2632            _decode,
2633        )
2634    }
2635
2636    type GetPartitionLimitResponseFut =
2637        fidl::client::QueryResponseFut<(i32, u64), fidl::encoding::DefaultFuchsiaResourceDialect>;
2638    fn r#get_partition_limit(
2639        &self,
2640        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2641    ) -> Self::GetPartitionLimitResponseFut {
2642        fn _decode(
2643            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2644        ) -> Result<(i32, u64), fidl::Error> {
2645            let _response = fidl::client::decode_transaction_body::<
2646                VolumeManagerGetPartitionLimitResponse,
2647                fidl::encoding::DefaultFuchsiaResourceDialect,
2648                0x6e32f6df9fa2a919,
2649            >(_buf?)?;
2650            Ok((_response.status, _response.slice_count))
2651        }
2652        self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
2653            (guid,),
2654            0x6e32f6df9fa2a919,
2655            fidl::encoding::DynamicFlags::empty(),
2656            _decode,
2657        )
2658    }
2659
2660    type SetPartitionLimitResponseFut =
2661        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2662    fn r#set_partition_limit(
2663        &self,
2664        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2665        mut slice_count: u64,
2666    ) -> Self::SetPartitionLimitResponseFut {
2667        fn _decode(
2668            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2669        ) -> Result<i32, fidl::Error> {
2670            let _response = fidl::client::decode_transaction_body::<
2671                VolumeManagerSetPartitionLimitResponse,
2672                fidl::encoding::DefaultFuchsiaResourceDialect,
2673                0x2e09076ef266fa35,
2674            >(_buf?)?;
2675            Ok(_response.status)
2676        }
2677        self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
2678            (guid, slice_count),
2679            0x2e09076ef266fa35,
2680            fidl::encoding::DynamicFlags::empty(),
2681            _decode,
2682        )
2683    }
2684
2685    type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
2686        VolumeManagerSetPartitionNameResult,
2687        fidl::encoding::DefaultFuchsiaResourceDialect,
2688    >;
2689    fn r#set_partition_name(
2690        &self,
2691        mut guid: &fidl_fuchsia_hardware_block_partition::Guid,
2692        mut name: &str,
2693    ) -> Self::SetPartitionNameResponseFut {
2694        fn _decode(
2695            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2696        ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
2697            let _response = fidl::client::decode_transaction_body::<
2698                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2699                fidl::encoding::DefaultFuchsiaResourceDialect,
2700                0x4539a9b95cba0397,
2701            >(_buf?)?;
2702            Ok(_response.map(|x| x))
2703        }
2704        self.client.send_query_and_decode::<
2705            VolumeManagerSetPartitionNameRequest,
2706            VolumeManagerSetPartitionNameResult,
2707        >(
2708            (guid, name,),
2709            0x4539a9b95cba0397,
2710            fidl::encoding::DynamicFlags::empty(),
2711            _decode,
2712        )
2713    }
2714}
2715
2716pub struct VolumeManagerEventStream {
2717    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2718}
2719
2720impl std::marker::Unpin for VolumeManagerEventStream {}
2721
2722impl futures::stream::FusedStream for VolumeManagerEventStream {
2723    fn is_terminated(&self) -> bool {
2724        self.event_receiver.is_terminated()
2725    }
2726}
2727
2728impl futures::Stream for VolumeManagerEventStream {
2729    type Item = Result<VolumeManagerEvent, fidl::Error>;
2730
2731    fn poll_next(
2732        mut self: std::pin::Pin<&mut Self>,
2733        cx: &mut std::task::Context<'_>,
2734    ) -> std::task::Poll<Option<Self::Item>> {
2735        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2736            &mut self.event_receiver,
2737            cx
2738        )?) {
2739            Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
2740            None => std::task::Poll::Ready(None),
2741        }
2742    }
2743}
2744
2745#[derive(Debug)]
2746pub enum VolumeManagerEvent {}
2747
2748impl VolumeManagerEvent {
2749    /// Decodes a message buffer as a [`VolumeManagerEvent`].
2750    fn decode(
2751        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2752    ) -> Result<VolumeManagerEvent, fidl::Error> {
2753        let (bytes, _handles) = buf.split_mut();
2754        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2755        debug_assert_eq!(tx_header.tx_id, 0);
2756        match tx_header.ordinal {
2757            _ => Err(fidl::Error::UnknownOrdinal {
2758                ordinal: tx_header.ordinal,
2759                protocol_name: <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2760            }),
2761        }
2762    }
2763}
2764
2765/// A Stream of incoming requests for fuchsia.hardware.block.volume/VolumeManager.
2766pub struct VolumeManagerRequestStream {
2767    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2768    is_terminated: bool,
2769}
2770
2771impl std::marker::Unpin for VolumeManagerRequestStream {}
2772
2773impl futures::stream::FusedStream for VolumeManagerRequestStream {
2774    fn is_terminated(&self) -> bool {
2775        self.is_terminated
2776    }
2777}
2778
2779impl fidl::endpoints::RequestStream for VolumeManagerRequestStream {
2780    type Protocol = VolumeManagerMarker;
2781    type ControlHandle = VolumeManagerControlHandle;
2782
2783    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2784        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2785    }
2786
2787    fn control_handle(&self) -> Self::ControlHandle {
2788        VolumeManagerControlHandle { inner: self.inner.clone() }
2789    }
2790
2791    fn into_inner(
2792        self,
2793    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2794    {
2795        (self.inner, self.is_terminated)
2796    }
2797
2798    fn from_inner(
2799        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2800        is_terminated: bool,
2801    ) -> Self {
2802        Self { inner, is_terminated }
2803    }
2804}
2805
2806impl futures::Stream for VolumeManagerRequestStream {
2807    type Item = Result<VolumeManagerRequest, fidl::Error>;
2808
2809    fn poll_next(
2810        mut self: std::pin::Pin<&mut Self>,
2811        cx: &mut std::task::Context<'_>,
2812    ) -> std::task::Poll<Option<Self::Item>> {
2813        let this = &mut *self;
2814        if this.inner.check_shutdown(cx) {
2815            this.is_terminated = true;
2816            return std::task::Poll::Ready(None);
2817        }
2818        if this.is_terminated {
2819            panic!("polled VolumeManagerRequestStream after completion");
2820        }
2821        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2822            |bytes, handles| {
2823                match this.inner.channel().read_etc(cx, bytes, handles) {
2824                    std::task::Poll::Ready(Ok(())) => {}
2825                    std::task::Poll::Pending => return std::task::Poll::Pending,
2826                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2827                        this.is_terminated = true;
2828                        return std::task::Poll::Ready(None);
2829                    }
2830                    std::task::Poll::Ready(Err(e)) => {
2831                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2832                            e.into(),
2833                        ))))
2834                    }
2835                }
2836
2837                // A message has been received from the channel
2838                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2839
2840                std::task::Poll::Ready(Some(match header.ordinal {
2841                    0x4e79f24ed059e394 => {
2842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2843                        let mut req = fidl::new_empty!(
2844                            VolumeManagerAllocatePartitionRequest,
2845                            fidl::encoding::DefaultFuchsiaResourceDialect
2846                        );
2847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
2848                        let control_handle =
2849                            VolumeManagerControlHandle { inner: this.inner.clone() };
2850                        Ok(VolumeManagerRequest::AllocatePartition {
2851                            slice_count: req.slice_count,
2852                            type_: req.type_,
2853                            instance: req.instance,
2854                            name: req.name,
2855                            flags: req.flags,
2856
2857                            responder: VolumeManagerAllocatePartitionResponder {
2858                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2859                                tx_id: header.tx_id,
2860                            },
2861                        })
2862                    }
2863                    0x735b3548582b2c9 => {
2864                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2865                        let mut req = fidl::new_empty!(
2866                            fidl::encoding::EmptyPayload,
2867                            fidl::encoding::DefaultFuchsiaResourceDialect
2868                        );
2869                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2870                        let control_handle =
2871                            VolumeManagerControlHandle { inner: this.inner.clone() };
2872                        Ok(VolumeManagerRequest::GetInfo {
2873                            responder: VolumeManagerGetInfoResponder {
2874                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2875                                tx_id: header.tx_id,
2876                            },
2877                        })
2878                    }
2879                    0xc8cef57012874d0 => {
2880                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2881                        let mut req = fidl::new_empty!(
2882                            VolumeManagerActivateRequest,
2883                            fidl::encoding::DefaultFuchsiaResourceDialect
2884                        );
2885                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
2886                        let control_handle =
2887                            VolumeManagerControlHandle { inner: this.inner.clone() };
2888                        Ok(VolumeManagerRequest::Activate {
2889                            old_guid: req.old_guid,
2890                            new_guid: req.new_guid,
2891
2892                            responder: VolumeManagerActivateResponder {
2893                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2894                                tx_id: header.tx_id,
2895                            },
2896                        })
2897                    }
2898                    0x6e32f6df9fa2a919 => {
2899                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2900                        let mut req = fidl::new_empty!(
2901                            VolumeManagerGetPartitionLimitRequest,
2902                            fidl::encoding::DefaultFuchsiaResourceDialect
2903                        );
2904                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
2905                        let control_handle =
2906                            VolumeManagerControlHandle { inner: this.inner.clone() };
2907                        Ok(VolumeManagerRequest::GetPartitionLimit {
2908                            guid: req.guid,
2909
2910                            responder: VolumeManagerGetPartitionLimitResponder {
2911                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2912                                tx_id: header.tx_id,
2913                            },
2914                        })
2915                    }
2916                    0x2e09076ef266fa35 => {
2917                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2918                        let mut req = fidl::new_empty!(
2919                            VolumeManagerSetPartitionLimitRequest,
2920                            fidl::encoding::DefaultFuchsiaResourceDialect
2921                        );
2922                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
2923                        let control_handle =
2924                            VolumeManagerControlHandle { inner: this.inner.clone() };
2925                        Ok(VolumeManagerRequest::SetPartitionLimit {
2926                            guid: req.guid,
2927                            slice_count: req.slice_count,
2928
2929                            responder: VolumeManagerSetPartitionLimitResponder {
2930                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2931                                tx_id: header.tx_id,
2932                            },
2933                        })
2934                    }
2935                    0x4539a9b95cba0397 => {
2936                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2937                        let mut req = fidl::new_empty!(
2938                            VolumeManagerSetPartitionNameRequest,
2939                            fidl::encoding::DefaultFuchsiaResourceDialect
2940                        );
2941                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
2942                        let control_handle =
2943                            VolumeManagerControlHandle { inner: this.inner.clone() };
2944                        Ok(VolumeManagerRequest::SetPartitionName {
2945                            guid: req.guid,
2946                            name: req.name,
2947
2948                            responder: VolumeManagerSetPartitionNameResponder {
2949                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2950                                tx_id: header.tx_id,
2951                            },
2952                        })
2953                    }
2954                    _ => Err(fidl::Error::UnknownOrdinal {
2955                        ordinal: header.ordinal,
2956                        protocol_name:
2957                            <VolumeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2958                    }),
2959                }))
2960            },
2961        )
2962    }
2963}
2964
2965/// VolumeManager controls a collection of Volumes.
2966#[derive(Debug)]
2967pub enum VolumeManagerRequest {
2968    /// Allocates a virtual partition with the requested features.
2969    ///
2970    /// `slice_count` is the number of slices initially allocated to the partition, at
2971    /// offset zero. The number of slices allocated to a new partition must be at least one.
2972    /// `type` and `value` indicate type and instance GUIDs for the partition, respectively.
2973    /// `name` indicates the name of the new partition.
2974    AllocatePartition {
2975        slice_count: u64,
2976        type_: fidl_fuchsia_hardware_block_partition::Guid,
2977        instance: fidl_fuchsia_hardware_block_partition::Guid,
2978        name: String,
2979        flags: u32,
2980        responder: VolumeManagerAllocatePartitionResponder,
2981    },
2982    /// Gets the VolumeManagerInfo describing this instance of the `VolumeManager`.
2983    ///
2984    /// **NOTE**: GetInfo() is used to synchronize child partition device visibility with devfs.
2985    /// Implementations must only respond once all child partitions of `VolumeManager` have been
2986    /// added to devfs, to guarantee clients can safely enumerate them.
2987    ///
2988    /// See https://fxbug.dev/42077585 for more information.
2989    GetInfo { responder: VolumeManagerGetInfoResponder },
2990    /// Atomically marks a vpartition (by instance GUID) as inactive, while finding
2991    /// another partition (by instance GUID) and marking it as active.
2992    ///
2993    /// If the "old" partition does not exist, the GUID is ignored.
2994    /// If the "old" partition is the same as the "new" partition, the "old"
2995    /// GUID is ignored.
2996    /// If the "new" partition does not exist, `ZX_ERR_NOT_FOUND` is returned.
2997    ///
2998    /// This function does not destroy the "old" partition, it just marks it as
2999    /// inactive -- to reclaim that space, the "old" partition must be explicitly
3000    /// destroyed.  This destruction can also occur automatically when the FVM driver
3001    /// is rebound (i.e., on reboot).
3002    ///
3003    /// This function may be useful for A/B updates within the FVM,
3004    /// since it will allow activating updated partitions.
3005    Activate {
3006        old_guid: fidl_fuchsia_hardware_block_partition::Guid,
3007        new_guid: fidl_fuchsia_hardware_block_partition::Guid,
3008        responder: VolumeManagerActivateResponder,
3009    },
3010    /// Retrieves the allocation limit for the partition. A return value of 0 indicates that there
3011    /// is no limit and the partition can be extended as long as there is available space on the
3012    /// device.
3013    ///
3014    /// The partition may be larger than this limit if a smaller limit was applied after the
3015    /// partition had already grown to the current size.
3016    ///
3017    /// Currently the partition limit is not persisted across reboots but this may change in the
3018    /// future.
3019    GetPartitionLimit {
3020        guid: fidl_fuchsia_hardware_block_partition::Guid,
3021        responder: VolumeManagerGetPartitionLimitResponder,
3022    },
3023    /// Sets the allocation limit for the partition. Partitions can not be extended beyond their
3024    /// allocation limit. The partition limit will never shrink partitions so if this value is
3025    /// less than the current partition size, it will keep the current size but prevent further
3026    /// growth.
3027    ///
3028    /// The allocation limits are on the VolumeManager API rather than on the partition because
3029    /// they represent a higher capability level. These limits are designed to put guards on
3030    /// users of the block device (and hence the Volume API).
3031    ///
3032    /// Currently the partition limit is not persisted across reboots but this may change in the
3033    /// future.
3034    SetPartitionLimit {
3035        guid: fidl_fuchsia_hardware_block_partition::Guid,
3036        slice_count: u64,
3037        responder: VolumeManagerSetPartitionLimitResponder,
3038    },
3039    /// Renames the specified partition. Any existing devices that include the name of the partition
3040    /// in their topological path might *not* reflect the name change until the next time that the
3041    /// device is instantiated.
3042    SetPartitionName {
3043        guid: fidl_fuchsia_hardware_block_partition::Guid,
3044        name: String,
3045        responder: VolumeManagerSetPartitionNameResponder,
3046    },
3047}
3048
3049impl VolumeManagerRequest {
3050    #[allow(irrefutable_let_patterns)]
3051    pub fn into_allocate_partition(
3052        self,
3053    ) -> Option<(
3054        u64,
3055        fidl_fuchsia_hardware_block_partition::Guid,
3056        fidl_fuchsia_hardware_block_partition::Guid,
3057        String,
3058        u32,
3059        VolumeManagerAllocatePartitionResponder,
3060    )> {
3061        if let VolumeManagerRequest::AllocatePartition {
3062            slice_count,
3063            type_,
3064            instance,
3065            name,
3066            flags,
3067            responder,
3068        } = self
3069        {
3070            Some((slice_count, type_, instance, name, flags, responder))
3071        } else {
3072            None
3073        }
3074    }
3075
3076    #[allow(irrefutable_let_patterns)]
3077    pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
3078        if let VolumeManagerRequest::GetInfo { responder } = self {
3079            Some((responder))
3080        } else {
3081            None
3082        }
3083    }
3084
3085    #[allow(irrefutable_let_patterns)]
3086    pub fn into_activate(
3087        self,
3088    ) -> Option<(
3089        fidl_fuchsia_hardware_block_partition::Guid,
3090        fidl_fuchsia_hardware_block_partition::Guid,
3091        VolumeManagerActivateResponder,
3092    )> {
3093        if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
3094            Some((old_guid, new_guid, responder))
3095        } else {
3096            None
3097        }
3098    }
3099
3100    #[allow(irrefutable_let_patterns)]
3101    pub fn into_get_partition_limit(
3102        self,
3103    ) -> Option<(
3104        fidl_fuchsia_hardware_block_partition::Guid,
3105        VolumeManagerGetPartitionLimitResponder,
3106    )> {
3107        if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
3108            Some((guid, responder))
3109        } else {
3110            None
3111        }
3112    }
3113
3114    #[allow(irrefutable_let_patterns)]
3115    pub fn into_set_partition_limit(
3116        self,
3117    ) -> Option<(
3118        fidl_fuchsia_hardware_block_partition::Guid,
3119        u64,
3120        VolumeManagerSetPartitionLimitResponder,
3121    )> {
3122        if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
3123            Some((guid, slice_count, responder))
3124        } else {
3125            None
3126        }
3127    }
3128
3129    #[allow(irrefutable_let_patterns)]
3130    pub fn into_set_partition_name(
3131        self,
3132    ) -> Option<(
3133        fidl_fuchsia_hardware_block_partition::Guid,
3134        String,
3135        VolumeManagerSetPartitionNameResponder,
3136    )> {
3137        if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
3138            Some((guid, name, responder))
3139        } else {
3140            None
3141        }
3142    }
3143
3144    /// Name of the method defined in FIDL
3145    pub fn method_name(&self) -> &'static str {
3146        match *self {
3147            VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
3148            VolumeManagerRequest::GetInfo { .. } => "get_info",
3149            VolumeManagerRequest::Activate { .. } => "activate",
3150            VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
3151            VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
3152            VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
3153        }
3154    }
3155}
3156
3157#[derive(Debug, Clone)]
3158pub struct VolumeManagerControlHandle {
3159    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3160}
3161
3162impl fidl::endpoints::ControlHandle for VolumeManagerControlHandle {
3163    fn shutdown(&self) {
3164        self.inner.shutdown()
3165    }
3166    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3167        self.inner.shutdown_with_epitaph(status)
3168    }
3169
3170    fn is_closed(&self) -> bool {
3171        self.inner.channel().is_closed()
3172    }
3173    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3174        self.inner.channel().on_closed()
3175    }
3176
3177    #[cfg(target_os = "fuchsia")]
3178    fn signal_peer(
3179        &self,
3180        clear_mask: zx::Signals,
3181        set_mask: zx::Signals,
3182    ) -> Result<(), zx_status::Status> {
3183        use fidl::Peered;
3184        self.inner.channel().signal_peer(clear_mask, set_mask)
3185    }
3186}
3187
3188impl VolumeManagerControlHandle {}
3189
3190#[must_use = "FIDL methods require a response to be sent"]
3191#[derive(Debug)]
3192pub struct VolumeManagerAllocatePartitionResponder {
3193    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3194    tx_id: u32,
3195}
3196
3197/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
3198/// if the responder is dropped without sending a response, so that the client
3199/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3200impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
3201    fn drop(&mut self) {
3202        self.control_handle.shutdown();
3203        // Safety: drops once, never accessed again
3204        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3205    }
3206}
3207
3208impl fidl::endpoints::Responder for VolumeManagerAllocatePartitionResponder {
3209    type ControlHandle = VolumeManagerControlHandle;
3210
3211    fn control_handle(&self) -> &VolumeManagerControlHandle {
3212        &self.control_handle
3213    }
3214
3215    fn drop_without_shutdown(mut self) {
3216        // Safety: drops once, never accessed again due to mem::forget
3217        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3218        // Prevent Drop from running (which would shut down the channel)
3219        std::mem::forget(self);
3220    }
3221}
3222
3223impl VolumeManagerAllocatePartitionResponder {
3224    /// Sends a response to the FIDL transaction.
3225    ///
3226    /// Sets the channel to shutdown if an error occurs.
3227    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3228        let _result = self.send_raw(status);
3229        if _result.is_err() {
3230            self.control_handle.shutdown();
3231        }
3232        self.drop_without_shutdown();
3233        _result
3234    }
3235
3236    /// Similar to "send" but does not shutdown the channel if an error occurs.
3237    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3238        let _result = self.send_raw(status);
3239        self.drop_without_shutdown();
3240        _result
3241    }
3242
3243    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3244        self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
3245            (status,),
3246            self.tx_id,
3247            0x4e79f24ed059e394,
3248            fidl::encoding::DynamicFlags::empty(),
3249        )
3250    }
3251}
3252
3253#[must_use = "FIDL methods require a response to be sent"]
3254#[derive(Debug)]
3255pub struct VolumeManagerGetInfoResponder {
3256    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3257    tx_id: u32,
3258}
3259
3260/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
3261/// if the responder is dropped without sending a response, so that the client
3262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3263impl std::ops::Drop for VolumeManagerGetInfoResponder {
3264    fn drop(&mut self) {
3265        self.control_handle.shutdown();
3266        // Safety: drops once, never accessed again
3267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3268    }
3269}
3270
3271impl fidl::endpoints::Responder for VolumeManagerGetInfoResponder {
3272    type ControlHandle = VolumeManagerControlHandle;
3273
3274    fn control_handle(&self) -> &VolumeManagerControlHandle {
3275        &self.control_handle
3276    }
3277
3278    fn drop_without_shutdown(mut self) {
3279        // Safety: drops once, never accessed again due to mem::forget
3280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3281        // Prevent Drop from running (which would shut down the channel)
3282        std::mem::forget(self);
3283    }
3284}
3285
3286impl VolumeManagerGetInfoResponder {
3287    /// Sends a response to the FIDL transaction.
3288    ///
3289    /// Sets the channel to shutdown if an error occurs.
3290    pub fn send(
3291        self,
3292        mut status: i32,
3293        mut info: Option<&VolumeManagerInfo>,
3294    ) -> Result<(), fidl::Error> {
3295        let _result = self.send_raw(status, info);
3296        if _result.is_err() {
3297            self.control_handle.shutdown();
3298        }
3299        self.drop_without_shutdown();
3300        _result
3301    }
3302
3303    /// Similar to "send" but does not shutdown the channel if an error occurs.
3304    pub fn send_no_shutdown_on_err(
3305        self,
3306        mut status: i32,
3307        mut info: Option<&VolumeManagerInfo>,
3308    ) -> Result<(), fidl::Error> {
3309        let _result = self.send_raw(status, info);
3310        self.drop_without_shutdown();
3311        _result
3312    }
3313
3314    fn send_raw(
3315        &self,
3316        mut status: i32,
3317        mut info: Option<&VolumeManagerInfo>,
3318    ) -> Result<(), fidl::Error> {
3319        self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
3320            (status, info),
3321            self.tx_id,
3322            0x735b3548582b2c9,
3323            fidl::encoding::DynamicFlags::empty(),
3324        )
3325    }
3326}
3327
3328#[must_use = "FIDL methods require a response to be sent"]
3329#[derive(Debug)]
3330pub struct VolumeManagerActivateResponder {
3331    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3332    tx_id: u32,
3333}
3334
3335/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
3336/// if the responder is dropped without sending a response, so that the client
3337/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3338impl std::ops::Drop for VolumeManagerActivateResponder {
3339    fn drop(&mut self) {
3340        self.control_handle.shutdown();
3341        // Safety: drops once, never accessed again
3342        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3343    }
3344}
3345
3346impl fidl::endpoints::Responder for VolumeManagerActivateResponder {
3347    type ControlHandle = VolumeManagerControlHandle;
3348
3349    fn control_handle(&self) -> &VolumeManagerControlHandle {
3350        &self.control_handle
3351    }
3352
3353    fn drop_without_shutdown(mut self) {
3354        // Safety: drops once, never accessed again due to mem::forget
3355        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3356        // Prevent Drop from running (which would shut down the channel)
3357        std::mem::forget(self);
3358    }
3359}
3360
3361impl VolumeManagerActivateResponder {
3362    /// Sends a response to the FIDL transaction.
3363    ///
3364    /// Sets the channel to shutdown if an error occurs.
3365    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3366        let _result = self.send_raw(status);
3367        if _result.is_err() {
3368            self.control_handle.shutdown();
3369        }
3370        self.drop_without_shutdown();
3371        _result
3372    }
3373
3374    /// Similar to "send" but does not shutdown the channel if an error occurs.
3375    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3376        let _result = self.send_raw(status);
3377        self.drop_without_shutdown();
3378        _result
3379    }
3380
3381    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3382        self.control_handle.inner.send::<VolumeManagerActivateResponse>(
3383            (status,),
3384            self.tx_id,
3385            0xc8cef57012874d0,
3386            fidl::encoding::DynamicFlags::empty(),
3387        )
3388    }
3389}
3390
3391#[must_use = "FIDL methods require a response to be sent"]
3392#[derive(Debug)]
3393pub struct VolumeManagerGetPartitionLimitResponder {
3394    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3395    tx_id: u32,
3396}
3397
3398/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
3399/// if the responder is dropped without sending a response, so that the client
3400/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3401impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
3402    fn drop(&mut self) {
3403        self.control_handle.shutdown();
3404        // Safety: drops once, never accessed again
3405        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3406    }
3407}
3408
3409impl fidl::endpoints::Responder for VolumeManagerGetPartitionLimitResponder {
3410    type ControlHandle = VolumeManagerControlHandle;
3411
3412    fn control_handle(&self) -> &VolumeManagerControlHandle {
3413        &self.control_handle
3414    }
3415
3416    fn drop_without_shutdown(mut self) {
3417        // Safety: drops once, never accessed again due to mem::forget
3418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3419        // Prevent Drop from running (which would shut down the channel)
3420        std::mem::forget(self);
3421    }
3422}
3423
3424impl VolumeManagerGetPartitionLimitResponder {
3425    /// Sends a response to the FIDL transaction.
3426    ///
3427    /// Sets the channel to shutdown if an error occurs.
3428    pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
3429        let _result = self.send_raw(status, slice_count);
3430        if _result.is_err() {
3431            self.control_handle.shutdown();
3432        }
3433        self.drop_without_shutdown();
3434        _result
3435    }
3436
3437    /// Similar to "send" but does not shutdown the channel if an error occurs.
3438    pub fn send_no_shutdown_on_err(
3439        self,
3440        mut status: i32,
3441        mut slice_count: u64,
3442    ) -> Result<(), fidl::Error> {
3443        let _result = self.send_raw(status, slice_count);
3444        self.drop_without_shutdown();
3445        _result
3446    }
3447
3448    fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
3449        self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
3450            (status, slice_count),
3451            self.tx_id,
3452            0x6e32f6df9fa2a919,
3453            fidl::encoding::DynamicFlags::empty(),
3454        )
3455    }
3456}
3457
3458#[must_use = "FIDL methods require a response to be sent"]
3459#[derive(Debug)]
3460pub struct VolumeManagerSetPartitionLimitResponder {
3461    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3462    tx_id: u32,
3463}
3464
3465/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
3466/// if the responder is dropped without sending a response, so that the client
3467/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3468impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
3469    fn drop(&mut self) {
3470        self.control_handle.shutdown();
3471        // Safety: drops once, never accessed again
3472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3473    }
3474}
3475
3476impl fidl::endpoints::Responder for VolumeManagerSetPartitionLimitResponder {
3477    type ControlHandle = VolumeManagerControlHandle;
3478
3479    fn control_handle(&self) -> &VolumeManagerControlHandle {
3480        &self.control_handle
3481    }
3482
3483    fn drop_without_shutdown(mut self) {
3484        // Safety: drops once, never accessed again due to mem::forget
3485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3486        // Prevent Drop from running (which would shut down the channel)
3487        std::mem::forget(self);
3488    }
3489}
3490
3491impl VolumeManagerSetPartitionLimitResponder {
3492    /// Sends a response to the FIDL transaction.
3493    ///
3494    /// Sets the channel to shutdown if an error occurs.
3495    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3496        let _result = self.send_raw(status);
3497        if _result.is_err() {
3498            self.control_handle.shutdown();
3499        }
3500        self.drop_without_shutdown();
3501        _result
3502    }
3503
3504    /// Similar to "send" but does not shutdown the channel if an error occurs.
3505    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3506        let _result = self.send_raw(status);
3507        self.drop_without_shutdown();
3508        _result
3509    }
3510
3511    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3512        self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
3513            (status,),
3514            self.tx_id,
3515            0x2e09076ef266fa35,
3516            fidl::encoding::DynamicFlags::empty(),
3517        )
3518    }
3519}
3520
3521#[must_use = "FIDL methods require a response to be sent"]
3522#[derive(Debug)]
3523pub struct VolumeManagerSetPartitionNameResponder {
3524    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
3525    tx_id: u32,
3526}
3527
3528/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
3529/// if the responder is dropped without sending a response, so that the client
3530/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3531impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
3532    fn drop(&mut self) {
3533        self.control_handle.shutdown();
3534        // Safety: drops once, never accessed again
3535        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3536    }
3537}
3538
3539impl fidl::endpoints::Responder for VolumeManagerSetPartitionNameResponder {
3540    type ControlHandle = VolumeManagerControlHandle;
3541
3542    fn control_handle(&self) -> &VolumeManagerControlHandle {
3543        &self.control_handle
3544    }
3545
3546    fn drop_without_shutdown(mut self) {
3547        // Safety: drops once, never accessed again due to mem::forget
3548        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3549        // Prevent Drop from running (which would shut down the channel)
3550        std::mem::forget(self);
3551    }
3552}
3553
3554impl VolumeManagerSetPartitionNameResponder {
3555    /// Sends a response to the FIDL transaction.
3556    ///
3557    /// Sets the channel to shutdown if an error occurs.
3558    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3559        let _result = self.send_raw(result);
3560        if _result.is_err() {
3561            self.control_handle.shutdown();
3562        }
3563        self.drop_without_shutdown();
3564        _result
3565    }
3566
3567    /// Similar to "send" but does not shutdown the channel if an error occurs.
3568    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3569        let _result = self.send_raw(result);
3570        self.drop_without_shutdown();
3571        _result
3572    }
3573
3574    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3575        self.control_handle
3576            .inner
3577            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3578                result,
3579                self.tx_id,
3580                0x4539a9b95cba0397,
3581                fidl::encoding::DynamicFlags::empty(),
3582            )
3583    }
3584}
3585
3586#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3587pub struct ServiceMarker;
3588
3589#[cfg(target_os = "fuchsia")]
3590impl fidl::endpoints::ServiceMarker for ServiceMarker {
3591    type Proxy = ServiceProxy;
3592    type Request = ServiceRequest;
3593    const SERVICE_NAME: &'static str = "fuchsia.hardware.block.volume.Service";
3594}
3595
3596/// A request for one of the member protocols of Service.
3597///
3598#[cfg(target_os = "fuchsia")]
3599pub enum ServiceRequest {
3600    Volume(VolumeRequestStream),
3601}
3602
3603#[cfg(target_os = "fuchsia")]
3604impl fidl::endpoints::ServiceRequest for ServiceRequest {
3605    type Service = ServiceMarker;
3606
3607    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
3608        match name {
3609            "volume" => Self::Volume(
3610                <VolumeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
3611            ),
3612            _ => panic!("no such member protocol name for service Service"),
3613        }
3614    }
3615
3616    fn member_names() -> &'static [&'static str] {
3617        &["volume"]
3618    }
3619}
3620#[cfg(target_os = "fuchsia")]
3621pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
3622
3623#[cfg(target_os = "fuchsia")]
3624impl fidl::endpoints::ServiceProxy for ServiceProxy {
3625    type Service = ServiceMarker;
3626
3627    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
3628        Self(opener)
3629    }
3630}
3631
3632#[cfg(target_os = "fuchsia")]
3633impl ServiceProxy {
3634    pub fn connect_to_volume(&self) -> Result<VolumeProxy, fidl::Error> {
3635        let (proxy, server_end) = fidl::endpoints::create_proxy::<VolumeMarker>();
3636        self.connect_channel_to_volume(server_end)?;
3637        Ok(proxy)
3638    }
3639
3640    /// Like `connect_to_volume`, but returns a sync proxy.
3641    /// See [`Self::connect_to_volume`] for more details.
3642    pub fn connect_to_volume_sync(&self) -> Result<VolumeSynchronousProxy, fidl::Error> {
3643        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<VolumeMarker>();
3644        self.connect_channel_to_volume(server_end)?;
3645        Ok(proxy)
3646    }
3647
3648    /// Like `connect_to_volume`, but accepts a server end.
3649    /// See [`Self::connect_to_volume`] for more details.
3650    pub fn connect_channel_to_volume(
3651        &self,
3652        server_end: fidl::endpoints::ServerEnd<VolumeMarker>,
3653    ) -> Result<(), fidl::Error> {
3654        self.0.open_member("volume", server_end.into_channel())
3655    }
3656
3657    pub fn instance_name(&self) -> &str {
3658        self.0.instance_name()
3659    }
3660}
3661
3662mod internal {
3663    use super::*;
3664}