Skip to main content

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