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