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