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