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 BlockConnectMapperRequest {
15    pub server_end: fdomain_client::fidl::ServerEnd<MapperMarker>,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for BlockConnectMapperRequest {}
19
20#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
21pub struct BlockOpenSessionRequest {
22    pub session: fdomain_client::fidl::ServerEnd<SessionMarker>,
23}
24
25impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for BlockOpenSessionRequest {}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct BlockOpenSessionWithOptionsRequest {
29    pub session: fdomain_client::fidl::ServerEnd<SessionMarker>,
30    pub mappings: Vec<BlockOffsetMapping>,
31}
32
33impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
34    for BlockOpenSessionWithOptionsRequest
35{
36}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct MapperOpenSessionRequest {
40    pub session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
41    /// VMO that contains the mappings.
42    pub mapping_vmo: fdomain_client::Vmo,
43    /// Page requests will be delivered on the port.
44    pub port: Option<fdomain_client::Port>,
45    /// Completed requests are delivered on this queue.
46    pub delivery_queue: Option<fdomain_client::Vmo>,
47}
48
49impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for MapperOpenSessionRequest {}
50
51#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52pub struct MapperSessionOpenChildSessionRequest {
53    pub session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
54    /// VMO that contains the mappings.
55    pub mapping_vmo: fdomain_client::Vmo,
56    /// Key in the parent session identifying the parent mapping to route through.
57    pub parent_key: u64,
58    /// Page requests will be delivered on the port.
59    pub port: Option<fdomain_client::Port>,
60    /// Completed requests are delivered on this queue.
61    pub delivery_queue: Option<fdomain_client::Vmo>,
62}
63
64impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
65    for MapperSessionOpenChildSessionRequest
66{
67}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct MapperSessionCreateVmoResponse {
71    pub vmo: fdomain_client::Vmo,
72}
73
74impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
75    for MapperSessionCreateVmoResponse
76{
77}
78
79#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
80pub struct SessionAttachVmoRequest {
81    pub vmo: fdomain_client::Vmo,
82}
83
84impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for SessionAttachVmoRequest {}
85
86#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
87pub struct SessionGetFifoResponse {
88    pub fifo: fdomain_client::Fifo,
89}
90
91impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for SessionGetFifoResponse {}
92
93#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
94pub struct BlockMarker;
95
96impl fdomain_client::fidl::ProtocolMarker for BlockMarker {
97    type Proxy = BlockProxy;
98    type RequestStream = BlockRequestStream;
99
100    const DEBUG_NAME: &'static str = "fuchsia.storage.block.Block";
101}
102impl fdomain_client::fidl::DiscoverableProtocolMarker for BlockMarker {}
103pub type BlockGetInfoResult = Result<BlockInfo, i32>;
104pub type BlockConnectMapperResult = Result<(), i32>;
105pub type BlockGetMetadataResult = Result<PartitionInfo, i32>;
106
107pub trait BlockProxyInterface: Send + Sync {
108    type GetInfoResponseFut: std::future::Future<Output = Result<BlockGetInfoResult, fidl::Error>>
109        + Send;
110    fn r#get_info(&self) -> Self::GetInfoResponseFut;
111    fn r#open_session(
112        &self,
113        session: fdomain_client::fidl::ServerEnd<SessionMarker>,
114    ) -> Result<(), fidl::Error>;
115    fn r#open_session_with_options(
116        &self,
117        session: fdomain_client::fidl::ServerEnd<SessionMarker>,
118        mappings: &[BlockOffsetMapping],
119    ) -> Result<(), fidl::Error>;
120    type ConnectMapperResponseFut: std::future::Future<Output = Result<BlockConnectMapperResult, fidl::Error>>
121        + Send;
122    fn r#connect_mapper(
123        &self,
124        server_end: fdomain_client::fidl::ServerEnd<MapperMarker>,
125    ) -> Self::ConnectMapperResponseFut;
126    type GetTypeGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
127        + Send;
128    fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
129    type GetInstanceGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
130        + Send;
131    fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
132    type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
133        + Send;
134    fn r#get_name(&self) -> Self::GetNameResponseFut;
135    type GetMetadataResponseFut: std::future::Future<Output = Result<BlockGetMetadataResult, fidl::Error>>
136        + Send;
137    fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
138    type QuerySlicesResponseFut: std::future::Future<Output = Result<(i32, [VsliceRange; 16], u64), fidl::Error>>
139        + Send;
140    fn r#query_slices(&self, start_slices: &[u64]) -> Self::QuerySlicesResponseFut;
141    type GetVolumeInfoResponseFut: std::future::Future<
142            Output = Result<
143                (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
144                fidl::Error,
145            >,
146        > + Send;
147    fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut;
148    type ExtendResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
149    fn r#extend(&self, start_slice: u64, slice_count: u64) -> Self::ExtendResponseFut;
150    type ShrinkResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
151    fn r#shrink(&self, start_slice: u64, slice_count: u64) -> Self::ShrinkResponseFut;
152    type DestroyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
153    fn r#destroy(&self) -> Self::DestroyResponseFut;
154}
155
156#[derive(Debug, Clone)]
157pub struct BlockProxy {
158    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
159}
160
161impl fdomain_client::fidl::Proxy for BlockProxy {
162    type Protocol = BlockMarker;
163
164    fn from_channel(inner: fdomain_client::Channel) -> Self {
165        Self::new(inner)
166    }
167
168    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
169        self.client.into_channel().map_err(|client| Self { client })
170    }
171
172    fn as_channel(&self) -> &fdomain_client::Channel {
173        self.client.as_channel()
174    }
175}
176
177impl BlockProxy {
178    /// Create a new Proxy for fuchsia.storage.block/Block.
179    pub fn new(channel: fdomain_client::Channel) -> Self {
180        let protocol_name = <BlockMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
181        Self { client: fidl::client::Client::new(channel, protocol_name) }
182    }
183
184    /// Get a Stream of events from the remote end of the protocol.
185    ///
186    /// # Panics
187    ///
188    /// Panics if the event stream was already taken.
189    pub fn take_event_stream(&self) -> BlockEventStream {
190        BlockEventStream { event_receiver: self.client.take_event_receiver() }
191    }
192
193    /// Get information about the underlying block device.
194    pub fn r#get_info(
195        &self,
196    ) -> fidl::client::QueryResponseFut<
197        BlockGetInfoResult,
198        fdomain_client::fidl::FDomainResourceDialect,
199    > {
200        BlockProxyInterface::r#get_info(self)
201    }
202
203    /// Opens a new FIFO-based session on the block device.
204    pub fn r#open_session(
205        &self,
206        mut session: fdomain_client::fidl::ServerEnd<SessionMarker>,
207    ) -> Result<(), fidl::Error> {
208        BlockProxyInterface::r#open_session(self, session)
209    }
210
211    /// Opens a new FIFO-based session on the block device, with additional options.
212    ///
213    /// # Mappings
214    ///
215    /// The `mappings` argument is a list of logical -> physical block mappings, which the server
216    /// will transparently apply to device offsets in block FIFO requests within this session.
217    /// The mappings are logically contiguous starting from logical offset 0.
218    ///
219    /// This interface is intended to be used internally between nested Block implementations, in
220    /// order to provide passthrough I/O.  For example, a fixed partition map (e.g. GPT) will serve
221    /// a Block protocol for each partition, and will respond to OpenSession requests by calling
222    /// OpenSessionWithOptions on the underlying block device, providing mappings which translate
223    /// block offsets which are relative to (and bounded by) the partition to absolute offsets on
224    /// the device.
225    ///
226    /// Mappings can only ever restrict the visible range of a device; servers will reject mappings
227    /// which exceed the range of the device.
228    ///
229    /// If `mappings` is empty, the session channel will be closed with epitaph
230    /// `ZX_ERR_INVALID_ARGS`.
231    pub fn r#open_session_with_options(
232        &self,
233        mut session: fdomain_client::fidl::ServerEnd<SessionMarker>,
234        mut mappings: &[BlockOffsetMapping],
235    ) -> Result<(), fidl::Error> {
236        BlockProxyInterface::r#open_session_with_options(self, session, mappings)
237    }
238
239    /// Connects to the device's Mapper protocol, allowing read-only mapped page-in.
240    /// Since the caller already holds a handle to Block (which grants full read/write access
241    /// to the device), this method provides a direct way to obtain the corresponding Mapper
242    /// protocol without requiring an out-of-band channel or separate capability routing.
243    ///
244    /// If the device or driver does not support the Mapper protocol, ZX_ERR_NOT_SUPPORTED
245    /// is returned.
246    pub fn r#connect_mapper(
247        &self,
248        mut server_end: fdomain_client::fidl::ServerEnd<MapperMarker>,
249    ) -> fidl::client::QueryResponseFut<
250        BlockConnectMapperResult,
251        fdomain_client::fidl::FDomainResourceDialect,
252    > {
253        BlockProxyInterface::r#connect_mapper(self, server_end)
254    }
255
256    /// Gets the type GUID of the partition (if one exists).
257    /// If the partition has no type GUID, ZX_ERR_NOT_SUPPORTED is returned.
258    pub fn r#get_type_guid(
259        &self,
260    ) -> fidl::client::QueryResponseFut<
261        (i32, Option<Box<Guid>>),
262        fdomain_client::fidl::FDomainResourceDialect,
263    > {
264        BlockProxyInterface::r#get_type_guid(self)
265    }
266
267    /// Gets the instance GUID of the partition (if one exists).
268    /// If the partition has no instance GUID, ZX_ERR_NOT_SUPPORTED is returned.
269    pub fn r#get_instance_guid(
270        &self,
271    ) -> fidl::client::QueryResponseFut<
272        (i32, Option<Box<Guid>>),
273        fdomain_client::fidl::FDomainResourceDialect,
274    > {
275        BlockProxyInterface::r#get_instance_guid(self)
276    }
277
278    /// Gets the name of the partition (if one exists).
279    /// If the partition has no name, ZX_ERR_NOT_SUPPORTED is returned.
280    pub fn r#get_name(
281        &self,
282    ) -> fidl::client::QueryResponseFut<
283        (i32, Option<String>),
284        fdomain_client::fidl::FDomainResourceDialect,
285    > {
286        BlockProxyInterface::r#get_name(self)
287    }
288
289    /// Gets the metadata for the partition.
290    ///
291    /// Fields may be absent if the partition doesn't have the given metadata.
292    pub fn r#get_metadata(
293        &self,
294    ) -> fidl::client::QueryResponseFut<
295        BlockGetMetadataResult,
296        fdomain_client::fidl::FDomainResourceDialect,
297    > {
298        BlockProxyInterface::r#get_metadata(self)
299    }
300
301    /// Returns the number of contiguous allocated (or unallocated) vslices
302    /// starting from each vslice.
303    ///
304    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
305    pub fn r#query_slices(
306        &self,
307        mut start_slices: &[u64],
308    ) -> fidl::client::QueryResponseFut<
309        (i32, [VsliceRange; 16], u64),
310        fdomain_client::fidl::FDomainResourceDialect,
311    > {
312        BlockProxyInterface::r#query_slices(self, start_slices)
313    }
314
315    /// Returns the information about this volume and the volume manager it is embedded in.
316    ///
317    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
318    pub fn r#get_volume_info(
319        &self,
320    ) -> fidl::client::QueryResponseFut<
321        (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
322        fdomain_client::fidl::FDomainResourceDialect,
323    > {
324        BlockProxyInterface::r#get_volume_info(self)
325    }
326
327    /// Extends the mapping of this partition.
328    ///
329    /// The ability to extend the partition is dependent on having sufficient free space on the
330    /// underlying device, having sufficient free slots for tracking the bytes in the volume
331    /// manager header, and the partition limit (see VolumeManager.SetPartitionLimit).
332    ///
333    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
334    pub fn r#extend(
335        &self,
336        mut start_slice: u64,
337        mut slice_count: u64,
338    ) -> fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect> {
339        BlockProxyInterface::r#extend(self, start_slice, slice_count)
340    }
341
342    /// Shrinks a virtual partition. Returns `ZX_OK` if ANY slices are
343    /// freed, even if part of the requested range contains unallocated slices.
344    ///
345    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
346    pub fn r#shrink(
347        &self,
348        mut start_slice: u64,
349        mut slice_count: u64,
350    ) -> fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect> {
351        BlockProxyInterface::r#shrink(self, start_slice, slice_count)
352    }
353
354    /// Destroys the current volume, removing it from the VolumeManager, and
355    /// freeing all underlying storage. The connection to the volume is also closed.
356    ///
357    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
358    pub fn r#destroy(
359        &self,
360    ) -> fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect> {
361        BlockProxyInterface::r#destroy(self)
362    }
363}
364
365impl BlockProxyInterface for BlockProxy {
366    type GetInfoResponseFut = fidl::client::QueryResponseFut<
367        BlockGetInfoResult,
368        fdomain_client::fidl::FDomainResourceDialect,
369    >;
370    fn r#get_info(&self) -> Self::GetInfoResponseFut {
371        fn _decode(
372            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
373        ) -> Result<BlockGetInfoResult, fidl::Error> {
374            let _response = fidl::client::decode_transaction_body::<
375                fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
376                fdomain_client::fidl::FDomainResourceDialect,
377                0x58777a4a31cc9a47,
378            >(_buf?)?;
379            Ok(_response.map(|x| x.info))
380        }
381        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetInfoResult>(
382            (),
383            0x58777a4a31cc9a47,
384            fidl::encoding::DynamicFlags::empty(),
385            _decode,
386        )
387    }
388
389    fn r#open_session(
390        &self,
391        mut session: fdomain_client::fidl::ServerEnd<SessionMarker>,
392    ) -> Result<(), fidl::Error> {
393        self.client.send::<BlockOpenSessionRequest>(
394            (session,),
395            0x2ca32f8c64f1d6c8,
396            fidl::encoding::DynamicFlags::empty(),
397        )
398    }
399
400    fn r#open_session_with_options(
401        &self,
402        mut session: fdomain_client::fidl::ServerEnd<SessionMarker>,
403        mut mappings: &[BlockOffsetMapping],
404    ) -> Result<(), fidl::Error> {
405        self.client.send::<BlockOpenSessionWithOptionsRequest>(
406            (session, mappings),
407            0x1974e5f7b9de6f0c,
408            fidl::encoding::DynamicFlags::empty(),
409        )
410    }
411
412    type ConnectMapperResponseFut = fidl::client::QueryResponseFut<
413        BlockConnectMapperResult,
414        fdomain_client::fidl::FDomainResourceDialect,
415    >;
416    fn r#connect_mapper(
417        &self,
418        mut server_end: fdomain_client::fidl::ServerEnd<MapperMarker>,
419    ) -> Self::ConnectMapperResponseFut {
420        fn _decode(
421            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
422        ) -> Result<BlockConnectMapperResult, fidl::Error> {
423            let _response = fidl::client::decode_transaction_body::<
424                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
425                fdomain_client::fidl::FDomainResourceDialect,
426                0xa38a3fbbe3412c3,
427            >(_buf?)?;
428            Ok(_response.map(|x| x))
429        }
430        self.client.send_query_and_decode::<BlockConnectMapperRequest, BlockConnectMapperResult>(
431            (server_end,),
432            0xa38a3fbbe3412c3,
433            fidl::encoding::DynamicFlags::empty(),
434            _decode,
435        )
436    }
437
438    type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
439        (i32, Option<Box<Guid>>),
440        fdomain_client::fidl::FDomainResourceDialect,
441    >;
442    fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
443        fn _decode(
444            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
445        ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
446            let _response = fidl::client::decode_transaction_body::<
447                BlockGetTypeGuidResponse,
448                fdomain_client::fidl::FDomainResourceDialect,
449                0xefe4e41dafce4cc,
450            >(_buf?)?;
451            Ok((_response.status, _response.guid))
452        }
453        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
454            (),
455            0xefe4e41dafce4cc,
456            fidl::encoding::DynamicFlags::empty(),
457            _decode,
458        )
459    }
460
461    type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
462        (i32, Option<Box<Guid>>),
463        fdomain_client::fidl::FDomainResourceDialect,
464    >;
465    fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
466        fn _decode(
467            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
468        ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
469            let _response = fidl::client::decode_transaction_body::<
470                BlockGetInstanceGuidResponse,
471                fdomain_client::fidl::FDomainResourceDialect,
472                0x2e85011aabeb87fb,
473            >(_buf?)?;
474            Ok((_response.status, _response.guid))
475        }
476        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
477            (),
478            0x2e85011aabeb87fb,
479            fidl::encoding::DynamicFlags::empty(),
480            _decode,
481        )
482    }
483
484    type GetNameResponseFut = fidl::client::QueryResponseFut<
485        (i32, Option<String>),
486        fdomain_client::fidl::FDomainResourceDialect,
487    >;
488    fn r#get_name(&self) -> Self::GetNameResponseFut {
489        fn _decode(
490            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
491        ) -> Result<(i32, Option<String>), fidl::Error> {
492            let _response = fidl::client::decode_transaction_body::<
493                BlockGetNameResponse,
494                fdomain_client::fidl::FDomainResourceDialect,
495                0x630be18badedbb05,
496            >(_buf?)?;
497            Ok((_response.status, _response.name))
498        }
499        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
500            (),
501            0x630be18badedbb05,
502            fidl::encoding::DynamicFlags::empty(),
503            _decode,
504        )
505    }
506
507    type GetMetadataResponseFut = fidl::client::QueryResponseFut<
508        BlockGetMetadataResult,
509        fdomain_client::fidl::FDomainResourceDialect,
510    >;
511    fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
512        fn _decode(
513            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
514        ) -> Result<BlockGetMetadataResult, fidl::Error> {
515            let _response = fidl::client::decode_transaction_body::<
516                fidl::encoding::ResultType<PartitionInfo, i32>,
517                fdomain_client::fidl::FDomainResourceDialect,
518                0x2c76b02ef9382533,
519            >(_buf?)?;
520            Ok(_response.map(|x| x))
521        }
522        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetMetadataResult>(
523            (),
524            0x2c76b02ef9382533,
525            fidl::encoding::DynamicFlags::empty(),
526            _decode,
527        )
528    }
529
530    type QuerySlicesResponseFut = fidl::client::QueryResponseFut<
531        (i32, [VsliceRange; 16], u64),
532        fdomain_client::fidl::FDomainResourceDialect,
533    >;
534    fn r#query_slices(&self, mut start_slices: &[u64]) -> Self::QuerySlicesResponseFut {
535        fn _decode(
536            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
537        ) -> Result<(i32, [VsliceRange; 16], u64), fidl::Error> {
538            let _response = fidl::client::decode_transaction_body::<
539                BlockQuerySlicesResponse,
540                fdomain_client::fidl::FDomainResourceDialect,
541                0x289240ac4fbaa190,
542            >(_buf?)?;
543            Ok((_response.status, _response.response, _response.response_count))
544        }
545        self.client.send_query_and_decode::<BlockQuerySlicesRequest, (i32, [VsliceRange; 16], u64)>(
546            (start_slices,),
547            0x289240ac4fbaa190,
548            fidl::encoding::DynamicFlags::empty(),
549            _decode,
550        )
551    }
552
553    type GetVolumeInfoResponseFut = fidl::client::QueryResponseFut<
554        (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
555        fdomain_client::fidl::FDomainResourceDialect,
556    >;
557    fn r#get_volume_info(&self) -> Self::GetVolumeInfoResponseFut {
558        fn _decode(
559            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
560        ) -> Result<(i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>), fidl::Error>
561        {
562            let _response = fidl::client::decode_transaction_body::<
563                BlockGetVolumeInfoResponse,
564                fdomain_client::fidl::FDomainResourceDialect,
565                0x3a7dc69ea5d788d4,
566            >(_buf?)?;
567            Ok((_response.status, _response.manager, _response.volume))
568        }
569        self.client.send_query_and_decode::<
570            fidl::encoding::EmptyPayload,
571            (i32, Option<Box<VolumeManagerInfo>>, Option<Box<VolumeInfo>>),
572        >(
573            (),
574            0x3a7dc69ea5d788d4,
575            fidl::encoding::DynamicFlags::empty(),
576            _decode,
577        )
578    }
579
580    type ExtendResponseFut =
581        fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect>;
582    fn r#extend(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ExtendResponseFut {
583        fn _decode(
584            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
585        ) -> Result<i32, fidl::Error> {
586            let _response = fidl::client::decode_transaction_body::<
587                BlockExtendResponse,
588                fdomain_client::fidl::FDomainResourceDialect,
589                0x273fb2980ff24157,
590            >(_buf?)?;
591            Ok(_response.status)
592        }
593        self.client.send_query_and_decode::<BlockExtendRequest, i32>(
594            (start_slice, slice_count),
595            0x273fb2980ff24157,
596            fidl::encoding::DynamicFlags::empty(),
597            _decode,
598        )
599    }
600
601    type ShrinkResponseFut =
602        fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect>;
603    fn r#shrink(&self, mut start_slice: u64, mut slice_count: u64) -> Self::ShrinkResponseFut {
604        fn _decode(
605            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
606        ) -> Result<i32, fidl::Error> {
607            let _response = fidl::client::decode_transaction_body::<
608                BlockShrinkResponse,
609                fdomain_client::fidl::FDomainResourceDialect,
610                0x73da6de865600a8b,
611            >(_buf?)?;
612            Ok(_response.status)
613        }
614        self.client.send_query_and_decode::<BlockShrinkRequest, i32>(
615            (start_slice, slice_count),
616            0x73da6de865600a8b,
617            fidl::encoding::DynamicFlags::empty(),
618            _decode,
619        )
620    }
621
622    type DestroyResponseFut =
623        fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect>;
624    fn r#destroy(&self) -> Self::DestroyResponseFut {
625        fn _decode(
626            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
627        ) -> Result<i32, fidl::Error> {
628            let _response = fidl::client::decode_transaction_body::<
629                BlockDestroyResponse,
630                fdomain_client::fidl::FDomainResourceDialect,
631                0x5866ba764e05a68e,
632            >(_buf?)?;
633            Ok(_response.status)
634        }
635        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
636            (),
637            0x5866ba764e05a68e,
638            fidl::encoding::DynamicFlags::empty(),
639            _decode,
640        )
641    }
642}
643
644pub struct BlockEventStream {
645    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
646}
647
648impl std::marker::Unpin for BlockEventStream {}
649
650impl futures::stream::FusedStream for BlockEventStream {
651    fn is_terminated(&self) -> bool {
652        self.event_receiver.is_terminated()
653    }
654}
655
656impl futures::Stream for BlockEventStream {
657    type Item = Result<BlockEvent, fidl::Error>;
658
659    fn poll_next(
660        mut self: std::pin::Pin<&mut Self>,
661        cx: &mut std::task::Context<'_>,
662    ) -> std::task::Poll<Option<Self::Item>> {
663        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
664            &mut self.event_receiver,
665            cx
666        )?) {
667            Some(buf) => std::task::Poll::Ready(Some(BlockEvent::decode(buf))),
668            None => std::task::Poll::Ready(None),
669        }
670    }
671}
672
673#[derive(Debug)]
674pub enum BlockEvent {}
675
676impl BlockEvent {
677    /// Decodes a message buffer as a [`BlockEvent`].
678    fn decode(
679        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
680    ) -> Result<BlockEvent, fidl::Error> {
681        let (bytes, _handles) = buf.split_mut();
682        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
683        debug_assert_eq!(tx_header.tx_id, 0);
684        match tx_header.ordinal {
685            _ => Err(fidl::Error::UnknownOrdinal {
686                ordinal: tx_header.ordinal,
687                protocol_name: <BlockMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
688            }),
689        }
690    }
691}
692
693/// A Stream of incoming requests for fuchsia.storage.block/Block.
694pub struct BlockRequestStream {
695    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
696    is_terminated: bool,
697}
698
699impl std::marker::Unpin for BlockRequestStream {}
700
701impl futures::stream::FusedStream for BlockRequestStream {
702    fn is_terminated(&self) -> bool {
703        self.is_terminated
704    }
705}
706
707impl fdomain_client::fidl::RequestStream for BlockRequestStream {
708    type Protocol = BlockMarker;
709    type ControlHandle = BlockControlHandle;
710
711    fn from_channel(channel: fdomain_client::Channel) -> Self {
712        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
713    }
714
715    fn control_handle(&self) -> Self::ControlHandle {
716        BlockControlHandle { inner: self.inner.clone() }
717    }
718
719    fn into_inner(
720        self,
721    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
722    {
723        (self.inner, self.is_terminated)
724    }
725
726    fn from_inner(
727        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
728        is_terminated: bool,
729    ) -> Self {
730        Self { inner, is_terminated }
731    }
732}
733
734impl futures::Stream for BlockRequestStream {
735    type Item = Result<BlockRequest, fidl::Error>;
736
737    fn poll_next(
738        mut self: std::pin::Pin<&mut Self>,
739        cx: &mut std::task::Context<'_>,
740    ) -> std::task::Poll<Option<Self::Item>> {
741        let this = &mut *self;
742        if this.inner.check_shutdown(cx) {
743            this.is_terminated = true;
744            return std::task::Poll::Ready(None);
745        }
746        if this.is_terminated {
747            panic!("polled BlockRequestStream after completion");
748        }
749        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
750            |bytes, handles| {
751                match this.inner.channel().read_etc(cx, bytes, handles) {
752                    std::task::Poll::Ready(Ok(())) => {}
753                    std::task::Poll::Pending => return std::task::Poll::Pending,
754                    std::task::Poll::Ready(Err(None)) => {
755                        this.is_terminated = true;
756                        return std::task::Poll::Ready(None);
757                    }
758                    std::task::Poll::Ready(Err(Some(e))) => {
759                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
760                            e.into(),
761                        ))));
762                    }
763                }
764
765                // A message has been received from the channel
766                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
767
768                std::task::Poll::Ready(Some(match header.ordinal {
769                    0x58777a4a31cc9a47 => {
770                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
771                        let mut req = fidl::new_empty!(
772                            fidl::encoding::EmptyPayload,
773                            fdomain_client::fidl::FDomainResourceDialect
774                        );
775                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
776                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
777                        Ok(BlockRequest::GetInfo {
778                            responder: BlockGetInfoResponder {
779                                control_handle: std::mem::ManuallyDrop::new(control_handle),
780                                tx_id: header.tx_id,
781                            },
782                        })
783                    }
784                    0x2ca32f8c64f1d6c8 => {
785                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
786                        let mut req = fidl::new_empty!(
787                            BlockOpenSessionRequest,
788                            fdomain_client::fidl::FDomainResourceDialect
789                        );
790                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
791                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
792                        Ok(BlockRequest::OpenSession { session: req.session, control_handle })
793                    }
794                    0x1974e5f7b9de6f0c => {
795                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
796                        let mut req = fidl::new_empty!(
797                            BlockOpenSessionWithOptionsRequest,
798                            fdomain_client::fidl::FDomainResourceDialect
799                        );
800                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BlockOpenSessionWithOptionsRequest>(&header, _body_bytes, handles, &mut req)?;
801                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
802                        Ok(BlockRequest::OpenSessionWithOptions {
803                            session: req.session,
804                            mappings: req.mappings,
805
806                            control_handle,
807                        })
808                    }
809                    0xa38a3fbbe3412c3 => {
810                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
811                        let mut req = fidl::new_empty!(
812                            BlockConnectMapperRequest,
813                            fdomain_client::fidl::FDomainResourceDialect
814                        );
815                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BlockConnectMapperRequest>(&header, _body_bytes, handles, &mut req)?;
816                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
817                        Ok(BlockRequest::ConnectMapper {
818                            server_end: req.server_end,
819
820                            responder: BlockConnectMapperResponder {
821                                control_handle: std::mem::ManuallyDrop::new(control_handle),
822                                tx_id: header.tx_id,
823                            },
824                        })
825                    }
826                    0xefe4e41dafce4cc => {
827                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
828                        let mut req = fidl::new_empty!(
829                            fidl::encoding::EmptyPayload,
830                            fdomain_client::fidl::FDomainResourceDialect
831                        );
832                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
833                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
834                        Ok(BlockRequest::GetTypeGuid {
835                            responder: BlockGetTypeGuidResponder {
836                                control_handle: std::mem::ManuallyDrop::new(control_handle),
837                                tx_id: header.tx_id,
838                            },
839                        })
840                    }
841                    0x2e85011aabeb87fb => {
842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
843                        let mut req = fidl::new_empty!(
844                            fidl::encoding::EmptyPayload,
845                            fdomain_client::fidl::FDomainResourceDialect
846                        );
847                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
848                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
849                        Ok(BlockRequest::GetInstanceGuid {
850                            responder: BlockGetInstanceGuidResponder {
851                                control_handle: std::mem::ManuallyDrop::new(control_handle),
852                                tx_id: header.tx_id,
853                            },
854                        })
855                    }
856                    0x630be18badedbb05 => {
857                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
858                        let mut req = fidl::new_empty!(
859                            fidl::encoding::EmptyPayload,
860                            fdomain_client::fidl::FDomainResourceDialect
861                        );
862                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
863                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
864                        Ok(BlockRequest::GetName {
865                            responder: BlockGetNameResponder {
866                                control_handle: std::mem::ManuallyDrop::new(control_handle),
867                                tx_id: header.tx_id,
868                            },
869                        })
870                    }
871                    0x2c76b02ef9382533 => {
872                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
873                        let mut req = fidl::new_empty!(
874                            fidl::encoding::EmptyPayload,
875                            fdomain_client::fidl::FDomainResourceDialect
876                        );
877                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
878                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
879                        Ok(BlockRequest::GetMetadata {
880                            responder: BlockGetMetadataResponder {
881                                control_handle: std::mem::ManuallyDrop::new(control_handle),
882                                tx_id: header.tx_id,
883                            },
884                        })
885                    }
886                    0x289240ac4fbaa190 => {
887                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
888                        let mut req = fidl::new_empty!(
889                            BlockQuerySlicesRequest,
890                            fdomain_client::fidl::FDomainResourceDialect
891                        );
892                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BlockQuerySlicesRequest>(&header, _body_bytes, handles, &mut req)?;
893                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
894                        Ok(BlockRequest::QuerySlices {
895                            start_slices: req.start_slices,
896
897                            responder: BlockQuerySlicesResponder {
898                                control_handle: std::mem::ManuallyDrop::new(control_handle),
899                                tx_id: header.tx_id,
900                            },
901                        })
902                    }
903                    0x3a7dc69ea5d788d4 => {
904                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
905                        let mut req = fidl::new_empty!(
906                            fidl::encoding::EmptyPayload,
907                            fdomain_client::fidl::FDomainResourceDialect
908                        );
909                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
910                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
911                        Ok(BlockRequest::GetVolumeInfo {
912                            responder: BlockGetVolumeInfoResponder {
913                                control_handle: std::mem::ManuallyDrop::new(control_handle),
914                                tx_id: header.tx_id,
915                            },
916                        })
917                    }
918                    0x273fb2980ff24157 => {
919                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
920                        let mut req = fidl::new_empty!(
921                            BlockExtendRequest,
922                            fdomain_client::fidl::FDomainResourceDialect
923                        );
924                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BlockExtendRequest>(&header, _body_bytes, handles, &mut req)?;
925                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
926                        Ok(BlockRequest::Extend {
927                            start_slice: req.start_slice,
928                            slice_count: req.slice_count,
929
930                            responder: BlockExtendResponder {
931                                control_handle: std::mem::ManuallyDrop::new(control_handle),
932                                tx_id: header.tx_id,
933                            },
934                        })
935                    }
936                    0x73da6de865600a8b => {
937                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
938                        let mut req = fidl::new_empty!(
939                            BlockShrinkRequest,
940                            fdomain_client::fidl::FDomainResourceDialect
941                        );
942                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BlockShrinkRequest>(&header, _body_bytes, handles, &mut req)?;
943                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
944                        Ok(BlockRequest::Shrink {
945                            start_slice: req.start_slice,
946                            slice_count: req.slice_count,
947
948                            responder: BlockShrinkResponder {
949                                control_handle: std::mem::ManuallyDrop::new(control_handle),
950                                tx_id: header.tx_id,
951                            },
952                        })
953                    }
954                    0x5866ba764e05a68e => {
955                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
956                        let mut req = fidl::new_empty!(
957                            fidl::encoding::EmptyPayload,
958                            fdomain_client::fidl::FDomainResourceDialect
959                        );
960                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
961                        let control_handle = BlockControlHandle { inner: this.inner.clone() };
962                        Ok(BlockRequest::Destroy {
963                            responder: BlockDestroyResponder {
964                                control_handle: std::mem::ManuallyDrop::new(control_handle),
965                                tx_id: header.tx_id,
966                            },
967                        })
968                    }
969                    _ => Err(fidl::Error::UnknownOrdinal {
970                        ordinal: header.ordinal,
971                        protocol_name:
972                            <BlockMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
973                    }),
974                }))
975            },
976        )
977    }
978}
979
980/// Defines access to a device which is accessible in block-granularity chunks
981/// for reading and writing.
982#[derive(Debug)]
983pub enum BlockRequest {
984    /// Get information about the underlying block device.
985    GetInfo { responder: BlockGetInfoResponder },
986    /// Opens a new FIFO-based session on the block device.
987    OpenSession {
988        session: fdomain_client::fidl::ServerEnd<SessionMarker>,
989        control_handle: BlockControlHandle,
990    },
991    /// Opens a new FIFO-based session on the block device, with additional options.
992    ///
993    /// # Mappings
994    ///
995    /// The `mappings` argument is a list of logical -> physical block mappings, which the server
996    /// will transparently apply to device offsets in block FIFO requests within this session.
997    /// The mappings are logically contiguous starting from logical offset 0.
998    ///
999    /// This interface is intended to be used internally between nested Block implementations, in
1000    /// order to provide passthrough I/O.  For example, a fixed partition map (e.g. GPT) will serve
1001    /// a Block protocol for each partition, and will respond to OpenSession requests by calling
1002    /// OpenSessionWithOptions on the underlying block device, providing mappings which translate
1003    /// block offsets which are relative to (and bounded by) the partition to absolute offsets on
1004    /// the device.
1005    ///
1006    /// Mappings can only ever restrict the visible range of a device; servers will reject mappings
1007    /// which exceed the range of the device.
1008    ///
1009    /// If `mappings` is empty, the session channel will be closed with epitaph
1010    /// `ZX_ERR_INVALID_ARGS`.
1011    OpenSessionWithOptions {
1012        session: fdomain_client::fidl::ServerEnd<SessionMarker>,
1013        mappings: Vec<BlockOffsetMapping>,
1014        control_handle: BlockControlHandle,
1015    },
1016    /// Connects to the device's Mapper protocol, allowing read-only mapped page-in.
1017    /// Since the caller already holds a handle to Block (which grants full read/write access
1018    /// to the device), this method provides a direct way to obtain the corresponding Mapper
1019    /// protocol without requiring an out-of-band channel or separate capability routing.
1020    ///
1021    /// If the device or driver does not support the Mapper protocol, ZX_ERR_NOT_SUPPORTED
1022    /// is returned.
1023    ConnectMapper {
1024        server_end: fdomain_client::fidl::ServerEnd<MapperMarker>,
1025        responder: BlockConnectMapperResponder,
1026    },
1027    /// Gets the type GUID of the partition (if one exists).
1028    /// If the partition has no type GUID, ZX_ERR_NOT_SUPPORTED is returned.
1029    GetTypeGuid { responder: BlockGetTypeGuidResponder },
1030    /// Gets the instance GUID of the partition (if one exists).
1031    /// If the partition has no instance GUID, ZX_ERR_NOT_SUPPORTED is returned.
1032    GetInstanceGuid { responder: BlockGetInstanceGuidResponder },
1033    /// Gets the name of the partition (if one exists).
1034    /// If the partition has no name, ZX_ERR_NOT_SUPPORTED is returned.
1035    GetName { responder: BlockGetNameResponder },
1036    /// Gets the metadata for the partition.
1037    ///
1038    /// Fields may be absent if the partition doesn't have the given metadata.
1039    GetMetadata { responder: BlockGetMetadataResponder },
1040    /// Returns the number of contiguous allocated (or unallocated) vslices
1041    /// starting from each vslice.
1042    ///
1043    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
1044    QuerySlices { start_slices: Vec<u64>, responder: BlockQuerySlicesResponder },
1045    /// Returns the information about this volume and the volume manager it is embedded in.
1046    ///
1047    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
1048    GetVolumeInfo { responder: BlockGetVolumeInfoResponder },
1049    /// Extends the mapping of this partition.
1050    ///
1051    /// The ability to extend the partition is dependent on having sufficient free space on the
1052    /// underlying device, having sufficient free slots for tracking the bytes in the volume
1053    /// manager header, and the partition limit (see VolumeManager.SetPartitionLimit).
1054    ///
1055    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
1056    Extend { start_slice: u64, slice_count: u64, responder: BlockExtendResponder },
1057    /// Shrinks a virtual partition. Returns `ZX_OK` if ANY slices are
1058    /// freed, even if part of the requested range contains unallocated slices.
1059    ///
1060    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
1061    Shrink { start_slice: u64, slice_count: u64, responder: BlockShrinkResponder },
1062    /// Destroys the current volume, removing it from the VolumeManager, and
1063    /// freeing all underlying storage. The connection to the volume is also closed.
1064    ///
1065    /// Returns ZX_ERR_NOT_SUPPORTED if the device is not a volume.
1066    Destroy { responder: BlockDestroyResponder },
1067}
1068
1069impl BlockRequest {
1070    #[allow(irrefutable_let_patterns)]
1071    pub fn into_get_info(self) -> Option<(BlockGetInfoResponder)> {
1072        if let BlockRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1073    }
1074
1075    #[allow(irrefutable_let_patterns)]
1076    pub fn into_open_session(
1077        self,
1078    ) -> Option<(fdomain_client::fidl::ServerEnd<SessionMarker>, BlockControlHandle)> {
1079        if let BlockRequest::OpenSession { session, control_handle } = self {
1080            Some((session, control_handle))
1081        } else {
1082            None
1083        }
1084    }
1085
1086    #[allow(irrefutable_let_patterns)]
1087    pub fn into_open_session_with_options(
1088        self,
1089    ) -> Option<(
1090        fdomain_client::fidl::ServerEnd<SessionMarker>,
1091        Vec<BlockOffsetMapping>,
1092        BlockControlHandle,
1093    )> {
1094        if let BlockRequest::OpenSessionWithOptions { session, mappings, control_handle } = self {
1095            Some((session, mappings, control_handle))
1096        } else {
1097            None
1098        }
1099    }
1100
1101    #[allow(irrefutable_let_patterns)]
1102    pub fn into_connect_mapper(
1103        self,
1104    ) -> Option<(fdomain_client::fidl::ServerEnd<MapperMarker>, BlockConnectMapperResponder)> {
1105        if let BlockRequest::ConnectMapper { server_end, responder } = self {
1106            Some((server_end, responder))
1107        } else {
1108            None
1109        }
1110    }
1111
1112    #[allow(irrefutable_let_patterns)]
1113    pub fn into_get_type_guid(self) -> Option<(BlockGetTypeGuidResponder)> {
1114        if let BlockRequest::GetTypeGuid { responder } = self { Some((responder)) } else { None }
1115    }
1116
1117    #[allow(irrefutable_let_patterns)]
1118    pub fn into_get_instance_guid(self) -> Option<(BlockGetInstanceGuidResponder)> {
1119        if let BlockRequest::GetInstanceGuid { responder } = self {
1120            Some((responder))
1121        } else {
1122            None
1123        }
1124    }
1125
1126    #[allow(irrefutable_let_patterns)]
1127    pub fn into_get_name(self) -> Option<(BlockGetNameResponder)> {
1128        if let BlockRequest::GetName { responder } = self { Some((responder)) } else { None }
1129    }
1130
1131    #[allow(irrefutable_let_patterns)]
1132    pub fn into_get_metadata(self) -> Option<(BlockGetMetadataResponder)> {
1133        if let BlockRequest::GetMetadata { responder } = self { Some((responder)) } else { None }
1134    }
1135
1136    #[allow(irrefutable_let_patterns)]
1137    pub fn into_query_slices(self) -> Option<(Vec<u64>, BlockQuerySlicesResponder)> {
1138        if let BlockRequest::QuerySlices { start_slices, responder } = self {
1139            Some((start_slices, responder))
1140        } else {
1141            None
1142        }
1143    }
1144
1145    #[allow(irrefutable_let_patterns)]
1146    pub fn into_get_volume_info(self) -> Option<(BlockGetVolumeInfoResponder)> {
1147        if let BlockRequest::GetVolumeInfo { responder } = self { Some((responder)) } else { None }
1148    }
1149
1150    #[allow(irrefutable_let_patterns)]
1151    pub fn into_extend(self) -> Option<(u64, u64, BlockExtendResponder)> {
1152        if let BlockRequest::Extend { start_slice, slice_count, responder } = self {
1153            Some((start_slice, slice_count, responder))
1154        } else {
1155            None
1156        }
1157    }
1158
1159    #[allow(irrefutable_let_patterns)]
1160    pub fn into_shrink(self) -> Option<(u64, u64, BlockShrinkResponder)> {
1161        if let BlockRequest::Shrink { start_slice, slice_count, responder } = self {
1162            Some((start_slice, slice_count, responder))
1163        } else {
1164            None
1165        }
1166    }
1167
1168    #[allow(irrefutable_let_patterns)]
1169    pub fn into_destroy(self) -> Option<(BlockDestroyResponder)> {
1170        if let BlockRequest::Destroy { responder } = self { Some((responder)) } else { None }
1171    }
1172
1173    /// Name of the method defined in FIDL
1174    pub fn method_name(&self) -> &'static str {
1175        match *self {
1176            BlockRequest::GetInfo { .. } => "get_info",
1177            BlockRequest::OpenSession { .. } => "open_session",
1178            BlockRequest::OpenSessionWithOptions { .. } => "open_session_with_options",
1179            BlockRequest::ConnectMapper { .. } => "connect_mapper",
1180            BlockRequest::GetTypeGuid { .. } => "get_type_guid",
1181            BlockRequest::GetInstanceGuid { .. } => "get_instance_guid",
1182            BlockRequest::GetName { .. } => "get_name",
1183            BlockRequest::GetMetadata { .. } => "get_metadata",
1184            BlockRequest::QuerySlices { .. } => "query_slices",
1185            BlockRequest::GetVolumeInfo { .. } => "get_volume_info",
1186            BlockRequest::Extend { .. } => "extend",
1187            BlockRequest::Shrink { .. } => "shrink",
1188            BlockRequest::Destroy { .. } => "destroy",
1189        }
1190    }
1191}
1192
1193#[derive(Debug, Clone)]
1194pub struct BlockControlHandle {
1195    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1196}
1197
1198impl BlockControlHandle {
1199    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1200        self.inner.shutdown_with_epitaph(status.into())
1201    }
1202}
1203
1204impl fdomain_client::fidl::ControlHandle for BlockControlHandle {
1205    fn shutdown(&self) {
1206        self.inner.shutdown()
1207    }
1208
1209    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1210        self.inner.shutdown_with_epitaph(status)
1211    }
1212
1213    fn is_closed(&self) -> bool {
1214        self.inner.channel().is_closed()
1215    }
1216    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1217        self.inner.channel().on_closed()
1218    }
1219}
1220
1221impl BlockControlHandle {}
1222
1223#[must_use = "FIDL methods require a response to be sent"]
1224#[derive(Debug)]
1225pub struct BlockGetInfoResponder {
1226    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1227    tx_id: u32,
1228}
1229
1230/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1231/// if the responder is dropped without sending a response, so that the client
1232/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1233impl std::ops::Drop for BlockGetInfoResponder {
1234    fn drop(&mut self) {
1235        self.control_handle.shutdown();
1236        // Safety: drops once, never accessed again
1237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1238    }
1239}
1240
1241impl fdomain_client::fidl::Responder for BlockGetInfoResponder {
1242    type ControlHandle = BlockControlHandle;
1243
1244    fn control_handle(&self) -> &BlockControlHandle {
1245        &self.control_handle
1246    }
1247
1248    fn drop_without_shutdown(mut self) {
1249        // Safety: drops once, never accessed again due to mem::forget
1250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1251        // Prevent Drop from running (which would shut down the channel)
1252        std::mem::forget(self);
1253    }
1254}
1255
1256impl BlockGetInfoResponder {
1257    /// Sends a response to the FIDL transaction.
1258    ///
1259    /// Sets the channel to shutdown if an error occurs.
1260    pub fn send(self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1261        let _result = self.send_raw(result);
1262        if _result.is_err() {
1263            self.control_handle.shutdown();
1264        }
1265        self.drop_without_shutdown();
1266        _result
1267    }
1268
1269    /// Similar to "send" but does not shutdown the channel if an error occurs.
1270    pub fn send_no_shutdown_on_err(
1271        self,
1272        mut result: Result<&BlockInfo, i32>,
1273    ) -> Result<(), fidl::Error> {
1274        let _result = self.send_raw(result);
1275        self.drop_without_shutdown();
1276        _result
1277    }
1278
1279    fn send_raw(&self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
1280        self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetInfoResponse, i32>>(
1281            result.map(|info| (info,)),
1282            self.tx_id,
1283            0x58777a4a31cc9a47,
1284            fidl::encoding::DynamicFlags::empty(),
1285        )
1286    }
1287}
1288
1289#[must_use = "FIDL methods require a response to be sent"]
1290#[derive(Debug)]
1291pub struct BlockConnectMapperResponder {
1292    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1293    tx_id: u32,
1294}
1295
1296/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1297/// if the responder is dropped without sending a response, so that the client
1298/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1299impl std::ops::Drop for BlockConnectMapperResponder {
1300    fn drop(&mut self) {
1301        self.control_handle.shutdown();
1302        // Safety: drops once, never accessed again
1303        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1304    }
1305}
1306
1307impl fdomain_client::fidl::Responder for BlockConnectMapperResponder {
1308    type ControlHandle = BlockControlHandle;
1309
1310    fn control_handle(&self) -> &BlockControlHandle {
1311        &self.control_handle
1312    }
1313
1314    fn drop_without_shutdown(mut self) {
1315        // Safety: drops once, never accessed again due to mem::forget
1316        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317        // Prevent Drop from running (which would shut down the channel)
1318        std::mem::forget(self);
1319    }
1320}
1321
1322impl BlockConnectMapperResponder {
1323    /// Sends a response to the FIDL transaction.
1324    ///
1325    /// Sets the channel to shutdown if an error occurs.
1326    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1327        let _result = self.send_raw(result);
1328        if _result.is_err() {
1329            self.control_handle.shutdown();
1330        }
1331        self.drop_without_shutdown();
1332        _result
1333    }
1334
1335    /// Similar to "send" but does not shutdown the channel if an error occurs.
1336    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1337        let _result = self.send_raw(result);
1338        self.drop_without_shutdown();
1339        _result
1340    }
1341
1342    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1343        self.control_handle
1344            .inner
1345            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1346                result,
1347                self.tx_id,
1348                0xa38a3fbbe3412c3,
1349                fidl::encoding::DynamicFlags::empty(),
1350            )
1351    }
1352}
1353
1354#[must_use = "FIDL methods require a response to be sent"]
1355#[derive(Debug)]
1356pub struct BlockGetTypeGuidResponder {
1357    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1358    tx_id: u32,
1359}
1360
1361/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1362/// if the responder is dropped without sending a response, so that the client
1363/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1364impl std::ops::Drop for BlockGetTypeGuidResponder {
1365    fn drop(&mut self) {
1366        self.control_handle.shutdown();
1367        // Safety: drops once, never accessed again
1368        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1369    }
1370}
1371
1372impl fdomain_client::fidl::Responder for BlockGetTypeGuidResponder {
1373    type ControlHandle = BlockControlHandle;
1374
1375    fn control_handle(&self) -> &BlockControlHandle {
1376        &self.control_handle
1377    }
1378
1379    fn drop_without_shutdown(mut self) {
1380        // Safety: drops once, never accessed again due to mem::forget
1381        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1382        // Prevent Drop from running (which would shut down the channel)
1383        std::mem::forget(self);
1384    }
1385}
1386
1387impl BlockGetTypeGuidResponder {
1388    /// Sends a response to the FIDL transaction.
1389    ///
1390    /// Sets the channel to shutdown if an error occurs.
1391    pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1392        let _result = self.send_raw(status, guid);
1393        if _result.is_err() {
1394            self.control_handle.shutdown();
1395        }
1396        self.drop_without_shutdown();
1397        _result
1398    }
1399
1400    /// Similar to "send" but does not shutdown the channel if an error occurs.
1401    pub fn send_no_shutdown_on_err(
1402        self,
1403        mut status: i32,
1404        mut guid: Option<&Guid>,
1405    ) -> Result<(), fidl::Error> {
1406        let _result = self.send_raw(status, guid);
1407        self.drop_without_shutdown();
1408        _result
1409    }
1410
1411    fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1412        self.control_handle.inner.send::<BlockGetTypeGuidResponse>(
1413            (status, guid),
1414            self.tx_id,
1415            0xefe4e41dafce4cc,
1416            fidl::encoding::DynamicFlags::empty(),
1417        )
1418    }
1419}
1420
1421#[must_use = "FIDL methods require a response to be sent"]
1422#[derive(Debug)]
1423pub struct BlockGetInstanceGuidResponder {
1424    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1425    tx_id: u32,
1426}
1427
1428/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1429/// if the responder is dropped without sending a response, so that the client
1430/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1431impl std::ops::Drop for BlockGetInstanceGuidResponder {
1432    fn drop(&mut self) {
1433        self.control_handle.shutdown();
1434        // Safety: drops once, never accessed again
1435        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1436    }
1437}
1438
1439impl fdomain_client::fidl::Responder for BlockGetInstanceGuidResponder {
1440    type ControlHandle = BlockControlHandle;
1441
1442    fn control_handle(&self) -> &BlockControlHandle {
1443        &self.control_handle
1444    }
1445
1446    fn drop_without_shutdown(mut self) {
1447        // Safety: drops once, never accessed again due to mem::forget
1448        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1449        // Prevent Drop from running (which would shut down the channel)
1450        std::mem::forget(self);
1451    }
1452}
1453
1454impl BlockGetInstanceGuidResponder {
1455    /// Sends a response to the FIDL transaction.
1456    ///
1457    /// Sets the channel to shutdown if an error occurs.
1458    pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1459        let _result = self.send_raw(status, guid);
1460        if _result.is_err() {
1461            self.control_handle.shutdown();
1462        }
1463        self.drop_without_shutdown();
1464        _result
1465    }
1466
1467    /// Similar to "send" but does not shutdown the channel if an error occurs.
1468    pub fn send_no_shutdown_on_err(
1469        self,
1470        mut status: i32,
1471        mut guid: Option<&Guid>,
1472    ) -> Result<(), fidl::Error> {
1473        let _result = self.send_raw(status, guid);
1474        self.drop_without_shutdown();
1475        _result
1476    }
1477
1478    fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1479        self.control_handle.inner.send::<BlockGetInstanceGuidResponse>(
1480            (status, guid),
1481            self.tx_id,
1482            0x2e85011aabeb87fb,
1483            fidl::encoding::DynamicFlags::empty(),
1484        )
1485    }
1486}
1487
1488#[must_use = "FIDL methods require a response to be sent"]
1489#[derive(Debug)]
1490pub struct BlockGetNameResponder {
1491    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1492    tx_id: u32,
1493}
1494
1495/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1496/// if the responder is dropped without sending a response, so that the client
1497/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1498impl std::ops::Drop for BlockGetNameResponder {
1499    fn drop(&mut self) {
1500        self.control_handle.shutdown();
1501        // Safety: drops once, never accessed again
1502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1503    }
1504}
1505
1506impl fdomain_client::fidl::Responder for BlockGetNameResponder {
1507    type ControlHandle = BlockControlHandle;
1508
1509    fn control_handle(&self) -> &BlockControlHandle {
1510        &self.control_handle
1511    }
1512
1513    fn drop_without_shutdown(mut self) {
1514        // Safety: drops once, never accessed again due to mem::forget
1515        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1516        // Prevent Drop from running (which would shut down the channel)
1517        std::mem::forget(self);
1518    }
1519}
1520
1521impl BlockGetNameResponder {
1522    /// Sends a response to the FIDL transaction.
1523    ///
1524    /// Sets the channel to shutdown if an error occurs.
1525    pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1526        let _result = self.send_raw(status, name);
1527        if _result.is_err() {
1528            self.control_handle.shutdown();
1529        }
1530        self.drop_without_shutdown();
1531        _result
1532    }
1533
1534    /// Similar to "send" but does not shutdown the channel if an error occurs.
1535    pub fn send_no_shutdown_on_err(
1536        self,
1537        mut status: i32,
1538        mut name: Option<&str>,
1539    ) -> Result<(), fidl::Error> {
1540        let _result = self.send_raw(status, name);
1541        self.drop_without_shutdown();
1542        _result
1543    }
1544
1545    fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1546        self.control_handle.inner.send::<BlockGetNameResponse>(
1547            (status, name),
1548            self.tx_id,
1549            0x630be18badedbb05,
1550            fidl::encoding::DynamicFlags::empty(),
1551        )
1552    }
1553}
1554
1555#[must_use = "FIDL methods require a response to be sent"]
1556#[derive(Debug)]
1557pub struct BlockGetMetadataResponder {
1558    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1559    tx_id: u32,
1560}
1561
1562/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1563/// if the responder is dropped without sending a response, so that the client
1564/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1565impl std::ops::Drop for BlockGetMetadataResponder {
1566    fn drop(&mut self) {
1567        self.control_handle.shutdown();
1568        // Safety: drops once, never accessed again
1569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1570    }
1571}
1572
1573impl fdomain_client::fidl::Responder for BlockGetMetadataResponder {
1574    type ControlHandle = BlockControlHandle;
1575
1576    fn control_handle(&self) -> &BlockControlHandle {
1577        &self.control_handle
1578    }
1579
1580    fn drop_without_shutdown(mut self) {
1581        // Safety: drops once, never accessed again due to mem::forget
1582        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1583        // Prevent Drop from running (which would shut down the channel)
1584        std::mem::forget(self);
1585    }
1586}
1587
1588impl BlockGetMetadataResponder {
1589    /// Sends a response to the FIDL transaction.
1590    ///
1591    /// Sets the channel to shutdown if an error occurs.
1592    pub fn send(self, mut result: Result<&PartitionInfo, i32>) -> Result<(), fidl::Error> {
1593        let _result = self.send_raw(result);
1594        if _result.is_err() {
1595            self.control_handle.shutdown();
1596        }
1597        self.drop_without_shutdown();
1598        _result
1599    }
1600
1601    /// Similar to "send" but does not shutdown the channel if an error occurs.
1602    pub fn send_no_shutdown_on_err(
1603        self,
1604        mut result: Result<&PartitionInfo, i32>,
1605    ) -> Result<(), fidl::Error> {
1606        let _result = self.send_raw(result);
1607        self.drop_without_shutdown();
1608        _result
1609    }
1610
1611    fn send_raw(&self, mut result: Result<&PartitionInfo, i32>) -> Result<(), fidl::Error> {
1612        self.control_handle.inner.send::<fidl::encoding::ResultType<PartitionInfo, i32>>(
1613            result,
1614            self.tx_id,
1615            0x2c76b02ef9382533,
1616            fidl::encoding::DynamicFlags::empty(),
1617        )
1618    }
1619}
1620
1621#[must_use = "FIDL methods require a response to be sent"]
1622#[derive(Debug)]
1623pub struct BlockQuerySlicesResponder {
1624    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1625    tx_id: u32,
1626}
1627
1628/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1629/// if the responder is dropped without sending a response, so that the client
1630/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1631impl std::ops::Drop for BlockQuerySlicesResponder {
1632    fn drop(&mut self) {
1633        self.control_handle.shutdown();
1634        // Safety: drops once, never accessed again
1635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1636    }
1637}
1638
1639impl fdomain_client::fidl::Responder for BlockQuerySlicesResponder {
1640    type ControlHandle = BlockControlHandle;
1641
1642    fn control_handle(&self) -> &BlockControlHandle {
1643        &self.control_handle
1644    }
1645
1646    fn drop_without_shutdown(mut self) {
1647        // Safety: drops once, never accessed again due to mem::forget
1648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1649        // Prevent Drop from running (which would shut down the channel)
1650        std::mem::forget(self);
1651    }
1652}
1653
1654impl BlockQuerySlicesResponder {
1655    /// Sends a response to the FIDL transaction.
1656    ///
1657    /// Sets the channel to shutdown if an error occurs.
1658    pub fn send(
1659        self,
1660        mut status: i32,
1661        mut response: &[VsliceRange; 16],
1662        mut response_count: u64,
1663    ) -> Result<(), fidl::Error> {
1664        let _result = self.send_raw(status, response, response_count);
1665        if _result.is_err() {
1666            self.control_handle.shutdown();
1667        }
1668        self.drop_without_shutdown();
1669        _result
1670    }
1671
1672    /// Similar to "send" but does not shutdown the channel if an error occurs.
1673    pub fn send_no_shutdown_on_err(
1674        self,
1675        mut status: i32,
1676        mut response: &[VsliceRange; 16],
1677        mut response_count: u64,
1678    ) -> Result<(), fidl::Error> {
1679        let _result = self.send_raw(status, response, response_count);
1680        self.drop_without_shutdown();
1681        _result
1682    }
1683
1684    fn send_raw(
1685        &self,
1686        mut status: i32,
1687        mut response: &[VsliceRange; 16],
1688        mut response_count: u64,
1689    ) -> Result<(), fidl::Error> {
1690        self.control_handle.inner.send::<BlockQuerySlicesResponse>(
1691            (status, response, response_count),
1692            self.tx_id,
1693            0x289240ac4fbaa190,
1694            fidl::encoding::DynamicFlags::empty(),
1695        )
1696    }
1697}
1698
1699#[must_use = "FIDL methods require a response to be sent"]
1700#[derive(Debug)]
1701pub struct BlockGetVolumeInfoResponder {
1702    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1703    tx_id: u32,
1704}
1705
1706/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1707/// if the responder is dropped without sending a response, so that the client
1708/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1709impl std::ops::Drop for BlockGetVolumeInfoResponder {
1710    fn drop(&mut self) {
1711        self.control_handle.shutdown();
1712        // Safety: drops once, never accessed again
1713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1714    }
1715}
1716
1717impl fdomain_client::fidl::Responder for BlockGetVolumeInfoResponder {
1718    type ControlHandle = BlockControlHandle;
1719
1720    fn control_handle(&self) -> &BlockControlHandle {
1721        &self.control_handle
1722    }
1723
1724    fn drop_without_shutdown(mut self) {
1725        // Safety: drops once, never accessed again due to mem::forget
1726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1727        // Prevent Drop from running (which would shut down the channel)
1728        std::mem::forget(self);
1729    }
1730}
1731
1732impl BlockGetVolumeInfoResponder {
1733    /// Sends a response to the FIDL transaction.
1734    ///
1735    /// Sets the channel to shutdown if an error occurs.
1736    pub fn send(
1737        self,
1738        mut status: i32,
1739        mut manager: Option<&VolumeManagerInfo>,
1740        mut volume: Option<&VolumeInfo>,
1741    ) -> Result<(), fidl::Error> {
1742        let _result = self.send_raw(status, manager, volume);
1743        if _result.is_err() {
1744            self.control_handle.shutdown();
1745        }
1746        self.drop_without_shutdown();
1747        _result
1748    }
1749
1750    /// Similar to "send" but does not shutdown the channel if an error occurs.
1751    pub fn send_no_shutdown_on_err(
1752        self,
1753        mut status: i32,
1754        mut manager: Option<&VolumeManagerInfo>,
1755        mut volume: Option<&VolumeInfo>,
1756    ) -> Result<(), fidl::Error> {
1757        let _result = self.send_raw(status, manager, volume);
1758        self.drop_without_shutdown();
1759        _result
1760    }
1761
1762    fn send_raw(
1763        &self,
1764        mut status: i32,
1765        mut manager: Option<&VolumeManagerInfo>,
1766        mut volume: Option<&VolumeInfo>,
1767    ) -> Result<(), fidl::Error> {
1768        self.control_handle.inner.send::<BlockGetVolumeInfoResponse>(
1769            (status, manager, volume),
1770            self.tx_id,
1771            0x3a7dc69ea5d788d4,
1772            fidl::encoding::DynamicFlags::empty(),
1773        )
1774    }
1775}
1776
1777#[must_use = "FIDL methods require a response to be sent"]
1778#[derive(Debug)]
1779pub struct BlockExtendResponder {
1780    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1781    tx_id: u32,
1782}
1783
1784/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1785/// if the responder is dropped without sending a response, so that the client
1786/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1787impl std::ops::Drop for BlockExtendResponder {
1788    fn drop(&mut self) {
1789        self.control_handle.shutdown();
1790        // Safety: drops once, never accessed again
1791        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1792    }
1793}
1794
1795impl fdomain_client::fidl::Responder for BlockExtendResponder {
1796    type ControlHandle = BlockControlHandle;
1797
1798    fn control_handle(&self) -> &BlockControlHandle {
1799        &self.control_handle
1800    }
1801
1802    fn drop_without_shutdown(mut self) {
1803        // Safety: drops once, never accessed again due to mem::forget
1804        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1805        // Prevent Drop from running (which would shut down the channel)
1806        std::mem::forget(self);
1807    }
1808}
1809
1810impl BlockExtendResponder {
1811    /// Sends a response to the FIDL transaction.
1812    ///
1813    /// Sets the channel to shutdown if an error occurs.
1814    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1815        let _result = self.send_raw(status);
1816        if _result.is_err() {
1817            self.control_handle.shutdown();
1818        }
1819        self.drop_without_shutdown();
1820        _result
1821    }
1822
1823    /// Similar to "send" but does not shutdown the channel if an error occurs.
1824    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1825        let _result = self.send_raw(status);
1826        self.drop_without_shutdown();
1827        _result
1828    }
1829
1830    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1831        self.control_handle.inner.send::<BlockExtendResponse>(
1832            (status,),
1833            self.tx_id,
1834            0x273fb2980ff24157,
1835            fidl::encoding::DynamicFlags::empty(),
1836        )
1837    }
1838}
1839
1840#[must_use = "FIDL methods require a response to be sent"]
1841#[derive(Debug)]
1842pub struct BlockShrinkResponder {
1843    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1844    tx_id: u32,
1845}
1846
1847/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1848/// if the responder is dropped without sending a response, so that the client
1849/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1850impl std::ops::Drop for BlockShrinkResponder {
1851    fn drop(&mut self) {
1852        self.control_handle.shutdown();
1853        // Safety: drops once, never accessed again
1854        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1855    }
1856}
1857
1858impl fdomain_client::fidl::Responder for BlockShrinkResponder {
1859    type ControlHandle = BlockControlHandle;
1860
1861    fn control_handle(&self) -> &BlockControlHandle {
1862        &self.control_handle
1863    }
1864
1865    fn drop_without_shutdown(mut self) {
1866        // Safety: drops once, never accessed again due to mem::forget
1867        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1868        // Prevent Drop from running (which would shut down the channel)
1869        std::mem::forget(self);
1870    }
1871}
1872
1873impl BlockShrinkResponder {
1874    /// Sends a response to the FIDL transaction.
1875    ///
1876    /// Sets the channel to shutdown if an error occurs.
1877    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1878        let _result = self.send_raw(status);
1879        if _result.is_err() {
1880            self.control_handle.shutdown();
1881        }
1882        self.drop_without_shutdown();
1883        _result
1884    }
1885
1886    /// Similar to "send" but does not shutdown the channel if an error occurs.
1887    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1888        let _result = self.send_raw(status);
1889        self.drop_without_shutdown();
1890        _result
1891    }
1892
1893    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1894        self.control_handle.inner.send::<BlockShrinkResponse>(
1895            (status,),
1896            self.tx_id,
1897            0x73da6de865600a8b,
1898            fidl::encoding::DynamicFlags::empty(),
1899        )
1900    }
1901}
1902
1903#[must_use = "FIDL methods require a response to be sent"]
1904#[derive(Debug)]
1905pub struct BlockDestroyResponder {
1906    control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
1907    tx_id: u32,
1908}
1909
1910/// Set the the channel to be shutdown (see [`BlockControlHandle::shutdown`])
1911/// if the responder is dropped without sending a response, so that the client
1912/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1913impl std::ops::Drop for BlockDestroyResponder {
1914    fn drop(&mut self) {
1915        self.control_handle.shutdown();
1916        // Safety: drops once, never accessed again
1917        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1918    }
1919}
1920
1921impl fdomain_client::fidl::Responder for BlockDestroyResponder {
1922    type ControlHandle = BlockControlHandle;
1923
1924    fn control_handle(&self) -> &BlockControlHandle {
1925        &self.control_handle
1926    }
1927
1928    fn drop_without_shutdown(mut self) {
1929        // Safety: drops once, never accessed again due to mem::forget
1930        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1931        // Prevent Drop from running (which would shut down the channel)
1932        std::mem::forget(self);
1933    }
1934}
1935
1936impl BlockDestroyResponder {
1937    /// Sends a response to the FIDL transaction.
1938    ///
1939    /// Sets the channel to shutdown if an error occurs.
1940    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1941        let _result = self.send_raw(status);
1942        if _result.is_err() {
1943            self.control_handle.shutdown();
1944        }
1945        self.drop_without_shutdown();
1946        _result
1947    }
1948
1949    /// Similar to "send" but does not shutdown the channel if an error occurs.
1950    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1951        let _result = self.send_raw(status);
1952        self.drop_without_shutdown();
1953        _result
1954    }
1955
1956    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1957        self.control_handle.inner.send::<BlockDestroyResponse>(
1958            (status,),
1959            self.tx_id,
1960            0x5866ba764e05a68e,
1961            fidl::encoding::DynamicFlags::empty(),
1962        )
1963    }
1964}
1965
1966#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1967pub struct MapperMarker;
1968
1969impl fdomain_client::fidl::ProtocolMarker for MapperMarker {
1970    type Proxy = MapperProxy;
1971    type RequestStream = MapperRequestStream;
1972
1973    const DEBUG_NAME: &'static str = "fuchsia.storage.block.Mapper";
1974}
1975impl fdomain_client::fidl::DiscoverableProtocolMarker for MapperMarker {}
1976pub type MapperOpenSessionResult = Result<(), i32>;
1977
1978pub trait MapperProxyInterface: Send + Sync {
1979    type OpenSessionResponseFut: std::future::Future<Output = Result<MapperOpenSessionResult, fidl::Error>>
1980        + Send;
1981    fn r#open_session(
1982        &self,
1983        session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
1984        mapping_vmo: fdomain_client::Vmo,
1985        port: Option<fdomain_client::Port>,
1986        delivery_queue: Option<fdomain_client::Vmo>,
1987    ) -> Self::OpenSessionResponseFut;
1988}
1989
1990#[derive(Debug, Clone)]
1991pub struct MapperProxy {
1992    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1993}
1994
1995impl fdomain_client::fidl::Proxy for MapperProxy {
1996    type Protocol = MapperMarker;
1997
1998    fn from_channel(inner: fdomain_client::Channel) -> Self {
1999        Self::new(inner)
2000    }
2001
2002    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2003        self.client.into_channel().map_err(|client| Self { client })
2004    }
2005
2006    fn as_channel(&self) -> &fdomain_client::Channel {
2007        self.client.as_channel()
2008    }
2009}
2010
2011impl MapperProxy {
2012    /// Create a new Proxy for fuchsia.storage.block/Mapper.
2013    pub fn new(channel: fdomain_client::Channel) -> Self {
2014        let protocol_name = <MapperMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2015        Self { client: fidl::client::Client::new(channel, protocol_name) }
2016    }
2017
2018    /// Get a Stream of events from the remote end of the protocol.
2019    ///
2020    /// # Panics
2021    ///
2022    /// Panics if the event stream was already taken.
2023    pub fn take_event_stream(&self) -> MapperEventStream {
2024        MapperEventStream { event_receiver: self.client.take_event_receiver() }
2025    }
2026
2027    /// Bootstraps the driver mapper with the mapping VMO and verifier handles.
2028    pub fn r#open_session(
2029        &self,
2030        mut session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2031        mut mapping_vmo: fdomain_client::Vmo,
2032        mut port: Option<fdomain_client::Port>,
2033        mut delivery_queue: Option<fdomain_client::Vmo>,
2034    ) -> fidl::client::QueryResponseFut<
2035        MapperOpenSessionResult,
2036        fdomain_client::fidl::FDomainResourceDialect,
2037    > {
2038        MapperProxyInterface::r#open_session(self, session, mapping_vmo, port, delivery_queue)
2039    }
2040}
2041
2042impl MapperProxyInterface for MapperProxy {
2043    type OpenSessionResponseFut = fidl::client::QueryResponseFut<
2044        MapperOpenSessionResult,
2045        fdomain_client::fidl::FDomainResourceDialect,
2046    >;
2047    fn r#open_session(
2048        &self,
2049        mut session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2050        mut mapping_vmo: fdomain_client::Vmo,
2051        mut port: Option<fdomain_client::Port>,
2052        mut delivery_queue: Option<fdomain_client::Vmo>,
2053    ) -> Self::OpenSessionResponseFut {
2054        fn _decode(
2055            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2056        ) -> Result<MapperOpenSessionResult, fidl::Error> {
2057            let _response = fidl::client::decode_transaction_body::<
2058                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2059                fdomain_client::fidl::FDomainResourceDialect,
2060                0x638c49dbdff13a9c,
2061            >(_buf?)?
2062            .into_result_fdomain::<MapperMarker>("open_session")?;
2063            Ok(_response.map(|x| x))
2064        }
2065        self.client.send_query_and_decode::<MapperOpenSessionRequest, MapperOpenSessionResult>(
2066            (session, mapping_vmo, port, delivery_queue),
2067            0x638c49dbdff13a9c,
2068            fidl::encoding::DynamicFlags::FLEXIBLE,
2069            _decode,
2070        )
2071    }
2072}
2073
2074pub struct MapperEventStream {
2075    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2076}
2077
2078impl std::marker::Unpin for MapperEventStream {}
2079
2080impl futures::stream::FusedStream for MapperEventStream {
2081    fn is_terminated(&self) -> bool {
2082        self.event_receiver.is_terminated()
2083    }
2084}
2085
2086impl futures::Stream for MapperEventStream {
2087    type Item = Result<MapperEvent, fidl::Error>;
2088
2089    fn poll_next(
2090        mut self: std::pin::Pin<&mut Self>,
2091        cx: &mut std::task::Context<'_>,
2092    ) -> std::task::Poll<Option<Self::Item>> {
2093        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2094            &mut self.event_receiver,
2095            cx
2096        )?) {
2097            Some(buf) => std::task::Poll::Ready(Some(MapperEvent::decode(buf))),
2098            None => std::task::Poll::Ready(None),
2099        }
2100    }
2101}
2102
2103#[derive(Debug)]
2104pub enum MapperEvent {
2105    #[non_exhaustive]
2106    _UnknownEvent {
2107        /// Ordinal of the event that was sent.
2108        ordinal: u64,
2109    },
2110}
2111
2112impl MapperEvent {
2113    /// Decodes a message buffer as a [`MapperEvent`].
2114    fn decode(
2115        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2116    ) -> Result<MapperEvent, fidl::Error> {
2117        let (bytes, _handles) = buf.split_mut();
2118        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2119        debug_assert_eq!(tx_header.tx_id, 0);
2120        match tx_header.ordinal {
2121            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2122                Ok(MapperEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2123            }
2124            _ => Err(fidl::Error::UnknownOrdinal {
2125                ordinal: tx_header.ordinal,
2126                protocol_name: <MapperMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2127            }),
2128        }
2129    }
2130}
2131
2132/// A Stream of incoming requests for fuchsia.storage.block/Mapper.
2133pub struct MapperRequestStream {
2134    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2135    is_terminated: bool,
2136}
2137
2138impl std::marker::Unpin for MapperRequestStream {}
2139
2140impl futures::stream::FusedStream for MapperRequestStream {
2141    fn is_terminated(&self) -> bool {
2142        self.is_terminated
2143    }
2144}
2145
2146impl fdomain_client::fidl::RequestStream for MapperRequestStream {
2147    type Protocol = MapperMarker;
2148    type ControlHandle = MapperControlHandle;
2149
2150    fn from_channel(channel: fdomain_client::Channel) -> Self {
2151        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2152    }
2153
2154    fn control_handle(&self) -> Self::ControlHandle {
2155        MapperControlHandle { inner: self.inner.clone() }
2156    }
2157
2158    fn into_inner(
2159        self,
2160    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2161    {
2162        (self.inner, self.is_terminated)
2163    }
2164
2165    fn from_inner(
2166        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2167        is_terminated: bool,
2168    ) -> Self {
2169        Self { inner, is_terminated }
2170    }
2171}
2172
2173impl futures::Stream for MapperRequestStream {
2174    type Item = Result<MapperRequest, fidl::Error>;
2175
2176    fn poll_next(
2177        mut self: std::pin::Pin<&mut Self>,
2178        cx: &mut std::task::Context<'_>,
2179    ) -> std::task::Poll<Option<Self::Item>> {
2180        let this = &mut *self;
2181        if this.inner.check_shutdown(cx) {
2182            this.is_terminated = true;
2183            return std::task::Poll::Ready(None);
2184        }
2185        if this.is_terminated {
2186            panic!("polled MapperRequestStream after completion");
2187        }
2188        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2189            |bytes, handles| {
2190                match this.inner.channel().read_etc(cx, bytes, handles) {
2191                    std::task::Poll::Ready(Ok(())) => {}
2192                    std::task::Poll::Pending => return std::task::Poll::Pending,
2193                    std::task::Poll::Ready(Err(None)) => {
2194                        this.is_terminated = true;
2195                        return std::task::Poll::Ready(None);
2196                    }
2197                    std::task::Poll::Ready(Err(Some(e))) => {
2198                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2199                            e.into(),
2200                        ))));
2201                    }
2202                }
2203
2204                // A message has been received from the channel
2205                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2206
2207                std::task::Poll::Ready(Some(match header.ordinal {
2208                    0x638c49dbdff13a9c => {
2209                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2210                        let mut req = fidl::new_empty!(
2211                            MapperOpenSessionRequest,
2212                            fdomain_client::fidl::FDomainResourceDialect
2213                        );
2214                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<MapperOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2215                        let control_handle = MapperControlHandle { inner: this.inner.clone() };
2216                        Ok(MapperRequest::OpenSession {
2217                            session: req.session,
2218                            mapping_vmo: req.mapping_vmo,
2219                            port: req.port,
2220                            delivery_queue: req.delivery_queue,
2221
2222                            responder: MapperOpenSessionResponder {
2223                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2224                                tx_id: header.tx_id,
2225                            },
2226                        })
2227                    }
2228                    _ if header.tx_id == 0
2229                        && header
2230                            .dynamic_flags()
2231                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2232                    {
2233                        Ok(MapperRequest::_UnknownMethod {
2234                            ordinal: header.ordinal,
2235                            control_handle: MapperControlHandle { inner: this.inner.clone() },
2236                            method_type: fidl::MethodType::OneWay,
2237                        })
2238                    }
2239                    _ if header
2240                        .dynamic_flags()
2241                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2242                    {
2243                        this.inner.send_framework_err(
2244                            fidl::encoding::FrameworkErr::UnknownMethod,
2245                            header.tx_id,
2246                            header.ordinal,
2247                            header.dynamic_flags(),
2248                            (bytes, handles),
2249                        )?;
2250                        Ok(MapperRequest::_UnknownMethod {
2251                            ordinal: header.ordinal,
2252                            control_handle: MapperControlHandle { inner: this.inner.clone() },
2253                            method_type: fidl::MethodType::TwoWay,
2254                        })
2255                    }
2256                    _ => Err(fidl::Error::UnknownOrdinal {
2257                        ordinal: header.ordinal,
2258                        protocol_name:
2259                            <MapperMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2260                    }),
2261                }))
2262            },
2263        )
2264    }
2265}
2266
2267/// Exposed by the block driver, routed via fshost to pkg-cache.
2268#[derive(Debug)]
2269pub enum MapperRequest {
2270    /// Bootstraps the driver mapper with the mapping VMO and verifier handles.
2271    OpenSession {
2272        session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2273        mapping_vmo: fdomain_client::Vmo,
2274        port: Option<fdomain_client::Port>,
2275        delivery_queue: Option<fdomain_client::Vmo>,
2276        responder: MapperOpenSessionResponder,
2277    },
2278    /// An interaction was received which does not match any known method.
2279    #[non_exhaustive]
2280    _UnknownMethod {
2281        /// Ordinal of the method that was called.
2282        ordinal: u64,
2283        control_handle: MapperControlHandle,
2284        method_type: fidl::MethodType,
2285    },
2286}
2287
2288impl MapperRequest {
2289    #[allow(irrefutable_let_patterns)]
2290    pub fn into_open_session(
2291        self,
2292    ) -> Option<(
2293        fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2294        fdomain_client::Vmo,
2295        Option<fdomain_client::Port>,
2296        Option<fdomain_client::Vmo>,
2297        MapperOpenSessionResponder,
2298    )> {
2299        if let MapperRequest::OpenSession {
2300            session,
2301            mapping_vmo,
2302            port,
2303            delivery_queue,
2304            responder,
2305        } = self
2306        {
2307            Some((session, mapping_vmo, port, delivery_queue, responder))
2308        } else {
2309            None
2310        }
2311    }
2312
2313    /// Name of the method defined in FIDL
2314    pub fn method_name(&self) -> &'static str {
2315        match *self {
2316            MapperRequest::OpenSession { .. } => "open_session",
2317            MapperRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2318                "unknown one-way method"
2319            }
2320            MapperRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2321                "unknown two-way method"
2322            }
2323        }
2324    }
2325}
2326
2327#[derive(Debug, Clone)]
2328pub struct MapperControlHandle {
2329    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2330}
2331
2332impl MapperControlHandle {
2333    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2334        self.inner.shutdown_with_epitaph(status.into())
2335    }
2336}
2337
2338impl fdomain_client::fidl::ControlHandle for MapperControlHandle {
2339    fn shutdown(&self) {
2340        self.inner.shutdown()
2341    }
2342
2343    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2344        self.inner.shutdown_with_epitaph(status)
2345    }
2346
2347    fn is_closed(&self) -> bool {
2348        self.inner.channel().is_closed()
2349    }
2350    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2351        self.inner.channel().on_closed()
2352    }
2353}
2354
2355impl MapperControlHandle {}
2356
2357#[must_use = "FIDL methods require a response to be sent"]
2358#[derive(Debug)]
2359pub struct MapperOpenSessionResponder {
2360    control_handle: std::mem::ManuallyDrop<MapperControlHandle>,
2361    tx_id: u32,
2362}
2363
2364/// Set the the channel to be shutdown (see [`MapperControlHandle::shutdown`])
2365/// if the responder is dropped without sending a response, so that the client
2366/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2367impl std::ops::Drop for MapperOpenSessionResponder {
2368    fn drop(&mut self) {
2369        self.control_handle.shutdown();
2370        // Safety: drops once, never accessed again
2371        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2372    }
2373}
2374
2375impl fdomain_client::fidl::Responder for MapperOpenSessionResponder {
2376    type ControlHandle = MapperControlHandle;
2377
2378    fn control_handle(&self) -> &MapperControlHandle {
2379        &self.control_handle
2380    }
2381
2382    fn drop_without_shutdown(mut self) {
2383        // Safety: drops once, never accessed again due to mem::forget
2384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2385        // Prevent Drop from running (which would shut down the channel)
2386        std::mem::forget(self);
2387    }
2388}
2389
2390impl MapperOpenSessionResponder {
2391    /// Sends a response to the FIDL transaction.
2392    ///
2393    /// Sets the channel to shutdown if an error occurs.
2394    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2395        let _result = self.send_raw(result);
2396        if _result.is_err() {
2397            self.control_handle.shutdown();
2398        }
2399        self.drop_without_shutdown();
2400        _result
2401    }
2402
2403    /// Similar to "send" but does not shutdown the channel if an error occurs.
2404    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2405        let _result = self.send_raw(result);
2406        self.drop_without_shutdown();
2407        _result
2408    }
2409
2410    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2411        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2412            fidl::encoding::EmptyStruct,
2413            i32,
2414        >>(
2415            fidl::encoding::FlexibleResult::new(result),
2416            self.tx_id,
2417            0x638c49dbdff13a9c,
2418            fidl::encoding::DynamicFlags::FLEXIBLE,
2419        )
2420    }
2421}
2422
2423#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2424pub struct MapperSessionMarker;
2425
2426impl fdomain_client::fidl::ProtocolMarker for MapperSessionMarker {
2427    type Proxy = MapperSessionProxy;
2428    type RequestStream = MapperSessionRequestStream;
2429
2430    const DEBUG_NAME: &'static str = "(anonymous) MapperSession";
2431}
2432pub type MapperSessionCreateVmoResult = Result<fdomain_client::Vmo, i32>;
2433pub type MapperSessionOpenChildSessionResult = Result<(), i32>;
2434
2435pub trait MapperSessionProxyInterface: Send + Sync {
2436    type CloseResponseFut: std::future::Future<
2437            Output = Result<fdomain_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
2438        > + Send;
2439    fn r#close(&self) -> Self::CloseResponseFut;
2440    type CreateVmoResponseFut: std::future::Future<Output = Result<MapperSessionCreateVmoResult, fidl::Error>>
2441        + Send;
2442    fn r#create_vmo(
2443        &self,
2444        key: u64,
2445        size: u64,
2446        options: CreateVmoOptions,
2447    ) -> Self::CreateVmoResponseFut;
2448    type OpenChildSessionResponseFut: std::future::Future<Output = Result<MapperSessionOpenChildSessionResult, fidl::Error>>
2449        + Send;
2450    fn r#open_child_session(
2451        &self,
2452        session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2453        mapping_vmo: fdomain_client::Vmo,
2454        parent_key: u64,
2455        port: Option<fdomain_client::Port>,
2456        delivery_queue: Option<fdomain_client::Vmo>,
2457    ) -> Self::OpenChildSessionResponseFut;
2458}
2459
2460#[derive(Debug, Clone)]
2461pub struct MapperSessionProxy {
2462    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2463}
2464
2465impl fdomain_client::fidl::Proxy for MapperSessionProxy {
2466    type Protocol = MapperSessionMarker;
2467
2468    fn from_channel(inner: fdomain_client::Channel) -> Self {
2469        Self::new(inner)
2470    }
2471
2472    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2473        self.client.into_channel().map_err(|client| Self { client })
2474    }
2475
2476    fn as_channel(&self) -> &fdomain_client::Channel {
2477        self.client.as_channel()
2478    }
2479}
2480
2481impl MapperSessionProxy {
2482    /// Create a new Proxy for fuchsia.storage.block/MapperSession.
2483    pub fn new(channel: fdomain_client::Channel) -> Self {
2484        let protocol_name =
2485            <MapperSessionMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2486        Self { client: fidl::client::Client::new(channel, protocol_name) }
2487    }
2488
2489    /// Get a Stream of events from the remote end of the protocol.
2490    ///
2491    /// # Panics
2492    ///
2493    /// Panics if the event stream was already taken.
2494    pub fn take_event_stream(&self) -> MapperSessionEventStream {
2495        MapperSessionEventStream { event_receiver: self.client.take_event_receiver() }
2496    }
2497
2498    /// Terminates the connection.
2499    ///
2500    /// After calling `Close`, the client must not send any other requests.
2501    ///
2502    /// Servers, after sending the status response, should close the connection
2503    /// regardless of status and without sending an epitaph.
2504    ///
2505    /// Closing the client end of the channel should be semantically equivalent
2506    /// to calling `Close` without knowing when the close has completed or its
2507    /// status.
2508    pub fn r#close(
2509        &self,
2510    ) -> fidl::client::QueryResponseFut<
2511        fdomain_fuchsia_unknown::CloseableCloseResult,
2512        fdomain_client::fidl::FDomainResourceDialect,
2513    > {
2514        MapperSessionProxyInterface::r#close(self)
2515    }
2516
2517    /// Creates a pager-backed VMO of `size` bytes associated with `key`.
2518    /// Page faults on this VMO are handled directly by the driver mapper.
2519    pub fn r#create_vmo(
2520        &self,
2521        mut key: u64,
2522        mut size: u64,
2523        mut options: CreateVmoOptions,
2524    ) -> fidl::client::QueryResponseFut<
2525        MapperSessionCreateVmoResult,
2526        fdomain_client::fidl::FDomainResourceDialect,
2527    > {
2528        MapperSessionProxyInterface::r#create_vmo(self, key, size, options)
2529    }
2530
2531    /// Opens a child mapper session whose reads map through `parent_key` in the parent session.
2532    /// When a parent session is closed, all child sessions opened from it are closed as well.
2533    pub fn r#open_child_session(
2534        &self,
2535        mut session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2536        mut mapping_vmo: fdomain_client::Vmo,
2537        mut parent_key: u64,
2538        mut port: Option<fdomain_client::Port>,
2539        mut delivery_queue: Option<fdomain_client::Vmo>,
2540    ) -> fidl::client::QueryResponseFut<
2541        MapperSessionOpenChildSessionResult,
2542        fdomain_client::fidl::FDomainResourceDialect,
2543    > {
2544        MapperSessionProxyInterface::r#open_child_session(
2545            self,
2546            session,
2547            mapping_vmo,
2548            parent_key,
2549            port,
2550            delivery_queue,
2551        )
2552    }
2553}
2554
2555impl MapperSessionProxyInterface for MapperSessionProxy {
2556    type CloseResponseFut = fidl::client::QueryResponseFut<
2557        fdomain_fuchsia_unknown::CloseableCloseResult,
2558        fdomain_client::fidl::FDomainResourceDialect,
2559    >;
2560    fn r#close(&self) -> Self::CloseResponseFut {
2561        fn _decode(
2562            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2563        ) -> Result<fdomain_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
2564            let _response = fidl::client::decode_transaction_body::<
2565                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2566                fdomain_client::fidl::FDomainResourceDialect,
2567                0x5ac5d459ad7f657e,
2568            >(_buf?)?;
2569            Ok(_response.map(|x| x))
2570        }
2571        self.client.send_query_and_decode::<
2572            fidl::encoding::EmptyPayload,
2573            fdomain_fuchsia_unknown::CloseableCloseResult,
2574        >(
2575            (),
2576            0x5ac5d459ad7f657e,
2577            fidl::encoding::DynamicFlags::empty(),
2578            _decode,
2579        )
2580    }
2581
2582    type CreateVmoResponseFut = fidl::client::QueryResponseFut<
2583        MapperSessionCreateVmoResult,
2584        fdomain_client::fidl::FDomainResourceDialect,
2585    >;
2586    fn r#create_vmo(
2587        &self,
2588        mut key: u64,
2589        mut size: u64,
2590        mut options: CreateVmoOptions,
2591    ) -> Self::CreateVmoResponseFut {
2592        fn _decode(
2593            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2594        ) -> Result<MapperSessionCreateVmoResult, fidl::Error> {
2595            let _response = fidl::client::decode_transaction_body::<
2596                fidl::encoding::FlexibleResultType<MapperSessionCreateVmoResponse, i32>,
2597                fdomain_client::fidl::FDomainResourceDialect,
2598                0x35be1bf1bd0f9e1d,
2599            >(_buf?)?
2600            .into_result_fdomain::<MapperSessionMarker>("create_vmo")?;
2601            Ok(_response.map(|x| x.vmo))
2602        }
2603        self.client
2604            .send_query_and_decode::<MapperSessionCreateVmoRequest, MapperSessionCreateVmoResult>(
2605                (key, size, options),
2606                0x35be1bf1bd0f9e1d,
2607                fidl::encoding::DynamicFlags::FLEXIBLE,
2608                _decode,
2609            )
2610    }
2611
2612    type OpenChildSessionResponseFut = fidl::client::QueryResponseFut<
2613        MapperSessionOpenChildSessionResult,
2614        fdomain_client::fidl::FDomainResourceDialect,
2615    >;
2616    fn r#open_child_session(
2617        &self,
2618        mut session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2619        mut mapping_vmo: fdomain_client::Vmo,
2620        mut parent_key: u64,
2621        mut port: Option<fdomain_client::Port>,
2622        mut delivery_queue: Option<fdomain_client::Vmo>,
2623    ) -> Self::OpenChildSessionResponseFut {
2624        fn _decode(
2625            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2626        ) -> Result<MapperSessionOpenChildSessionResult, fidl::Error> {
2627            let _response = fidl::client::decode_transaction_body::<
2628                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2629                fdomain_client::fidl::FDomainResourceDialect,
2630                0x7b80686acf9dcca3,
2631            >(_buf?)?
2632            .into_result_fdomain::<MapperSessionMarker>("open_child_session")?;
2633            Ok(_response.map(|x| x))
2634        }
2635        self.client.send_query_and_decode::<
2636            MapperSessionOpenChildSessionRequest,
2637            MapperSessionOpenChildSessionResult,
2638        >(
2639            (session, mapping_vmo, parent_key, port, delivery_queue,),
2640            0x7b80686acf9dcca3,
2641            fidl::encoding::DynamicFlags::FLEXIBLE,
2642            _decode,
2643        )
2644    }
2645}
2646
2647pub struct MapperSessionEventStream {
2648    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2649}
2650
2651impl std::marker::Unpin for MapperSessionEventStream {}
2652
2653impl futures::stream::FusedStream for MapperSessionEventStream {
2654    fn is_terminated(&self) -> bool {
2655        self.event_receiver.is_terminated()
2656    }
2657}
2658
2659impl futures::Stream for MapperSessionEventStream {
2660    type Item = Result<MapperSessionEvent, fidl::Error>;
2661
2662    fn poll_next(
2663        mut self: std::pin::Pin<&mut Self>,
2664        cx: &mut std::task::Context<'_>,
2665    ) -> std::task::Poll<Option<Self::Item>> {
2666        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2667            &mut self.event_receiver,
2668            cx
2669        )?) {
2670            Some(buf) => std::task::Poll::Ready(Some(MapperSessionEvent::decode(buf))),
2671            None => std::task::Poll::Ready(None),
2672        }
2673    }
2674}
2675
2676#[derive(Debug)]
2677pub enum MapperSessionEvent {
2678    #[non_exhaustive]
2679    _UnknownEvent {
2680        /// Ordinal of the event that was sent.
2681        ordinal: u64,
2682    },
2683}
2684
2685impl MapperSessionEvent {
2686    /// Decodes a message buffer as a [`MapperSessionEvent`].
2687    fn decode(
2688        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2689    ) -> Result<MapperSessionEvent, fidl::Error> {
2690        let (bytes, _handles) = buf.split_mut();
2691        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2692        debug_assert_eq!(tx_header.tx_id, 0);
2693        match tx_header.ordinal {
2694            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2695                Ok(MapperSessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2696            }
2697            _ => Err(fidl::Error::UnknownOrdinal {
2698                ordinal: tx_header.ordinal,
2699                protocol_name:
2700                    <MapperSessionMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2701            }),
2702        }
2703    }
2704}
2705
2706/// A Stream of incoming requests for fuchsia.storage.block/MapperSession.
2707pub struct MapperSessionRequestStream {
2708    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2709    is_terminated: bool,
2710}
2711
2712impl std::marker::Unpin for MapperSessionRequestStream {}
2713
2714impl futures::stream::FusedStream for MapperSessionRequestStream {
2715    fn is_terminated(&self) -> bool {
2716        self.is_terminated
2717    }
2718}
2719
2720impl fdomain_client::fidl::RequestStream for MapperSessionRequestStream {
2721    type Protocol = MapperSessionMarker;
2722    type ControlHandle = MapperSessionControlHandle;
2723
2724    fn from_channel(channel: fdomain_client::Channel) -> Self {
2725        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2726    }
2727
2728    fn control_handle(&self) -> Self::ControlHandle {
2729        MapperSessionControlHandle { inner: self.inner.clone() }
2730    }
2731
2732    fn into_inner(
2733        self,
2734    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2735    {
2736        (self.inner, self.is_terminated)
2737    }
2738
2739    fn from_inner(
2740        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2741        is_terminated: bool,
2742    ) -> Self {
2743        Self { inner, is_terminated }
2744    }
2745}
2746
2747impl futures::Stream for MapperSessionRequestStream {
2748    type Item = Result<MapperSessionRequest, fidl::Error>;
2749
2750    fn poll_next(
2751        mut self: std::pin::Pin<&mut Self>,
2752        cx: &mut std::task::Context<'_>,
2753    ) -> std::task::Poll<Option<Self::Item>> {
2754        let this = &mut *self;
2755        if this.inner.check_shutdown(cx) {
2756            this.is_terminated = true;
2757            return std::task::Poll::Ready(None);
2758        }
2759        if this.is_terminated {
2760            panic!("polled MapperSessionRequestStream after completion");
2761        }
2762        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2763            |bytes, handles| {
2764                match this.inner.channel().read_etc(cx, bytes, handles) {
2765                    std::task::Poll::Ready(Ok(())) => {}
2766                    std::task::Poll::Pending => return std::task::Poll::Pending,
2767                    std::task::Poll::Ready(Err(None)) => {
2768                        this.is_terminated = true;
2769                        return std::task::Poll::Ready(None);
2770                    }
2771                    std::task::Poll::Ready(Err(Some(e))) => {
2772                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2773                            e.into(),
2774                        ))));
2775                    }
2776                }
2777
2778                // A message has been received from the channel
2779                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2780
2781                std::task::Poll::Ready(Some(match header.ordinal {
2782                0x5ac5d459ad7f657e => {
2783                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2784                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
2785                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2786                    let control_handle = MapperSessionControlHandle {
2787                        inner: this.inner.clone(),
2788                    };
2789                    Ok(MapperSessionRequest::Close {
2790                        responder: MapperSessionCloseResponder {
2791                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2792                            tx_id: header.tx_id,
2793                        },
2794                    })
2795                }
2796                0x35be1bf1bd0f9e1d => {
2797                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2798                    let mut req = fidl::new_empty!(MapperSessionCreateVmoRequest, fdomain_client::fidl::FDomainResourceDialect);
2799                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<MapperSessionCreateVmoRequest>(&header, _body_bytes, handles, &mut req)?;
2800                    let control_handle = MapperSessionControlHandle {
2801                        inner: this.inner.clone(),
2802                    };
2803                    Ok(MapperSessionRequest::CreateVmo {key: req.key,
2804size: req.size,
2805options: req.options,
2806
2807                        responder: MapperSessionCreateVmoResponder {
2808                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2809                            tx_id: header.tx_id,
2810                        },
2811                    })
2812                }
2813                0x7b80686acf9dcca3 => {
2814                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2815                    let mut req = fidl::new_empty!(MapperSessionOpenChildSessionRequest, fdomain_client::fidl::FDomainResourceDialect);
2816                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<MapperSessionOpenChildSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2817                    let control_handle = MapperSessionControlHandle {
2818                        inner: this.inner.clone(),
2819                    };
2820                    Ok(MapperSessionRequest::OpenChildSession {session: req.session,
2821mapping_vmo: req.mapping_vmo,
2822parent_key: req.parent_key,
2823port: req.port,
2824delivery_queue: req.delivery_queue,
2825
2826                        responder: MapperSessionOpenChildSessionResponder {
2827                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2828                            tx_id: header.tx_id,
2829                        },
2830                    })
2831                }
2832                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2833                    Ok(MapperSessionRequest::_UnknownMethod {
2834                        ordinal: header.ordinal,
2835                        control_handle: MapperSessionControlHandle { inner: this.inner.clone() },
2836                        method_type: fidl::MethodType::OneWay,
2837                    })
2838                }
2839                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2840                    this.inner.send_framework_err(
2841                        fidl::encoding::FrameworkErr::UnknownMethod,
2842                        header.tx_id,
2843                        header.ordinal,
2844                        header.dynamic_flags(),
2845                        (bytes, handles),
2846                    )?;
2847                    Ok(MapperSessionRequest::_UnknownMethod {
2848                        ordinal: header.ordinal,
2849                        control_handle: MapperSessionControlHandle { inner: this.inner.clone() },
2850                        method_type: fidl::MethodType::TwoWay,
2851                    })
2852                }
2853                _ => Err(fidl::Error::UnknownOrdinal {
2854                    ordinal: header.ordinal,
2855                    protocol_name: <MapperSessionMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2856                }),
2857            }))
2858            },
2859        )
2860    }
2861}
2862
2863/// Represents an active driver mapping session.
2864#[derive(Debug)]
2865pub enum MapperSessionRequest {
2866    /// Terminates the connection.
2867    ///
2868    /// After calling `Close`, the client must not send any other requests.
2869    ///
2870    /// Servers, after sending the status response, should close the connection
2871    /// regardless of status and without sending an epitaph.
2872    ///
2873    /// Closing the client end of the channel should be semantically equivalent
2874    /// to calling `Close` without knowing when the close has completed or its
2875    /// status.
2876    Close { responder: MapperSessionCloseResponder },
2877    /// Creates a pager-backed VMO of `size` bytes associated with `key`.
2878    /// Page faults on this VMO are handled directly by the driver mapper.
2879    CreateVmo {
2880        key: u64,
2881        size: u64,
2882        options: CreateVmoOptions,
2883        responder: MapperSessionCreateVmoResponder,
2884    },
2885    /// Opens a child mapper session whose reads map through `parent_key` in the parent session.
2886    /// When a parent session is closed, all child sessions opened from it are closed as well.
2887    OpenChildSession {
2888        session: fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2889        mapping_vmo: fdomain_client::Vmo,
2890        parent_key: u64,
2891        port: Option<fdomain_client::Port>,
2892        delivery_queue: Option<fdomain_client::Vmo>,
2893        responder: MapperSessionOpenChildSessionResponder,
2894    },
2895    /// An interaction was received which does not match any known method.
2896    #[non_exhaustive]
2897    _UnknownMethod {
2898        /// Ordinal of the method that was called.
2899        ordinal: u64,
2900        control_handle: MapperSessionControlHandle,
2901        method_type: fidl::MethodType,
2902    },
2903}
2904
2905impl MapperSessionRequest {
2906    #[allow(irrefutable_let_patterns)]
2907    pub fn into_close(self) -> Option<(MapperSessionCloseResponder)> {
2908        if let MapperSessionRequest::Close { responder } = self { Some((responder)) } else { None }
2909    }
2910
2911    #[allow(irrefutable_let_patterns)]
2912    pub fn into_create_vmo(
2913        self,
2914    ) -> Option<(u64, u64, CreateVmoOptions, MapperSessionCreateVmoResponder)> {
2915        if let MapperSessionRequest::CreateVmo { key, size, options, responder } = self {
2916            Some((key, size, options, responder))
2917        } else {
2918            None
2919        }
2920    }
2921
2922    #[allow(irrefutable_let_patterns)]
2923    pub fn into_open_child_session(
2924        self,
2925    ) -> Option<(
2926        fdomain_client::fidl::ServerEnd<MapperSessionMarker>,
2927        fdomain_client::Vmo,
2928        u64,
2929        Option<fdomain_client::Port>,
2930        Option<fdomain_client::Vmo>,
2931        MapperSessionOpenChildSessionResponder,
2932    )> {
2933        if let MapperSessionRequest::OpenChildSession {
2934            session,
2935            mapping_vmo,
2936            parent_key,
2937            port,
2938            delivery_queue,
2939            responder,
2940        } = self
2941        {
2942            Some((session, mapping_vmo, parent_key, port, delivery_queue, responder))
2943        } else {
2944            None
2945        }
2946    }
2947
2948    /// Name of the method defined in FIDL
2949    pub fn method_name(&self) -> &'static str {
2950        match *self {
2951            MapperSessionRequest::Close { .. } => "close",
2952            MapperSessionRequest::CreateVmo { .. } => "create_vmo",
2953            MapperSessionRequest::OpenChildSession { .. } => "open_child_session",
2954            MapperSessionRequest::_UnknownMethod {
2955                method_type: fidl::MethodType::OneWay, ..
2956            } => "unknown one-way method",
2957            MapperSessionRequest::_UnknownMethod {
2958                method_type: fidl::MethodType::TwoWay, ..
2959            } => "unknown two-way method",
2960        }
2961    }
2962}
2963
2964#[derive(Debug, Clone)]
2965pub struct MapperSessionControlHandle {
2966    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2967}
2968
2969impl MapperSessionControlHandle {
2970    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2971        self.inner.shutdown_with_epitaph(status.into())
2972    }
2973}
2974
2975impl fdomain_client::fidl::ControlHandle for MapperSessionControlHandle {
2976    fn shutdown(&self) {
2977        self.inner.shutdown()
2978    }
2979
2980    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2981        self.inner.shutdown_with_epitaph(status)
2982    }
2983
2984    fn is_closed(&self) -> bool {
2985        self.inner.channel().is_closed()
2986    }
2987    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2988        self.inner.channel().on_closed()
2989    }
2990}
2991
2992impl MapperSessionControlHandle {}
2993
2994#[must_use = "FIDL methods require a response to be sent"]
2995#[derive(Debug)]
2996pub struct MapperSessionCloseResponder {
2997    control_handle: std::mem::ManuallyDrop<MapperSessionControlHandle>,
2998    tx_id: u32,
2999}
3000
3001/// Set the the channel to be shutdown (see [`MapperSessionControlHandle::shutdown`])
3002/// if the responder is dropped without sending a response, so that the client
3003/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3004impl std::ops::Drop for MapperSessionCloseResponder {
3005    fn drop(&mut self) {
3006        self.control_handle.shutdown();
3007        // Safety: drops once, never accessed again
3008        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3009    }
3010}
3011
3012impl fdomain_client::fidl::Responder for MapperSessionCloseResponder {
3013    type ControlHandle = MapperSessionControlHandle;
3014
3015    fn control_handle(&self) -> &MapperSessionControlHandle {
3016        &self.control_handle
3017    }
3018
3019    fn drop_without_shutdown(mut self) {
3020        // Safety: drops once, never accessed again due to mem::forget
3021        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3022        // Prevent Drop from running (which would shut down the channel)
3023        std::mem::forget(self);
3024    }
3025}
3026
3027impl MapperSessionCloseResponder {
3028    /// Sends a response to the FIDL transaction.
3029    ///
3030    /// Sets the channel to shutdown if an error occurs.
3031    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3032        let _result = self.send_raw(result);
3033        if _result.is_err() {
3034            self.control_handle.shutdown();
3035        }
3036        self.drop_without_shutdown();
3037        _result
3038    }
3039
3040    /// Similar to "send" but does not shutdown the channel if an error occurs.
3041    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3042        let _result = self.send_raw(result);
3043        self.drop_without_shutdown();
3044        _result
3045    }
3046
3047    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3048        self.control_handle
3049            .inner
3050            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3051                result,
3052                self.tx_id,
3053                0x5ac5d459ad7f657e,
3054                fidl::encoding::DynamicFlags::empty(),
3055            )
3056    }
3057}
3058
3059#[must_use = "FIDL methods require a response to be sent"]
3060#[derive(Debug)]
3061pub struct MapperSessionCreateVmoResponder {
3062    control_handle: std::mem::ManuallyDrop<MapperSessionControlHandle>,
3063    tx_id: u32,
3064}
3065
3066/// Set the the channel to be shutdown (see [`MapperSessionControlHandle::shutdown`])
3067/// if the responder is dropped without sending a response, so that the client
3068/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3069impl std::ops::Drop for MapperSessionCreateVmoResponder {
3070    fn drop(&mut self) {
3071        self.control_handle.shutdown();
3072        // Safety: drops once, never accessed again
3073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3074    }
3075}
3076
3077impl fdomain_client::fidl::Responder for MapperSessionCreateVmoResponder {
3078    type ControlHandle = MapperSessionControlHandle;
3079
3080    fn control_handle(&self) -> &MapperSessionControlHandle {
3081        &self.control_handle
3082    }
3083
3084    fn drop_without_shutdown(mut self) {
3085        // Safety: drops once, never accessed again due to mem::forget
3086        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3087        // Prevent Drop from running (which would shut down the channel)
3088        std::mem::forget(self);
3089    }
3090}
3091
3092impl MapperSessionCreateVmoResponder {
3093    /// Sends a response to the FIDL transaction.
3094    ///
3095    /// Sets the channel to shutdown if an error occurs.
3096    pub fn send(self, mut result: Result<fdomain_client::Vmo, i32>) -> Result<(), fidl::Error> {
3097        let _result = self.send_raw(result);
3098        if _result.is_err() {
3099            self.control_handle.shutdown();
3100        }
3101        self.drop_without_shutdown();
3102        _result
3103    }
3104
3105    /// Similar to "send" but does not shutdown the channel if an error occurs.
3106    pub fn send_no_shutdown_on_err(
3107        self,
3108        mut result: Result<fdomain_client::Vmo, i32>,
3109    ) -> Result<(), fidl::Error> {
3110        let _result = self.send_raw(result);
3111        self.drop_without_shutdown();
3112        _result
3113    }
3114
3115    fn send_raw(&self, mut result: Result<fdomain_client::Vmo, i32>) -> Result<(), fidl::Error> {
3116        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3117            MapperSessionCreateVmoResponse,
3118            i32,
3119        >>(
3120            fidl::encoding::FlexibleResult::new(result.map(|vmo| (vmo,))),
3121            self.tx_id,
3122            0x35be1bf1bd0f9e1d,
3123            fidl::encoding::DynamicFlags::FLEXIBLE,
3124        )
3125    }
3126}
3127
3128#[must_use = "FIDL methods require a response to be sent"]
3129#[derive(Debug)]
3130pub struct MapperSessionOpenChildSessionResponder {
3131    control_handle: std::mem::ManuallyDrop<MapperSessionControlHandle>,
3132    tx_id: u32,
3133}
3134
3135/// Set the the channel to be shutdown (see [`MapperSessionControlHandle::shutdown`])
3136/// if the responder is dropped without sending a response, so that the client
3137/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3138impl std::ops::Drop for MapperSessionOpenChildSessionResponder {
3139    fn drop(&mut self) {
3140        self.control_handle.shutdown();
3141        // Safety: drops once, never accessed again
3142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3143    }
3144}
3145
3146impl fdomain_client::fidl::Responder for MapperSessionOpenChildSessionResponder {
3147    type ControlHandle = MapperSessionControlHandle;
3148
3149    fn control_handle(&self) -> &MapperSessionControlHandle {
3150        &self.control_handle
3151    }
3152
3153    fn drop_without_shutdown(mut self) {
3154        // Safety: drops once, never accessed again due to mem::forget
3155        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3156        // Prevent Drop from running (which would shut down the channel)
3157        std::mem::forget(self);
3158    }
3159}
3160
3161impl MapperSessionOpenChildSessionResponder {
3162    /// Sends a response to the FIDL transaction.
3163    ///
3164    /// Sets the channel to shutdown if an error occurs.
3165    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3166        let _result = self.send_raw(result);
3167        if _result.is_err() {
3168            self.control_handle.shutdown();
3169        }
3170        self.drop_without_shutdown();
3171        _result
3172    }
3173
3174    /// Similar to "send" but does not shutdown the channel if an error occurs.
3175    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3176        let _result = self.send_raw(result);
3177        self.drop_without_shutdown();
3178        _result
3179    }
3180
3181    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3182        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3183            fidl::encoding::EmptyStruct,
3184            i32,
3185        >>(
3186            fidl::encoding::FlexibleResult::new(result),
3187            self.tx_id,
3188            0x7b80686acf9dcca3,
3189            fidl::encoding::DynamicFlags::FLEXIBLE,
3190        )
3191    }
3192}
3193
3194#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3195pub struct SessionMarker;
3196
3197impl fdomain_client::fidl::ProtocolMarker for SessionMarker {
3198    type Proxy = SessionProxy;
3199    type RequestStream = SessionRequestStream;
3200
3201    const DEBUG_NAME: &'static str = "(anonymous) Session";
3202}
3203pub type SessionGetFifoResult = Result<fdomain_client::Fifo, i32>;
3204pub type SessionAttachVmoResult = Result<VmoId, i32>;
3205
3206pub trait SessionProxyInterface: Send + Sync {
3207    type CloseResponseFut: std::future::Future<
3208            Output = Result<fdomain_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
3209        > + Send;
3210    fn r#close(&self) -> Self::CloseResponseFut;
3211    type GetFifoResponseFut: std::future::Future<Output = Result<SessionGetFifoResult, fidl::Error>>
3212        + Send;
3213    fn r#get_fifo(&self) -> Self::GetFifoResponseFut;
3214    type AttachVmoResponseFut: std::future::Future<Output = Result<SessionAttachVmoResult, fidl::Error>>
3215        + Send;
3216    fn r#attach_vmo(&self, vmo: fdomain_client::Vmo) -> Self::AttachVmoResponseFut;
3217}
3218
3219#[derive(Debug, Clone)]
3220pub struct SessionProxy {
3221    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3222}
3223
3224impl fdomain_client::fidl::Proxy for SessionProxy {
3225    type Protocol = SessionMarker;
3226
3227    fn from_channel(inner: fdomain_client::Channel) -> Self {
3228        Self::new(inner)
3229    }
3230
3231    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3232        self.client.into_channel().map_err(|client| Self { client })
3233    }
3234
3235    fn as_channel(&self) -> &fdomain_client::Channel {
3236        self.client.as_channel()
3237    }
3238}
3239
3240impl SessionProxy {
3241    /// Create a new Proxy for fuchsia.storage.block/Session.
3242    pub fn new(channel: fdomain_client::Channel) -> Self {
3243        let protocol_name = <SessionMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3244        Self { client: fidl::client::Client::new(channel, protocol_name) }
3245    }
3246
3247    /// Get a Stream of events from the remote end of the protocol.
3248    ///
3249    /// # Panics
3250    ///
3251    /// Panics if the event stream was already taken.
3252    pub fn take_event_stream(&self) -> SessionEventStream {
3253        SessionEventStream { event_receiver: self.client.take_event_receiver() }
3254    }
3255
3256    /// Terminates the connection.
3257    ///
3258    /// After calling `Close`, the client must not send any other requests.
3259    ///
3260    /// Servers, after sending the status response, should close the connection
3261    /// regardless of status and without sending an epitaph.
3262    ///
3263    /// Closing the client end of the channel should be semantically equivalent
3264    /// to calling `Close` without knowing when the close has completed or its
3265    /// status.
3266    pub fn r#close(
3267        &self,
3268    ) -> fidl::client::QueryResponseFut<
3269        fdomain_fuchsia_unknown::CloseableCloseResult,
3270        fdomain_client::fidl::FDomainResourceDialect,
3271    > {
3272        SessionProxyInterface::r#close(self)
3273    }
3274
3275    /// Returns a handle to the client end of the FIFO.
3276    pub fn r#get_fifo(
3277        &self,
3278    ) -> fidl::client::QueryResponseFut<
3279        SessionGetFifoResult,
3280        fdomain_client::fidl::FDomainResourceDialect,
3281    > {
3282        SessionProxyInterface::r#get_fifo(self)
3283    }
3284
3285    /// Attaches a VMO to the session. Resizable VMOs are not supported and will return
3286    /// `ZX_ERR_INVALID_ARGS`.
3287    ///
3288    /// Returns an identifier that can be used to refer to the VMO.
3289    pub fn r#attach_vmo(
3290        &self,
3291        mut vmo: fdomain_client::Vmo,
3292    ) -> fidl::client::QueryResponseFut<
3293        SessionAttachVmoResult,
3294        fdomain_client::fidl::FDomainResourceDialect,
3295    > {
3296        SessionProxyInterface::r#attach_vmo(self, vmo)
3297    }
3298}
3299
3300impl SessionProxyInterface for SessionProxy {
3301    type CloseResponseFut = fidl::client::QueryResponseFut<
3302        fdomain_fuchsia_unknown::CloseableCloseResult,
3303        fdomain_client::fidl::FDomainResourceDialect,
3304    >;
3305    fn r#close(&self) -> Self::CloseResponseFut {
3306        fn _decode(
3307            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3308        ) -> Result<fdomain_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
3309            let _response = fidl::client::decode_transaction_body::<
3310                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3311                fdomain_client::fidl::FDomainResourceDialect,
3312                0x5ac5d459ad7f657e,
3313            >(_buf?)?;
3314            Ok(_response.map(|x| x))
3315        }
3316        self.client.send_query_and_decode::<
3317            fidl::encoding::EmptyPayload,
3318            fdomain_fuchsia_unknown::CloseableCloseResult,
3319        >(
3320            (),
3321            0x5ac5d459ad7f657e,
3322            fidl::encoding::DynamicFlags::empty(),
3323            _decode,
3324        )
3325    }
3326
3327    type GetFifoResponseFut = fidl::client::QueryResponseFut<
3328        SessionGetFifoResult,
3329        fdomain_client::fidl::FDomainResourceDialect,
3330    >;
3331    fn r#get_fifo(&self) -> Self::GetFifoResponseFut {
3332        fn _decode(
3333            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3334        ) -> Result<SessionGetFifoResult, fidl::Error> {
3335            let _response = fidl::client::decode_transaction_body::<
3336                fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
3337                fdomain_client::fidl::FDomainResourceDialect,
3338                0x7a6c7610912aaa98,
3339            >(_buf?)?;
3340            Ok(_response.map(|x| x.fifo))
3341        }
3342        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionGetFifoResult>(
3343            (),
3344            0x7a6c7610912aaa98,
3345            fidl::encoding::DynamicFlags::empty(),
3346            _decode,
3347        )
3348    }
3349
3350    type AttachVmoResponseFut = fidl::client::QueryResponseFut<
3351        SessionAttachVmoResult,
3352        fdomain_client::fidl::FDomainResourceDialect,
3353    >;
3354    fn r#attach_vmo(&self, mut vmo: fdomain_client::Vmo) -> Self::AttachVmoResponseFut {
3355        fn _decode(
3356            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3357        ) -> Result<SessionAttachVmoResult, fidl::Error> {
3358            let _response = fidl::client::decode_transaction_body::<
3359                fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
3360                fdomain_client::fidl::FDomainResourceDialect,
3361                0x677a0f6fd1a370b2,
3362            >(_buf?)?;
3363            Ok(_response.map(|x| x.vmoid))
3364        }
3365        self.client.send_query_and_decode::<SessionAttachVmoRequest, SessionAttachVmoResult>(
3366            (vmo,),
3367            0x677a0f6fd1a370b2,
3368            fidl::encoding::DynamicFlags::empty(),
3369            _decode,
3370        )
3371    }
3372}
3373
3374pub struct SessionEventStream {
3375    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3376}
3377
3378impl std::marker::Unpin for SessionEventStream {}
3379
3380impl futures::stream::FusedStream for SessionEventStream {
3381    fn is_terminated(&self) -> bool {
3382        self.event_receiver.is_terminated()
3383    }
3384}
3385
3386impl futures::Stream for SessionEventStream {
3387    type Item = Result<SessionEvent, fidl::Error>;
3388
3389    fn poll_next(
3390        mut self: std::pin::Pin<&mut Self>,
3391        cx: &mut std::task::Context<'_>,
3392    ) -> std::task::Poll<Option<Self::Item>> {
3393        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3394            &mut self.event_receiver,
3395            cx
3396        )?) {
3397            Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
3398            None => std::task::Poll::Ready(None),
3399        }
3400    }
3401}
3402
3403#[derive(Debug)]
3404pub enum SessionEvent {}
3405
3406impl SessionEvent {
3407    /// Decodes a message buffer as a [`SessionEvent`].
3408    fn decode(
3409        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3410    ) -> Result<SessionEvent, fidl::Error> {
3411        let (bytes, _handles) = buf.split_mut();
3412        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3413        debug_assert_eq!(tx_header.tx_id, 0);
3414        match tx_header.ordinal {
3415            _ => Err(fidl::Error::UnknownOrdinal {
3416                ordinal: tx_header.ordinal,
3417                protocol_name: <SessionMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3418            }),
3419        }
3420    }
3421}
3422
3423/// A Stream of incoming requests for fuchsia.storage.block/Session.
3424pub struct SessionRequestStream {
3425    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3426    is_terminated: bool,
3427}
3428
3429impl std::marker::Unpin for SessionRequestStream {}
3430
3431impl futures::stream::FusedStream for SessionRequestStream {
3432    fn is_terminated(&self) -> bool {
3433        self.is_terminated
3434    }
3435}
3436
3437impl fdomain_client::fidl::RequestStream for SessionRequestStream {
3438    type Protocol = SessionMarker;
3439    type ControlHandle = SessionControlHandle;
3440
3441    fn from_channel(channel: fdomain_client::Channel) -> Self {
3442        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3443    }
3444
3445    fn control_handle(&self) -> Self::ControlHandle {
3446        SessionControlHandle { inner: self.inner.clone() }
3447    }
3448
3449    fn into_inner(
3450        self,
3451    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3452    {
3453        (self.inner, self.is_terminated)
3454    }
3455
3456    fn from_inner(
3457        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3458        is_terminated: bool,
3459    ) -> Self {
3460        Self { inner, is_terminated }
3461    }
3462}
3463
3464impl futures::Stream for SessionRequestStream {
3465    type Item = Result<SessionRequest, fidl::Error>;
3466
3467    fn poll_next(
3468        mut self: std::pin::Pin<&mut Self>,
3469        cx: &mut std::task::Context<'_>,
3470    ) -> std::task::Poll<Option<Self::Item>> {
3471        let this = &mut *self;
3472        if this.inner.check_shutdown(cx) {
3473            this.is_terminated = true;
3474            return std::task::Poll::Ready(None);
3475        }
3476        if this.is_terminated {
3477            panic!("polled SessionRequestStream after completion");
3478        }
3479        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3480            |bytes, handles| {
3481                match this.inner.channel().read_etc(cx, bytes, handles) {
3482                    std::task::Poll::Ready(Ok(())) => {}
3483                    std::task::Poll::Pending => return std::task::Poll::Pending,
3484                    std::task::Poll::Ready(Err(None)) => {
3485                        this.is_terminated = true;
3486                        return std::task::Poll::Ready(None);
3487                    }
3488                    std::task::Poll::Ready(Err(Some(e))) => {
3489                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3490                            e.into(),
3491                        ))));
3492                    }
3493                }
3494
3495                // A message has been received from the channel
3496                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3497
3498                std::task::Poll::Ready(Some(match header.ordinal {
3499                    0x5ac5d459ad7f657e => {
3500                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3501                        let mut req = fidl::new_empty!(
3502                            fidl::encoding::EmptyPayload,
3503                            fdomain_client::fidl::FDomainResourceDialect
3504                        );
3505                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3506                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3507                        Ok(SessionRequest::Close {
3508                            responder: SessionCloseResponder {
3509                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3510                                tx_id: header.tx_id,
3511                            },
3512                        })
3513                    }
3514                    0x7a6c7610912aaa98 => {
3515                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3516                        let mut req = fidl::new_empty!(
3517                            fidl::encoding::EmptyPayload,
3518                            fdomain_client::fidl::FDomainResourceDialect
3519                        );
3520                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3521                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3522                        Ok(SessionRequest::GetFifo {
3523                            responder: SessionGetFifoResponder {
3524                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3525                                tx_id: header.tx_id,
3526                            },
3527                        })
3528                    }
3529                    0x677a0f6fd1a370b2 => {
3530                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3531                        let mut req = fidl::new_empty!(
3532                            SessionAttachVmoRequest,
3533                            fdomain_client::fidl::FDomainResourceDialect
3534                        );
3535                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<SessionAttachVmoRequest>(&header, _body_bytes, handles, &mut req)?;
3536                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3537                        Ok(SessionRequest::AttachVmo {
3538                            vmo: req.vmo,
3539
3540                            responder: SessionAttachVmoResponder {
3541                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3542                                tx_id: header.tx_id,
3543                            },
3544                        })
3545                    }
3546                    _ => Err(fidl::Error::UnknownOrdinal {
3547                        ordinal: header.ordinal,
3548                        protocol_name:
3549                            <SessionMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3550                    }),
3551                }))
3552            },
3553        )
3554    }
3555}
3556
3557/// Represents a session with a block device.
3558///
3559/// This protocol encodes the underlying object's lifetime in both directions; the underlying object
3560/// is alive iff both ends of the protocol are open. That is:
3561///
3562/// - Closing the client end causes the object to be destroyed.
3563/// - Observing a closure of the server end indicates the object no longer exists.
3564///
3565/// The object can be destroyed synchronously using [`fuchsia.unknown/Closeable.Close`].
3566#[derive(Debug)]
3567pub enum SessionRequest {
3568    /// Terminates the connection.
3569    ///
3570    /// After calling `Close`, the client must not send any other requests.
3571    ///
3572    /// Servers, after sending the status response, should close the connection
3573    /// regardless of status and without sending an epitaph.
3574    ///
3575    /// Closing the client end of the channel should be semantically equivalent
3576    /// to calling `Close` without knowing when the close has completed or its
3577    /// status.
3578    Close { responder: SessionCloseResponder },
3579    /// Returns a handle to the client end of the FIFO.
3580    GetFifo { responder: SessionGetFifoResponder },
3581    /// Attaches a VMO to the session. Resizable VMOs are not supported and will return
3582    /// `ZX_ERR_INVALID_ARGS`.
3583    ///
3584    /// Returns an identifier that can be used to refer to the VMO.
3585    AttachVmo { vmo: fdomain_client::Vmo, responder: SessionAttachVmoResponder },
3586}
3587
3588impl SessionRequest {
3589    #[allow(irrefutable_let_patterns)]
3590    pub fn into_close(self) -> Option<(SessionCloseResponder)> {
3591        if let SessionRequest::Close { responder } = self { Some((responder)) } else { None }
3592    }
3593
3594    #[allow(irrefutable_let_patterns)]
3595    pub fn into_get_fifo(self) -> Option<(SessionGetFifoResponder)> {
3596        if let SessionRequest::GetFifo { responder } = self { Some((responder)) } else { None }
3597    }
3598
3599    #[allow(irrefutable_let_patterns)]
3600    pub fn into_attach_vmo(self) -> Option<(fdomain_client::Vmo, SessionAttachVmoResponder)> {
3601        if let SessionRequest::AttachVmo { vmo, responder } = self {
3602            Some((vmo, responder))
3603        } else {
3604            None
3605        }
3606    }
3607
3608    /// Name of the method defined in FIDL
3609    pub fn method_name(&self) -> &'static str {
3610        match *self {
3611            SessionRequest::Close { .. } => "close",
3612            SessionRequest::GetFifo { .. } => "get_fifo",
3613            SessionRequest::AttachVmo { .. } => "attach_vmo",
3614        }
3615    }
3616}
3617
3618#[derive(Debug, Clone)]
3619pub struct SessionControlHandle {
3620    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3621}
3622
3623impl SessionControlHandle {
3624    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3625        self.inner.shutdown_with_epitaph(status.into())
3626    }
3627}
3628
3629impl fdomain_client::fidl::ControlHandle for SessionControlHandle {
3630    fn shutdown(&self) {
3631        self.inner.shutdown()
3632    }
3633
3634    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3635        self.inner.shutdown_with_epitaph(status)
3636    }
3637
3638    fn is_closed(&self) -> bool {
3639        self.inner.channel().is_closed()
3640    }
3641    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3642        self.inner.channel().on_closed()
3643    }
3644}
3645
3646impl SessionControlHandle {}
3647
3648#[must_use = "FIDL methods require a response to be sent"]
3649#[derive(Debug)]
3650pub struct SessionCloseResponder {
3651    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
3652    tx_id: u32,
3653}
3654
3655/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
3656/// if the responder is dropped without sending a response, so that the client
3657/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3658impl std::ops::Drop for SessionCloseResponder {
3659    fn drop(&mut self) {
3660        self.control_handle.shutdown();
3661        // Safety: drops once, never accessed again
3662        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3663    }
3664}
3665
3666impl fdomain_client::fidl::Responder for SessionCloseResponder {
3667    type ControlHandle = SessionControlHandle;
3668
3669    fn control_handle(&self) -> &SessionControlHandle {
3670        &self.control_handle
3671    }
3672
3673    fn drop_without_shutdown(mut self) {
3674        // Safety: drops once, never accessed again due to mem::forget
3675        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3676        // Prevent Drop from running (which would shut down the channel)
3677        std::mem::forget(self);
3678    }
3679}
3680
3681impl SessionCloseResponder {
3682    /// Sends a response to the FIDL transaction.
3683    ///
3684    /// Sets the channel to shutdown if an error occurs.
3685    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3686        let _result = self.send_raw(result);
3687        if _result.is_err() {
3688            self.control_handle.shutdown();
3689        }
3690        self.drop_without_shutdown();
3691        _result
3692    }
3693
3694    /// Similar to "send" but does not shutdown the channel if an error occurs.
3695    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3696        let _result = self.send_raw(result);
3697        self.drop_without_shutdown();
3698        _result
3699    }
3700
3701    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3702        self.control_handle
3703            .inner
3704            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3705                result,
3706                self.tx_id,
3707                0x5ac5d459ad7f657e,
3708                fidl::encoding::DynamicFlags::empty(),
3709            )
3710    }
3711}
3712
3713#[must_use = "FIDL methods require a response to be sent"]
3714#[derive(Debug)]
3715pub struct SessionGetFifoResponder {
3716    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
3717    tx_id: u32,
3718}
3719
3720/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
3721/// if the responder is dropped without sending a response, so that the client
3722/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3723impl std::ops::Drop for SessionGetFifoResponder {
3724    fn drop(&mut self) {
3725        self.control_handle.shutdown();
3726        // Safety: drops once, never accessed again
3727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3728    }
3729}
3730
3731impl fdomain_client::fidl::Responder for SessionGetFifoResponder {
3732    type ControlHandle = SessionControlHandle;
3733
3734    fn control_handle(&self) -> &SessionControlHandle {
3735        &self.control_handle
3736    }
3737
3738    fn drop_without_shutdown(mut self) {
3739        // Safety: drops once, never accessed again due to mem::forget
3740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3741        // Prevent Drop from running (which would shut down the channel)
3742        std::mem::forget(self);
3743    }
3744}
3745
3746impl SessionGetFifoResponder {
3747    /// Sends a response to the FIDL transaction.
3748    ///
3749    /// Sets the channel to shutdown if an error occurs.
3750    pub fn send(self, mut result: Result<fdomain_client::Fifo, i32>) -> Result<(), fidl::Error> {
3751        let _result = self.send_raw(result);
3752        if _result.is_err() {
3753            self.control_handle.shutdown();
3754        }
3755        self.drop_without_shutdown();
3756        _result
3757    }
3758
3759    /// Similar to "send" but does not shutdown the channel if an error occurs.
3760    pub fn send_no_shutdown_on_err(
3761        self,
3762        mut result: Result<fdomain_client::Fifo, i32>,
3763    ) -> Result<(), fidl::Error> {
3764        let _result = self.send_raw(result);
3765        self.drop_without_shutdown();
3766        _result
3767    }
3768
3769    fn send_raw(&self, mut result: Result<fdomain_client::Fifo, i32>) -> Result<(), fidl::Error> {
3770        self.control_handle.inner.send::<fidl::encoding::ResultType<SessionGetFifoResponse, i32>>(
3771            result.map(|fifo| (fifo,)),
3772            self.tx_id,
3773            0x7a6c7610912aaa98,
3774            fidl::encoding::DynamicFlags::empty(),
3775        )
3776    }
3777}
3778
3779#[must_use = "FIDL methods require a response to be sent"]
3780#[derive(Debug)]
3781pub struct SessionAttachVmoResponder {
3782    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
3783    tx_id: u32,
3784}
3785
3786/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
3787/// if the responder is dropped without sending a response, so that the client
3788/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3789impl std::ops::Drop for SessionAttachVmoResponder {
3790    fn drop(&mut self) {
3791        self.control_handle.shutdown();
3792        // Safety: drops once, never accessed again
3793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3794    }
3795}
3796
3797impl fdomain_client::fidl::Responder for SessionAttachVmoResponder {
3798    type ControlHandle = SessionControlHandle;
3799
3800    fn control_handle(&self) -> &SessionControlHandle {
3801        &self.control_handle
3802    }
3803
3804    fn drop_without_shutdown(mut self) {
3805        // Safety: drops once, never accessed again due to mem::forget
3806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3807        // Prevent Drop from running (which would shut down the channel)
3808        std::mem::forget(self);
3809    }
3810}
3811
3812impl SessionAttachVmoResponder {
3813    /// Sends a response to the FIDL transaction.
3814    ///
3815    /// Sets the channel to shutdown if an error occurs.
3816    pub fn send(self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
3817        let _result = self.send_raw(result);
3818        if _result.is_err() {
3819            self.control_handle.shutdown();
3820        }
3821        self.drop_without_shutdown();
3822        _result
3823    }
3824
3825    /// Similar to "send" but does not shutdown the channel if an error occurs.
3826    pub fn send_no_shutdown_on_err(
3827        self,
3828        mut result: Result<&VmoId, i32>,
3829    ) -> Result<(), fidl::Error> {
3830        let _result = self.send_raw(result);
3831        self.drop_without_shutdown();
3832        _result
3833    }
3834
3835    fn send_raw(&self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
3836        self.control_handle.inner.send::<fidl::encoding::ResultType<SessionAttachVmoResponse, i32>>(
3837            result.map(|vmoid| (vmoid,)),
3838            self.tx_id,
3839            0x677a0f6fd1a370b2,
3840            fidl::encoding::DynamicFlags::empty(),
3841        )
3842    }
3843}
3844
3845#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3846pub struct VolumeManagerMarker;
3847
3848impl fdomain_client::fidl::ProtocolMarker for VolumeManagerMarker {
3849    type Proxy = VolumeManagerProxy;
3850    type RequestStream = VolumeManagerRequestStream;
3851
3852    const DEBUG_NAME: &'static str = "(anonymous) VolumeManager";
3853}
3854pub type VolumeManagerSetPartitionNameResult = Result<(), i32>;
3855
3856pub trait VolumeManagerProxyInterface: Send + Sync {
3857    type AllocatePartitionResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3858    fn r#allocate_partition(
3859        &self,
3860        slice_count: u64,
3861        type_: &Guid,
3862        instance: &Guid,
3863        name: &str,
3864        flags: u32,
3865    ) -> Self::AllocatePartitionResponseFut;
3866    type GetInfoResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error>>
3867        + Send;
3868    fn r#get_info(&self) -> Self::GetInfoResponseFut;
3869    type ActivateResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3870    fn r#activate(&self, old_guid: &Guid, new_guid: &Guid) -> Self::ActivateResponseFut;
3871    type GetPartitionLimitResponseFut: std::future::Future<Output = Result<(i32, u64), fidl::Error>>
3872        + Send;
3873    fn r#get_partition_limit(&self, guid: &Guid) -> Self::GetPartitionLimitResponseFut;
3874    type SetPartitionLimitResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3875    fn r#set_partition_limit(
3876        &self,
3877        guid: &Guid,
3878        slice_count: u64,
3879    ) -> Self::SetPartitionLimitResponseFut;
3880    type SetPartitionNameResponseFut: std::future::Future<Output = Result<VolumeManagerSetPartitionNameResult, fidl::Error>>
3881        + Send;
3882    fn r#set_partition_name(&self, guid: &Guid, name: &str) -> Self::SetPartitionNameResponseFut;
3883}
3884
3885#[derive(Debug, Clone)]
3886pub struct VolumeManagerProxy {
3887    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3888}
3889
3890impl fdomain_client::fidl::Proxy for VolumeManagerProxy {
3891    type Protocol = VolumeManagerMarker;
3892
3893    fn from_channel(inner: fdomain_client::Channel) -> Self {
3894        Self::new(inner)
3895    }
3896
3897    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3898        self.client.into_channel().map_err(|client| Self { client })
3899    }
3900
3901    fn as_channel(&self) -> &fdomain_client::Channel {
3902        self.client.as_channel()
3903    }
3904}
3905
3906impl VolumeManagerProxy {
3907    /// Create a new Proxy for fuchsia.storage.block/VolumeManager.
3908    pub fn new(channel: fdomain_client::Channel) -> Self {
3909        let protocol_name =
3910            <VolumeManagerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3911        Self { client: fidl::client::Client::new(channel, protocol_name) }
3912    }
3913
3914    /// Get a Stream of events from the remote end of the protocol.
3915    ///
3916    /// # Panics
3917    ///
3918    /// Panics if the event stream was already taken.
3919    pub fn take_event_stream(&self) -> VolumeManagerEventStream {
3920        VolumeManagerEventStream { event_receiver: self.client.take_event_receiver() }
3921    }
3922
3923    /// Allocates a virtual partition with the requested features.
3924    ///
3925    /// `slice_count` is the number of slices initially allocated to the partition, at
3926    /// offset zero. The number of slices allocated to a new partition must be at least one.
3927    /// `type` and `value` indicate type and instance GUIDs for the partition, respectively.
3928    /// `name` indicates the name of the new partition.
3929    pub fn r#allocate_partition(
3930        &self,
3931        mut slice_count: u64,
3932        mut type_: &Guid,
3933        mut instance: &Guid,
3934        mut name: &str,
3935        mut flags: u32,
3936    ) -> fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect> {
3937        VolumeManagerProxyInterface::r#allocate_partition(
3938            self,
3939            slice_count,
3940            type_,
3941            instance,
3942            name,
3943            flags,
3944        )
3945    }
3946
3947    /// Gets the VolumeManagerInfo describing this instance of the `VolumeManager`.
3948    ///
3949    /// **NOTE**: GetInfo() is used to synchronize child partition device visibility with devfs.
3950    /// Implementations must only respond once all child partitions of `VolumeManager` have been
3951    /// added to devfs, to guarantee clients can safely enumerate them.
3952    ///
3953    /// See https://fxbug.dev/42077585 for more information.
3954    pub fn r#get_info(
3955        &self,
3956    ) -> fidl::client::QueryResponseFut<
3957        (i32, Option<Box<VolumeManagerInfo>>),
3958        fdomain_client::fidl::FDomainResourceDialect,
3959    > {
3960        VolumeManagerProxyInterface::r#get_info(self)
3961    }
3962
3963    /// Atomically marks a vpartition (by instance GUID) as inactive, while finding
3964    /// another partition (by instance GUID) and marking it as active.
3965    ///
3966    /// If the "old" partition does not exist, the GUID is ignored.
3967    /// If the "old" partition is the same as the "new" partition, the "old"
3968    /// GUID is ignored.
3969    /// If the "new" partition does not exist, `ZX_ERR_NOT_FOUND` is returned.
3970    ///
3971    /// This function does not destroy the "old" partition, it just marks it as
3972    /// inactive -- to reclaim that space, the "old" partition must be explicitly
3973    /// destroyed.  This destruction can also occur automatically when the FVM driver
3974    /// is rebound (i.e., on reboot).
3975    ///
3976    /// This function may be useful for A/B updates within the FVM,
3977    /// since it will allow activating updated partitions.
3978    pub fn r#activate(
3979        &self,
3980        mut old_guid: &Guid,
3981        mut new_guid: &Guid,
3982    ) -> fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect> {
3983        VolumeManagerProxyInterface::r#activate(self, old_guid, new_guid)
3984    }
3985
3986    /// Retrieves the allocation limit for the partition. A return value of 0 indicates that there
3987    /// is no limit and the partition can be extended as long as there is available space on the
3988    /// device.
3989    ///
3990    /// The partition may be larger than this limit if a smaller limit was applied after the
3991    /// partition had already grown to the current size.
3992    ///
3993    /// Currently the partition limit is not persisted across reboots but this may change in the
3994    /// future.
3995    pub fn r#get_partition_limit(
3996        &self,
3997        mut guid: &Guid,
3998    ) -> fidl::client::QueryResponseFut<(i32, u64), fdomain_client::fidl::FDomainResourceDialect>
3999    {
4000        VolumeManagerProxyInterface::r#get_partition_limit(self, guid)
4001    }
4002
4003    /// Sets the allocation limit for the partition. Partitions can not be extended beyond their
4004    /// allocation limit. The partition limit will never shrink partitions so if this value is
4005    /// less than the current partition size, it will keep the current size but prevent further
4006    /// growth.
4007    ///
4008    /// The allocation limits are on the VolumeManager API rather than on the partition because
4009    /// they represent a higher capability level. These limits are designed to put guards on
4010    /// users of the block device (and hence the Volume API).
4011    ///
4012    /// Currently the partition limit is not persisted across reboots but this may change in the
4013    /// future.
4014    pub fn r#set_partition_limit(
4015        &self,
4016        mut guid: &Guid,
4017        mut slice_count: u64,
4018    ) -> fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect> {
4019        VolumeManagerProxyInterface::r#set_partition_limit(self, guid, slice_count)
4020    }
4021
4022    /// Renames the specified partition. Any existing devices that include the name of the partition
4023    /// in their topological path might *not* reflect the name change until the next time that the
4024    /// device is instantiated.
4025    pub fn r#set_partition_name(
4026        &self,
4027        mut guid: &Guid,
4028        mut name: &str,
4029    ) -> fidl::client::QueryResponseFut<
4030        VolumeManagerSetPartitionNameResult,
4031        fdomain_client::fidl::FDomainResourceDialect,
4032    > {
4033        VolumeManagerProxyInterface::r#set_partition_name(self, guid, name)
4034    }
4035}
4036
4037impl VolumeManagerProxyInterface for VolumeManagerProxy {
4038    type AllocatePartitionResponseFut =
4039        fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect>;
4040    fn r#allocate_partition(
4041        &self,
4042        mut slice_count: u64,
4043        mut type_: &Guid,
4044        mut instance: &Guid,
4045        mut name: &str,
4046        mut flags: u32,
4047    ) -> Self::AllocatePartitionResponseFut {
4048        fn _decode(
4049            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4050        ) -> Result<i32, fidl::Error> {
4051            let _response = fidl::client::decode_transaction_body::<
4052                VolumeManagerAllocatePartitionResponse,
4053                fdomain_client::fidl::FDomainResourceDialect,
4054                0x5db528bfc287b696,
4055            >(_buf?)?;
4056            Ok(_response.status)
4057        }
4058        self.client.send_query_and_decode::<VolumeManagerAllocatePartitionRequest, i32>(
4059            (slice_count, type_, instance, name, flags),
4060            0x5db528bfc287b696,
4061            fidl::encoding::DynamicFlags::empty(),
4062            _decode,
4063        )
4064    }
4065
4066    type GetInfoResponseFut = fidl::client::QueryResponseFut<
4067        (i32, Option<Box<VolumeManagerInfo>>),
4068        fdomain_client::fidl::FDomainResourceDialect,
4069    >;
4070    fn r#get_info(&self) -> Self::GetInfoResponseFut {
4071        fn _decode(
4072            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4073        ) -> Result<(i32, Option<Box<VolumeManagerInfo>>), fidl::Error> {
4074            let _response = fidl::client::decode_transaction_body::<
4075                VolumeManagerGetInfoResponse,
4076                fdomain_client::fidl::FDomainResourceDialect,
4077                0x2611214dcca5b064,
4078            >(_buf?)?;
4079            Ok((_response.status, _response.info))
4080        }
4081        self.client.send_query_and_decode::<
4082            fidl::encoding::EmptyPayload,
4083            (i32, Option<Box<VolumeManagerInfo>>),
4084        >(
4085            (),
4086            0x2611214dcca5b064,
4087            fidl::encoding::DynamicFlags::empty(),
4088            _decode,
4089        )
4090    }
4091
4092    type ActivateResponseFut =
4093        fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect>;
4094    fn r#activate(&self, mut old_guid: &Guid, mut new_guid: &Guid) -> Self::ActivateResponseFut {
4095        fn _decode(
4096            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4097        ) -> Result<i32, fidl::Error> {
4098            let _response = fidl::client::decode_transaction_body::<
4099                VolumeManagerActivateResponse,
4100                fdomain_client::fidl::FDomainResourceDialect,
4101                0x182238d40c275be,
4102            >(_buf?)?;
4103            Ok(_response.status)
4104        }
4105        self.client.send_query_and_decode::<VolumeManagerActivateRequest, i32>(
4106            (old_guid, new_guid),
4107            0x182238d40c275be,
4108            fidl::encoding::DynamicFlags::empty(),
4109            _decode,
4110        )
4111    }
4112
4113    type GetPartitionLimitResponseFut =
4114        fidl::client::QueryResponseFut<(i32, u64), fdomain_client::fidl::FDomainResourceDialect>;
4115    fn r#get_partition_limit(&self, mut guid: &Guid) -> Self::GetPartitionLimitResponseFut {
4116        fn _decode(
4117            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4118        ) -> Result<(i32, u64), fidl::Error> {
4119            let _response = fidl::client::decode_transaction_body::<
4120                VolumeManagerGetPartitionLimitResponse,
4121                fdomain_client::fidl::FDomainResourceDialect,
4122                0x5bc9d21ea8bd52db,
4123            >(_buf?)?;
4124            Ok((_response.status, _response.slice_count))
4125        }
4126        self.client.send_query_and_decode::<VolumeManagerGetPartitionLimitRequest, (i32, u64)>(
4127            (guid,),
4128            0x5bc9d21ea8bd52db,
4129            fidl::encoding::DynamicFlags::empty(),
4130            _decode,
4131        )
4132    }
4133
4134    type SetPartitionLimitResponseFut =
4135        fidl::client::QueryResponseFut<i32, fdomain_client::fidl::FDomainResourceDialect>;
4136    fn r#set_partition_limit(
4137        &self,
4138        mut guid: &Guid,
4139        mut slice_count: u64,
4140    ) -> Self::SetPartitionLimitResponseFut {
4141        fn _decode(
4142            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4143        ) -> Result<i32, fidl::Error> {
4144            let _response = fidl::client::decode_transaction_body::<
4145                VolumeManagerSetPartitionLimitResponse,
4146                fdomain_client::fidl::FDomainResourceDialect,
4147                0x3a4903076534c093,
4148            >(_buf?)?;
4149            Ok(_response.status)
4150        }
4151        self.client.send_query_and_decode::<VolumeManagerSetPartitionLimitRequest, i32>(
4152            (guid, slice_count),
4153            0x3a4903076534c093,
4154            fidl::encoding::DynamicFlags::empty(),
4155            _decode,
4156        )
4157    }
4158
4159    type SetPartitionNameResponseFut = fidl::client::QueryResponseFut<
4160        VolumeManagerSetPartitionNameResult,
4161        fdomain_client::fidl::FDomainResourceDialect,
4162    >;
4163    fn r#set_partition_name(
4164        &self,
4165        mut guid: &Guid,
4166        mut name: &str,
4167    ) -> Self::SetPartitionNameResponseFut {
4168        fn _decode(
4169            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4170        ) -> Result<VolumeManagerSetPartitionNameResult, fidl::Error> {
4171            let _response = fidl::client::decode_transaction_body::<
4172                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4173                fdomain_client::fidl::FDomainResourceDialect,
4174                0x26afb07b9d70ff1a,
4175            >(_buf?)?;
4176            Ok(_response.map(|x| x))
4177        }
4178        self.client.send_query_and_decode::<
4179            VolumeManagerSetPartitionNameRequest,
4180            VolumeManagerSetPartitionNameResult,
4181        >(
4182            (guid, name,),
4183            0x26afb07b9d70ff1a,
4184            fidl::encoding::DynamicFlags::empty(),
4185            _decode,
4186        )
4187    }
4188}
4189
4190pub struct VolumeManagerEventStream {
4191    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4192}
4193
4194impl std::marker::Unpin for VolumeManagerEventStream {}
4195
4196impl futures::stream::FusedStream for VolumeManagerEventStream {
4197    fn is_terminated(&self) -> bool {
4198        self.event_receiver.is_terminated()
4199    }
4200}
4201
4202impl futures::Stream for VolumeManagerEventStream {
4203    type Item = Result<VolumeManagerEvent, fidl::Error>;
4204
4205    fn poll_next(
4206        mut self: std::pin::Pin<&mut Self>,
4207        cx: &mut std::task::Context<'_>,
4208    ) -> std::task::Poll<Option<Self::Item>> {
4209        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4210            &mut self.event_receiver,
4211            cx
4212        )?) {
4213            Some(buf) => std::task::Poll::Ready(Some(VolumeManagerEvent::decode(buf))),
4214            None => std::task::Poll::Ready(None),
4215        }
4216    }
4217}
4218
4219#[derive(Debug)]
4220pub enum VolumeManagerEvent {}
4221
4222impl VolumeManagerEvent {
4223    /// Decodes a message buffer as a [`VolumeManagerEvent`].
4224    fn decode(
4225        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4226    ) -> Result<VolumeManagerEvent, fidl::Error> {
4227        let (bytes, _handles) = buf.split_mut();
4228        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4229        debug_assert_eq!(tx_header.tx_id, 0);
4230        match tx_header.ordinal {
4231            _ => Err(fidl::Error::UnknownOrdinal {
4232                ordinal: tx_header.ordinal,
4233                protocol_name:
4234                    <VolumeManagerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4235            }),
4236        }
4237    }
4238}
4239
4240/// A Stream of incoming requests for fuchsia.storage.block/VolumeManager.
4241pub struct VolumeManagerRequestStream {
4242    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4243    is_terminated: bool,
4244}
4245
4246impl std::marker::Unpin for VolumeManagerRequestStream {}
4247
4248impl futures::stream::FusedStream for VolumeManagerRequestStream {
4249    fn is_terminated(&self) -> bool {
4250        self.is_terminated
4251    }
4252}
4253
4254impl fdomain_client::fidl::RequestStream for VolumeManagerRequestStream {
4255    type Protocol = VolumeManagerMarker;
4256    type ControlHandle = VolumeManagerControlHandle;
4257
4258    fn from_channel(channel: fdomain_client::Channel) -> Self {
4259        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4260    }
4261
4262    fn control_handle(&self) -> Self::ControlHandle {
4263        VolumeManagerControlHandle { inner: self.inner.clone() }
4264    }
4265
4266    fn into_inner(
4267        self,
4268    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4269    {
4270        (self.inner, self.is_terminated)
4271    }
4272
4273    fn from_inner(
4274        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4275        is_terminated: bool,
4276    ) -> Self {
4277        Self { inner, is_terminated }
4278    }
4279}
4280
4281impl futures::Stream for VolumeManagerRequestStream {
4282    type Item = Result<VolumeManagerRequest, fidl::Error>;
4283
4284    fn poll_next(
4285        mut self: std::pin::Pin<&mut Self>,
4286        cx: &mut std::task::Context<'_>,
4287    ) -> std::task::Poll<Option<Self::Item>> {
4288        let this = &mut *self;
4289        if this.inner.check_shutdown(cx) {
4290            this.is_terminated = true;
4291            return std::task::Poll::Ready(None);
4292        }
4293        if this.is_terminated {
4294            panic!("polled VolumeManagerRequestStream after completion");
4295        }
4296        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
4297            |bytes, handles| {
4298                match this.inner.channel().read_etc(cx, bytes, handles) {
4299                    std::task::Poll::Ready(Ok(())) => {}
4300                    std::task::Poll::Pending => return std::task::Poll::Pending,
4301                    std::task::Poll::Ready(Err(None)) => {
4302                        this.is_terminated = true;
4303                        return std::task::Poll::Ready(None);
4304                    }
4305                    std::task::Poll::Ready(Err(Some(e))) => {
4306                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4307                            e.into(),
4308                        ))));
4309                    }
4310                }
4311
4312                // A message has been received from the channel
4313                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4314
4315                std::task::Poll::Ready(Some(match header.ordinal {
4316                0x5db528bfc287b696 => {
4317                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4318                    let mut req = fidl::new_empty!(VolumeManagerAllocatePartitionRequest, fdomain_client::fidl::FDomainResourceDialect);
4319                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeManagerAllocatePartitionRequest>(&header, _body_bytes, handles, &mut req)?;
4320                    let control_handle = VolumeManagerControlHandle {
4321                        inner: this.inner.clone(),
4322                    };
4323                    Ok(VolumeManagerRequest::AllocatePartition {slice_count: req.slice_count,
4324type_: req.type_,
4325instance: req.instance,
4326name: req.name,
4327flags: req.flags,
4328
4329                        responder: VolumeManagerAllocatePartitionResponder {
4330                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4331                            tx_id: header.tx_id,
4332                        },
4333                    })
4334                }
4335                0x2611214dcca5b064 => {
4336                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4337                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
4338                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4339                    let control_handle = VolumeManagerControlHandle {
4340                        inner: this.inner.clone(),
4341                    };
4342                    Ok(VolumeManagerRequest::GetInfo {
4343                        responder: VolumeManagerGetInfoResponder {
4344                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4345                            tx_id: header.tx_id,
4346                        },
4347                    })
4348                }
4349                0x182238d40c275be => {
4350                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4351                    let mut req = fidl::new_empty!(VolumeManagerActivateRequest, fdomain_client::fidl::FDomainResourceDialect);
4352                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
4353                    let control_handle = VolumeManagerControlHandle {
4354                        inner: this.inner.clone(),
4355                    };
4356                    Ok(VolumeManagerRequest::Activate {old_guid: req.old_guid,
4357new_guid: req.new_guid,
4358
4359                        responder: VolumeManagerActivateResponder {
4360                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4361                            tx_id: header.tx_id,
4362                        },
4363                    })
4364                }
4365                0x5bc9d21ea8bd52db => {
4366                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4367                    let mut req = fidl::new_empty!(VolumeManagerGetPartitionLimitRequest, fdomain_client::fidl::FDomainResourceDialect);
4368                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeManagerGetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
4369                    let control_handle = VolumeManagerControlHandle {
4370                        inner: this.inner.clone(),
4371                    };
4372                    Ok(VolumeManagerRequest::GetPartitionLimit {guid: req.guid,
4373
4374                        responder: VolumeManagerGetPartitionLimitResponder {
4375                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4376                            tx_id: header.tx_id,
4377                        },
4378                    })
4379                }
4380                0x3a4903076534c093 => {
4381                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4382                    let mut req = fidl::new_empty!(VolumeManagerSetPartitionLimitRequest, fdomain_client::fidl::FDomainResourceDialect);
4383                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeManagerSetPartitionLimitRequest>(&header, _body_bytes, handles, &mut req)?;
4384                    let control_handle = VolumeManagerControlHandle {
4385                        inner: this.inner.clone(),
4386                    };
4387                    Ok(VolumeManagerRequest::SetPartitionLimit {guid: req.guid,
4388slice_count: req.slice_count,
4389
4390                        responder: VolumeManagerSetPartitionLimitResponder {
4391                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4392                            tx_id: header.tx_id,
4393                        },
4394                    })
4395                }
4396                0x26afb07b9d70ff1a => {
4397                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4398                    let mut req = fidl::new_empty!(VolumeManagerSetPartitionNameRequest, fdomain_client::fidl::FDomainResourceDialect);
4399                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<VolumeManagerSetPartitionNameRequest>(&header, _body_bytes, handles, &mut req)?;
4400                    let control_handle = VolumeManagerControlHandle {
4401                        inner: this.inner.clone(),
4402                    };
4403                    Ok(VolumeManagerRequest::SetPartitionName {guid: req.guid,
4404name: req.name,
4405
4406                        responder: VolumeManagerSetPartitionNameResponder {
4407                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4408                            tx_id: header.tx_id,
4409                        },
4410                    })
4411                }
4412                _ => Err(fidl::Error::UnknownOrdinal {
4413                    ordinal: header.ordinal,
4414                    protocol_name: <VolumeManagerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4415                }),
4416            }))
4417            },
4418        )
4419    }
4420}
4421
4422/// VolumeManager controls a collection of Volumes.
4423#[derive(Debug)]
4424pub enum VolumeManagerRequest {
4425    /// Allocates a virtual partition with the requested features.
4426    ///
4427    /// `slice_count` is the number of slices initially allocated to the partition, at
4428    /// offset zero. The number of slices allocated to a new partition must be at least one.
4429    /// `type` and `value` indicate type and instance GUIDs for the partition, respectively.
4430    /// `name` indicates the name of the new partition.
4431    AllocatePartition {
4432        slice_count: u64,
4433        type_: Guid,
4434        instance: Guid,
4435        name: String,
4436        flags: u32,
4437        responder: VolumeManagerAllocatePartitionResponder,
4438    },
4439    /// Gets the VolumeManagerInfo describing this instance of the `VolumeManager`.
4440    ///
4441    /// **NOTE**: GetInfo() is used to synchronize child partition device visibility with devfs.
4442    /// Implementations must only respond once all child partitions of `VolumeManager` have been
4443    /// added to devfs, to guarantee clients can safely enumerate them.
4444    ///
4445    /// See https://fxbug.dev/42077585 for more information.
4446    GetInfo { responder: VolumeManagerGetInfoResponder },
4447    /// Atomically marks a vpartition (by instance GUID) as inactive, while finding
4448    /// another partition (by instance GUID) and marking it as active.
4449    ///
4450    /// If the "old" partition does not exist, the GUID is ignored.
4451    /// If the "old" partition is the same as the "new" partition, the "old"
4452    /// GUID is ignored.
4453    /// If the "new" partition does not exist, `ZX_ERR_NOT_FOUND` is returned.
4454    ///
4455    /// This function does not destroy the "old" partition, it just marks it as
4456    /// inactive -- to reclaim that space, the "old" partition must be explicitly
4457    /// destroyed.  This destruction can also occur automatically when the FVM driver
4458    /// is rebound (i.e., on reboot).
4459    ///
4460    /// This function may be useful for A/B updates within the FVM,
4461    /// since it will allow activating updated partitions.
4462    Activate { old_guid: Guid, new_guid: Guid, responder: VolumeManagerActivateResponder },
4463    /// Retrieves the allocation limit for the partition. A return value of 0 indicates that there
4464    /// is no limit and the partition can be extended as long as there is available space on the
4465    /// device.
4466    ///
4467    /// The partition may be larger than this limit if a smaller limit was applied after the
4468    /// partition had already grown to the current size.
4469    ///
4470    /// Currently the partition limit is not persisted across reboots but this may change in the
4471    /// future.
4472    GetPartitionLimit { guid: Guid, responder: VolumeManagerGetPartitionLimitResponder },
4473    /// Sets the allocation limit for the partition. Partitions can not be extended beyond their
4474    /// allocation limit. The partition limit will never shrink partitions so if this value is
4475    /// less than the current partition size, it will keep the current size but prevent further
4476    /// growth.
4477    ///
4478    /// The allocation limits are on the VolumeManager API rather than on the partition because
4479    /// they represent a higher capability level. These limits are designed to put guards on
4480    /// users of the block device (and hence the Volume API).
4481    ///
4482    /// Currently the partition limit is not persisted across reboots but this may change in the
4483    /// future.
4484    SetPartitionLimit {
4485        guid: Guid,
4486        slice_count: u64,
4487        responder: VolumeManagerSetPartitionLimitResponder,
4488    },
4489    /// Renames the specified partition. Any existing devices that include the name of the partition
4490    /// in their topological path might *not* reflect the name change until the next time that the
4491    /// device is instantiated.
4492    SetPartitionName { guid: Guid, name: String, responder: VolumeManagerSetPartitionNameResponder },
4493}
4494
4495impl VolumeManagerRequest {
4496    #[allow(irrefutable_let_patterns)]
4497    pub fn into_allocate_partition(
4498        self,
4499    ) -> Option<(u64, Guid, Guid, String, u32, VolumeManagerAllocatePartitionResponder)> {
4500        if let VolumeManagerRequest::AllocatePartition {
4501            slice_count,
4502            type_,
4503            instance,
4504            name,
4505            flags,
4506            responder,
4507        } = self
4508        {
4509            Some((slice_count, type_, instance, name, flags, responder))
4510        } else {
4511            None
4512        }
4513    }
4514
4515    #[allow(irrefutable_let_patterns)]
4516    pub fn into_get_info(self) -> Option<(VolumeManagerGetInfoResponder)> {
4517        if let VolumeManagerRequest::GetInfo { responder } = self {
4518            Some((responder))
4519        } else {
4520            None
4521        }
4522    }
4523
4524    #[allow(irrefutable_let_patterns)]
4525    pub fn into_activate(self) -> Option<(Guid, Guid, VolumeManagerActivateResponder)> {
4526        if let VolumeManagerRequest::Activate { old_guid, new_guid, responder } = self {
4527            Some((old_guid, new_guid, responder))
4528        } else {
4529            None
4530        }
4531    }
4532
4533    #[allow(irrefutable_let_patterns)]
4534    pub fn into_get_partition_limit(
4535        self,
4536    ) -> Option<(Guid, VolumeManagerGetPartitionLimitResponder)> {
4537        if let VolumeManagerRequest::GetPartitionLimit { guid, responder } = self {
4538            Some((guid, responder))
4539        } else {
4540            None
4541        }
4542    }
4543
4544    #[allow(irrefutable_let_patterns)]
4545    pub fn into_set_partition_limit(
4546        self,
4547    ) -> Option<(Guid, u64, VolumeManagerSetPartitionLimitResponder)> {
4548        if let VolumeManagerRequest::SetPartitionLimit { guid, slice_count, responder } = self {
4549            Some((guid, slice_count, responder))
4550        } else {
4551            None
4552        }
4553    }
4554
4555    #[allow(irrefutable_let_patterns)]
4556    pub fn into_set_partition_name(
4557        self,
4558    ) -> Option<(Guid, String, VolumeManagerSetPartitionNameResponder)> {
4559        if let VolumeManagerRequest::SetPartitionName { guid, name, responder } = self {
4560            Some((guid, name, responder))
4561        } else {
4562            None
4563        }
4564    }
4565
4566    /// Name of the method defined in FIDL
4567    pub fn method_name(&self) -> &'static str {
4568        match *self {
4569            VolumeManagerRequest::AllocatePartition { .. } => "allocate_partition",
4570            VolumeManagerRequest::GetInfo { .. } => "get_info",
4571            VolumeManagerRequest::Activate { .. } => "activate",
4572            VolumeManagerRequest::GetPartitionLimit { .. } => "get_partition_limit",
4573            VolumeManagerRequest::SetPartitionLimit { .. } => "set_partition_limit",
4574            VolumeManagerRequest::SetPartitionName { .. } => "set_partition_name",
4575        }
4576    }
4577}
4578
4579#[derive(Debug, Clone)]
4580pub struct VolumeManagerControlHandle {
4581    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4582}
4583
4584impl VolumeManagerControlHandle {
4585    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4586        self.inner.shutdown_with_epitaph(status.into())
4587    }
4588}
4589
4590impl fdomain_client::fidl::ControlHandle for VolumeManagerControlHandle {
4591    fn shutdown(&self) {
4592        self.inner.shutdown()
4593    }
4594
4595    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4596        self.inner.shutdown_with_epitaph(status)
4597    }
4598
4599    fn is_closed(&self) -> bool {
4600        self.inner.channel().is_closed()
4601    }
4602    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4603        self.inner.channel().on_closed()
4604    }
4605}
4606
4607impl VolumeManagerControlHandle {}
4608
4609#[must_use = "FIDL methods require a response to be sent"]
4610#[derive(Debug)]
4611pub struct VolumeManagerAllocatePartitionResponder {
4612    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4613    tx_id: u32,
4614}
4615
4616/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
4617/// if the responder is dropped without sending a response, so that the client
4618/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4619impl std::ops::Drop for VolumeManagerAllocatePartitionResponder {
4620    fn drop(&mut self) {
4621        self.control_handle.shutdown();
4622        // Safety: drops once, never accessed again
4623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4624    }
4625}
4626
4627impl fdomain_client::fidl::Responder for VolumeManagerAllocatePartitionResponder {
4628    type ControlHandle = VolumeManagerControlHandle;
4629
4630    fn control_handle(&self) -> &VolumeManagerControlHandle {
4631        &self.control_handle
4632    }
4633
4634    fn drop_without_shutdown(mut self) {
4635        // Safety: drops once, never accessed again due to mem::forget
4636        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4637        // Prevent Drop from running (which would shut down the channel)
4638        std::mem::forget(self);
4639    }
4640}
4641
4642impl VolumeManagerAllocatePartitionResponder {
4643    /// Sends a response to the FIDL transaction.
4644    ///
4645    /// Sets the channel to shutdown if an error occurs.
4646    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4647        let _result = self.send_raw(status);
4648        if _result.is_err() {
4649            self.control_handle.shutdown();
4650        }
4651        self.drop_without_shutdown();
4652        _result
4653    }
4654
4655    /// Similar to "send" but does not shutdown the channel if an error occurs.
4656    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4657        let _result = self.send_raw(status);
4658        self.drop_without_shutdown();
4659        _result
4660    }
4661
4662    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4663        self.control_handle.inner.send::<VolumeManagerAllocatePartitionResponse>(
4664            (status,),
4665            self.tx_id,
4666            0x5db528bfc287b696,
4667            fidl::encoding::DynamicFlags::empty(),
4668        )
4669    }
4670}
4671
4672#[must_use = "FIDL methods require a response to be sent"]
4673#[derive(Debug)]
4674pub struct VolumeManagerGetInfoResponder {
4675    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4676    tx_id: u32,
4677}
4678
4679/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
4680/// if the responder is dropped without sending a response, so that the client
4681/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4682impl std::ops::Drop for VolumeManagerGetInfoResponder {
4683    fn drop(&mut self) {
4684        self.control_handle.shutdown();
4685        // Safety: drops once, never accessed again
4686        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4687    }
4688}
4689
4690impl fdomain_client::fidl::Responder for VolumeManagerGetInfoResponder {
4691    type ControlHandle = VolumeManagerControlHandle;
4692
4693    fn control_handle(&self) -> &VolumeManagerControlHandle {
4694        &self.control_handle
4695    }
4696
4697    fn drop_without_shutdown(mut self) {
4698        // Safety: drops once, never accessed again due to mem::forget
4699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4700        // Prevent Drop from running (which would shut down the channel)
4701        std::mem::forget(self);
4702    }
4703}
4704
4705impl VolumeManagerGetInfoResponder {
4706    /// Sends a response to the FIDL transaction.
4707    ///
4708    /// Sets the channel to shutdown if an error occurs.
4709    pub fn send(
4710        self,
4711        mut status: i32,
4712        mut info: Option<&VolumeManagerInfo>,
4713    ) -> Result<(), fidl::Error> {
4714        let _result = self.send_raw(status, info);
4715        if _result.is_err() {
4716            self.control_handle.shutdown();
4717        }
4718        self.drop_without_shutdown();
4719        _result
4720    }
4721
4722    /// Similar to "send" but does not shutdown the channel if an error occurs.
4723    pub fn send_no_shutdown_on_err(
4724        self,
4725        mut status: i32,
4726        mut info: Option<&VolumeManagerInfo>,
4727    ) -> Result<(), fidl::Error> {
4728        let _result = self.send_raw(status, info);
4729        self.drop_without_shutdown();
4730        _result
4731    }
4732
4733    fn send_raw(
4734        &self,
4735        mut status: i32,
4736        mut info: Option<&VolumeManagerInfo>,
4737    ) -> Result<(), fidl::Error> {
4738        self.control_handle.inner.send::<VolumeManagerGetInfoResponse>(
4739            (status, info),
4740            self.tx_id,
4741            0x2611214dcca5b064,
4742            fidl::encoding::DynamicFlags::empty(),
4743        )
4744    }
4745}
4746
4747#[must_use = "FIDL methods require a response to be sent"]
4748#[derive(Debug)]
4749pub struct VolumeManagerActivateResponder {
4750    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4751    tx_id: u32,
4752}
4753
4754/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
4755/// if the responder is dropped without sending a response, so that the client
4756/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4757impl std::ops::Drop for VolumeManagerActivateResponder {
4758    fn drop(&mut self) {
4759        self.control_handle.shutdown();
4760        // Safety: drops once, never accessed again
4761        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4762    }
4763}
4764
4765impl fdomain_client::fidl::Responder for VolumeManagerActivateResponder {
4766    type ControlHandle = VolumeManagerControlHandle;
4767
4768    fn control_handle(&self) -> &VolumeManagerControlHandle {
4769        &self.control_handle
4770    }
4771
4772    fn drop_without_shutdown(mut self) {
4773        // Safety: drops once, never accessed again due to mem::forget
4774        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4775        // Prevent Drop from running (which would shut down the channel)
4776        std::mem::forget(self);
4777    }
4778}
4779
4780impl VolumeManagerActivateResponder {
4781    /// Sends a response to the FIDL transaction.
4782    ///
4783    /// Sets the channel to shutdown if an error occurs.
4784    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4785        let _result = self.send_raw(status);
4786        if _result.is_err() {
4787            self.control_handle.shutdown();
4788        }
4789        self.drop_without_shutdown();
4790        _result
4791    }
4792
4793    /// Similar to "send" but does not shutdown the channel if an error occurs.
4794    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4795        let _result = self.send_raw(status);
4796        self.drop_without_shutdown();
4797        _result
4798    }
4799
4800    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4801        self.control_handle.inner.send::<VolumeManagerActivateResponse>(
4802            (status,),
4803            self.tx_id,
4804            0x182238d40c275be,
4805            fidl::encoding::DynamicFlags::empty(),
4806        )
4807    }
4808}
4809
4810#[must_use = "FIDL methods require a response to be sent"]
4811#[derive(Debug)]
4812pub struct VolumeManagerGetPartitionLimitResponder {
4813    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4814    tx_id: u32,
4815}
4816
4817/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
4818/// if the responder is dropped without sending a response, so that the client
4819/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4820impl std::ops::Drop for VolumeManagerGetPartitionLimitResponder {
4821    fn drop(&mut self) {
4822        self.control_handle.shutdown();
4823        // Safety: drops once, never accessed again
4824        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4825    }
4826}
4827
4828impl fdomain_client::fidl::Responder for VolumeManagerGetPartitionLimitResponder {
4829    type ControlHandle = VolumeManagerControlHandle;
4830
4831    fn control_handle(&self) -> &VolumeManagerControlHandle {
4832        &self.control_handle
4833    }
4834
4835    fn drop_without_shutdown(mut self) {
4836        // Safety: drops once, never accessed again due to mem::forget
4837        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4838        // Prevent Drop from running (which would shut down the channel)
4839        std::mem::forget(self);
4840    }
4841}
4842
4843impl VolumeManagerGetPartitionLimitResponder {
4844    /// Sends a response to the FIDL transaction.
4845    ///
4846    /// Sets the channel to shutdown if an error occurs.
4847    pub fn send(self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
4848        let _result = self.send_raw(status, slice_count);
4849        if _result.is_err() {
4850            self.control_handle.shutdown();
4851        }
4852        self.drop_without_shutdown();
4853        _result
4854    }
4855
4856    /// Similar to "send" but does not shutdown the channel if an error occurs.
4857    pub fn send_no_shutdown_on_err(
4858        self,
4859        mut status: i32,
4860        mut slice_count: u64,
4861    ) -> Result<(), fidl::Error> {
4862        let _result = self.send_raw(status, slice_count);
4863        self.drop_without_shutdown();
4864        _result
4865    }
4866
4867    fn send_raw(&self, mut status: i32, mut slice_count: u64) -> Result<(), fidl::Error> {
4868        self.control_handle.inner.send::<VolumeManagerGetPartitionLimitResponse>(
4869            (status, slice_count),
4870            self.tx_id,
4871            0x5bc9d21ea8bd52db,
4872            fidl::encoding::DynamicFlags::empty(),
4873        )
4874    }
4875}
4876
4877#[must_use = "FIDL methods require a response to be sent"]
4878#[derive(Debug)]
4879pub struct VolumeManagerSetPartitionLimitResponder {
4880    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4881    tx_id: u32,
4882}
4883
4884/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
4885/// if the responder is dropped without sending a response, so that the client
4886/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4887impl std::ops::Drop for VolumeManagerSetPartitionLimitResponder {
4888    fn drop(&mut self) {
4889        self.control_handle.shutdown();
4890        // Safety: drops once, never accessed again
4891        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4892    }
4893}
4894
4895impl fdomain_client::fidl::Responder for VolumeManagerSetPartitionLimitResponder {
4896    type ControlHandle = VolumeManagerControlHandle;
4897
4898    fn control_handle(&self) -> &VolumeManagerControlHandle {
4899        &self.control_handle
4900    }
4901
4902    fn drop_without_shutdown(mut self) {
4903        // Safety: drops once, never accessed again due to mem::forget
4904        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4905        // Prevent Drop from running (which would shut down the channel)
4906        std::mem::forget(self);
4907    }
4908}
4909
4910impl VolumeManagerSetPartitionLimitResponder {
4911    /// Sends a response to the FIDL transaction.
4912    ///
4913    /// Sets the channel to shutdown if an error occurs.
4914    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
4915        let _result = self.send_raw(status);
4916        if _result.is_err() {
4917            self.control_handle.shutdown();
4918        }
4919        self.drop_without_shutdown();
4920        _result
4921    }
4922
4923    /// Similar to "send" but does not shutdown the channel if an error occurs.
4924    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
4925        let _result = self.send_raw(status);
4926        self.drop_without_shutdown();
4927        _result
4928    }
4929
4930    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
4931        self.control_handle.inner.send::<VolumeManagerSetPartitionLimitResponse>(
4932            (status,),
4933            self.tx_id,
4934            0x3a4903076534c093,
4935            fidl::encoding::DynamicFlags::empty(),
4936        )
4937    }
4938}
4939
4940#[must_use = "FIDL methods require a response to be sent"]
4941#[derive(Debug)]
4942pub struct VolumeManagerSetPartitionNameResponder {
4943    control_handle: std::mem::ManuallyDrop<VolumeManagerControlHandle>,
4944    tx_id: u32,
4945}
4946
4947/// Set the the channel to be shutdown (see [`VolumeManagerControlHandle::shutdown`])
4948/// if the responder is dropped without sending a response, so that the client
4949/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4950impl std::ops::Drop for VolumeManagerSetPartitionNameResponder {
4951    fn drop(&mut self) {
4952        self.control_handle.shutdown();
4953        // Safety: drops once, never accessed again
4954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4955    }
4956}
4957
4958impl fdomain_client::fidl::Responder for VolumeManagerSetPartitionNameResponder {
4959    type ControlHandle = VolumeManagerControlHandle;
4960
4961    fn control_handle(&self) -> &VolumeManagerControlHandle {
4962        &self.control_handle
4963    }
4964
4965    fn drop_without_shutdown(mut self) {
4966        // Safety: drops once, never accessed again due to mem::forget
4967        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4968        // Prevent Drop from running (which would shut down the channel)
4969        std::mem::forget(self);
4970    }
4971}
4972
4973impl VolumeManagerSetPartitionNameResponder {
4974    /// Sends a response to the FIDL transaction.
4975    ///
4976    /// Sets the channel to shutdown if an error occurs.
4977    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4978        let _result = self.send_raw(result);
4979        if _result.is_err() {
4980            self.control_handle.shutdown();
4981        }
4982        self.drop_without_shutdown();
4983        _result
4984    }
4985
4986    /// Similar to "send" but does not shutdown the channel if an error occurs.
4987    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4988        let _result = self.send_raw(result);
4989        self.drop_without_shutdown();
4990        _result
4991    }
4992
4993    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4994        self.control_handle
4995            .inner
4996            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4997                result,
4998                self.tx_id,
4999                0x26afb07b9d70ff1a,
5000                fidl::encoding::DynamicFlags::empty(),
5001            )
5002    }
5003}
5004
5005mod internal {
5006    use super::*;
5007
5008    impl fidl::encoding::ResourceTypeMarker for BlockConnectMapperRequest {
5009        type Borrowed<'a> = &'a mut Self;
5010        fn take_or_borrow<'a>(
5011            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5012        ) -> Self::Borrowed<'a> {
5013            value
5014        }
5015    }
5016
5017    unsafe impl fidl::encoding::TypeMarker for BlockConnectMapperRequest {
5018        type Owned = Self;
5019
5020        #[inline(always)]
5021        fn inline_align(_context: fidl::encoding::Context) -> usize {
5022            4
5023        }
5024
5025        #[inline(always)]
5026        fn inline_size(_context: fidl::encoding::Context) -> usize {
5027            4
5028        }
5029    }
5030
5031    unsafe impl
5032        fidl::encoding::Encode<
5033            BlockConnectMapperRequest,
5034            fdomain_client::fidl::FDomainResourceDialect,
5035        > for &mut BlockConnectMapperRequest
5036    {
5037        #[inline]
5038        unsafe fn encode(
5039            self,
5040            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5041            offset: usize,
5042            _depth: fidl::encoding::Depth,
5043        ) -> fidl::Result<()> {
5044            encoder.debug_check_bounds::<BlockConnectMapperRequest>(offset);
5045            // Delegate to tuple encoding.
5046            fidl::encoding::Encode::<BlockConnectMapperRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
5047                (
5048                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5049                ),
5050                encoder, offset, _depth
5051            )
5052        }
5053    }
5054    unsafe impl<
5055        T0: fidl::encoding::Encode<
5056                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperMarker>>,
5057                fdomain_client::fidl::FDomainResourceDialect,
5058            >,
5059    >
5060        fidl::encoding::Encode<
5061            BlockConnectMapperRequest,
5062            fdomain_client::fidl::FDomainResourceDialect,
5063        > for (T0,)
5064    {
5065        #[inline]
5066        unsafe fn encode(
5067            self,
5068            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5069            offset: usize,
5070            depth: fidl::encoding::Depth,
5071        ) -> fidl::Result<()> {
5072            encoder.debug_check_bounds::<BlockConnectMapperRequest>(offset);
5073            // Zero out padding regions. There's no need to apply masks
5074            // because the unmasked parts will be overwritten by fields.
5075            // Write the fields.
5076            self.0.encode(encoder, offset + 0, depth)?;
5077            Ok(())
5078        }
5079    }
5080
5081    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5082        for BlockConnectMapperRequest
5083    {
5084        #[inline(always)]
5085        fn new_empty() -> Self {
5086            Self {
5087                server_end: fidl::new_empty!(
5088                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperMarker>>,
5089                    fdomain_client::fidl::FDomainResourceDialect
5090                ),
5091            }
5092        }
5093
5094        #[inline]
5095        unsafe fn decode(
5096            &mut self,
5097            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5098            offset: usize,
5099            _depth: fidl::encoding::Depth,
5100        ) -> fidl::Result<()> {
5101            decoder.debug_check_bounds::<Self>(offset);
5102            // Verify that padding bytes are zero.
5103            fidl::decode!(
5104                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperMarker>>,
5105                fdomain_client::fidl::FDomainResourceDialect,
5106                &mut self.server_end,
5107                decoder,
5108                offset + 0,
5109                _depth
5110            )?;
5111            Ok(())
5112        }
5113    }
5114
5115    impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionRequest {
5116        type Borrowed<'a> = &'a mut Self;
5117        fn take_or_borrow<'a>(
5118            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5119        ) -> Self::Borrowed<'a> {
5120            value
5121        }
5122    }
5123
5124    unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionRequest {
5125        type Owned = Self;
5126
5127        #[inline(always)]
5128        fn inline_align(_context: fidl::encoding::Context) -> usize {
5129            4
5130        }
5131
5132        #[inline(always)]
5133        fn inline_size(_context: fidl::encoding::Context) -> usize {
5134            4
5135        }
5136    }
5137
5138    unsafe impl
5139        fidl::encoding::Encode<
5140            BlockOpenSessionRequest,
5141            fdomain_client::fidl::FDomainResourceDialect,
5142        > for &mut BlockOpenSessionRequest
5143    {
5144        #[inline]
5145        unsafe fn encode(
5146            self,
5147            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5148            offset: usize,
5149            _depth: fidl::encoding::Depth,
5150        ) -> fidl::Result<()> {
5151            encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
5152            // Delegate to tuple encoding.
5153            fidl::encoding::Encode::<BlockOpenSessionRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
5154                (
5155                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
5156                ),
5157                encoder, offset, _depth
5158            )
5159        }
5160    }
5161    unsafe impl<
5162        T0: fidl::encoding::Encode<
5163                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>>,
5164                fdomain_client::fidl::FDomainResourceDialect,
5165            >,
5166    >
5167        fidl::encoding::Encode<
5168            BlockOpenSessionRequest,
5169            fdomain_client::fidl::FDomainResourceDialect,
5170        > for (T0,)
5171    {
5172        #[inline]
5173        unsafe fn encode(
5174            self,
5175            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5176            offset: usize,
5177            depth: fidl::encoding::Depth,
5178        ) -> fidl::Result<()> {
5179            encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
5180            // Zero out padding regions. There's no need to apply masks
5181            // because the unmasked parts will be overwritten by fields.
5182            // Write the fields.
5183            self.0.encode(encoder, offset + 0, depth)?;
5184            Ok(())
5185        }
5186    }
5187
5188    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5189        for BlockOpenSessionRequest
5190    {
5191        #[inline(always)]
5192        fn new_empty() -> Self {
5193            Self {
5194                session: fidl::new_empty!(
5195                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>>,
5196                    fdomain_client::fidl::FDomainResourceDialect
5197                ),
5198            }
5199        }
5200
5201        #[inline]
5202        unsafe fn decode(
5203            &mut self,
5204            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5205            offset: usize,
5206            _depth: fidl::encoding::Depth,
5207        ) -> fidl::Result<()> {
5208            decoder.debug_check_bounds::<Self>(offset);
5209            // Verify that padding bytes are zero.
5210            fidl::decode!(
5211                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>>,
5212                fdomain_client::fidl::FDomainResourceDialect,
5213                &mut self.session,
5214                decoder,
5215                offset + 0,
5216                _depth
5217            )?;
5218            Ok(())
5219        }
5220    }
5221
5222    impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionWithOptionsRequest {
5223        type Borrowed<'a> = &'a mut Self;
5224        fn take_or_borrow<'a>(
5225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5226        ) -> Self::Borrowed<'a> {
5227            value
5228        }
5229    }
5230
5231    unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionWithOptionsRequest {
5232        type Owned = Self;
5233
5234        #[inline(always)]
5235        fn inline_align(_context: fidl::encoding::Context) -> usize {
5236            8
5237        }
5238
5239        #[inline(always)]
5240        fn inline_size(_context: fidl::encoding::Context) -> usize {
5241            24
5242        }
5243    }
5244
5245    unsafe impl
5246        fidl::encoding::Encode<
5247            BlockOpenSessionWithOptionsRequest,
5248            fdomain_client::fidl::FDomainResourceDialect,
5249        > for &mut BlockOpenSessionWithOptionsRequest
5250    {
5251        #[inline]
5252        unsafe fn encode(
5253            self,
5254            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5255            offset: usize,
5256            _depth: fidl::encoding::Depth,
5257        ) -> fidl::Result<()> {
5258            encoder.debug_check_bounds::<BlockOpenSessionWithOptionsRequest>(offset);
5259            // Delegate to tuple encoding.
5260            fidl::encoding::Encode::<BlockOpenSessionWithOptionsRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
5261                (
5262                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
5263                    <fidl::encoding::Vector<BlockOffsetMapping, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.mappings),
5264                ),
5265                encoder, offset, _depth
5266            )
5267        }
5268    }
5269    unsafe impl<
5270        T0: fidl::encoding::Encode<
5271                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>>,
5272                fdomain_client::fidl::FDomainResourceDialect,
5273            >,
5274        T1: fidl::encoding::Encode<
5275                fidl::encoding::Vector<BlockOffsetMapping, 4>,
5276                fdomain_client::fidl::FDomainResourceDialect,
5277            >,
5278    >
5279        fidl::encoding::Encode<
5280            BlockOpenSessionWithOptionsRequest,
5281            fdomain_client::fidl::FDomainResourceDialect,
5282        > for (T0, T1)
5283    {
5284        #[inline]
5285        unsafe fn encode(
5286            self,
5287            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5288            offset: usize,
5289            depth: fidl::encoding::Depth,
5290        ) -> fidl::Result<()> {
5291            encoder.debug_check_bounds::<BlockOpenSessionWithOptionsRequest>(offset);
5292            // Zero out padding regions. There's no need to apply masks
5293            // because the unmasked parts will be overwritten by fields.
5294            unsafe {
5295                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5296                (ptr as *mut u64).write_unaligned(0);
5297            }
5298            // Write the fields.
5299            self.0.encode(encoder, offset + 0, depth)?;
5300            self.1.encode(encoder, offset + 8, depth)?;
5301            Ok(())
5302        }
5303    }
5304
5305    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5306        for BlockOpenSessionWithOptionsRequest
5307    {
5308        #[inline(always)]
5309        fn new_empty() -> Self {
5310            Self {
5311                session: fidl::new_empty!(
5312                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>>,
5313                    fdomain_client::fidl::FDomainResourceDialect
5314                ),
5315                mappings: fidl::new_empty!(fidl::encoding::Vector<BlockOffsetMapping, 4>, fdomain_client::fidl::FDomainResourceDialect),
5316            }
5317        }
5318
5319        #[inline]
5320        unsafe fn decode(
5321            &mut self,
5322            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5323            offset: usize,
5324            _depth: fidl::encoding::Depth,
5325        ) -> fidl::Result<()> {
5326            decoder.debug_check_bounds::<Self>(offset);
5327            // Verify that padding bytes are zero.
5328            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5329            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5330            let mask = 0xffffffff00000000u64;
5331            let maskedval = padval & mask;
5332            if maskedval != 0 {
5333                return Err(fidl::Error::NonZeroPadding {
5334                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5335                });
5336            }
5337            fidl::decode!(
5338                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SessionMarker>>,
5339                fdomain_client::fidl::FDomainResourceDialect,
5340                &mut self.session,
5341                decoder,
5342                offset + 0,
5343                _depth
5344            )?;
5345            fidl::decode!(fidl::encoding::Vector<BlockOffsetMapping, 4>, fdomain_client::fidl::FDomainResourceDialect, &mut self.mappings, decoder, offset + 8, _depth)?;
5346            Ok(())
5347        }
5348    }
5349
5350    impl fidl::encoding::ResourceTypeMarker for MapperOpenSessionRequest {
5351        type Borrowed<'a> = &'a mut Self;
5352        fn take_or_borrow<'a>(
5353            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5354        ) -> Self::Borrowed<'a> {
5355            value
5356        }
5357    }
5358
5359    unsafe impl fidl::encoding::TypeMarker for MapperOpenSessionRequest {
5360        type Owned = Self;
5361
5362        #[inline(always)]
5363        fn inline_align(_context: fidl::encoding::Context) -> usize {
5364            4
5365        }
5366
5367        #[inline(always)]
5368        fn inline_size(_context: fidl::encoding::Context) -> usize {
5369            16
5370        }
5371    }
5372
5373    unsafe impl
5374        fidl::encoding::Encode<
5375            MapperOpenSessionRequest,
5376            fdomain_client::fidl::FDomainResourceDialect,
5377        > for &mut MapperOpenSessionRequest
5378    {
5379        #[inline]
5380        unsafe fn encode(
5381            self,
5382            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5383            offset: usize,
5384            _depth: fidl::encoding::Depth,
5385        ) -> fidl::Result<()> {
5386            encoder.debug_check_bounds::<MapperOpenSessionRequest>(offset);
5387            // Delegate to tuple encoding.
5388            fidl::encoding::Encode::<MapperOpenSessionRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
5389                (
5390                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
5391                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mapping_vmo),
5392                    <fidl::encoding::Optional<fidl::encoding::HandleType<fdomain_client::Port, { fidl::ObjectType::PORT.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
5393                    <fidl::encoding::Optional<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delivery_queue),
5394                ),
5395                encoder, offset, _depth
5396            )
5397        }
5398    }
5399    unsafe impl<
5400        T0: fidl::encoding::Encode<
5401                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>>,
5402                fdomain_client::fidl::FDomainResourceDialect,
5403            >,
5404        T1: fidl::encoding::Encode<
5405                fidl::encoding::HandleType<
5406                    fdomain_client::Vmo,
5407                    { fidl::ObjectType::VMO.into_raw() },
5408                    2147483648,
5409                >,
5410                fdomain_client::fidl::FDomainResourceDialect,
5411            >,
5412        T2: fidl::encoding::Encode<
5413                fidl::encoding::Optional<
5414                    fidl::encoding::HandleType<
5415                        fdomain_client::Port,
5416                        { fidl::ObjectType::PORT.into_raw() },
5417                        2147483648,
5418                    >,
5419                >,
5420                fdomain_client::fidl::FDomainResourceDialect,
5421            >,
5422        T3: fidl::encoding::Encode<
5423                fidl::encoding::Optional<
5424                    fidl::encoding::HandleType<
5425                        fdomain_client::Vmo,
5426                        { fidl::ObjectType::VMO.into_raw() },
5427                        2147483648,
5428                    >,
5429                >,
5430                fdomain_client::fidl::FDomainResourceDialect,
5431            >,
5432    >
5433        fidl::encoding::Encode<
5434            MapperOpenSessionRequest,
5435            fdomain_client::fidl::FDomainResourceDialect,
5436        > for (T0, T1, T2, T3)
5437    {
5438        #[inline]
5439        unsafe fn encode(
5440            self,
5441            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5442            offset: usize,
5443            depth: fidl::encoding::Depth,
5444        ) -> fidl::Result<()> {
5445            encoder.debug_check_bounds::<MapperOpenSessionRequest>(offset);
5446            // Zero out padding regions. There's no need to apply masks
5447            // because the unmasked parts will be overwritten by fields.
5448            // Write the fields.
5449            self.0.encode(encoder, offset + 0, depth)?;
5450            self.1.encode(encoder, offset + 4, depth)?;
5451            self.2.encode(encoder, offset + 8, depth)?;
5452            self.3.encode(encoder, offset + 12, depth)?;
5453            Ok(())
5454        }
5455    }
5456
5457    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5458        for MapperOpenSessionRequest
5459    {
5460        #[inline(always)]
5461        fn new_empty() -> Self {
5462            Self {
5463                session: fidl::new_empty!(
5464                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>>,
5465                    fdomain_client::fidl::FDomainResourceDialect
5466                ),
5467                mapping_vmo: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
5468                port: fidl::new_empty!(
5469                    fidl::encoding::Optional<
5470                        fidl::encoding::HandleType<
5471                            fdomain_client::Port,
5472                            { fidl::ObjectType::PORT.into_raw() },
5473                            2147483648,
5474                        >,
5475                    >,
5476                    fdomain_client::fidl::FDomainResourceDialect
5477                ),
5478                delivery_queue: fidl::new_empty!(
5479                    fidl::encoding::Optional<
5480                        fidl::encoding::HandleType<
5481                            fdomain_client::Vmo,
5482                            { fidl::ObjectType::VMO.into_raw() },
5483                            2147483648,
5484                        >,
5485                    >,
5486                    fdomain_client::fidl::FDomainResourceDialect
5487                ),
5488            }
5489        }
5490
5491        #[inline]
5492        unsafe fn decode(
5493            &mut self,
5494            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5495            offset: usize,
5496            _depth: fidl::encoding::Depth,
5497        ) -> fidl::Result<()> {
5498            decoder.debug_check_bounds::<Self>(offset);
5499            // Verify that padding bytes are zero.
5500            fidl::decode!(
5501                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>>,
5502                fdomain_client::fidl::FDomainResourceDialect,
5503                &mut self.session,
5504                decoder,
5505                offset + 0,
5506                _depth
5507            )?;
5508            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, &mut self.mapping_vmo, decoder, offset + 4, _depth)?;
5509            fidl::decode!(
5510                fidl::encoding::Optional<
5511                    fidl::encoding::HandleType<
5512                        fdomain_client::Port,
5513                        { fidl::ObjectType::PORT.into_raw() },
5514                        2147483648,
5515                    >,
5516                >,
5517                fdomain_client::fidl::FDomainResourceDialect,
5518                &mut self.port,
5519                decoder,
5520                offset + 8,
5521                _depth
5522            )?;
5523            fidl::decode!(
5524                fidl::encoding::Optional<
5525                    fidl::encoding::HandleType<
5526                        fdomain_client::Vmo,
5527                        { fidl::ObjectType::VMO.into_raw() },
5528                        2147483648,
5529                    >,
5530                >,
5531                fdomain_client::fidl::FDomainResourceDialect,
5532                &mut self.delivery_queue,
5533                decoder,
5534                offset + 12,
5535                _depth
5536            )?;
5537            Ok(())
5538        }
5539    }
5540
5541    impl fidl::encoding::ResourceTypeMarker for MapperSessionOpenChildSessionRequest {
5542        type Borrowed<'a> = &'a mut Self;
5543        fn take_or_borrow<'a>(
5544            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5545        ) -> Self::Borrowed<'a> {
5546            value
5547        }
5548    }
5549
5550    unsafe impl fidl::encoding::TypeMarker for MapperSessionOpenChildSessionRequest {
5551        type Owned = Self;
5552
5553        #[inline(always)]
5554        fn inline_align(_context: fidl::encoding::Context) -> usize {
5555            8
5556        }
5557
5558        #[inline(always)]
5559        fn inline_size(_context: fidl::encoding::Context) -> usize {
5560            24
5561        }
5562    }
5563
5564    unsafe impl
5565        fidl::encoding::Encode<
5566            MapperSessionOpenChildSessionRequest,
5567            fdomain_client::fidl::FDomainResourceDialect,
5568        > for &mut MapperSessionOpenChildSessionRequest
5569    {
5570        #[inline]
5571        unsafe fn encode(
5572            self,
5573            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5574            offset: usize,
5575            _depth: fidl::encoding::Depth,
5576        ) -> fidl::Result<()> {
5577            encoder.debug_check_bounds::<MapperSessionOpenChildSessionRequest>(offset);
5578            // Delegate to tuple encoding.
5579            fidl::encoding::Encode::<MapperSessionOpenChildSessionRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
5580                (
5581                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
5582                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mapping_vmo),
5583                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent_key),
5584                    <fidl::encoding::Optional<fidl::encoding::HandleType<fdomain_client::Port, { fidl::ObjectType::PORT.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.port),
5585                    <fidl::encoding::Optional<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delivery_queue),
5586                ),
5587                encoder, offset, _depth
5588            )
5589        }
5590    }
5591    unsafe impl<
5592        T0: fidl::encoding::Encode<
5593                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>>,
5594                fdomain_client::fidl::FDomainResourceDialect,
5595            >,
5596        T1: fidl::encoding::Encode<
5597                fidl::encoding::HandleType<
5598                    fdomain_client::Vmo,
5599                    { fidl::ObjectType::VMO.into_raw() },
5600                    2147483648,
5601                >,
5602                fdomain_client::fidl::FDomainResourceDialect,
5603            >,
5604        T2: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
5605        T3: fidl::encoding::Encode<
5606                fidl::encoding::Optional<
5607                    fidl::encoding::HandleType<
5608                        fdomain_client::Port,
5609                        { fidl::ObjectType::PORT.into_raw() },
5610                        2147483648,
5611                    >,
5612                >,
5613                fdomain_client::fidl::FDomainResourceDialect,
5614            >,
5615        T4: fidl::encoding::Encode<
5616                fidl::encoding::Optional<
5617                    fidl::encoding::HandleType<
5618                        fdomain_client::Vmo,
5619                        { fidl::ObjectType::VMO.into_raw() },
5620                        2147483648,
5621                    >,
5622                >,
5623                fdomain_client::fidl::FDomainResourceDialect,
5624            >,
5625    >
5626        fidl::encoding::Encode<
5627            MapperSessionOpenChildSessionRequest,
5628            fdomain_client::fidl::FDomainResourceDialect,
5629        > for (T0, T1, T2, T3, T4)
5630    {
5631        #[inline]
5632        unsafe fn encode(
5633            self,
5634            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5635            offset: usize,
5636            depth: fidl::encoding::Depth,
5637        ) -> fidl::Result<()> {
5638            encoder.debug_check_bounds::<MapperSessionOpenChildSessionRequest>(offset);
5639            // Zero out padding regions. There's no need to apply masks
5640            // because the unmasked parts will be overwritten by fields.
5641            // Write the fields.
5642            self.0.encode(encoder, offset + 0, depth)?;
5643            self.1.encode(encoder, offset + 4, depth)?;
5644            self.2.encode(encoder, offset + 8, depth)?;
5645            self.3.encode(encoder, offset + 16, depth)?;
5646            self.4.encode(encoder, offset + 20, depth)?;
5647            Ok(())
5648        }
5649    }
5650
5651    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5652        for MapperSessionOpenChildSessionRequest
5653    {
5654        #[inline(always)]
5655        fn new_empty() -> Self {
5656            Self {
5657                session: fidl::new_empty!(
5658                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>>,
5659                    fdomain_client::fidl::FDomainResourceDialect
5660                ),
5661                mapping_vmo: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
5662                parent_key: fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect),
5663                port: fidl::new_empty!(
5664                    fidl::encoding::Optional<
5665                        fidl::encoding::HandleType<
5666                            fdomain_client::Port,
5667                            { fidl::ObjectType::PORT.into_raw() },
5668                            2147483648,
5669                        >,
5670                    >,
5671                    fdomain_client::fidl::FDomainResourceDialect
5672                ),
5673                delivery_queue: fidl::new_empty!(
5674                    fidl::encoding::Optional<
5675                        fidl::encoding::HandleType<
5676                            fdomain_client::Vmo,
5677                            { fidl::ObjectType::VMO.into_raw() },
5678                            2147483648,
5679                        >,
5680                    >,
5681                    fdomain_client::fidl::FDomainResourceDialect
5682                ),
5683            }
5684        }
5685
5686        #[inline]
5687        unsafe fn decode(
5688            &mut self,
5689            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5690            offset: usize,
5691            _depth: fidl::encoding::Depth,
5692        ) -> fidl::Result<()> {
5693            decoder.debug_check_bounds::<Self>(offset);
5694            // Verify that padding bytes are zero.
5695            fidl::decode!(
5696                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<MapperSessionMarker>>,
5697                fdomain_client::fidl::FDomainResourceDialect,
5698                &mut self.session,
5699                decoder,
5700                offset + 0,
5701                _depth
5702            )?;
5703            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, &mut self.mapping_vmo, decoder, offset + 4, _depth)?;
5704            fidl::decode!(
5705                u64,
5706                fdomain_client::fidl::FDomainResourceDialect,
5707                &mut self.parent_key,
5708                decoder,
5709                offset + 8,
5710                _depth
5711            )?;
5712            fidl::decode!(
5713                fidl::encoding::Optional<
5714                    fidl::encoding::HandleType<
5715                        fdomain_client::Port,
5716                        { fidl::ObjectType::PORT.into_raw() },
5717                        2147483648,
5718                    >,
5719                >,
5720                fdomain_client::fidl::FDomainResourceDialect,
5721                &mut self.port,
5722                decoder,
5723                offset + 16,
5724                _depth
5725            )?;
5726            fidl::decode!(
5727                fidl::encoding::Optional<
5728                    fidl::encoding::HandleType<
5729                        fdomain_client::Vmo,
5730                        { fidl::ObjectType::VMO.into_raw() },
5731                        2147483648,
5732                    >,
5733                >,
5734                fdomain_client::fidl::FDomainResourceDialect,
5735                &mut self.delivery_queue,
5736                decoder,
5737                offset + 20,
5738                _depth
5739            )?;
5740            Ok(())
5741        }
5742    }
5743
5744    impl fidl::encoding::ResourceTypeMarker for MapperSessionCreateVmoResponse {
5745        type Borrowed<'a> = &'a mut Self;
5746        fn take_or_borrow<'a>(
5747            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5748        ) -> Self::Borrowed<'a> {
5749            value
5750        }
5751    }
5752
5753    unsafe impl fidl::encoding::TypeMarker for MapperSessionCreateVmoResponse {
5754        type Owned = Self;
5755
5756        #[inline(always)]
5757        fn inline_align(_context: fidl::encoding::Context) -> usize {
5758            4
5759        }
5760
5761        #[inline(always)]
5762        fn inline_size(_context: fidl::encoding::Context) -> usize {
5763            4
5764        }
5765    }
5766
5767    unsafe impl
5768        fidl::encoding::Encode<
5769            MapperSessionCreateVmoResponse,
5770            fdomain_client::fidl::FDomainResourceDialect,
5771        > for &mut MapperSessionCreateVmoResponse
5772    {
5773        #[inline]
5774        unsafe fn encode(
5775            self,
5776            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5777            offset: usize,
5778            _depth: fidl::encoding::Depth,
5779        ) -> fidl::Result<()> {
5780            encoder.debug_check_bounds::<MapperSessionCreateVmoResponse>(offset);
5781            // Delegate to tuple encoding.
5782            fidl::encoding::Encode::<
5783                MapperSessionCreateVmoResponse,
5784                fdomain_client::fidl::FDomainResourceDialect,
5785            >::encode(
5786                (<fidl::encoding::HandleType<
5787                    fdomain_client::Vmo,
5788                    { fidl::ObjectType::VMO.into_raw() },
5789                    2147483648,
5790                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5791                    &mut self.vmo
5792                ),),
5793                encoder,
5794                offset,
5795                _depth,
5796            )
5797        }
5798    }
5799    unsafe impl<
5800        T0: fidl::encoding::Encode<
5801                fidl::encoding::HandleType<
5802                    fdomain_client::Vmo,
5803                    { fidl::ObjectType::VMO.into_raw() },
5804                    2147483648,
5805                >,
5806                fdomain_client::fidl::FDomainResourceDialect,
5807            >,
5808    >
5809        fidl::encoding::Encode<
5810            MapperSessionCreateVmoResponse,
5811            fdomain_client::fidl::FDomainResourceDialect,
5812        > for (T0,)
5813    {
5814        #[inline]
5815        unsafe fn encode(
5816            self,
5817            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5818            offset: usize,
5819            depth: fidl::encoding::Depth,
5820        ) -> fidl::Result<()> {
5821            encoder.debug_check_bounds::<MapperSessionCreateVmoResponse>(offset);
5822            // Zero out padding regions. There's no need to apply masks
5823            // because the unmasked parts will be overwritten by fields.
5824            // Write the fields.
5825            self.0.encode(encoder, offset + 0, depth)?;
5826            Ok(())
5827        }
5828    }
5829
5830    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5831        for MapperSessionCreateVmoResponse
5832    {
5833        #[inline(always)]
5834        fn new_empty() -> Self {
5835            Self {
5836                vmo: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
5837            }
5838        }
5839
5840        #[inline]
5841        unsafe fn decode(
5842            &mut self,
5843            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5844            offset: usize,
5845            _depth: fidl::encoding::Depth,
5846        ) -> fidl::Result<()> {
5847            decoder.debug_check_bounds::<Self>(offset);
5848            // Verify that padding bytes are zero.
5849            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)?;
5850            Ok(())
5851        }
5852    }
5853
5854    impl fidl::encoding::ResourceTypeMarker for SessionAttachVmoRequest {
5855        type Borrowed<'a> = &'a mut Self;
5856        fn take_or_borrow<'a>(
5857            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5858        ) -> Self::Borrowed<'a> {
5859            value
5860        }
5861    }
5862
5863    unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoRequest {
5864        type Owned = Self;
5865
5866        #[inline(always)]
5867        fn inline_align(_context: fidl::encoding::Context) -> usize {
5868            4
5869        }
5870
5871        #[inline(always)]
5872        fn inline_size(_context: fidl::encoding::Context) -> usize {
5873            4
5874        }
5875    }
5876
5877    unsafe impl
5878        fidl::encoding::Encode<
5879            SessionAttachVmoRequest,
5880            fdomain_client::fidl::FDomainResourceDialect,
5881        > for &mut SessionAttachVmoRequest
5882    {
5883        #[inline]
5884        unsafe fn encode(
5885            self,
5886            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5887            offset: usize,
5888            _depth: fidl::encoding::Depth,
5889        ) -> fidl::Result<()> {
5890            encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
5891            // Delegate to tuple encoding.
5892            fidl::encoding::Encode::<
5893                SessionAttachVmoRequest,
5894                fdomain_client::fidl::FDomainResourceDialect,
5895            >::encode(
5896                (<fidl::encoding::HandleType<
5897                    fdomain_client::Vmo,
5898                    { fidl::ObjectType::VMO.into_raw() },
5899                    2147483648,
5900                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5901                    &mut self.vmo
5902                ),),
5903                encoder,
5904                offset,
5905                _depth,
5906            )
5907        }
5908    }
5909    unsafe impl<
5910        T0: fidl::encoding::Encode<
5911                fidl::encoding::HandleType<
5912                    fdomain_client::Vmo,
5913                    { fidl::ObjectType::VMO.into_raw() },
5914                    2147483648,
5915                >,
5916                fdomain_client::fidl::FDomainResourceDialect,
5917            >,
5918    >
5919        fidl::encoding::Encode<
5920            SessionAttachVmoRequest,
5921            fdomain_client::fidl::FDomainResourceDialect,
5922        > for (T0,)
5923    {
5924        #[inline]
5925        unsafe fn encode(
5926            self,
5927            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5928            offset: usize,
5929            depth: fidl::encoding::Depth,
5930        ) -> fidl::Result<()> {
5931            encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
5932            // Zero out padding regions. There's no need to apply masks
5933            // because the unmasked parts will be overwritten by fields.
5934            // Write the fields.
5935            self.0.encode(encoder, offset + 0, depth)?;
5936            Ok(())
5937        }
5938    }
5939
5940    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
5941        for SessionAttachVmoRequest
5942    {
5943        #[inline(always)]
5944        fn new_empty() -> Self {
5945            Self {
5946                vmo: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
5947            }
5948        }
5949
5950        #[inline]
5951        unsafe fn decode(
5952            &mut self,
5953            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5954            offset: usize,
5955            _depth: fidl::encoding::Depth,
5956        ) -> fidl::Result<()> {
5957            decoder.debug_check_bounds::<Self>(offset);
5958            // Verify that padding bytes are zero.
5959            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)?;
5960            Ok(())
5961        }
5962    }
5963
5964    impl fidl::encoding::ResourceTypeMarker for SessionGetFifoResponse {
5965        type Borrowed<'a> = &'a mut Self;
5966        fn take_or_borrow<'a>(
5967            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5968        ) -> Self::Borrowed<'a> {
5969            value
5970        }
5971    }
5972
5973    unsafe impl fidl::encoding::TypeMarker for SessionGetFifoResponse {
5974        type Owned = Self;
5975
5976        #[inline(always)]
5977        fn inline_align(_context: fidl::encoding::Context) -> usize {
5978            4
5979        }
5980
5981        #[inline(always)]
5982        fn inline_size(_context: fidl::encoding::Context) -> usize {
5983            4
5984        }
5985    }
5986
5987    unsafe impl
5988        fidl::encoding::Encode<SessionGetFifoResponse, fdomain_client::fidl::FDomainResourceDialect>
5989        for &mut SessionGetFifoResponse
5990    {
5991        #[inline]
5992        unsafe fn encode(
5993            self,
5994            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
5995            offset: usize,
5996            _depth: fidl::encoding::Depth,
5997        ) -> fidl::Result<()> {
5998            encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
5999            // Delegate to tuple encoding.
6000            fidl::encoding::Encode::<
6001                SessionGetFifoResponse,
6002                fdomain_client::fidl::FDomainResourceDialect,
6003            >::encode(
6004                (<fidl::encoding::HandleType<
6005                    fdomain_client::Fifo,
6006                    { fidl::ObjectType::FIFO.into_raw() },
6007                    2147483648,
6008                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6009                    &mut self.fifo
6010                ),),
6011                encoder,
6012                offset,
6013                _depth,
6014            )
6015        }
6016    }
6017    unsafe impl<
6018        T0: fidl::encoding::Encode<
6019                fidl::encoding::HandleType<
6020                    fdomain_client::Fifo,
6021                    { fidl::ObjectType::FIFO.into_raw() },
6022                    2147483648,
6023                >,
6024                fdomain_client::fidl::FDomainResourceDialect,
6025            >,
6026    >
6027        fidl::encoding::Encode<SessionGetFifoResponse, fdomain_client::fidl::FDomainResourceDialect>
6028        for (T0,)
6029    {
6030        #[inline]
6031        unsafe fn encode(
6032            self,
6033            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
6034            offset: usize,
6035            depth: fidl::encoding::Depth,
6036        ) -> fidl::Result<()> {
6037            encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
6038            // Zero out padding regions. There's no need to apply masks
6039            // because the unmasked parts will be overwritten by fields.
6040            // Write the fields.
6041            self.0.encode(encoder, offset + 0, depth)?;
6042            Ok(())
6043        }
6044    }
6045
6046    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
6047        for SessionGetFifoResponse
6048    {
6049        #[inline(always)]
6050        fn new_empty() -> Self {
6051            Self {
6052                fifo: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
6053            }
6054        }
6055
6056        #[inline]
6057        unsafe fn decode(
6058            &mut self,
6059            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
6060            offset: usize,
6061            _depth: fidl::encoding::Depth,
6062        ) -> fidl::Result<()> {
6063            decoder.debug_check_bounds::<Self>(offset);
6064            // Verify that padding bytes are zero.
6065            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)?;
6066            Ok(())
6067        }
6068    }
6069}