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