fidl_fuchsia_fs_realm/
fidl_fuchsia_fs_realm.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_realm__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerCheckRequest {
16    pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
17    pub name: String,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerCheckRequest {}
21
22#[derive(Debug, PartialEq)]
23pub struct ControllerFormatRequest {
24    pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
25    pub name: String,
26    pub options: FormatOptions,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerFormatRequest {}
30
31#[derive(Debug, PartialEq)]
32pub struct ControllerMountRequest {
33    pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
34    pub name: String,
35    pub options: MountOptions,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerMountRequest {}
39
40#[derive(Debug, Default, PartialEq)]
41pub struct FormatOptions {
42    pub verbose: Option<bool>,
43    pub fvm_data_slices: Option<u32>,
44    #[doc(hidden)]
45    pub __source_breaking: fidl::marker::SourceBreaking,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FormatOptions {}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct MountOptions {
52    pub read_only: Option<bool>,
53    pub verbose: Option<bool>,
54    #[doc(hidden)]
55    pub __source_breaking: fidl::marker::SourceBreaking,
56}
57
58impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {}
59
60#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
61pub struct ControllerMarker;
62
63impl fidl::endpoints::ProtocolMarker for ControllerMarker {
64    type Proxy = ControllerProxy;
65    type RequestStream = ControllerRequestStream;
66    #[cfg(target_os = "fuchsia")]
67    type SynchronousProxy = ControllerSynchronousProxy;
68
69    const DEBUG_NAME: &'static str = "fuchsia.fs.realm.Controller";
70}
71impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
72pub type ControllerMountResult = Result<(), i32>;
73pub type ControllerUnmountResult = Result<(), i32>;
74pub type ControllerFormatResult = Result<(), i32>;
75pub type ControllerCheckResult = Result<(), i32>;
76
77pub trait ControllerProxyInterface: Send + Sync {
78    type MountResponseFut: std::future::Future<Output = Result<ControllerMountResult, fidl::Error>>
79        + Send;
80    fn r#mount(
81        &self,
82        device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
83        name: &str,
84        options: MountOptions,
85    ) -> Self::MountResponseFut;
86    type UnmountResponseFut: std::future::Future<Output = Result<ControllerUnmountResult, fidl::Error>>
87        + Send;
88    fn r#unmount(&self, name: &str) -> Self::UnmountResponseFut;
89    type FormatResponseFut: std::future::Future<Output = Result<ControllerFormatResult, fidl::Error>>
90        + Send;
91    fn r#format(
92        &self,
93        device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
94        name: &str,
95        options: FormatOptions,
96    ) -> Self::FormatResponseFut;
97    type CheckResponseFut: std::future::Future<Output = Result<ControllerCheckResult, fidl::Error>>
98        + Send;
99    fn r#check(
100        &self,
101        device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
102        name: &str,
103    ) -> Self::CheckResponseFut;
104}
105#[derive(Debug)]
106#[cfg(target_os = "fuchsia")]
107pub struct ControllerSynchronousProxy {
108    client: fidl::client::sync::Client,
109}
110
111#[cfg(target_os = "fuchsia")]
112impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
113    type Proxy = ControllerProxy;
114    type Protocol = ControllerMarker;
115
116    fn from_channel(inner: fidl::Channel) -> Self {
117        Self::new(inner)
118    }
119
120    fn into_channel(self) -> fidl::Channel {
121        self.client.into_channel()
122    }
123
124    fn as_channel(&self) -> &fidl::Channel {
125        self.client.as_channel()
126    }
127}
128
129#[cfg(target_os = "fuchsia")]
130impl ControllerSynchronousProxy {
131    pub fn new(channel: fidl::Channel) -> Self {
132        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
133        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
134    }
135
136    pub fn into_channel(self) -> fidl::Channel {
137        self.client.into_channel()
138    }
139
140    /// Waits until an event arrives and returns it. It is safe for other
141    /// threads to make concurrent requests while waiting for an event.
142    pub fn wait_for_event(
143        &self,
144        deadline: zx::MonotonicInstant,
145    ) -> Result<ControllerEvent, fidl::Error> {
146        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
147    }
148
149    /// Mounts a filesystem on a block device.
150    pub fn r#mount(
151        &self,
152        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
153        mut name: &str,
154        mut options: MountOptions,
155        ___deadline: zx::MonotonicInstant,
156    ) -> Result<ControllerMountResult, fidl::Error> {
157        let _response = self.client.send_query::<
158            ControllerMountRequest,
159            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
160        >(
161            (device, name, &mut options,),
162            0x49300213a51ec7f7,
163            fidl::encoding::DynamicFlags::empty(),
164            ___deadline,
165        )?;
166        Ok(_response.map(|x| x))
167    }
168
169    /// Unmounts a previously mounted filesystem.
170    pub fn r#unmount(
171        &self,
172        mut name: &str,
173        ___deadline: zx::MonotonicInstant,
174    ) -> Result<ControllerUnmountResult, fidl::Error> {
175        let _response = self.client.send_query::<
176            ControllerUnmountRequest,
177            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
178        >(
179            (name,),
180            0x2d994ee1a9364179,
181            fidl::encoding::DynamicFlags::empty(),
182            ___deadline,
183        )?;
184        Ok(_response.map(|x| x))
185    }
186
187    /// Formats a block device with a particular filesystem format
188    pub fn r#format(
189        &self,
190        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
191        mut name: &str,
192        mut options: FormatOptions,
193        ___deadline: zx::MonotonicInstant,
194    ) -> Result<ControllerFormatResult, fidl::Error> {
195        let _response = self.client.send_query::<
196            ControllerFormatRequest,
197            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
198        >(
199            (device, name, &mut options,),
200            0x52ce219e43664bf0,
201            fidl::encoding::DynamicFlags::empty(),
202            ___deadline,
203        )?;
204        Ok(_response.map(|x| x))
205    }
206
207    /// Checks the consistency of the filesystem formatted on
208    /// the block device
209    pub fn r#check(
210        &self,
211        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
212        mut name: &str,
213        ___deadline: zx::MonotonicInstant,
214    ) -> Result<ControllerCheckResult, fidl::Error> {
215        let _response = self.client.send_query::<
216            ControllerCheckRequest,
217            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
218        >(
219            (device, name,),
220            0x20d3ff7c33a9b863,
221            fidl::encoding::DynamicFlags::empty(),
222            ___deadline,
223        )?;
224        Ok(_response.map(|x| x))
225    }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl From<ControllerSynchronousProxy> for zx::NullableHandle {
230    fn from(value: ControllerSynchronousProxy) -> Self {
231        value.into_channel().into()
232    }
233}
234
235#[cfg(target_os = "fuchsia")]
236impl From<fidl::Channel> for ControllerSynchronousProxy {
237    fn from(value: fidl::Channel) -> Self {
238        Self::new(value)
239    }
240}
241
242#[cfg(target_os = "fuchsia")]
243impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
244    type Protocol = ControllerMarker;
245
246    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
247        Self::new(value.into_channel())
248    }
249}
250
251#[derive(Debug, Clone)]
252pub struct ControllerProxy {
253    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
254}
255
256impl fidl::endpoints::Proxy for ControllerProxy {
257    type Protocol = ControllerMarker;
258
259    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
260        Self::new(inner)
261    }
262
263    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
264        self.client.into_channel().map_err(|client| Self { client })
265    }
266
267    fn as_channel(&self) -> &::fidl::AsyncChannel {
268        self.client.as_channel()
269    }
270}
271
272impl ControllerProxy {
273    /// Create a new Proxy for fuchsia.fs.realm/Controller.
274    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
275        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
276        Self { client: fidl::client::Client::new(channel, protocol_name) }
277    }
278
279    /// Get a Stream of events from the remote end of the protocol.
280    ///
281    /// # Panics
282    ///
283    /// Panics if the event stream was already taken.
284    pub fn take_event_stream(&self) -> ControllerEventStream {
285        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
286    }
287
288    /// Mounts a filesystem on a block device.
289    pub fn r#mount(
290        &self,
291        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
292        mut name: &str,
293        mut options: MountOptions,
294    ) -> fidl::client::QueryResponseFut<
295        ControllerMountResult,
296        fidl::encoding::DefaultFuchsiaResourceDialect,
297    > {
298        ControllerProxyInterface::r#mount(self, device, name, options)
299    }
300
301    /// Unmounts a previously mounted filesystem.
302    pub fn r#unmount(
303        &self,
304        mut name: &str,
305    ) -> fidl::client::QueryResponseFut<
306        ControllerUnmountResult,
307        fidl::encoding::DefaultFuchsiaResourceDialect,
308    > {
309        ControllerProxyInterface::r#unmount(self, name)
310    }
311
312    /// Formats a block device with a particular filesystem format
313    pub fn r#format(
314        &self,
315        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
316        mut name: &str,
317        mut options: FormatOptions,
318    ) -> fidl::client::QueryResponseFut<
319        ControllerFormatResult,
320        fidl::encoding::DefaultFuchsiaResourceDialect,
321    > {
322        ControllerProxyInterface::r#format(self, device, name, options)
323    }
324
325    /// Checks the consistency of the filesystem formatted on
326    /// the block device
327    pub fn r#check(
328        &self,
329        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
330        mut name: &str,
331    ) -> fidl::client::QueryResponseFut<
332        ControllerCheckResult,
333        fidl::encoding::DefaultFuchsiaResourceDialect,
334    > {
335        ControllerProxyInterface::r#check(self, device, name)
336    }
337}
338
339impl ControllerProxyInterface for ControllerProxy {
340    type MountResponseFut = fidl::client::QueryResponseFut<
341        ControllerMountResult,
342        fidl::encoding::DefaultFuchsiaResourceDialect,
343    >;
344    fn r#mount(
345        &self,
346        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
347        mut name: &str,
348        mut options: MountOptions,
349    ) -> Self::MountResponseFut {
350        fn _decode(
351            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
352        ) -> Result<ControllerMountResult, fidl::Error> {
353            let _response = fidl::client::decode_transaction_body::<
354                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
355                fidl::encoding::DefaultFuchsiaResourceDialect,
356                0x49300213a51ec7f7,
357            >(_buf?)?;
358            Ok(_response.map(|x| x))
359        }
360        self.client.send_query_and_decode::<ControllerMountRequest, ControllerMountResult>(
361            (device, name, &mut options),
362            0x49300213a51ec7f7,
363            fidl::encoding::DynamicFlags::empty(),
364            _decode,
365        )
366    }
367
368    type UnmountResponseFut = fidl::client::QueryResponseFut<
369        ControllerUnmountResult,
370        fidl::encoding::DefaultFuchsiaResourceDialect,
371    >;
372    fn r#unmount(&self, mut name: &str) -> Self::UnmountResponseFut {
373        fn _decode(
374            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
375        ) -> Result<ControllerUnmountResult, fidl::Error> {
376            let _response = fidl::client::decode_transaction_body::<
377                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
378                fidl::encoding::DefaultFuchsiaResourceDialect,
379                0x2d994ee1a9364179,
380            >(_buf?)?;
381            Ok(_response.map(|x| x))
382        }
383        self.client.send_query_and_decode::<ControllerUnmountRequest, ControllerUnmountResult>(
384            (name,),
385            0x2d994ee1a9364179,
386            fidl::encoding::DynamicFlags::empty(),
387            _decode,
388        )
389    }
390
391    type FormatResponseFut = fidl::client::QueryResponseFut<
392        ControllerFormatResult,
393        fidl::encoding::DefaultFuchsiaResourceDialect,
394    >;
395    fn r#format(
396        &self,
397        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
398        mut name: &str,
399        mut options: FormatOptions,
400    ) -> Self::FormatResponseFut {
401        fn _decode(
402            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
403        ) -> Result<ControllerFormatResult, fidl::Error> {
404            let _response = fidl::client::decode_transaction_body::<
405                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
406                fidl::encoding::DefaultFuchsiaResourceDialect,
407                0x52ce219e43664bf0,
408            >(_buf?)?;
409            Ok(_response.map(|x| x))
410        }
411        self.client.send_query_and_decode::<ControllerFormatRequest, ControllerFormatResult>(
412            (device, name, &mut options),
413            0x52ce219e43664bf0,
414            fidl::encoding::DynamicFlags::empty(),
415            _decode,
416        )
417    }
418
419    type CheckResponseFut = fidl::client::QueryResponseFut<
420        ControllerCheckResult,
421        fidl::encoding::DefaultFuchsiaResourceDialect,
422    >;
423    fn r#check(
424        &self,
425        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
426        mut name: &str,
427    ) -> Self::CheckResponseFut {
428        fn _decode(
429            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
430        ) -> Result<ControllerCheckResult, fidl::Error> {
431            let _response = fidl::client::decode_transaction_body::<
432                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
433                fidl::encoding::DefaultFuchsiaResourceDialect,
434                0x20d3ff7c33a9b863,
435            >(_buf?)?;
436            Ok(_response.map(|x| x))
437        }
438        self.client.send_query_and_decode::<ControllerCheckRequest, ControllerCheckResult>(
439            (device, name),
440            0x20d3ff7c33a9b863,
441            fidl::encoding::DynamicFlags::empty(),
442            _decode,
443        )
444    }
445}
446
447pub struct ControllerEventStream {
448    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
449}
450
451impl std::marker::Unpin for ControllerEventStream {}
452
453impl futures::stream::FusedStream for ControllerEventStream {
454    fn is_terminated(&self) -> bool {
455        self.event_receiver.is_terminated()
456    }
457}
458
459impl futures::Stream for ControllerEventStream {
460    type Item = Result<ControllerEvent, fidl::Error>;
461
462    fn poll_next(
463        mut self: std::pin::Pin<&mut Self>,
464        cx: &mut std::task::Context<'_>,
465    ) -> std::task::Poll<Option<Self::Item>> {
466        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
467            &mut self.event_receiver,
468            cx
469        )?) {
470            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
471            None => std::task::Poll::Ready(None),
472        }
473    }
474}
475
476#[derive(Debug)]
477pub enum ControllerEvent {}
478
479impl ControllerEvent {
480    /// Decodes a message buffer as a [`ControllerEvent`].
481    fn decode(
482        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
483    ) -> Result<ControllerEvent, fidl::Error> {
484        let (bytes, _handles) = buf.split_mut();
485        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
486        debug_assert_eq!(tx_header.tx_id, 0);
487        match tx_header.ordinal {
488            _ => Err(fidl::Error::UnknownOrdinal {
489                ordinal: tx_header.ordinal,
490                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
491            }),
492        }
493    }
494}
495
496/// A Stream of incoming requests for fuchsia.fs.realm/Controller.
497pub struct ControllerRequestStream {
498    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
499    is_terminated: bool,
500}
501
502impl std::marker::Unpin for ControllerRequestStream {}
503
504impl futures::stream::FusedStream for ControllerRequestStream {
505    fn is_terminated(&self) -> bool {
506        self.is_terminated
507    }
508}
509
510impl fidl::endpoints::RequestStream for ControllerRequestStream {
511    type Protocol = ControllerMarker;
512    type ControlHandle = ControllerControlHandle;
513
514    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
515        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
516    }
517
518    fn control_handle(&self) -> Self::ControlHandle {
519        ControllerControlHandle { inner: self.inner.clone() }
520    }
521
522    fn into_inner(
523        self,
524    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
525    {
526        (self.inner, self.is_terminated)
527    }
528
529    fn from_inner(
530        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
531        is_terminated: bool,
532    ) -> Self {
533        Self { inner, is_terminated }
534    }
535}
536
537impl futures::Stream for ControllerRequestStream {
538    type Item = Result<ControllerRequest, fidl::Error>;
539
540    fn poll_next(
541        mut self: std::pin::Pin<&mut Self>,
542        cx: &mut std::task::Context<'_>,
543    ) -> std::task::Poll<Option<Self::Item>> {
544        let this = &mut *self;
545        if this.inner.check_shutdown(cx) {
546            this.is_terminated = true;
547            return std::task::Poll::Ready(None);
548        }
549        if this.is_terminated {
550            panic!("polled ControllerRequestStream after completion");
551        }
552        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
553            |bytes, handles| {
554                match this.inner.channel().read_etc(cx, bytes, handles) {
555                    std::task::Poll::Ready(Ok(())) => {}
556                    std::task::Poll::Pending => return std::task::Poll::Pending,
557                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
558                        this.is_terminated = true;
559                        return std::task::Poll::Ready(None);
560                    }
561                    std::task::Poll::Ready(Err(e)) => {
562                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
563                            e.into(),
564                        ))));
565                    }
566                }
567
568                // A message has been received from the channel
569                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
570
571                std::task::Poll::Ready(Some(match header.ordinal {
572                    0x49300213a51ec7f7 => {
573                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
574                        let mut req = fidl::new_empty!(
575                            ControllerMountRequest,
576                            fidl::encoding::DefaultFuchsiaResourceDialect
577                        );
578                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerMountRequest>(&header, _body_bytes, handles, &mut req)?;
579                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
580                        Ok(ControllerRequest::Mount {
581                            device: req.device,
582                            name: req.name,
583                            options: req.options,
584
585                            responder: ControllerMountResponder {
586                                control_handle: std::mem::ManuallyDrop::new(control_handle),
587                                tx_id: header.tx_id,
588                            },
589                        })
590                    }
591                    0x2d994ee1a9364179 => {
592                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
593                        let mut req = fidl::new_empty!(
594                            ControllerUnmountRequest,
595                            fidl::encoding::DefaultFuchsiaResourceDialect
596                        );
597                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerUnmountRequest>(&header, _body_bytes, handles, &mut req)?;
598                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
599                        Ok(ControllerRequest::Unmount {
600                            name: req.name,
601
602                            responder: ControllerUnmountResponder {
603                                control_handle: std::mem::ManuallyDrop::new(control_handle),
604                                tx_id: header.tx_id,
605                            },
606                        })
607                    }
608                    0x52ce219e43664bf0 => {
609                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
610                        let mut req = fidl::new_empty!(
611                            ControllerFormatRequest,
612                            fidl::encoding::DefaultFuchsiaResourceDialect
613                        );
614                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerFormatRequest>(&header, _body_bytes, handles, &mut req)?;
615                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
616                        Ok(ControllerRequest::Format {
617                            device: req.device,
618                            name: req.name,
619                            options: req.options,
620
621                            responder: ControllerFormatResponder {
622                                control_handle: std::mem::ManuallyDrop::new(control_handle),
623                                tx_id: header.tx_id,
624                            },
625                        })
626                    }
627                    0x20d3ff7c33a9b863 => {
628                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
629                        let mut req = fidl::new_empty!(
630                            ControllerCheckRequest,
631                            fidl::encoding::DefaultFuchsiaResourceDialect
632                        );
633                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerCheckRequest>(&header, _body_bytes, handles, &mut req)?;
634                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
635                        Ok(ControllerRequest::Check {
636                            device: req.device,
637                            name: req.name,
638
639                            responder: ControllerCheckResponder {
640                                control_handle: std::mem::ManuallyDrop::new(control_handle),
641                                tx_id: header.tx_id,
642                            },
643                        })
644                    }
645                    _ => Err(fidl::Error::UnknownOrdinal {
646                        ordinal: header.ordinal,
647                        protocol_name:
648                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
649                    }),
650                }))
651            },
652        )
653    }
654}
655
656#[derive(Debug)]
657pub enum ControllerRequest {
658    /// Mounts a filesystem on a block device.
659    Mount {
660        device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
661        name: String,
662        options: MountOptions,
663        responder: ControllerMountResponder,
664    },
665    /// Unmounts a previously mounted filesystem.
666    Unmount { name: String, responder: ControllerUnmountResponder },
667    /// Formats a block device with a particular filesystem format
668    Format {
669        device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
670        name: String,
671        options: FormatOptions,
672        responder: ControllerFormatResponder,
673    },
674    /// Checks the consistency of the filesystem formatted on
675    /// the block device
676    Check {
677        device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
678        name: String,
679        responder: ControllerCheckResponder,
680    },
681}
682
683impl ControllerRequest {
684    #[allow(irrefutable_let_patterns)]
685    pub fn into_mount(
686        self,
687    ) -> Option<(
688        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
689        String,
690        MountOptions,
691        ControllerMountResponder,
692    )> {
693        if let ControllerRequest::Mount { device, name, options, responder } = self {
694            Some((device, name, options, responder))
695        } else {
696            None
697        }
698    }
699
700    #[allow(irrefutable_let_patterns)]
701    pub fn into_unmount(self) -> Option<(String, ControllerUnmountResponder)> {
702        if let ControllerRequest::Unmount { name, responder } = self {
703            Some((name, responder))
704        } else {
705            None
706        }
707    }
708
709    #[allow(irrefutable_let_patterns)]
710    pub fn into_format(
711        self,
712    ) -> Option<(
713        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
714        String,
715        FormatOptions,
716        ControllerFormatResponder,
717    )> {
718        if let ControllerRequest::Format { device, name, options, responder } = self {
719            Some((device, name, options, responder))
720        } else {
721            None
722        }
723    }
724
725    #[allow(irrefutable_let_patterns)]
726    pub fn into_check(
727        self,
728    ) -> Option<(
729        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
730        String,
731        ControllerCheckResponder,
732    )> {
733        if let ControllerRequest::Check { device, name, responder } = self {
734            Some((device, name, responder))
735        } else {
736            None
737        }
738    }
739
740    /// Name of the method defined in FIDL
741    pub fn method_name(&self) -> &'static str {
742        match *self {
743            ControllerRequest::Mount { .. } => "mount",
744            ControllerRequest::Unmount { .. } => "unmount",
745            ControllerRequest::Format { .. } => "format",
746            ControllerRequest::Check { .. } => "check",
747        }
748    }
749}
750
751#[derive(Debug, Clone)]
752pub struct ControllerControlHandle {
753    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
754}
755
756impl fidl::endpoints::ControlHandle for ControllerControlHandle {
757    fn shutdown(&self) {
758        self.inner.shutdown()
759    }
760
761    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
762        self.inner.shutdown_with_epitaph(status)
763    }
764
765    fn is_closed(&self) -> bool {
766        self.inner.channel().is_closed()
767    }
768    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
769        self.inner.channel().on_closed()
770    }
771
772    #[cfg(target_os = "fuchsia")]
773    fn signal_peer(
774        &self,
775        clear_mask: zx::Signals,
776        set_mask: zx::Signals,
777    ) -> Result<(), zx_status::Status> {
778        use fidl::Peered;
779        self.inner.channel().signal_peer(clear_mask, set_mask)
780    }
781}
782
783impl ControllerControlHandle {}
784
785#[must_use = "FIDL methods require a response to be sent"]
786#[derive(Debug)]
787pub struct ControllerMountResponder {
788    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
789    tx_id: u32,
790}
791
792/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
793/// if the responder is dropped without sending a response, so that the client
794/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
795impl std::ops::Drop for ControllerMountResponder {
796    fn drop(&mut self) {
797        self.control_handle.shutdown();
798        // Safety: drops once, never accessed again
799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
800    }
801}
802
803impl fidl::endpoints::Responder for ControllerMountResponder {
804    type ControlHandle = ControllerControlHandle;
805
806    fn control_handle(&self) -> &ControllerControlHandle {
807        &self.control_handle
808    }
809
810    fn drop_without_shutdown(mut self) {
811        // Safety: drops once, never accessed again due to mem::forget
812        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
813        // Prevent Drop from running (which would shut down the channel)
814        std::mem::forget(self);
815    }
816}
817
818impl ControllerMountResponder {
819    /// Sends a response to the FIDL transaction.
820    ///
821    /// Sets the channel to shutdown if an error occurs.
822    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
823        let _result = self.send_raw(result);
824        if _result.is_err() {
825            self.control_handle.shutdown();
826        }
827        self.drop_without_shutdown();
828        _result
829    }
830
831    /// Similar to "send" but does not shutdown the channel if an error occurs.
832    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
833        let _result = self.send_raw(result);
834        self.drop_without_shutdown();
835        _result
836    }
837
838    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
839        self.control_handle
840            .inner
841            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
842                result,
843                self.tx_id,
844                0x49300213a51ec7f7,
845                fidl::encoding::DynamicFlags::empty(),
846            )
847    }
848}
849
850#[must_use = "FIDL methods require a response to be sent"]
851#[derive(Debug)]
852pub struct ControllerUnmountResponder {
853    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
854    tx_id: u32,
855}
856
857/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
858/// if the responder is dropped without sending a response, so that the client
859/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
860impl std::ops::Drop for ControllerUnmountResponder {
861    fn drop(&mut self) {
862        self.control_handle.shutdown();
863        // Safety: drops once, never accessed again
864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
865    }
866}
867
868impl fidl::endpoints::Responder for ControllerUnmountResponder {
869    type ControlHandle = ControllerControlHandle;
870
871    fn control_handle(&self) -> &ControllerControlHandle {
872        &self.control_handle
873    }
874
875    fn drop_without_shutdown(mut self) {
876        // Safety: drops once, never accessed again due to mem::forget
877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
878        // Prevent Drop from running (which would shut down the channel)
879        std::mem::forget(self);
880    }
881}
882
883impl ControllerUnmountResponder {
884    /// Sends a response to the FIDL transaction.
885    ///
886    /// Sets the channel to shutdown if an error occurs.
887    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
888        let _result = self.send_raw(result);
889        if _result.is_err() {
890            self.control_handle.shutdown();
891        }
892        self.drop_without_shutdown();
893        _result
894    }
895
896    /// Similar to "send" but does not shutdown the channel if an error occurs.
897    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
898        let _result = self.send_raw(result);
899        self.drop_without_shutdown();
900        _result
901    }
902
903    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
904        self.control_handle
905            .inner
906            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
907                result,
908                self.tx_id,
909                0x2d994ee1a9364179,
910                fidl::encoding::DynamicFlags::empty(),
911            )
912    }
913}
914
915#[must_use = "FIDL methods require a response to be sent"]
916#[derive(Debug)]
917pub struct ControllerFormatResponder {
918    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
919    tx_id: u32,
920}
921
922/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
923/// if the responder is dropped without sending a response, so that the client
924/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
925impl std::ops::Drop for ControllerFormatResponder {
926    fn drop(&mut self) {
927        self.control_handle.shutdown();
928        // Safety: drops once, never accessed again
929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
930    }
931}
932
933impl fidl::endpoints::Responder for ControllerFormatResponder {
934    type ControlHandle = ControllerControlHandle;
935
936    fn control_handle(&self) -> &ControllerControlHandle {
937        &self.control_handle
938    }
939
940    fn drop_without_shutdown(mut self) {
941        // Safety: drops once, never accessed again due to mem::forget
942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
943        // Prevent Drop from running (which would shut down the channel)
944        std::mem::forget(self);
945    }
946}
947
948impl ControllerFormatResponder {
949    /// Sends a response to the FIDL transaction.
950    ///
951    /// Sets the channel to shutdown if an error occurs.
952    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
953        let _result = self.send_raw(result);
954        if _result.is_err() {
955            self.control_handle.shutdown();
956        }
957        self.drop_without_shutdown();
958        _result
959    }
960
961    /// Similar to "send" but does not shutdown the channel if an error occurs.
962    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
963        let _result = self.send_raw(result);
964        self.drop_without_shutdown();
965        _result
966    }
967
968    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
969        self.control_handle
970            .inner
971            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
972                result,
973                self.tx_id,
974                0x52ce219e43664bf0,
975                fidl::encoding::DynamicFlags::empty(),
976            )
977    }
978}
979
980#[must_use = "FIDL methods require a response to be sent"]
981#[derive(Debug)]
982pub struct ControllerCheckResponder {
983    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
984    tx_id: u32,
985}
986
987/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
988/// if the responder is dropped without sending a response, so that the client
989/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
990impl std::ops::Drop for ControllerCheckResponder {
991    fn drop(&mut self) {
992        self.control_handle.shutdown();
993        // Safety: drops once, never accessed again
994        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
995    }
996}
997
998impl fidl::endpoints::Responder for ControllerCheckResponder {
999    type ControlHandle = ControllerControlHandle;
1000
1001    fn control_handle(&self) -> &ControllerControlHandle {
1002        &self.control_handle
1003    }
1004
1005    fn drop_without_shutdown(mut self) {
1006        // Safety: drops once, never accessed again due to mem::forget
1007        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1008        // Prevent Drop from running (which would shut down the channel)
1009        std::mem::forget(self);
1010    }
1011}
1012
1013impl ControllerCheckResponder {
1014    /// Sends a response to the FIDL transaction.
1015    ///
1016    /// Sets the channel to shutdown if an error occurs.
1017    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1018        let _result = self.send_raw(result);
1019        if _result.is_err() {
1020            self.control_handle.shutdown();
1021        }
1022        self.drop_without_shutdown();
1023        _result
1024    }
1025
1026    /// Similar to "send" but does not shutdown the channel if an error occurs.
1027    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1028        let _result = self.send_raw(result);
1029        self.drop_without_shutdown();
1030        _result
1031    }
1032
1033    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1034        self.control_handle
1035            .inner
1036            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1037                result,
1038                self.tx_id,
1039                0x20d3ff7c33a9b863,
1040                fidl::encoding::DynamicFlags::empty(),
1041            )
1042    }
1043}
1044
1045mod internal {
1046    use super::*;
1047
1048    impl fidl::encoding::ResourceTypeMarker for ControllerCheckRequest {
1049        type Borrowed<'a> = &'a mut Self;
1050        fn take_or_borrow<'a>(
1051            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1052        ) -> Self::Borrowed<'a> {
1053            value
1054        }
1055    }
1056
1057    unsafe impl fidl::encoding::TypeMarker for ControllerCheckRequest {
1058        type Owned = Self;
1059
1060        #[inline(always)]
1061        fn inline_align(_context: fidl::encoding::Context) -> usize {
1062            8
1063        }
1064
1065        #[inline(always)]
1066        fn inline_size(_context: fidl::encoding::Context) -> usize {
1067            24
1068        }
1069    }
1070
1071    unsafe impl
1072        fidl::encoding::Encode<
1073            ControllerCheckRequest,
1074            fidl::encoding::DefaultFuchsiaResourceDialect,
1075        > for &mut ControllerCheckRequest
1076    {
1077        #[inline]
1078        unsafe fn encode(
1079            self,
1080            encoder: &mut fidl::encoding::Encoder<
1081                '_,
1082                fidl::encoding::DefaultFuchsiaResourceDialect,
1083            >,
1084            offset: usize,
1085            _depth: fidl::encoding::Depth,
1086        ) -> fidl::Result<()> {
1087            encoder.debug_check_bounds::<ControllerCheckRequest>(offset);
1088            // Delegate to tuple encoding.
1089            fidl::encoding::Encode::<
1090                ControllerCheckRequest,
1091                fidl::encoding::DefaultFuchsiaResourceDialect,
1092            >::encode(
1093                (
1094                    <fidl::encoding::Endpoint<
1095                        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1096                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1097                        &mut self.device
1098                    ),
1099                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1100                        &self.name,
1101                    ),
1102                ),
1103                encoder,
1104                offset,
1105                _depth,
1106            )
1107        }
1108    }
1109    unsafe impl<
1110        T0: fidl::encoding::Encode<
1111                fidl::encoding::Endpoint<
1112                    fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1113                >,
1114                fidl::encoding::DefaultFuchsiaResourceDialect,
1115            >,
1116        T1: fidl::encoding::Encode<
1117                fidl::encoding::BoundedString<255>,
1118                fidl::encoding::DefaultFuchsiaResourceDialect,
1119            >,
1120    >
1121        fidl::encoding::Encode<
1122            ControllerCheckRequest,
1123            fidl::encoding::DefaultFuchsiaResourceDialect,
1124        > for (T0, T1)
1125    {
1126        #[inline]
1127        unsafe fn encode(
1128            self,
1129            encoder: &mut fidl::encoding::Encoder<
1130                '_,
1131                fidl::encoding::DefaultFuchsiaResourceDialect,
1132            >,
1133            offset: usize,
1134            depth: fidl::encoding::Depth,
1135        ) -> fidl::Result<()> {
1136            encoder.debug_check_bounds::<ControllerCheckRequest>(offset);
1137            // Zero out padding regions. There's no need to apply masks
1138            // because the unmasked parts will be overwritten by fields.
1139            unsafe {
1140                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1141                (ptr as *mut u64).write_unaligned(0);
1142            }
1143            // Write the fields.
1144            self.0.encode(encoder, offset + 0, depth)?;
1145            self.1.encode(encoder, offset + 8, depth)?;
1146            Ok(())
1147        }
1148    }
1149
1150    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1151        for ControllerCheckRequest
1152    {
1153        #[inline(always)]
1154        fn new_empty() -> Self {
1155            Self {
1156                device: fidl::new_empty!(
1157                    fidl::encoding::Endpoint<
1158                        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1159                    >,
1160                    fidl::encoding::DefaultFuchsiaResourceDialect
1161                ),
1162                name: fidl::new_empty!(
1163                    fidl::encoding::BoundedString<255>,
1164                    fidl::encoding::DefaultFuchsiaResourceDialect
1165                ),
1166            }
1167        }
1168
1169        #[inline]
1170        unsafe fn decode(
1171            &mut self,
1172            decoder: &mut fidl::encoding::Decoder<
1173                '_,
1174                fidl::encoding::DefaultFuchsiaResourceDialect,
1175            >,
1176            offset: usize,
1177            _depth: fidl::encoding::Depth,
1178        ) -> fidl::Result<()> {
1179            decoder.debug_check_bounds::<Self>(offset);
1180            // Verify that padding bytes are zero.
1181            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1182            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1183            let mask = 0xffffffff00000000u64;
1184            let maskedval = padval & mask;
1185            if maskedval != 0 {
1186                return Err(fidl::Error::NonZeroPadding {
1187                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1188                });
1189            }
1190            fidl::decode!(
1191                fidl::encoding::Endpoint<
1192                    fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1193                >,
1194                fidl::encoding::DefaultFuchsiaResourceDialect,
1195                &mut self.device,
1196                decoder,
1197                offset + 0,
1198                _depth
1199            )?;
1200            fidl::decode!(
1201                fidl::encoding::BoundedString<255>,
1202                fidl::encoding::DefaultFuchsiaResourceDialect,
1203                &mut self.name,
1204                decoder,
1205                offset + 8,
1206                _depth
1207            )?;
1208            Ok(())
1209        }
1210    }
1211
1212    impl fidl::encoding::ResourceTypeMarker for ControllerFormatRequest {
1213        type Borrowed<'a> = &'a mut Self;
1214        fn take_or_borrow<'a>(
1215            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1216        ) -> Self::Borrowed<'a> {
1217            value
1218        }
1219    }
1220
1221    unsafe impl fidl::encoding::TypeMarker for ControllerFormatRequest {
1222        type Owned = Self;
1223
1224        #[inline(always)]
1225        fn inline_align(_context: fidl::encoding::Context) -> usize {
1226            8
1227        }
1228
1229        #[inline(always)]
1230        fn inline_size(_context: fidl::encoding::Context) -> usize {
1231            40
1232        }
1233    }
1234
1235    unsafe impl
1236        fidl::encoding::Encode<
1237            ControllerFormatRequest,
1238            fidl::encoding::DefaultFuchsiaResourceDialect,
1239        > for &mut ControllerFormatRequest
1240    {
1241        #[inline]
1242        unsafe fn encode(
1243            self,
1244            encoder: &mut fidl::encoding::Encoder<
1245                '_,
1246                fidl::encoding::DefaultFuchsiaResourceDialect,
1247            >,
1248            offset: usize,
1249            _depth: fidl::encoding::Depth,
1250        ) -> fidl::Result<()> {
1251            encoder.debug_check_bounds::<ControllerFormatRequest>(offset);
1252            // Delegate to tuple encoding.
1253            fidl::encoding::Encode::<
1254                ControllerFormatRequest,
1255                fidl::encoding::DefaultFuchsiaResourceDialect,
1256            >::encode(
1257                (
1258                    <fidl::encoding::Endpoint<
1259                        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1260                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1261                        &mut self.device
1262                    ),
1263                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1264                        &self.name,
1265                    ),
1266                    <FormatOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1267                        &mut self.options,
1268                    ),
1269                ),
1270                encoder,
1271                offset,
1272                _depth,
1273            )
1274        }
1275    }
1276    unsafe impl<
1277        T0: fidl::encoding::Encode<
1278                fidl::encoding::Endpoint<
1279                    fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1280                >,
1281                fidl::encoding::DefaultFuchsiaResourceDialect,
1282            >,
1283        T1: fidl::encoding::Encode<
1284                fidl::encoding::BoundedString<255>,
1285                fidl::encoding::DefaultFuchsiaResourceDialect,
1286            >,
1287        T2: fidl::encoding::Encode<FormatOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1288    >
1289        fidl::encoding::Encode<
1290            ControllerFormatRequest,
1291            fidl::encoding::DefaultFuchsiaResourceDialect,
1292        > for (T0, T1, T2)
1293    {
1294        #[inline]
1295        unsafe fn encode(
1296            self,
1297            encoder: &mut fidl::encoding::Encoder<
1298                '_,
1299                fidl::encoding::DefaultFuchsiaResourceDialect,
1300            >,
1301            offset: usize,
1302            depth: fidl::encoding::Depth,
1303        ) -> fidl::Result<()> {
1304            encoder.debug_check_bounds::<ControllerFormatRequest>(offset);
1305            // Zero out padding regions. There's no need to apply masks
1306            // because the unmasked parts will be overwritten by fields.
1307            unsafe {
1308                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1309                (ptr as *mut u64).write_unaligned(0);
1310            }
1311            // Write the fields.
1312            self.0.encode(encoder, offset + 0, depth)?;
1313            self.1.encode(encoder, offset + 8, depth)?;
1314            self.2.encode(encoder, offset + 24, depth)?;
1315            Ok(())
1316        }
1317    }
1318
1319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1320        for ControllerFormatRequest
1321    {
1322        #[inline(always)]
1323        fn new_empty() -> Self {
1324            Self {
1325                device: fidl::new_empty!(
1326                    fidl::encoding::Endpoint<
1327                        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1328                    >,
1329                    fidl::encoding::DefaultFuchsiaResourceDialect
1330                ),
1331                name: fidl::new_empty!(
1332                    fidl::encoding::BoundedString<255>,
1333                    fidl::encoding::DefaultFuchsiaResourceDialect
1334                ),
1335                options: fidl::new_empty!(
1336                    FormatOptions,
1337                    fidl::encoding::DefaultFuchsiaResourceDialect
1338                ),
1339            }
1340        }
1341
1342        #[inline]
1343        unsafe fn decode(
1344            &mut self,
1345            decoder: &mut fidl::encoding::Decoder<
1346                '_,
1347                fidl::encoding::DefaultFuchsiaResourceDialect,
1348            >,
1349            offset: usize,
1350            _depth: fidl::encoding::Depth,
1351        ) -> fidl::Result<()> {
1352            decoder.debug_check_bounds::<Self>(offset);
1353            // Verify that padding bytes are zero.
1354            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1355            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1356            let mask = 0xffffffff00000000u64;
1357            let maskedval = padval & mask;
1358            if maskedval != 0 {
1359                return Err(fidl::Error::NonZeroPadding {
1360                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1361                });
1362            }
1363            fidl::decode!(
1364                fidl::encoding::Endpoint<
1365                    fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1366                >,
1367                fidl::encoding::DefaultFuchsiaResourceDialect,
1368                &mut self.device,
1369                decoder,
1370                offset + 0,
1371                _depth
1372            )?;
1373            fidl::decode!(
1374                fidl::encoding::BoundedString<255>,
1375                fidl::encoding::DefaultFuchsiaResourceDialect,
1376                &mut self.name,
1377                decoder,
1378                offset + 8,
1379                _depth
1380            )?;
1381            fidl::decode!(
1382                FormatOptions,
1383                fidl::encoding::DefaultFuchsiaResourceDialect,
1384                &mut self.options,
1385                decoder,
1386                offset + 24,
1387                _depth
1388            )?;
1389            Ok(())
1390        }
1391    }
1392
1393    impl fidl::encoding::ResourceTypeMarker for ControllerMountRequest {
1394        type Borrowed<'a> = &'a mut Self;
1395        fn take_or_borrow<'a>(
1396            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1397        ) -> Self::Borrowed<'a> {
1398            value
1399        }
1400    }
1401
1402    unsafe impl fidl::encoding::TypeMarker for ControllerMountRequest {
1403        type Owned = Self;
1404
1405        #[inline(always)]
1406        fn inline_align(_context: fidl::encoding::Context) -> usize {
1407            8
1408        }
1409
1410        #[inline(always)]
1411        fn inline_size(_context: fidl::encoding::Context) -> usize {
1412            40
1413        }
1414    }
1415
1416    unsafe impl
1417        fidl::encoding::Encode<
1418            ControllerMountRequest,
1419            fidl::encoding::DefaultFuchsiaResourceDialect,
1420        > for &mut ControllerMountRequest
1421    {
1422        #[inline]
1423        unsafe fn encode(
1424            self,
1425            encoder: &mut fidl::encoding::Encoder<
1426                '_,
1427                fidl::encoding::DefaultFuchsiaResourceDialect,
1428            >,
1429            offset: usize,
1430            _depth: fidl::encoding::Depth,
1431        ) -> fidl::Result<()> {
1432            encoder.debug_check_bounds::<ControllerMountRequest>(offset);
1433            // Delegate to tuple encoding.
1434            fidl::encoding::Encode::<
1435                ControllerMountRequest,
1436                fidl::encoding::DefaultFuchsiaResourceDialect,
1437            >::encode(
1438                (
1439                    <fidl::encoding::Endpoint<
1440                        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1441                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1442                        &mut self.device
1443                    ),
1444                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1445                        &self.name,
1446                    ),
1447                    <MountOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1448                        &mut self.options,
1449                    ),
1450                ),
1451                encoder,
1452                offset,
1453                _depth,
1454            )
1455        }
1456    }
1457    unsafe impl<
1458        T0: fidl::encoding::Encode<
1459                fidl::encoding::Endpoint<
1460                    fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1461                >,
1462                fidl::encoding::DefaultFuchsiaResourceDialect,
1463            >,
1464        T1: fidl::encoding::Encode<
1465                fidl::encoding::BoundedString<255>,
1466                fidl::encoding::DefaultFuchsiaResourceDialect,
1467            >,
1468        T2: fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1469    >
1470        fidl::encoding::Encode<
1471            ControllerMountRequest,
1472            fidl::encoding::DefaultFuchsiaResourceDialect,
1473        > for (T0, T1, T2)
1474    {
1475        #[inline]
1476        unsafe fn encode(
1477            self,
1478            encoder: &mut fidl::encoding::Encoder<
1479                '_,
1480                fidl::encoding::DefaultFuchsiaResourceDialect,
1481            >,
1482            offset: usize,
1483            depth: fidl::encoding::Depth,
1484        ) -> fidl::Result<()> {
1485            encoder.debug_check_bounds::<ControllerMountRequest>(offset);
1486            // Zero out padding regions. There's no need to apply masks
1487            // because the unmasked parts will be overwritten by fields.
1488            unsafe {
1489                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1490                (ptr as *mut u64).write_unaligned(0);
1491            }
1492            // Write the fields.
1493            self.0.encode(encoder, offset + 0, depth)?;
1494            self.1.encode(encoder, offset + 8, depth)?;
1495            self.2.encode(encoder, offset + 24, depth)?;
1496            Ok(())
1497        }
1498    }
1499
1500    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1501        for ControllerMountRequest
1502    {
1503        #[inline(always)]
1504        fn new_empty() -> Self {
1505            Self {
1506                device: fidl::new_empty!(
1507                    fidl::encoding::Endpoint<
1508                        fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1509                    >,
1510                    fidl::encoding::DefaultFuchsiaResourceDialect
1511                ),
1512                name: fidl::new_empty!(
1513                    fidl::encoding::BoundedString<255>,
1514                    fidl::encoding::DefaultFuchsiaResourceDialect
1515                ),
1516                options: fidl::new_empty!(
1517                    MountOptions,
1518                    fidl::encoding::DefaultFuchsiaResourceDialect
1519                ),
1520            }
1521        }
1522
1523        #[inline]
1524        unsafe fn decode(
1525            &mut self,
1526            decoder: &mut fidl::encoding::Decoder<
1527                '_,
1528                fidl::encoding::DefaultFuchsiaResourceDialect,
1529            >,
1530            offset: usize,
1531            _depth: fidl::encoding::Depth,
1532        ) -> fidl::Result<()> {
1533            decoder.debug_check_bounds::<Self>(offset);
1534            // Verify that padding bytes are zero.
1535            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1536            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1537            let mask = 0xffffffff00000000u64;
1538            let maskedval = padval & mask;
1539            if maskedval != 0 {
1540                return Err(fidl::Error::NonZeroPadding {
1541                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1542                });
1543            }
1544            fidl::decode!(
1545                fidl::encoding::Endpoint<
1546                    fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1547                >,
1548                fidl::encoding::DefaultFuchsiaResourceDialect,
1549                &mut self.device,
1550                decoder,
1551                offset + 0,
1552                _depth
1553            )?;
1554            fidl::decode!(
1555                fidl::encoding::BoundedString<255>,
1556                fidl::encoding::DefaultFuchsiaResourceDialect,
1557                &mut self.name,
1558                decoder,
1559                offset + 8,
1560                _depth
1561            )?;
1562            fidl::decode!(
1563                MountOptions,
1564                fidl::encoding::DefaultFuchsiaResourceDialect,
1565                &mut self.options,
1566                decoder,
1567                offset + 24,
1568                _depth
1569            )?;
1570            Ok(())
1571        }
1572    }
1573
1574    impl FormatOptions {
1575        #[inline(always)]
1576        fn max_ordinal_present(&self) -> u64 {
1577            if let Some(_) = self.fvm_data_slices {
1578                return 2;
1579            }
1580            if let Some(_) = self.verbose {
1581                return 1;
1582            }
1583            0
1584        }
1585    }
1586
1587    impl fidl::encoding::ResourceTypeMarker for FormatOptions {
1588        type Borrowed<'a> = &'a mut Self;
1589        fn take_or_borrow<'a>(
1590            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1591        ) -> Self::Borrowed<'a> {
1592            value
1593        }
1594    }
1595
1596    unsafe impl fidl::encoding::TypeMarker for FormatOptions {
1597        type Owned = Self;
1598
1599        #[inline(always)]
1600        fn inline_align(_context: fidl::encoding::Context) -> usize {
1601            8
1602        }
1603
1604        #[inline(always)]
1605        fn inline_size(_context: fidl::encoding::Context) -> usize {
1606            16
1607        }
1608    }
1609
1610    unsafe impl fidl::encoding::Encode<FormatOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1611        for &mut FormatOptions
1612    {
1613        unsafe fn encode(
1614            self,
1615            encoder: &mut fidl::encoding::Encoder<
1616                '_,
1617                fidl::encoding::DefaultFuchsiaResourceDialect,
1618            >,
1619            offset: usize,
1620            mut depth: fidl::encoding::Depth,
1621        ) -> fidl::Result<()> {
1622            encoder.debug_check_bounds::<FormatOptions>(offset);
1623            // Vector header
1624            let max_ordinal: u64 = self.max_ordinal_present();
1625            encoder.write_num(max_ordinal, offset);
1626            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1627            // Calling encoder.out_of_line_offset(0) is not allowed.
1628            if max_ordinal == 0 {
1629                return Ok(());
1630            }
1631            depth.increment()?;
1632            let envelope_size = 8;
1633            let bytes_len = max_ordinal as usize * envelope_size;
1634            #[allow(unused_variables)]
1635            let offset = encoder.out_of_line_offset(bytes_len);
1636            let mut _prev_end_offset: usize = 0;
1637            if 1 > max_ordinal {
1638                return Ok(());
1639            }
1640
1641            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1642            // are envelope_size bytes.
1643            let cur_offset: usize = (1 - 1) * envelope_size;
1644
1645            // Zero reserved fields.
1646            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1647
1648            // Safety:
1649            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1650            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1651            //   envelope_size bytes, there is always sufficient room.
1652            fidl::encoding::encode_in_envelope_optional::<
1653                bool,
1654                fidl::encoding::DefaultFuchsiaResourceDialect,
1655            >(
1656                self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1657                encoder,
1658                offset + cur_offset,
1659                depth,
1660            )?;
1661
1662            _prev_end_offset = cur_offset + envelope_size;
1663            if 2 > max_ordinal {
1664                return Ok(());
1665            }
1666
1667            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1668            // are envelope_size bytes.
1669            let cur_offset: usize = (2 - 1) * envelope_size;
1670
1671            // Zero reserved fields.
1672            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1673
1674            // Safety:
1675            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1676            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1677            //   envelope_size bytes, there is always sufficient room.
1678            fidl::encoding::encode_in_envelope_optional::<
1679                u32,
1680                fidl::encoding::DefaultFuchsiaResourceDialect,
1681            >(
1682                self.fvm_data_slices.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1683                encoder,
1684                offset + cur_offset,
1685                depth,
1686            )?;
1687
1688            _prev_end_offset = cur_offset + envelope_size;
1689
1690            Ok(())
1691        }
1692    }
1693
1694    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FormatOptions {
1695        #[inline(always)]
1696        fn new_empty() -> Self {
1697            Self::default()
1698        }
1699
1700        unsafe fn decode(
1701            &mut self,
1702            decoder: &mut fidl::encoding::Decoder<
1703                '_,
1704                fidl::encoding::DefaultFuchsiaResourceDialect,
1705            >,
1706            offset: usize,
1707            mut depth: fidl::encoding::Depth,
1708        ) -> fidl::Result<()> {
1709            decoder.debug_check_bounds::<Self>(offset);
1710            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1711                None => return Err(fidl::Error::NotNullable),
1712                Some(len) => len,
1713            };
1714            // Calling decoder.out_of_line_offset(0) is not allowed.
1715            if len == 0 {
1716                return Ok(());
1717            };
1718            depth.increment()?;
1719            let envelope_size = 8;
1720            let bytes_len = len * envelope_size;
1721            let offset = decoder.out_of_line_offset(bytes_len)?;
1722            // Decode the envelope for each type.
1723            let mut _next_ordinal_to_read = 0;
1724            let mut next_offset = offset;
1725            let end_offset = offset + bytes_len;
1726            _next_ordinal_to_read += 1;
1727            if next_offset >= end_offset {
1728                return Ok(());
1729            }
1730
1731            // Decode unknown envelopes for gaps in ordinals.
1732            while _next_ordinal_to_read < 1 {
1733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1734                _next_ordinal_to_read += 1;
1735                next_offset += envelope_size;
1736            }
1737
1738            let next_out_of_line = decoder.next_out_of_line();
1739            let handles_before = decoder.remaining_handles();
1740            if let Some((inlined, num_bytes, num_handles)) =
1741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1742            {
1743                let member_inline_size =
1744                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1745                if inlined != (member_inline_size <= 4) {
1746                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1747                }
1748                let inner_offset;
1749                let mut inner_depth = depth.clone();
1750                if inlined {
1751                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1752                    inner_offset = next_offset;
1753                } else {
1754                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1755                    inner_depth.increment()?;
1756                }
1757                let val_ref = self.verbose.get_or_insert_with(|| {
1758                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1759                });
1760                fidl::decode!(
1761                    bool,
1762                    fidl::encoding::DefaultFuchsiaResourceDialect,
1763                    val_ref,
1764                    decoder,
1765                    inner_offset,
1766                    inner_depth
1767                )?;
1768                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1769                {
1770                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1771                }
1772                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1773                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1774                }
1775            }
1776
1777            next_offset += envelope_size;
1778            _next_ordinal_to_read += 1;
1779            if next_offset >= end_offset {
1780                return Ok(());
1781            }
1782
1783            // Decode unknown envelopes for gaps in ordinals.
1784            while _next_ordinal_to_read < 2 {
1785                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1786                _next_ordinal_to_read += 1;
1787                next_offset += envelope_size;
1788            }
1789
1790            let next_out_of_line = decoder.next_out_of_line();
1791            let handles_before = decoder.remaining_handles();
1792            if let Some((inlined, num_bytes, num_handles)) =
1793                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1794            {
1795                let member_inline_size =
1796                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1797                if inlined != (member_inline_size <= 4) {
1798                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1799                }
1800                let inner_offset;
1801                let mut inner_depth = depth.clone();
1802                if inlined {
1803                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1804                    inner_offset = next_offset;
1805                } else {
1806                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1807                    inner_depth.increment()?;
1808                }
1809                let val_ref = self.fvm_data_slices.get_or_insert_with(|| {
1810                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1811                });
1812                fidl::decode!(
1813                    u32,
1814                    fidl::encoding::DefaultFuchsiaResourceDialect,
1815                    val_ref,
1816                    decoder,
1817                    inner_offset,
1818                    inner_depth
1819                )?;
1820                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1821                {
1822                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1823                }
1824                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1825                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1826                }
1827            }
1828
1829            next_offset += envelope_size;
1830
1831            // Decode the remaining unknown envelopes.
1832            while next_offset < end_offset {
1833                _next_ordinal_to_read += 1;
1834                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1835                next_offset += envelope_size;
1836            }
1837
1838            Ok(())
1839        }
1840    }
1841
1842    impl MountOptions {
1843        #[inline(always)]
1844        fn max_ordinal_present(&self) -> u64 {
1845            if let Some(_) = self.verbose {
1846                return 2;
1847            }
1848            if let Some(_) = self.read_only {
1849                return 1;
1850            }
1851            0
1852        }
1853    }
1854
1855    impl fidl::encoding::ResourceTypeMarker for MountOptions {
1856        type Borrowed<'a> = &'a mut Self;
1857        fn take_or_borrow<'a>(
1858            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1859        ) -> Self::Borrowed<'a> {
1860            value
1861        }
1862    }
1863
1864    unsafe impl fidl::encoding::TypeMarker for MountOptions {
1865        type Owned = Self;
1866
1867        #[inline(always)]
1868        fn inline_align(_context: fidl::encoding::Context) -> usize {
1869            8
1870        }
1871
1872        #[inline(always)]
1873        fn inline_size(_context: fidl::encoding::Context) -> usize {
1874            16
1875        }
1876    }
1877
1878    unsafe impl fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1879        for &mut MountOptions
1880    {
1881        unsafe fn encode(
1882            self,
1883            encoder: &mut fidl::encoding::Encoder<
1884                '_,
1885                fidl::encoding::DefaultFuchsiaResourceDialect,
1886            >,
1887            offset: usize,
1888            mut depth: fidl::encoding::Depth,
1889        ) -> fidl::Result<()> {
1890            encoder.debug_check_bounds::<MountOptions>(offset);
1891            // Vector header
1892            let max_ordinal: u64 = self.max_ordinal_present();
1893            encoder.write_num(max_ordinal, offset);
1894            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1895            // Calling encoder.out_of_line_offset(0) is not allowed.
1896            if max_ordinal == 0 {
1897                return Ok(());
1898            }
1899            depth.increment()?;
1900            let envelope_size = 8;
1901            let bytes_len = max_ordinal as usize * envelope_size;
1902            #[allow(unused_variables)]
1903            let offset = encoder.out_of_line_offset(bytes_len);
1904            let mut _prev_end_offset: usize = 0;
1905            if 1 > max_ordinal {
1906                return Ok(());
1907            }
1908
1909            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1910            // are envelope_size bytes.
1911            let cur_offset: usize = (1 - 1) * envelope_size;
1912
1913            // Zero reserved fields.
1914            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1915
1916            // Safety:
1917            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1918            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1919            //   envelope_size bytes, there is always sufficient room.
1920            fidl::encoding::encode_in_envelope_optional::<
1921                bool,
1922                fidl::encoding::DefaultFuchsiaResourceDialect,
1923            >(
1924                self.read_only.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1925                encoder,
1926                offset + cur_offset,
1927                depth,
1928            )?;
1929
1930            _prev_end_offset = cur_offset + envelope_size;
1931            if 2 > max_ordinal {
1932                return Ok(());
1933            }
1934
1935            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1936            // are envelope_size bytes.
1937            let cur_offset: usize = (2 - 1) * envelope_size;
1938
1939            // Zero reserved fields.
1940            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1941
1942            // Safety:
1943            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1944            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1945            //   envelope_size bytes, there is always sufficient room.
1946            fidl::encoding::encode_in_envelope_optional::<
1947                bool,
1948                fidl::encoding::DefaultFuchsiaResourceDialect,
1949            >(
1950                self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1951                encoder,
1952                offset + cur_offset,
1953                depth,
1954            )?;
1955
1956            _prev_end_offset = cur_offset + envelope_size;
1957
1958            Ok(())
1959        }
1960    }
1961
1962    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {
1963        #[inline(always)]
1964        fn new_empty() -> Self {
1965            Self::default()
1966        }
1967
1968        unsafe fn decode(
1969            &mut self,
1970            decoder: &mut fidl::encoding::Decoder<
1971                '_,
1972                fidl::encoding::DefaultFuchsiaResourceDialect,
1973            >,
1974            offset: usize,
1975            mut depth: fidl::encoding::Depth,
1976        ) -> fidl::Result<()> {
1977            decoder.debug_check_bounds::<Self>(offset);
1978            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1979                None => return Err(fidl::Error::NotNullable),
1980                Some(len) => len,
1981            };
1982            // Calling decoder.out_of_line_offset(0) is not allowed.
1983            if len == 0 {
1984                return Ok(());
1985            };
1986            depth.increment()?;
1987            let envelope_size = 8;
1988            let bytes_len = len * envelope_size;
1989            let offset = decoder.out_of_line_offset(bytes_len)?;
1990            // Decode the envelope for each type.
1991            let mut _next_ordinal_to_read = 0;
1992            let mut next_offset = offset;
1993            let end_offset = offset + bytes_len;
1994            _next_ordinal_to_read += 1;
1995            if next_offset >= end_offset {
1996                return Ok(());
1997            }
1998
1999            // Decode unknown envelopes for gaps in ordinals.
2000            while _next_ordinal_to_read < 1 {
2001                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2002                _next_ordinal_to_read += 1;
2003                next_offset += envelope_size;
2004            }
2005
2006            let next_out_of_line = decoder.next_out_of_line();
2007            let handles_before = decoder.remaining_handles();
2008            if let Some((inlined, num_bytes, num_handles)) =
2009                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2010            {
2011                let member_inline_size =
2012                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2013                if inlined != (member_inline_size <= 4) {
2014                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2015                }
2016                let inner_offset;
2017                let mut inner_depth = depth.clone();
2018                if inlined {
2019                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2020                    inner_offset = next_offset;
2021                } else {
2022                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2023                    inner_depth.increment()?;
2024                }
2025                let val_ref = self.read_only.get_or_insert_with(|| {
2026                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2027                });
2028                fidl::decode!(
2029                    bool,
2030                    fidl::encoding::DefaultFuchsiaResourceDialect,
2031                    val_ref,
2032                    decoder,
2033                    inner_offset,
2034                    inner_depth
2035                )?;
2036                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2037                {
2038                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2039                }
2040                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2041                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2042                }
2043            }
2044
2045            next_offset += envelope_size;
2046            _next_ordinal_to_read += 1;
2047            if next_offset >= end_offset {
2048                return Ok(());
2049            }
2050
2051            // Decode unknown envelopes for gaps in ordinals.
2052            while _next_ordinal_to_read < 2 {
2053                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2054                _next_ordinal_to_read += 1;
2055                next_offset += envelope_size;
2056            }
2057
2058            let next_out_of_line = decoder.next_out_of_line();
2059            let handles_before = decoder.remaining_handles();
2060            if let Some((inlined, num_bytes, num_handles)) =
2061                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2062            {
2063                let member_inline_size =
2064                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2065                if inlined != (member_inline_size <= 4) {
2066                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2067                }
2068                let inner_offset;
2069                let mut inner_depth = depth.clone();
2070                if inlined {
2071                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2072                    inner_offset = next_offset;
2073                } else {
2074                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2075                    inner_depth.increment()?;
2076                }
2077                let val_ref = self.verbose.get_or_insert_with(|| {
2078                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2079                });
2080                fidl::decode!(
2081                    bool,
2082                    fidl::encoding::DefaultFuchsiaResourceDialect,
2083                    val_ref,
2084                    decoder,
2085                    inner_offset,
2086                    inner_depth
2087                )?;
2088                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2089                {
2090                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2091                }
2092                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2093                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2094                }
2095            }
2096
2097            next_offset += envelope_size;
2098
2099            // Decode the remaining unknown envelopes.
2100            while next_offset < end_offset {
2101                _next_ordinal_to_read += 1;
2102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2103                next_offset += envelope_size;
2104            }
2105
2106            Ok(())
2107        }
2108    }
2109}