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