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