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