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