Skip to main content

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