fidl_fuchsia_fs_startup/
fidl_fuchsia_fs_startup.rs

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