fidl_fuchsia_fshost/
fidl_fuchsia_fshost.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_fshost__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct RecoveryMountSystemBlobVolumeRequest {
16    pub blob_exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for RecoveryMountSystemBlobVolumeRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct RecoveryWriteDataFileRequest {
26    pub filename: String,
27    pub payload: fidl::Vmo,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for RecoveryWriteDataFileRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct RecoveryWriteSystemBlobImageRequest {
37    pub payload: fidl::Vmo,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for RecoveryWriteSystemBlobImageRequest
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct StarnixVolumeProviderCreateRequest {
47    pub crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
48    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52    for StarnixVolumeProviderCreateRequest
53{
54}
55
56#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct StarnixVolumeProviderMountRequest {
58    pub crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
59    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63    for StarnixVolumeProviderMountRequest
64{
65}
66
67#[derive(Debug, Default, PartialEq)]
68pub struct MountOptions {
69    pub read_only: Option<bool>,
70    /// [DEPRECATED] Metrics are always enabled now.
71    pub collect_metrics: Option<bool>,
72    pub verbose: Option<bool>,
73    pub write_compression_algorithm: Option<String>,
74    #[doc(hidden)]
75    pub __source_breaking: fidl::marker::SourceBreaking,
76}
77
78impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {}
79
80#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
81pub struct AdminMarker;
82
83impl fidl::endpoints::ProtocolMarker for AdminMarker {
84    type Proxy = AdminProxy;
85    type RequestStream = AdminRequestStream;
86    #[cfg(target_os = "fuchsia")]
87    type SynchronousProxy = AdminSynchronousProxy;
88
89    const DEBUG_NAME: &'static str = "fuchsia.fshost.Admin";
90}
91impl fidl::endpoints::DiscoverableProtocolMarker for AdminMarker {}
92pub type AdminShredDataVolumeResult = Result<(), i32>;
93
94pub trait AdminProxyInterface: Send + Sync {
95    type ShredDataVolumeResponseFut: std::future::Future<Output = Result<AdminShredDataVolumeResult, fidl::Error>>
96        + Send;
97    fn r#shred_data_volume(&self) -> Self::ShredDataVolumeResponseFut;
98    type StorageHostEnabledResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
99        + Send;
100    fn r#storage_host_enabled(&self) -> Self::StorageHostEnabledResponseFut;
101}
102#[derive(Debug)]
103#[cfg(target_os = "fuchsia")]
104pub struct AdminSynchronousProxy {
105    client: fidl::client::sync::Client,
106}
107
108#[cfg(target_os = "fuchsia")]
109impl fidl::endpoints::SynchronousProxy for AdminSynchronousProxy {
110    type Proxy = AdminProxy;
111    type Protocol = AdminMarker;
112
113    fn from_channel(inner: fidl::Channel) -> Self {
114        Self::new(inner)
115    }
116
117    fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    fn as_channel(&self) -> &fidl::Channel {
122        self.client.as_channel()
123    }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl AdminSynchronousProxy {
128    pub fn new(channel: fidl::Channel) -> Self {
129        let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
130        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
131    }
132
133    pub fn into_channel(self) -> fidl::Channel {
134        self.client.into_channel()
135    }
136
137    /// Waits until an event arrives and returns it. It is safe for other
138    /// threads to make concurrent requests while waiting for an event.
139    pub fn wait_for_event(
140        &self,
141        deadline: zx::MonotonicInstant,
142    ) -> Result<AdminEvent, fidl::Error> {
143        AdminEvent::decode(self.client.wait_for_event(deadline)?)
144    }
145
146    /// Wipes the data volume which will get reinitialised upon next boot.  This is not
147    /// cryptographically secure; the caller should take care to reset hardware keys.
148    pub fn r#shred_data_volume(
149        &self,
150        ___deadline: zx::MonotonicInstant,
151    ) -> Result<AdminShredDataVolumeResult, fidl::Error> {
152        let _response = self.client.send_query::<
153            fidl::encoding::EmptyPayload,
154            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
155        >(
156            (),
157            0xb0d6c2e95343a10,
158            fidl::encoding::DynamicFlags::empty(),
159            ___deadline,
160        )?;
161        Ok(_response.map(|x| x))
162    }
163
164    /// Returns whether fshost is configured to use storage-host.
165    pub fn r#storage_host_enabled(
166        &self,
167        ___deadline: zx::MonotonicInstant,
168    ) -> Result<bool, fidl::Error> {
169        let _response = self
170            .client
171            .send_query::<fidl::encoding::EmptyPayload, AdminStorageHostEnabledResponse>(
172                (),
173                0x5934b6527ec49a35,
174                fidl::encoding::DynamicFlags::empty(),
175                ___deadline,
176            )?;
177        Ok(_response.enabled)
178    }
179}
180
181#[cfg(target_os = "fuchsia")]
182impl From<AdminSynchronousProxy> for zx::Handle {
183    fn from(value: AdminSynchronousProxy) -> Self {
184        value.into_channel().into()
185    }
186}
187
188#[cfg(target_os = "fuchsia")]
189impl From<fidl::Channel> for AdminSynchronousProxy {
190    fn from(value: fidl::Channel) -> Self {
191        Self::new(value)
192    }
193}
194
195#[cfg(target_os = "fuchsia")]
196impl fidl::endpoints::FromClient for AdminSynchronousProxy {
197    type Protocol = AdminMarker;
198
199    fn from_client(value: fidl::endpoints::ClientEnd<AdminMarker>) -> Self {
200        Self::new(value.into_channel())
201    }
202}
203
204#[derive(Debug, Clone)]
205pub struct AdminProxy {
206    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
207}
208
209impl fidl::endpoints::Proxy for AdminProxy {
210    type Protocol = AdminMarker;
211
212    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
213        Self::new(inner)
214    }
215
216    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
217        self.client.into_channel().map_err(|client| Self { client })
218    }
219
220    fn as_channel(&self) -> &::fidl::AsyncChannel {
221        self.client.as_channel()
222    }
223}
224
225impl AdminProxy {
226    /// Create a new Proxy for fuchsia.fshost/Admin.
227    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
228        let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
229        Self { client: fidl::client::Client::new(channel, protocol_name) }
230    }
231
232    /// Get a Stream of events from the remote end of the protocol.
233    ///
234    /// # Panics
235    ///
236    /// Panics if the event stream was already taken.
237    pub fn take_event_stream(&self) -> AdminEventStream {
238        AdminEventStream { event_receiver: self.client.take_event_receiver() }
239    }
240
241    /// Wipes the data volume which will get reinitialised upon next boot.  This is not
242    /// cryptographically secure; the caller should take care to reset hardware keys.
243    pub fn r#shred_data_volume(
244        &self,
245    ) -> fidl::client::QueryResponseFut<
246        AdminShredDataVolumeResult,
247        fidl::encoding::DefaultFuchsiaResourceDialect,
248    > {
249        AdminProxyInterface::r#shred_data_volume(self)
250    }
251
252    /// Returns whether fshost is configured to use storage-host.
253    pub fn r#storage_host_enabled(
254        &self,
255    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
256        AdminProxyInterface::r#storage_host_enabled(self)
257    }
258}
259
260impl AdminProxyInterface for AdminProxy {
261    type ShredDataVolumeResponseFut = fidl::client::QueryResponseFut<
262        AdminShredDataVolumeResult,
263        fidl::encoding::DefaultFuchsiaResourceDialect,
264    >;
265    fn r#shred_data_volume(&self) -> Self::ShredDataVolumeResponseFut {
266        fn _decode(
267            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
268        ) -> Result<AdminShredDataVolumeResult, fidl::Error> {
269            let _response = fidl::client::decode_transaction_body::<
270                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
271                fidl::encoding::DefaultFuchsiaResourceDialect,
272                0xb0d6c2e95343a10,
273            >(_buf?)?;
274            Ok(_response.map(|x| x))
275        }
276        self.client
277            .send_query_and_decode::<fidl::encoding::EmptyPayload, AdminShredDataVolumeResult>(
278                (),
279                0xb0d6c2e95343a10,
280                fidl::encoding::DynamicFlags::empty(),
281                _decode,
282            )
283    }
284
285    type StorageHostEnabledResponseFut =
286        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
287    fn r#storage_host_enabled(&self) -> Self::StorageHostEnabledResponseFut {
288        fn _decode(
289            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
290        ) -> Result<bool, fidl::Error> {
291            let _response = fidl::client::decode_transaction_body::<
292                AdminStorageHostEnabledResponse,
293                fidl::encoding::DefaultFuchsiaResourceDialect,
294                0x5934b6527ec49a35,
295            >(_buf?)?;
296            Ok(_response.enabled)
297        }
298        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
299            (),
300            0x5934b6527ec49a35,
301            fidl::encoding::DynamicFlags::empty(),
302            _decode,
303        )
304    }
305}
306
307pub struct AdminEventStream {
308    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
309}
310
311impl std::marker::Unpin for AdminEventStream {}
312
313impl futures::stream::FusedStream for AdminEventStream {
314    fn is_terminated(&self) -> bool {
315        self.event_receiver.is_terminated()
316    }
317}
318
319impl futures::Stream for AdminEventStream {
320    type Item = Result<AdminEvent, fidl::Error>;
321
322    fn poll_next(
323        mut self: std::pin::Pin<&mut Self>,
324        cx: &mut std::task::Context<'_>,
325    ) -> std::task::Poll<Option<Self::Item>> {
326        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
327            &mut self.event_receiver,
328            cx
329        )?) {
330            Some(buf) => std::task::Poll::Ready(Some(AdminEvent::decode(buf))),
331            None => std::task::Poll::Ready(None),
332        }
333    }
334}
335
336#[derive(Debug)]
337pub enum AdminEvent {}
338
339impl AdminEvent {
340    /// Decodes a message buffer as a [`AdminEvent`].
341    fn decode(
342        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
343    ) -> Result<AdminEvent, fidl::Error> {
344        let (bytes, _handles) = buf.split_mut();
345        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
346        debug_assert_eq!(tx_header.tx_id, 0);
347        match tx_header.ordinal {
348            _ => Err(fidl::Error::UnknownOrdinal {
349                ordinal: tx_header.ordinal,
350                protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
351            }),
352        }
353    }
354}
355
356/// A Stream of incoming requests for fuchsia.fshost/Admin.
357pub struct AdminRequestStream {
358    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
359    is_terminated: bool,
360}
361
362impl std::marker::Unpin for AdminRequestStream {}
363
364impl futures::stream::FusedStream for AdminRequestStream {
365    fn is_terminated(&self) -> bool {
366        self.is_terminated
367    }
368}
369
370impl fidl::endpoints::RequestStream for AdminRequestStream {
371    type Protocol = AdminMarker;
372    type ControlHandle = AdminControlHandle;
373
374    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
375        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
376    }
377
378    fn control_handle(&self) -> Self::ControlHandle {
379        AdminControlHandle { inner: self.inner.clone() }
380    }
381
382    fn into_inner(
383        self,
384    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
385    {
386        (self.inner, self.is_terminated)
387    }
388
389    fn from_inner(
390        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
391        is_terminated: bool,
392    ) -> Self {
393        Self { inner, is_terminated }
394    }
395}
396
397impl futures::Stream for AdminRequestStream {
398    type Item = Result<AdminRequest, fidl::Error>;
399
400    fn poll_next(
401        mut self: std::pin::Pin<&mut Self>,
402        cx: &mut std::task::Context<'_>,
403    ) -> std::task::Poll<Option<Self::Item>> {
404        let this = &mut *self;
405        if this.inner.check_shutdown(cx) {
406            this.is_terminated = true;
407            return std::task::Poll::Ready(None);
408        }
409        if this.is_terminated {
410            panic!("polled AdminRequestStream after completion");
411        }
412        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
413            |bytes, handles| {
414                match this.inner.channel().read_etc(cx, bytes, handles) {
415                    std::task::Poll::Ready(Ok(())) => {}
416                    std::task::Poll::Pending => return std::task::Poll::Pending,
417                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
418                        this.is_terminated = true;
419                        return std::task::Poll::Ready(None);
420                    }
421                    std::task::Poll::Ready(Err(e)) => {
422                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
423                            e.into(),
424                        ))));
425                    }
426                }
427
428                // A message has been received from the channel
429                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
430
431                std::task::Poll::Ready(Some(match header.ordinal {
432                    0xb0d6c2e95343a10 => {
433                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
434                        let mut req = fidl::new_empty!(
435                            fidl::encoding::EmptyPayload,
436                            fidl::encoding::DefaultFuchsiaResourceDialect
437                        );
438                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
439                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
440                        Ok(AdminRequest::ShredDataVolume {
441                            responder: AdminShredDataVolumeResponder {
442                                control_handle: std::mem::ManuallyDrop::new(control_handle),
443                                tx_id: header.tx_id,
444                            },
445                        })
446                    }
447                    0x5934b6527ec49a35 => {
448                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
449                        let mut req = fidl::new_empty!(
450                            fidl::encoding::EmptyPayload,
451                            fidl::encoding::DefaultFuchsiaResourceDialect
452                        );
453                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
454                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
455                        Ok(AdminRequest::StorageHostEnabled {
456                            responder: AdminStorageHostEnabledResponder {
457                                control_handle: std::mem::ManuallyDrop::new(control_handle),
458                                tx_id: header.tx_id,
459                            },
460                        })
461                    }
462                    _ => Err(fidl::Error::UnknownOrdinal {
463                        ordinal: header.ordinal,
464                        protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
465                    }),
466                }))
467            },
468        )
469    }
470}
471
472/// Manages fshost lifecycle
473#[derive(Debug)]
474pub enum AdminRequest {
475    /// Wipes the data volume which will get reinitialised upon next boot.  This is not
476    /// cryptographically secure; the caller should take care to reset hardware keys.
477    ShredDataVolume { responder: AdminShredDataVolumeResponder },
478    /// Returns whether fshost is configured to use storage-host.
479    StorageHostEnabled { responder: AdminStorageHostEnabledResponder },
480}
481
482impl AdminRequest {
483    #[allow(irrefutable_let_patterns)]
484    pub fn into_shred_data_volume(self) -> Option<(AdminShredDataVolumeResponder)> {
485        if let AdminRequest::ShredDataVolume { responder } = self {
486            Some((responder))
487        } else {
488            None
489        }
490    }
491
492    #[allow(irrefutable_let_patterns)]
493    pub fn into_storage_host_enabled(self) -> Option<(AdminStorageHostEnabledResponder)> {
494        if let AdminRequest::StorageHostEnabled { responder } = self {
495            Some((responder))
496        } else {
497            None
498        }
499    }
500
501    /// Name of the method defined in FIDL
502    pub fn method_name(&self) -> &'static str {
503        match *self {
504            AdminRequest::ShredDataVolume { .. } => "shred_data_volume",
505            AdminRequest::StorageHostEnabled { .. } => "storage_host_enabled",
506        }
507    }
508}
509
510#[derive(Debug, Clone)]
511pub struct AdminControlHandle {
512    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
513}
514
515impl fidl::endpoints::ControlHandle for AdminControlHandle {
516    fn shutdown(&self) {
517        self.inner.shutdown()
518    }
519    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
520        self.inner.shutdown_with_epitaph(status)
521    }
522
523    fn is_closed(&self) -> bool {
524        self.inner.channel().is_closed()
525    }
526    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
527        self.inner.channel().on_closed()
528    }
529
530    #[cfg(target_os = "fuchsia")]
531    fn signal_peer(
532        &self,
533        clear_mask: zx::Signals,
534        set_mask: zx::Signals,
535    ) -> Result<(), zx_status::Status> {
536        use fidl::Peered;
537        self.inner.channel().signal_peer(clear_mask, set_mask)
538    }
539}
540
541impl AdminControlHandle {}
542
543#[must_use = "FIDL methods require a response to be sent"]
544#[derive(Debug)]
545pub struct AdminShredDataVolumeResponder {
546    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
547    tx_id: u32,
548}
549
550/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
551/// if the responder is dropped without sending a response, so that the client
552/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
553impl std::ops::Drop for AdminShredDataVolumeResponder {
554    fn drop(&mut self) {
555        self.control_handle.shutdown();
556        // Safety: drops once, never accessed again
557        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
558    }
559}
560
561impl fidl::endpoints::Responder for AdminShredDataVolumeResponder {
562    type ControlHandle = AdminControlHandle;
563
564    fn control_handle(&self) -> &AdminControlHandle {
565        &self.control_handle
566    }
567
568    fn drop_without_shutdown(mut self) {
569        // Safety: drops once, never accessed again due to mem::forget
570        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
571        // Prevent Drop from running (which would shut down the channel)
572        std::mem::forget(self);
573    }
574}
575
576impl AdminShredDataVolumeResponder {
577    /// Sends a response to the FIDL transaction.
578    ///
579    /// Sets the channel to shutdown if an error occurs.
580    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
581        let _result = self.send_raw(result);
582        if _result.is_err() {
583            self.control_handle.shutdown();
584        }
585        self.drop_without_shutdown();
586        _result
587    }
588
589    /// Similar to "send" but does not shutdown the channel if an error occurs.
590    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
591        let _result = self.send_raw(result);
592        self.drop_without_shutdown();
593        _result
594    }
595
596    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
597        self.control_handle
598            .inner
599            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
600                result,
601                self.tx_id,
602                0xb0d6c2e95343a10,
603                fidl::encoding::DynamicFlags::empty(),
604            )
605    }
606}
607
608#[must_use = "FIDL methods require a response to be sent"]
609#[derive(Debug)]
610pub struct AdminStorageHostEnabledResponder {
611    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
612    tx_id: u32,
613}
614
615/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
616/// if the responder is dropped without sending a response, so that the client
617/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
618impl std::ops::Drop for AdminStorageHostEnabledResponder {
619    fn drop(&mut self) {
620        self.control_handle.shutdown();
621        // Safety: drops once, never accessed again
622        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
623    }
624}
625
626impl fidl::endpoints::Responder for AdminStorageHostEnabledResponder {
627    type ControlHandle = AdminControlHandle;
628
629    fn control_handle(&self) -> &AdminControlHandle {
630        &self.control_handle
631    }
632
633    fn drop_without_shutdown(mut self) {
634        // Safety: drops once, never accessed again due to mem::forget
635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
636        // Prevent Drop from running (which would shut down the channel)
637        std::mem::forget(self);
638    }
639}
640
641impl AdminStorageHostEnabledResponder {
642    /// Sends a response to the FIDL transaction.
643    ///
644    /// Sets the channel to shutdown if an error occurs.
645    pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
646        let _result = self.send_raw(enabled);
647        if _result.is_err() {
648            self.control_handle.shutdown();
649        }
650        self.drop_without_shutdown();
651        _result
652    }
653
654    /// Similar to "send" but does not shutdown the channel if an error occurs.
655    pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
656        let _result = self.send_raw(enabled);
657        self.drop_without_shutdown();
658        _result
659    }
660
661    fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
662        self.control_handle.inner.send::<AdminStorageHostEnabledResponse>(
663            (enabled,),
664            self.tx_id,
665            0x5934b6527ec49a35,
666            fidl::encoding::DynamicFlags::empty(),
667        )
668    }
669}
670
671#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
672pub struct RecoveryMarker;
673
674impl fidl::endpoints::ProtocolMarker for RecoveryMarker {
675    type Proxy = RecoveryProxy;
676    type RequestStream = RecoveryRequestStream;
677    #[cfg(target_os = "fuchsia")]
678    type SynchronousProxy = RecoverySynchronousProxy;
679
680    const DEBUG_NAME: &'static str = "fuchsia.fshost.Recovery";
681}
682impl fidl::endpoints::DiscoverableProtocolMarker for RecoveryMarker {}
683pub type RecoveryInitSystemPartitionTableResult = Result<(), i32>;
684pub type RecoveryWriteDataFileResult = Result<(), i32>;
685pub type RecoveryFormatSystemBlobVolumeResult = Result<(), i32>;
686pub type RecoveryMountSystemBlobVolumeResult = Result<(), i32>;
687pub type RecoveryWriteSystemBlobImageResult = Result<(), i32>;
688pub type RecoveryInstallSystemBlobImageResult = Result<(), i32>;
689
690pub trait RecoveryProxyInterface: Send + Sync {
691    type InitSystemPartitionTableResponseFut: std::future::Future<Output = Result<RecoveryInitSystemPartitionTableResult, fidl::Error>>
692        + Send;
693    fn r#init_system_partition_table(
694        &self,
695        partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
696    ) -> Self::InitSystemPartitionTableResponseFut;
697    type WriteDataFileResponseFut: std::future::Future<Output = Result<RecoveryWriteDataFileResult, fidl::Error>>
698        + Send;
699    fn r#write_data_file(
700        &self,
701        filename: &str,
702        payload: fidl::Vmo,
703    ) -> Self::WriteDataFileResponseFut;
704    type FormatSystemBlobVolumeResponseFut: std::future::Future<Output = Result<RecoveryFormatSystemBlobVolumeResult, fidl::Error>>
705        + Send;
706    fn r#format_system_blob_volume(&self) -> Self::FormatSystemBlobVolumeResponseFut;
707    type MountSystemBlobVolumeResponseFut: std::future::Future<Output = Result<RecoveryMountSystemBlobVolumeResult, fidl::Error>>
708        + Send;
709    fn r#mount_system_blob_volume(
710        &self,
711        blob_exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
712    ) -> Self::MountSystemBlobVolumeResponseFut;
713    type WriteSystemBlobImageResponseFut: std::future::Future<Output = Result<RecoveryWriteSystemBlobImageResult, fidl::Error>>
714        + Send;
715    fn r#write_system_blob_image(
716        &self,
717        payload: fidl::Vmo,
718    ) -> Self::WriteSystemBlobImageResponseFut;
719    type InstallSystemBlobImageResponseFut: std::future::Future<Output = Result<RecoveryInstallSystemBlobImageResult, fidl::Error>>
720        + Send;
721    fn r#install_system_blob_image(&self) -> Self::InstallSystemBlobImageResponseFut;
722}
723#[derive(Debug)]
724#[cfg(target_os = "fuchsia")]
725pub struct RecoverySynchronousProxy {
726    client: fidl::client::sync::Client,
727}
728
729#[cfg(target_os = "fuchsia")]
730impl fidl::endpoints::SynchronousProxy for RecoverySynchronousProxy {
731    type Proxy = RecoveryProxy;
732    type Protocol = RecoveryMarker;
733
734    fn from_channel(inner: fidl::Channel) -> Self {
735        Self::new(inner)
736    }
737
738    fn into_channel(self) -> fidl::Channel {
739        self.client.into_channel()
740    }
741
742    fn as_channel(&self) -> &fidl::Channel {
743        self.client.as_channel()
744    }
745}
746
747#[cfg(target_os = "fuchsia")]
748impl RecoverySynchronousProxy {
749    pub fn new(channel: fidl::Channel) -> Self {
750        let protocol_name = <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
751        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
752    }
753
754    pub fn into_channel(self) -> fidl::Channel {
755        self.client.into_channel()
756    }
757
758    /// Waits until an event arrives and returns it. It is safe for other
759    /// threads to make concurrent requests while waiting for an event.
760    pub fn wait_for_event(
761        &self,
762        deadline: zx::MonotonicInstant,
763    ) -> Result<RecoveryEvent, fidl::Error> {
764        RecoveryEvent::decode(self.client.wait_for_event(deadline)?)
765    }
766
767    /// Wipes and re-initializes the system partition table.  This is a destructive operation!
768    pub fn r#init_system_partition_table(
769        &self,
770        mut partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
771        ___deadline: zx::MonotonicInstant,
772    ) -> Result<RecoveryInitSystemPartitionTableResult, fidl::Error> {
773        let _response = self.client.send_query::<
774            RecoveryInitSystemPartitionTableRequest,
775            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
776        >(
777            (partitions,),
778            0x3dcadcbb75e2330b,
779            fidl::encoding::DynamicFlags::empty(),
780            ___deadline,
781        )?;
782        Ok(_response.map(|x| x))
783    }
784
785    /// Writes `filename` into the data partition with contents from `payload`, formatting the data
786    /// partition if it isn't already formatted.  Overwrites file if it already exists.
787    ///
788    /// This can only be called while the data partition isn't already mounted, which is typically
789    /// in recovery builds where fshost is running with the `ramdisk_image` flag set.
790    pub fn r#write_data_file(
791        &self,
792        mut filename: &str,
793        mut payload: fidl::Vmo,
794        ___deadline: zx::MonotonicInstant,
795    ) -> Result<RecoveryWriteDataFileResult, fidl::Error> {
796        let _response = self.client.send_query::<
797            RecoveryWriteDataFileRequest,
798            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
799        >(
800            (filename, payload,),
801            0xd6cf7b3f57b418d,
802            fidl::encoding::DynamicFlags::empty(),
803            ___deadline,
804        )?;
805        Ok(_response.map(|x| x))
806    }
807
808    /// Formats the blob volume in the system container. If the system container does not have a
809    /// blob volume, a new one will be created. All existing blobs will be deleted. If the system
810    /// container is corrupt or unmountable, this function will have no effect and will leave the
811    /// disk intact.
812    ///
813    /// **WARNING**: This can cause irreversible data loss and can render a device unbootable.
814    pub fn r#format_system_blob_volume(
815        &self,
816        ___deadline: zx::MonotonicInstant,
817    ) -> Result<RecoveryFormatSystemBlobVolumeResult, fidl::Error> {
818        let _response = self.client.send_query::<
819            fidl::encoding::EmptyPayload,
820            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
821        >(
822            (),
823            0x4e93f6b198f61f7d,
824            fidl::encoding::DynamicFlags::empty(),
825            ___deadline,
826        )?;
827        Ok(_response.map(|x| x))
828    }
829
830    /// Mounts the system container's blob volume, and returns a handle to the blob volume's
831    /// exposed directory to facilitate writing a new system. The system container will remain
832    /// mounted as long as `blob_exposed_dir` is kept open. Only the blob volume will be mounted.
833    pub fn r#mount_system_blob_volume(
834        &self,
835        mut blob_exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
836        ___deadline: zx::MonotonicInstant,
837    ) -> Result<RecoveryMountSystemBlobVolumeResult, fidl::Error> {
838        let _response = self.client.send_query::<
839            RecoveryMountSystemBlobVolumeRequest,
840            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
841        >(
842            (blob_exposed_dir,),
843            0x63ddff4240e908c0,
844            fidl::encoding::DynamicFlags::empty(),
845            ___deadline,
846        )?;
847        Ok(_response.map(|x| x))
848    }
849
850    /// Writes `payload` to be installed as the blob volume in the system container. `payload` must
851    /// be a valid Android sparse image containing an fxfs partition image with a blob volume. This
852    /// method can be called multiple times to write multiple sparse images, usually targeting
853    /// different offsets, allowing very large images exceeding RAM to be written in chunks. The
854    /// existing blob volume will remain unmodified until `InstallSystemBlobVolume` is called.
855    pub fn r#write_system_blob_image(
856        &self,
857        mut payload: fidl::Vmo,
858        ___deadline: zx::MonotonicInstant,
859    ) -> Result<RecoveryWriteSystemBlobImageResult, fidl::Error> {
860        let _response = self.client.send_query::<
861            RecoveryWriteSystemBlobImageRequest,
862            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
863        >(
864            (payload,),
865            0x65751d7784fa3647,
866            fidl::encoding::DynamicFlags::empty(),
867            ___deadline,
868        )?;
869        Ok(_response.map(|x| x))
870    }
871
872    /// Installs the blob volume previously written via `WriteSystemBlobVolume`, replacing the
873    /// existing blob volume in the system container. On failure, the existing blob volume will
874    /// remain intact, and the written image will be deleted to free space. A new blob image can
875    /// then be written and the installation process restarted. If no blob volume has been written,
876    /// this will have no effect.
877    pub fn r#install_system_blob_image(
878        &self,
879        ___deadline: zx::MonotonicInstant,
880    ) -> Result<RecoveryInstallSystemBlobImageResult, fidl::Error> {
881        let _response = self.client.send_query::<
882            fidl::encoding::EmptyPayload,
883            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
884        >(
885            (),
886            0x311fc553a2a48b6,
887            fidl::encoding::DynamicFlags::empty(),
888            ___deadline,
889        )?;
890        Ok(_response.map(|x| x))
891    }
892}
893
894#[cfg(target_os = "fuchsia")]
895impl From<RecoverySynchronousProxy> for zx::Handle {
896    fn from(value: RecoverySynchronousProxy) -> Self {
897        value.into_channel().into()
898    }
899}
900
901#[cfg(target_os = "fuchsia")]
902impl From<fidl::Channel> for RecoverySynchronousProxy {
903    fn from(value: fidl::Channel) -> Self {
904        Self::new(value)
905    }
906}
907
908#[cfg(target_os = "fuchsia")]
909impl fidl::endpoints::FromClient for RecoverySynchronousProxy {
910    type Protocol = RecoveryMarker;
911
912    fn from_client(value: fidl::endpoints::ClientEnd<RecoveryMarker>) -> Self {
913        Self::new(value.into_channel())
914    }
915}
916
917#[derive(Debug, Clone)]
918pub struct RecoveryProxy {
919    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
920}
921
922impl fidl::endpoints::Proxy for RecoveryProxy {
923    type Protocol = RecoveryMarker;
924
925    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
926        Self::new(inner)
927    }
928
929    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
930        self.client.into_channel().map_err(|client| Self { client })
931    }
932
933    fn as_channel(&self) -> &::fidl::AsyncChannel {
934        self.client.as_channel()
935    }
936}
937
938impl RecoveryProxy {
939    /// Create a new Proxy for fuchsia.fshost/Recovery.
940    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
941        let protocol_name = <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
942        Self { client: fidl::client::Client::new(channel, protocol_name) }
943    }
944
945    /// Get a Stream of events from the remote end of the protocol.
946    ///
947    /// # Panics
948    ///
949    /// Panics if the event stream was already taken.
950    pub fn take_event_stream(&self) -> RecoveryEventStream {
951        RecoveryEventStream { event_receiver: self.client.take_event_receiver() }
952    }
953
954    /// Wipes and re-initializes the system partition table.  This is a destructive operation!
955    pub fn r#init_system_partition_table(
956        &self,
957        mut partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
958    ) -> fidl::client::QueryResponseFut<
959        RecoveryInitSystemPartitionTableResult,
960        fidl::encoding::DefaultFuchsiaResourceDialect,
961    > {
962        RecoveryProxyInterface::r#init_system_partition_table(self, partitions)
963    }
964
965    /// Writes `filename` into the data partition with contents from `payload`, formatting the data
966    /// partition if it isn't already formatted.  Overwrites file if it already exists.
967    ///
968    /// This can only be called while the data partition isn't already mounted, which is typically
969    /// in recovery builds where fshost is running with the `ramdisk_image` flag set.
970    pub fn r#write_data_file(
971        &self,
972        mut filename: &str,
973        mut payload: fidl::Vmo,
974    ) -> fidl::client::QueryResponseFut<
975        RecoveryWriteDataFileResult,
976        fidl::encoding::DefaultFuchsiaResourceDialect,
977    > {
978        RecoveryProxyInterface::r#write_data_file(self, filename, payload)
979    }
980
981    /// Formats the blob volume in the system container. If the system container does not have a
982    /// blob volume, a new one will be created. All existing blobs will be deleted. If the system
983    /// container is corrupt or unmountable, this function will have no effect and will leave the
984    /// disk intact.
985    ///
986    /// **WARNING**: This can cause irreversible data loss and can render a device unbootable.
987    pub fn r#format_system_blob_volume(
988        &self,
989    ) -> fidl::client::QueryResponseFut<
990        RecoveryFormatSystemBlobVolumeResult,
991        fidl::encoding::DefaultFuchsiaResourceDialect,
992    > {
993        RecoveryProxyInterface::r#format_system_blob_volume(self)
994    }
995
996    /// Mounts the system container's blob volume, and returns a handle to the blob volume's
997    /// exposed directory to facilitate writing a new system. The system container will remain
998    /// mounted as long as `blob_exposed_dir` is kept open. Only the blob volume will be mounted.
999    pub fn r#mount_system_blob_volume(
1000        &self,
1001        mut blob_exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1002    ) -> fidl::client::QueryResponseFut<
1003        RecoveryMountSystemBlobVolumeResult,
1004        fidl::encoding::DefaultFuchsiaResourceDialect,
1005    > {
1006        RecoveryProxyInterface::r#mount_system_blob_volume(self, blob_exposed_dir)
1007    }
1008
1009    /// Writes `payload` to be installed as the blob volume in the system container. `payload` must
1010    /// be a valid Android sparse image containing an fxfs partition image with a blob volume. This
1011    /// method can be called multiple times to write multiple sparse images, usually targeting
1012    /// different offsets, allowing very large images exceeding RAM to be written in chunks. The
1013    /// existing blob volume will remain unmodified until `InstallSystemBlobVolume` is called.
1014    pub fn r#write_system_blob_image(
1015        &self,
1016        mut payload: fidl::Vmo,
1017    ) -> fidl::client::QueryResponseFut<
1018        RecoveryWriteSystemBlobImageResult,
1019        fidl::encoding::DefaultFuchsiaResourceDialect,
1020    > {
1021        RecoveryProxyInterface::r#write_system_blob_image(self, payload)
1022    }
1023
1024    /// Installs the blob volume previously written via `WriteSystemBlobVolume`, replacing the
1025    /// existing blob volume in the system container. On failure, the existing blob volume will
1026    /// remain intact, and the written image will be deleted to free space. A new blob image can
1027    /// then be written and the installation process restarted. If no blob volume has been written,
1028    /// this will have no effect.
1029    pub fn r#install_system_blob_image(
1030        &self,
1031    ) -> fidl::client::QueryResponseFut<
1032        RecoveryInstallSystemBlobImageResult,
1033        fidl::encoding::DefaultFuchsiaResourceDialect,
1034    > {
1035        RecoveryProxyInterface::r#install_system_blob_image(self)
1036    }
1037}
1038
1039impl RecoveryProxyInterface for RecoveryProxy {
1040    type InitSystemPartitionTableResponseFut = fidl::client::QueryResponseFut<
1041        RecoveryInitSystemPartitionTableResult,
1042        fidl::encoding::DefaultFuchsiaResourceDialect,
1043    >;
1044    fn r#init_system_partition_table(
1045        &self,
1046        mut partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
1047    ) -> Self::InitSystemPartitionTableResponseFut {
1048        fn _decode(
1049            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1050        ) -> Result<RecoveryInitSystemPartitionTableResult, fidl::Error> {
1051            let _response = fidl::client::decode_transaction_body::<
1052                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1053                fidl::encoding::DefaultFuchsiaResourceDialect,
1054                0x3dcadcbb75e2330b,
1055            >(_buf?)?;
1056            Ok(_response.map(|x| x))
1057        }
1058        self.client.send_query_and_decode::<
1059            RecoveryInitSystemPartitionTableRequest,
1060            RecoveryInitSystemPartitionTableResult,
1061        >(
1062            (partitions,),
1063            0x3dcadcbb75e2330b,
1064            fidl::encoding::DynamicFlags::empty(),
1065            _decode,
1066        )
1067    }
1068
1069    type WriteDataFileResponseFut = fidl::client::QueryResponseFut<
1070        RecoveryWriteDataFileResult,
1071        fidl::encoding::DefaultFuchsiaResourceDialect,
1072    >;
1073    fn r#write_data_file(
1074        &self,
1075        mut filename: &str,
1076        mut payload: fidl::Vmo,
1077    ) -> Self::WriteDataFileResponseFut {
1078        fn _decode(
1079            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1080        ) -> Result<RecoveryWriteDataFileResult, fidl::Error> {
1081            let _response = fidl::client::decode_transaction_body::<
1082                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1083                fidl::encoding::DefaultFuchsiaResourceDialect,
1084                0xd6cf7b3f57b418d,
1085            >(_buf?)?;
1086            Ok(_response.map(|x| x))
1087        }
1088        self.client
1089            .send_query_and_decode::<RecoveryWriteDataFileRequest, RecoveryWriteDataFileResult>(
1090                (filename, payload),
1091                0xd6cf7b3f57b418d,
1092                fidl::encoding::DynamicFlags::empty(),
1093                _decode,
1094            )
1095    }
1096
1097    type FormatSystemBlobVolumeResponseFut = fidl::client::QueryResponseFut<
1098        RecoveryFormatSystemBlobVolumeResult,
1099        fidl::encoding::DefaultFuchsiaResourceDialect,
1100    >;
1101    fn r#format_system_blob_volume(&self) -> Self::FormatSystemBlobVolumeResponseFut {
1102        fn _decode(
1103            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1104        ) -> Result<RecoveryFormatSystemBlobVolumeResult, fidl::Error> {
1105            let _response = fidl::client::decode_transaction_body::<
1106                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1107                fidl::encoding::DefaultFuchsiaResourceDialect,
1108                0x4e93f6b198f61f7d,
1109            >(_buf?)?;
1110            Ok(_response.map(|x| x))
1111        }
1112        self.client.send_query_and_decode::<
1113            fidl::encoding::EmptyPayload,
1114            RecoveryFormatSystemBlobVolumeResult,
1115        >(
1116            (),
1117            0x4e93f6b198f61f7d,
1118            fidl::encoding::DynamicFlags::empty(),
1119            _decode,
1120        )
1121    }
1122
1123    type MountSystemBlobVolumeResponseFut = fidl::client::QueryResponseFut<
1124        RecoveryMountSystemBlobVolumeResult,
1125        fidl::encoding::DefaultFuchsiaResourceDialect,
1126    >;
1127    fn r#mount_system_blob_volume(
1128        &self,
1129        mut blob_exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1130    ) -> Self::MountSystemBlobVolumeResponseFut {
1131        fn _decode(
1132            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1133        ) -> Result<RecoveryMountSystemBlobVolumeResult, fidl::Error> {
1134            let _response = fidl::client::decode_transaction_body::<
1135                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1136                fidl::encoding::DefaultFuchsiaResourceDialect,
1137                0x63ddff4240e908c0,
1138            >(_buf?)?;
1139            Ok(_response.map(|x| x))
1140        }
1141        self.client.send_query_and_decode::<
1142            RecoveryMountSystemBlobVolumeRequest,
1143            RecoveryMountSystemBlobVolumeResult,
1144        >(
1145            (blob_exposed_dir,),
1146            0x63ddff4240e908c0,
1147            fidl::encoding::DynamicFlags::empty(),
1148            _decode,
1149        )
1150    }
1151
1152    type WriteSystemBlobImageResponseFut = fidl::client::QueryResponseFut<
1153        RecoveryWriteSystemBlobImageResult,
1154        fidl::encoding::DefaultFuchsiaResourceDialect,
1155    >;
1156    fn r#write_system_blob_image(
1157        &self,
1158        mut payload: fidl::Vmo,
1159    ) -> Self::WriteSystemBlobImageResponseFut {
1160        fn _decode(
1161            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1162        ) -> Result<RecoveryWriteSystemBlobImageResult, fidl::Error> {
1163            let _response = fidl::client::decode_transaction_body::<
1164                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1165                fidl::encoding::DefaultFuchsiaResourceDialect,
1166                0x65751d7784fa3647,
1167            >(_buf?)?;
1168            Ok(_response.map(|x| x))
1169        }
1170        self.client.send_query_and_decode::<
1171            RecoveryWriteSystemBlobImageRequest,
1172            RecoveryWriteSystemBlobImageResult,
1173        >(
1174            (payload,),
1175            0x65751d7784fa3647,
1176            fidl::encoding::DynamicFlags::empty(),
1177            _decode,
1178        )
1179    }
1180
1181    type InstallSystemBlobImageResponseFut = fidl::client::QueryResponseFut<
1182        RecoveryInstallSystemBlobImageResult,
1183        fidl::encoding::DefaultFuchsiaResourceDialect,
1184    >;
1185    fn r#install_system_blob_image(&self) -> Self::InstallSystemBlobImageResponseFut {
1186        fn _decode(
1187            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1188        ) -> Result<RecoveryInstallSystemBlobImageResult, fidl::Error> {
1189            let _response = fidl::client::decode_transaction_body::<
1190                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1191                fidl::encoding::DefaultFuchsiaResourceDialect,
1192                0x311fc553a2a48b6,
1193            >(_buf?)?;
1194            Ok(_response.map(|x| x))
1195        }
1196        self.client.send_query_and_decode::<
1197            fidl::encoding::EmptyPayload,
1198            RecoveryInstallSystemBlobImageResult,
1199        >(
1200            (),
1201            0x311fc553a2a48b6,
1202            fidl::encoding::DynamicFlags::empty(),
1203            _decode,
1204        )
1205    }
1206}
1207
1208pub struct RecoveryEventStream {
1209    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1210}
1211
1212impl std::marker::Unpin for RecoveryEventStream {}
1213
1214impl futures::stream::FusedStream for RecoveryEventStream {
1215    fn is_terminated(&self) -> bool {
1216        self.event_receiver.is_terminated()
1217    }
1218}
1219
1220impl futures::Stream for RecoveryEventStream {
1221    type Item = Result<RecoveryEvent, fidl::Error>;
1222
1223    fn poll_next(
1224        mut self: std::pin::Pin<&mut Self>,
1225        cx: &mut std::task::Context<'_>,
1226    ) -> std::task::Poll<Option<Self::Item>> {
1227        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1228            &mut self.event_receiver,
1229            cx
1230        )?) {
1231            Some(buf) => std::task::Poll::Ready(Some(RecoveryEvent::decode(buf))),
1232            None => std::task::Poll::Ready(None),
1233        }
1234    }
1235}
1236
1237#[derive(Debug)]
1238pub enum RecoveryEvent {}
1239
1240impl RecoveryEvent {
1241    /// Decodes a message buffer as a [`RecoveryEvent`].
1242    fn decode(
1243        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1244    ) -> Result<RecoveryEvent, fidl::Error> {
1245        let (bytes, _handles) = buf.split_mut();
1246        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1247        debug_assert_eq!(tx_header.tx_id, 0);
1248        match tx_header.ordinal {
1249            _ => Err(fidl::Error::UnknownOrdinal {
1250                ordinal: tx_header.ordinal,
1251                protocol_name: <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1252            }),
1253        }
1254    }
1255}
1256
1257/// A Stream of incoming requests for fuchsia.fshost/Recovery.
1258pub struct RecoveryRequestStream {
1259    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1260    is_terminated: bool,
1261}
1262
1263impl std::marker::Unpin for RecoveryRequestStream {}
1264
1265impl futures::stream::FusedStream for RecoveryRequestStream {
1266    fn is_terminated(&self) -> bool {
1267        self.is_terminated
1268    }
1269}
1270
1271impl fidl::endpoints::RequestStream for RecoveryRequestStream {
1272    type Protocol = RecoveryMarker;
1273    type ControlHandle = RecoveryControlHandle;
1274
1275    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1276        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1277    }
1278
1279    fn control_handle(&self) -> Self::ControlHandle {
1280        RecoveryControlHandle { inner: self.inner.clone() }
1281    }
1282
1283    fn into_inner(
1284        self,
1285    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1286    {
1287        (self.inner, self.is_terminated)
1288    }
1289
1290    fn from_inner(
1291        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1292        is_terminated: bool,
1293    ) -> Self {
1294        Self { inner, is_terminated }
1295    }
1296}
1297
1298impl futures::Stream for RecoveryRequestStream {
1299    type Item = Result<RecoveryRequest, fidl::Error>;
1300
1301    fn poll_next(
1302        mut self: std::pin::Pin<&mut Self>,
1303        cx: &mut std::task::Context<'_>,
1304    ) -> std::task::Poll<Option<Self::Item>> {
1305        let this = &mut *self;
1306        if this.inner.check_shutdown(cx) {
1307            this.is_terminated = true;
1308            return std::task::Poll::Ready(None);
1309        }
1310        if this.is_terminated {
1311            panic!("polled RecoveryRequestStream after completion");
1312        }
1313        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1314            |bytes, handles| {
1315                match this.inner.channel().read_etc(cx, bytes, handles) {
1316                    std::task::Poll::Ready(Ok(())) => {}
1317                    std::task::Poll::Pending => return std::task::Poll::Pending,
1318                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1319                        this.is_terminated = true;
1320                        return std::task::Poll::Ready(None);
1321                    }
1322                    std::task::Poll::Ready(Err(e)) => {
1323                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1324                            e.into(),
1325                        ))));
1326                    }
1327                }
1328
1329                // A message has been received from the channel
1330                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1331
1332                std::task::Poll::Ready(Some(match header.ordinal {
1333                    0x3dcadcbb75e2330b => {
1334                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1335                        let mut req = fidl::new_empty!(
1336                            RecoveryInitSystemPartitionTableRequest,
1337                            fidl::encoding::DefaultFuchsiaResourceDialect
1338                        );
1339                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RecoveryInitSystemPartitionTableRequest>(&header, _body_bytes, handles, &mut req)?;
1340                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1341                        Ok(RecoveryRequest::InitSystemPartitionTable {
1342                            partitions: req.partitions,
1343
1344                            responder: RecoveryInitSystemPartitionTableResponder {
1345                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1346                                tx_id: header.tx_id,
1347                            },
1348                        })
1349                    }
1350                    0xd6cf7b3f57b418d => {
1351                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1352                        let mut req = fidl::new_empty!(
1353                            RecoveryWriteDataFileRequest,
1354                            fidl::encoding::DefaultFuchsiaResourceDialect
1355                        );
1356                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RecoveryWriteDataFileRequest>(&header, _body_bytes, handles, &mut req)?;
1357                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1358                        Ok(RecoveryRequest::WriteDataFile {
1359                            filename: req.filename,
1360                            payload: req.payload,
1361
1362                            responder: RecoveryWriteDataFileResponder {
1363                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1364                                tx_id: header.tx_id,
1365                            },
1366                        })
1367                    }
1368                    0x4e93f6b198f61f7d => {
1369                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1370                        let mut req = fidl::new_empty!(
1371                            fidl::encoding::EmptyPayload,
1372                            fidl::encoding::DefaultFuchsiaResourceDialect
1373                        );
1374                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1375                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1376                        Ok(RecoveryRequest::FormatSystemBlobVolume {
1377                            responder: RecoveryFormatSystemBlobVolumeResponder {
1378                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1379                                tx_id: header.tx_id,
1380                            },
1381                        })
1382                    }
1383                    0x63ddff4240e908c0 => {
1384                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1385                        let mut req = fidl::new_empty!(
1386                            RecoveryMountSystemBlobVolumeRequest,
1387                            fidl::encoding::DefaultFuchsiaResourceDialect
1388                        );
1389                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RecoveryMountSystemBlobVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
1390                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1391                        Ok(RecoveryRequest::MountSystemBlobVolume {
1392                            blob_exposed_dir: req.blob_exposed_dir,
1393
1394                            responder: RecoveryMountSystemBlobVolumeResponder {
1395                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1396                                tx_id: header.tx_id,
1397                            },
1398                        })
1399                    }
1400                    0x65751d7784fa3647 => {
1401                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1402                        let mut req = fidl::new_empty!(
1403                            RecoveryWriteSystemBlobImageRequest,
1404                            fidl::encoding::DefaultFuchsiaResourceDialect
1405                        );
1406                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RecoveryWriteSystemBlobImageRequest>(&header, _body_bytes, handles, &mut req)?;
1407                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1408                        Ok(RecoveryRequest::WriteSystemBlobImage {
1409                            payload: req.payload,
1410
1411                            responder: RecoveryWriteSystemBlobImageResponder {
1412                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1413                                tx_id: header.tx_id,
1414                            },
1415                        })
1416                    }
1417                    0x311fc553a2a48b6 => {
1418                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1419                        let mut req = fidl::new_empty!(
1420                            fidl::encoding::EmptyPayload,
1421                            fidl::encoding::DefaultFuchsiaResourceDialect
1422                        );
1423                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1424                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1425                        Ok(RecoveryRequest::InstallSystemBlobImage {
1426                            responder: RecoveryInstallSystemBlobImageResponder {
1427                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1428                                tx_id: header.tx_id,
1429                            },
1430                        })
1431                    }
1432                    _ => Err(fidl::Error::UnknownOrdinal {
1433                        ordinal: header.ordinal,
1434                        protocol_name:
1435                            <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1436                    }),
1437                }))
1438            },
1439        )
1440    }
1441}
1442
1443/// Special functionality that is only intended to be used in recovery and device bringup.
1444///
1445/// *WARNING*: The methods in this protocol are highly specialized and can result in unintended
1446/// data loss if used improperly. Most methods in this protocol assume exclusive access to the
1447/// underlying block device, and it is the responsibility of callers to mediate the use of this
1448/// protocol across components.
1449#[derive(Debug)]
1450pub enum RecoveryRequest {
1451    /// Wipes and re-initializes the system partition table.  This is a destructive operation!
1452    InitSystemPartitionTable {
1453        partitions: Vec<fidl_fuchsia_storage_partitions::PartitionInfo>,
1454        responder: RecoveryInitSystemPartitionTableResponder,
1455    },
1456    /// Writes `filename` into the data partition with contents from `payload`, formatting the data
1457    /// partition if it isn't already formatted.  Overwrites file if it already exists.
1458    ///
1459    /// This can only be called while the data partition isn't already mounted, which is typically
1460    /// in recovery builds where fshost is running with the `ramdisk_image` flag set.
1461    WriteDataFile {
1462        filename: String,
1463        payload: fidl::Vmo,
1464        responder: RecoveryWriteDataFileResponder,
1465    },
1466    /// Formats the blob volume in the system container. If the system container does not have a
1467    /// blob volume, a new one will be created. All existing blobs will be deleted. If the system
1468    /// container is corrupt or unmountable, this function will have no effect and will leave the
1469    /// disk intact.
1470    ///
1471    /// **WARNING**: This can cause irreversible data loss and can render a device unbootable.
1472    FormatSystemBlobVolume { responder: RecoveryFormatSystemBlobVolumeResponder },
1473    /// Mounts the system container's blob volume, and returns a handle to the blob volume's
1474    /// exposed directory to facilitate writing a new system. The system container will remain
1475    /// mounted as long as `blob_exposed_dir` is kept open. Only the blob volume will be mounted.
1476    MountSystemBlobVolume {
1477        blob_exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1478        responder: RecoveryMountSystemBlobVolumeResponder,
1479    },
1480    /// Writes `payload` to be installed as the blob volume in the system container. `payload` must
1481    /// be a valid Android sparse image containing an fxfs partition image with a blob volume. This
1482    /// method can be called multiple times to write multiple sparse images, usually targeting
1483    /// different offsets, allowing very large images exceeding RAM to be written in chunks. The
1484    /// existing blob volume will remain unmodified until `InstallSystemBlobVolume` is called.
1485    WriteSystemBlobImage { payload: fidl::Vmo, responder: RecoveryWriteSystemBlobImageResponder },
1486    /// Installs the blob volume previously written via `WriteSystemBlobVolume`, replacing the
1487    /// existing blob volume in the system container. On failure, the existing blob volume will
1488    /// remain intact, and the written image will be deleted to free space. A new blob image can
1489    /// then be written and the installation process restarted. If no blob volume has been written,
1490    /// this will have no effect.
1491    InstallSystemBlobImage { responder: RecoveryInstallSystemBlobImageResponder },
1492}
1493
1494impl RecoveryRequest {
1495    #[allow(irrefutable_let_patterns)]
1496    pub fn into_init_system_partition_table(
1497        self,
1498    ) -> Option<(
1499        Vec<fidl_fuchsia_storage_partitions::PartitionInfo>,
1500        RecoveryInitSystemPartitionTableResponder,
1501    )> {
1502        if let RecoveryRequest::InitSystemPartitionTable { partitions, responder } = self {
1503            Some((partitions, responder))
1504        } else {
1505            None
1506        }
1507    }
1508
1509    #[allow(irrefutable_let_patterns)]
1510    pub fn into_write_data_file(
1511        self,
1512    ) -> Option<(String, fidl::Vmo, RecoveryWriteDataFileResponder)> {
1513        if let RecoveryRequest::WriteDataFile { filename, payload, responder } = self {
1514            Some((filename, payload, responder))
1515        } else {
1516            None
1517        }
1518    }
1519
1520    #[allow(irrefutable_let_patterns)]
1521    pub fn into_format_system_blob_volume(
1522        self,
1523    ) -> Option<(RecoveryFormatSystemBlobVolumeResponder)> {
1524        if let RecoveryRequest::FormatSystemBlobVolume { responder } = self {
1525            Some((responder))
1526        } else {
1527            None
1528        }
1529    }
1530
1531    #[allow(irrefutable_let_patterns)]
1532    pub fn into_mount_system_blob_volume(
1533        self,
1534    ) -> Option<(
1535        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1536        RecoveryMountSystemBlobVolumeResponder,
1537    )> {
1538        if let RecoveryRequest::MountSystemBlobVolume { blob_exposed_dir, responder } = self {
1539            Some((blob_exposed_dir, responder))
1540        } else {
1541            None
1542        }
1543    }
1544
1545    #[allow(irrefutable_let_patterns)]
1546    pub fn into_write_system_blob_image(
1547        self,
1548    ) -> Option<(fidl::Vmo, RecoveryWriteSystemBlobImageResponder)> {
1549        if let RecoveryRequest::WriteSystemBlobImage { payload, responder } = self {
1550            Some((payload, responder))
1551        } else {
1552            None
1553        }
1554    }
1555
1556    #[allow(irrefutable_let_patterns)]
1557    pub fn into_install_system_blob_image(
1558        self,
1559    ) -> Option<(RecoveryInstallSystemBlobImageResponder)> {
1560        if let RecoveryRequest::InstallSystemBlobImage { responder } = self {
1561            Some((responder))
1562        } else {
1563            None
1564        }
1565    }
1566
1567    /// Name of the method defined in FIDL
1568    pub fn method_name(&self) -> &'static str {
1569        match *self {
1570            RecoveryRequest::InitSystemPartitionTable { .. } => "init_system_partition_table",
1571            RecoveryRequest::WriteDataFile { .. } => "write_data_file",
1572            RecoveryRequest::FormatSystemBlobVolume { .. } => "format_system_blob_volume",
1573            RecoveryRequest::MountSystemBlobVolume { .. } => "mount_system_blob_volume",
1574            RecoveryRequest::WriteSystemBlobImage { .. } => "write_system_blob_image",
1575            RecoveryRequest::InstallSystemBlobImage { .. } => "install_system_blob_image",
1576        }
1577    }
1578}
1579
1580#[derive(Debug, Clone)]
1581pub struct RecoveryControlHandle {
1582    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1583}
1584
1585impl fidl::endpoints::ControlHandle for RecoveryControlHandle {
1586    fn shutdown(&self) {
1587        self.inner.shutdown()
1588    }
1589    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1590        self.inner.shutdown_with_epitaph(status)
1591    }
1592
1593    fn is_closed(&self) -> bool {
1594        self.inner.channel().is_closed()
1595    }
1596    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1597        self.inner.channel().on_closed()
1598    }
1599
1600    #[cfg(target_os = "fuchsia")]
1601    fn signal_peer(
1602        &self,
1603        clear_mask: zx::Signals,
1604        set_mask: zx::Signals,
1605    ) -> Result<(), zx_status::Status> {
1606        use fidl::Peered;
1607        self.inner.channel().signal_peer(clear_mask, set_mask)
1608    }
1609}
1610
1611impl RecoveryControlHandle {}
1612
1613#[must_use = "FIDL methods require a response to be sent"]
1614#[derive(Debug)]
1615pub struct RecoveryInitSystemPartitionTableResponder {
1616    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1617    tx_id: u32,
1618}
1619
1620/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1621/// if the responder is dropped without sending a response, so that the client
1622/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1623impl std::ops::Drop for RecoveryInitSystemPartitionTableResponder {
1624    fn drop(&mut self) {
1625        self.control_handle.shutdown();
1626        // Safety: drops once, never accessed again
1627        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1628    }
1629}
1630
1631impl fidl::endpoints::Responder for RecoveryInitSystemPartitionTableResponder {
1632    type ControlHandle = RecoveryControlHandle;
1633
1634    fn control_handle(&self) -> &RecoveryControlHandle {
1635        &self.control_handle
1636    }
1637
1638    fn drop_without_shutdown(mut self) {
1639        // Safety: drops once, never accessed again due to mem::forget
1640        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1641        // Prevent Drop from running (which would shut down the channel)
1642        std::mem::forget(self);
1643    }
1644}
1645
1646impl RecoveryInitSystemPartitionTableResponder {
1647    /// Sends a response to the FIDL transaction.
1648    ///
1649    /// Sets the channel to shutdown if an error occurs.
1650    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1651        let _result = self.send_raw(result);
1652        if _result.is_err() {
1653            self.control_handle.shutdown();
1654        }
1655        self.drop_without_shutdown();
1656        _result
1657    }
1658
1659    /// Similar to "send" but does not shutdown the channel if an error occurs.
1660    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1661        let _result = self.send_raw(result);
1662        self.drop_without_shutdown();
1663        _result
1664    }
1665
1666    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1667        self.control_handle
1668            .inner
1669            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1670                result,
1671                self.tx_id,
1672                0x3dcadcbb75e2330b,
1673                fidl::encoding::DynamicFlags::empty(),
1674            )
1675    }
1676}
1677
1678#[must_use = "FIDL methods require a response to be sent"]
1679#[derive(Debug)]
1680pub struct RecoveryWriteDataFileResponder {
1681    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1682    tx_id: u32,
1683}
1684
1685/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1686/// if the responder is dropped without sending a response, so that the client
1687/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1688impl std::ops::Drop for RecoveryWriteDataFileResponder {
1689    fn drop(&mut self) {
1690        self.control_handle.shutdown();
1691        // Safety: drops once, never accessed again
1692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1693    }
1694}
1695
1696impl fidl::endpoints::Responder for RecoveryWriteDataFileResponder {
1697    type ControlHandle = RecoveryControlHandle;
1698
1699    fn control_handle(&self) -> &RecoveryControlHandle {
1700        &self.control_handle
1701    }
1702
1703    fn drop_without_shutdown(mut self) {
1704        // Safety: drops once, never accessed again due to mem::forget
1705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1706        // Prevent Drop from running (which would shut down the channel)
1707        std::mem::forget(self);
1708    }
1709}
1710
1711impl RecoveryWriteDataFileResponder {
1712    /// Sends a response to the FIDL transaction.
1713    ///
1714    /// Sets the channel to shutdown if an error occurs.
1715    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1716        let _result = self.send_raw(result);
1717        if _result.is_err() {
1718            self.control_handle.shutdown();
1719        }
1720        self.drop_without_shutdown();
1721        _result
1722    }
1723
1724    /// Similar to "send" but does not shutdown the channel if an error occurs.
1725    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1726        let _result = self.send_raw(result);
1727        self.drop_without_shutdown();
1728        _result
1729    }
1730
1731    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1732        self.control_handle
1733            .inner
1734            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1735                result,
1736                self.tx_id,
1737                0xd6cf7b3f57b418d,
1738                fidl::encoding::DynamicFlags::empty(),
1739            )
1740    }
1741}
1742
1743#[must_use = "FIDL methods require a response to be sent"]
1744#[derive(Debug)]
1745pub struct RecoveryFormatSystemBlobVolumeResponder {
1746    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1747    tx_id: u32,
1748}
1749
1750/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1751/// if the responder is dropped without sending a response, so that the client
1752/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1753impl std::ops::Drop for RecoveryFormatSystemBlobVolumeResponder {
1754    fn drop(&mut self) {
1755        self.control_handle.shutdown();
1756        // Safety: drops once, never accessed again
1757        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1758    }
1759}
1760
1761impl fidl::endpoints::Responder for RecoveryFormatSystemBlobVolumeResponder {
1762    type ControlHandle = RecoveryControlHandle;
1763
1764    fn control_handle(&self) -> &RecoveryControlHandle {
1765        &self.control_handle
1766    }
1767
1768    fn drop_without_shutdown(mut self) {
1769        // Safety: drops once, never accessed again due to mem::forget
1770        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1771        // Prevent Drop from running (which would shut down the channel)
1772        std::mem::forget(self);
1773    }
1774}
1775
1776impl RecoveryFormatSystemBlobVolumeResponder {
1777    /// Sends a response to the FIDL transaction.
1778    ///
1779    /// Sets the channel to shutdown if an error occurs.
1780    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1781        let _result = self.send_raw(result);
1782        if _result.is_err() {
1783            self.control_handle.shutdown();
1784        }
1785        self.drop_without_shutdown();
1786        _result
1787    }
1788
1789    /// Similar to "send" but does not shutdown the channel if an error occurs.
1790    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1791        let _result = self.send_raw(result);
1792        self.drop_without_shutdown();
1793        _result
1794    }
1795
1796    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1797        self.control_handle
1798            .inner
1799            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1800                result,
1801                self.tx_id,
1802                0x4e93f6b198f61f7d,
1803                fidl::encoding::DynamicFlags::empty(),
1804            )
1805    }
1806}
1807
1808#[must_use = "FIDL methods require a response to be sent"]
1809#[derive(Debug)]
1810pub struct RecoveryMountSystemBlobVolumeResponder {
1811    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1812    tx_id: u32,
1813}
1814
1815/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1816/// if the responder is dropped without sending a response, so that the client
1817/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1818impl std::ops::Drop for RecoveryMountSystemBlobVolumeResponder {
1819    fn drop(&mut self) {
1820        self.control_handle.shutdown();
1821        // Safety: drops once, never accessed again
1822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1823    }
1824}
1825
1826impl fidl::endpoints::Responder for RecoveryMountSystemBlobVolumeResponder {
1827    type ControlHandle = RecoveryControlHandle;
1828
1829    fn control_handle(&self) -> &RecoveryControlHandle {
1830        &self.control_handle
1831    }
1832
1833    fn drop_without_shutdown(mut self) {
1834        // Safety: drops once, never accessed again due to mem::forget
1835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1836        // Prevent Drop from running (which would shut down the channel)
1837        std::mem::forget(self);
1838    }
1839}
1840
1841impl RecoveryMountSystemBlobVolumeResponder {
1842    /// Sends a response to the FIDL transaction.
1843    ///
1844    /// Sets the channel to shutdown if an error occurs.
1845    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1846        let _result = self.send_raw(result);
1847        if _result.is_err() {
1848            self.control_handle.shutdown();
1849        }
1850        self.drop_without_shutdown();
1851        _result
1852    }
1853
1854    /// Similar to "send" but does not shutdown the channel if an error occurs.
1855    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1856        let _result = self.send_raw(result);
1857        self.drop_without_shutdown();
1858        _result
1859    }
1860
1861    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1862        self.control_handle
1863            .inner
1864            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1865                result,
1866                self.tx_id,
1867                0x63ddff4240e908c0,
1868                fidl::encoding::DynamicFlags::empty(),
1869            )
1870    }
1871}
1872
1873#[must_use = "FIDL methods require a response to be sent"]
1874#[derive(Debug)]
1875pub struct RecoveryWriteSystemBlobImageResponder {
1876    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1877    tx_id: u32,
1878}
1879
1880/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1881/// if the responder is dropped without sending a response, so that the client
1882/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1883impl std::ops::Drop for RecoveryWriteSystemBlobImageResponder {
1884    fn drop(&mut self) {
1885        self.control_handle.shutdown();
1886        // Safety: drops once, never accessed again
1887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1888    }
1889}
1890
1891impl fidl::endpoints::Responder for RecoveryWriteSystemBlobImageResponder {
1892    type ControlHandle = RecoveryControlHandle;
1893
1894    fn control_handle(&self) -> &RecoveryControlHandle {
1895        &self.control_handle
1896    }
1897
1898    fn drop_without_shutdown(mut self) {
1899        // Safety: drops once, never accessed again due to mem::forget
1900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1901        // Prevent Drop from running (which would shut down the channel)
1902        std::mem::forget(self);
1903    }
1904}
1905
1906impl RecoveryWriteSystemBlobImageResponder {
1907    /// Sends a response to the FIDL transaction.
1908    ///
1909    /// Sets the channel to shutdown if an error occurs.
1910    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1911        let _result = self.send_raw(result);
1912        if _result.is_err() {
1913            self.control_handle.shutdown();
1914        }
1915        self.drop_without_shutdown();
1916        _result
1917    }
1918
1919    /// Similar to "send" but does not shutdown the channel if an error occurs.
1920    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1921        let _result = self.send_raw(result);
1922        self.drop_without_shutdown();
1923        _result
1924    }
1925
1926    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1927        self.control_handle
1928            .inner
1929            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1930                result,
1931                self.tx_id,
1932                0x65751d7784fa3647,
1933                fidl::encoding::DynamicFlags::empty(),
1934            )
1935    }
1936}
1937
1938#[must_use = "FIDL methods require a response to be sent"]
1939#[derive(Debug)]
1940pub struct RecoveryInstallSystemBlobImageResponder {
1941    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1942    tx_id: u32,
1943}
1944
1945/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1946/// if the responder is dropped without sending a response, so that the client
1947/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1948impl std::ops::Drop for RecoveryInstallSystemBlobImageResponder {
1949    fn drop(&mut self) {
1950        self.control_handle.shutdown();
1951        // Safety: drops once, never accessed again
1952        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1953    }
1954}
1955
1956impl fidl::endpoints::Responder for RecoveryInstallSystemBlobImageResponder {
1957    type ControlHandle = RecoveryControlHandle;
1958
1959    fn control_handle(&self) -> &RecoveryControlHandle {
1960        &self.control_handle
1961    }
1962
1963    fn drop_without_shutdown(mut self) {
1964        // Safety: drops once, never accessed again due to mem::forget
1965        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1966        // Prevent Drop from running (which would shut down the channel)
1967        std::mem::forget(self);
1968    }
1969}
1970
1971impl RecoveryInstallSystemBlobImageResponder {
1972    /// Sends a response to the FIDL transaction.
1973    ///
1974    /// Sets the channel to shutdown if an error occurs.
1975    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1976        let _result = self.send_raw(result);
1977        if _result.is_err() {
1978            self.control_handle.shutdown();
1979        }
1980        self.drop_without_shutdown();
1981        _result
1982    }
1983
1984    /// Similar to "send" but does not shutdown the channel if an error occurs.
1985    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1986        let _result = self.send_raw(result);
1987        self.drop_without_shutdown();
1988        _result
1989    }
1990
1991    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1992        self.control_handle
1993            .inner
1994            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1995                result,
1996                self.tx_id,
1997                0x311fc553a2a48b6,
1998                fidl::encoding::DynamicFlags::empty(),
1999            )
2000    }
2001}
2002
2003#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2004pub struct StarnixVolumeProviderMarker;
2005
2006impl fidl::endpoints::ProtocolMarker for StarnixVolumeProviderMarker {
2007    type Proxy = StarnixVolumeProviderProxy;
2008    type RequestStream = StarnixVolumeProviderRequestStream;
2009    #[cfg(target_os = "fuchsia")]
2010    type SynchronousProxy = StarnixVolumeProviderSynchronousProxy;
2011
2012    const DEBUG_NAME: &'static str = "fuchsia.fshost.StarnixVolumeProvider";
2013}
2014impl fidl::endpoints::DiscoverableProtocolMarker for StarnixVolumeProviderMarker {}
2015pub type StarnixVolumeProviderMountResult = Result<(), i32>;
2016pub type StarnixVolumeProviderCreateResult = Result<(), i32>;
2017
2018pub trait StarnixVolumeProviderProxyInterface: Send + Sync {
2019    type MountResponseFut: std::future::Future<Output = Result<StarnixVolumeProviderMountResult, fidl::Error>>
2020        + Send;
2021    fn r#mount(
2022        &self,
2023        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2024        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2025    ) -> Self::MountResponseFut;
2026    type CreateResponseFut: std::future::Future<Output = Result<StarnixVolumeProviderCreateResult, fidl::Error>>
2027        + Send;
2028    fn r#create(
2029        &self,
2030        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2031        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2032    ) -> Self::CreateResponseFut;
2033}
2034#[derive(Debug)]
2035#[cfg(target_os = "fuchsia")]
2036pub struct StarnixVolumeProviderSynchronousProxy {
2037    client: fidl::client::sync::Client,
2038}
2039
2040#[cfg(target_os = "fuchsia")]
2041impl fidl::endpoints::SynchronousProxy for StarnixVolumeProviderSynchronousProxy {
2042    type Proxy = StarnixVolumeProviderProxy;
2043    type Protocol = StarnixVolumeProviderMarker;
2044
2045    fn from_channel(inner: fidl::Channel) -> Self {
2046        Self::new(inner)
2047    }
2048
2049    fn into_channel(self) -> fidl::Channel {
2050        self.client.into_channel()
2051    }
2052
2053    fn as_channel(&self) -> &fidl::Channel {
2054        self.client.as_channel()
2055    }
2056}
2057
2058#[cfg(target_os = "fuchsia")]
2059impl StarnixVolumeProviderSynchronousProxy {
2060    pub fn new(channel: fidl::Channel) -> Self {
2061        let protocol_name =
2062            <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2063        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2064    }
2065
2066    pub fn into_channel(self) -> fidl::Channel {
2067        self.client.into_channel()
2068    }
2069
2070    /// Waits until an event arrives and returns it. It is safe for other
2071    /// threads to make concurrent requests while waiting for an event.
2072    pub fn wait_for_event(
2073        &self,
2074        deadline: zx::MonotonicInstant,
2075    ) -> Result<StarnixVolumeProviderEvent, fidl::Error> {
2076        StarnixVolumeProviderEvent::decode(self.client.wait_for_event(deadline)?)
2077    }
2078
2079    /// Mounts the main starnix volume using `crypt`. `exposed_dir` will be connected to the
2080    /// exposed directory of the mounted starnix volume. Silently creates the volume if it does
2081    /// not already exist.
2082    pub fn r#mount(
2083        &self,
2084        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2085        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2086        ___deadline: zx::MonotonicInstant,
2087    ) -> Result<StarnixVolumeProviderMountResult, fidl::Error> {
2088        let _response = self.client.send_query::<
2089            StarnixVolumeProviderMountRequest,
2090            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2091        >(
2092            (crypt, exposed_dir,),
2093            0x62ae75763dde5af6,
2094            fidl::encoding::DynamicFlags::empty(),
2095            ___deadline,
2096        )?;
2097        Ok(_response.map(|x| x))
2098    }
2099
2100    /// Creates and mounts the main starnix volume using `crypt`. If the volume already exists,
2101    /// unmount and delete the volume before creating the new one. `exposed_dir` will be connected
2102    /// to the exposed directory of the mounted starnix volume.
2103    pub fn r#create(
2104        &self,
2105        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2106        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2107        ___deadline: zx::MonotonicInstant,
2108    ) -> Result<StarnixVolumeProviderCreateResult, fidl::Error> {
2109        let _response = self.client.send_query::<
2110            StarnixVolumeProviderCreateRequest,
2111            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2112        >(
2113            (crypt, exposed_dir,),
2114            0x1f172ca81a8da7c4,
2115            fidl::encoding::DynamicFlags::empty(),
2116            ___deadline,
2117        )?;
2118        Ok(_response.map(|x| x))
2119    }
2120}
2121
2122#[cfg(target_os = "fuchsia")]
2123impl From<StarnixVolumeProviderSynchronousProxy> for zx::Handle {
2124    fn from(value: StarnixVolumeProviderSynchronousProxy) -> Self {
2125        value.into_channel().into()
2126    }
2127}
2128
2129#[cfg(target_os = "fuchsia")]
2130impl From<fidl::Channel> for StarnixVolumeProviderSynchronousProxy {
2131    fn from(value: fidl::Channel) -> Self {
2132        Self::new(value)
2133    }
2134}
2135
2136#[cfg(target_os = "fuchsia")]
2137impl fidl::endpoints::FromClient for StarnixVolumeProviderSynchronousProxy {
2138    type Protocol = StarnixVolumeProviderMarker;
2139
2140    fn from_client(value: fidl::endpoints::ClientEnd<StarnixVolumeProviderMarker>) -> Self {
2141        Self::new(value.into_channel())
2142    }
2143}
2144
2145#[derive(Debug, Clone)]
2146pub struct StarnixVolumeProviderProxy {
2147    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2148}
2149
2150impl fidl::endpoints::Proxy for StarnixVolumeProviderProxy {
2151    type Protocol = StarnixVolumeProviderMarker;
2152
2153    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2154        Self::new(inner)
2155    }
2156
2157    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2158        self.client.into_channel().map_err(|client| Self { client })
2159    }
2160
2161    fn as_channel(&self) -> &::fidl::AsyncChannel {
2162        self.client.as_channel()
2163    }
2164}
2165
2166impl StarnixVolumeProviderProxy {
2167    /// Create a new Proxy for fuchsia.fshost/StarnixVolumeProvider.
2168    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2169        let protocol_name =
2170            <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2171        Self { client: fidl::client::Client::new(channel, protocol_name) }
2172    }
2173
2174    /// Get a Stream of events from the remote end of the protocol.
2175    ///
2176    /// # Panics
2177    ///
2178    /// Panics if the event stream was already taken.
2179    pub fn take_event_stream(&self) -> StarnixVolumeProviderEventStream {
2180        StarnixVolumeProviderEventStream { event_receiver: self.client.take_event_receiver() }
2181    }
2182
2183    /// Mounts the main starnix volume using `crypt`. `exposed_dir` will be connected to the
2184    /// exposed directory of the mounted starnix volume. Silently creates the volume if it does
2185    /// not already exist.
2186    pub fn r#mount(
2187        &self,
2188        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2189        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2190    ) -> fidl::client::QueryResponseFut<
2191        StarnixVolumeProviderMountResult,
2192        fidl::encoding::DefaultFuchsiaResourceDialect,
2193    > {
2194        StarnixVolumeProviderProxyInterface::r#mount(self, crypt, exposed_dir)
2195    }
2196
2197    /// Creates and mounts the main starnix volume using `crypt`. If the volume already exists,
2198    /// unmount and delete the volume before creating the new one. `exposed_dir` will be connected
2199    /// to the exposed directory of the mounted starnix volume.
2200    pub fn r#create(
2201        &self,
2202        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2203        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2204    ) -> fidl::client::QueryResponseFut<
2205        StarnixVolumeProviderCreateResult,
2206        fidl::encoding::DefaultFuchsiaResourceDialect,
2207    > {
2208        StarnixVolumeProviderProxyInterface::r#create(self, crypt, exposed_dir)
2209    }
2210}
2211
2212impl StarnixVolumeProviderProxyInterface for StarnixVolumeProviderProxy {
2213    type MountResponseFut = fidl::client::QueryResponseFut<
2214        StarnixVolumeProviderMountResult,
2215        fidl::encoding::DefaultFuchsiaResourceDialect,
2216    >;
2217    fn r#mount(
2218        &self,
2219        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2220        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2221    ) -> Self::MountResponseFut {
2222        fn _decode(
2223            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2224        ) -> Result<StarnixVolumeProviderMountResult, fidl::Error> {
2225            let _response = fidl::client::decode_transaction_body::<
2226                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2227                fidl::encoding::DefaultFuchsiaResourceDialect,
2228                0x62ae75763dde5af6,
2229            >(_buf?)?;
2230            Ok(_response.map(|x| x))
2231        }
2232        self.client.send_query_and_decode::<
2233            StarnixVolumeProviderMountRequest,
2234            StarnixVolumeProviderMountResult,
2235        >(
2236            (crypt, exposed_dir,),
2237            0x62ae75763dde5af6,
2238            fidl::encoding::DynamicFlags::empty(),
2239            _decode,
2240        )
2241    }
2242
2243    type CreateResponseFut = fidl::client::QueryResponseFut<
2244        StarnixVolumeProviderCreateResult,
2245        fidl::encoding::DefaultFuchsiaResourceDialect,
2246    >;
2247    fn r#create(
2248        &self,
2249        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2250        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2251    ) -> Self::CreateResponseFut {
2252        fn _decode(
2253            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2254        ) -> Result<StarnixVolumeProviderCreateResult, fidl::Error> {
2255            let _response = fidl::client::decode_transaction_body::<
2256                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2257                fidl::encoding::DefaultFuchsiaResourceDialect,
2258                0x1f172ca81a8da7c4,
2259            >(_buf?)?;
2260            Ok(_response.map(|x| x))
2261        }
2262        self.client.send_query_and_decode::<
2263            StarnixVolumeProviderCreateRequest,
2264            StarnixVolumeProviderCreateResult,
2265        >(
2266            (crypt, exposed_dir,),
2267            0x1f172ca81a8da7c4,
2268            fidl::encoding::DynamicFlags::empty(),
2269            _decode,
2270        )
2271    }
2272}
2273
2274pub struct StarnixVolumeProviderEventStream {
2275    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2276}
2277
2278impl std::marker::Unpin for StarnixVolumeProviderEventStream {}
2279
2280impl futures::stream::FusedStream for StarnixVolumeProviderEventStream {
2281    fn is_terminated(&self) -> bool {
2282        self.event_receiver.is_terminated()
2283    }
2284}
2285
2286impl futures::Stream for StarnixVolumeProviderEventStream {
2287    type Item = Result<StarnixVolumeProviderEvent, fidl::Error>;
2288
2289    fn poll_next(
2290        mut self: std::pin::Pin<&mut Self>,
2291        cx: &mut std::task::Context<'_>,
2292    ) -> std::task::Poll<Option<Self::Item>> {
2293        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2294            &mut self.event_receiver,
2295            cx
2296        )?) {
2297            Some(buf) => std::task::Poll::Ready(Some(StarnixVolumeProviderEvent::decode(buf))),
2298            None => std::task::Poll::Ready(None),
2299        }
2300    }
2301}
2302
2303#[derive(Debug)]
2304pub enum StarnixVolumeProviderEvent {}
2305
2306impl StarnixVolumeProviderEvent {
2307    /// Decodes a message buffer as a [`StarnixVolumeProviderEvent`].
2308    fn decode(
2309        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2310    ) -> Result<StarnixVolumeProviderEvent, fidl::Error> {
2311        let (bytes, _handles) = buf.split_mut();
2312        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2313        debug_assert_eq!(tx_header.tx_id, 0);
2314        match tx_header.ordinal {
2315            _ => Err(fidl::Error::UnknownOrdinal {
2316                ordinal: tx_header.ordinal,
2317                protocol_name:
2318                    <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2319            }),
2320        }
2321    }
2322}
2323
2324/// A Stream of incoming requests for fuchsia.fshost/StarnixVolumeProvider.
2325pub struct StarnixVolumeProviderRequestStream {
2326    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2327    is_terminated: bool,
2328}
2329
2330impl std::marker::Unpin for StarnixVolumeProviderRequestStream {}
2331
2332impl futures::stream::FusedStream for StarnixVolumeProviderRequestStream {
2333    fn is_terminated(&self) -> bool {
2334        self.is_terminated
2335    }
2336}
2337
2338impl fidl::endpoints::RequestStream for StarnixVolumeProviderRequestStream {
2339    type Protocol = StarnixVolumeProviderMarker;
2340    type ControlHandle = StarnixVolumeProviderControlHandle;
2341
2342    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2343        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2344    }
2345
2346    fn control_handle(&self) -> Self::ControlHandle {
2347        StarnixVolumeProviderControlHandle { inner: self.inner.clone() }
2348    }
2349
2350    fn into_inner(
2351        self,
2352    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2353    {
2354        (self.inner, self.is_terminated)
2355    }
2356
2357    fn from_inner(
2358        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2359        is_terminated: bool,
2360    ) -> Self {
2361        Self { inner, is_terminated }
2362    }
2363}
2364
2365impl futures::Stream for StarnixVolumeProviderRequestStream {
2366    type Item = Result<StarnixVolumeProviderRequest, fidl::Error>;
2367
2368    fn poll_next(
2369        mut self: std::pin::Pin<&mut Self>,
2370        cx: &mut std::task::Context<'_>,
2371    ) -> std::task::Poll<Option<Self::Item>> {
2372        let this = &mut *self;
2373        if this.inner.check_shutdown(cx) {
2374            this.is_terminated = true;
2375            return std::task::Poll::Ready(None);
2376        }
2377        if this.is_terminated {
2378            panic!("polled StarnixVolumeProviderRequestStream after completion");
2379        }
2380        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2381            |bytes, handles| {
2382                match this.inner.channel().read_etc(cx, bytes, handles) {
2383                    std::task::Poll::Ready(Ok(())) => {}
2384                    std::task::Poll::Pending => return std::task::Poll::Pending,
2385                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2386                        this.is_terminated = true;
2387                        return std::task::Poll::Ready(None);
2388                    }
2389                    std::task::Poll::Ready(Err(e)) => {
2390                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2391                            e.into(),
2392                        ))));
2393                    }
2394                }
2395
2396                // A message has been received from the channel
2397                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2398
2399                std::task::Poll::Ready(Some(match header.ordinal {
2400                0x62ae75763dde5af6 => {
2401                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2402                    let mut req = fidl::new_empty!(StarnixVolumeProviderMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2403                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StarnixVolumeProviderMountRequest>(&header, _body_bytes, handles, &mut req)?;
2404                    let control_handle = StarnixVolumeProviderControlHandle {
2405                        inner: this.inner.clone(),
2406                    };
2407                    Ok(StarnixVolumeProviderRequest::Mount {crypt: req.crypt,
2408exposed_dir: req.exposed_dir,
2409
2410                        responder: StarnixVolumeProviderMountResponder {
2411                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2412                            tx_id: header.tx_id,
2413                        },
2414                    })
2415                }
2416                0x1f172ca81a8da7c4 => {
2417                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2418                    let mut req = fidl::new_empty!(StarnixVolumeProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2419                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StarnixVolumeProviderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
2420                    let control_handle = StarnixVolumeProviderControlHandle {
2421                        inner: this.inner.clone(),
2422                    };
2423                    Ok(StarnixVolumeProviderRequest::Create {crypt: req.crypt,
2424exposed_dir: req.exposed_dir,
2425
2426                        responder: StarnixVolumeProviderCreateResponder {
2427                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2428                            tx_id: header.tx_id,
2429                        },
2430                    })
2431                }
2432                _ => Err(fidl::Error::UnknownOrdinal {
2433                    ordinal: header.ordinal,
2434                    protocol_name: <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2435                }),
2436            }))
2437            },
2438        )
2439    }
2440}
2441
2442/// Provides access to the volume which will be used by Starnix to store its data.
2443#[derive(Debug)]
2444pub enum StarnixVolumeProviderRequest {
2445    /// Mounts the main starnix volume using `crypt`. `exposed_dir` will be connected to the
2446    /// exposed directory of the mounted starnix volume. Silently creates the volume if it does
2447    /// not already exist.
2448    Mount {
2449        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2450        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2451        responder: StarnixVolumeProviderMountResponder,
2452    },
2453    /// Creates and mounts the main starnix volume using `crypt`. If the volume already exists,
2454    /// unmount and delete the volume before creating the new one. `exposed_dir` will be connected
2455    /// to the exposed directory of the mounted starnix volume.
2456    Create {
2457        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2458        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2459        responder: StarnixVolumeProviderCreateResponder,
2460    },
2461}
2462
2463impl StarnixVolumeProviderRequest {
2464    #[allow(irrefutable_let_patterns)]
2465    pub fn into_mount(
2466        self,
2467    ) -> Option<(
2468        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2469        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2470        StarnixVolumeProviderMountResponder,
2471    )> {
2472        if let StarnixVolumeProviderRequest::Mount { crypt, exposed_dir, responder } = self {
2473            Some((crypt, exposed_dir, responder))
2474        } else {
2475            None
2476        }
2477    }
2478
2479    #[allow(irrefutable_let_patterns)]
2480    pub fn into_create(
2481        self,
2482    ) -> Option<(
2483        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2484        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2485        StarnixVolumeProviderCreateResponder,
2486    )> {
2487        if let StarnixVolumeProviderRequest::Create { crypt, exposed_dir, responder } = self {
2488            Some((crypt, exposed_dir, responder))
2489        } else {
2490            None
2491        }
2492    }
2493
2494    /// Name of the method defined in FIDL
2495    pub fn method_name(&self) -> &'static str {
2496        match *self {
2497            StarnixVolumeProviderRequest::Mount { .. } => "mount",
2498            StarnixVolumeProviderRequest::Create { .. } => "create",
2499        }
2500    }
2501}
2502
2503#[derive(Debug, Clone)]
2504pub struct StarnixVolumeProviderControlHandle {
2505    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2506}
2507
2508impl fidl::endpoints::ControlHandle for StarnixVolumeProviderControlHandle {
2509    fn shutdown(&self) {
2510        self.inner.shutdown()
2511    }
2512    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2513        self.inner.shutdown_with_epitaph(status)
2514    }
2515
2516    fn is_closed(&self) -> bool {
2517        self.inner.channel().is_closed()
2518    }
2519    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2520        self.inner.channel().on_closed()
2521    }
2522
2523    #[cfg(target_os = "fuchsia")]
2524    fn signal_peer(
2525        &self,
2526        clear_mask: zx::Signals,
2527        set_mask: zx::Signals,
2528    ) -> Result<(), zx_status::Status> {
2529        use fidl::Peered;
2530        self.inner.channel().signal_peer(clear_mask, set_mask)
2531    }
2532}
2533
2534impl StarnixVolumeProviderControlHandle {}
2535
2536#[must_use = "FIDL methods require a response to be sent"]
2537#[derive(Debug)]
2538pub struct StarnixVolumeProviderMountResponder {
2539    control_handle: std::mem::ManuallyDrop<StarnixVolumeProviderControlHandle>,
2540    tx_id: u32,
2541}
2542
2543/// Set the the channel to be shutdown (see [`StarnixVolumeProviderControlHandle::shutdown`])
2544/// if the responder is dropped without sending a response, so that the client
2545/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2546impl std::ops::Drop for StarnixVolumeProviderMountResponder {
2547    fn drop(&mut self) {
2548        self.control_handle.shutdown();
2549        // Safety: drops once, never accessed again
2550        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2551    }
2552}
2553
2554impl fidl::endpoints::Responder for StarnixVolumeProviderMountResponder {
2555    type ControlHandle = StarnixVolumeProviderControlHandle;
2556
2557    fn control_handle(&self) -> &StarnixVolumeProviderControlHandle {
2558        &self.control_handle
2559    }
2560
2561    fn drop_without_shutdown(mut self) {
2562        // Safety: drops once, never accessed again due to mem::forget
2563        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2564        // Prevent Drop from running (which would shut down the channel)
2565        std::mem::forget(self);
2566    }
2567}
2568
2569impl StarnixVolumeProviderMountResponder {
2570    /// Sends a response to the FIDL transaction.
2571    ///
2572    /// Sets the channel to shutdown if an error occurs.
2573    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2574        let _result = self.send_raw(result);
2575        if _result.is_err() {
2576            self.control_handle.shutdown();
2577        }
2578        self.drop_without_shutdown();
2579        _result
2580    }
2581
2582    /// Similar to "send" but does not shutdown the channel if an error occurs.
2583    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2584        let _result = self.send_raw(result);
2585        self.drop_without_shutdown();
2586        _result
2587    }
2588
2589    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2590        self.control_handle
2591            .inner
2592            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2593                result,
2594                self.tx_id,
2595                0x62ae75763dde5af6,
2596                fidl::encoding::DynamicFlags::empty(),
2597            )
2598    }
2599}
2600
2601#[must_use = "FIDL methods require a response to be sent"]
2602#[derive(Debug)]
2603pub struct StarnixVolumeProviderCreateResponder {
2604    control_handle: std::mem::ManuallyDrop<StarnixVolumeProviderControlHandle>,
2605    tx_id: u32,
2606}
2607
2608/// Set the the channel to be shutdown (see [`StarnixVolumeProviderControlHandle::shutdown`])
2609/// if the responder is dropped without sending a response, so that the client
2610/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2611impl std::ops::Drop for StarnixVolumeProviderCreateResponder {
2612    fn drop(&mut self) {
2613        self.control_handle.shutdown();
2614        // Safety: drops once, never accessed again
2615        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2616    }
2617}
2618
2619impl fidl::endpoints::Responder for StarnixVolumeProviderCreateResponder {
2620    type ControlHandle = StarnixVolumeProviderControlHandle;
2621
2622    fn control_handle(&self) -> &StarnixVolumeProviderControlHandle {
2623        &self.control_handle
2624    }
2625
2626    fn drop_without_shutdown(mut self) {
2627        // Safety: drops once, never accessed again due to mem::forget
2628        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2629        // Prevent Drop from running (which would shut down the channel)
2630        std::mem::forget(self);
2631    }
2632}
2633
2634impl StarnixVolumeProviderCreateResponder {
2635    /// Sends a response to the FIDL transaction.
2636    ///
2637    /// Sets the channel to shutdown if an error occurs.
2638    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2639        let _result = self.send_raw(result);
2640        if _result.is_err() {
2641            self.control_handle.shutdown();
2642        }
2643        self.drop_without_shutdown();
2644        _result
2645    }
2646
2647    /// Similar to "send" but does not shutdown the channel if an error occurs.
2648    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2649        let _result = self.send_raw(result);
2650        self.drop_without_shutdown();
2651        _result
2652    }
2653
2654    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2655        self.control_handle
2656            .inner
2657            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2658                result,
2659                self.tx_id,
2660                0x1f172ca81a8da7c4,
2661                fidl::encoding::DynamicFlags::empty(),
2662            )
2663    }
2664}
2665
2666mod internal {
2667    use super::*;
2668
2669    impl fidl::encoding::ResourceTypeMarker for RecoveryMountSystemBlobVolumeRequest {
2670        type Borrowed<'a> = &'a mut Self;
2671        fn take_or_borrow<'a>(
2672            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2673        ) -> Self::Borrowed<'a> {
2674            value
2675        }
2676    }
2677
2678    unsafe impl fidl::encoding::TypeMarker for RecoveryMountSystemBlobVolumeRequest {
2679        type Owned = Self;
2680
2681        #[inline(always)]
2682        fn inline_align(_context: fidl::encoding::Context) -> usize {
2683            4
2684        }
2685
2686        #[inline(always)]
2687        fn inline_size(_context: fidl::encoding::Context) -> usize {
2688            4
2689        }
2690    }
2691
2692    unsafe impl
2693        fidl::encoding::Encode<
2694            RecoveryMountSystemBlobVolumeRequest,
2695            fidl::encoding::DefaultFuchsiaResourceDialect,
2696        > for &mut RecoveryMountSystemBlobVolumeRequest
2697    {
2698        #[inline]
2699        unsafe fn encode(
2700            self,
2701            encoder: &mut fidl::encoding::Encoder<
2702                '_,
2703                fidl::encoding::DefaultFuchsiaResourceDialect,
2704            >,
2705            offset: usize,
2706            _depth: fidl::encoding::Depth,
2707        ) -> fidl::Result<()> {
2708            encoder.debug_check_bounds::<RecoveryMountSystemBlobVolumeRequest>(offset);
2709            // Delegate to tuple encoding.
2710            fidl::encoding::Encode::<
2711                RecoveryMountSystemBlobVolumeRequest,
2712                fidl::encoding::DefaultFuchsiaResourceDialect,
2713            >::encode(
2714                (<fidl::encoding::Endpoint<
2715                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2716                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2717                    &mut self.blob_exposed_dir,
2718                ),),
2719                encoder,
2720                offset,
2721                _depth,
2722            )
2723        }
2724    }
2725    unsafe impl<
2726        T0: fidl::encoding::Encode<
2727                fidl::encoding::Endpoint<
2728                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2729                >,
2730                fidl::encoding::DefaultFuchsiaResourceDialect,
2731            >,
2732    >
2733        fidl::encoding::Encode<
2734            RecoveryMountSystemBlobVolumeRequest,
2735            fidl::encoding::DefaultFuchsiaResourceDialect,
2736        > for (T0,)
2737    {
2738        #[inline]
2739        unsafe fn encode(
2740            self,
2741            encoder: &mut fidl::encoding::Encoder<
2742                '_,
2743                fidl::encoding::DefaultFuchsiaResourceDialect,
2744            >,
2745            offset: usize,
2746            depth: fidl::encoding::Depth,
2747        ) -> fidl::Result<()> {
2748            encoder.debug_check_bounds::<RecoveryMountSystemBlobVolumeRequest>(offset);
2749            // Zero out padding regions. There's no need to apply masks
2750            // because the unmasked parts will be overwritten by fields.
2751            // Write the fields.
2752            self.0.encode(encoder, offset + 0, depth)?;
2753            Ok(())
2754        }
2755    }
2756
2757    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2758        for RecoveryMountSystemBlobVolumeRequest
2759    {
2760        #[inline(always)]
2761        fn new_empty() -> Self {
2762            Self {
2763                blob_exposed_dir: fidl::new_empty!(
2764                    fidl::encoding::Endpoint<
2765                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2766                    >,
2767                    fidl::encoding::DefaultFuchsiaResourceDialect
2768                ),
2769            }
2770        }
2771
2772        #[inline]
2773        unsafe fn decode(
2774            &mut self,
2775            decoder: &mut fidl::encoding::Decoder<
2776                '_,
2777                fidl::encoding::DefaultFuchsiaResourceDialect,
2778            >,
2779            offset: usize,
2780            _depth: fidl::encoding::Depth,
2781        ) -> fidl::Result<()> {
2782            decoder.debug_check_bounds::<Self>(offset);
2783            // Verify that padding bytes are zero.
2784            fidl::decode!(
2785                fidl::encoding::Endpoint<
2786                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2787                >,
2788                fidl::encoding::DefaultFuchsiaResourceDialect,
2789                &mut self.blob_exposed_dir,
2790                decoder,
2791                offset + 0,
2792                _depth
2793            )?;
2794            Ok(())
2795        }
2796    }
2797
2798    impl fidl::encoding::ResourceTypeMarker for RecoveryWriteDataFileRequest {
2799        type Borrowed<'a> = &'a mut Self;
2800        fn take_or_borrow<'a>(
2801            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2802        ) -> Self::Borrowed<'a> {
2803            value
2804        }
2805    }
2806
2807    unsafe impl fidl::encoding::TypeMarker for RecoveryWriteDataFileRequest {
2808        type Owned = Self;
2809
2810        #[inline(always)]
2811        fn inline_align(_context: fidl::encoding::Context) -> usize {
2812            8
2813        }
2814
2815        #[inline(always)]
2816        fn inline_size(_context: fidl::encoding::Context) -> usize {
2817            24
2818        }
2819    }
2820
2821    unsafe impl
2822        fidl::encoding::Encode<
2823            RecoveryWriteDataFileRequest,
2824            fidl::encoding::DefaultFuchsiaResourceDialect,
2825        > for &mut RecoveryWriteDataFileRequest
2826    {
2827        #[inline]
2828        unsafe fn encode(
2829            self,
2830            encoder: &mut fidl::encoding::Encoder<
2831                '_,
2832                fidl::encoding::DefaultFuchsiaResourceDialect,
2833            >,
2834            offset: usize,
2835            _depth: fidl::encoding::Depth,
2836        ) -> fidl::Result<()> {
2837            encoder.debug_check_bounds::<RecoveryWriteDataFileRequest>(offset);
2838            // Delegate to tuple encoding.
2839            fidl::encoding::Encode::<RecoveryWriteDataFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2840                (
2841                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.filename),
2842                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
2843                ),
2844                encoder, offset, _depth
2845            )
2846        }
2847    }
2848    unsafe impl<
2849        T0: fidl::encoding::Encode<
2850                fidl::encoding::BoundedString<4095>,
2851                fidl::encoding::DefaultFuchsiaResourceDialect,
2852            >,
2853        T1: fidl::encoding::Encode<
2854                fidl::encoding::HandleType<
2855                    fidl::Vmo,
2856                    { fidl::ObjectType::VMO.into_raw() },
2857                    2147483648,
2858                >,
2859                fidl::encoding::DefaultFuchsiaResourceDialect,
2860            >,
2861    >
2862        fidl::encoding::Encode<
2863            RecoveryWriteDataFileRequest,
2864            fidl::encoding::DefaultFuchsiaResourceDialect,
2865        > for (T0, T1)
2866    {
2867        #[inline]
2868        unsafe fn encode(
2869            self,
2870            encoder: &mut fidl::encoding::Encoder<
2871                '_,
2872                fidl::encoding::DefaultFuchsiaResourceDialect,
2873            >,
2874            offset: usize,
2875            depth: fidl::encoding::Depth,
2876        ) -> fidl::Result<()> {
2877            encoder.debug_check_bounds::<RecoveryWriteDataFileRequest>(offset);
2878            // Zero out padding regions. There's no need to apply masks
2879            // because the unmasked parts will be overwritten by fields.
2880            unsafe {
2881                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2882                (ptr as *mut u64).write_unaligned(0);
2883            }
2884            // Write the fields.
2885            self.0.encode(encoder, offset + 0, depth)?;
2886            self.1.encode(encoder, offset + 16, depth)?;
2887            Ok(())
2888        }
2889    }
2890
2891    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2892        for RecoveryWriteDataFileRequest
2893    {
2894        #[inline(always)]
2895        fn new_empty() -> Self {
2896            Self {
2897                filename: fidl::new_empty!(
2898                    fidl::encoding::BoundedString<4095>,
2899                    fidl::encoding::DefaultFuchsiaResourceDialect
2900                ),
2901                payload: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2902            }
2903        }
2904
2905        #[inline]
2906        unsafe fn decode(
2907            &mut self,
2908            decoder: &mut fidl::encoding::Decoder<
2909                '_,
2910                fidl::encoding::DefaultFuchsiaResourceDialect,
2911            >,
2912            offset: usize,
2913            _depth: fidl::encoding::Depth,
2914        ) -> fidl::Result<()> {
2915            decoder.debug_check_bounds::<Self>(offset);
2916            // Verify that padding bytes are zero.
2917            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2918            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2919            let mask = 0xffffffff00000000u64;
2920            let maskedval = padval & mask;
2921            if maskedval != 0 {
2922                return Err(fidl::Error::NonZeroPadding {
2923                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2924                });
2925            }
2926            fidl::decode!(
2927                fidl::encoding::BoundedString<4095>,
2928                fidl::encoding::DefaultFuchsiaResourceDialect,
2929                &mut self.filename,
2930                decoder,
2931                offset + 0,
2932                _depth
2933            )?;
2934            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.payload, decoder, offset + 16, _depth)?;
2935            Ok(())
2936        }
2937    }
2938
2939    impl fidl::encoding::ResourceTypeMarker for RecoveryWriteSystemBlobImageRequest {
2940        type Borrowed<'a> = &'a mut Self;
2941        fn take_or_borrow<'a>(
2942            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2943        ) -> Self::Borrowed<'a> {
2944            value
2945        }
2946    }
2947
2948    unsafe impl fidl::encoding::TypeMarker for RecoveryWriteSystemBlobImageRequest {
2949        type Owned = Self;
2950
2951        #[inline(always)]
2952        fn inline_align(_context: fidl::encoding::Context) -> usize {
2953            4
2954        }
2955
2956        #[inline(always)]
2957        fn inline_size(_context: fidl::encoding::Context) -> usize {
2958            4
2959        }
2960    }
2961
2962    unsafe impl
2963        fidl::encoding::Encode<
2964            RecoveryWriteSystemBlobImageRequest,
2965            fidl::encoding::DefaultFuchsiaResourceDialect,
2966        > for &mut RecoveryWriteSystemBlobImageRequest
2967    {
2968        #[inline]
2969        unsafe fn encode(
2970            self,
2971            encoder: &mut fidl::encoding::Encoder<
2972                '_,
2973                fidl::encoding::DefaultFuchsiaResourceDialect,
2974            >,
2975            offset: usize,
2976            _depth: fidl::encoding::Depth,
2977        ) -> fidl::Result<()> {
2978            encoder.debug_check_bounds::<RecoveryWriteSystemBlobImageRequest>(offset);
2979            // Delegate to tuple encoding.
2980            fidl::encoding::Encode::<
2981                RecoveryWriteSystemBlobImageRequest,
2982                fidl::encoding::DefaultFuchsiaResourceDialect,
2983            >::encode(
2984                (<fidl::encoding::HandleType<
2985                    fidl::Vmo,
2986                    { fidl::ObjectType::VMO.into_raw() },
2987                    2147483648,
2988                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2989                    &mut self.payload
2990                ),),
2991                encoder,
2992                offset,
2993                _depth,
2994            )
2995        }
2996    }
2997    unsafe impl<
2998        T0: fidl::encoding::Encode<
2999                fidl::encoding::HandleType<
3000                    fidl::Vmo,
3001                    { fidl::ObjectType::VMO.into_raw() },
3002                    2147483648,
3003                >,
3004                fidl::encoding::DefaultFuchsiaResourceDialect,
3005            >,
3006    >
3007        fidl::encoding::Encode<
3008            RecoveryWriteSystemBlobImageRequest,
3009            fidl::encoding::DefaultFuchsiaResourceDialect,
3010        > for (T0,)
3011    {
3012        #[inline]
3013        unsafe fn encode(
3014            self,
3015            encoder: &mut fidl::encoding::Encoder<
3016                '_,
3017                fidl::encoding::DefaultFuchsiaResourceDialect,
3018            >,
3019            offset: usize,
3020            depth: fidl::encoding::Depth,
3021        ) -> fidl::Result<()> {
3022            encoder.debug_check_bounds::<RecoveryWriteSystemBlobImageRequest>(offset);
3023            // Zero out padding regions. There's no need to apply masks
3024            // because the unmasked parts will be overwritten by fields.
3025            // Write the fields.
3026            self.0.encode(encoder, offset + 0, depth)?;
3027            Ok(())
3028        }
3029    }
3030
3031    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3032        for RecoveryWriteSystemBlobImageRequest
3033    {
3034        #[inline(always)]
3035        fn new_empty() -> Self {
3036            Self {
3037                payload: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3038            }
3039        }
3040
3041        #[inline]
3042        unsafe fn decode(
3043            &mut self,
3044            decoder: &mut fidl::encoding::Decoder<
3045                '_,
3046                fidl::encoding::DefaultFuchsiaResourceDialect,
3047            >,
3048            offset: usize,
3049            _depth: fidl::encoding::Depth,
3050        ) -> fidl::Result<()> {
3051            decoder.debug_check_bounds::<Self>(offset);
3052            // Verify that padding bytes are zero.
3053            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.payload, decoder, offset + 0, _depth)?;
3054            Ok(())
3055        }
3056    }
3057
3058    impl fidl::encoding::ResourceTypeMarker for StarnixVolumeProviderCreateRequest {
3059        type Borrowed<'a> = &'a mut Self;
3060        fn take_or_borrow<'a>(
3061            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3062        ) -> Self::Borrowed<'a> {
3063            value
3064        }
3065    }
3066
3067    unsafe impl fidl::encoding::TypeMarker for StarnixVolumeProviderCreateRequest {
3068        type Owned = Self;
3069
3070        #[inline(always)]
3071        fn inline_align(_context: fidl::encoding::Context) -> usize {
3072            4
3073        }
3074
3075        #[inline(always)]
3076        fn inline_size(_context: fidl::encoding::Context) -> usize {
3077            8
3078        }
3079    }
3080
3081    unsafe impl
3082        fidl::encoding::Encode<
3083            StarnixVolumeProviderCreateRequest,
3084            fidl::encoding::DefaultFuchsiaResourceDialect,
3085        > for &mut StarnixVolumeProviderCreateRequest
3086    {
3087        #[inline]
3088        unsafe fn encode(
3089            self,
3090            encoder: &mut fidl::encoding::Encoder<
3091                '_,
3092                fidl::encoding::DefaultFuchsiaResourceDialect,
3093            >,
3094            offset: usize,
3095            _depth: fidl::encoding::Depth,
3096        ) -> fidl::Result<()> {
3097            encoder.debug_check_bounds::<StarnixVolumeProviderCreateRequest>(offset);
3098            // Delegate to tuple encoding.
3099            fidl::encoding::Encode::<
3100                StarnixVolumeProviderCreateRequest,
3101                fidl::encoding::DefaultFuchsiaResourceDialect,
3102            >::encode(
3103                (
3104                    <fidl::encoding::Endpoint<
3105                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3106                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3107                        &mut self.crypt
3108                    ),
3109                    <fidl::encoding::Endpoint<
3110                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3111                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3112                        &mut self.exposed_dir
3113                    ),
3114                ),
3115                encoder,
3116                offset,
3117                _depth,
3118            )
3119        }
3120    }
3121    unsafe impl<
3122        T0: fidl::encoding::Encode<
3123                fidl::encoding::Endpoint<
3124                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3125                >,
3126                fidl::encoding::DefaultFuchsiaResourceDialect,
3127            >,
3128        T1: fidl::encoding::Encode<
3129                fidl::encoding::Endpoint<
3130                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3131                >,
3132                fidl::encoding::DefaultFuchsiaResourceDialect,
3133            >,
3134    >
3135        fidl::encoding::Encode<
3136            StarnixVolumeProviderCreateRequest,
3137            fidl::encoding::DefaultFuchsiaResourceDialect,
3138        > for (T0, T1)
3139    {
3140        #[inline]
3141        unsafe fn encode(
3142            self,
3143            encoder: &mut fidl::encoding::Encoder<
3144                '_,
3145                fidl::encoding::DefaultFuchsiaResourceDialect,
3146            >,
3147            offset: usize,
3148            depth: fidl::encoding::Depth,
3149        ) -> fidl::Result<()> {
3150            encoder.debug_check_bounds::<StarnixVolumeProviderCreateRequest>(offset);
3151            // Zero out padding regions. There's no need to apply masks
3152            // because the unmasked parts will be overwritten by fields.
3153            // Write the fields.
3154            self.0.encode(encoder, offset + 0, depth)?;
3155            self.1.encode(encoder, offset + 4, depth)?;
3156            Ok(())
3157        }
3158    }
3159
3160    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3161        for StarnixVolumeProviderCreateRequest
3162    {
3163        #[inline(always)]
3164        fn new_empty() -> Self {
3165            Self {
3166                crypt: fidl::new_empty!(
3167                    fidl::encoding::Endpoint<
3168                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3169                    >,
3170                    fidl::encoding::DefaultFuchsiaResourceDialect
3171                ),
3172                exposed_dir: fidl::new_empty!(
3173                    fidl::encoding::Endpoint<
3174                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3175                    >,
3176                    fidl::encoding::DefaultFuchsiaResourceDialect
3177                ),
3178            }
3179        }
3180
3181        #[inline]
3182        unsafe fn decode(
3183            &mut self,
3184            decoder: &mut fidl::encoding::Decoder<
3185                '_,
3186                fidl::encoding::DefaultFuchsiaResourceDialect,
3187            >,
3188            offset: usize,
3189            _depth: fidl::encoding::Depth,
3190        ) -> fidl::Result<()> {
3191            decoder.debug_check_bounds::<Self>(offset);
3192            // Verify that padding bytes are zero.
3193            fidl::decode!(
3194                fidl::encoding::Endpoint<
3195                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3196                >,
3197                fidl::encoding::DefaultFuchsiaResourceDialect,
3198                &mut self.crypt,
3199                decoder,
3200                offset + 0,
3201                _depth
3202            )?;
3203            fidl::decode!(
3204                fidl::encoding::Endpoint<
3205                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3206                >,
3207                fidl::encoding::DefaultFuchsiaResourceDialect,
3208                &mut self.exposed_dir,
3209                decoder,
3210                offset + 4,
3211                _depth
3212            )?;
3213            Ok(())
3214        }
3215    }
3216
3217    impl fidl::encoding::ResourceTypeMarker for StarnixVolumeProviderMountRequest {
3218        type Borrowed<'a> = &'a mut Self;
3219        fn take_or_borrow<'a>(
3220            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3221        ) -> Self::Borrowed<'a> {
3222            value
3223        }
3224    }
3225
3226    unsafe impl fidl::encoding::TypeMarker for StarnixVolumeProviderMountRequest {
3227        type Owned = Self;
3228
3229        #[inline(always)]
3230        fn inline_align(_context: fidl::encoding::Context) -> usize {
3231            4
3232        }
3233
3234        #[inline(always)]
3235        fn inline_size(_context: fidl::encoding::Context) -> usize {
3236            8
3237        }
3238    }
3239
3240    unsafe impl
3241        fidl::encoding::Encode<
3242            StarnixVolumeProviderMountRequest,
3243            fidl::encoding::DefaultFuchsiaResourceDialect,
3244        > for &mut StarnixVolumeProviderMountRequest
3245    {
3246        #[inline]
3247        unsafe fn encode(
3248            self,
3249            encoder: &mut fidl::encoding::Encoder<
3250                '_,
3251                fidl::encoding::DefaultFuchsiaResourceDialect,
3252            >,
3253            offset: usize,
3254            _depth: fidl::encoding::Depth,
3255        ) -> fidl::Result<()> {
3256            encoder.debug_check_bounds::<StarnixVolumeProviderMountRequest>(offset);
3257            // Delegate to tuple encoding.
3258            fidl::encoding::Encode::<
3259                StarnixVolumeProviderMountRequest,
3260                fidl::encoding::DefaultFuchsiaResourceDialect,
3261            >::encode(
3262                (
3263                    <fidl::encoding::Endpoint<
3264                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3265                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3266                        &mut self.crypt
3267                    ),
3268                    <fidl::encoding::Endpoint<
3269                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3270                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3271                        &mut self.exposed_dir
3272                    ),
3273                ),
3274                encoder,
3275                offset,
3276                _depth,
3277            )
3278        }
3279    }
3280    unsafe impl<
3281        T0: fidl::encoding::Encode<
3282                fidl::encoding::Endpoint<
3283                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3284                >,
3285                fidl::encoding::DefaultFuchsiaResourceDialect,
3286            >,
3287        T1: fidl::encoding::Encode<
3288                fidl::encoding::Endpoint<
3289                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3290                >,
3291                fidl::encoding::DefaultFuchsiaResourceDialect,
3292            >,
3293    >
3294        fidl::encoding::Encode<
3295            StarnixVolumeProviderMountRequest,
3296            fidl::encoding::DefaultFuchsiaResourceDialect,
3297        > for (T0, T1)
3298    {
3299        #[inline]
3300        unsafe fn encode(
3301            self,
3302            encoder: &mut fidl::encoding::Encoder<
3303                '_,
3304                fidl::encoding::DefaultFuchsiaResourceDialect,
3305            >,
3306            offset: usize,
3307            depth: fidl::encoding::Depth,
3308        ) -> fidl::Result<()> {
3309            encoder.debug_check_bounds::<StarnixVolumeProviderMountRequest>(offset);
3310            // Zero out padding regions. There's no need to apply masks
3311            // because the unmasked parts will be overwritten by fields.
3312            // Write the fields.
3313            self.0.encode(encoder, offset + 0, depth)?;
3314            self.1.encode(encoder, offset + 4, depth)?;
3315            Ok(())
3316        }
3317    }
3318
3319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3320        for StarnixVolumeProviderMountRequest
3321    {
3322        #[inline(always)]
3323        fn new_empty() -> Self {
3324            Self {
3325                crypt: fidl::new_empty!(
3326                    fidl::encoding::Endpoint<
3327                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3328                    >,
3329                    fidl::encoding::DefaultFuchsiaResourceDialect
3330                ),
3331                exposed_dir: fidl::new_empty!(
3332                    fidl::encoding::Endpoint<
3333                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3334                    >,
3335                    fidl::encoding::DefaultFuchsiaResourceDialect
3336                ),
3337            }
3338        }
3339
3340        #[inline]
3341        unsafe fn decode(
3342            &mut self,
3343            decoder: &mut fidl::encoding::Decoder<
3344                '_,
3345                fidl::encoding::DefaultFuchsiaResourceDialect,
3346            >,
3347            offset: usize,
3348            _depth: fidl::encoding::Depth,
3349        ) -> fidl::Result<()> {
3350            decoder.debug_check_bounds::<Self>(offset);
3351            // Verify that padding bytes are zero.
3352            fidl::decode!(
3353                fidl::encoding::Endpoint<
3354                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3355                >,
3356                fidl::encoding::DefaultFuchsiaResourceDialect,
3357                &mut self.crypt,
3358                decoder,
3359                offset + 0,
3360                _depth
3361            )?;
3362            fidl::decode!(
3363                fidl::encoding::Endpoint<
3364                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3365                >,
3366                fidl::encoding::DefaultFuchsiaResourceDialect,
3367                &mut self.exposed_dir,
3368                decoder,
3369                offset + 4,
3370                _depth
3371            )?;
3372            Ok(())
3373        }
3374    }
3375
3376    impl MountOptions {
3377        #[inline(always)]
3378        fn max_ordinal_present(&self) -> u64 {
3379            if let Some(_) = self.write_compression_algorithm {
3380                return 4;
3381            }
3382            if let Some(_) = self.verbose {
3383                return 3;
3384            }
3385            if let Some(_) = self.collect_metrics {
3386                return 2;
3387            }
3388            if let Some(_) = self.read_only {
3389                return 1;
3390            }
3391            0
3392        }
3393    }
3394
3395    impl fidl::encoding::ResourceTypeMarker for MountOptions {
3396        type Borrowed<'a> = &'a mut Self;
3397        fn take_or_borrow<'a>(
3398            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3399        ) -> Self::Borrowed<'a> {
3400            value
3401        }
3402    }
3403
3404    unsafe impl fidl::encoding::TypeMarker for MountOptions {
3405        type Owned = Self;
3406
3407        #[inline(always)]
3408        fn inline_align(_context: fidl::encoding::Context) -> usize {
3409            8
3410        }
3411
3412        #[inline(always)]
3413        fn inline_size(_context: fidl::encoding::Context) -> usize {
3414            16
3415        }
3416    }
3417
3418    unsafe impl fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3419        for &mut MountOptions
3420    {
3421        unsafe fn encode(
3422            self,
3423            encoder: &mut fidl::encoding::Encoder<
3424                '_,
3425                fidl::encoding::DefaultFuchsiaResourceDialect,
3426            >,
3427            offset: usize,
3428            mut depth: fidl::encoding::Depth,
3429        ) -> fidl::Result<()> {
3430            encoder.debug_check_bounds::<MountOptions>(offset);
3431            // Vector header
3432            let max_ordinal: u64 = self.max_ordinal_present();
3433            encoder.write_num(max_ordinal, offset);
3434            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3435            // Calling encoder.out_of_line_offset(0) is not allowed.
3436            if max_ordinal == 0 {
3437                return Ok(());
3438            }
3439            depth.increment()?;
3440            let envelope_size = 8;
3441            let bytes_len = max_ordinal as usize * envelope_size;
3442            #[allow(unused_variables)]
3443            let offset = encoder.out_of_line_offset(bytes_len);
3444            let mut _prev_end_offset: usize = 0;
3445            if 1 > max_ordinal {
3446                return Ok(());
3447            }
3448
3449            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3450            // are envelope_size bytes.
3451            let cur_offset: usize = (1 - 1) * envelope_size;
3452
3453            // Zero reserved fields.
3454            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3455
3456            // Safety:
3457            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3458            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3459            //   envelope_size bytes, there is always sufficient room.
3460            fidl::encoding::encode_in_envelope_optional::<
3461                bool,
3462                fidl::encoding::DefaultFuchsiaResourceDialect,
3463            >(
3464                self.read_only.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3465                encoder,
3466                offset + cur_offset,
3467                depth,
3468            )?;
3469
3470            _prev_end_offset = cur_offset + envelope_size;
3471            if 2 > max_ordinal {
3472                return Ok(());
3473            }
3474
3475            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3476            // are envelope_size bytes.
3477            let cur_offset: usize = (2 - 1) * envelope_size;
3478
3479            // Zero reserved fields.
3480            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3481
3482            // Safety:
3483            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3484            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3485            //   envelope_size bytes, there is always sufficient room.
3486            fidl::encoding::encode_in_envelope_optional::<
3487                bool,
3488                fidl::encoding::DefaultFuchsiaResourceDialect,
3489            >(
3490                self.collect_metrics
3491                    .as_ref()
3492                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3493                encoder,
3494                offset + cur_offset,
3495                depth,
3496            )?;
3497
3498            _prev_end_offset = cur_offset + envelope_size;
3499            if 3 > max_ordinal {
3500                return Ok(());
3501            }
3502
3503            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3504            // are envelope_size bytes.
3505            let cur_offset: usize = (3 - 1) * envelope_size;
3506
3507            // Zero reserved fields.
3508            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3509
3510            // Safety:
3511            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3512            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3513            //   envelope_size bytes, there is always sufficient room.
3514            fidl::encoding::encode_in_envelope_optional::<
3515                bool,
3516                fidl::encoding::DefaultFuchsiaResourceDialect,
3517            >(
3518                self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3519                encoder,
3520                offset + cur_offset,
3521                depth,
3522            )?;
3523
3524            _prev_end_offset = cur_offset + envelope_size;
3525            if 4 > max_ordinal {
3526                return Ok(());
3527            }
3528
3529            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3530            // are envelope_size bytes.
3531            let cur_offset: usize = (4 - 1) * envelope_size;
3532
3533            // Zero reserved fields.
3534            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3535
3536            // Safety:
3537            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3538            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3539            //   envelope_size bytes, there is always sufficient room.
3540            fidl::encoding::encode_in_envelope_optional::<
3541                fidl::encoding::BoundedString<32>,
3542                fidl::encoding::DefaultFuchsiaResourceDialect,
3543            >(
3544                self.write_compression_algorithm.as_ref().map(
3545                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
3546                ),
3547                encoder,
3548                offset + cur_offset,
3549                depth,
3550            )?;
3551
3552            _prev_end_offset = cur_offset + envelope_size;
3553
3554            Ok(())
3555        }
3556    }
3557
3558    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {
3559        #[inline(always)]
3560        fn new_empty() -> Self {
3561            Self::default()
3562        }
3563
3564        unsafe fn decode(
3565            &mut self,
3566            decoder: &mut fidl::encoding::Decoder<
3567                '_,
3568                fidl::encoding::DefaultFuchsiaResourceDialect,
3569            >,
3570            offset: usize,
3571            mut depth: fidl::encoding::Depth,
3572        ) -> fidl::Result<()> {
3573            decoder.debug_check_bounds::<Self>(offset);
3574            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3575                None => return Err(fidl::Error::NotNullable),
3576                Some(len) => len,
3577            };
3578            // Calling decoder.out_of_line_offset(0) is not allowed.
3579            if len == 0 {
3580                return Ok(());
3581            };
3582            depth.increment()?;
3583            let envelope_size = 8;
3584            let bytes_len = len * envelope_size;
3585            let offset = decoder.out_of_line_offset(bytes_len)?;
3586            // Decode the envelope for each type.
3587            let mut _next_ordinal_to_read = 0;
3588            let mut next_offset = offset;
3589            let end_offset = offset + bytes_len;
3590            _next_ordinal_to_read += 1;
3591            if next_offset >= end_offset {
3592                return Ok(());
3593            }
3594
3595            // Decode unknown envelopes for gaps in ordinals.
3596            while _next_ordinal_to_read < 1 {
3597                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3598                _next_ordinal_to_read += 1;
3599                next_offset += envelope_size;
3600            }
3601
3602            let next_out_of_line = decoder.next_out_of_line();
3603            let handles_before = decoder.remaining_handles();
3604            if let Some((inlined, num_bytes, num_handles)) =
3605                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3606            {
3607                let member_inline_size =
3608                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3609                if inlined != (member_inline_size <= 4) {
3610                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3611                }
3612                let inner_offset;
3613                let mut inner_depth = depth.clone();
3614                if inlined {
3615                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3616                    inner_offset = next_offset;
3617                } else {
3618                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3619                    inner_depth.increment()?;
3620                }
3621                let val_ref = self.read_only.get_or_insert_with(|| {
3622                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3623                });
3624                fidl::decode!(
3625                    bool,
3626                    fidl::encoding::DefaultFuchsiaResourceDialect,
3627                    val_ref,
3628                    decoder,
3629                    inner_offset,
3630                    inner_depth
3631                )?;
3632                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3633                {
3634                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3635                }
3636                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3637                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3638                }
3639            }
3640
3641            next_offset += envelope_size;
3642            _next_ordinal_to_read += 1;
3643            if next_offset >= end_offset {
3644                return Ok(());
3645            }
3646
3647            // Decode unknown envelopes for gaps in ordinals.
3648            while _next_ordinal_to_read < 2 {
3649                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3650                _next_ordinal_to_read += 1;
3651                next_offset += envelope_size;
3652            }
3653
3654            let next_out_of_line = decoder.next_out_of_line();
3655            let handles_before = decoder.remaining_handles();
3656            if let Some((inlined, num_bytes, num_handles)) =
3657                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3658            {
3659                let member_inline_size =
3660                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3661                if inlined != (member_inline_size <= 4) {
3662                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3663                }
3664                let inner_offset;
3665                let mut inner_depth = depth.clone();
3666                if inlined {
3667                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3668                    inner_offset = next_offset;
3669                } else {
3670                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3671                    inner_depth.increment()?;
3672                }
3673                let val_ref = self.collect_metrics.get_or_insert_with(|| {
3674                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3675                });
3676                fidl::decode!(
3677                    bool,
3678                    fidl::encoding::DefaultFuchsiaResourceDialect,
3679                    val_ref,
3680                    decoder,
3681                    inner_offset,
3682                    inner_depth
3683                )?;
3684                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3685                {
3686                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3687                }
3688                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3689                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3690                }
3691            }
3692
3693            next_offset += envelope_size;
3694            _next_ordinal_to_read += 1;
3695            if next_offset >= end_offset {
3696                return Ok(());
3697            }
3698
3699            // Decode unknown envelopes for gaps in ordinals.
3700            while _next_ordinal_to_read < 3 {
3701                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3702                _next_ordinal_to_read += 1;
3703                next_offset += envelope_size;
3704            }
3705
3706            let next_out_of_line = decoder.next_out_of_line();
3707            let handles_before = decoder.remaining_handles();
3708            if let Some((inlined, num_bytes, num_handles)) =
3709                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3710            {
3711                let member_inline_size =
3712                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3713                if inlined != (member_inline_size <= 4) {
3714                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3715                }
3716                let inner_offset;
3717                let mut inner_depth = depth.clone();
3718                if inlined {
3719                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3720                    inner_offset = next_offset;
3721                } else {
3722                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3723                    inner_depth.increment()?;
3724                }
3725                let val_ref = self.verbose.get_or_insert_with(|| {
3726                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3727                });
3728                fidl::decode!(
3729                    bool,
3730                    fidl::encoding::DefaultFuchsiaResourceDialect,
3731                    val_ref,
3732                    decoder,
3733                    inner_offset,
3734                    inner_depth
3735                )?;
3736                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3737                {
3738                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3739                }
3740                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3741                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3742                }
3743            }
3744
3745            next_offset += envelope_size;
3746            _next_ordinal_to_read += 1;
3747            if next_offset >= end_offset {
3748                return Ok(());
3749            }
3750
3751            // Decode unknown envelopes for gaps in ordinals.
3752            while _next_ordinal_to_read < 4 {
3753                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3754                _next_ordinal_to_read += 1;
3755                next_offset += envelope_size;
3756            }
3757
3758            let next_out_of_line = decoder.next_out_of_line();
3759            let handles_before = decoder.remaining_handles();
3760            if let Some((inlined, num_bytes, num_handles)) =
3761                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3762            {
3763                let member_inline_size =
3764                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
3765                        decoder.context,
3766                    );
3767                if inlined != (member_inline_size <= 4) {
3768                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3769                }
3770                let inner_offset;
3771                let mut inner_depth = depth.clone();
3772                if inlined {
3773                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3774                    inner_offset = next_offset;
3775                } else {
3776                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3777                    inner_depth.increment()?;
3778                }
3779                let val_ref = self.write_compression_algorithm.get_or_insert_with(|| {
3780                    fidl::new_empty!(
3781                        fidl::encoding::BoundedString<32>,
3782                        fidl::encoding::DefaultFuchsiaResourceDialect
3783                    )
3784                });
3785                fidl::decode!(
3786                    fidl::encoding::BoundedString<32>,
3787                    fidl::encoding::DefaultFuchsiaResourceDialect,
3788                    val_ref,
3789                    decoder,
3790                    inner_offset,
3791                    inner_depth
3792                )?;
3793                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3794                {
3795                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3796                }
3797                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3798                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3799                }
3800            }
3801
3802            next_offset += envelope_size;
3803
3804            // Decode the remaining unknown envelopes.
3805            while next_offset < end_offset {
3806                _next_ordinal_to_read += 1;
3807                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3808                next_offset += envelope_size;
3809            }
3810
3811            Ok(())
3812        }
3813    }
3814}