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