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