Skip to main content

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