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