Skip to main content

fidl_fuchsia_paver/
fidl_fuchsia_paver.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_paver__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DataSinkReadFirmwareRequest {
16    pub configuration: Configuration,
17    pub type_: String,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for DataSinkReadFirmwareRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct DataSinkWriteAssetRequest {
27    pub configuration: Configuration,
28    pub asset: Asset,
29    pub payload: fidl_fuchsia_mem::Buffer,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DataSinkWriteAssetRequest {}
33
34#[derive(Debug, PartialEq)]
35pub struct DataSinkWriteFirmwareRequest {
36    pub configuration: Configuration,
37    pub type_: String,
38    pub payload: fidl_fuchsia_mem::Buffer,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42    for DataSinkWriteFirmwareRequest
43{
44}
45
46#[derive(Debug, PartialEq)]
47pub struct DataSinkWriteOpaqueVolumeRequest {
48    pub payload: fidl_fuchsia_mem::Buffer,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52    for DataSinkWriteOpaqueVolumeRequest
53{
54}
55
56#[derive(Debug, PartialEq)]
57pub struct DataSinkWriteSparseVolumeRequest {
58    pub payload: fidl_fuchsia_mem::Buffer,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
62    for DataSinkWriteSparseVolumeRequest
63{
64}
65
66#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
67pub struct DataSinkWriteVolumesRequest {
68    pub payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
69}
70
71impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
72    for DataSinkWriteVolumesRequest
73{
74}
75
76#[derive(Debug, PartialEq)]
77pub struct DataSinkReadAssetResponse {
78    pub asset: fidl_fuchsia_mem::Buffer,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DataSinkReadAssetResponse {}
82
83#[derive(Debug, PartialEq)]
84pub struct DataSinkReadFirmwareResponse {
85    pub firmware: fidl_fuchsia_mem::Buffer,
86}
87
88impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
89    for DataSinkReadFirmwareResponse
90{
91}
92
93#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94pub struct PaverFindBootManagerRequest {
95    pub boot_manager: fidl::endpoints::ServerEnd<BootManagerMarker>,
96}
97
98impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
99    for PaverFindBootManagerRequest
100{
101}
102
103#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104pub struct PaverFindDataSinkRequest {
105    pub data_sink: fidl::endpoints::ServerEnd<DataSinkMarker>,
106}
107
108impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PaverFindDataSinkRequest {}
109
110#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111pub struct PaverFindPartitionTableManagerRequest {
112    pub data_sink: fidl::endpoints::ServerEnd<DynamicDataSinkMarker>,
113}
114
115impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
116    for PaverFindPartitionTableManagerRequest
117{
118}
119
120#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
121pub struct PaverFindSysconfigRequest {
122    pub sysconfig: fidl::endpoints::ServerEnd<SysconfigMarker>,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PaverFindSysconfigRequest {}
126
127#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
128pub struct PayloadStreamRegisterVmoRequest {
129    pub vmo: fidl::Vmo,
130}
131
132impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
133    for PayloadStreamRegisterVmoRequest
134{
135}
136
137#[derive(Debug, PartialEq)]
138pub struct SysconfigWriteRequest {
139    pub payload: fidl_fuchsia_mem::Buffer,
140}
141
142impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SysconfigWriteRequest {}
143
144#[derive(Debug, PartialEq)]
145pub struct SysconfigReadResponse {
146    pub data: fidl_fuchsia_mem::Buffer,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SysconfigReadResponse {}
150
151#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub struct BootManagerMarker;
153
154impl fidl::endpoints::ProtocolMarker for BootManagerMarker {
155    type Proxy = BootManagerProxy;
156    type RequestStream = BootManagerRequestStream;
157    #[cfg(target_os = "fuchsia")]
158    type SynchronousProxy = BootManagerSynchronousProxy;
159
160    const DEBUG_NAME: &'static str = "(anonymous) BootManager";
161}
162pub type BootManagerQueryCurrentConfigurationResult = Result<Configuration, i32>;
163pub type BootManagerQueryActiveConfigurationResult = Result<Configuration, i32>;
164pub type BootManagerQueryConfigurationLastSetActiveResult = Result<Configuration, i32>;
165pub type BootManagerQueryConfigurationStatusResult = Result<ConfigurationStatus, i32>;
166pub type BootManagerQueryConfigurationStatusAndBootAttemptsResult =
167    Result<BootManagerQueryConfigurationStatusAndBootAttemptsResponse, i32>;
168pub type BootManagerSetOneShotRecoveryResult = Result<(), i32>;
169
170pub trait BootManagerProxyInterface: Send + Sync {
171    type QueryCurrentConfigurationResponseFut: std::future::Future<
172            Output = Result<BootManagerQueryCurrentConfigurationResult, fidl::Error>,
173        > + Send;
174    fn r#query_current_configuration(&self) -> Self::QueryCurrentConfigurationResponseFut;
175    type QueryActiveConfigurationResponseFut: std::future::Future<Output = Result<BootManagerQueryActiveConfigurationResult, fidl::Error>>
176        + Send;
177    fn r#query_active_configuration(&self) -> Self::QueryActiveConfigurationResponseFut;
178    type QueryConfigurationLastSetActiveResponseFut: std::future::Future<
179            Output = Result<BootManagerQueryConfigurationLastSetActiveResult, fidl::Error>,
180        > + Send;
181    fn r#query_configuration_last_set_active(
182        &self,
183    ) -> Self::QueryConfigurationLastSetActiveResponseFut;
184    type QueryConfigurationStatusResponseFut: std::future::Future<Output = Result<BootManagerQueryConfigurationStatusResult, fidl::Error>>
185        + Send;
186    fn r#query_configuration_status(
187        &self,
188        configuration: Configuration,
189    ) -> Self::QueryConfigurationStatusResponseFut;
190    type QueryConfigurationStatusAndBootAttemptsResponseFut: std::future::Future<
191            Output = Result<BootManagerQueryConfigurationStatusAndBootAttemptsResult, fidl::Error>,
192        > + Send;
193    fn r#query_configuration_status_and_boot_attempts(
194        &self,
195        configuration: Configuration,
196    ) -> Self::QueryConfigurationStatusAndBootAttemptsResponseFut;
197    type SetConfigurationActiveResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
198        + Send;
199    fn r#set_configuration_active(
200        &self,
201        configuration: Configuration,
202    ) -> Self::SetConfigurationActiveResponseFut;
203    type SetConfigurationUnbootableResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
204        + Send;
205    fn r#set_configuration_unbootable(
206        &self,
207        configuration: Configuration,
208    ) -> Self::SetConfigurationUnbootableResponseFut;
209    type SetConfigurationHealthyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
210        + Send;
211    fn r#set_configuration_healthy(
212        &self,
213        configuration: Configuration,
214    ) -> Self::SetConfigurationHealthyResponseFut;
215    type SetOneShotRecoveryResponseFut: std::future::Future<Output = Result<BootManagerSetOneShotRecoveryResult, fidl::Error>>
216        + Send;
217    fn r#set_one_shot_recovery(&self) -> Self::SetOneShotRecoveryResponseFut;
218    type FlushResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
219    fn r#flush(&self) -> Self::FlushResponseFut;
220}
221#[derive(Debug)]
222#[cfg(target_os = "fuchsia")]
223pub struct BootManagerSynchronousProxy {
224    client: fidl::client::sync::Client,
225}
226
227#[cfg(target_os = "fuchsia")]
228impl fidl::endpoints::SynchronousProxy for BootManagerSynchronousProxy {
229    type Proxy = BootManagerProxy;
230    type Protocol = BootManagerMarker;
231
232    fn from_channel(inner: fidl::Channel) -> Self {
233        Self::new(inner)
234    }
235
236    fn into_channel(self) -> fidl::Channel {
237        self.client.into_channel()
238    }
239
240    fn as_channel(&self) -> &fidl::Channel {
241        self.client.as_channel()
242    }
243}
244
245#[cfg(target_os = "fuchsia")]
246impl BootManagerSynchronousProxy {
247    pub fn new(channel: fidl::Channel) -> Self {
248        Self { client: fidl::client::sync::Client::new(channel) }
249    }
250
251    pub fn into_channel(self) -> fidl::Channel {
252        self.client.into_channel()
253    }
254
255    /// Waits until an event arrives and returns it. It is safe for other
256    /// threads to make concurrent requests while waiting for an event.
257    pub fn wait_for_event(
258        &self,
259        deadline: zx::MonotonicInstant,
260    ) -> Result<BootManagerEvent, fidl::Error> {
261        BootManagerEvent::decode(self.client.wait_for_event::<BootManagerMarker>(deadline)?)
262    }
263
264    /// Queries the configuration the system is currently running.
265    ///
266    /// Returns `ZX_ERR_NOT_SUPPORTED` if the `zvb.current_slot` boot argument cannot be read
267    /// or is an unexpected value.
268    pub fn r#query_current_configuration(
269        &self,
270        ___deadline: zx::MonotonicInstant,
271    ) -> Result<BootManagerQueryCurrentConfigurationResult, fidl::Error> {
272        let _response =
273            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
274                BootManagerQueryCurrentConfigurationResponse,
275                i32,
276            >, BootManagerMarker>(
277                (),
278                0xc213298cbc9c371,
279                fidl::encoding::DynamicFlags::empty(),
280                ___deadline,
281            )?;
282        Ok(_response.map(|x| x.configuration))
283    }
284
285    /// Queries the configuration which will be used as the default boot choice on a normal cold
286    /// boot, which may differ from the currently running configuration. `Configuration::RECOVERY`
287    /// should never be active.
288    ///
289    /// Returns `ZX_ERR_NOT_SUPPORTED` if `Configuration.RECOVERY` is active.
290    pub fn r#query_active_configuration(
291        &self,
292        ___deadline: zx::MonotonicInstant,
293    ) -> Result<BootManagerQueryActiveConfigurationResult, fidl::Error> {
294        let _response =
295            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
296                BootManagerQueryActiveConfigurationResponse,
297                i32,
298            >, BootManagerMarker>(
299                (),
300                0x71d52acdf59947a4,
301                fidl::encoding::DynamicFlags::empty(),
302                ___deadline,
303            )?;
304        Ok(_response.map(|x| x.configuration))
305    }
306
307    /// Queries the configuration that was last explicitly marked as active by
308    /// SetConfigurationActive(). The result is not affected by the current status of the slot.
309    ///
310    /// A newly updated slot is typically marked as active immediately. Therefore this interface
311    /// can be used as a way to identify the newest slot.
312    ///
313    /// Returns `ZX_ERR_IO` if fail to load abr metadata. Returns `ZX_ERR_INTERNAL` if invalid
314    /// slot index is returned by libabr routine.
315    pub fn r#query_configuration_last_set_active(
316        &self,
317        ___deadline: zx::MonotonicInstant,
318    ) -> Result<BootManagerQueryConfigurationLastSetActiveResult, fidl::Error> {
319        let _response =
320            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
321                BootManagerQueryConfigurationLastSetActiveResponse,
322                i32,
323            >, BootManagerMarker>(
324                (),
325                0x6bcad87311b3345,
326                fidl::encoding::DynamicFlags::empty(),
327                ___deadline,
328            )?;
329        Ok(_response.map(|x| x.configuration))
330    }
331
332    /// Queries status of `configuration`.
333    ///
334    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
335    pub fn r#query_configuration_status(
336        &self,
337        mut configuration: Configuration,
338        ___deadline: zx::MonotonicInstant,
339    ) -> Result<BootManagerQueryConfigurationStatusResult, fidl::Error> {
340        let _response = self.client.send_query::<
341            BootManagerQueryConfigurationStatusRequest,
342            fidl::encoding::ResultType<BootManagerQueryConfigurationStatusResponse, i32>,
343            BootManagerMarker,
344        >(
345            (configuration,),
346            0x40822ca9ca68b19a,
347            fidl::encoding::DynamicFlags::empty(),
348            ___deadline,
349        )?;
350        Ok(_response.map(|x| x.status))
351    }
352
353    /// Queries status of `configuration`.
354    ///
355    /// The returned table contains:
356    ///
357    /// * `status`: the current `ConfigurationStatus`
358    ///
359    /// * `boot_attempts`: if `status` is `ConfigurationStatus::PENDING`, this will be the number of
360    ///   times this configuration has attempted to boot, including the current attempt. For any
361    ///   other `status` this value will not be provided.
362    ///
363    ///   If provided, this value will be in the range `[0, MAX_PENDING_BOOT_ATTEMPTS]`. 0 indicates
364    ///   the configuration was just set active and has not attempted any boots yet, and
365    ///   `MAX_PENDING_BOOT_ATTEMPTS` indicates that all attempts have been used.
366    ///
367    /// * `unbootable_reason`: if `status` is `ConfigurationStatus::UNBOOTABLE`, this will be the
368    ///   reported reason for why the configuration is unbootable. For any other `status` this value
369    ///   will not be provided.
370    ///
371    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
372    pub fn r#query_configuration_status_and_boot_attempts(
373        &self,
374        mut configuration: Configuration,
375        ___deadline: zx::MonotonicInstant,
376    ) -> Result<BootManagerQueryConfigurationStatusAndBootAttemptsResult, fidl::Error> {
377        let _response = self.client.send_query::<
378            BootManagerQueryConfigurationStatusAndBootAttemptsRequest,
379            fidl::encoding::ResultType<BootManagerQueryConfigurationStatusAndBootAttemptsResponse, i32>,
380            BootManagerMarker,
381        >(
382            (configuration,),
383            0x27f851d5809cfb3d,
384            fidl::encoding::DynamicFlags::empty(),
385            ___deadline,
386        )?;
387        Ok(_response.map(|x| x))
388    }
389
390    /// Updates persistent metadata identifying which configuration should be selected as 'primary'
391    /// for booting purposes. Should only be called after `KERNEL` as well as optional
392    /// `VERIFIED_BOOT_METADATA` assets for specified `configuration` were written successfully.
393    ///
394    /// Also resets the boot attempts count for the given `Configuration`.
395    ///
396    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
397    pub fn r#set_configuration_active(
398        &self,
399        mut configuration: Configuration,
400        ___deadline: zx::MonotonicInstant,
401    ) -> Result<i32, fidl::Error> {
402        let _response = self.client.send_query::<
403            BootManagerSetConfigurationActiveRequest,
404            BootManagerSetConfigurationActiveResponse,
405            BootManagerMarker,
406        >(
407            (configuration,),
408            0x14c64074f81f9a7f,
409            fidl::encoding::DynamicFlags::empty(),
410            ___deadline,
411        )?;
412        Ok(_response.status)
413    }
414
415    /// Updates persistent metadata identifying whether `configuration` is bootable.
416    /// Should only be called in the following situations:
417    /// * Before `KERNEL` as well as optional `VERIFIED_BOOT_METADATA` assets for specified
418    ///   `configuration` are written.
419    /// * After successfully booting from a new configuration and marking it healthy. This method
420    ///   would be then called on the old configuration.
421    /// * After "successfully" booting from a new configuration, but encountering an unrecoverable
422    ///   error during health check. This method would be then called on the new configuration.
423    ///
424    /// If the configuration is unbootable, no action is taken.
425    ///
426    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
427    pub fn r#set_configuration_unbootable(
428        &self,
429        mut configuration: Configuration,
430        ___deadline: zx::MonotonicInstant,
431    ) -> Result<i32, fidl::Error> {
432        let _response = self.client.send_query::<
433            BootManagerSetConfigurationUnbootableRequest,
434            BootManagerSetConfigurationUnbootableResponse,
435            BootManagerMarker,
436        >(
437            (configuration,),
438            0x6f8716bf306d197f,
439            fidl::encoding::DynamicFlags::empty(),
440            ___deadline,
441        )?;
442        Ok(_response.status)
443    }
444
445    /// Updates persistent metadata to mark a [`fuchsia.paver/Configuration`]
446    /// as successful.
447    ///
448    /// This function is typically used by the OS update system after having
449    /// confirmed that the configuration works as intended and the "rollback to
450    /// previous slot" logic is not needed anymore.
451    ///
452    /// Compatibility between the newly successful configuration and the other
453    /// configuration is unknown. Even if the other configuration was
454    /// successful at one point, it may no longer be. This function adds a
455    /// success mark to the given configuration but also removes any success
456    /// mark on the other.
457    ///
458    /// If `configuration` is unbootable or is
459    /// [`fuchsia.paver/Configuration.RECOVERY`], `response` will be
460    /// `ZX_ERR_INVALID_ARGS`.
461    ///
462    /// + request `configuration` the `Configuration` to mark as healthy. Must
463    ///   not be `RECOVERY`.
464    /// - response `status` a zx_status value indicating success or failure.
465    pub fn r#set_configuration_healthy(
466        &self,
467        mut configuration: Configuration,
468        ___deadline: zx::MonotonicInstant,
469    ) -> Result<i32, fidl::Error> {
470        let _response = self.client.send_query::<
471            BootManagerSetConfigurationHealthyRequest,
472            BootManagerSetConfigurationHealthyResponse,
473            BootManagerMarker,
474        >(
475            (configuration,),
476            0x5dfe31714c8ec4be,
477            fidl::encoding::DynamicFlags::empty(),
478            ___deadline,
479        )?;
480        Ok(_response.status)
481    }
482
483    /// Force device to boot to recovery in the next reboot/power cycle. This will only be
484    /// triggered once and will be reset after the reboot. State of A/B configuration slot will not
485    /// be affected.
486    pub fn r#set_one_shot_recovery(
487        &self,
488        ___deadline: zx::MonotonicInstant,
489    ) -> Result<BootManagerSetOneShotRecoveryResult, fidl::Error> {
490        let _response = self.client.send_query::<
491            fidl::encoding::EmptyPayload,
492            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
493            BootManagerMarker,
494        >(
495            (),
496            0x7a5af0a28354f24d,
497            fidl::encoding::DynamicFlags::empty(),
498            ___deadline,
499        )?;
500        Ok(_response.map(|x| x))
501    }
502
503    /// Flush all previously buffered writes to persistent storage.
504    pub fn r#flush(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
505        let _response = self.client.send_query::<
506            fidl::encoding::EmptyPayload,
507            BootManagerFlushResponse,
508            BootManagerMarker,
509        >(
510            (),
511            0x2f29ec2322d62d3e,
512            fidl::encoding::DynamicFlags::empty(),
513            ___deadline,
514        )?;
515        Ok(_response.status)
516    }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl From<BootManagerSynchronousProxy> for zx::NullableHandle {
521    fn from(value: BootManagerSynchronousProxy) -> Self {
522        value.into_channel().into()
523    }
524}
525
526#[cfg(target_os = "fuchsia")]
527impl From<fidl::Channel> for BootManagerSynchronousProxy {
528    fn from(value: fidl::Channel) -> Self {
529        Self::new(value)
530    }
531}
532
533#[cfg(target_os = "fuchsia")]
534impl fidl::endpoints::FromClient for BootManagerSynchronousProxy {
535    type Protocol = BootManagerMarker;
536
537    fn from_client(value: fidl::endpoints::ClientEnd<BootManagerMarker>) -> Self {
538        Self::new(value.into_channel())
539    }
540}
541
542#[derive(Debug, Clone)]
543pub struct BootManagerProxy {
544    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
545}
546
547impl fidl::endpoints::Proxy for BootManagerProxy {
548    type Protocol = BootManagerMarker;
549
550    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
551        Self::new(inner)
552    }
553
554    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
555        self.client.into_channel().map_err(|client| Self { client })
556    }
557
558    fn as_channel(&self) -> &::fidl::AsyncChannel {
559        self.client.as_channel()
560    }
561}
562
563impl BootManagerProxy {
564    /// Create a new Proxy for fuchsia.paver/BootManager.
565    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
566        let protocol_name = <BootManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
567        Self { client: fidl::client::Client::new(channel, protocol_name) }
568    }
569
570    /// Get a Stream of events from the remote end of the protocol.
571    ///
572    /// # Panics
573    ///
574    /// Panics if the event stream was already taken.
575    pub fn take_event_stream(&self) -> BootManagerEventStream {
576        BootManagerEventStream { event_receiver: self.client.take_event_receiver() }
577    }
578
579    /// Queries the configuration the system is currently running.
580    ///
581    /// Returns `ZX_ERR_NOT_SUPPORTED` if the `zvb.current_slot` boot argument cannot be read
582    /// or is an unexpected value.
583    pub fn r#query_current_configuration(
584        &self,
585    ) -> fidl::client::QueryResponseFut<
586        BootManagerQueryCurrentConfigurationResult,
587        fidl::encoding::DefaultFuchsiaResourceDialect,
588    > {
589        BootManagerProxyInterface::r#query_current_configuration(self)
590    }
591
592    /// Queries the configuration which will be used as the default boot choice on a normal cold
593    /// boot, which may differ from the currently running configuration. `Configuration::RECOVERY`
594    /// should never be active.
595    ///
596    /// Returns `ZX_ERR_NOT_SUPPORTED` if `Configuration.RECOVERY` is active.
597    pub fn r#query_active_configuration(
598        &self,
599    ) -> fidl::client::QueryResponseFut<
600        BootManagerQueryActiveConfigurationResult,
601        fidl::encoding::DefaultFuchsiaResourceDialect,
602    > {
603        BootManagerProxyInterface::r#query_active_configuration(self)
604    }
605
606    /// Queries the configuration that was last explicitly marked as active by
607    /// SetConfigurationActive(). The result is not affected by the current status of the slot.
608    ///
609    /// A newly updated slot is typically marked as active immediately. Therefore this interface
610    /// can be used as a way to identify the newest slot.
611    ///
612    /// Returns `ZX_ERR_IO` if fail to load abr metadata. Returns `ZX_ERR_INTERNAL` if invalid
613    /// slot index is returned by libabr routine.
614    pub fn r#query_configuration_last_set_active(
615        &self,
616    ) -> fidl::client::QueryResponseFut<
617        BootManagerQueryConfigurationLastSetActiveResult,
618        fidl::encoding::DefaultFuchsiaResourceDialect,
619    > {
620        BootManagerProxyInterface::r#query_configuration_last_set_active(self)
621    }
622
623    /// Queries status of `configuration`.
624    ///
625    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
626    pub fn r#query_configuration_status(
627        &self,
628        mut configuration: Configuration,
629    ) -> fidl::client::QueryResponseFut<
630        BootManagerQueryConfigurationStatusResult,
631        fidl::encoding::DefaultFuchsiaResourceDialect,
632    > {
633        BootManagerProxyInterface::r#query_configuration_status(self, configuration)
634    }
635
636    /// Queries status of `configuration`.
637    ///
638    /// The returned table contains:
639    ///
640    /// * `status`: the current `ConfigurationStatus`
641    ///
642    /// * `boot_attempts`: if `status` is `ConfigurationStatus::PENDING`, this will be the number of
643    ///   times this configuration has attempted to boot, including the current attempt. For any
644    ///   other `status` this value will not be provided.
645    ///
646    ///   If provided, this value will be in the range `[0, MAX_PENDING_BOOT_ATTEMPTS]`. 0 indicates
647    ///   the configuration was just set active and has not attempted any boots yet, and
648    ///   `MAX_PENDING_BOOT_ATTEMPTS` indicates that all attempts have been used.
649    ///
650    /// * `unbootable_reason`: if `status` is `ConfigurationStatus::UNBOOTABLE`, this will be the
651    ///   reported reason for why the configuration is unbootable. For any other `status` this value
652    ///   will not be provided.
653    ///
654    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
655    pub fn r#query_configuration_status_and_boot_attempts(
656        &self,
657        mut configuration: Configuration,
658    ) -> fidl::client::QueryResponseFut<
659        BootManagerQueryConfigurationStatusAndBootAttemptsResult,
660        fidl::encoding::DefaultFuchsiaResourceDialect,
661    > {
662        BootManagerProxyInterface::r#query_configuration_status_and_boot_attempts(
663            self,
664            configuration,
665        )
666    }
667
668    /// Updates persistent metadata identifying which configuration should be selected as 'primary'
669    /// for booting purposes. Should only be called after `KERNEL` as well as optional
670    /// `VERIFIED_BOOT_METADATA` assets for specified `configuration` were written successfully.
671    ///
672    /// Also resets the boot attempts count for the given `Configuration`.
673    ///
674    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
675    pub fn r#set_configuration_active(
676        &self,
677        mut configuration: Configuration,
678    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
679        BootManagerProxyInterface::r#set_configuration_active(self, configuration)
680    }
681
682    /// Updates persistent metadata identifying whether `configuration` is bootable.
683    /// Should only be called in the following situations:
684    /// * Before `KERNEL` as well as optional `VERIFIED_BOOT_METADATA` assets for specified
685    ///   `configuration` are written.
686    /// * After successfully booting from a new configuration and marking it healthy. This method
687    ///   would be then called on the old configuration.
688    /// * After "successfully" booting from a new configuration, but encountering an unrecoverable
689    ///   error during health check. This method would be then called on the new configuration.
690    ///
691    /// If the configuration is unbootable, no action is taken.
692    ///
693    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
694    pub fn r#set_configuration_unbootable(
695        &self,
696        mut configuration: Configuration,
697    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
698        BootManagerProxyInterface::r#set_configuration_unbootable(self, configuration)
699    }
700
701    /// Updates persistent metadata to mark a [`fuchsia.paver/Configuration`]
702    /// as successful.
703    ///
704    /// This function is typically used by the OS update system after having
705    /// confirmed that the configuration works as intended and the "rollback to
706    /// previous slot" logic is not needed anymore.
707    ///
708    /// Compatibility between the newly successful configuration and the other
709    /// configuration is unknown. Even if the other configuration was
710    /// successful at one point, it may no longer be. This function adds a
711    /// success mark to the given configuration but also removes any success
712    /// mark on the other.
713    ///
714    /// If `configuration` is unbootable or is
715    /// [`fuchsia.paver/Configuration.RECOVERY`], `response` will be
716    /// `ZX_ERR_INVALID_ARGS`.
717    ///
718    /// + request `configuration` the `Configuration` to mark as healthy. Must
719    ///   not be `RECOVERY`.
720    /// - response `status` a zx_status value indicating success or failure.
721    pub fn r#set_configuration_healthy(
722        &self,
723        mut configuration: Configuration,
724    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
725        BootManagerProxyInterface::r#set_configuration_healthy(self, configuration)
726    }
727
728    /// Force device to boot to recovery in the next reboot/power cycle. This will only be
729    /// triggered once and will be reset after the reboot. State of A/B configuration slot will not
730    /// be affected.
731    pub fn r#set_one_shot_recovery(
732        &self,
733    ) -> fidl::client::QueryResponseFut<
734        BootManagerSetOneShotRecoveryResult,
735        fidl::encoding::DefaultFuchsiaResourceDialect,
736    > {
737        BootManagerProxyInterface::r#set_one_shot_recovery(self)
738    }
739
740    /// Flush all previously buffered writes to persistent storage.
741    pub fn r#flush(
742        &self,
743    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
744        BootManagerProxyInterface::r#flush(self)
745    }
746}
747
748impl BootManagerProxyInterface for BootManagerProxy {
749    type QueryCurrentConfigurationResponseFut = fidl::client::QueryResponseFut<
750        BootManagerQueryCurrentConfigurationResult,
751        fidl::encoding::DefaultFuchsiaResourceDialect,
752    >;
753    fn r#query_current_configuration(&self) -> Self::QueryCurrentConfigurationResponseFut {
754        fn _decode(
755            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
756        ) -> Result<BootManagerQueryCurrentConfigurationResult, fidl::Error> {
757            let _response = fidl::client::decode_transaction_body::<
758                fidl::encoding::ResultType<BootManagerQueryCurrentConfigurationResponse, i32>,
759                fidl::encoding::DefaultFuchsiaResourceDialect,
760                0xc213298cbc9c371,
761            >(_buf?)?;
762            Ok(_response.map(|x| x.configuration))
763        }
764        self.client.send_query_and_decode::<
765            fidl::encoding::EmptyPayload,
766            BootManagerQueryCurrentConfigurationResult,
767        >(
768            (),
769            0xc213298cbc9c371,
770            fidl::encoding::DynamicFlags::empty(),
771            _decode,
772        )
773    }
774
775    type QueryActiveConfigurationResponseFut = fidl::client::QueryResponseFut<
776        BootManagerQueryActiveConfigurationResult,
777        fidl::encoding::DefaultFuchsiaResourceDialect,
778    >;
779    fn r#query_active_configuration(&self) -> Self::QueryActiveConfigurationResponseFut {
780        fn _decode(
781            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
782        ) -> Result<BootManagerQueryActiveConfigurationResult, fidl::Error> {
783            let _response = fidl::client::decode_transaction_body::<
784                fidl::encoding::ResultType<BootManagerQueryActiveConfigurationResponse, i32>,
785                fidl::encoding::DefaultFuchsiaResourceDialect,
786                0x71d52acdf59947a4,
787            >(_buf?)?;
788            Ok(_response.map(|x| x.configuration))
789        }
790        self.client.send_query_and_decode::<
791            fidl::encoding::EmptyPayload,
792            BootManagerQueryActiveConfigurationResult,
793        >(
794            (),
795            0x71d52acdf59947a4,
796            fidl::encoding::DynamicFlags::empty(),
797            _decode,
798        )
799    }
800
801    type QueryConfigurationLastSetActiveResponseFut = fidl::client::QueryResponseFut<
802        BootManagerQueryConfigurationLastSetActiveResult,
803        fidl::encoding::DefaultFuchsiaResourceDialect,
804    >;
805    fn r#query_configuration_last_set_active(
806        &self,
807    ) -> Self::QueryConfigurationLastSetActiveResponseFut {
808        fn _decode(
809            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
810        ) -> Result<BootManagerQueryConfigurationLastSetActiveResult, fidl::Error> {
811            let _response = fidl::client::decode_transaction_body::<
812                fidl::encoding::ResultType<BootManagerQueryConfigurationLastSetActiveResponse, i32>,
813                fidl::encoding::DefaultFuchsiaResourceDialect,
814                0x6bcad87311b3345,
815            >(_buf?)?;
816            Ok(_response.map(|x| x.configuration))
817        }
818        self.client.send_query_and_decode::<
819            fidl::encoding::EmptyPayload,
820            BootManagerQueryConfigurationLastSetActiveResult,
821        >(
822            (),
823            0x6bcad87311b3345,
824            fidl::encoding::DynamicFlags::empty(),
825            _decode,
826        )
827    }
828
829    type QueryConfigurationStatusResponseFut = fidl::client::QueryResponseFut<
830        BootManagerQueryConfigurationStatusResult,
831        fidl::encoding::DefaultFuchsiaResourceDialect,
832    >;
833    fn r#query_configuration_status(
834        &self,
835        mut configuration: Configuration,
836    ) -> Self::QueryConfigurationStatusResponseFut {
837        fn _decode(
838            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
839        ) -> Result<BootManagerQueryConfigurationStatusResult, fidl::Error> {
840            let _response = fidl::client::decode_transaction_body::<
841                fidl::encoding::ResultType<BootManagerQueryConfigurationStatusResponse, i32>,
842                fidl::encoding::DefaultFuchsiaResourceDialect,
843                0x40822ca9ca68b19a,
844            >(_buf?)?;
845            Ok(_response.map(|x| x.status))
846        }
847        self.client.send_query_and_decode::<
848            BootManagerQueryConfigurationStatusRequest,
849            BootManagerQueryConfigurationStatusResult,
850        >(
851            (configuration,),
852            0x40822ca9ca68b19a,
853            fidl::encoding::DynamicFlags::empty(),
854            _decode,
855        )
856    }
857
858    type QueryConfigurationStatusAndBootAttemptsResponseFut = fidl::client::QueryResponseFut<
859        BootManagerQueryConfigurationStatusAndBootAttemptsResult,
860        fidl::encoding::DefaultFuchsiaResourceDialect,
861    >;
862    fn r#query_configuration_status_and_boot_attempts(
863        &self,
864        mut configuration: Configuration,
865    ) -> Self::QueryConfigurationStatusAndBootAttemptsResponseFut {
866        fn _decode(
867            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
868        ) -> Result<BootManagerQueryConfigurationStatusAndBootAttemptsResult, fidl::Error> {
869            let _response = fidl::client::decode_transaction_body::<
870                fidl::encoding::ResultType<
871                    BootManagerQueryConfigurationStatusAndBootAttemptsResponse,
872                    i32,
873                >,
874                fidl::encoding::DefaultFuchsiaResourceDialect,
875                0x27f851d5809cfb3d,
876            >(_buf?)?;
877            Ok(_response.map(|x| x))
878        }
879        self.client.send_query_and_decode::<
880            BootManagerQueryConfigurationStatusAndBootAttemptsRequest,
881            BootManagerQueryConfigurationStatusAndBootAttemptsResult,
882        >(
883            (configuration,),
884            0x27f851d5809cfb3d,
885            fidl::encoding::DynamicFlags::empty(),
886            _decode,
887        )
888    }
889
890    type SetConfigurationActiveResponseFut =
891        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
892    fn r#set_configuration_active(
893        &self,
894        mut configuration: Configuration,
895    ) -> Self::SetConfigurationActiveResponseFut {
896        fn _decode(
897            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
898        ) -> Result<i32, fidl::Error> {
899            let _response = fidl::client::decode_transaction_body::<
900                BootManagerSetConfigurationActiveResponse,
901                fidl::encoding::DefaultFuchsiaResourceDialect,
902                0x14c64074f81f9a7f,
903            >(_buf?)?;
904            Ok(_response.status)
905        }
906        self.client.send_query_and_decode::<BootManagerSetConfigurationActiveRequest, i32>(
907            (configuration,),
908            0x14c64074f81f9a7f,
909            fidl::encoding::DynamicFlags::empty(),
910            _decode,
911        )
912    }
913
914    type SetConfigurationUnbootableResponseFut =
915        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
916    fn r#set_configuration_unbootable(
917        &self,
918        mut configuration: Configuration,
919    ) -> Self::SetConfigurationUnbootableResponseFut {
920        fn _decode(
921            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
922        ) -> Result<i32, fidl::Error> {
923            let _response = fidl::client::decode_transaction_body::<
924                BootManagerSetConfigurationUnbootableResponse,
925                fidl::encoding::DefaultFuchsiaResourceDialect,
926                0x6f8716bf306d197f,
927            >(_buf?)?;
928            Ok(_response.status)
929        }
930        self.client.send_query_and_decode::<BootManagerSetConfigurationUnbootableRequest, i32>(
931            (configuration,),
932            0x6f8716bf306d197f,
933            fidl::encoding::DynamicFlags::empty(),
934            _decode,
935        )
936    }
937
938    type SetConfigurationHealthyResponseFut =
939        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
940    fn r#set_configuration_healthy(
941        &self,
942        mut configuration: Configuration,
943    ) -> Self::SetConfigurationHealthyResponseFut {
944        fn _decode(
945            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
946        ) -> Result<i32, fidl::Error> {
947            let _response = fidl::client::decode_transaction_body::<
948                BootManagerSetConfigurationHealthyResponse,
949                fidl::encoding::DefaultFuchsiaResourceDialect,
950                0x5dfe31714c8ec4be,
951            >(_buf?)?;
952            Ok(_response.status)
953        }
954        self.client.send_query_and_decode::<BootManagerSetConfigurationHealthyRequest, i32>(
955            (configuration,),
956            0x5dfe31714c8ec4be,
957            fidl::encoding::DynamicFlags::empty(),
958            _decode,
959        )
960    }
961
962    type SetOneShotRecoveryResponseFut = fidl::client::QueryResponseFut<
963        BootManagerSetOneShotRecoveryResult,
964        fidl::encoding::DefaultFuchsiaResourceDialect,
965    >;
966    fn r#set_one_shot_recovery(&self) -> Self::SetOneShotRecoveryResponseFut {
967        fn _decode(
968            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
969        ) -> Result<BootManagerSetOneShotRecoveryResult, fidl::Error> {
970            let _response = fidl::client::decode_transaction_body::<
971                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
972                fidl::encoding::DefaultFuchsiaResourceDialect,
973                0x7a5af0a28354f24d,
974            >(_buf?)?;
975            Ok(_response.map(|x| x))
976        }
977        self.client.send_query_and_decode::<
978            fidl::encoding::EmptyPayload,
979            BootManagerSetOneShotRecoveryResult,
980        >(
981            (),
982            0x7a5af0a28354f24d,
983            fidl::encoding::DynamicFlags::empty(),
984            _decode,
985        )
986    }
987
988    type FlushResponseFut =
989        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
990    fn r#flush(&self) -> Self::FlushResponseFut {
991        fn _decode(
992            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
993        ) -> Result<i32, fidl::Error> {
994            let _response = fidl::client::decode_transaction_body::<
995                BootManagerFlushResponse,
996                fidl::encoding::DefaultFuchsiaResourceDialect,
997                0x2f29ec2322d62d3e,
998            >(_buf?)?;
999            Ok(_response.status)
1000        }
1001        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
1002            (),
1003            0x2f29ec2322d62d3e,
1004            fidl::encoding::DynamicFlags::empty(),
1005            _decode,
1006        )
1007    }
1008}
1009
1010pub struct BootManagerEventStream {
1011    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1012}
1013
1014impl std::marker::Unpin for BootManagerEventStream {}
1015
1016impl futures::stream::FusedStream for BootManagerEventStream {
1017    fn is_terminated(&self) -> bool {
1018        self.event_receiver.is_terminated()
1019    }
1020}
1021
1022impl futures::Stream for BootManagerEventStream {
1023    type Item = Result<BootManagerEvent, fidl::Error>;
1024
1025    fn poll_next(
1026        mut self: std::pin::Pin<&mut Self>,
1027        cx: &mut std::task::Context<'_>,
1028    ) -> std::task::Poll<Option<Self::Item>> {
1029        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1030            &mut self.event_receiver,
1031            cx
1032        )?) {
1033            Some(buf) => std::task::Poll::Ready(Some(BootManagerEvent::decode(buf))),
1034            None => std::task::Poll::Ready(None),
1035        }
1036    }
1037}
1038
1039#[derive(Debug)]
1040pub enum BootManagerEvent {}
1041
1042impl BootManagerEvent {
1043    /// Decodes a message buffer as a [`BootManagerEvent`].
1044    fn decode(
1045        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1046    ) -> Result<BootManagerEvent, fidl::Error> {
1047        let (bytes, _handles) = buf.split_mut();
1048        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1049        debug_assert_eq!(tx_header.tx_id, 0);
1050        match tx_header.ordinal {
1051            _ => Err(fidl::Error::UnknownOrdinal {
1052                ordinal: tx_header.ordinal,
1053                protocol_name: <BootManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1054            }),
1055        }
1056    }
1057}
1058
1059/// A Stream of incoming requests for fuchsia.paver/BootManager.
1060pub struct BootManagerRequestStream {
1061    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1062    is_terminated: bool,
1063}
1064
1065impl std::marker::Unpin for BootManagerRequestStream {}
1066
1067impl futures::stream::FusedStream for BootManagerRequestStream {
1068    fn is_terminated(&self) -> bool {
1069        self.is_terminated
1070    }
1071}
1072
1073impl fidl::endpoints::RequestStream for BootManagerRequestStream {
1074    type Protocol = BootManagerMarker;
1075    type ControlHandle = BootManagerControlHandle;
1076
1077    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1078        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1079    }
1080
1081    fn control_handle(&self) -> Self::ControlHandle {
1082        BootManagerControlHandle { inner: self.inner.clone() }
1083    }
1084
1085    fn into_inner(
1086        self,
1087    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1088    {
1089        (self.inner, self.is_terminated)
1090    }
1091
1092    fn from_inner(
1093        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1094        is_terminated: bool,
1095    ) -> Self {
1096        Self { inner, is_terminated }
1097    }
1098}
1099
1100impl futures::Stream for BootManagerRequestStream {
1101    type Item = Result<BootManagerRequest, fidl::Error>;
1102
1103    fn poll_next(
1104        mut self: std::pin::Pin<&mut Self>,
1105        cx: &mut std::task::Context<'_>,
1106    ) -> std::task::Poll<Option<Self::Item>> {
1107        let this = &mut *self;
1108        if this.inner.check_shutdown(cx) {
1109            this.is_terminated = true;
1110            return std::task::Poll::Ready(None);
1111        }
1112        if this.is_terminated {
1113            panic!("polled BootManagerRequestStream after completion");
1114        }
1115        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1116            |bytes, handles| {
1117                match this.inner.channel().read_etc(cx, bytes, handles) {
1118                    std::task::Poll::Ready(Ok(())) => {}
1119                    std::task::Poll::Pending => return std::task::Poll::Pending,
1120                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1121                        this.is_terminated = true;
1122                        return std::task::Poll::Ready(None);
1123                    }
1124                    std::task::Poll::Ready(Err(e)) => {
1125                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1126                            e.into(),
1127                        ))));
1128                    }
1129                }
1130
1131                // A message has been received from the channel
1132                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1133
1134                std::task::Poll::Ready(Some(match header.ordinal {
1135                    0xc213298cbc9c371 => {
1136                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1137                        let mut req = fidl::new_empty!(
1138                            fidl::encoding::EmptyPayload,
1139                            fidl::encoding::DefaultFuchsiaResourceDialect
1140                        );
1141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1142                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1143                        Ok(BootManagerRequest::QueryCurrentConfiguration {
1144                            responder: BootManagerQueryCurrentConfigurationResponder {
1145                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1146                                tx_id: header.tx_id,
1147                            },
1148                        })
1149                    }
1150                    0x71d52acdf59947a4 => {
1151                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1152                        let mut req = fidl::new_empty!(
1153                            fidl::encoding::EmptyPayload,
1154                            fidl::encoding::DefaultFuchsiaResourceDialect
1155                        );
1156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1157                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1158                        Ok(BootManagerRequest::QueryActiveConfiguration {
1159                            responder: BootManagerQueryActiveConfigurationResponder {
1160                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1161                                tx_id: header.tx_id,
1162                            },
1163                        })
1164                    }
1165                    0x6bcad87311b3345 => {
1166                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1167                        let mut req = fidl::new_empty!(
1168                            fidl::encoding::EmptyPayload,
1169                            fidl::encoding::DefaultFuchsiaResourceDialect
1170                        );
1171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1172                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1173                        Ok(BootManagerRequest::QueryConfigurationLastSetActive {
1174                            responder: BootManagerQueryConfigurationLastSetActiveResponder {
1175                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1176                                tx_id: header.tx_id,
1177                            },
1178                        })
1179                    }
1180                    0x40822ca9ca68b19a => {
1181                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1182                        let mut req = fidl::new_empty!(
1183                            BootManagerQueryConfigurationStatusRequest,
1184                            fidl::encoding::DefaultFuchsiaResourceDialect
1185                        );
1186                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootManagerQueryConfigurationStatusRequest>(&header, _body_bytes, handles, &mut req)?;
1187                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1188                        Ok(BootManagerRequest::QueryConfigurationStatus {
1189                            configuration: req.configuration,
1190
1191                            responder: BootManagerQueryConfigurationStatusResponder {
1192                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1193                                tx_id: header.tx_id,
1194                            },
1195                        })
1196                    }
1197                    0x27f851d5809cfb3d => {
1198                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1199                        let mut req = fidl::new_empty!(
1200                            BootManagerQueryConfigurationStatusAndBootAttemptsRequest,
1201                            fidl::encoding::DefaultFuchsiaResourceDialect
1202                        );
1203                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootManagerQueryConfigurationStatusAndBootAttemptsRequest>(&header, _body_bytes, handles, &mut req)?;
1204                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1205                        Ok(BootManagerRequest::QueryConfigurationStatusAndBootAttempts {
1206                            configuration: req.configuration,
1207
1208                            responder:
1209                                BootManagerQueryConfigurationStatusAndBootAttemptsResponder {
1210                                    control_handle: std::mem::ManuallyDrop::new(control_handle),
1211                                    tx_id: header.tx_id,
1212                                },
1213                        })
1214                    }
1215                    0x14c64074f81f9a7f => {
1216                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1217                        let mut req = fidl::new_empty!(
1218                            BootManagerSetConfigurationActiveRequest,
1219                            fidl::encoding::DefaultFuchsiaResourceDialect
1220                        );
1221                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootManagerSetConfigurationActiveRequest>(&header, _body_bytes, handles, &mut req)?;
1222                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1223                        Ok(BootManagerRequest::SetConfigurationActive {
1224                            configuration: req.configuration,
1225
1226                            responder: BootManagerSetConfigurationActiveResponder {
1227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1228                                tx_id: header.tx_id,
1229                            },
1230                        })
1231                    }
1232                    0x6f8716bf306d197f => {
1233                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1234                        let mut req = fidl::new_empty!(
1235                            BootManagerSetConfigurationUnbootableRequest,
1236                            fidl::encoding::DefaultFuchsiaResourceDialect
1237                        );
1238                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootManagerSetConfigurationUnbootableRequest>(&header, _body_bytes, handles, &mut req)?;
1239                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1240                        Ok(BootManagerRequest::SetConfigurationUnbootable {
1241                            configuration: req.configuration,
1242
1243                            responder: BootManagerSetConfigurationUnbootableResponder {
1244                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1245                                tx_id: header.tx_id,
1246                            },
1247                        })
1248                    }
1249                    0x5dfe31714c8ec4be => {
1250                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1251                        let mut req = fidl::new_empty!(
1252                            BootManagerSetConfigurationHealthyRequest,
1253                            fidl::encoding::DefaultFuchsiaResourceDialect
1254                        );
1255                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootManagerSetConfigurationHealthyRequest>(&header, _body_bytes, handles, &mut req)?;
1256                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1257                        Ok(BootManagerRequest::SetConfigurationHealthy {
1258                            configuration: req.configuration,
1259
1260                            responder: BootManagerSetConfigurationHealthyResponder {
1261                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1262                                tx_id: header.tx_id,
1263                            },
1264                        })
1265                    }
1266                    0x7a5af0a28354f24d => {
1267                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1268                        let mut req = fidl::new_empty!(
1269                            fidl::encoding::EmptyPayload,
1270                            fidl::encoding::DefaultFuchsiaResourceDialect
1271                        );
1272                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1273                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1274                        Ok(BootManagerRequest::SetOneShotRecovery {
1275                            responder: BootManagerSetOneShotRecoveryResponder {
1276                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1277                                tx_id: header.tx_id,
1278                            },
1279                        })
1280                    }
1281                    0x2f29ec2322d62d3e => {
1282                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1283                        let mut req = fidl::new_empty!(
1284                            fidl::encoding::EmptyPayload,
1285                            fidl::encoding::DefaultFuchsiaResourceDialect
1286                        );
1287                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1288                        let control_handle = BootManagerControlHandle { inner: this.inner.clone() };
1289                        Ok(BootManagerRequest::Flush {
1290                            responder: BootManagerFlushResponder {
1291                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1292                                tx_id: header.tx_id,
1293                            },
1294                        })
1295                    }
1296                    _ => Err(fidl::Error::UnknownOrdinal {
1297                        ordinal: header.ordinal,
1298                        protocol_name:
1299                            <BootManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1300                    }),
1301                }))
1302            },
1303        )
1304    }
1305}
1306
1307/// Protocol for managing boot configurations.
1308///
1309/// All functions will first check the A/B/R metadata and reset it to the default state if it's
1310/// invalid.
1311///
1312/// Operations which change the configuration are applied transactionally and will not be persisted
1313/// to storage until Flush() is called, at which point they will *all* be applied (or none at all).
1314/// If any of the operations fail (which is generally unexpected), the current set of changes may be
1315/// discarded.
1316///
1317/// The connection will be immediately closed with an epitaph of `ZX_ERR_NOT_SUPPORTED` if A/B/R is
1318/// not supported.
1319#[derive(Debug)]
1320pub enum BootManagerRequest {
1321    /// Queries the configuration the system is currently running.
1322    ///
1323    /// Returns `ZX_ERR_NOT_SUPPORTED` if the `zvb.current_slot` boot argument cannot be read
1324    /// or is an unexpected value.
1325    QueryCurrentConfiguration { responder: BootManagerQueryCurrentConfigurationResponder },
1326    /// Queries the configuration which will be used as the default boot choice on a normal cold
1327    /// boot, which may differ from the currently running configuration. `Configuration::RECOVERY`
1328    /// should never be active.
1329    ///
1330    /// Returns `ZX_ERR_NOT_SUPPORTED` if `Configuration.RECOVERY` is active.
1331    QueryActiveConfiguration { responder: BootManagerQueryActiveConfigurationResponder },
1332    /// Queries the configuration that was last explicitly marked as active by
1333    /// SetConfigurationActive(). The result is not affected by the current status of the slot.
1334    ///
1335    /// A newly updated slot is typically marked as active immediately. Therefore this interface
1336    /// can be used as a way to identify the newest slot.
1337    ///
1338    /// Returns `ZX_ERR_IO` if fail to load abr metadata. Returns `ZX_ERR_INTERNAL` if invalid
1339    /// slot index is returned by libabr routine.
1340    QueryConfigurationLastSetActive {
1341        responder: BootManagerQueryConfigurationLastSetActiveResponder,
1342    },
1343    /// Queries status of `configuration`.
1344    ///
1345    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
1346    QueryConfigurationStatus {
1347        configuration: Configuration,
1348        responder: BootManagerQueryConfigurationStatusResponder,
1349    },
1350    /// Queries status of `configuration`.
1351    ///
1352    /// The returned table contains:
1353    ///
1354    /// * `status`: the current `ConfigurationStatus`
1355    ///
1356    /// * `boot_attempts`: if `status` is `ConfigurationStatus::PENDING`, this will be the number of
1357    ///   times this configuration has attempted to boot, including the current attempt. For any
1358    ///   other `status` this value will not be provided.
1359    ///
1360    ///   If provided, this value will be in the range `[0, MAX_PENDING_BOOT_ATTEMPTS]`. 0 indicates
1361    ///   the configuration was just set active and has not attempted any boots yet, and
1362    ///   `MAX_PENDING_BOOT_ATTEMPTS` indicates that all attempts have been used.
1363    ///
1364    /// * `unbootable_reason`: if `status` is `ConfigurationStatus::UNBOOTABLE`, this will be the
1365    ///   reported reason for why the configuration is unbootable. For any other `status` this value
1366    ///   will not be provided.
1367    ///
1368    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
1369    QueryConfigurationStatusAndBootAttempts {
1370        configuration: Configuration,
1371        responder: BootManagerQueryConfigurationStatusAndBootAttemptsResponder,
1372    },
1373    /// Updates persistent metadata identifying which configuration should be selected as 'primary'
1374    /// for booting purposes. Should only be called after `KERNEL` as well as optional
1375    /// `VERIFIED_BOOT_METADATA` assets for specified `configuration` were written successfully.
1376    ///
1377    /// Also resets the boot attempts count for the given `Configuration`.
1378    ///
1379    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
1380    SetConfigurationActive {
1381        configuration: Configuration,
1382        responder: BootManagerSetConfigurationActiveResponder,
1383    },
1384    /// Updates persistent metadata identifying whether `configuration` is bootable.
1385    /// Should only be called in the following situations:
1386    /// * Before `KERNEL` as well as optional `VERIFIED_BOOT_METADATA` assets for specified
1387    ///   `configuration` are written.
1388    /// * After successfully booting from a new configuration and marking it healthy. This method
1389    ///   would be then called on the old configuration.
1390    /// * After "successfully" booting from a new configuration, but encountering an unrecoverable
1391    ///   error during health check. This method would be then called on the new configuration.
1392    ///
1393    /// If the configuration is unbootable, no action is taken.
1394    ///
1395    /// Returns `ZX_ERR_INVALID_ARGS` if `Configuration.RECOVERY` is passed in via `configuration`.
1396    SetConfigurationUnbootable {
1397        configuration: Configuration,
1398        responder: BootManagerSetConfigurationUnbootableResponder,
1399    },
1400    /// Updates persistent metadata to mark a [`fuchsia.paver/Configuration`]
1401    /// as successful.
1402    ///
1403    /// This function is typically used by the OS update system after having
1404    /// confirmed that the configuration works as intended and the "rollback to
1405    /// previous slot" logic is not needed anymore.
1406    ///
1407    /// Compatibility between the newly successful configuration and the other
1408    /// configuration is unknown. Even if the other configuration was
1409    /// successful at one point, it may no longer be. This function adds a
1410    /// success mark to the given configuration but also removes any success
1411    /// mark on the other.
1412    ///
1413    /// If `configuration` is unbootable or is
1414    /// [`fuchsia.paver/Configuration.RECOVERY`], `response` will be
1415    /// `ZX_ERR_INVALID_ARGS`.
1416    ///
1417    /// + request `configuration` the `Configuration` to mark as healthy. Must
1418    ///   not be `RECOVERY`.
1419    /// - response `status` a zx_status value indicating success or failure.
1420    SetConfigurationHealthy {
1421        configuration: Configuration,
1422        responder: BootManagerSetConfigurationHealthyResponder,
1423    },
1424    /// Force device to boot to recovery in the next reboot/power cycle. This will only be
1425    /// triggered once and will be reset after the reboot. State of A/B configuration slot will not
1426    /// be affected.
1427    SetOneShotRecovery { responder: BootManagerSetOneShotRecoveryResponder },
1428    /// Flush all previously buffered writes to persistent storage.
1429    Flush { responder: BootManagerFlushResponder },
1430}
1431
1432impl BootManagerRequest {
1433    #[allow(irrefutable_let_patterns)]
1434    pub fn into_query_current_configuration(
1435        self,
1436    ) -> Option<(BootManagerQueryCurrentConfigurationResponder)> {
1437        if let BootManagerRequest::QueryCurrentConfiguration { responder } = self {
1438            Some((responder))
1439        } else {
1440            None
1441        }
1442    }
1443
1444    #[allow(irrefutable_let_patterns)]
1445    pub fn into_query_active_configuration(
1446        self,
1447    ) -> Option<(BootManagerQueryActiveConfigurationResponder)> {
1448        if let BootManagerRequest::QueryActiveConfiguration { responder } = self {
1449            Some((responder))
1450        } else {
1451            None
1452        }
1453    }
1454
1455    #[allow(irrefutable_let_patterns)]
1456    pub fn into_query_configuration_last_set_active(
1457        self,
1458    ) -> Option<(BootManagerQueryConfigurationLastSetActiveResponder)> {
1459        if let BootManagerRequest::QueryConfigurationLastSetActive { responder } = self {
1460            Some((responder))
1461        } else {
1462            None
1463        }
1464    }
1465
1466    #[allow(irrefutable_let_patterns)]
1467    pub fn into_query_configuration_status(
1468        self,
1469    ) -> Option<(Configuration, BootManagerQueryConfigurationStatusResponder)> {
1470        if let BootManagerRequest::QueryConfigurationStatus { configuration, responder } = self {
1471            Some((configuration, responder))
1472        } else {
1473            None
1474        }
1475    }
1476
1477    #[allow(irrefutable_let_patterns)]
1478    pub fn into_query_configuration_status_and_boot_attempts(
1479        self,
1480    ) -> Option<(Configuration, BootManagerQueryConfigurationStatusAndBootAttemptsResponder)> {
1481        if let BootManagerRequest::QueryConfigurationStatusAndBootAttempts {
1482            configuration,
1483            responder,
1484        } = self
1485        {
1486            Some((configuration, responder))
1487        } else {
1488            None
1489        }
1490    }
1491
1492    #[allow(irrefutable_let_patterns)]
1493    pub fn into_set_configuration_active(
1494        self,
1495    ) -> Option<(Configuration, BootManagerSetConfigurationActiveResponder)> {
1496        if let BootManagerRequest::SetConfigurationActive { configuration, responder } = self {
1497            Some((configuration, responder))
1498        } else {
1499            None
1500        }
1501    }
1502
1503    #[allow(irrefutable_let_patterns)]
1504    pub fn into_set_configuration_unbootable(
1505        self,
1506    ) -> Option<(Configuration, BootManagerSetConfigurationUnbootableResponder)> {
1507        if let BootManagerRequest::SetConfigurationUnbootable { configuration, responder } = self {
1508            Some((configuration, responder))
1509        } else {
1510            None
1511        }
1512    }
1513
1514    #[allow(irrefutable_let_patterns)]
1515    pub fn into_set_configuration_healthy(
1516        self,
1517    ) -> Option<(Configuration, BootManagerSetConfigurationHealthyResponder)> {
1518        if let BootManagerRequest::SetConfigurationHealthy { configuration, responder } = self {
1519            Some((configuration, responder))
1520        } else {
1521            None
1522        }
1523    }
1524
1525    #[allow(irrefutable_let_patterns)]
1526    pub fn into_set_one_shot_recovery(self) -> Option<(BootManagerSetOneShotRecoveryResponder)> {
1527        if let BootManagerRequest::SetOneShotRecovery { responder } = self {
1528            Some((responder))
1529        } else {
1530            None
1531        }
1532    }
1533
1534    #[allow(irrefutable_let_patterns)]
1535    pub fn into_flush(self) -> Option<(BootManagerFlushResponder)> {
1536        if let BootManagerRequest::Flush { responder } = self { Some((responder)) } else { None }
1537    }
1538
1539    /// Name of the method defined in FIDL
1540    pub fn method_name(&self) -> &'static str {
1541        match *self {
1542            BootManagerRequest::QueryCurrentConfiguration { .. } => "query_current_configuration",
1543            BootManagerRequest::QueryActiveConfiguration { .. } => "query_active_configuration",
1544            BootManagerRequest::QueryConfigurationLastSetActive { .. } => {
1545                "query_configuration_last_set_active"
1546            }
1547            BootManagerRequest::QueryConfigurationStatus { .. } => "query_configuration_status",
1548            BootManagerRequest::QueryConfigurationStatusAndBootAttempts { .. } => {
1549                "query_configuration_status_and_boot_attempts"
1550            }
1551            BootManagerRequest::SetConfigurationActive { .. } => "set_configuration_active",
1552            BootManagerRequest::SetConfigurationUnbootable { .. } => "set_configuration_unbootable",
1553            BootManagerRequest::SetConfigurationHealthy { .. } => "set_configuration_healthy",
1554            BootManagerRequest::SetOneShotRecovery { .. } => "set_one_shot_recovery",
1555            BootManagerRequest::Flush { .. } => "flush",
1556        }
1557    }
1558}
1559
1560#[derive(Debug, Clone)]
1561pub struct BootManagerControlHandle {
1562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1563}
1564
1565impl fidl::endpoints::ControlHandle for BootManagerControlHandle {
1566    fn shutdown(&self) {
1567        self.inner.shutdown()
1568    }
1569
1570    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1571        self.inner.shutdown_with_epitaph(status)
1572    }
1573
1574    fn is_closed(&self) -> bool {
1575        self.inner.channel().is_closed()
1576    }
1577    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1578        self.inner.channel().on_closed()
1579    }
1580
1581    #[cfg(target_os = "fuchsia")]
1582    fn signal_peer(
1583        &self,
1584        clear_mask: zx::Signals,
1585        set_mask: zx::Signals,
1586    ) -> Result<(), zx_status::Status> {
1587        use fidl::Peered;
1588        self.inner.channel().signal_peer(clear_mask, set_mask)
1589    }
1590}
1591
1592impl BootManagerControlHandle {}
1593
1594#[must_use = "FIDL methods require a response to be sent"]
1595#[derive(Debug)]
1596pub struct BootManagerQueryCurrentConfigurationResponder {
1597    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
1598    tx_id: u32,
1599}
1600
1601/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
1602/// if the responder is dropped without sending a response, so that the client
1603/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1604impl std::ops::Drop for BootManagerQueryCurrentConfigurationResponder {
1605    fn drop(&mut self) {
1606        self.control_handle.shutdown();
1607        // Safety: drops once, never accessed again
1608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1609    }
1610}
1611
1612impl fidl::endpoints::Responder for BootManagerQueryCurrentConfigurationResponder {
1613    type ControlHandle = BootManagerControlHandle;
1614
1615    fn control_handle(&self) -> &BootManagerControlHandle {
1616        &self.control_handle
1617    }
1618
1619    fn drop_without_shutdown(mut self) {
1620        // Safety: drops once, never accessed again due to mem::forget
1621        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1622        // Prevent Drop from running (which would shut down the channel)
1623        std::mem::forget(self);
1624    }
1625}
1626
1627impl BootManagerQueryCurrentConfigurationResponder {
1628    /// Sends a response to the FIDL transaction.
1629    ///
1630    /// Sets the channel to shutdown if an error occurs.
1631    pub fn send(self, mut result: Result<Configuration, i32>) -> Result<(), fidl::Error> {
1632        let _result = self.send_raw(result);
1633        if _result.is_err() {
1634            self.control_handle.shutdown();
1635        }
1636        self.drop_without_shutdown();
1637        _result
1638    }
1639
1640    /// Similar to "send" but does not shutdown the channel if an error occurs.
1641    pub fn send_no_shutdown_on_err(
1642        self,
1643        mut result: Result<Configuration, i32>,
1644    ) -> Result<(), fidl::Error> {
1645        let _result = self.send_raw(result);
1646        self.drop_without_shutdown();
1647        _result
1648    }
1649
1650    fn send_raw(&self, mut result: Result<Configuration, i32>) -> Result<(), fidl::Error> {
1651        self.control_handle.inner.send::<fidl::encoding::ResultType<
1652            BootManagerQueryCurrentConfigurationResponse,
1653            i32,
1654        >>(
1655            result.map(|configuration| (configuration,)),
1656            self.tx_id,
1657            0xc213298cbc9c371,
1658            fidl::encoding::DynamicFlags::empty(),
1659        )
1660    }
1661}
1662
1663#[must_use = "FIDL methods require a response to be sent"]
1664#[derive(Debug)]
1665pub struct BootManagerQueryActiveConfigurationResponder {
1666    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
1667    tx_id: u32,
1668}
1669
1670/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
1671/// if the responder is dropped without sending a response, so that the client
1672/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1673impl std::ops::Drop for BootManagerQueryActiveConfigurationResponder {
1674    fn drop(&mut self) {
1675        self.control_handle.shutdown();
1676        // Safety: drops once, never accessed again
1677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1678    }
1679}
1680
1681impl fidl::endpoints::Responder for BootManagerQueryActiveConfigurationResponder {
1682    type ControlHandle = BootManagerControlHandle;
1683
1684    fn control_handle(&self) -> &BootManagerControlHandle {
1685        &self.control_handle
1686    }
1687
1688    fn drop_without_shutdown(mut self) {
1689        // Safety: drops once, never accessed again due to mem::forget
1690        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1691        // Prevent Drop from running (which would shut down the channel)
1692        std::mem::forget(self);
1693    }
1694}
1695
1696impl BootManagerQueryActiveConfigurationResponder {
1697    /// Sends a response to the FIDL transaction.
1698    ///
1699    /// Sets the channel to shutdown if an error occurs.
1700    pub fn send(self, mut result: Result<Configuration, i32>) -> Result<(), fidl::Error> {
1701        let _result = self.send_raw(result);
1702        if _result.is_err() {
1703            self.control_handle.shutdown();
1704        }
1705        self.drop_without_shutdown();
1706        _result
1707    }
1708
1709    /// Similar to "send" but does not shutdown the channel if an error occurs.
1710    pub fn send_no_shutdown_on_err(
1711        self,
1712        mut result: Result<Configuration, i32>,
1713    ) -> Result<(), fidl::Error> {
1714        let _result = self.send_raw(result);
1715        self.drop_without_shutdown();
1716        _result
1717    }
1718
1719    fn send_raw(&self, mut result: Result<Configuration, i32>) -> Result<(), fidl::Error> {
1720        self.control_handle.inner.send::<fidl::encoding::ResultType<
1721            BootManagerQueryActiveConfigurationResponse,
1722            i32,
1723        >>(
1724            result.map(|configuration| (configuration,)),
1725            self.tx_id,
1726            0x71d52acdf59947a4,
1727            fidl::encoding::DynamicFlags::empty(),
1728        )
1729    }
1730}
1731
1732#[must_use = "FIDL methods require a response to be sent"]
1733#[derive(Debug)]
1734pub struct BootManagerQueryConfigurationLastSetActiveResponder {
1735    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
1736    tx_id: u32,
1737}
1738
1739/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
1740/// if the responder is dropped without sending a response, so that the client
1741/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1742impl std::ops::Drop for BootManagerQueryConfigurationLastSetActiveResponder {
1743    fn drop(&mut self) {
1744        self.control_handle.shutdown();
1745        // Safety: drops once, never accessed again
1746        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1747    }
1748}
1749
1750impl fidl::endpoints::Responder for BootManagerQueryConfigurationLastSetActiveResponder {
1751    type ControlHandle = BootManagerControlHandle;
1752
1753    fn control_handle(&self) -> &BootManagerControlHandle {
1754        &self.control_handle
1755    }
1756
1757    fn drop_without_shutdown(mut self) {
1758        // Safety: drops once, never accessed again due to mem::forget
1759        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1760        // Prevent Drop from running (which would shut down the channel)
1761        std::mem::forget(self);
1762    }
1763}
1764
1765impl BootManagerQueryConfigurationLastSetActiveResponder {
1766    /// Sends a response to the FIDL transaction.
1767    ///
1768    /// Sets the channel to shutdown if an error occurs.
1769    pub fn send(self, mut result: Result<Configuration, i32>) -> Result<(), fidl::Error> {
1770        let _result = self.send_raw(result);
1771        if _result.is_err() {
1772            self.control_handle.shutdown();
1773        }
1774        self.drop_without_shutdown();
1775        _result
1776    }
1777
1778    /// Similar to "send" but does not shutdown the channel if an error occurs.
1779    pub fn send_no_shutdown_on_err(
1780        self,
1781        mut result: Result<Configuration, i32>,
1782    ) -> Result<(), fidl::Error> {
1783        let _result = self.send_raw(result);
1784        self.drop_without_shutdown();
1785        _result
1786    }
1787
1788    fn send_raw(&self, mut result: Result<Configuration, i32>) -> Result<(), fidl::Error> {
1789        self.control_handle.inner.send::<fidl::encoding::ResultType<
1790            BootManagerQueryConfigurationLastSetActiveResponse,
1791            i32,
1792        >>(
1793            result.map(|configuration| (configuration,)),
1794            self.tx_id,
1795            0x6bcad87311b3345,
1796            fidl::encoding::DynamicFlags::empty(),
1797        )
1798    }
1799}
1800
1801#[must_use = "FIDL methods require a response to be sent"]
1802#[derive(Debug)]
1803pub struct BootManagerQueryConfigurationStatusResponder {
1804    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
1805    tx_id: u32,
1806}
1807
1808/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
1809/// if the responder is dropped without sending a response, so that the client
1810/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1811impl std::ops::Drop for BootManagerQueryConfigurationStatusResponder {
1812    fn drop(&mut self) {
1813        self.control_handle.shutdown();
1814        // Safety: drops once, never accessed again
1815        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1816    }
1817}
1818
1819impl fidl::endpoints::Responder for BootManagerQueryConfigurationStatusResponder {
1820    type ControlHandle = BootManagerControlHandle;
1821
1822    fn control_handle(&self) -> &BootManagerControlHandle {
1823        &self.control_handle
1824    }
1825
1826    fn drop_without_shutdown(mut self) {
1827        // Safety: drops once, never accessed again due to mem::forget
1828        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1829        // Prevent Drop from running (which would shut down the channel)
1830        std::mem::forget(self);
1831    }
1832}
1833
1834impl BootManagerQueryConfigurationStatusResponder {
1835    /// Sends a response to the FIDL transaction.
1836    ///
1837    /// Sets the channel to shutdown if an error occurs.
1838    pub fn send(self, mut result: Result<ConfigurationStatus, i32>) -> Result<(), fidl::Error> {
1839        let _result = self.send_raw(result);
1840        if _result.is_err() {
1841            self.control_handle.shutdown();
1842        }
1843        self.drop_without_shutdown();
1844        _result
1845    }
1846
1847    /// Similar to "send" but does not shutdown the channel if an error occurs.
1848    pub fn send_no_shutdown_on_err(
1849        self,
1850        mut result: Result<ConfigurationStatus, i32>,
1851    ) -> Result<(), fidl::Error> {
1852        let _result = self.send_raw(result);
1853        self.drop_without_shutdown();
1854        _result
1855    }
1856
1857    fn send_raw(&self, mut result: Result<ConfigurationStatus, i32>) -> Result<(), fidl::Error> {
1858        self.control_handle.inner.send::<fidl::encoding::ResultType<
1859            BootManagerQueryConfigurationStatusResponse,
1860            i32,
1861        >>(
1862            result.map(|status| (status,)),
1863            self.tx_id,
1864            0x40822ca9ca68b19a,
1865            fidl::encoding::DynamicFlags::empty(),
1866        )
1867    }
1868}
1869
1870#[must_use = "FIDL methods require a response to be sent"]
1871#[derive(Debug)]
1872pub struct BootManagerQueryConfigurationStatusAndBootAttemptsResponder {
1873    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
1874    tx_id: u32,
1875}
1876
1877/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
1878/// if the responder is dropped without sending a response, so that the client
1879/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1880impl std::ops::Drop for BootManagerQueryConfigurationStatusAndBootAttemptsResponder {
1881    fn drop(&mut self) {
1882        self.control_handle.shutdown();
1883        // Safety: drops once, never accessed again
1884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1885    }
1886}
1887
1888impl fidl::endpoints::Responder for BootManagerQueryConfigurationStatusAndBootAttemptsResponder {
1889    type ControlHandle = BootManagerControlHandle;
1890
1891    fn control_handle(&self) -> &BootManagerControlHandle {
1892        &self.control_handle
1893    }
1894
1895    fn drop_without_shutdown(mut self) {
1896        // Safety: drops once, never accessed again due to mem::forget
1897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1898        // Prevent Drop from running (which would shut down the channel)
1899        std::mem::forget(self);
1900    }
1901}
1902
1903impl BootManagerQueryConfigurationStatusAndBootAttemptsResponder {
1904    /// Sends a response to the FIDL transaction.
1905    ///
1906    /// Sets the channel to shutdown if an error occurs.
1907    pub fn send(
1908        self,
1909        mut result: Result<&BootManagerQueryConfigurationStatusAndBootAttemptsResponse, i32>,
1910    ) -> 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(
1921        self,
1922        mut result: Result<&BootManagerQueryConfigurationStatusAndBootAttemptsResponse, i32>,
1923    ) -> Result<(), fidl::Error> {
1924        let _result = self.send_raw(result);
1925        self.drop_without_shutdown();
1926        _result
1927    }
1928
1929    fn send_raw(
1930        &self,
1931        mut result: Result<&BootManagerQueryConfigurationStatusAndBootAttemptsResponse, i32>,
1932    ) -> Result<(), fidl::Error> {
1933        self.control_handle.inner.send::<fidl::encoding::ResultType<
1934            BootManagerQueryConfigurationStatusAndBootAttemptsResponse,
1935            i32,
1936        >>(
1937            result,
1938            self.tx_id,
1939            0x27f851d5809cfb3d,
1940            fidl::encoding::DynamicFlags::empty(),
1941        )
1942    }
1943}
1944
1945#[must_use = "FIDL methods require a response to be sent"]
1946#[derive(Debug)]
1947pub struct BootManagerSetConfigurationActiveResponder {
1948    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
1949    tx_id: u32,
1950}
1951
1952/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
1953/// if the responder is dropped without sending a response, so that the client
1954/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1955impl std::ops::Drop for BootManagerSetConfigurationActiveResponder {
1956    fn drop(&mut self) {
1957        self.control_handle.shutdown();
1958        // Safety: drops once, never accessed again
1959        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1960    }
1961}
1962
1963impl fidl::endpoints::Responder for BootManagerSetConfigurationActiveResponder {
1964    type ControlHandle = BootManagerControlHandle;
1965
1966    fn control_handle(&self) -> &BootManagerControlHandle {
1967        &self.control_handle
1968    }
1969
1970    fn drop_without_shutdown(mut self) {
1971        // Safety: drops once, never accessed again due to mem::forget
1972        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1973        // Prevent Drop from running (which would shut down the channel)
1974        std::mem::forget(self);
1975    }
1976}
1977
1978impl BootManagerSetConfigurationActiveResponder {
1979    /// Sends a response to the FIDL transaction.
1980    ///
1981    /// Sets the channel to shutdown if an error occurs.
1982    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1983        let _result = self.send_raw(status);
1984        if _result.is_err() {
1985            self.control_handle.shutdown();
1986        }
1987        self.drop_without_shutdown();
1988        _result
1989    }
1990
1991    /// Similar to "send" but does not shutdown the channel if an error occurs.
1992    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1993        let _result = self.send_raw(status);
1994        self.drop_without_shutdown();
1995        _result
1996    }
1997
1998    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1999        self.control_handle.inner.send::<BootManagerSetConfigurationActiveResponse>(
2000            (status,),
2001            self.tx_id,
2002            0x14c64074f81f9a7f,
2003            fidl::encoding::DynamicFlags::empty(),
2004        )
2005    }
2006}
2007
2008#[must_use = "FIDL methods require a response to be sent"]
2009#[derive(Debug)]
2010pub struct BootManagerSetConfigurationUnbootableResponder {
2011    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
2012    tx_id: u32,
2013}
2014
2015/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
2016/// if the responder is dropped without sending a response, so that the client
2017/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2018impl std::ops::Drop for BootManagerSetConfigurationUnbootableResponder {
2019    fn drop(&mut self) {
2020        self.control_handle.shutdown();
2021        // Safety: drops once, never accessed again
2022        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2023    }
2024}
2025
2026impl fidl::endpoints::Responder for BootManagerSetConfigurationUnbootableResponder {
2027    type ControlHandle = BootManagerControlHandle;
2028
2029    fn control_handle(&self) -> &BootManagerControlHandle {
2030        &self.control_handle
2031    }
2032
2033    fn drop_without_shutdown(mut self) {
2034        // Safety: drops once, never accessed again due to mem::forget
2035        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2036        // Prevent Drop from running (which would shut down the channel)
2037        std::mem::forget(self);
2038    }
2039}
2040
2041impl BootManagerSetConfigurationUnbootableResponder {
2042    /// Sends a response to the FIDL transaction.
2043    ///
2044    /// Sets the channel to shutdown if an error occurs.
2045    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2046        let _result = self.send_raw(status);
2047        if _result.is_err() {
2048            self.control_handle.shutdown();
2049        }
2050        self.drop_without_shutdown();
2051        _result
2052    }
2053
2054    /// Similar to "send" but does not shutdown the channel if an error occurs.
2055    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2056        let _result = self.send_raw(status);
2057        self.drop_without_shutdown();
2058        _result
2059    }
2060
2061    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2062        self.control_handle.inner.send::<BootManagerSetConfigurationUnbootableResponse>(
2063            (status,),
2064            self.tx_id,
2065            0x6f8716bf306d197f,
2066            fidl::encoding::DynamicFlags::empty(),
2067        )
2068    }
2069}
2070
2071#[must_use = "FIDL methods require a response to be sent"]
2072#[derive(Debug)]
2073pub struct BootManagerSetConfigurationHealthyResponder {
2074    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
2075    tx_id: u32,
2076}
2077
2078/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
2079/// if the responder is dropped without sending a response, so that the client
2080/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2081impl std::ops::Drop for BootManagerSetConfigurationHealthyResponder {
2082    fn drop(&mut self) {
2083        self.control_handle.shutdown();
2084        // Safety: drops once, never accessed again
2085        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2086    }
2087}
2088
2089impl fidl::endpoints::Responder for BootManagerSetConfigurationHealthyResponder {
2090    type ControlHandle = BootManagerControlHandle;
2091
2092    fn control_handle(&self) -> &BootManagerControlHandle {
2093        &self.control_handle
2094    }
2095
2096    fn drop_without_shutdown(mut self) {
2097        // Safety: drops once, never accessed again due to mem::forget
2098        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2099        // Prevent Drop from running (which would shut down the channel)
2100        std::mem::forget(self);
2101    }
2102}
2103
2104impl BootManagerSetConfigurationHealthyResponder {
2105    /// Sends a response to the FIDL transaction.
2106    ///
2107    /// Sets the channel to shutdown if an error occurs.
2108    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2109        let _result = self.send_raw(status);
2110        if _result.is_err() {
2111            self.control_handle.shutdown();
2112        }
2113        self.drop_without_shutdown();
2114        _result
2115    }
2116
2117    /// Similar to "send" but does not shutdown the channel if an error occurs.
2118    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2119        let _result = self.send_raw(status);
2120        self.drop_without_shutdown();
2121        _result
2122    }
2123
2124    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2125        self.control_handle.inner.send::<BootManagerSetConfigurationHealthyResponse>(
2126            (status,),
2127            self.tx_id,
2128            0x5dfe31714c8ec4be,
2129            fidl::encoding::DynamicFlags::empty(),
2130        )
2131    }
2132}
2133
2134#[must_use = "FIDL methods require a response to be sent"]
2135#[derive(Debug)]
2136pub struct BootManagerSetOneShotRecoveryResponder {
2137    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
2138    tx_id: u32,
2139}
2140
2141/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
2142/// if the responder is dropped without sending a response, so that the client
2143/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2144impl std::ops::Drop for BootManagerSetOneShotRecoveryResponder {
2145    fn drop(&mut self) {
2146        self.control_handle.shutdown();
2147        // Safety: drops once, never accessed again
2148        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2149    }
2150}
2151
2152impl fidl::endpoints::Responder for BootManagerSetOneShotRecoveryResponder {
2153    type ControlHandle = BootManagerControlHandle;
2154
2155    fn control_handle(&self) -> &BootManagerControlHandle {
2156        &self.control_handle
2157    }
2158
2159    fn drop_without_shutdown(mut self) {
2160        // Safety: drops once, never accessed again due to mem::forget
2161        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2162        // Prevent Drop from running (which would shut down the channel)
2163        std::mem::forget(self);
2164    }
2165}
2166
2167impl BootManagerSetOneShotRecoveryResponder {
2168    /// Sends a response to the FIDL transaction.
2169    ///
2170    /// Sets the channel to shutdown if an error occurs.
2171    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2172        let _result = self.send_raw(result);
2173        if _result.is_err() {
2174            self.control_handle.shutdown();
2175        }
2176        self.drop_without_shutdown();
2177        _result
2178    }
2179
2180    /// Similar to "send" but does not shutdown the channel if an error occurs.
2181    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2182        let _result = self.send_raw(result);
2183        self.drop_without_shutdown();
2184        _result
2185    }
2186
2187    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2188        self.control_handle
2189            .inner
2190            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2191                result,
2192                self.tx_id,
2193                0x7a5af0a28354f24d,
2194                fidl::encoding::DynamicFlags::empty(),
2195            )
2196    }
2197}
2198
2199#[must_use = "FIDL methods require a response to be sent"]
2200#[derive(Debug)]
2201pub struct BootManagerFlushResponder {
2202    control_handle: std::mem::ManuallyDrop<BootManagerControlHandle>,
2203    tx_id: u32,
2204}
2205
2206/// Set the the channel to be shutdown (see [`BootManagerControlHandle::shutdown`])
2207/// if the responder is dropped without sending a response, so that the client
2208/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2209impl std::ops::Drop for BootManagerFlushResponder {
2210    fn drop(&mut self) {
2211        self.control_handle.shutdown();
2212        // Safety: drops once, never accessed again
2213        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2214    }
2215}
2216
2217impl fidl::endpoints::Responder for BootManagerFlushResponder {
2218    type ControlHandle = BootManagerControlHandle;
2219
2220    fn control_handle(&self) -> &BootManagerControlHandle {
2221        &self.control_handle
2222    }
2223
2224    fn drop_without_shutdown(mut self) {
2225        // Safety: drops once, never accessed again due to mem::forget
2226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2227        // Prevent Drop from running (which would shut down the channel)
2228        std::mem::forget(self);
2229    }
2230}
2231
2232impl BootManagerFlushResponder {
2233    /// Sends a response to the FIDL transaction.
2234    ///
2235    /// Sets the channel to shutdown if an error occurs.
2236    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2237        let _result = self.send_raw(status);
2238        if _result.is_err() {
2239            self.control_handle.shutdown();
2240        }
2241        self.drop_without_shutdown();
2242        _result
2243    }
2244
2245    /// Similar to "send" but does not shutdown the channel if an error occurs.
2246    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2247        let _result = self.send_raw(status);
2248        self.drop_without_shutdown();
2249        _result
2250    }
2251
2252    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2253        self.control_handle.inner.send::<BootManagerFlushResponse>(
2254            (status,),
2255            self.tx_id,
2256            0x2f29ec2322d62d3e,
2257            fidl::encoding::DynamicFlags::empty(),
2258        )
2259    }
2260}
2261
2262#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2263pub struct DataSinkMarker;
2264
2265impl fidl::endpoints::ProtocolMarker for DataSinkMarker {
2266    type Proxy = DataSinkProxy;
2267    type RequestStream = DataSinkRequestStream;
2268    #[cfg(target_os = "fuchsia")]
2269    type SynchronousProxy = DataSinkSynchronousProxy;
2270
2271    const DEBUG_NAME: &'static str = "(anonymous) DataSink";
2272}
2273pub type DataSinkReadAssetResult = Result<fidl_fuchsia_mem::Buffer, i32>;
2274pub type DataSinkReadFirmwareResult = Result<fidl_fuchsia_mem::Buffer, i32>;
2275pub type DataSinkWriteOpaqueVolumeResult = Result<(), i32>;
2276pub type DataSinkWriteSparseVolumeResult = Result<(), i32>;
2277
2278pub trait DataSinkProxyInterface: Send + Sync {
2279    type ReadAssetResponseFut: std::future::Future<Output = Result<DataSinkReadAssetResult, fidl::Error>>
2280        + Send;
2281    fn r#read_asset(
2282        &self,
2283        configuration: Configuration,
2284        asset: Asset,
2285    ) -> Self::ReadAssetResponseFut;
2286    type WriteAssetResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2287    fn r#write_asset(
2288        &self,
2289        configuration: Configuration,
2290        asset: Asset,
2291        payload: fidl_fuchsia_mem::Buffer,
2292    ) -> Self::WriteAssetResponseFut;
2293    type WriteFirmwareResponseFut: std::future::Future<Output = Result<WriteFirmwareResult, fidl::Error>>
2294        + Send;
2295    fn r#write_firmware(
2296        &self,
2297        configuration: Configuration,
2298        type_: &str,
2299        payload: fidl_fuchsia_mem::Buffer,
2300    ) -> Self::WriteFirmwareResponseFut;
2301    type ReadFirmwareResponseFut: std::future::Future<Output = Result<DataSinkReadFirmwareResult, fidl::Error>>
2302        + Send;
2303    fn r#read_firmware(
2304        &self,
2305        configuration: Configuration,
2306        type_: &str,
2307    ) -> Self::ReadFirmwareResponseFut;
2308    type WriteVolumesResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2309    fn r#write_volumes(
2310        &self,
2311        payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
2312    ) -> Self::WriteVolumesResponseFut;
2313    type WriteOpaqueVolumeResponseFut: std::future::Future<Output = Result<DataSinkWriteOpaqueVolumeResult, fidl::Error>>
2314        + Send;
2315    fn r#write_opaque_volume(
2316        &self,
2317        payload: fidl_fuchsia_mem::Buffer,
2318    ) -> Self::WriteOpaqueVolumeResponseFut;
2319    type WriteSparseVolumeResponseFut: std::future::Future<Output = Result<DataSinkWriteSparseVolumeResult, fidl::Error>>
2320        + Send;
2321    fn r#write_sparse_volume(
2322        &self,
2323        payload: fidl_fuchsia_mem::Buffer,
2324    ) -> Self::WriteSparseVolumeResponseFut;
2325    type FlushResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
2326    fn r#flush(&self) -> Self::FlushResponseFut;
2327}
2328#[derive(Debug)]
2329#[cfg(target_os = "fuchsia")]
2330pub struct DataSinkSynchronousProxy {
2331    client: fidl::client::sync::Client,
2332}
2333
2334#[cfg(target_os = "fuchsia")]
2335impl fidl::endpoints::SynchronousProxy for DataSinkSynchronousProxy {
2336    type Proxy = DataSinkProxy;
2337    type Protocol = DataSinkMarker;
2338
2339    fn from_channel(inner: fidl::Channel) -> Self {
2340        Self::new(inner)
2341    }
2342
2343    fn into_channel(self) -> fidl::Channel {
2344        self.client.into_channel()
2345    }
2346
2347    fn as_channel(&self) -> &fidl::Channel {
2348        self.client.as_channel()
2349    }
2350}
2351
2352#[cfg(target_os = "fuchsia")]
2353impl DataSinkSynchronousProxy {
2354    pub fn new(channel: fidl::Channel) -> Self {
2355        Self { client: fidl::client::sync::Client::new(channel) }
2356    }
2357
2358    pub fn into_channel(self) -> fidl::Channel {
2359        self.client.into_channel()
2360    }
2361
2362    /// Waits until an event arrives and returns it. It is safe for other
2363    /// threads to make concurrent requests while waiting for an event.
2364    pub fn wait_for_event(
2365        &self,
2366        deadline: zx::MonotonicInstant,
2367    ) -> Result<DataSinkEvent, fidl::Error> {
2368        DataSinkEvent::decode(self.client.wait_for_event::<DataSinkMarker>(deadline)?)
2369    }
2370
2371    /// Reads the partition corresponding to `configuration` and `asset` into a vmo and returns it.
2372    /// The size field of the returned `Buffer` will be the size of just the asset, if it can be
2373    /// determined. Otherwise, it will be the size of the entire partition.
2374    /// The size and stream size of the vmo in the returned `Buffer` will always be the size of the
2375    /// entire partition.
2376    pub fn r#read_asset(
2377        &self,
2378        mut configuration: Configuration,
2379        mut asset: Asset,
2380        ___deadline: zx::MonotonicInstant,
2381    ) -> Result<DataSinkReadAssetResult, fidl::Error> {
2382        let _response = self.client.send_query::<
2383            DataSinkReadAssetRequest,
2384            fidl::encoding::ResultType<DataSinkReadAssetResponse, i32>,
2385            DataSinkMarker,
2386        >(
2387            (configuration, asset,),
2388            0x125a23e561007898,
2389            fidl::encoding::DynamicFlags::empty(),
2390            ___deadline,
2391        )?;
2392        Ok(_response.map(|x| x.asset))
2393    }
2394
2395    /// Writes partition corresponding to `configuration` and `asset` with data from `payload`.
2396    /// `payload` may need to be resized to the partition size, so the provided vmo must have
2397    /// been created with `ZX_VMO_RESIZABLE` or must be a child VMO that was created with
2398    /// `ZX_VMO_CHILD_RESIZABLE`. Will zero out rest of the partition if `payload` is smaller
2399    /// than the size of the partition being written.
2400    ///
2401    ///
2402    /// Returns `ZX_ERR_INVALID_ARGS` if `configuration` specifies active configuration.
2403    pub fn r#write_asset(
2404        &self,
2405        mut configuration: Configuration,
2406        mut asset: Asset,
2407        mut payload: fidl_fuchsia_mem::Buffer,
2408        ___deadline: zx::MonotonicInstant,
2409    ) -> Result<i32, fidl::Error> {
2410        let _response = self
2411            .client
2412            .send_query::<DataSinkWriteAssetRequest, DataSinkWriteAssetResponse, DataSinkMarker>(
2413                (configuration, asset, &mut payload),
2414                0x516839ce76c4d0a9,
2415                fidl::encoding::DynamicFlags::empty(),
2416                ___deadline,
2417            )?;
2418        Ok(_response.status)
2419    }
2420
2421    /// Writes firmware data from `payload`.
2422    ///
2423    /// `configuration` represents the A/B/R configuration. For platforms that do not support
2424    /// firmware A/B/R, the parameter will be ignored by the underlying device-specific logic .
2425    ///
2426    /// `type` is a device-specific string identifying the payload contents,
2427    /// used to select the proper paving logic. For example, a device with
2428    /// multiple bootloader stages might send them as separate calls to
2429    /// `WriteFirmware()`, differentiated by `type`. An empty string
2430    /// indicates the default type.
2431    ///
2432    /// `payload` may need to be resized to the partition size, so the provided
2433    /// vmo must have been created with `ZX_VMO_RESIZABLE` or must be a child
2434    /// VMO that was created with `ZX_VMO_CHILD_RESIZABLE`.
2435    pub fn r#write_firmware(
2436        &self,
2437        mut configuration: Configuration,
2438        mut type_: &str,
2439        mut payload: fidl_fuchsia_mem::Buffer,
2440        ___deadline: zx::MonotonicInstant,
2441    ) -> Result<WriteFirmwareResult, fidl::Error> {
2442        let _response = self.client.send_query::<
2443            DataSinkWriteFirmwareRequest,
2444            DataSinkWriteFirmwareResponse,
2445            DataSinkMarker,
2446        >(
2447            (configuration, type_, &mut payload,),
2448            0x514b93454ac0be97,
2449            fidl::encoding::DynamicFlags::empty(),
2450            ___deadline,
2451        )?;
2452        Ok(_response.result)
2453    }
2454
2455    /// Read firmware corresponding to `configuration` and `type`.
2456    ///
2457    /// Parameter `configuration` and `type` are the same as WriteFirmware.
2458    ///
2459    /// If ReadFirmware returns error, caller should assume that firmware image does not exist
2460    /// or is in a bad state, or firmware read is not defined for the product.
2461    pub fn r#read_firmware(
2462        &self,
2463        mut configuration: Configuration,
2464        mut type_: &str,
2465        ___deadline: zx::MonotonicInstant,
2466    ) -> Result<DataSinkReadFirmwareResult, fidl::Error> {
2467        let _response = self.client.send_query::<
2468            DataSinkReadFirmwareRequest,
2469            fidl::encoding::ResultType<DataSinkReadFirmwareResponse, i32>,
2470            DataSinkMarker,
2471        >(
2472            (configuration, type_,),
2473            0xcb67f9830cae9c3,
2474            fidl::encoding::DynamicFlags::empty(),
2475            ___deadline,
2476        )?;
2477        Ok(_response.map(|x| x.firmware))
2478    }
2479
2480    /// Writes FVM with data from streamed via `payload`. This potentially affects all
2481    /// configurations.
2482    pub fn r#write_volumes(
2483        &self,
2484        mut payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
2485        ___deadline: zx::MonotonicInstant,
2486    ) -> Result<i32, fidl::Error> {
2487        let _response = self.client.send_query::<
2488            DataSinkWriteVolumesRequest,
2489            DataSinkWriteVolumesResponse,
2490            DataSinkMarker,
2491        >(
2492            (payload,),
2493            0x5ee32c861d0259df,
2494            fidl::encoding::DynamicFlags::empty(),
2495            ___deadline,
2496        )?;
2497        Ok(_response.status)
2498    }
2499
2500    /// Write a raw volume image to the device. The image will be passed as it is to the device
2501    /// partitioner backend to write. Therefore the format and write logic for the image is up to
2502    /// the product to define. It differs from WriteVolume(), which is specifically for writing the
2503    /// FVM sparse image, in that the paver will not perform any FVM related parsing or other
2504    /// operation of the image. Thus it is not dependent on the volume driver version and less
2505    /// susceptible to an outdated paver.
2506    ///
2507    /// Returns ZX_ERR_NOT_SUPPORTED if the backend does not support opaque volume blobs.
2508    pub fn r#write_opaque_volume(
2509        &self,
2510        mut payload: fidl_fuchsia_mem::Buffer,
2511        ___deadline: zx::MonotonicInstant,
2512    ) -> Result<DataSinkWriteOpaqueVolumeResult, fidl::Error> {
2513        let _response = self.client.send_query::<
2514            DataSinkWriteOpaqueVolumeRequest,
2515            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2516            DataSinkMarker,
2517        >(
2518            (&mut payload,),
2519            0x4884b6ebaf660d79,
2520            fidl::encoding::DynamicFlags::empty(),
2521            ___deadline,
2522        )?;
2523        Ok(_response.map(|x| x))
2524    }
2525
2526    /// Writes an image in the Android Sparse format.  Identical in behaviour to
2527    /// `WriteOpaqueVolume`, except the contents of `payload` are parsed as a sparse image and
2528    /// unpacked before being written to disk.
2529    pub fn r#write_sparse_volume(
2530        &self,
2531        mut payload: fidl_fuchsia_mem::Buffer,
2532        ___deadline: zx::MonotonicInstant,
2533    ) -> Result<DataSinkWriteSparseVolumeResult, fidl::Error> {
2534        let _response = self.client.send_query::<
2535            DataSinkWriteSparseVolumeRequest,
2536            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2537            DataSinkMarker,
2538        >(
2539            (&mut payload,),
2540            0x340f5370c5b1e026,
2541            fidl::encoding::DynamicFlags::empty(),
2542            ___deadline,
2543        )?;
2544        Ok(_response.map(|x| x))
2545    }
2546
2547    /// Flush all previously buffered writes to persistent storage.
2548    pub fn r#flush(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
2549        let _response = self
2550            .client
2551            .send_query::<fidl::encoding::EmptyPayload, DataSinkFlushResponse, DataSinkMarker>(
2552                (),
2553                0x3b59d3e2338e3139,
2554                fidl::encoding::DynamicFlags::empty(),
2555                ___deadline,
2556            )?;
2557        Ok(_response.status)
2558    }
2559}
2560
2561#[cfg(target_os = "fuchsia")]
2562impl From<DataSinkSynchronousProxy> for zx::NullableHandle {
2563    fn from(value: DataSinkSynchronousProxy) -> Self {
2564        value.into_channel().into()
2565    }
2566}
2567
2568#[cfg(target_os = "fuchsia")]
2569impl From<fidl::Channel> for DataSinkSynchronousProxy {
2570    fn from(value: fidl::Channel) -> Self {
2571        Self::new(value)
2572    }
2573}
2574
2575#[cfg(target_os = "fuchsia")]
2576impl fidl::endpoints::FromClient for DataSinkSynchronousProxy {
2577    type Protocol = DataSinkMarker;
2578
2579    fn from_client(value: fidl::endpoints::ClientEnd<DataSinkMarker>) -> Self {
2580        Self::new(value.into_channel())
2581    }
2582}
2583
2584#[derive(Debug, Clone)]
2585pub struct DataSinkProxy {
2586    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2587}
2588
2589impl fidl::endpoints::Proxy for DataSinkProxy {
2590    type Protocol = DataSinkMarker;
2591
2592    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2593        Self::new(inner)
2594    }
2595
2596    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2597        self.client.into_channel().map_err(|client| Self { client })
2598    }
2599
2600    fn as_channel(&self) -> &::fidl::AsyncChannel {
2601        self.client.as_channel()
2602    }
2603}
2604
2605impl DataSinkProxy {
2606    /// Create a new Proxy for fuchsia.paver/DataSink.
2607    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2608        let protocol_name = <DataSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2609        Self { client: fidl::client::Client::new(channel, protocol_name) }
2610    }
2611
2612    /// Get a Stream of events from the remote end of the protocol.
2613    ///
2614    /// # Panics
2615    ///
2616    /// Panics if the event stream was already taken.
2617    pub fn take_event_stream(&self) -> DataSinkEventStream {
2618        DataSinkEventStream { event_receiver: self.client.take_event_receiver() }
2619    }
2620
2621    /// Reads the partition corresponding to `configuration` and `asset` into a vmo and returns it.
2622    /// The size field of the returned `Buffer` will be the size of just the asset, if it can be
2623    /// determined. Otherwise, it will be the size of the entire partition.
2624    /// The size and stream size of the vmo in the returned `Buffer` will always be the size of the
2625    /// entire partition.
2626    pub fn r#read_asset(
2627        &self,
2628        mut configuration: Configuration,
2629        mut asset: Asset,
2630    ) -> fidl::client::QueryResponseFut<
2631        DataSinkReadAssetResult,
2632        fidl::encoding::DefaultFuchsiaResourceDialect,
2633    > {
2634        DataSinkProxyInterface::r#read_asset(self, configuration, asset)
2635    }
2636
2637    /// Writes partition corresponding to `configuration` and `asset` with data from `payload`.
2638    /// `payload` may need to be resized to the partition size, so the provided vmo must have
2639    /// been created with `ZX_VMO_RESIZABLE` or must be a child VMO that was created with
2640    /// `ZX_VMO_CHILD_RESIZABLE`. Will zero out rest of the partition if `payload` is smaller
2641    /// than the size of the partition being written.
2642    ///
2643    ///
2644    /// Returns `ZX_ERR_INVALID_ARGS` if `configuration` specifies active configuration.
2645    pub fn r#write_asset(
2646        &self,
2647        mut configuration: Configuration,
2648        mut asset: Asset,
2649        mut payload: fidl_fuchsia_mem::Buffer,
2650    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2651        DataSinkProxyInterface::r#write_asset(self, configuration, asset, payload)
2652    }
2653
2654    /// Writes firmware data from `payload`.
2655    ///
2656    /// `configuration` represents the A/B/R configuration. For platforms that do not support
2657    /// firmware A/B/R, the parameter will be ignored by the underlying device-specific logic .
2658    ///
2659    /// `type` is a device-specific string identifying the payload contents,
2660    /// used to select the proper paving logic. For example, a device with
2661    /// multiple bootloader stages might send them as separate calls to
2662    /// `WriteFirmware()`, differentiated by `type`. An empty string
2663    /// indicates the default type.
2664    ///
2665    /// `payload` may need to be resized to the partition size, so the provided
2666    /// vmo must have been created with `ZX_VMO_RESIZABLE` or must be a child
2667    /// VMO that was created with `ZX_VMO_CHILD_RESIZABLE`.
2668    pub fn r#write_firmware(
2669        &self,
2670        mut configuration: Configuration,
2671        mut type_: &str,
2672        mut payload: fidl_fuchsia_mem::Buffer,
2673    ) -> fidl::client::QueryResponseFut<
2674        WriteFirmwareResult,
2675        fidl::encoding::DefaultFuchsiaResourceDialect,
2676    > {
2677        DataSinkProxyInterface::r#write_firmware(self, configuration, type_, payload)
2678    }
2679
2680    /// Read firmware corresponding to `configuration` and `type`.
2681    ///
2682    /// Parameter `configuration` and `type` are the same as WriteFirmware.
2683    ///
2684    /// If ReadFirmware returns error, caller should assume that firmware image does not exist
2685    /// or is in a bad state, or firmware read is not defined for the product.
2686    pub fn r#read_firmware(
2687        &self,
2688        mut configuration: Configuration,
2689        mut type_: &str,
2690    ) -> fidl::client::QueryResponseFut<
2691        DataSinkReadFirmwareResult,
2692        fidl::encoding::DefaultFuchsiaResourceDialect,
2693    > {
2694        DataSinkProxyInterface::r#read_firmware(self, configuration, type_)
2695    }
2696
2697    /// Writes FVM with data from streamed via `payload`. This potentially affects all
2698    /// configurations.
2699    pub fn r#write_volumes(
2700        &self,
2701        mut payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
2702    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2703        DataSinkProxyInterface::r#write_volumes(self, payload)
2704    }
2705
2706    /// Write a raw volume image to the device. The image will be passed as it is to the device
2707    /// partitioner backend to write. Therefore the format and write logic for the image is up to
2708    /// the product to define. It differs from WriteVolume(), which is specifically for writing the
2709    /// FVM sparse image, in that the paver will not perform any FVM related parsing or other
2710    /// operation of the image. Thus it is not dependent on the volume driver version and less
2711    /// susceptible to an outdated paver.
2712    ///
2713    /// Returns ZX_ERR_NOT_SUPPORTED if the backend does not support opaque volume blobs.
2714    pub fn r#write_opaque_volume(
2715        &self,
2716        mut payload: fidl_fuchsia_mem::Buffer,
2717    ) -> fidl::client::QueryResponseFut<
2718        DataSinkWriteOpaqueVolumeResult,
2719        fidl::encoding::DefaultFuchsiaResourceDialect,
2720    > {
2721        DataSinkProxyInterface::r#write_opaque_volume(self, payload)
2722    }
2723
2724    /// Writes an image in the Android Sparse format.  Identical in behaviour to
2725    /// `WriteOpaqueVolume`, except the contents of `payload` are parsed as a sparse image and
2726    /// unpacked before being written to disk.
2727    pub fn r#write_sparse_volume(
2728        &self,
2729        mut payload: fidl_fuchsia_mem::Buffer,
2730    ) -> fidl::client::QueryResponseFut<
2731        DataSinkWriteSparseVolumeResult,
2732        fidl::encoding::DefaultFuchsiaResourceDialect,
2733    > {
2734        DataSinkProxyInterface::r#write_sparse_volume(self, payload)
2735    }
2736
2737    /// Flush all previously buffered writes to persistent storage.
2738    pub fn r#flush(
2739        &self,
2740    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2741        DataSinkProxyInterface::r#flush(self)
2742    }
2743}
2744
2745impl DataSinkProxyInterface for DataSinkProxy {
2746    type ReadAssetResponseFut = fidl::client::QueryResponseFut<
2747        DataSinkReadAssetResult,
2748        fidl::encoding::DefaultFuchsiaResourceDialect,
2749    >;
2750    fn r#read_asset(
2751        &self,
2752        mut configuration: Configuration,
2753        mut asset: Asset,
2754    ) -> Self::ReadAssetResponseFut {
2755        fn _decode(
2756            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2757        ) -> Result<DataSinkReadAssetResult, fidl::Error> {
2758            let _response = fidl::client::decode_transaction_body::<
2759                fidl::encoding::ResultType<DataSinkReadAssetResponse, i32>,
2760                fidl::encoding::DefaultFuchsiaResourceDialect,
2761                0x125a23e561007898,
2762            >(_buf?)?;
2763            Ok(_response.map(|x| x.asset))
2764        }
2765        self.client.send_query_and_decode::<DataSinkReadAssetRequest, DataSinkReadAssetResult>(
2766            (configuration, asset),
2767            0x125a23e561007898,
2768            fidl::encoding::DynamicFlags::empty(),
2769            _decode,
2770        )
2771    }
2772
2773    type WriteAssetResponseFut =
2774        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2775    fn r#write_asset(
2776        &self,
2777        mut configuration: Configuration,
2778        mut asset: Asset,
2779        mut payload: fidl_fuchsia_mem::Buffer,
2780    ) -> Self::WriteAssetResponseFut {
2781        fn _decode(
2782            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2783        ) -> Result<i32, fidl::Error> {
2784            let _response = fidl::client::decode_transaction_body::<
2785                DataSinkWriteAssetResponse,
2786                fidl::encoding::DefaultFuchsiaResourceDialect,
2787                0x516839ce76c4d0a9,
2788            >(_buf?)?;
2789            Ok(_response.status)
2790        }
2791        self.client.send_query_and_decode::<DataSinkWriteAssetRequest, i32>(
2792            (configuration, asset, &mut payload),
2793            0x516839ce76c4d0a9,
2794            fidl::encoding::DynamicFlags::empty(),
2795            _decode,
2796        )
2797    }
2798
2799    type WriteFirmwareResponseFut = fidl::client::QueryResponseFut<
2800        WriteFirmwareResult,
2801        fidl::encoding::DefaultFuchsiaResourceDialect,
2802    >;
2803    fn r#write_firmware(
2804        &self,
2805        mut configuration: Configuration,
2806        mut type_: &str,
2807        mut payload: fidl_fuchsia_mem::Buffer,
2808    ) -> Self::WriteFirmwareResponseFut {
2809        fn _decode(
2810            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2811        ) -> Result<WriteFirmwareResult, fidl::Error> {
2812            let _response = fidl::client::decode_transaction_body::<
2813                DataSinkWriteFirmwareResponse,
2814                fidl::encoding::DefaultFuchsiaResourceDialect,
2815                0x514b93454ac0be97,
2816            >(_buf?)?;
2817            Ok(_response.result)
2818        }
2819        self.client.send_query_and_decode::<DataSinkWriteFirmwareRequest, WriteFirmwareResult>(
2820            (configuration, type_, &mut payload),
2821            0x514b93454ac0be97,
2822            fidl::encoding::DynamicFlags::empty(),
2823            _decode,
2824        )
2825    }
2826
2827    type ReadFirmwareResponseFut = fidl::client::QueryResponseFut<
2828        DataSinkReadFirmwareResult,
2829        fidl::encoding::DefaultFuchsiaResourceDialect,
2830    >;
2831    fn r#read_firmware(
2832        &self,
2833        mut configuration: Configuration,
2834        mut type_: &str,
2835    ) -> Self::ReadFirmwareResponseFut {
2836        fn _decode(
2837            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2838        ) -> Result<DataSinkReadFirmwareResult, fidl::Error> {
2839            let _response = fidl::client::decode_transaction_body::<
2840                fidl::encoding::ResultType<DataSinkReadFirmwareResponse, i32>,
2841                fidl::encoding::DefaultFuchsiaResourceDialect,
2842                0xcb67f9830cae9c3,
2843            >(_buf?)?;
2844            Ok(_response.map(|x| x.firmware))
2845        }
2846        self.client
2847            .send_query_and_decode::<DataSinkReadFirmwareRequest, DataSinkReadFirmwareResult>(
2848                (configuration, type_),
2849                0xcb67f9830cae9c3,
2850                fidl::encoding::DynamicFlags::empty(),
2851                _decode,
2852            )
2853    }
2854
2855    type WriteVolumesResponseFut =
2856        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2857    fn r#write_volumes(
2858        &self,
2859        mut payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
2860    ) -> Self::WriteVolumesResponseFut {
2861        fn _decode(
2862            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2863        ) -> Result<i32, fidl::Error> {
2864            let _response = fidl::client::decode_transaction_body::<
2865                DataSinkWriteVolumesResponse,
2866                fidl::encoding::DefaultFuchsiaResourceDialect,
2867                0x5ee32c861d0259df,
2868            >(_buf?)?;
2869            Ok(_response.status)
2870        }
2871        self.client.send_query_and_decode::<DataSinkWriteVolumesRequest, i32>(
2872            (payload,),
2873            0x5ee32c861d0259df,
2874            fidl::encoding::DynamicFlags::empty(),
2875            _decode,
2876        )
2877    }
2878
2879    type WriteOpaqueVolumeResponseFut = fidl::client::QueryResponseFut<
2880        DataSinkWriteOpaqueVolumeResult,
2881        fidl::encoding::DefaultFuchsiaResourceDialect,
2882    >;
2883    fn r#write_opaque_volume(
2884        &self,
2885        mut payload: fidl_fuchsia_mem::Buffer,
2886    ) -> Self::WriteOpaqueVolumeResponseFut {
2887        fn _decode(
2888            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2889        ) -> Result<DataSinkWriteOpaqueVolumeResult, fidl::Error> {
2890            let _response = fidl::client::decode_transaction_body::<
2891                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2892                fidl::encoding::DefaultFuchsiaResourceDialect,
2893                0x4884b6ebaf660d79,
2894            >(_buf?)?;
2895            Ok(_response.map(|x| x))
2896        }
2897        self.client.send_query_and_decode::<
2898            DataSinkWriteOpaqueVolumeRequest,
2899            DataSinkWriteOpaqueVolumeResult,
2900        >(
2901            (&mut payload,),
2902            0x4884b6ebaf660d79,
2903            fidl::encoding::DynamicFlags::empty(),
2904            _decode,
2905        )
2906    }
2907
2908    type WriteSparseVolumeResponseFut = fidl::client::QueryResponseFut<
2909        DataSinkWriteSparseVolumeResult,
2910        fidl::encoding::DefaultFuchsiaResourceDialect,
2911    >;
2912    fn r#write_sparse_volume(
2913        &self,
2914        mut payload: fidl_fuchsia_mem::Buffer,
2915    ) -> Self::WriteSparseVolumeResponseFut {
2916        fn _decode(
2917            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2918        ) -> Result<DataSinkWriteSparseVolumeResult, fidl::Error> {
2919            let _response = fidl::client::decode_transaction_body::<
2920                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2921                fidl::encoding::DefaultFuchsiaResourceDialect,
2922                0x340f5370c5b1e026,
2923            >(_buf?)?;
2924            Ok(_response.map(|x| x))
2925        }
2926        self.client.send_query_and_decode::<
2927            DataSinkWriteSparseVolumeRequest,
2928            DataSinkWriteSparseVolumeResult,
2929        >(
2930            (&mut payload,),
2931            0x340f5370c5b1e026,
2932            fidl::encoding::DynamicFlags::empty(),
2933            _decode,
2934        )
2935    }
2936
2937    type FlushResponseFut =
2938        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2939    fn r#flush(&self) -> Self::FlushResponseFut {
2940        fn _decode(
2941            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2942        ) -> Result<i32, fidl::Error> {
2943            let _response = fidl::client::decode_transaction_body::<
2944                DataSinkFlushResponse,
2945                fidl::encoding::DefaultFuchsiaResourceDialect,
2946                0x3b59d3e2338e3139,
2947            >(_buf?)?;
2948            Ok(_response.status)
2949        }
2950        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
2951            (),
2952            0x3b59d3e2338e3139,
2953            fidl::encoding::DynamicFlags::empty(),
2954            _decode,
2955        )
2956    }
2957}
2958
2959pub struct DataSinkEventStream {
2960    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2961}
2962
2963impl std::marker::Unpin for DataSinkEventStream {}
2964
2965impl futures::stream::FusedStream for DataSinkEventStream {
2966    fn is_terminated(&self) -> bool {
2967        self.event_receiver.is_terminated()
2968    }
2969}
2970
2971impl futures::Stream for DataSinkEventStream {
2972    type Item = Result<DataSinkEvent, fidl::Error>;
2973
2974    fn poll_next(
2975        mut self: std::pin::Pin<&mut Self>,
2976        cx: &mut std::task::Context<'_>,
2977    ) -> std::task::Poll<Option<Self::Item>> {
2978        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2979            &mut self.event_receiver,
2980            cx
2981        )?) {
2982            Some(buf) => std::task::Poll::Ready(Some(DataSinkEvent::decode(buf))),
2983            None => std::task::Poll::Ready(None),
2984        }
2985    }
2986}
2987
2988#[derive(Debug)]
2989pub enum DataSinkEvent {}
2990
2991impl DataSinkEvent {
2992    /// Decodes a message buffer as a [`DataSinkEvent`].
2993    fn decode(
2994        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2995    ) -> Result<DataSinkEvent, fidl::Error> {
2996        let (bytes, _handles) = buf.split_mut();
2997        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2998        debug_assert_eq!(tx_header.tx_id, 0);
2999        match tx_header.ordinal {
3000            _ => Err(fidl::Error::UnknownOrdinal {
3001                ordinal: tx_header.ordinal,
3002                protocol_name: <DataSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3003            }),
3004        }
3005    }
3006}
3007
3008/// A Stream of incoming requests for fuchsia.paver/DataSink.
3009pub struct DataSinkRequestStream {
3010    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3011    is_terminated: bool,
3012}
3013
3014impl std::marker::Unpin for DataSinkRequestStream {}
3015
3016impl futures::stream::FusedStream for DataSinkRequestStream {
3017    fn is_terminated(&self) -> bool {
3018        self.is_terminated
3019    }
3020}
3021
3022impl fidl::endpoints::RequestStream for DataSinkRequestStream {
3023    type Protocol = DataSinkMarker;
3024    type ControlHandle = DataSinkControlHandle;
3025
3026    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3027        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3028    }
3029
3030    fn control_handle(&self) -> Self::ControlHandle {
3031        DataSinkControlHandle { inner: self.inner.clone() }
3032    }
3033
3034    fn into_inner(
3035        self,
3036    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3037    {
3038        (self.inner, self.is_terminated)
3039    }
3040
3041    fn from_inner(
3042        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3043        is_terminated: bool,
3044    ) -> Self {
3045        Self { inner, is_terminated }
3046    }
3047}
3048
3049impl futures::Stream for DataSinkRequestStream {
3050    type Item = Result<DataSinkRequest, fidl::Error>;
3051
3052    fn poll_next(
3053        mut self: std::pin::Pin<&mut Self>,
3054        cx: &mut std::task::Context<'_>,
3055    ) -> std::task::Poll<Option<Self::Item>> {
3056        let this = &mut *self;
3057        if this.inner.check_shutdown(cx) {
3058            this.is_terminated = true;
3059            return std::task::Poll::Ready(None);
3060        }
3061        if this.is_terminated {
3062            panic!("polled DataSinkRequestStream after completion");
3063        }
3064        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3065            |bytes, handles| {
3066                match this.inner.channel().read_etc(cx, bytes, handles) {
3067                    std::task::Poll::Ready(Ok(())) => {}
3068                    std::task::Poll::Pending => return std::task::Poll::Pending,
3069                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3070                        this.is_terminated = true;
3071                        return std::task::Poll::Ready(None);
3072                    }
3073                    std::task::Poll::Ready(Err(e)) => {
3074                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3075                            e.into(),
3076                        ))));
3077                    }
3078                }
3079
3080                // A message has been received from the channel
3081                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3082
3083                std::task::Poll::Ready(Some(match header.ordinal {
3084                    0x125a23e561007898 => {
3085                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3086                        let mut req = fidl::new_empty!(
3087                            DataSinkReadAssetRequest,
3088                            fidl::encoding::DefaultFuchsiaResourceDialect
3089                        );
3090                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkReadAssetRequest>(&header, _body_bytes, handles, &mut req)?;
3091                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3092                        Ok(DataSinkRequest::ReadAsset {
3093                            configuration: req.configuration,
3094                            asset: req.asset,
3095
3096                            responder: DataSinkReadAssetResponder {
3097                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3098                                tx_id: header.tx_id,
3099                            },
3100                        })
3101                    }
3102                    0x516839ce76c4d0a9 => {
3103                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3104                        let mut req = fidl::new_empty!(
3105                            DataSinkWriteAssetRequest,
3106                            fidl::encoding::DefaultFuchsiaResourceDialect
3107                        );
3108                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteAssetRequest>(&header, _body_bytes, handles, &mut req)?;
3109                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3110                        Ok(DataSinkRequest::WriteAsset {
3111                            configuration: req.configuration,
3112                            asset: req.asset,
3113                            payload: req.payload,
3114
3115                            responder: DataSinkWriteAssetResponder {
3116                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3117                                tx_id: header.tx_id,
3118                            },
3119                        })
3120                    }
3121                    0x514b93454ac0be97 => {
3122                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3123                        let mut req = fidl::new_empty!(
3124                            DataSinkWriteFirmwareRequest,
3125                            fidl::encoding::DefaultFuchsiaResourceDialect
3126                        );
3127                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteFirmwareRequest>(&header, _body_bytes, handles, &mut req)?;
3128                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3129                        Ok(DataSinkRequest::WriteFirmware {
3130                            configuration: req.configuration,
3131                            type_: req.type_,
3132                            payload: req.payload,
3133
3134                            responder: DataSinkWriteFirmwareResponder {
3135                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3136                                tx_id: header.tx_id,
3137                            },
3138                        })
3139                    }
3140                    0xcb67f9830cae9c3 => {
3141                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3142                        let mut req = fidl::new_empty!(
3143                            DataSinkReadFirmwareRequest,
3144                            fidl::encoding::DefaultFuchsiaResourceDialect
3145                        );
3146                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkReadFirmwareRequest>(&header, _body_bytes, handles, &mut req)?;
3147                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3148                        Ok(DataSinkRequest::ReadFirmware {
3149                            configuration: req.configuration,
3150                            type_: req.type_,
3151
3152                            responder: DataSinkReadFirmwareResponder {
3153                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3154                                tx_id: header.tx_id,
3155                            },
3156                        })
3157                    }
3158                    0x5ee32c861d0259df => {
3159                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3160                        let mut req = fidl::new_empty!(
3161                            DataSinkWriteVolumesRequest,
3162                            fidl::encoding::DefaultFuchsiaResourceDialect
3163                        );
3164                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteVolumesRequest>(&header, _body_bytes, handles, &mut req)?;
3165                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3166                        Ok(DataSinkRequest::WriteVolumes {
3167                            payload: req.payload,
3168
3169                            responder: DataSinkWriteVolumesResponder {
3170                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3171                                tx_id: header.tx_id,
3172                            },
3173                        })
3174                    }
3175                    0x4884b6ebaf660d79 => {
3176                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3177                        let mut req = fidl::new_empty!(
3178                            DataSinkWriteOpaqueVolumeRequest,
3179                            fidl::encoding::DefaultFuchsiaResourceDialect
3180                        );
3181                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteOpaqueVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
3182                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3183                        Ok(DataSinkRequest::WriteOpaqueVolume {
3184                            payload: req.payload,
3185
3186                            responder: DataSinkWriteOpaqueVolumeResponder {
3187                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3188                                tx_id: header.tx_id,
3189                            },
3190                        })
3191                    }
3192                    0x340f5370c5b1e026 => {
3193                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3194                        let mut req = fidl::new_empty!(
3195                            DataSinkWriteSparseVolumeRequest,
3196                            fidl::encoding::DefaultFuchsiaResourceDialect
3197                        );
3198                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteSparseVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
3199                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3200                        Ok(DataSinkRequest::WriteSparseVolume {
3201                            payload: req.payload,
3202
3203                            responder: DataSinkWriteSparseVolumeResponder {
3204                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3205                                tx_id: header.tx_id,
3206                            },
3207                        })
3208                    }
3209                    0x3b59d3e2338e3139 => {
3210                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3211                        let mut req = fidl::new_empty!(
3212                            fidl::encoding::EmptyPayload,
3213                            fidl::encoding::DefaultFuchsiaResourceDialect
3214                        );
3215                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3216                        let control_handle = DataSinkControlHandle { inner: this.inner.clone() };
3217                        Ok(DataSinkRequest::Flush {
3218                            responder: DataSinkFlushResponder {
3219                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3220                                tx_id: header.tx_id,
3221                            },
3222                        })
3223                    }
3224                    _ => Err(fidl::Error::UnknownOrdinal {
3225                        ordinal: header.ordinal,
3226                        protocol_name:
3227                            <DataSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3228                    }),
3229                }))
3230            },
3231        )
3232    }
3233}
3234
3235/// Protocol for reading and writing boot partitions.
3236///
3237/// A note on DataSink.Flush() (and BootManager.Flush() coming after):
3238///
3239/// Some platforms may implement the Flush() fidl interface of DataSink/BootManager. For these
3240/// platforms, the update of some system images and A/B configuration is not persisted to storage
3241/// immediately and only buffered internally when the write fidl interfaces return. The data is
3242/// guaranteed to be persisted only after the Flush() interfaces are called.
3243///
3244/// If not implemented, Flush() is no-op and system images and A/B configuration will be persisted
3245/// to storage immediately after the write fidl interfaces return.
3246///
3247/// For all platforms, it is guaranteed that if DataSink.Flush() is implemented, BootManager.Flush()
3248/// is implemented as well. Therefore, in the context of system update, both of the following update
3249/// sequences are safe in the sense that, new A/B configuration will not be persisted to storage
3250/// before new system images.
3251/// DataSink.Write[...]() --> DataSink.Flush() --> BootManager.Set[...]() --> BootManager.Flush()
3252/// DataSink.Write[...]() --> BootManager.Set[...]() --> DataSink.Flush() --> BootManager.Flush()
3253#[derive(Debug)]
3254pub enum DataSinkRequest {
3255    /// Reads the partition corresponding to `configuration` and `asset` into a vmo and returns it.
3256    /// The size field of the returned `Buffer` will be the size of just the asset, if it can be
3257    /// determined. Otherwise, it will be the size of the entire partition.
3258    /// The size and stream size of the vmo in the returned `Buffer` will always be the size of the
3259    /// entire partition.
3260    ReadAsset { configuration: Configuration, asset: Asset, responder: DataSinkReadAssetResponder },
3261    /// Writes partition corresponding to `configuration` and `asset` with data from `payload`.
3262    /// `payload` may need to be resized to the partition size, so the provided vmo must have
3263    /// been created with `ZX_VMO_RESIZABLE` or must be a child VMO that was created with
3264    /// `ZX_VMO_CHILD_RESIZABLE`. Will zero out rest of the partition if `payload` is smaller
3265    /// than the size of the partition being written.
3266    ///
3267    ///
3268    /// Returns `ZX_ERR_INVALID_ARGS` if `configuration` specifies active configuration.
3269    WriteAsset {
3270        configuration: Configuration,
3271        asset: Asset,
3272        payload: fidl_fuchsia_mem::Buffer,
3273        responder: DataSinkWriteAssetResponder,
3274    },
3275    /// Writes firmware data from `payload`.
3276    ///
3277    /// `configuration` represents the A/B/R configuration. For platforms that do not support
3278    /// firmware A/B/R, the parameter will be ignored by the underlying device-specific logic .
3279    ///
3280    /// `type` is a device-specific string identifying the payload contents,
3281    /// used to select the proper paving logic. For example, a device with
3282    /// multiple bootloader stages might send them as separate calls to
3283    /// `WriteFirmware()`, differentiated by `type`. An empty string
3284    /// indicates the default type.
3285    ///
3286    /// `payload` may need to be resized to the partition size, so the provided
3287    /// vmo must have been created with `ZX_VMO_RESIZABLE` or must be a child
3288    /// VMO that was created with `ZX_VMO_CHILD_RESIZABLE`.
3289    WriteFirmware {
3290        configuration: Configuration,
3291        type_: String,
3292        payload: fidl_fuchsia_mem::Buffer,
3293        responder: DataSinkWriteFirmwareResponder,
3294    },
3295    /// Read firmware corresponding to `configuration` and `type`.
3296    ///
3297    /// Parameter `configuration` and `type` are the same as WriteFirmware.
3298    ///
3299    /// If ReadFirmware returns error, caller should assume that firmware image does not exist
3300    /// or is in a bad state, or firmware read is not defined for the product.
3301    ReadFirmware {
3302        configuration: Configuration,
3303        type_: String,
3304        responder: DataSinkReadFirmwareResponder,
3305    },
3306    /// Writes FVM with data from streamed via `payload`. This potentially affects all
3307    /// configurations.
3308    WriteVolumes {
3309        payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
3310        responder: DataSinkWriteVolumesResponder,
3311    },
3312    /// Write a raw volume image to the device. The image will be passed as it is to the device
3313    /// partitioner backend to write. Therefore the format and write logic for the image is up to
3314    /// the product to define. It differs from WriteVolume(), which is specifically for writing the
3315    /// FVM sparse image, in that the paver will not perform any FVM related parsing or other
3316    /// operation of the image. Thus it is not dependent on the volume driver version and less
3317    /// susceptible to an outdated paver.
3318    ///
3319    /// Returns ZX_ERR_NOT_SUPPORTED if the backend does not support opaque volume blobs.
3320    WriteOpaqueVolume {
3321        payload: fidl_fuchsia_mem::Buffer,
3322        responder: DataSinkWriteOpaqueVolumeResponder,
3323    },
3324    /// Writes an image in the Android Sparse format.  Identical in behaviour to
3325    /// `WriteOpaqueVolume`, except the contents of `payload` are parsed as a sparse image and
3326    /// unpacked before being written to disk.
3327    WriteSparseVolume {
3328        payload: fidl_fuchsia_mem::Buffer,
3329        responder: DataSinkWriteSparseVolumeResponder,
3330    },
3331    /// Flush all previously buffered writes to persistent storage.
3332    Flush { responder: DataSinkFlushResponder },
3333}
3334
3335impl DataSinkRequest {
3336    #[allow(irrefutable_let_patterns)]
3337    pub fn into_read_asset(self) -> Option<(Configuration, Asset, DataSinkReadAssetResponder)> {
3338        if let DataSinkRequest::ReadAsset { configuration, asset, responder } = self {
3339            Some((configuration, asset, responder))
3340        } else {
3341            None
3342        }
3343    }
3344
3345    #[allow(irrefutable_let_patterns)]
3346    pub fn into_write_asset(
3347        self,
3348    ) -> Option<(Configuration, Asset, fidl_fuchsia_mem::Buffer, DataSinkWriteAssetResponder)> {
3349        if let DataSinkRequest::WriteAsset { configuration, asset, payload, responder } = self {
3350            Some((configuration, asset, payload, responder))
3351        } else {
3352            None
3353        }
3354    }
3355
3356    #[allow(irrefutable_let_patterns)]
3357    pub fn into_write_firmware(
3358        self,
3359    ) -> Option<(Configuration, String, fidl_fuchsia_mem::Buffer, DataSinkWriteFirmwareResponder)>
3360    {
3361        if let DataSinkRequest::WriteFirmware { configuration, type_, payload, responder } = self {
3362            Some((configuration, type_, payload, responder))
3363        } else {
3364            None
3365        }
3366    }
3367
3368    #[allow(irrefutable_let_patterns)]
3369    pub fn into_read_firmware(
3370        self,
3371    ) -> Option<(Configuration, String, DataSinkReadFirmwareResponder)> {
3372        if let DataSinkRequest::ReadFirmware { configuration, type_, responder } = self {
3373            Some((configuration, type_, responder))
3374        } else {
3375            None
3376        }
3377    }
3378
3379    #[allow(irrefutable_let_patterns)]
3380    pub fn into_write_volumes(
3381        self,
3382    ) -> Option<(fidl::endpoints::ClientEnd<PayloadStreamMarker>, DataSinkWriteVolumesResponder)>
3383    {
3384        if let DataSinkRequest::WriteVolumes { payload, responder } = self {
3385            Some((payload, responder))
3386        } else {
3387            None
3388        }
3389    }
3390
3391    #[allow(irrefutable_let_patterns)]
3392    pub fn into_write_opaque_volume(
3393        self,
3394    ) -> Option<(fidl_fuchsia_mem::Buffer, DataSinkWriteOpaqueVolumeResponder)> {
3395        if let DataSinkRequest::WriteOpaqueVolume { payload, responder } = self {
3396            Some((payload, responder))
3397        } else {
3398            None
3399        }
3400    }
3401
3402    #[allow(irrefutable_let_patterns)]
3403    pub fn into_write_sparse_volume(
3404        self,
3405    ) -> Option<(fidl_fuchsia_mem::Buffer, DataSinkWriteSparseVolumeResponder)> {
3406        if let DataSinkRequest::WriteSparseVolume { payload, responder } = self {
3407            Some((payload, responder))
3408        } else {
3409            None
3410        }
3411    }
3412
3413    #[allow(irrefutable_let_patterns)]
3414    pub fn into_flush(self) -> Option<(DataSinkFlushResponder)> {
3415        if let DataSinkRequest::Flush { responder } = self { Some((responder)) } else { None }
3416    }
3417
3418    /// Name of the method defined in FIDL
3419    pub fn method_name(&self) -> &'static str {
3420        match *self {
3421            DataSinkRequest::ReadAsset { .. } => "read_asset",
3422            DataSinkRequest::WriteAsset { .. } => "write_asset",
3423            DataSinkRequest::WriteFirmware { .. } => "write_firmware",
3424            DataSinkRequest::ReadFirmware { .. } => "read_firmware",
3425            DataSinkRequest::WriteVolumes { .. } => "write_volumes",
3426            DataSinkRequest::WriteOpaqueVolume { .. } => "write_opaque_volume",
3427            DataSinkRequest::WriteSparseVolume { .. } => "write_sparse_volume",
3428            DataSinkRequest::Flush { .. } => "flush",
3429        }
3430    }
3431}
3432
3433#[derive(Debug, Clone)]
3434pub struct DataSinkControlHandle {
3435    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3436}
3437
3438impl fidl::endpoints::ControlHandle for DataSinkControlHandle {
3439    fn shutdown(&self) {
3440        self.inner.shutdown()
3441    }
3442
3443    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3444        self.inner.shutdown_with_epitaph(status)
3445    }
3446
3447    fn is_closed(&self) -> bool {
3448        self.inner.channel().is_closed()
3449    }
3450    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3451        self.inner.channel().on_closed()
3452    }
3453
3454    #[cfg(target_os = "fuchsia")]
3455    fn signal_peer(
3456        &self,
3457        clear_mask: zx::Signals,
3458        set_mask: zx::Signals,
3459    ) -> Result<(), zx_status::Status> {
3460        use fidl::Peered;
3461        self.inner.channel().signal_peer(clear_mask, set_mask)
3462    }
3463}
3464
3465impl DataSinkControlHandle {}
3466
3467#[must_use = "FIDL methods require a response to be sent"]
3468#[derive(Debug)]
3469pub struct DataSinkReadAssetResponder {
3470    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3471    tx_id: u32,
3472}
3473
3474/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3475/// if the responder is dropped without sending a response, so that the client
3476/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3477impl std::ops::Drop for DataSinkReadAssetResponder {
3478    fn drop(&mut self) {
3479        self.control_handle.shutdown();
3480        // Safety: drops once, never accessed again
3481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3482    }
3483}
3484
3485impl fidl::endpoints::Responder for DataSinkReadAssetResponder {
3486    type ControlHandle = DataSinkControlHandle;
3487
3488    fn control_handle(&self) -> &DataSinkControlHandle {
3489        &self.control_handle
3490    }
3491
3492    fn drop_without_shutdown(mut self) {
3493        // Safety: drops once, never accessed again due to mem::forget
3494        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3495        // Prevent Drop from running (which would shut down the channel)
3496        std::mem::forget(self);
3497    }
3498}
3499
3500impl DataSinkReadAssetResponder {
3501    /// Sends a response to the FIDL transaction.
3502    ///
3503    /// Sets the channel to shutdown if an error occurs.
3504    pub fn send(
3505        self,
3506        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
3507    ) -> Result<(), fidl::Error> {
3508        let _result = self.send_raw(result);
3509        if _result.is_err() {
3510            self.control_handle.shutdown();
3511        }
3512        self.drop_without_shutdown();
3513        _result
3514    }
3515
3516    /// Similar to "send" but does not shutdown the channel if an error occurs.
3517    pub fn send_no_shutdown_on_err(
3518        self,
3519        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
3520    ) -> Result<(), fidl::Error> {
3521        let _result = self.send_raw(result);
3522        self.drop_without_shutdown();
3523        _result
3524    }
3525
3526    fn send_raw(
3527        &self,
3528        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
3529    ) -> Result<(), fidl::Error> {
3530        self.control_handle
3531            .inner
3532            .send::<fidl::encoding::ResultType<DataSinkReadAssetResponse, i32>>(
3533                result.as_mut().map_err(|e| *e).map(|asset| (asset,)),
3534                self.tx_id,
3535                0x125a23e561007898,
3536                fidl::encoding::DynamicFlags::empty(),
3537            )
3538    }
3539}
3540
3541#[must_use = "FIDL methods require a response to be sent"]
3542#[derive(Debug)]
3543pub struct DataSinkWriteAssetResponder {
3544    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3545    tx_id: u32,
3546}
3547
3548/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3549/// if the responder is dropped without sending a response, so that the client
3550/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3551impl std::ops::Drop for DataSinkWriteAssetResponder {
3552    fn drop(&mut self) {
3553        self.control_handle.shutdown();
3554        // Safety: drops once, never accessed again
3555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3556    }
3557}
3558
3559impl fidl::endpoints::Responder for DataSinkWriteAssetResponder {
3560    type ControlHandle = DataSinkControlHandle;
3561
3562    fn control_handle(&self) -> &DataSinkControlHandle {
3563        &self.control_handle
3564    }
3565
3566    fn drop_without_shutdown(mut self) {
3567        // Safety: drops once, never accessed again due to mem::forget
3568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3569        // Prevent Drop from running (which would shut down the channel)
3570        std::mem::forget(self);
3571    }
3572}
3573
3574impl DataSinkWriteAssetResponder {
3575    /// Sends a response to the FIDL transaction.
3576    ///
3577    /// Sets the channel to shutdown if an error occurs.
3578    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3579        let _result = self.send_raw(status);
3580        if _result.is_err() {
3581            self.control_handle.shutdown();
3582        }
3583        self.drop_without_shutdown();
3584        _result
3585    }
3586
3587    /// Similar to "send" but does not shutdown the channel if an error occurs.
3588    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3589        let _result = self.send_raw(status);
3590        self.drop_without_shutdown();
3591        _result
3592    }
3593
3594    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3595        self.control_handle.inner.send::<DataSinkWriteAssetResponse>(
3596            (status,),
3597            self.tx_id,
3598            0x516839ce76c4d0a9,
3599            fidl::encoding::DynamicFlags::empty(),
3600        )
3601    }
3602}
3603
3604#[must_use = "FIDL methods require a response to be sent"]
3605#[derive(Debug)]
3606pub struct DataSinkWriteFirmwareResponder {
3607    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3608    tx_id: u32,
3609}
3610
3611/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3612/// if the responder is dropped without sending a response, so that the client
3613/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3614impl std::ops::Drop for DataSinkWriteFirmwareResponder {
3615    fn drop(&mut self) {
3616        self.control_handle.shutdown();
3617        // Safety: drops once, never accessed again
3618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3619    }
3620}
3621
3622impl fidl::endpoints::Responder for DataSinkWriteFirmwareResponder {
3623    type ControlHandle = DataSinkControlHandle;
3624
3625    fn control_handle(&self) -> &DataSinkControlHandle {
3626        &self.control_handle
3627    }
3628
3629    fn drop_without_shutdown(mut self) {
3630        // Safety: drops once, never accessed again due to mem::forget
3631        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3632        // Prevent Drop from running (which would shut down the channel)
3633        std::mem::forget(self);
3634    }
3635}
3636
3637impl DataSinkWriteFirmwareResponder {
3638    /// Sends a response to the FIDL transaction.
3639    ///
3640    /// Sets the channel to shutdown if an error occurs.
3641    pub fn send(self, mut result: &WriteFirmwareResult) -> Result<(), fidl::Error> {
3642        let _result = self.send_raw(result);
3643        if _result.is_err() {
3644            self.control_handle.shutdown();
3645        }
3646        self.drop_without_shutdown();
3647        _result
3648    }
3649
3650    /// Similar to "send" but does not shutdown the channel if an error occurs.
3651    pub fn send_no_shutdown_on_err(
3652        self,
3653        mut result: &WriteFirmwareResult,
3654    ) -> Result<(), fidl::Error> {
3655        let _result = self.send_raw(result);
3656        self.drop_without_shutdown();
3657        _result
3658    }
3659
3660    fn send_raw(&self, mut result: &WriteFirmwareResult) -> Result<(), fidl::Error> {
3661        self.control_handle.inner.send::<DataSinkWriteFirmwareResponse>(
3662            (result,),
3663            self.tx_id,
3664            0x514b93454ac0be97,
3665            fidl::encoding::DynamicFlags::empty(),
3666        )
3667    }
3668}
3669
3670#[must_use = "FIDL methods require a response to be sent"]
3671#[derive(Debug)]
3672pub struct DataSinkReadFirmwareResponder {
3673    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3674    tx_id: u32,
3675}
3676
3677/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3678/// if the responder is dropped without sending a response, so that the client
3679/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3680impl std::ops::Drop for DataSinkReadFirmwareResponder {
3681    fn drop(&mut self) {
3682        self.control_handle.shutdown();
3683        // Safety: drops once, never accessed again
3684        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3685    }
3686}
3687
3688impl fidl::endpoints::Responder for DataSinkReadFirmwareResponder {
3689    type ControlHandle = DataSinkControlHandle;
3690
3691    fn control_handle(&self) -> &DataSinkControlHandle {
3692        &self.control_handle
3693    }
3694
3695    fn drop_without_shutdown(mut self) {
3696        // Safety: drops once, never accessed again due to mem::forget
3697        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3698        // Prevent Drop from running (which would shut down the channel)
3699        std::mem::forget(self);
3700    }
3701}
3702
3703impl DataSinkReadFirmwareResponder {
3704    /// Sends a response to the FIDL transaction.
3705    ///
3706    /// Sets the channel to shutdown if an error occurs.
3707    pub fn send(
3708        self,
3709        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
3710    ) -> Result<(), fidl::Error> {
3711        let _result = self.send_raw(result);
3712        if _result.is_err() {
3713            self.control_handle.shutdown();
3714        }
3715        self.drop_without_shutdown();
3716        _result
3717    }
3718
3719    /// Similar to "send" but does not shutdown the channel if an error occurs.
3720    pub fn send_no_shutdown_on_err(
3721        self,
3722        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
3723    ) -> Result<(), fidl::Error> {
3724        let _result = self.send_raw(result);
3725        self.drop_without_shutdown();
3726        _result
3727    }
3728
3729    fn send_raw(
3730        &self,
3731        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
3732    ) -> Result<(), fidl::Error> {
3733        self.control_handle
3734            .inner
3735            .send::<fidl::encoding::ResultType<DataSinkReadFirmwareResponse, i32>>(
3736                result.as_mut().map_err(|e| *e).map(|firmware| (firmware,)),
3737                self.tx_id,
3738                0xcb67f9830cae9c3,
3739                fidl::encoding::DynamicFlags::empty(),
3740            )
3741    }
3742}
3743
3744#[must_use = "FIDL methods require a response to be sent"]
3745#[derive(Debug)]
3746pub struct DataSinkWriteVolumesResponder {
3747    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3748    tx_id: u32,
3749}
3750
3751/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3752/// if the responder is dropped without sending a response, so that the client
3753/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3754impl std::ops::Drop for DataSinkWriteVolumesResponder {
3755    fn drop(&mut self) {
3756        self.control_handle.shutdown();
3757        // Safety: drops once, never accessed again
3758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3759    }
3760}
3761
3762impl fidl::endpoints::Responder for DataSinkWriteVolumesResponder {
3763    type ControlHandle = DataSinkControlHandle;
3764
3765    fn control_handle(&self) -> &DataSinkControlHandle {
3766        &self.control_handle
3767    }
3768
3769    fn drop_without_shutdown(mut self) {
3770        // Safety: drops once, never accessed again due to mem::forget
3771        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3772        // Prevent Drop from running (which would shut down the channel)
3773        std::mem::forget(self);
3774    }
3775}
3776
3777impl DataSinkWriteVolumesResponder {
3778    /// Sends a response to the FIDL transaction.
3779    ///
3780    /// Sets the channel to shutdown if an error occurs.
3781    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3782        let _result = self.send_raw(status);
3783        if _result.is_err() {
3784            self.control_handle.shutdown();
3785        }
3786        self.drop_without_shutdown();
3787        _result
3788    }
3789
3790    /// Similar to "send" but does not shutdown the channel if an error occurs.
3791    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3792        let _result = self.send_raw(status);
3793        self.drop_without_shutdown();
3794        _result
3795    }
3796
3797    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3798        self.control_handle.inner.send::<DataSinkWriteVolumesResponse>(
3799            (status,),
3800            self.tx_id,
3801            0x5ee32c861d0259df,
3802            fidl::encoding::DynamicFlags::empty(),
3803        )
3804    }
3805}
3806
3807#[must_use = "FIDL methods require a response to be sent"]
3808#[derive(Debug)]
3809pub struct DataSinkWriteOpaqueVolumeResponder {
3810    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3811    tx_id: u32,
3812}
3813
3814/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3815/// if the responder is dropped without sending a response, so that the client
3816/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3817impl std::ops::Drop for DataSinkWriteOpaqueVolumeResponder {
3818    fn drop(&mut self) {
3819        self.control_handle.shutdown();
3820        // Safety: drops once, never accessed again
3821        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3822    }
3823}
3824
3825impl fidl::endpoints::Responder for DataSinkWriteOpaqueVolumeResponder {
3826    type ControlHandle = DataSinkControlHandle;
3827
3828    fn control_handle(&self) -> &DataSinkControlHandle {
3829        &self.control_handle
3830    }
3831
3832    fn drop_without_shutdown(mut self) {
3833        // Safety: drops once, never accessed again due to mem::forget
3834        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3835        // Prevent Drop from running (which would shut down the channel)
3836        std::mem::forget(self);
3837    }
3838}
3839
3840impl DataSinkWriteOpaqueVolumeResponder {
3841    /// Sends a response to the FIDL transaction.
3842    ///
3843    /// Sets the channel to shutdown if an error occurs.
3844    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3845        let _result = self.send_raw(result);
3846        if _result.is_err() {
3847            self.control_handle.shutdown();
3848        }
3849        self.drop_without_shutdown();
3850        _result
3851    }
3852
3853    /// Similar to "send" but does not shutdown the channel if an error occurs.
3854    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3855        let _result = self.send_raw(result);
3856        self.drop_without_shutdown();
3857        _result
3858    }
3859
3860    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3861        self.control_handle
3862            .inner
3863            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3864                result,
3865                self.tx_id,
3866                0x4884b6ebaf660d79,
3867                fidl::encoding::DynamicFlags::empty(),
3868            )
3869    }
3870}
3871
3872#[must_use = "FIDL methods require a response to be sent"]
3873#[derive(Debug)]
3874pub struct DataSinkWriteSparseVolumeResponder {
3875    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3876    tx_id: u32,
3877}
3878
3879/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3880/// if the responder is dropped without sending a response, so that the client
3881/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3882impl std::ops::Drop for DataSinkWriteSparseVolumeResponder {
3883    fn drop(&mut self) {
3884        self.control_handle.shutdown();
3885        // Safety: drops once, never accessed again
3886        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3887    }
3888}
3889
3890impl fidl::endpoints::Responder for DataSinkWriteSparseVolumeResponder {
3891    type ControlHandle = DataSinkControlHandle;
3892
3893    fn control_handle(&self) -> &DataSinkControlHandle {
3894        &self.control_handle
3895    }
3896
3897    fn drop_without_shutdown(mut self) {
3898        // Safety: drops once, never accessed again due to mem::forget
3899        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3900        // Prevent Drop from running (which would shut down the channel)
3901        std::mem::forget(self);
3902    }
3903}
3904
3905impl DataSinkWriteSparseVolumeResponder {
3906    /// Sends a response to the FIDL transaction.
3907    ///
3908    /// Sets the channel to shutdown if an error occurs.
3909    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3910        let _result = self.send_raw(result);
3911        if _result.is_err() {
3912            self.control_handle.shutdown();
3913        }
3914        self.drop_without_shutdown();
3915        _result
3916    }
3917
3918    /// Similar to "send" but does not shutdown the channel if an error occurs.
3919    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3920        let _result = self.send_raw(result);
3921        self.drop_without_shutdown();
3922        _result
3923    }
3924
3925    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3926        self.control_handle
3927            .inner
3928            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3929                result,
3930                self.tx_id,
3931                0x340f5370c5b1e026,
3932                fidl::encoding::DynamicFlags::empty(),
3933            )
3934    }
3935}
3936
3937#[must_use = "FIDL methods require a response to be sent"]
3938#[derive(Debug)]
3939pub struct DataSinkFlushResponder {
3940    control_handle: std::mem::ManuallyDrop<DataSinkControlHandle>,
3941    tx_id: u32,
3942}
3943
3944/// Set the the channel to be shutdown (see [`DataSinkControlHandle::shutdown`])
3945/// if the responder is dropped without sending a response, so that the client
3946/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3947impl std::ops::Drop for DataSinkFlushResponder {
3948    fn drop(&mut self) {
3949        self.control_handle.shutdown();
3950        // Safety: drops once, never accessed again
3951        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3952    }
3953}
3954
3955impl fidl::endpoints::Responder for DataSinkFlushResponder {
3956    type ControlHandle = DataSinkControlHandle;
3957
3958    fn control_handle(&self) -> &DataSinkControlHandle {
3959        &self.control_handle
3960    }
3961
3962    fn drop_without_shutdown(mut self) {
3963        // Safety: drops once, never accessed again due to mem::forget
3964        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3965        // Prevent Drop from running (which would shut down the channel)
3966        std::mem::forget(self);
3967    }
3968}
3969
3970impl DataSinkFlushResponder {
3971    /// Sends a response to the FIDL transaction.
3972    ///
3973    /// Sets the channel to shutdown if an error occurs.
3974    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
3975        let _result = self.send_raw(status);
3976        if _result.is_err() {
3977            self.control_handle.shutdown();
3978        }
3979        self.drop_without_shutdown();
3980        _result
3981    }
3982
3983    /// Similar to "send" but does not shutdown the channel if an error occurs.
3984    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
3985        let _result = self.send_raw(status);
3986        self.drop_without_shutdown();
3987        _result
3988    }
3989
3990    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
3991        self.control_handle.inner.send::<DataSinkFlushResponse>(
3992            (status,),
3993            self.tx_id,
3994            0x3b59d3e2338e3139,
3995            fidl::encoding::DynamicFlags::empty(),
3996        )
3997    }
3998}
3999
4000#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4001pub struct DynamicDataSinkMarker;
4002
4003impl fidl::endpoints::ProtocolMarker for DynamicDataSinkMarker {
4004    type Proxy = DynamicDataSinkProxy;
4005    type RequestStream = DynamicDataSinkRequestStream;
4006    #[cfg(target_os = "fuchsia")]
4007    type SynchronousProxy = DynamicDataSinkSynchronousProxy;
4008
4009    const DEBUG_NAME: &'static str = "(anonymous) DynamicDataSink";
4010}
4011
4012pub trait DynamicDataSinkProxyInterface: Send + Sync {
4013    type ReadAssetResponseFut: std::future::Future<Output = Result<DataSinkReadAssetResult, fidl::Error>>
4014        + Send;
4015    fn r#read_asset(
4016        &self,
4017        configuration: Configuration,
4018        asset: Asset,
4019    ) -> Self::ReadAssetResponseFut;
4020    type WriteAssetResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
4021    fn r#write_asset(
4022        &self,
4023        configuration: Configuration,
4024        asset: Asset,
4025        payload: fidl_fuchsia_mem::Buffer,
4026    ) -> Self::WriteAssetResponseFut;
4027    type WriteFirmwareResponseFut: std::future::Future<Output = Result<WriteFirmwareResult, fidl::Error>>
4028        + Send;
4029    fn r#write_firmware(
4030        &self,
4031        configuration: Configuration,
4032        type_: &str,
4033        payload: fidl_fuchsia_mem::Buffer,
4034    ) -> Self::WriteFirmwareResponseFut;
4035    type ReadFirmwareResponseFut: std::future::Future<Output = Result<DataSinkReadFirmwareResult, fidl::Error>>
4036        + Send;
4037    fn r#read_firmware(
4038        &self,
4039        configuration: Configuration,
4040        type_: &str,
4041    ) -> Self::ReadFirmwareResponseFut;
4042    type WriteVolumesResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
4043    fn r#write_volumes(
4044        &self,
4045        payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
4046    ) -> Self::WriteVolumesResponseFut;
4047    type WriteOpaqueVolumeResponseFut: std::future::Future<Output = Result<DataSinkWriteOpaqueVolumeResult, fidl::Error>>
4048        + Send;
4049    fn r#write_opaque_volume(
4050        &self,
4051        payload: fidl_fuchsia_mem::Buffer,
4052    ) -> Self::WriteOpaqueVolumeResponseFut;
4053    type WriteSparseVolumeResponseFut: std::future::Future<Output = Result<DataSinkWriteSparseVolumeResult, fidl::Error>>
4054        + Send;
4055    fn r#write_sparse_volume(
4056        &self,
4057        payload: fidl_fuchsia_mem::Buffer,
4058    ) -> Self::WriteSparseVolumeResponseFut;
4059    type FlushResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
4060    fn r#flush(&self) -> Self::FlushResponseFut;
4061    type InitializePartitionTablesResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
4062        + Send;
4063    fn r#initialize_partition_tables(&self) -> Self::InitializePartitionTablesResponseFut;
4064    type WipePartitionTablesResponseFut: std::future::Future<Output = Result<i32, fidl::Error>>
4065        + Send;
4066    fn r#wipe_partition_tables(&self) -> Self::WipePartitionTablesResponseFut;
4067}
4068#[derive(Debug)]
4069#[cfg(target_os = "fuchsia")]
4070pub struct DynamicDataSinkSynchronousProxy {
4071    client: fidl::client::sync::Client,
4072}
4073
4074#[cfg(target_os = "fuchsia")]
4075impl fidl::endpoints::SynchronousProxy for DynamicDataSinkSynchronousProxy {
4076    type Proxy = DynamicDataSinkProxy;
4077    type Protocol = DynamicDataSinkMarker;
4078
4079    fn from_channel(inner: fidl::Channel) -> Self {
4080        Self::new(inner)
4081    }
4082
4083    fn into_channel(self) -> fidl::Channel {
4084        self.client.into_channel()
4085    }
4086
4087    fn as_channel(&self) -> &fidl::Channel {
4088        self.client.as_channel()
4089    }
4090}
4091
4092#[cfg(target_os = "fuchsia")]
4093impl DynamicDataSinkSynchronousProxy {
4094    pub fn new(channel: fidl::Channel) -> Self {
4095        Self { client: fidl::client::sync::Client::new(channel) }
4096    }
4097
4098    pub fn into_channel(self) -> fidl::Channel {
4099        self.client.into_channel()
4100    }
4101
4102    /// Waits until an event arrives and returns it. It is safe for other
4103    /// threads to make concurrent requests while waiting for an event.
4104    pub fn wait_for_event(
4105        &self,
4106        deadline: zx::MonotonicInstant,
4107    ) -> Result<DynamicDataSinkEvent, fidl::Error> {
4108        DynamicDataSinkEvent::decode(self.client.wait_for_event::<DynamicDataSinkMarker>(deadline)?)
4109    }
4110
4111    /// Reads the partition corresponding to `configuration` and `asset` into a vmo and returns it.
4112    /// The size field of the returned `Buffer` will be the size of just the asset, if it can be
4113    /// determined. Otherwise, it will be the size of the entire partition.
4114    /// The size and stream size of the vmo in the returned `Buffer` will always be the size of the
4115    /// entire partition.
4116    pub fn r#read_asset(
4117        &self,
4118        mut configuration: Configuration,
4119        mut asset: Asset,
4120        ___deadline: zx::MonotonicInstant,
4121    ) -> Result<DataSinkReadAssetResult, fidl::Error> {
4122        let _response = self.client.send_query::<
4123            DataSinkReadAssetRequest,
4124            fidl::encoding::ResultType<DataSinkReadAssetResponse, i32>,
4125            DynamicDataSinkMarker,
4126        >(
4127            (configuration, asset,),
4128            0x125a23e561007898,
4129            fidl::encoding::DynamicFlags::empty(),
4130            ___deadline,
4131        )?;
4132        Ok(_response.map(|x| x.asset))
4133    }
4134
4135    /// Writes partition corresponding to `configuration` and `asset` with data from `payload`.
4136    /// `payload` may need to be resized to the partition size, so the provided vmo must have
4137    /// been created with `ZX_VMO_RESIZABLE` or must be a child VMO that was created with
4138    /// `ZX_VMO_CHILD_RESIZABLE`. Will zero out rest of the partition if `payload` is smaller
4139    /// than the size of the partition being written.
4140    ///
4141    ///
4142    /// Returns `ZX_ERR_INVALID_ARGS` if `configuration` specifies active configuration.
4143    pub fn r#write_asset(
4144        &self,
4145        mut configuration: Configuration,
4146        mut asset: Asset,
4147        mut payload: fidl_fuchsia_mem::Buffer,
4148        ___deadline: zx::MonotonicInstant,
4149    ) -> Result<i32, fidl::Error> {
4150        let _response = self.client.send_query::<
4151            DataSinkWriteAssetRequest,
4152            DataSinkWriteAssetResponse,
4153            DynamicDataSinkMarker,
4154        >(
4155            (configuration, asset, &mut payload,),
4156            0x516839ce76c4d0a9,
4157            fidl::encoding::DynamicFlags::empty(),
4158            ___deadline,
4159        )?;
4160        Ok(_response.status)
4161    }
4162
4163    /// Writes firmware data from `payload`.
4164    ///
4165    /// `configuration` represents the A/B/R configuration. For platforms that do not support
4166    /// firmware A/B/R, the parameter will be ignored by the underlying device-specific logic .
4167    ///
4168    /// `type` is a device-specific string identifying the payload contents,
4169    /// used to select the proper paving logic. For example, a device with
4170    /// multiple bootloader stages might send them as separate calls to
4171    /// `WriteFirmware()`, differentiated by `type`. An empty string
4172    /// indicates the default type.
4173    ///
4174    /// `payload` may need to be resized to the partition size, so the provided
4175    /// vmo must have been created with `ZX_VMO_RESIZABLE` or must be a child
4176    /// VMO that was created with `ZX_VMO_CHILD_RESIZABLE`.
4177    pub fn r#write_firmware(
4178        &self,
4179        mut configuration: Configuration,
4180        mut type_: &str,
4181        mut payload: fidl_fuchsia_mem::Buffer,
4182        ___deadline: zx::MonotonicInstant,
4183    ) -> Result<WriteFirmwareResult, fidl::Error> {
4184        let _response = self.client.send_query::<
4185            DataSinkWriteFirmwareRequest,
4186            DataSinkWriteFirmwareResponse,
4187            DynamicDataSinkMarker,
4188        >(
4189            (configuration, type_, &mut payload,),
4190            0x514b93454ac0be97,
4191            fidl::encoding::DynamicFlags::empty(),
4192            ___deadline,
4193        )?;
4194        Ok(_response.result)
4195    }
4196
4197    /// Read firmware corresponding to `configuration` and `type`.
4198    ///
4199    /// Parameter `configuration` and `type` are the same as WriteFirmware.
4200    ///
4201    /// If ReadFirmware returns error, caller should assume that firmware image does not exist
4202    /// or is in a bad state, or firmware read is not defined for the product.
4203    pub fn r#read_firmware(
4204        &self,
4205        mut configuration: Configuration,
4206        mut type_: &str,
4207        ___deadline: zx::MonotonicInstant,
4208    ) -> Result<DataSinkReadFirmwareResult, fidl::Error> {
4209        let _response = self.client.send_query::<
4210            DataSinkReadFirmwareRequest,
4211            fidl::encoding::ResultType<DataSinkReadFirmwareResponse, i32>,
4212            DynamicDataSinkMarker,
4213        >(
4214            (configuration, type_,),
4215            0xcb67f9830cae9c3,
4216            fidl::encoding::DynamicFlags::empty(),
4217            ___deadline,
4218        )?;
4219        Ok(_response.map(|x| x.firmware))
4220    }
4221
4222    /// Writes FVM with data from streamed via `payload`. This potentially affects all
4223    /// configurations.
4224    pub fn r#write_volumes(
4225        &self,
4226        mut payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
4227        ___deadline: zx::MonotonicInstant,
4228    ) -> Result<i32, fidl::Error> {
4229        let _response = self.client.send_query::<
4230            DataSinkWriteVolumesRequest,
4231            DataSinkWriteVolumesResponse,
4232            DynamicDataSinkMarker,
4233        >(
4234            (payload,),
4235            0x5ee32c861d0259df,
4236            fidl::encoding::DynamicFlags::empty(),
4237            ___deadline,
4238        )?;
4239        Ok(_response.status)
4240    }
4241
4242    /// Write a raw volume image to the device. The image will be passed as it is to the device
4243    /// partitioner backend to write. Therefore the format and write logic for the image is up to
4244    /// the product to define. It differs from WriteVolume(), which is specifically for writing the
4245    /// FVM sparse image, in that the paver will not perform any FVM related parsing or other
4246    /// operation of the image. Thus it is not dependent on the volume driver version and less
4247    /// susceptible to an outdated paver.
4248    ///
4249    /// Returns ZX_ERR_NOT_SUPPORTED if the backend does not support opaque volume blobs.
4250    pub fn r#write_opaque_volume(
4251        &self,
4252        mut payload: fidl_fuchsia_mem::Buffer,
4253        ___deadline: zx::MonotonicInstant,
4254    ) -> Result<DataSinkWriteOpaqueVolumeResult, fidl::Error> {
4255        let _response = self.client.send_query::<
4256            DataSinkWriteOpaqueVolumeRequest,
4257            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4258            DynamicDataSinkMarker,
4259        >(
4260            (&mut payload,),
4261            0x4884b6ebaf660d79,
4262            fidl::encoding::DynamicFlags::empty(),
4263            ___deadline,
4264        )?;
4265        Ok(_response.map(|x| x))
4266    }
4267
4268    /// Writes an image in the Android Sparse format.  Identical in behaviour to
4269    /// `WriteOpaqueVolume`, except the contents of `payload` are parsed as a sparse image and
4270    /// unpacked before being written to disk.
4271    pub fn r#write_sparse_volume(
4272        &self,
4273        mut payload: fidl_fuchsia_mem::Buffer,
4274        ___deadline: zx::MonotonicInstant,
4275    ) -> Result<DataSinkWriteSparseVolumeResult, fidl::Error> {
4276        let _response = self.client.send_query::<
4277            DataSinkWriteSparseVolumeRequest,
4278            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4279            DynamicDataSinkMarker,
4280        >(
4281            (&mut payload,),
4282            0x340f5370c5b1e026,
4283            fidl::encoding::DynamicFlags::empty(),
4284            ___deadline,
4285        )?;
4286        Ok(_response.map(|x| x))
4287    }
4288
4289    /// Flush all previously buffered writes to persistent storage.
4290    pub fn r#flush(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
4291        let _response = self.client.send_query::<
4292            fidl::encoding::EmptyPayload,
4293            DataSinkFlushResponse,
4294            DynamicDataSinkMarker,
4295        >(
4296            (),
4297            0x3b59d3e2338e3139,
4298            fidl::encoding::DynamicFlags::empty(),
4299            ___deadline,
4300        )?;
4301        Ok(_response.status)
4302    }
4303
4304    /// Initializes partitions on given block device.
4305    ///
4306    /// Currently only supported on devices which don't support fastboot (which is the preferred
4307    /// mechanism for device setup).
4308    ///
4309    /// *WARNING*: This API will wipe the existing partitions and data loss may occur.  Non-Fuchsia
4310    /// partitions *may* be preserved, although this is behaviour is board-specific.
4311    pub fn r#initialize_partition_tables(
4312        &self,
4313        ___deadline: zx::MonotonicInstant,
4314    ) -> Result<i32, fidl::Error> {
4315        let _response = self.client.send_query::<
4316            fidl::encoding::EmptyPayload,
4317            DynamicDataSinkInitializePartitionTablesResponse,
4318            DynamicDataSinkMarker,
4319        >(
4320            (),
4321            0x4c798b3813ea9f7e,
4322            fidl::encoding::DynamicFlags::empty(),
4323            ___deadline,
4324        )?;
4325        Ok(_response.status)
4326    }
4327
4328    /// Wipes all entries from the partition table of the specified block device.
4329    /// Currently only supported on devices with a GPT.
4330    ///
4331    /// *WARNING*: This API may destructively remove non-fuchsia maintained partitions from
4332    /// the block device.
4333    pub fn r#wipe_partition_tables(
4334        &self,
4335        ___deadline: zx::MonotonicInstant,
4336    ) -> Result<i32, fidl::Error> {
4337        let _response = self.client.send_query::<
4338            fidl::encoding::EmptyPayload,
4339            DynamicDataSinkWipePartitionTablesResponse,
4340            DynamicDataSinkMarker,
4341        >(
4342            (),
4343            0x797c0ebeedaf2cc,
4344            fidl::encoding::DynamicFlags::empty(),
4345            ___deadline,
4346        )?;
4347        Ok(_response.status)
4348    }
4349}
4350
4351#[cfg(target_os = "fuchsia")]
4352impl From<DynamicDataSinkSynchronousProxy> for zx::NullableHandle {
4353    fn from(value: DynamicDataSinkSynchronousProxy) -> Self {
4354        value.into_channel().into()
4355    }
4356}
4357
4358#[cfg(target_os = "fuchsia")]
4359impl From<fidl::Channel> for DynamicDataSinkSynchronousProxy {
4360    fn from(value: fidl::Channel) -> Self {
4361        Self::new(value)
4362    }
4363}
4364
4365#[cfg(target_os = "fuchsia")]
4366impl fidl::endpoints::FromClient for DynamicDataSinkSynchronousProxy {
4367    type Protocol = DynamicDataSinkMarker;
4368
4369    fn from_client(value: fidl::endpoints::ClientEnd<DynamicDataSinkMarker>) -> Self {
4370        Self::new(value.into_channel())
4371    }
4372}
4373
4374#[derive(Debug, Clone)]
4375pub struct DynamicDataSinkProxy {
4376    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4377}
4378
4379impl fidl::endpoints::Proxy for DynamicDataSinkProxy {
4380    type Protocol = DynamicDataSinkMarker;
4381
4382    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4383        Self::new(inner)
4384    }
4385
4386    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4387        self.client.into_channel().map_err(|client| Self { client })
4388    }
4389
4390    fn as_channel(&self) -> &::fidl::AsyncChannel {
4391        self.client.as_channel()
4392    }
4393}
4394
4395impl DynamicDataSinkProxy {
4396    /// Create a new Proxy for fuchsia.paver/DynamicDataSink.
4397    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4398        let protocol_name = <DynamicDataSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4399        Self { client: fidl::client::Client::new(channel, protocol_name) }
4400    }
4401
4402    /// Get a Stream of events from the remote end of the protocol.
4403    ///
4404    /// # Panics
4405    ///
4406    /// Panics if the event stream was already taken.
4407    pub fn take_event_stream(&self) -> DynamicDataSinkEventStream {
4408        DynamicDataSinkEventStream { event_receiver: self.client.take_event_receiver() }
4409    }
4410
4411    /// Reads the partition corresponding to `configuration` and `asset` into a vmo and returns it.
4412    /// The size field of the returned `Buffer` will be the size of just the asset, if it can be
4413    /// determined. Otherwise, it will be the size of the entire partition.
4414    /// The size and stream size of the vmo in the returned `Buffer` will always be the size of the
4415    /// entire partition.
4416    pub fn r#read_asset(
4417        &self,
4418        mut configuration: Configuration,
4419        mut asset: Asset,
4420    ) -> fidl::client::QueryResponseFut<
4421        DataSinkReadAssetResult,
4422        fidl::encoding::DefaultFuchsiaResourceDialect,
4423    > {
4424        DynamicDataSinkProxyInterface::r#read_asset(self, configuration, asset)
4425    }
4426
4427    /// Writes partition corresponding to `configuration` and `asset` with data from `payload`.
4428    /// `payload` may need to be resized to the partition size, so the provided vmo must have
4429    /// been created with `ZX_VMO_RESIZABLE` or must be a child VMO that was created with
4430    /// `ZX_VMO_CHILD_RESIZABLE`. Will zero out rest of the partition if `payload` is smaller
4431    /// than the size of the partition being written.
4432    ///
4433    ///
4434    /// Returns `ZX_ERR_INVALID_ARGS` if `configuration` specifies active configuration.
4435    pub fn r#write_asset(
4436        &self,
4437        mut configuration: Configuration,
4438        mut asset: Asset,
4439        mut payload: fidl_fuchsia_mem::Buffer,
4440    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4441        DynamicDataSinkProxyInterface::r#write_asset(self, configuration, asset, payload)
4442    }
4443
4444    /// Writes firmware data from `payload`.
4445    ///
4446    /// `configuration` represents the A/B/R configuration. For platforms that do not support
4447    /// firmware A/B/R, the parameter will be ignored by the underlying device-specific logic .
4448    ///
4449    /// `type` is a device-specific string identifying the payload contents,
4450    /// used to select the proper paving logic. For example, a device with
4451    /// multiple bootloader stages might send them as separate calls to
4452    /// `WriteFirmware()`, differentiated by `type`. An empty string
4453    /// indicates the default type.
4454    ///
4455    /// `payload` may need to be resized to the partition size, so the provided
4456    /// vmo must have been created with `ZX_VMO_RESIZABLE` or must be a child
4457    /// VMO that was created with `ZX_VMO_CHILD_RESIZABLE`.
4458    pub fn r#write_firmware(
4459        &self,
4460        mut configuration: Configuration,
4461        mut type_: &str,
4462        mut payload: fidl_fuchsia_mem::Buffer,
4463    ) -> fidl::client::QueryResponseFut<
4464        WriteFirmwareResult,
4465        fidl::encoding::DefaultFuchsiaResourceDialect,
4466    > {
4467        DynamicDataSinkProxyInterface::r#write_firmware(self, configuration, type_, payload)
4468    }
4469
4470    /// Read firmware corresponding to `configuration` and `type`.
4471    ///
4472    /// Parameter `configuration` and `type` are the same as WriteFirmware.
4473    ///
4474    /// If ReadFirmware returns error, caller should assume that firmware image does not exist
4475    /// or is in a bad state, or firmware read is not defined for the product.
4476    pub fn r#read_firmware(
4477        &self,
4478        mut configuration: Configuration,
4479        mut type_: &str,
4480    ) -> fidl::client::QueryResponseFut<
4481        DataSinkReadFirmwareResult,
4482        fidl::encoding::DefaultFuchsiaResourceDialect,
4483    > {
4484        DynamicDataSinkProxyInterface::r#read_firmware(self, configuration, type_)
4485    }
4486
4487    /// Writes FVM with data from streamed via `payload`. This potentially affects all
4488    /// configurations.
4489    pub fn r#write_volumes(
4490        &self,
4491        mut payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
4492    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4493        DynamicDataSinkProxyInterface::r#write_volumes(self, payload)
4494    }
4495
4496    /// Write a raw volume image to the device. The image will be passed as it is to the device
4497    /// partitioner backend to write. Therefore the format and write logic for the image is up to
4498    /// the product to define. It differs from WriteVolume(), which is specifically for writing the
4499    /// FVM sparse image, in that the paver will not perform any FVM related parsing or other
4500    /// operation of the image. Thus it is not dependent on the volume driver version and less
4501    /// susceptible to an outdated paver.
4502    ///
4503    /// Returns ZX_ERR_NOT_SUPPORTED if the backend does not support opaque volume blobs.
4504    pub fn r#write_opaque_volume(
4505        &self,
4506        mut payload: fidl_fuchsia_mem::Buffer,
4507    ) -> fidl::client::QueryResponseFut<
4508        DataSinkWriteOpaqueVolumeResult,
4509        fidl::encoding::DefaultFuchsiaResourceDialect,
4510    > {
4511        DynamicDataSinkProxyInterface::r#write_opaque_volume(self, payload)
4512    }
4513
4514    /// Writes an image in the Android Sparse format.  Identical in behaviour to
4515    /// `WriteOpaqueVolume`, except the contents of `payload` are parsed as a sparse image and
4516    /// unpacked before being written to disk.
4517    pub fn r#write_sparse_volume(
4518        &self,
4519        mut payload: fidl_fuchsia_mem::Buffer,
4520    ) -> fidl::client::QueryResponseFut<
4521        DataSinkWriteSparseVolumeResult,
4522        fidl::encoding::DefaultFuchsiaResourceDialect,
4523    > {
4524        DynamicDataSinkProxyInterface::r#write_sparse_volume(self, payload)
4525    }
4526
4527    /// Flush all previously buffered writes to persistent storage.
4528    pub fn r#flush(
4529        &self,
4530    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4531        DynamicDataSinkProxyInterface::r#flush(self)
4532    }
4533
4534    /// Initializes partitions on given block device.
4535    ///
4536    /// Currently only supported on devices which don't support fastboot (which is the preferred
4537    /// mechanism for device setup).
4538    ///
4539    /// *WARNING*: This API will wipe the existing partitions and data loss may occur.  Non-Fuchsia
4540    /// partitions *may* be preserved, although this is behaviour is board-specific.
4541    pub fn r#initialize_partition_tables(
4542        &self,
4543    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4544        DynamicDataSinkProxyInterface::r#initialize_partition_tables(self)
4545    }
4546
4547    /// Wipes all entries from the partition table of the specified block device.
4548    /// Currently only supported on devices with a GPT.
4549    ///
4550    /// *WARNING*: This API may destructively remove non-fuchsia maintained partitions from
4551    /// the block device.
4552    pub fn r#wipe_partition_tables(
4553        &self,
4554    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4555        DynamicDataSinkProxyInterface::r#wipe_partition_tables(self)
4556    }
4557}
4558
4559impl DynamicDataSinkProxyInterface for DynamicDataSinkProxy {
4560    type ReadAssetResponseFut = fidl::client::QueryResponseFut<
4561        DataSinkReadAssetResult,
4562        fidl::encoding::DefaultFuchsiaResourceDialect,
4563    >;
4564    fn r#read_asset(
4565        &self,
4566        mut configuration: Configuration,
4567        mut asset: Asset,
4568    ) -> Self::ReadAssetResponseFut {
4569        fn _decode(
4570            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4571        ) -> Result<DataSinkReadAssetResult, fidl::Error> {
4572            let _response = fidl::client::decode_transaction_body::<
4573                fidl::encoding::ResultType<DataSinkReadAssetResponse, i32>,
4574                fidl::encoding::DefaultFuchsiaResourceDialect,
4575                0x125a23e561007898,
4576            >(_buf?)?;
4577            Ok(_response.map(|x| x.asset))
4578        }
4579        self.client.send_query_and_decode::<DataSinkReadAssetRequest, DataSinkReadAssetResult>(
4580            (configuration, asset),
4581            0x125a23e561007898,
4582            fidl::encoding::DynamicFlags::empty(),
4583            _decode,
4584        )
4585    }
4586
4587    type WriteAssetResponseFut =
4588        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
4589    fn r#write_asset(
4590        &self,
4591        mut configuration: Configuration,
4592        mut asset: Asset,
4593        mut payload: fidl_fuchsia_mem::Buffer,
4594    ) -> Self::WriteAssetResponseFut {
4595        fn _decode(
4596            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4597        ) -> Result<i32, fidl::Error> {
4598            let _response = fidl::client::decode_transaction_body::<
4599                DataSinkWriteAssetResponse,
4600                fidl::encoding::DefaultFuchsiaResourceDialect,
4601                0x516839ce76c4d0a9,
4602            >(_buf?)?;
4603            Ok(_response.status)
4604        }
4605        self.client.send_query_and_decode::<DataSinkWriteAssetRequest, i32>(
4606            (configuration, asset, &mut payload),
4607            0x516839ce76c4d0a9,
4608            fidl::encoding::DynamicFlags::empty(),
4609            _decode,
4610        )
4611    }
4612
4613    type WriteFirmwareResponseFut = fidl::client::QueryResponseFut<
4614        WriteFirmwareResult,
4615        fidl::encoding::DefaultFuchsiaResourceDialect,
4616    >;
4617    fn r#write_firmware(
4618        &self,
4619        mut configuration: Configuration,
4620        mut type_: &str,
4621        mut payload: fidl_fuchsia_mem::Buffer,
4622    ) -> Self::WriteFirmwareResponseFut {
4623        fn _decode(
4624            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4625        ) -> Result<WriteFirmwareResult, fidl::Error> {
4626            let _response = fidl::client::decode_transaction_body::<
4627                DataSinkWriteFirmwareResponse,
4628                fidl::encoding::DefaultFuchsiaResourceDialect,
4629                0x514b93454ac0be97,
4630            >(_buf?)?;
4631            Ok(_response.result)
4632        }
4633        self.client.send_query_and_decode::<DataSinkWriteFirmwareRequest, WriteFirmwareResult>(
4634            (configuration, type_, &mut payload),
4635            0x514b93454ac0be97,
4636            fidl::encoding::DynamicFlags::empty(),
4637            _decode,
4638        )
4639    }
4640
4641    type ReadFirmwareResponseFut = fidl::client::QueryResponseFut<
4642        DataSinkReadFirmwareResult,
4643        fidl::encoding::DefaultFuchsiaResourceDialect,
4644    >;
4645    fn r#read_firmware(
4646        &self,
4647        mut configuration: Configuration,
4648        mut type_: &str,
4649    ) -> Self::ReadFirmwareResponseFut {
4650        fn _decode(
4651            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4652        ) -> Result<DataSinkReadFirmwareResult, fidl::Error> {
4653            let _response = fidl::client::decode_transaction_body::<
4654                fidl::encoding::ResultType<DataSinkReadFirmwareResponse, i32>,
4655                fidl::encoding::DefaultFuchsiaResourceDialect,
4656                0xcb67f9830cae9c3,
4657            >(_buf?)?;
4658            Ok(_response.map(|x| x.firmware))
4659        }
4660        self.client
4661            .send_query_and_decode::<DataSinkReadFirmwareRequest, DataSinkReadFirmwareResult>(
4662                (configuration, type_),
4663                0xcb67f9830cae9c3,
4664                fidl::encoding::DynamicFlags::empty(),
4665                _decode,
4666            )
4667    }
4668
4669    type WriteVolumesResponseFut =
4670        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
4671    fn r#write_volumes(
4672        &self,
4673        mut payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
4674    ) -> Self::WriteVolumesResponseFut {
4675        fn _decode(
4676            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4677        ) -> Result<i32, fidl::Error> {
4678            let _response = fidl::client::decode_transaction_body::<
4679                DataSinkWriteVolumesResponse,
4680                fidl::encoding::DefaultFuchsiaResourceDialect,
4681                0x5ee32c861d0259df,
4682            >(_buf?)?;
4683            Ok(_response.status)
4684        }
4685        self.client.send_query_and_decode::<DataSinkWriteVolumesRequest, i32>(
4686            (payload,),
4687            0x5ee32c861d0259df,
4688            fidl::encoding::DynamicFlags::empty(),
4689            _decode,
4690        )
4691    }
4692
4693    type WriteOpaqueVolumeResponseFut = fidl::client::QueryResponseFut<
4694        DataSinkWriteOpaqueVolumeResult,
4695        fidl::encoding::DefaultFuchsiaResourceDialect,
4696    >;
4697    fn r#write_opaque_volume(
4698        &self,
4699        mut payload: fidl_fuchsia_mem::Buffer,
4700    ) -> Self::WriteOpaqueVolumeResponseFut {
4701        fn _decode(
4702            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4703        ) -> Result<DataSinkWriteOpaqueVolumeResult, fidl::Error> {
4704            let _response = fidl::client::decode_transaction_body::<
4705                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4706                fidl::encoding::DefaultFuchsiaResourceDialect,
4707                0x4884b6ebaf660d79,
4708            >(_buf?)?;
4709            Ok(_response.map(|x| x))
4710        }
4711        self.client.send_query_and_decode::<
4712            DataSinkWriteOpaqueVolumeRequest,
4713            DataSinkWriteOpaqueVolumeResult,
4714        >(
4715            (&mut payload,),
4716            0x4884b6ebaf660d79,
4717            fidl::encoding::DynamicFlags::empty(),
4718            _decode,
4719        )
4720    }
4721
4722    type WriteSparseVolumeResponseFut = fidl::client::QueryResponseFut<
4723        DataSinkWriteSparseVolumeResult,
4724        fidl::encoding::DefaultFuchsiaResourceDialect,
4725    >;
4726    fn r#write_sparse_volume(
4727        &self,
4728        mut payload: fidl_fuchsia_mem::Buffer,
4729    ) -> Self::WriteSparseVolumeResponseFut {
4730        fn _decode(
4731            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4732        ) -> Result<DataSinkWriteSparseVolumeResult, fidl::Error> {
4733            let _response = fidl::client::decode_transaction_body::<
4734                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4735                fidl::encoding::DefaultFuchsiaResourceDialect,
4736                0x340f5370c5b1e026,
4737            >(_buf?)?;
4738            Ok(_response.map(|x| x))
4739        }
4740        self.client.send_query_and_decode::<
4741            DataSinkWriteSparseVolumeRequest,
4742            DataSinkWriteSparseVolumeResult,
4743        >(
4744            (&mut payload,),
4745            0x340f5370c5b1e026,
4746            fidl::encoding::DynamicFlags::empty(),
4747            _decode,
4748        )
4749    }
4750
4751    type FlushResponseFut =
4752        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
4753    fn r#flush(&self) -> Self::FlushResponseFut {
4754        fn _decode(
4755            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4756        ) -> Result<i32, fidl::Error> {
4757            let _response = fidl::client::decode_transaction_body::<
4758                DataSinkFlushResponse,
4759                fidl::encoding::DefaultFuchsiaResourceDialect,
4760                0x3b59d3e2338e3139,
4761            >(_buf?)?;
4762            Ok(_response.status)
4763        }
4764        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
4765            (),
4766            0x3b59d3e2338e3139,
4767            fidl::encoding::DynamicFlags::empty(),
4768            _decode,
4769        )
4770    }
4771
4772    type InitializePartitionTablesResponseFut =
4773        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
4774    fn r#initialize_partition_tables(&self) -> Self::InitializePartitionTablesResponseFut {
4775        fn _decode(
4776            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4777        ) -> Result<i32, fidl::Error> {
4778            let _response = fidl::client::decode_transaction_body::<
4779                DynamicDataSinkInitializePartitionTablesResponse,
4780                fidl::encoding::DefaultFuchsiaResourceDialect,
4781                0x4c798b3813ea9f7e,
4782            >(_buf?)?;
4783            Ok(_response.status)
4784        }
4785        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
4786            (),
4787            0x4c798b3813ea9f7e,
4788            fidl::encoding::DynamicFlags::empty(),
4789            _decode,
4790        )
4791    }
4792
4793    type WipePartitionTablesResponseFut =
4794        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
4795    fn r#wipe_partition_tables(&self) -> Self::WipePartitionTablesResponseFut {
4796        fn _decode(
4797            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4798        ) -> Result<i32, fidl::Error> {
4799            let _response = fidl::client::decode_transaction_body::<
4800                DynamicDataSinkWipePartitionTablesResponse,
4801                fidl::encoding::DefaultFuchsiaResourceDialect,
4802                0x797c0ebeedaf2cc,
4803            >(_buf?)?;
4804            Ok(_response.status)
4805        }
4806        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
4807            (),
4808            0x797c0ebeedaf2cc,
4809            fidl::encoding::DynamicFlags::empty(),
4810            _decode,
4811        )
4812    }
4813}
4814
4815pub struct DynamicDataSinkEventStream {
4816    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4817}
4818
4819impl std::marker::Unpin for DynamicDataSinkEventStream {}
4820
4821impl futures::stream::FusedStream for DynamicDataSinkEventStream {
4822    fn is_terminated(&self) -> bool {
4823        self.event_receiver.is_terminated()
4824    }
4825}
4826
4827impl futures::Stream for DynamicDataSinkEventStream {
4828    type Item = Result<DynamicDataSinkEvent, fidl::Error>;
4829
4830    fn poll_next(
4831        mut self: std::pin::Pin<&mut Self>,
4832        cx: &mut std::task::Context<'_>,
4833    ) -> std::task::Poll<Option<Self::Item>> {
4834        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4835            &mut self.event_receiver,
4836            cx
4837        )?) {
4838            Some(buf) => std::task::Poll::Ready(Some(DynamicDataSinkEvent::decode(buf))),
4839            None => std::task::Poll::Ready(None),
4840        }
4841    }
4842}
4843
4844#[derive(Debug)]
4845pub enum DynamicDataSinkEvent {}
4846
4847impl DynamicDataSinkEvent {
4848    /// Decodes a message buffer as a [`DynamicDataSinkEvent`].
4849    fn decode(
4850        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4851    ) -> Result<DynamicDataSinkEvent, fidl::Error> {
4852        let (bytes, _handles) = buf.split_mut();
4853        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4854        debug_assert_eq!(tx_header.tx_id, 0);
4855        match tx_header.ordinal {
4856            _ => Err(fidl::Error::UnknownOrdinal {
4857                ordinal: tx_header.ordinal,
4858                protocol_name:
4859                    <DynamicDataSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4860            }),
4861        }
4862    }
4863}
4864
4865/// A Stream of incoming requests for fuchsia.paver/DynamicDataSink.
4866pub struct DynamicDataSinkRequestStream {
4867    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4868    is_terminated: bool,
4869}
4870
4871impl std::marker::Unpin for DynamicDataSinkRequestStream {}
4872
4873impl futures::stream::FusedStream for DynamicDataSinkRequestStream {
4874    fn is_terminated(&self) -> bool {
4875        self.is_terminated
4876    }
4877}
4878
4879impl fidl::endpoints::RequestStream for DynamicDataSinkRequestStream {
4880    type Protocol = DynamicDataSinkMarker;
4881    type ControlHandle = DynamicDataSinkControlHandle;
4882
4883    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4884        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4885    }
4886
4887    fn control_handle(&self) -> Self::ControlHandle {
4888        DynamicDataSinkControlHandle { inner: self.inner.clone() }
4889    }
4890
4891    fn into_inner(
4892        self,
4893    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4894    {
4895        (self.inner, self.is_terminated)
4896    }
4897
4898    fn from_inner(
4899        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4900        is_terminated: bool,
4901    ) -> Self {
4902        Self { inner, is_terminated }
4903    }
4904}
4905
4906impl futures::Stream for DynamicDataSinkRequestStream {
4907    type Item = Result<DynamicDataSinkRequest, fidl::Error>;
4908
4909    fn poll_next(
4910        mut self: std::pin::Pin<&mut Self>,
4911        cx: &mut std::task::Context<'_>,
4912    ) -> std::task::Poll<Option<Self::Item>> {
4913        let this = &mut *self;
4914        if this.inner.check_shutdown(cx) {
4915            this.is_terminated = true;
4916            return std::task::Poll::Ready(None);
4917        }
4918        if this.is_terminated {
4919            panic!("polled DynamicDataSinkRequestStream after completion");
4920        }
4921        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4922            |bytes, handles| {
4923                match this.inner.channel().read_etc(cx, bytes, handles) {
4924                    std::task::Poll::Ready(Ok(())) => {}
4925                    std::task::Poll::Pending => return std::task::Poll::Pending,
4926                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4927                        this.is_terminated = true;
4928                        return std::task::Poll::Ready(None);
4929                    }
4930                    std::task::Poll::Ready(Err(e)) => {
4931                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4932                            e.into(),
4933                        ))));
4934                    }
4935                }
4936
4937                // A message has been received from the channel
4938                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4939
4940                std::task::Poll::Ready(Some(match header.ordinal {
4941                    0x125a23e561007898 => {
4942                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4943                        let mut req = fidl::new_empty!(
4944                            DataSinkReadAssetRequest,
4945                            fidl::encoding::DefaultFuchsiaResourceDialect
4946                        );
4947                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkReadAssetRequest>(&header, _body_bytes, handles, &mut req)?;
4948                        let control_handle =
4949                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
4950                        Ok(DynamicDataSinkRequest::ReadAsset {
4951                            configuration: req.configuration,
4952                            asset: req.asset,
4953
4954                            responder: DynamicDataSinkReadAssetResponder {
4955                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4956                                tx_id: header.tx_id,
4957                            },
4958                        })
4959                    }
4960                    0x516839ce76c4d0a9 => {
4961                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4962                        let mut req = fidl::new_empty!(
4963                            DataSinkWriteAssetRequest,
4964                            fidl::encoding::DefaultFuchsiaResourceDialect
4965                        );
4966                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteAssetRequest>(&header, _body_bytes, handles, &mut req)?;
4967                        let control_handle =
4968                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
4969                        Ok(DynamicDataSinkRequest::WriteAsset {
4970                            configuration: req.configuration,
4971                            asset: req.asset,
4972                            payload: req.payload,
4973
4974                            responder: DynamicDataSinkWriteAssetResponder {
4975                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4976                                tx_id: header.tx_id,
4977                            },
4978                        })
4979                    }
4980                    0x514b93454ac0be97 => {
4981                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4982                        let mut req = fidl::new_empty!(
4983                            DataSinkWriteFirmwareRequest,
4984                            fidl::encoding::DefaultFuchsiaResourceDialect
4985                        );
4986                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteFirmwareRequest>(&header, _body_bytes, handles, &mut req)?;
4987                        let control_handle =
4988                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
4989                        Ok(DynamicDataSinkRequest::WriteFirmware {
4990                            configuration: req.configuration,
4991                            type_: req.type_,
4992                            payload: req.payload,
4993
4994                            responder: DynamicDataSinkWriteFirmwareResponder {
4995                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4996                                tx_id: header.tx_id,
4997                            },
4998                        })
4999                    }
5000                    0xcb67f9830cae9c3 => {
5001                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5002                        let mut req = fidl::new_empty!(
5003                            DataSinkReadFirmwareRequest,
5004                            fidl::encoding::DefaultFuchsiaResourceDialect
5005                        );
5006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkReadFirmwareRequest>(&header, _body_bytes, handles, &mut req)?;
5007                        let control_handle =
5008                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5009                        Ok(DynamicDataSinkRequest::ReadFirmware {
5010                            configuration: req.configuration,
5011                            type_: req.type_,
5012
5013                            responder: DynamicDataSinkReadFirmwareResponder {
5014                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5015                                tx_id: header.tx_id,
5016                            },
5017                        })
5018                    }
5019                    0x5ee32c861d0259df => {
5020                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5021                        let mut req = fidl::new_empty!(
5022                            DataSinkWriteVolumesRequest,
5023                            fidl::encoding::DefaultFuchsiaResourceDialect
5024                        );
5025                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteVolumesRequest>(&header, _body_bytes, handles, &mut req)?;
5026                        let control_handle =
5027                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5028                        Ok(DynamicDataSinkRequest::WriteVolumes {
5029                            payload: req.payload,
5030
5031                            responder: DynamicDataSinkWriteVolumesResponder {
5032                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5033                                tx_id: header.tx_id,
5034                            },
5035                        })
5036                    }
5037                    0x4884b6ebaf660d79 => {
5038                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5039                        let mut req = fidl::new_empty!(
5040                            DataSinkWriteOpaqueVolumeRequest,
5041                            fidl::encoding::DefaultFuchsiaResourceDialect
5042                        );
5043                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteOpaqueVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
5044                        let control_handle =
5045                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5046                        Ok(DynamicDataSinkRequest::WriteOpaqueVolume {
5047                            payload: req.payload,
5048
5049                            responder: DynamicDataSinkWriteOpaqueVolumeResponder {
5050                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5051                                tx_id: header.tx_id,
5052                            },
5053                        })
5054                    }
5055                    0x340f5370c5b1e026 => {
5056                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5057                        let mut req = fidl::new_empty!(
5058                            DataSinkWriteSparseVolumeRequest,
5059                            fidl::encoding::DefaultFuchsiaResourceDialect
5060                        );
5061                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataSinkWriteSparseVolumeRequest>(&header, _body_bytes, handles, &mut req)?;
5062                        let control_handle =
5063                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5064                        Ok(DynamicDataSinkRequest::WriteSparseVolume {
5065                            payload: req.payload,
5066
5067                            responder: DynamicDataSinkWriteSparseVolumeResponder {
5068                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5069                                tx_id: header.tx_id,
5070                            },
5071                        })
5072                    }
5073                    0x3b59d3e2338e3139 => {
5074                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5075                        let mut req = fidl::new_empty!(
5076                            fidl::encoding::EmptyPayload,
5077                            fidl::encoding::DefaultFuchsiaResourceDialect
5078                        );
5079                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5080                        let control_handle =
5081                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5082                        Ok(DynamicDataSinkRequest::Flush {
5083                            responder: DynamicDataSinkFlushResponder {
5084                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5085                                tx_id: header.tx_id,
5086                            },
5087                        })
5088                    }
5089                    0x4c798b3813ea9f7e => {
5090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5091                        let mut req = fidl::new_empty!(
5092                            fidl::encoding::EmptyPayload,
5093                            fidl::encoding::DefaultFuchsiaResourceDialect
5094                        );
5095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5096                        let control_handle =
5097                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5098                        Ok(DynamicDataSinkRequest::InitializePartitionTables {
5099                            responder: DynamicDataSinkInitializePartitionTablesResponder {
5100                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5101                                tx_id: header.tx_id,
5102                            },
5103                        })
5104                    }
5105                    0x797c0ebeedaf2cc => {
5106                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5107                        let mut req = fidl::new_empty!(
5108                            fidl::encoding::EmptyPayload,
5109                            fidl::encoding::DefaultFuchsiaResourceDialect
5110                        );
5111                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5112                        let control_handle =
5113                            DynamicDataSinkControlHandle { inner: this.inner.clone() };
5114                        Ok(DynamicDataSinkRequest::WipePartitionTables {
5115                            responder: DynamicDataSinkWipePartitionTablesResponder {
5116                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5117                                tx_id: header.tx_id,
5118                            },
5119                        })
5120                    }
5121                    _ => Err(fidl::Error::UnknownOrdinal {
5122                        ordinal: header.ordinal,
5123                        protocol_name:
5124                            <DynamicDataSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5125                    }),
5126                }))
5127            },
5128        )
5129    }
5130}
5131
5132/// Specialized DataSink with dynamic partition tables.
5133#[derive(Debug)]
5134pub enum DynamicDataSinkRequest {
5135    /// Reads the partition corresponding to `configuration` and `asset` into a vmo and returns it.
5136    /// The size field of the returned `Buffer` will be the size of just the asset, if it can be
5137    /// determined. Otherwise, it will be the size of the entire partition.
5138    /// The size and stream size of the vmo in the returned `Buffer` will always be the size of the
5139    /// entire partition.
5140    ReadAsset {
5141        configuration: Configuration,
5142        asset: Asset,
5143        responder: DynamicDataSinkReadAssetResponder,
5144    },
5145    /// Writes partition corresponding to `configuration` and `asset` with data from `payload`.
5146    /// `payload` may need to be resized to the partition size, so the provided vmo must have
5147    /// been created with `ZX_VMO_RESIZABLE` or must be a child VMO that was created with
5148    /// `ZX_VMO_CHILD_RESIZABLE`. Will zero out rest of the partition if `payload` is smaller
5149    /// than the size of the partition being written.
5150    ///
5151    ///
5152    /// Returns `ZX_ERR_INVALID_ARGS` if `configuration` specifies active configuration.
5153    WriteAsset {
5154        configuration: Configuration,
5155        asset: Asset,
5156        payload: fidl_fuchsia_mem::Buffer,
5157        responder: DynamicDataSinkWriteAssetResponder,
5158    },
5159    /// Writes firmware data from `payload`.
5160    ///
5161    /// `configuration` represents the A/B/R configuration. For platforms that do not support
5162    /// firmware A/B/R, the parameter will be ignored by the underlying device-specific logic .
5163    ///
5164    /// `type` is a device-specific string identifying the payload contents,
5165    /// used to select the proper paving logic. For example, a device with
5166    /// multiple bootloader stages might send them as separate calls to
5167    /// `WriteFirmware()`, differentiated by `type`. An empty string
5168    /// indicates the default type.
5169    ///
5170    /// `payload` may need to be resized to the partition size, so the provided
5171    /// vmo must have been created with `ZX_VMO_RESIZABLE` or must be a child
5172    /// VMO that was created with `ZX_VMO_CHILD_RESIZABLE`.
5173    WriteFirmware {
5174        configuration: Configuration,
5175        type_: String,
5176        payload: fidl_fuchsia_mem::Buffer,
5177        responder: DynamicDataSinkWriteFirmwareResponder,
5178    },
5179    /// Read firmware corresponding to `configuration` and `type`.
5180    ///
5181    /// Parameter `configuration` and `type` are the same as WriteFirmware.
5182    ///
5183    /// If ReadFirmware returns error, caller should assume that firmware image does not exist
5184    /// or is in a bad state, or firmware read is not defined for the product.
5185    ReadFirmware {
5186        configuration: Configuration,
5187        type_: String,
5188        responder: DynamicDataSinkReadFirmwareResponder,
5189    },
5190    /// Writes FVM with data from streamed via `payload`. This potentially affects all
5191    /// configurations.
5192    WriteVolumes {
5193        payload: fidl::endpoints::ClientEnd<PayloadStreamMarker>,
5194        responder: DynamicDataSinkWriteVolumesResponder,
5195    },
5196    /// Write a raw volume image to the device. The image will be passed as it is to the device
5197    /// partitioner backend to write. Therefore the format and write logic for the image is up to
5198    /// the product to define. It differs from WriteVolume(), which is specifically for writing the
5199    /// FVM sparse image, in that the paver will not perform any FVM related parsing or other
5200    /// operation of the image. Thus it is not dependent on the volume driver version and less
5201    /// susceptible to an outdated paver.
5202    ///
5203    /// Returns ZX_ERR_NOT_SUPPORTED if the backend does not support opaque volume blobs.
5204    WriteOpaqueVolume {
5205        payload: fidl_fuchsia_mem::Buffer,
5206        responder: DynamicDataSinkWriteOpaqueVolumeResponder,
5207    },
5208    /// Writes an image in the Android Sparse format.  Identical in behaviour to
5209    /// `WriteOpaqueVolume`, except the contents of `payload` are parsed as a sparse image and
5210    /// unpacked before being written to disk.
5211    WriteSparseVolume {
5212        payload: fidl_fuchsia_mem::Buffer,
5213        responder: DynamicDataSinkWriteSparseVolumeResponder,
5214    },
5215    /// Flush all previously buffered writes to persistent storage.
5216    Flush { responder: DynamicDataSinkFlushResponder },
5217    /// Initializes partitions on given block device.
5218    ///
5219    /// Currently only supported on devices which don't support fastboot (which is the preferred
5220    /// mechanism for device setup).
5221    ///
5222    /// *WARNING*: This API will wipe the existing partitions and data loss may occur.  Non-Fuchsia
5223    /// partitions *may* be preserved, although this is behaviour is board-specific.
5224    InitializePartitionTables { responder: DynamicDataSinkInitializePartitionTablesResponder },
5225    /// Wipes all entries from the partition table of the specified block device.
5226    /// Currently only supported on devices with a GPT.
5227    ///
5228    /// *WARNING*: This API may destructively remove non-fuchsia maintained partitions from
5229    /// the block device.
5230    WipePartitionTables { responder: DynamicDataSinkWipePartitionTablesResponder },
5231}
5232
5233impl DynamicDataSinkRequest {
5234    #[allow(irrefutable_let_patterns)]
5235    pub fn into_read_asset(
5236        self,
5237    ) -> Option<(Configuration, Asset, DynamicDataSinkReadAssetResponder)> {
5238        if let DynamicDataSinkRequest::ReadAsset { configuration, asset, responder } = self {
5239            Some((configuration, asset, responder))
5240        } else {
5241            None
5242        }
5243    }
5244
5245    #[allow(irrefutable_let_patterns)]
5246    pub fn into_write_asset(
5247        self,
5248    ) -> Option<(Configuration, Asset, fidl_fuchsia_mem::Buffer, DynamicDataSinkWriteAssetResponder)>
5249    {
5250        if let DynamicDataSinkRequest::WriteAsset { configuration, asset, payload, responder } =
5251            self
5252        {
5253            Some((configuration, asset, payload, responder))
5254        } else {
5255            None
5256        }
5257    }
5258
5259    #[allow(irrefutable_let_patterns)]
5260    pub fn into_write_firmware(
5261        self,
5262    ) -> Option<(
5263        Configuration,
5264        String,
5265        fidl_fuchsia_mem::Buffer,
5266        DynamicDataSinkWriteFirmwareResponder,
5267    )> {
5268        if let DynamicDataSinkRequest::WriteFirmware { configuration, type_, payload, responder } =
5269            self
5270        {
5271            Some((configuration, type_, payload, responder))
5272        } else {
5273            None
5274        }
5275    }
5276
5277    #[allow(irrefutable_let_patterns)]
5278    pub fn into_read_firmware(
5279        self,
5280    ) -> Option<(Configuration, String, DynamicDataSinkReadFirmwareResponder)> {
5281        if let DynamicDataSinkRequest::ReadFirmware { configuration, type_, responder } = self {
5282            Some((configuration, type_, responder))
5283        } else {
5284            None
5285        }
5286    }
5287
5288    #[allow(irrefutable_let_patterns)]
5289    pub fn into_write_volumes(
5290        self,
5291    ) -> Option<(
5292        fidl::endpoints::ClientEnd<PayloadStreamMarker>,
5293        DynamicDataSinkWriteVolumesResponder,
5294    )> {
5295        if let DynamicDataSinkRequest::WriteVolumes { payload, responder } = self {
5296            Some((payload, responder))
5297        } else {
5298            None
5299        }
5300    }
5301
5302    #[allow(irrefutable_let_patterns)]
5303    pub fn into_write_opaque_volume(
5304        self,
5305    ) -> Option<(fidl_fuchsia_mem::Buffer, DynamicDataSinkWriteOpaqueVolumeResponder)> {
5306        if let DynamicDataSinkRequest::WriteOpaqueVolume { payload, responder } = self {
5307            Some((payload, responder))
5308        } else {
5309            None
5310        }
5311    }
5312
5313    #[allow(irrefutable_let_patterns)]
5314    pub fn into_write_sparse_volume(
5315        self,
5316    ) -> Option<(fidl_fuchsia_mem::Buffer, DynamicDataSinkWriteSparseVolumeResponder)> {
5317        if let DynamicDataSinkRequest::WriteSparseVolume { payload, responder } = self {
5318            Some((payload, responder))
5319        } else {
5320            None
5321        }
5322    }
5323
5324    #[allow(irrefutable_let_patterns)]
5325    pub fn into_flush(self) -> Option<(DynamicDataSinkFlushResponder)> {
5326        if let DynamicDataSinkRequest::Flush { responder } = self {
5327            Some((responder))
5328        } else {
5329            None
5330        }
5331    }
5332
5333    #[allow(irrefutable_let_patterns)]
5334    pub fn into_initialize_partition_tables(
5335        self,
5336    ) -> Option<(DynamicDataSinkInitializePartitionTablesResponder)> {
5337        if let DynamicDataSinkRequest::InitializePartitionTables { responder } = self {
5338            Some((responder))
5339        } else {
5340            None
5341        }
5342    }
5343
5344    #[allow(irrefutable_let_patterns)]
5345    pub fn into_wipe_partition_tables(
5346        self,
5347    ) -> Option<(DynamicDataSinkWipePartitionTablesResponder)> {
5348        if let DynamicDataSinkRequest::WipePartitionTables { responder } = self {
5349            Some((responder))
5350        } else {
5351            None
5352        }
5353    }
5354
5355    /// Name of the method defined in FIDL
5356    pub fn method_name(&self) -> &'static str {
5357        match *self {
5358            DynamicDataSinkRequest::ReadAsset { .. } => "read_asset",
5359            DynamicDataSinkRequest::WriteAsset { .. } => "write_asset",
5360            DynamicDataSinkRequest::WriteFirmware { .. } => "write_firmware",
5361            DynamicDataSinkRequest::ReadFirmware { .. } => "read_firmware",
5362            DynamicDataSinkRequest::WriteVolumes { .. } => "write_volumes",
5363            DynamicDataSinkRequest::WriteOpaqueVolume { .. } => "write_opaque_volume",
5364            DynamicDataSinkRequest::WriteSparseVolume { .. } => "write_sparse_volume",
5365            DynamicDataSinkRequest::Flush { .. } => "flush",
5366            DynamicDataSinkRequest::InitializePartitionTables { .. } => {
5367                "initialize_partition_tables"
5368            }
5369            DynamicDataSinkRequest::WipePartitionTables { .. } => "wipe_partition_tables",
5370        }
5371    }
5372}
5373
5374#[derive(Debug, Clone)]
5375pub struct DynamicDataSinkControlHandle {
5376    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5377}
5378
5379impl fidl::endpoints::ControlHandle for DynamicDataSinkControlHandle {
5380    fn shutdown(&self) {
5381        self.inner.shutdown()
5382    }
5383
5384    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5385        self.inner.shutdown_with_epitaph(status)
5386    }
5387
5388    fn is_closed(&self) -> bool {
5389        self.inner.channel().is_closed()
5390    }
5391    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5392        self.inner.channel().on_closed()
5393    }
5394
5395    #[cfg(target_os = "fuchsia")]
5396    fn signal_peer(
5397        &self,
5398        clear_mask: zx::Signals,
5399        set_mask: zx::Signals,
5400    ) -> Result<(), zx_status::Status> {
5401        use fidl::Peered;
5402        self.inner.channel().signal_peer(clear_mask, set_mask)
5403    }
5404}
5405
5406impl DynamicDataSinkControlHandle {}
5407
5408#[must_use = "FIDL methods require a response to be sent"]
5409#[derive(Debug)]
5410pub struct DynamicDataSinkReadAssetResponder {
5411    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5412    tx_id: u32,
5413}
5414
5415/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5416/// if the responder is dropped without sending a response, so that the client
5417/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5418impl std::ops::Drop for DynamicDataSinkReadAssetResponder {
5419    fn drop(&mut self) {
5420        self.control_handle.shutdown();
5421        // Safety: drops once, never accessed again
5422        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5423    }
5424}
5425
5426impl fidl::endpoints::Responder for DynamicDataSinkReadAssetResponder {
5427    type ControlHandle = DynamicDataSinkControlHandle;
5428
5429    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5430        &self.control_handle
5431    }
5432
5433    fn drop_without_shutdown(mut self) {
5434        // Safety: drops once, never accessed again due to mem::forget
5435        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5436        // Prevent Drop from running (which would shut down the channel)
5437        std::mem::forget(self);
5438    }
5439}
5440
5441impl DynamicDataSinkReadAssetResponder {
5442    /// Sends a response to the FIDL transaction.
5443    ///
5444    /// Sets the channel to shutdown if an error occurs.
5445    pub fn send(
5446        self,
5447        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
5448    ) -> Result<(), fidl::Error> {
5449        let _result = self.send_raw(result);
5450        if _result.is_err() {
5451            self.control_handle.shutdown();
5452        }
5453        self.drop_without_shutdown();
5454        _result
5455    }
5456
5457    /// Similar to "send" but does not shutdown the channel if an error occurs.
5458    pub fn send_no_shutdown_on_err(
5459        self,
5460        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
5461    ) -> Result<(), fidl::Error> {
5462        let _result = self.send_raw(result);
5463        self.drop_without_shutdown();
5464        _result
5465    }
5466
5467    fn send_raw(
5468        &self,
5469        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
5470    ) -> Result<(), fidl::Error> {
5471        self.control_handle
5472            .inner
5473            .send::<fidl::encoding::ResultType<DataSinkReadAssetResponse, i32>>(
5474                result.as_mut().map_err(|e| *e).map(|asset| (asset,)),
5475                self.tx_id,
5476                0x125a23e561007898,
5477                fidl::encoding::DynamicFlags::empty(),
5478            )
5479    }
5480}
5481
5482#[must_use = "FIDL methods require a response to be sent"]
5483#[derive(Debug)]
5484pub struct DynamicDataSinkWriteAssetResponder {
5485    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5486    tx_id: u32,
5487}
5488
5489/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5490/// if the responder is dropped without sending a response, so that the client
5491/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5492impl std::ops::Drop for DynamicDataSinkWriteAssetResponder {
5493    fn drop(&mut self) {
5494        self.control_handle.shutdown();
5495        // Safety: drops once, never accessed again
5496        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5497    }
5498}
5499
5500impl fidl::endpoints::Responder for DynamicDataSinkWriteAssetResponder {
5501    type ControlHandle = DynamicDataSinkControlHandle;
5502
5503    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5504        &self.control_handle
5505    }
5506
5507    fn drop_without_shutdown(mut self) {
5508        // Safety: drops once, never accessed again due to mem::forget
5509        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5510        // Prevent Drop from running (which would shut down the channel)
5511        std::mem::forget(self);
5512    }
5513}
5514
5515impl DynamicDataSinkWriteAssetResponder {
5516    /// Sends a response to the FIDL transaction.
5517    ///
5518    /// Sets the channel to shutdown if an error occurs.
5519    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5520        let _result = self.send_raw(status);
5521        if _result.is_err() {
5522            self.control_handle.shutdown();
5523        }
5524        self.drop_without_shutdown();
5525        _result
5526    }
5527
5528    /// Similar to "send" but does not shutdown the channel if an error occurs.
5529    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5530        let _result = self.send_raw(status);
5531        self.drop_without_shutdown();
5532        _result
5533    }
5534
5535    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5536        self.control_handle.inner.send::<DataSinkWriteAssetResponse>(
5537            (status,),
5538            self.tx_id,
5539            0x516839ce76c4d0a9,
5540            fidl::encoding::DynamicFlags::empty(),
5541        )
5542    }
5543}
5544
5545#[must_use = "FIDL methods require a response to be sent"]
5546#[derive(Debug)]
5547pub struct DynamicDataSinkWriteFirmwareResponder {
5548    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5549    tx_id: u32,
5550}
5551
5552/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5553/// if the responder is dropped without sending a response, so that the client
5554/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5555impl std::ops::Drop for DynamicDataSinkWriteFirmwareResponder {
5556    fn drop(&mut self) {
5557        self.control_handle.shutdown();
5558        // Safety: drops once, never accessed again
5559        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5560    }
5561}
5562
5563impl fidl::endpoints::Responder for DynamicDataSinkWriteFirmwareResponder {
5564    type ControlHandle = DynamicDataSinkControlHandle;
5565
5566    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5567        &self.control_handle
5568    }
5569
5570    fn drop_without_shutdown(mut self) {
5571        // Safety: drops once, never accessed again due to mem::forget
5572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5573        // Prevent Drop from running (which would shut down the channel)
5574        std::mem::forget(self);
5575    }
5576}
5577
5578impl DynamicDataSinkWriteFirmwareResponder {
5579    /// Sends a response to the FIDL transaction.
5580    ///
5581    /// Sets the channel to shutdown if an error occurs.
5582    pub fn send(self, mut result: &WriteFirmwareResult) -> Result<(), fidl::Error> {
5583        let _result = self.send_raw(result);
5584        if _result.is_err() {
5585            self.control_handle.shutdown();
5586        }
5587        self.drop_without_shutdown();
5588        _result
5589    }
5590
5591    /// Similar to "send" but does not shutdown the channel if an error occurs.
5592    pub fn send_no_shutdown_on_err(
5593        self,
5594        mut result: &WriteFirmwareResult,
5595    ) -> Result<(), fidl::Error> {
5596        let _result = self.send_raw(result);
5597        self.drop_without_shutdown();
5598        _result
5599    }
5600
5601    fn send_raw(&self, mut result: &WriteFirmwareResult) -> Result<(), fidl::Error> {
5602        self.control_handle.inner.send::<DataSinkWriteFirmwareResponse>(
5603            (result,),
5604            self.tx_id,
5605            0x514b93454ac0be97,
5606            fidl::encoding::DynamicFlags::empty(),
5607        )
5608    }
5609}
5610
5611#[must_use = "FIDL methods require a response to be sent"]
5612#[derive(Debug)]
5613pub struct DynamicDataSinkReadFirmwareResponder {
5614    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5615    tx_id: u32,
5616}
5617
5618/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5619/// if the responder is dropped without sending a response, so that the client
5620/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5621impl std::ops::Drop for DynamicDataSinkReadFirmwareResponder {
5622    fn drop(&mut self) {
5623        self.control_handle.shutdown();
5624        // Safety: drops once, never accessed again
5625        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5626    }
5627}
5628
5629impl fidl::endpoints::Responder for DynamicDataSinkReadFirmwareResponder {
5630    type ControlHandle = DynamicDataSinkControlHandle;
5631
5632    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5633        &self.control_handle
5634    }
5635
5636    fn drop_without_shutdown(mut self) {
5637        // Safety: drops once, never accessed again due to mem::forget
5638        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5639        // Prevent Drop from running (which would shut down the channel)
5640        std::mem::forget(self);
5641    }
5642}
5643
5644impl DynamicDataSinkReadFirmwareResponder {
5645    /// Sends a response to the FIDL transaction.
5646    ///
5647    /// Sets the channel to shutdown if an error occurs.
5648    pub fn send(
5649        self,
5650        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
5651    ) -> Result<(), fidl::Error> {
5652        let _result = self.send_raw(result);
5653        if _result.is_err() {
5654            self.control_handle.shutdown();
5655        }
5656        self.drop_without_shutdown();
5657        _result
5658    }
5659
5660    /// Similar to "send" but does not shutdown the channel if an error occurs.
5661    pub fn send_no_shutdown_on_err(
5662        self,
5663        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
5664    ) -> Result<(), fidl::Error> {
5665        let _result = self.send_raw(result);
5666        self.drop_without_shutdown();
5667        _result
5668    }
5669
5670    fn send_raw(
5671        &self,
5672        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
5673    ) -> Result<(), fidl::Error> {
5674        self.control_handle
5675            .inner
5676            .send::<fidl::encoding::ResultType<DataSinkReadFirmwareResponse, i32>>(
5677                result.as_mut().map_err(|e| *e).map(|firmware| (firmware,)),
5678                self.tx_id,
5679                0xcb67f9830cae9c3,
5680                fidl::encoding::DynamicFlags::empty(),
5681            )
5682    }
5683}
5684
5685#[must_use = "FIDL methods require a response to be sent"]
5686#[derive(Debug)]
5687pub struct DynamicDataSinkWriteVolumesResponder {
5688    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5689    tx_id: u32,
5690}
5691
5692/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5693/// if the responder is dropped without sending a response, so that the client
5694/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5695impl std::ops::Drop for DynamicDataSinkWriteVolumesResponder {
5696    fn drop(&mut self) {
5697        self.control_handle.shutdown();
5698        // Safety: drops once, never accessed again
5699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5700    }
5701}
5702
5703impl fidl::endpoints::Responder for DynamicDataSinkWriteVolumesResponder {
5704    type ControlHandle = DynamicDataSinkControlHandle;
5705
5706    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5707        &self.control_handle
5708    }
5709
5710    fn drop_without_shutdown(mut self) {
5711        // Safety: drops once, never accessed again due to mem::forget
5712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5713        // Prevent Drop from running (which would shut down the channel)
5714        std::mem::forget(self);
5715    }
5716}
5717
5718impl DynamicDataSinkWriteVolumesResponder {
5719    /// Sends a response to the FIDL transaction.
5720    ///
5721    /// Sets the channel to shutdown if an error occurs.
5722    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5723        let _result = self.send_raw(status);
5724        if _result.is_err() {
5725            self.control_handle.shutdown();
5726        }
5727        self.drop_without_shutdown();
5728        _result
5729    }
5730
5731    /// Similar to "send" but does not shutdown the channel if an error occurs.
5732    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5733        let _result = self.send_raw(status);
5734        self.drop_without_shutdown();
5735        _result
5736    }
5737
5738    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5739        self.control_handle.inner.send::<DataSinkWriteVolumesResponse>(
5740            (status,),
5741            self.tx_id,
5742            0x5ee32c861d0259df,
5743            fidl::encoding::DynamicFlags::empty(),
5744        )
5745    }
5746}
5747
5748#[must_use = "FIDL methods require a response to be sent"]
5749#[derive(Debug)]
5750pub struct DynamicDataSinkWriteOpaqueVolumeResponder {
5751    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5752    tx_id: u32,
5753}
5754
5755/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5756/// if the responder is dropped without sending a response, so that the client
5757/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5758impl std::ops::Drop for DynamicDataSinkWriteOpaqueVolumeResponder {
5759    fn drop(&mut self) {
5760        self.control_handle.shutdown();
5761        // Safety: drops once, never accessed again
5762        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5763    }
5764}
5765
5766impl fidl::endpoints::Responder for DynamicDataSinkWriteOpaqueVolumeResponder {
5767    type ControlHandle = DynamicDataSinkControlHandle;
5768
5769    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5770        &self.control_handle
5771    }
5772
5773    fn drop_without_shutdown(mut self) {
5774        // Safety: drops once, never accessed again due to mem::forget
5775        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5776        // Prevent Drop from running (which would shut down the channel)
5777        std::mem::forget(self);
5778    }
5779}
5780
5781impl DynamicDataSinkWriteOpaqueVolumeResponder {
5782    /// Sends a response to the FIDL transaction.
5783    ///
5784    /// Sets the channel to shutdown if an error occurs.
5785    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5786        let _result = self.send_raw(result);
5787        if _result.is_err() {
5788            self.control_handle.shutdown();
5789        }
5790        self.drop_without_shutdown();
5791        _result
5792    }
5793
5794    /// Similar to "send" but does not shutdown the channel if an error occurs.
5795    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5796        let _result = self.send_raw(result);
5797        self.drop_without_shutdown();
5798        _result
5799    }
5800
5801    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5802        self.control_handle
5803            .inner
5804            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5805                result,
5806                self.tx_id,
5807                0x4884b6ebaf660d79,
5808                fidl::encoding::DynamicFlags::empty(),
5809            )
5810    }
5811}
5812
5813#[must_use = "FIDL methods require a response to be sent"]
5814#[derive(Debug)]
5815pub struct DynamicDataSinkWriteSparseVolumeResponder {
5816    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5817    tx_id: u32,
5818}
5819
5820/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5821/// if the responder is dropped without sending a response, so that the client
5822/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5823impl std::ops::Drop for DynamicDataSinkWriteSparseVolumeResponder {
5824    fn drop(&mut self) {
5825        self.control_handle.shutdown();
5826        // Safety: drops once, never accessed again
5827        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5828    }
5829}
5830
5831impl fidl::endpoints::Responder for DynamicDataSinkWriteSparseVolumeResponder {
5832    type ControlHandle = DynamicDataSinkControlHandle;
5833
5834    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5835        &self.control_handle
5836    }
5837
5838    fn drop_without_shutdown(mut self) {
5839        // Safety: drops once, never accessed again due to mem::forget
5840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5841        // Prevent Drop from running (which would shut down the channel)
5842        std::mem::forget(self);
5843    }
5844}
5845
5846impl DynamicDataSinkWriteSparseVolumeResponder {
5847    /// Sends a response to the FIDL transaction.
5848    ///
5849    /// Sets the channel to shutdown if an error occurs.
5850    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5851        let _result = self.send_raw(result);
5852        if _result.is_err() {
5853            self.control_handle.shutdown();
5854        }
5855        self.drop_without_shutdown();
5856        _result
5857    }
5858
5859    /// Similar to "send" but does not shutdown the channel if an error occurs.
5860    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5861        let _result = self.send_raw(result);
5862        self.drop_without_shutdown();
5863        _result
5864    }
5865
5866    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5867        self.control_handle
5868            .inner
5869            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5870                result,
5871                self.tx_id,
5872                0x340f5370c5b1e026,
5873                fidl::encoding::DynamicFlags::empty(),
5874            )
5875    }
5876}
5877
5878#[must_use = "FIDL methods require a response to be sent"]
5879#[derive(Debug)]
5880pub struct DynamicDataSinkFlushResponder {
5881    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5882    tx_id: u32,
5883}
5884
5885/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5886/// if the responder is dropped without sending a response, so that the client
5887/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5888impl std::ops::Drop for DynamicDataSinkFlushResponder {
5889    fn drop(&mut self) {
5890        self.control_handle.shutdown();
5891        // Safety: drops once, never accessed again
5892        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5893    }
5894}
5895
5896impl fidl::endpoints::Responder for DynamicDataSinkFlushResponder {
5897    type ControlHandle = DynamicDataSinkControlHandle;
5898
5899    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5900        &self.control_handle
5901    }
5902
5903    fn drop_without_shutdown(mut self) {
5904        // Safety: drops once, never accessed again due to mem::forget
5905        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5906        // Prevent Drop from running (which would shut down the channel)
5907        std::mem::forget(self);
5908    }
5909}
5910
5911impl DynamicDataSinkFlushResponder {
5912    /// Sends a response to the FIDL transaction.
5913    ///
5914    /// Sets the channel to shutdown if an error occurs.
5915    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5916        let _result = self.send_raw(status);
5917        if _result.is_err() {
5918            self.control_handle.shutdown();
5919        }
5920        self.drop_without_shutdown();
5921        _result
5922    }
5923
5924    /// Similar to "send" but does not shutdown the channel if an error occurs.
5925    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5926        let _result = self.send_raw(status);
5927        self.drop_without_shutdown();
5928        _result
5929    }
5930
5931    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5932        self.control_handle.inner.send::<DataSinkFlushResponse>(
5933            (status,),
5934            self.tx_id,
5935            0x3b59d3e2338e3139,
5936            fidl::encoding::DynamicFlags::empty(),
5937        )
5938    }
5939}
5940
5941#[must_use = "FIDL methods require a response to be sent"]
5942#[derive(Debug)]
5943pub struct DynamicDataSinkInitializePartitionTablesResponder {
5944    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
5945    tx_id: u32,
5946}
5947
5948/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
5949/// if the responder is dropped without sending a response, so that the client
5950/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5951impl std::ops::Drop for DynamicDataSinkInitializePartitionTablesResponder {
5952    fn drop(&mut self) {
5953        self.control_handle.shutdown();
5954        // Safety: drops once, never accessed again
5955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5956    }
5957}
5958
5959impl fidl::endpoints::Responder for DynamicDataSinkInitializePartitionTablesResponder {
5960    type ControlHandle = DynamicDataSinkControlHandle;
5961
5962    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
5963        &self.control_handle
5964    }
5965
5966    fn drop_without_shutdown(mut self) {
5967        // Safety: drops once, never accessed again due to mem::forget
5968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5969        // Prevent Drop from running (which would shut down the channel)
5970        std::mem::forget(self);
5971    }
5972}
5973
5974impl DynamicDataSinkInitializePartitionTablesResponder {
5975    /// Sends a response to the FIDL transaction.
5976    ///
5977    /// Sets the channel to shutdown if an error occurs.
5978    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5979        let _result = self.send_raw(status);
5980        if _result.is_err() {
5981            self.control_handle.shutdown();
5982        }
5983        self.drop_without_shutdown();
5984        _result
5985    }
5986
5987    /// Similar to "send" but does not shutdown the channel if an error occurs.
5988    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5989        let _result = self.send_raw(status);
5990        self.drop_without_shutdown();
5991        _result
5992    }
5993
5994    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5995        self.control_handle.inner.send::<DynamicDataSinkInitializePartitionTablesResponse>(
5996            (status,),
5997            self.tx_id,
5998            0x4c798b3813ea9f7e,
5999            fidl::encoding::DynamicFlags::empty(),
6000        )
6001    }
6002}
6003
6004#[must_use = "FIDL methods require a response to be sent"]
6005#[derive(Debug)]
6006pub struct DynamicDataSinkWipePartitionTablesResponder {
6007    control_handle: std::mem::ManuallyDrop<DynamicDataSinkControlHandle>,
6008    tx_id: u32,
6009}
6010
6011/// Set the the channel to be shutdown (see [`DynamicDataSinkControlHandle::shutdown`])
6012/// if the responder is dropped without sending a response, so that the client
6013/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6014impl std::ops::Drop for DynamicDataSinkWipePartitionTablesResponder {
6015    fn drop(&mut self) {
6016        self.control_handle.shutdown();
6017        // Safety: drops once, never accessed again
6018        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6019    }
6020}
6021
6022impl fidl::endpoints::Responder for DynamicDataSinkWipePartitionTablesResponder {
6023    type ControlHandle = DynamicDataSinkControlHandle;
6024
6025    fn control_handle(&self) -> &DynamicDataSinkControlHandle {
6026        &self.control_handle
6027    }
6028
6029    fn drop_without_shutdown(mut self) {
6030        // Safety: drops once, never accessed again due to mem::forget
6031        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6032        // Prevent Drop from running (which would shut down the channel)
6033        std::mem::forget(self);
6034    }
6035}
6036
6037impl DynamicDataSinkWipePartitionTablesResponder {
6038    /// Sends a response to the FIDL transaction.
6039    ///
6040    /// Sets the channel to shutdown if an error occurs.
6041    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
6042        let _result = self.send_raw(status);
6043        if _result.is_err() {
6044            self.control_handle.shutdown();
6045        }
6046        self.drop_without_shutdown();
6047        _result
6048    }
6049
6050    /// Similar to "send" but does not shutdown the channel if an error occurs.
6051    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
6052        let _result = self.send_raw(status);
6053        self.drop_without_shutdown();
6054        _result
6055    }
6056
6057    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
6058        self.control_handle.inner.send::<DynamicDataSinkWipePartitionTablesResponse>(
6059            (status,),
6060            self.tx_id,
6061            0x797c0ebeedaf2cc,
6062            fidl::encoding::DynamicFlags::empty(),
6063        )
6064    }
6065}
6066
6067#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6068pub struct PaverMarker;
6069
6070impl fidl::endpoints::ProtocolMarker for PaverMarker {
6071    type Proxy = PaverProxy;
6072    type RequestStream = PaverRequestStream;
6073    #[cfg(target_os = "fuchsia")]
6074    type SynchronousProxy = PaverSynchronousProxy;
6075
6076    const DEBUG_NAME: &'static str = "fuchsia.paver.Paver";
6077}
6078impl fidl::endpoints::DiscoverableProtocolMarker for PaverMarker {}
6079
6080pub trait PaverProxyInterface: Send + Sync {
6081    fn r#find_data_sink(
6082        &self,
6083        data_sink: fidl::endpoints::ServerEnd<DataSinkMarker>,
6084    ) -> Result<(), fidl::Error>;
6085    fn r#find_partition_table_manager(
6086        &self,
6087        data_sink: fidl::endpoints::ServerEnd<DynamicDataSinkMarker>,
6088    ) -> Result<(), fidl::Error>;
6089    fn r#find_boot_manager(
6090        &self,
6091        boot_manager: fidl::endpoints::ServerEnd<BootManagerMarker>,
6092    ) -> Result<(), fidl::Error>;
6093    fn r#find_sysconfig(
6094        &self,
6095        sysconfig: fidl::endpoints::ServerEnd<SysconfigMarker>,
6096    ) -> Result<(), fidl::Error>;
6097}
6098#[derive(Debug)]
6099#[cfg(target_os = "fuchsia")]
6100pub struct PaverSynchronousProxy {
6101    client: fidl::client::sync::Client,
6102}
6103
6104#[cfg(target_os = "fuchsia")]
6105impl fidl::endpoints::SynchronousProxy for PaverSynchronousProxy {
6106    type Proxy = PaverProxy;
6107    type Protocol = PaverMarker;
6108
6109    fn from_channel(inner: fidl::Channel) -> Self {
6110        Self::new(inner)
6111    }
6112
6113    fn into_channel(self) -> fidl::Channel {
6114        self.client.into_channel()
6115    }
6116
6117    fn as_channel(&self) -> &fidl::Channel {
6118        self.client.as_channel()
6119    }
6120}
6121
6122#[cfg(target_os = "fuchsia")]
6123impl PaverSynchronousProxy {
6124    pub fn new(channel: fidl::Channel) -> Self {
6125        Self { client: fidl::client::sync::Client::new(channel) }
6126    }
6127
6128    pub fn into_channel(self) -> fidl::Channel {
6129        self.client.into_channel()
6130    }
6131
6132    /// Waits until an event arrives and returns it. It is safe for other
6133    /// threads to make concurrent requests while waiting for an event.
6134    pub fn wait_for_event(
6135        &self,
6136        deadline: zx::MonotonicInstant,
6137    ) -> Result<PaverEvent, fidl::Error> {
6138        PaverEvent::decode(self.client.wait_for_event::<PaverMarker>(deadline)?)
6139    }
6140
6141    /// Attempts to auto-discover the data sink where assets and volumes will get paved to.
6142    /// On devices with GPT, the partition must have a valid FVM partition in order for
6143    /// auto-discovery to find it. If multiple devices are found suitable, error is returned.
6144    ///
6145    /// `data_sink` will be closed on error, with an epitaph provided on failure reason.
6146    pub fn r#find_data_sink(
6147        &self,
6148        mut data_sink: fidl::endpoints::ServerEnd<DataSinkMarker>,
6149    ) -> Result<(), fidl::Error> {
6150        self.client.send::<PaverFindDataSinkRequest>(
6151            (data_sink,),
6152            0x710a34c6f9c8a0e9,
6153            fidl::encoding::DynamicFlags::empty(),
6154        )
6155    }
6156
6157    /// Like `FindDataSink`, but the returned block device will be dynamic, supporting partition
6158    /// table manipulation.
6159    ///
6160    /// `data_sink` will be closed on error, with an epitaph provided on failure reason.
6161    pub fn r#find_partition_table_manager(
6162        &self,
6163        mut data_sink: fidl::endpoints::ServerEnd<DynamicDataSinkMarker>,
6164    ) -> Result<(), fidl::Error> {
6165        self.client.send::<PaverFindPartitionTableManagerRequest>(
6166            (data_sink,),
6167            0x10991ecc6fb9f47b,
6168            fidl::encoding::DynamicFlags::empty(),
6169        )
6170    }
6171
6172    /// Attempts to auto-discover the boot manager.
6173    ///
6174    /// `boot_manager` will be closed on error, with an epitaph provided on failure reason.
6175    /// ZX_ERR_NOT_SUPPORTED indicates lack of support and configuration A is always booted from.
6176    pub fn r#find_boot_manager(
6177        &self,
6178        mut boot_manager: fidl::endpoints::ServerEnd<BootManagerMarker>,
6179    ) -> Result<(), fidl::Error> {
6180        self.client.send::<PaverFindBootManagerRequest>(
6181            (boot_manager,),
6182            0x5d500b0633102443,
6183            fidl::encoding::DynamicFlags::empty(),
6184        )
6185    }
6186
6187    /// Find Sysconfig service.
6188    pub fn r#find_sysconfig(
6189        &self,
6190        mut sysconfig: fidl::endpoints::ServerEnd<SysconfigMarker>,
6191    ) -> Result<(), fidl::Error> {
6192        self.client.send::<PaverFindSysconfigRequest>(
6193            (sysconfig,),
6194            0x542cdb5be9b5c02d,
6195            fidl::encoding::DynamicFlags::empty(),
6196        )
6197    }
6198}
6199
6200#[cfg(target_os = "fuchsia")]
6201impl From<PaverSynchronousProxy> for zx::NullableHandle {
6202    fn from(value: PaverSynchronousProxy) -> Self {
6203        value.into_channel().into()
6204    }
6205}
6206
6207#[cfg(target_os = "fuchsia")]
6208impl From<fidl::Channel> for PaverSynchronousProxy {
6209    fn from(value: fidl::Channel) -> Self {
6210        Self::new(value)
6211    }
6212}
6213
6214#[cfg(target_os = "fuchsia")]
6215impl fidl::endpoints::FromClient for PaverSynchronousProxy {
6216    type Protocol = PaverMarker;
6217
6218    fn from_client(value: fidl::endpoints::ClientEnd<PaverMarker>) -> Self {
6219        Self::new(value.into_channel())
6220    }
6221}
6222
6223#[derive(Debug, Clone)]
6224pub struct PaverProxy {
6225    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6226}
6227
6228impl fidl::endpoints::Proxy for PaverProxy {
6229    type Protocol = PaverMarker;
6230
6231    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6232        Self::new(inner)
6233    }
6234
6235    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6236        self.client.into_channel().map_err(|client| Self { client })
6237    }
6238
6239    fn as_channel(&self) -> &::fidl::AsyncChannel {
6240        self.client.as_channel()
6241    }
6242}
6243
6244impl PaverProxy {
6245    /// Create a new Proxy for fuchsia.paver/Paver.
6246    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6247        let protocol_name = <PaverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6248        Self { client: fidl::client::Client::new(channel, protocol_name) }
6249    }
6250
6251    /// Get a Stream of events from the remote end of the protocol.
6252    ///
6253    /// # Panics
6254    ///
6255    /// Panics if the event stream was already taken.
6256    pub fn take_event_stream(&self) -> PaverEventStream {
6257        PaverEventStream { event_receiver: self.client.take_event_receiver() }
6258    }
6259
6260    /// Attempts to auto-discover the data sink where assets and volumes will get paved to.
6261    /// On devices with GPT, the partition must have a valid FVM partition in order for
6262    /// auto-discovery to find it. If multiple devices are found suitable, error is returned.
6263    ///
6264    /// `data_sink` will be closed on error, with an epitaph provided on failure reason.
6265    pub fn r#find_data_sink(
6266        &self,
6267        mut data_sink: fidl::endpoints::ServerEnd<DataSinkMarker>,
6268    ) -> Result<(), fidl::Error> {
6269        PaverProxyInterface::r#find_data_sink(self, data_sink)
6270    }
6271
6272    /// Like `FindDataSink`, but the returned block device will be dynamic, supporting partition
6273    /// table manipulation.
6274    ///
6275    /// `data_sink` will be closed on error, with an epitaph provided on failure reason.
6276    pub fn r#find_partition_table_manager(
6277        &self,
6278        mut data_sink: fidl::endpoints::ServerEnd<DynamicDataSinkMarker>,
6279    ) -> Result<(), fidl::Error> {
6280        PaverProxyInterface::r#find_partition_table_manager(self, data_sink)
6281    }
6282
6283    /// Attempts to auto-discover the boot manager.
6284    ///
6285    /// `boot_manager` will be closed on error, with an epitaph provided on failure reason.
6286    /// ZX_ERR_NOT_SUPPORTED indicates lack of support and configuration A is always booted from.
6287    pub fn r#find_boot_manager(
6288        &self,
6289        mut boot_manager: fidl::endpoints::ServerEnd<BootManagerMarker>,
6290    ) -> Result<(), fidl::Error> {
6291        PaverProxyInterface::r#find_boot_manager(self, boot_manager)
6292    }
6293
6294    /// Find Sysconfig service.
6295    pub fn r#find_sysconfig(
6296        &self,
6297        mut sysconfig: fidl::endpoints::ServerEnd<SysconfigMarker>,
6298    ) -> Result<(), fidl::Error> {
6299        PaverProxyInterface::r#find_sysconfig(self, sysconfig)
6300    }
6301}
6302
6303impl PaverProxyInterface for PaverProxy {
6304    fn r#find_data_sink(
6305        &self,
6306        mut data_sink: fidl::endpoints::ServerEnd<DataSinkMarker>,
6307    ) -> Result<(), fidl::Error> {
6308        self.client.send::<PaverFindDataSinkRequest>(
6309            (data_sink,),
6310            0x710a34c6f9c8a0e9,
6311            fidl::encoding::DynamicFlags::empty(),
6312        )
6313    }
6314
6315    fn r#find_partition_table_manager(
6316        &self,
6317        mut data_sink: fidl::endpoints::ServerEnd<DynamicDataSinkMarker>,
6318    ) -> Result<(), fidl::Error> {
6319        self.client.send::<PaverFindPartitionTableManagerRequest>(
6320            (data_sink,),
6321            0x10991ecc6fb9f47b,
6322            fidl::encoding::DynamicFlags::empty(),
6323        )
6324    }
6325
6326    fn r#find_boot_manager(
6327        &self,
6328        mut boot_manager: fidl::endpoints::ServerEnd<BootManagerMarker>,
6329    ) -> Result<(), fidl::Error> {
6330        self.client.send::<PaverFindBootManagerRequest>(
6331            (boot_manager,),
6332            0x5d500b0633102443,
6333            fidl::encoding::DynamicFlags::empty(),
6334        )
6335    }
6336
6337    fn r#find_sysconfig(
6338        &self,
6339        mut sysconfig: fidl::endpoints::ServerEnd<SysconfigMarker>,
6340    ) -> Result<(), fidl::Error> {
6341        self.client.send::<PaverFindSysconfigRequest>(
6342            (sysconfig,),
6343            0x542cdb5be9b5c02d,
6344            fidl::encoding::DynamicFlags::empty(),
6345        )
6346    }
6347}
6348
6349pub struct PaverEventStream {
6350    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6351}
6352
6353impl std::marker::Unpin for PaverEventStream {}
6354
6355impl futures::stream::FusedStream for PaverEventStream {
6356    fn is_terminated(&self) -> bool {
6357        self.event_receiver.is_terminated()
6358    }
6359}
6360
6361impl futures::Stream for PaverEventStream {
6362    type Item = Result<PaverEvent, fidl::Error>;
6363
6364    fn poll_next(
6365        mut self: std::pin::Pin<&mut Self>,
6366        cx: &mut std::task::Context<'_>,
6367    ) -> std::task::Poll<Option<Self::Item>> {
6368        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6369            &mut self.event_receiver,
6370            cx
6371        )?) {
6372            Some(buf) => std::task::Poll::Ready(Some(PaverEvent::decode(buf))),
6373            None => std::task::Poll::Ready(None),
6374        }
6375    }
6376}
6377
6378#[derive(Debug)]
6379pub enum PaverEvent {}
6380
6381impl PaverEvent {
6382    /// Decodes a message buffer as a [`PaverEvent`].
6383    fn decode(
6384        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6385    ) -> Result<PaverEvent, fidl::Error> {
6386        let (bytes, _handles) = buf.split_mut();
6387        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6388        debug_assert_eq!(tx_header.tx_id, 0);
6389        match tx_header.ordinal {
6390            _ => Err(fidl::Error::UnknownOrdinal {
6391                ordinal: tx_header.ordinal,
6392                protocol_name: <PaverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6393            }),
6394        }
6395    }
6396}
6397
6398/// A Stream of incoming requests for fuchsia.paver/Paver.
6399pub struct PaverRequestStream {
6400    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6401    is_terminated: bool,
6402}
6403
6404impl std::marker::Unpin for PaverRequestStream {}
6405
6406impl futures::stream::FusedStream for PaverRequestStream {
6407    fn is_terminated(&self) -> bool {
6408        self.is_terminated
6409    }
6410}
6411
6412impl fidl::endpoints::RequestStream for PaverRequestStream {
6413    type Protocol = PaverMarker;
6414    type ControlHandle = PaverControlHandle;
6415
6416    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6417        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6418    }
6419
6420    fn control_handle(&self) -> Self::ControlHandle {
6421        PaverControlHandle { inner: self.inner.clone() }
6422    }
6423
6424    fn into_inner(
6425        self,
6426    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6427    {
6428        (self.inner, self.is_terminated)
6429    }
6430
6431    fn from_inner(
6432        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6433        is_terminated: bool,
6434    ) -> Self {
6435        Self { inner, is_terminated }
6436    }
6437}
6438
6439impl futures::Stream for PaverRequestStream {
6440    type Item = Result<PaverRequest, fidl::Error>;
6441
6442    fn poll_next(
6443        mut self: std::pin::Pin<&mut Self>,
6444        cx: &mut std::task::Context<'_>,
6445    ) -> std::task::Poll<Option<Self::Item>> {
6446        let this = &mut *self;
6447        if this.inner.check_shutdown(cx) {
6448            this.is_terminated = true;
6449            return std::task::Poll::Ready(None);
6450        }
6451        if this.is_terminated {
6452            panic!("polled PaverRequestStream after completion");
6453        }
6454        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6455            |bytes, handles| {
6456                match this.inner.channel().read_etc(cx, bytes, handles) {
6457                    std::task::Poll::Ready(Ok(())) => {}
6458                    std::task::Poll::Pending => return std::task::Poll::Pending,
6459                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6460                        this.is_terminated = true;
6461                        return std::task::Poll::Ready(None);
6462                    }
6463                    std::task::Poll::Ready(Err(e)) => {
6464                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6465                            e.into(),
6466                        ))));
6467                    }
6468                }
6469
6470                // A message has been received from the channel
6471                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6472
6473                std::task::Poll::Ready(Some(match header.ordinal {
6474                    0x710a34c6f9c8a0e9 => {
6475                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6476                        let mut req = fidl::new_empty!(
6477                            PaverFindDataSinkRequest,
6478                            fidl::encoding::DefaultFuchsiaResourceDialect
6479                        );
6480                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PaverFindDataSinkRequest>(&header, _body_bytes, handles, &mut req)?;
6481                        let control_handle = PaverControlHandle { inner: this.inner.clone() };
6482                        Ok(PaverRequest::FindDataSink { data_sink: req.data_sink, control_handle })
6483                    }
6484                    0x10991ecc6fb9f47b => {
6485                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6486                        let mut req = fidl::new_empty!(
6487                            PaverFindPartitionTableManagerRequest,
6488                            fidl::encoding::DefaultFuchsiaResourceDialect
6489                        );
6490                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PaverFindPartitionTableManagerRequest>(&header, _body_bytes, handles, &mut req)?;
6491                        let control_handle = PaverControlHandle { inner: this.inner.clone() };
6492                        Ok(PaverRequest::FindPartitionTableManager {
6493                            data_sink: req.data_sink,
6494
6495                            control_handle,
6496                        })
6497                    }
6498                    0x5d500b0633102443 => {
6499                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6500                        let mut req = fidl::new_empty!(
6501                            PaverFindBootManagerRequest,
6502                            fidl::encoding::DefaultFuchsiaResourceDialect
6503                        );
6504                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PaverFindBootManagerRequest>(&header, _body_bytes, handles, &mut req)?;
6505                        let control_handle = PaverControlHandle { inner: this.inner.clone() };
6506                        Ok(PaverRequest::FindBootManager {
6507                            boot_manager: req.boot_manager,
6508
6509                            control_handle,
6510                        })
6511                    }
6512                    0x542cdb5be9b5c02d => {
6513                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6514                        let mut req = fidl::new_empty!(
6515                            PaverFindSysconfigRequest,
6516                            fidl::encoding::DefaultFuchsiaResourceDialect
6517                        );
6518                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PaverFindSysconfigRequest>(&header, _body_bytes, handles, &mut req)?;
6519                        let control_handle = PaverControlHandle { inner: this.inner.clone() };
6520                        Ok(PaverRequest::FindSysconfig { sysconfig: req.sysconfig, control_handle })
6521                    }
6522                    _ => Err(fidl::Error::UnknownOrdinal {
6523                        ordinal: header.ordinal,
6524                        protocol_name: <PaverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6525                    }),
6526                }))
6527            },
6528        )
6529    }
6530}
6531
6532#[derive(Debug)]
6533pub enum PaverRequest {
6534    /// Attempts to auto-discover the data sink where assets and volumes will get paved to.
6535    /// On devices with GPT, the partition must have a valid FVM partition in order for
6536    /// auto-discovery to find it. If multiple devices are found suitable, error is returned.
6537    ///
6538    /// `data_sink` will be closed on error, with an epitaph provided on failure reason.
6539    FindDataSink {
6540        data_sink: fidl::endpoints::ServerEnd<DataSinkMarker>,
6541        control_handle: PaverControlHandle,
6542    },
6543    /// Like `FindDataSink`, but the returned block device will be dynamic, supporting partition
6544    /// table manipulation.
6545    ///
6546    /// `data_sink` will be closed on error, with an epitaph provided on failure reason.
6547    FindPartitionTableManager {
6548        data_sink: fidl::endpoints::ServerEnd<DynamicDataSinkMarker>,
6549        control_handle: PaverControlHandle,
6550    },
6551    /// Attempts to auto-discover the boot manager.
6552    ///
6553    /// `boot_manager` will be closed on error, with an epitaph provided on failure reason.
6554    /// ZX_ERR_NOT_SUPPORTED indicates lack of support and configuration A is always booted from.
6555    FindBootManager {
6556        boot_manager: fidl::endpoints::ServerEnd<BootManagerMarker>,
6557        control_handle: PaverControlHandle,
6558    },
6559    /// Find Sysconfig service.
6560    FindSysconfig {
6561        sysconfig: fidl::endpoints::ServerEnd<SysconfigMarker>,
6562        control_handle: PaverControlHandle,
6563    },
6564}
6565
6566impl PaverRequest {
6567    #[allow(irrefutable_let_patterns)]
6568    pub fn into_find_data_sink(
6569        self,
6570    ) -> Option<(fidl::endpoints::ServerEnd<DataSinkMarker>, PaverControlHandle)> {
6571        if let PaverRequest::FindDataSink { data_sink, control_handle } = self {
6572            Some((data_sink, control_handle))
6573        } else {
6574            None
6575        }
6576    }
6577
6578    #[allow(irrefutable_let_patterns)]
6579    pub fn into_find_partition_table_manager(
6580        self,
6581    ) -> Option<(fidl::endpoints::ServerEnd<DynamicDataSinkMarker>, PaverControlHandle)> {
6582        if let PaverRequest::FindPartitionTableManager { data_sink, control_handle } = self {
6583            Some((data_sink, control_handle))
6584        } else {
6585            None
6586        }
6587    }
6588
6589    #[allow(irrefutable_let_patterns)]
6590    pub fn into_find_boot_manager(
6591        self,
6592    ) -> Option<(fidl::endpoints::ServerEnd<BootManagerMarker>, PaverControlHandle)> {
6593        if let PaverRequest::FindBootManager { boot_manager, control_handle } = self {
6594            Some((boot_manager, control_handle))
6595        } else {
6596            None
6597        }
6598    }
6599
6600    #[allow(irrefutable_let_patterns)]
6601    pub fn into_find_sysconfig(
6602        self,
6603    ) -> Option<(fidl::endpoints::ServerEnd<SysconfigMarker>, PaverControlHandle)> {
6604        if let PaverRequest::FindSysconfig { sysconfig, control_handle } = self {
6605            Some((sysconfig, control_handle))
6606        } else {
6607            None
6608        }
6609    }
6610
6611    /// Name of the method defined in FIDL
6612    pub fn method_name(&self) -> &'static str {
6613        match *self {
6614            PaverRequest::FindDataSink { .. } => "find_data_sink",
6615            PaverRequest::FindPartitionTableManager { .. } => "find_partition_table_manager",
6616            PaverRequest::FindBootManager { .. } => "find_boot_manager",
6617            PaverRequest::FindSysconfig { .. } => "find_sysconfig",
6618        }
6619    }
6620}
6621
6622#[derive(Debug, Clone)]
6623pub struct PaverControlHandle {
6624    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6625}
6626
6627impl fidl::endpoints::ControlHandle for PaverControlHandle {
6628    fn shutdown(&self) {
6629        self.inner.shutdown()
6630    }
6631
6632    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6633        self.inner.shutdown_with_epitaph(status)
6634    }
6635
6636    fn is_closed(&self) -> bool {
6637        self.inner.channel().is_closed()
6638    }
6639    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6640        self.inner.channel().on_closed()
6641    }
6642
6643    #[cfg(target_os = "fuchsia")]
6644    fn signal_peer(
6645        &self,
6646        clear_mask: zx::Signals,
6647        set_mask: zx::Signals,
6648    ) -> Result<(), zx_status::Status> {
6649        use fidl::Peered;
6650        self.inner.channel().signal_peer(clear_mask, set_mask)
6651    }
6652}
6653
6654impl PaverControlHandle {}
6655
6656#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6657pub struct PayloadStreamMarker;
6658
6659impl fidl::endpoints::ProtocolMarker for PayloadStreamMarker {
6660    type Proxy = PayloadStreamProxy;
6661    type RequestStream = PayloadStreamRequestStream;
6662    #[cfg(target_os = "fuchsia")]
6663    type SynchronousProxy = PayloadStreamSynchronousProxy;
6664
6665    const DEBUG_NAME: &'static str = "(anonymous) PayloadStream";
6666}
6667
6668pub trait PayloadStreamProxyInterface: Send + Sync {
6669    type RegisterVmoResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
6670    fn r#register_vmo(&self, vmo: fidl::Vmo) -> Self::RegisterVmoResponseFut;
6671    type ReadDataResponseFut: std::future::Future<Output = Result<ReadResult, fidl::Error>> + Send;
6672    fn r#read_data(&self) -> Self::ReadDataResponseFut;
6673}
6674#[derive(Debug)]
6675#[cfg(target_os = "fuchsia")]
6676pub struct PayloadStreamSynchronousProxy {
6677    client: fidl::client::sync::Client,
6678}
6679
6680#[cfg(target_os = "fuchsia")]
6681impl fidl::endpoints::SynchronousProxy for PayloadStreamSynchronousProxy {
6682    type Proxy = PayloadStreamProxy;
6683    type Protocol = PayloadStreamMarker;
6684
6685    fn from_channel(inner: fidl::Channel) -> Self {
6686        Self::new(inner)
6687    }
6688
6689    fn into_channel(self) -> fidl::Channel {
6690        self.client.into_channel()
6691    }
6692
6693    fn as_channel(&self) -> &fidl::Channel {
6694        self.client.as_channel()
6695    }
6696}
6697
6698#[cfg(target_os = "fuchsia")]
6699impl PayloadStreamSynchronousProxy {
6700    pub fn new(channel: fidl::Channel) -> Self {
6701        Self { client: fidl::client::sync::Client::new(channel) }
6702    }
6703
6704    pub fn into_channel(self) -> fidl::Channel {
6705        self.client.into_channel()
6706    }
6707
6708    /// Waits until an event arrives and returns it. It is safe for other
6709    /// threads to make concurrent requests while waiting for an event.
6710    pub fn wait_for_event(
6711        &self,
6712        deadline: zx::MonotonicInstant,
6713    ) -> Result<PayloadStreamEvent, fidl::Error> {
6714        PayloadStreamEvent::decode(self.client.wait_for_event::<PayloadStreamMarker>(deadline)?)
6715    }
6716
6717    /// Registers a VMO to stream into.
6718    ///
6719    /// This can be called once per PayloadStream.
6720    /// Any subsequent calls will return ZX_ERR_ALREADY_BOUND.
6721    pub fn r#register_vmo(
6722        &self,
6723        mut vmo: fidl::Vmo,
6724        ___deadline: zx::MonotonicInstant,
6725    ) -> Result<i32, fidl::Error> {
6726        let _response = self.client.send_query::<
6727            PayloadStreamRegisterVmoRequest,
6728            PayloadStreamRegisterVmoResponse,
6729            PayloadStreamMarker,
6730        >(
6731            (vmo,),
6732            0x388d7fe44bcb4c,
6733            fidl::encoding::DynamicFlags::empty(),
6734            ___deadline,
6735        )?;
6736        Ok(_response.status)
6737    }
6738
6739    /// Reads data into the pre-registered vmo.
6740    pub fn r#read_data(
6741        &self,
6742        ___deadline: zx::MonotonicInstant,
6743    ) -> Result<ReadResult, fidl::Error> {
6744        let _response = self.client.send_query::<
6745            fidl::encoding::EmptyPayload,
6746            PayloadStreamReadDataResponse,
6747            PayloadStreamMarker,
6748        >(
6749            (),
6750            0x2ccde55366318afa,
6751            fidl::encoding::DynamicFlags::empty(),
6752            ___deadline,
6753        )?;
6754        Ok(_response.result)
6755    }
6756}
6757
6758#[cfg(target_os = "fuchsia")]
6759impl From<PayloadStreamSynchronousProxy> for zx::NullableHandle {
6760    fn from(value: PayloadStreamSynchronousProxy) -> Self {
6761        value.into_channel().into()
6762    }
6763}
6764
6765#[cfg(target_os = "fuchsia")]
6766impl From<fidl::Channel> for PayloadStreamSynchronousProxy {
6767    fn from(value: fidl::Channel) -> Self {
6768        Self::new(value)
6769    }
6770}
6771
6772#[cfg(target_os = "fuchsia")]
6773impl fidl::endpoints::FromClient for PayloadStreamSynchronousProxy {
6774    type Protocol = PayloadStreamMarker;
6775
6776    fn from_client(value: fidl::endpoints::ClientEnd<PayloadStreamMarker>) -> Self {
6777        Self::new(value.into_channel())
6778    }
6779}
6780
6781#[derive(Debug, Clone)]
6782pub struct PayloadStreamProxy {
6783    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6784}
6785
6786impl fidl::endpoints::Proxy for PayloadStreamProxy {
6787    type Protocol = PayloadStreamMarker;
6788
6789    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6790        Self::new(inner)
6791    }
6792
6793    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6794        self.client.into_channel().map_err(|client| Self { client })
6795    }
6796
6797    fn as_channel(&self) -> &::fidl::AsyncChannel {
6798        self.client.as_channel()
6799    }
6800}
6801
6802impl PayloadStreamProxy {
6803    /// Create a new Proxy for fuchsia.paver/PayloadStream.
6804    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6805        let protocol_name = <PayloadStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6806        Self { client: fidl::client::Client::new(channel, protocol_name) }
6807    }
6808
6809    /// Get a Stream of events from the remote end of the protocol.
6810    ///
6811    /// # Panics
6812    ///
6813    /// Panics if the event stream was already taken.
6814    pub fn take_event_stream(&self) -> PayloadStreamEventStream {
6815        PayloadStreamEventStream { event_receiver: self.client.take_event_receiver() }
6816    }
6817
6818    /// Registers a VMO to stream into.
6819    ///
6820    /// This can be called once per PayloadStream.
6821    /// Any subsequent calls will return ZX_ERR_ALREADY_BOUND.
6822    pub fn r#register_vmo(
6823        &self,
6824        mut vmo: fidl::Vmo,
6825    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
6826        PayloadStreamProxyInterface::r#register_vmo(self, vmo)
6827    }
6828
6829    /// Reads data into the pre-registered vmo.
6830    pub fn r#read_data(
6831        &self,
6832    ) -> fidl::client::QueryResponseFut<ReadResult, fidl::encoding::DefaultFuchsiaResourceDialect>
6833    {
6834        PayloadStreamProxyInterface::r#read_data(self)
6835    }
6836}
6837
6838impl PayloadStreamProxyInterface for PayloadStreamProxy {
6839    type RegisterVmoResponseFut =
6840        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
6841    fn r#register_vmo(&self, mut vmo: fidl::Vmo) -> Self::RegisterVmoResponseFut {
6842        fn _decode(
6843            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6844        ) -> Result<i32, fidl::Error> {
6845            let _response = fidl::client::decode_transaction_body::<
6846                PayloadStreamRegisterVmoResponse,
6847                fidl::encoding::DefaultFuchsiaResourceDialect,
6848                0x388d7fe44bcb4c,
6849            >(_buf?)?;
6850            Ok(_response.status)
6851        }
6852        self.client.send_query_and_decode::<PayloadStreamRegisterVmoRequest, i32>(
6853            (vmo,),
6854            0x388d7fe44bcb4c,
6855            fidl::encoding::DynamicFlags::empty(),
6856            _decode,
6857        )
6858    }
6859
6860    type ReadDataResponseFut =
6861        fidl::client::QueryResponseFut<ReadResult, fidl::encoding::DefaultFuchsiaResourceDialect>;
6862    fn r#read_data(&self) -> Self::ReadDataResponseFut {
6863        fn _decode(
6864            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6865        ) -> Result<ReadResult, fidl::Error> {
6866            let _response = fidl::client::decode_transaction_body::<
6867                PayloadStreamReadDataResponse,
6868                fidl::encoding::DefaultFuchsiaResourceDialect,
6869                0x2ccde55366318afa,
6870            >(_buf?)?;
6871            Ok(_response.result)
6872        }
6873        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ReadResult>(
6874            (),
6875            0x2ccde55366318afa,
6876            fidl::encoding::DynamicFlags::empty(),
6877            _decode,
6878        )
6879    }
6880}
6881
6882pub struct PayloadStreamEventStream {
6883    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6884}
6885
6886impl std::marker::Unpin for PayloadStreamEventStream {}
6887
6888impl futures::stream::FusedStream for PayloadStreamEventStream {
6889    fn is_terminated(&self) -> bool {
6890        self.event_receiver.is_terminated()
6891    }
6892}
6893
6894impl futures::Stream for PayloadStreamEventStream {
6895    type Item = Result<PayloadStreamEvent, fidl::Error>;
6896
6897    fn poll_next(
6898        mut self: std::pin::Pin<&mut Self>,
6899        cx: &mut std::task::Context<'_>,
6900    ) -> std::task::Poll<Option<Self::Item>> {
6901        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6902            &mut self.event_receiver,
6903            cx
6904        )?) {
6905            Some(buf) => std::task::Poll::Ready(Some(PayloadStreamEvent::decode(buf))),
6906            None => std::task::Poll::Ready(None),
6907        }
6908    }
6909}
6910
6911#[derive(Debug)]
6912pub enum PayloadStreamEvent {}
6913
6914impl PayloadStreamEvent {
6915    /// Decodes a message buffer as a [`PayloadStreamEvent`].
6916    fn decode(
6917        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6918    ) -> Result<PayloadStreamEvent, fidl::Error> {
6919        let (bytes, _handles) = buf.split_mut();
6920        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6921        debug_assert_eq!(tx_header.tx_id, 0);
6922        match tx_header.ordinal {
6923            _ => Err(fidl::Error::UnknownOrdinal {
6924                ordinal: tx_header.ordinal,
6925                protocol_name: <PayloadStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6926            }),
6927        }
6928    }
6929}
6930
6931/// A Stream of incoming requests for fuchsia.paver/PayloadStream.
6932pub struct PayloadStreamRequestStream {
6933    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6934    is_terminated: bool,
6935}
6936
6937impl std::marker::Unpin for PayloadStreamRequestStream {}
6938
6939impl futures::stream::FusedStream for PayloadStreamRequestStream {
6940    fn is_terminated(&self) -> bool {
6941        self.is_terminated
6942    }
6943}
6944
6945impl fidl::endpoints::RequestStream for PayloadStreamRequestStream {
6946    type Protocol = PayloadStreamMarker;
6947    type ControlHandle = PayloadStreamControlHandle;
6948
6949    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6950        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6951    }
6952
6953    fn control_handle(&self) -> Self::ControlHandle {
6954        PayloadStreamControlHandle { inner: self.inner.clone() }
6955    }
6956
6957    fn into_inner(
6958        self,
6959    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6960    {
6961        (self.inner, self.is_terminated)
6962    }
6963
6964    fn from_inner(
6965        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6966        is_terminated: bool,
6967    ) -> Self {
6968        Self { inner, is_terminated }
6969    }
6970}
6971
6972impl futures::Stream for PayloadStreamRequestStream {
6973    type Item = Result<PayloadStreamRequest, fidl::Error>;
6974
6975    fn poll_next(
6976        mut self: std::pin::Pin<&mut Self>,
6977        cx: &mut std::task::Context<'_>,
6978    ) -> std::task::Poll<Option<Self::Item>> {
6979        let this = &mut *self;
6980        if this.inner.check_shutdown(cx) {
6981            this.is_terminated = true;
6982            return std::task::Poll::Ready(None);
6983        }
6984        if this.is_terminated {
6985            panic!("polled PayloadStreamRequestStream after completion");
6986        }
6987        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6988            |bytes, handles| {
6989                match this.inner.channel().read_etc(cx, bytes, handles) {
6990                    std::task::Poll::Ready(Ok(())) => {}
6991                    std::task::Poll::Pending => return std::task::Poll::Pending,
6992                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6993                        this.is_terminated = true;
6994                        return std::task::Poll::Ready(None);
6995                    }
6996                    std::task::Poll::Ready(Err(e)) => {
6997                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6998                            e.into(),
6999                        ))));
7000                    }
7001                }
7002
7003                // A message has been received from the channel
7004                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7005
7006                std::task::Poll::Ready(Some(match header.ordinal {
7007                    0x388d7fe44bcb4c => {
7008                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7009                        let mut req = fidl::new_empty!(
7010                            PayloadStreamRegisterVmoRequest,
7011                            fidl::encoding::DefaultFuchsiaResourceDialect
7012                        );
7013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PayloadStreamRegisterVmoRequest>(&header, _body_bytes, handles, &mut req)?;
7014                        let control_handle =
7015                            PayloadStreamControlHandle { inner: this.inner.clone() };
7016                        Ok(PayloadStreamRequest::RegisterVmo {
7017                            vmo: req.vmo,
7018
7019                            responder: PayloadStreamRegisterVmoResponder {
7020                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7021                                tx_id: header.tx_id,
7022                            },
7023                        })
7024                    }
7025                    0x2ccde55366318afa => {
7026                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7027                        let mut req = fidl::new_empty!(
7028                            fidl::encoding::EmptyPayload,
7029                            fidl::encoding::DefaultFuchsiaResourceDialect
7030                        );
7031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7032                        let control_handle =
7033                            PayloadStreamControlHandle { inner: this.inner.clone() };
7034                        Ok(PayloadStreamRequest::ReadData {
7035                            responder: PayloadStreamReadDataResponder {
7036                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7037                                tx_id: header.tx_id,
7038                            },
7039                        })
7040                    }
7041                    _ => Err(fidl::Error::UnknownOrdinal {
7042                        ordinal: header.ordinal,
7043                        protocol_name:
7044                            <PayloadStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7045                    }),
7046                }))
7047            },
7048        )
7049    }
7050}
7051
7052/// Protocol for streaming the FVM payload.
7053#[derive(Debug)]
7054pub enum PayloadStreamRequest {
7055    /// Registers a VMO to stream into.
7056    ///
7057    /// This can be called once per PayloadStream.
7058    /// Any subsequent calls will return ZX_ERR_ALREADY_BOUND.
7059    RegisterVmo { vmo: fidl::Vmo, responder: PayloadStreamRegisterVmoResponder },
7060    /// Reads data into the pre-registered vmo.
7061    ReadData { responder: PayloadStreamReadDataResponder },
7062}
7063
7064impl PayloadStreamRequest {
7065    #[allow(irrefutable_let_patterns)]
7066    pub fn into_register_vmo(self) -> Option<(fidl::Vmo, PayloadStreamRegisterVmoResponder)> {
7067        if let PayloadStreamRequest::RegisterVmo { vmo, responder } = self {
7068            Some((vmo, responder))
7069        } else {
7070            None
7071        }
7072    }
7073
7074    #[allow(irrefutable_let_patterns)]
7075    pub fn into_read_data(self) -> Option<(PayloadStreamReadDataResponder)> {
7076        if let PayloadStreamRequest::ReadData { responder } = self {
7077            Some((responder))
7078        } else {
7079            None
7080        }
7081    }
7082
7083    /// Name of the method defined in FIDL
7084    pub fn method_name(&self) -> &'static str {
7085        match *self {
7086            PayloadStreamRequest::RegisterVmo { .. } => "register_vmo",
7087            PayloadStreamRequest::ReadData { .. } => "read_data",
7088        }
7089    }
7090}
7091
7092#[derive(Debug, Clone)]
7093pub struct PayloadStreamControlHandle {
7094    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7095}
7096
7097impl fidl::endpoints::ControlHandle for PayloadStreamControlHandle {
7098    fn shutdown(&self) {
7099        self.inner.shutdown()
7100    }
7101
7102    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7103        self.inner.shutdown_with_epitaph(status)
7104    }
7105
7106    fn is_closed(&self) -> bool {
7107        self.inner.channel().is_closed()
7108    }
7109    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7110        self.inner.channel().on_closed()
7111    }
7112
7113    #[cfg(target_os = "fuchsia")]
7114    fn signal_peer(
7115        &self,
7116        clear_mask: zx::Signals,
7117        set_mask: zx::Signals,
7118    ) -> Result<(), zx_status::Status> {
7119        use fidl::Peered;
7120        self.inner.channel().signal_peer(clear_mask, set_mask)
7121    }
7122}
7123
7124impl PayloadStreamControlHandle {}
7125
7126#[must_use = "FIDL methods require a response to be sent"]
7127#[derive(Debug)]
7128pub struct PayloadStreamRegisterVmoResponder {
7129    control_handle: std::mem::ManuallyDrop<PayloadStreamControlHandle>,
7130    tx_id: u32,
7131}
7132
7133/// Set the the channel to be shutdown (see [`PayloadStreamControlHandle::shutdown`])
7134/// if the responder is dropped without sending a response, so that the client
7135/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7136impl std::ops::Drop for PayloadStreamRegisterVmoResponder {
7137    fn drop(&mut self) {
7138        self.control_handle.shutdown();
7139        // Safety: drops once, never accessed again
7140        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7141    }
7142}
7143
7144impl fidl::endpoints::Responder for PayloadStreamRegisterVmoResponder {
7145    type ControlHandle = PayloadStreamControlHandle;
7146
7147    fn control_handle(&self) -> &PayloadStreamControlHandle {
7148        &self.control_handle
7149    }
7150
7151    fn drop_without_shutdown(mut self) {
7152        // Safety: drops once, never accessed again due to mem::forget
7153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7154        // Prevent Drop from running (which would shut down the channel)
7155        std::mem::forget(self);
7156    }
7157}
7158
7159impl PayloadStreamRegisterVmoResponder {
7160    /// Sends a response to the FIDL transaction.
7161    ///
7162    /// Sets the channel to shutdown if an error occurs.
7163    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
7164        let _result = self.send_raw(status);
7165        if _result.is_err() {
7166            self.control_handle.shutdown();
7167        }
7168        self.drop_without_shutdown();
7169        _result
7170    }
7171
7172    /// Similar to "send" but does not shutdown the channel if an error occurs.
7173    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
7174        let _result = self.send_raw(status);
7175        self.drop_without_shutdown();
7176        _result
7177    }
7178
7179    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
7180        self.control_handle.inner.send::<PayloadStreamRegisterVmoResponse>(
7181            (status,),
7182            self.tx_id,
7183            0x388d7fe44bcb4c,
7184            fidl::encoding::DynamicFlags::empty(),
7185        )
7186    }
7187}
7188
7189#[must_use = "FIDL methods require a response to be sent"]
7190#[derive(Debug)]
7191pub struct PayloadStreamReadDataResponder {
7192    control_handle: std::mem::ManuallyDrop<PayloadStreamControlHandle>,
7193    tx_id: u32,
7194}
7195
7196/// Set the the channel to be shutdown (see [`PayloadStreamControlHandle::shutdown`])
7197/// if the responder is dropped without sending a response, so that the client
7198/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7199impl std::ops::Drop for PayloadStreamReadDataResponder {
7200    fn drop(&mut self) {
7201        self.control_handle.shutdown();
7202        // Safety: drops once, never accessed again
7203        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7204    }
7205}
7206
7207impl fidl::endpoints::Responder for PayloadStreamReadDataResponder {
7208    type ControlHandle = PayloadStreamControlHandle;
7209
7210    fn control_handle(&self) -> &PayloadStreamControlHandle {
7211        &self.control_handle
7212    }
7213
7214    fn drop_without_shutdown(mut self) {
7215        // Safety: drops once, never accessed again due to mem::forget
7216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7217        // Prevent Drop from running (which would shut down the channel)
7218        std::mem::forget(self);
7219    }
7220}
7221
7222impl PayloadStreamReadDataResponder {
7223    /// Sends a response to the FIDL transaction.
7224    ///
7225    /// Sets the channel to shutdown if an error occurs.
7226    pub fn send(self, mut result: &ReadResult) -> Result<(), fidl::Error> {
7227        let _result = self.send_raw(result);
7228        if _result.is_err() {
7229            self.control_handle.shutdown();
7230        }
7231        self.drop_without_shutdown();
7232        _result
7233    }
7234
7235    /// Similar to "send" but does not shutdown the channel if an error occurs.
7236    pub fn send_no_shutdown_on_err(self, mut result: &ReadResult) -> Result<(), fidl::Error> {
7237        let _result = self.send_raw(result);
7238        self.drop_without_shutdown();
7239        _result
7240    }
7241
7242    fn send_raw(&self, mut result: &ReadResult) -> Result<(), fidl::Error> {
7243        self.control_handle.inner.send::<PayloadStreamReadDataResponse>(
7244            (result,),
7245            self.tx_id,
7246            0x2ccde55366318afa,
7247            fidl::encoding::DynamicFlags::empty(),
7248        )
7249    }
7250}
7251
7252#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7253pub struct SysconfigMarker;
7254
7255impl fidl::endpoints::ProtocolMarker for SysconfigMarker {
7256    type Proxy = SysconfigProxy;
7257    type RequestStream = SysconfigRequestStream;
7258    #[cfg(target_os = "fuchsia")]
7259    type SynchronousProxy = SysconfigSynchronousProxy;
7260
7261    const DEBUG_NAME: &'static str = "(anonymous) Sysconfig";
7262}
7263pub type SysconfigReadResult = Result<fidl_fuchsia_mem::Buffer, i32>;
7264pub type SysconfigGetPartitionSizeResult = Result<u64, i32>;
7265
7266pub trait SysconfigProxyInterface: Send + Sync {
7267    type ReadResponseFut: std::future::Future<Output = Result<SysconfigReadResult, fidl::Error>>
7268        + Send;
7269    fn r#read(&self) -> Self::ReadResponseFut;
7270    type WriteResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
7271    fn r#write(&self, payload: fidl_fuchsia_mem::Buffer) -> Self::WriteResponseFut;
7272    type GetPartitionSizeResponseFut: std::future::Future<Output = Result<SysconfigGetPartitionSizeResult, fidl::Error>>
7273        + Send;
7274    fn r#get_partition_size(&self) -> Self::GetPartitionSizeResponseFut;
7275    type FlushResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
7276    fn r#flush(&self) -> Self::FlushResponseFut;
7277    type WipeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
7278    fn r#wipe(&self) -> Self::WipeResponseFut;
7279}
7280#[derive(Debug)]
7281#[cfg(target_os = "fuchsia")]
7282pub struct SysconfigSynchronousProxy {
7283    client: fidl::client::sync::Client,
7284}
7285
7286#[cfg(target_os = "fuchsia")]
7287impl fidl::endpoints::SynchronousProxy for SysconfigSynchronousProxy {
7288    type Proxy = SysconfigProxy;
7289    type Protocol = SysconfigMarker;
7290
7291    fn from_channel(inner: fidl::Channel) -> Self {
7292        Self::new(inner)
7293    }
7294
7295    fn into_channel(self) -> fidl::Channel {
7296        self.client.into_channel()
7297    }
7298
7299    fn as_channel(&self) -> &fidl::Channel {
7300        self.client.as_channel()
7301    }
7302}
7303
7304#[cfg(target_os = "fuchsia")]
7305impl SysconfigSynchronousProxy {
7306    pub fn new(channel: fidl::Channel) -> Self {
7307        Self { client: fidl::client::sync::Client::new(channel) }
7308    }
7309
7310    pub fn into_channel(self) -> fidl::Channel {
7311        self.client.into_channel()
7312    }
7313
7314    /// Waits until an event arrives and returns it. It is safe for other
7315    /// threads to make concurrent requests while waiting for an event.
7316    pub fn wait_for_event(
7317        &self,
7318        deadline: zx::MonotonicInstant,
7319    ) -> Result<SysconfigEvent, fidl::Error> {
7320        SysconfigEvent::decode(self.client.wait_for_event::<SysconfigMarker>(deadline)?)
7321    }
7322
7323    /// Read from the sub-partition
7324    pub fn r#read(
7325        &self,
7326        ___deadline: zx::MonotonicInstant,
7327    ) -> Result<SysconfigReadResult, fidl::Error> {
7328        let _response = self.client.send_query::<
7329            fidl::encoding::EmptyPayload,
7330            fidl::encoding::ResultType<SysconfigReadResponse, i32>,
7331            SysconfigMarker,
7332        >(
7333            (),
7334            0x350c317c53c226fc,
7335            fidl::encoding::DynamicFlags::empty(),
7336            ___deadline,
7337        )?;
7338        Ok(_response.map(|x| x.data))
7339    }
7340
7341    /// Writes to the sub-partition
7342    pub fn r#write(
7343        &self,
7344        mut payload: fidl_fuchsia_mem::Buffer,
7345        ___deadline: zx::MonotonicInstant,
7346    ) -> Result<i32, fidl::Error> {
7347        let _response = self
7348            .client
7349            .send_query::<SysconfigWriteRequest, SysconfigWriteResponse, SysconfigMarker>(
7350                (&mut payload,),
7351                0x393786c114caf171,
7352                fidl::encoding::DynamicFlags::empty(),
7353                ___deadline,
7354            )?;
7355        Ok(_response.status)
7356    }
7357
7358    /// Get sub-partition size.
7359    pub fn r#get_partition_size(
7360        &self,
7361        ___deadline: zx::MonotonicInstant,
7362    ) -> Result<SysconfigGetPartitionSizeResult, fidl::Error> {
7363        let _response = self.client.send_query::<
7364            fidl::encoding::EmptyPayload,
7365            fidl::encoding::ResultType<SysconfigGetPartitionSizeResponse, i32>,
7366            SysconfigMarker,
7367        >(
7368            (),
7369            0x2570c58b74fb8957,
7370            fidl::encoding::DynamicFlags::empty(),
7371            ___deadline,
7372        )?;
7373        Ok(_response.map(|x| x.size))
7374    }
7375
7376    /// Flush all previously buffered data to persistent storage.
7377    pub fn r#flush(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
7378        let _response = self
7379            .client
7380            .send_query::<fidl::encoding::EmptyPayload, SysconfigFlushResponse, SysconfigMarker>(
7381                (),
7382                0xc6c1bb233d003c6,
7383                fidl::encoding::DynamicFlags::empty(),
7384                ___deadline,
7385            )?;
7386        Ok(_response.status)
7387    }
7388
7389    /// Wipe all data in the sub-partition (write 0 to all bytes).
7390    pub fn r#wipe(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
7391        let _response = self
7392            .client
7393            .send_query::<fidl::encoding::EmptyPayload, SysconfigWipeResponse, SysconfigMarker>(
7394                (),
7395                0x34a634965ebfb702,
7396                fidl::encoding::DynamicFlags::empty(),
7397                ___deadline,
7398            )?;
7399        Ok(_response.status)
7400    }
7401}
7402
7403#[cfg(target_os = "fuchsia")]
7404impl From<SysconfigSynchronousProxy> for zx::NullableHandle {
7405    fn from(value: SysconfigSynchronousProxy) -> Self {
7406        value.into_channel().into()
7407    }
7408}
7409
7410#[cfg(target_os = "fuchsia")]
7411impl From<fidl::Channel> for SysconfigSynchronousProxy {
7412    fn from(value: fidl::Channel) -> Self {
7413        Self::new(value)
7414    }
7415}
7416
7417#[cfg(target_os = "fuchsia")]
7418impl fidl::endpoints::FromClient for SysconfigSynchronousProxy {
7419    type Protocol = SysconfigMarker;
7420
7421    fn from_client(value: fidl::endpoints::ClientEnd<SysconfigMarker>) -> Self {
7422        Self::new(value.into_channel())
7423    }
7424}
7425
7426#[derive(Debug, Clone)]
7427pub struct SysconfigProxy {
7428    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7429}
7430
7431impl fidl::endpoints::Proxy for SysconfigProxy {
7432    type Protocol = SysconfigMarker;
7433
7434    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7435        Self::new(inner)
7436    }
7437
7438    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7439        self.client.into_channel().map_err(|client| Self { client })
7440    }
7441
7442    fn as_channel(&self) -> &::fidl::AsyncChannel {
7443        self.client.as_channel()
7444    }
7445}
7446
7447impl SysconfigProxy {
7448    /// Create a new Proxy for fuchsia.paver/Sysconfig.
7449    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7450        let protocol_name = <SysconfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7451        Self { client: fidl::client::Client::new(channel, protocol_name) }
7452    }
7453
7454    /// Get a Stream of events from the remote end of the protocol.
7455    ///
7456    /// # Panics
7457    ///
7458    /// Panics if the event stream was already taken.
7459    pub fn take_event_stream(&self) -> SysconfigEventStream {
7460        SysconfigEventStream { event_receiver: self.client.take_event_receiver() }
7461    }
7462
7463    /// Read from the sub-partition
7464    pub fn r#read(
7465        &self,
7466    ) -> fidl::client::QueryResponseFut<
7467        SysconfigReadResult,
7468        fidl::encoding::DefaultFuchsiaResourceDialect,
7469    > {
7470        SysconfigProxyInterface::r#read(self)
7471    }
7472
7473    /// Writes to the sub-partition
7474    pub fn r#write(
7475        &self,
7476        mut payload: fidl_fuchsia_mem::Buffer,
7477    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
7478        SysconfigProxyInterface::r#write(self, payload)
7479    }
7480
7481    /// Get sub-partition size.
7482    pub fn r#get_partition_size(
7483        &self,
7484    ) -> fidl::client::QueryResponseFut<
7485        SysconfigGetPartitionSizeResult,
7486        fidl::encoding::DefaultFuchsiaResourceDialect,
7487    > {
7488        SysconfigProxyInterface::r#get_partition_size(self)
7489    }
7490
7491    /// Flush all previously buffered data to persistent storage.
7492    pub fn r#flush(
7493        &self,
7494    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
7495        SysconfigProxyInterface::r#flush(self)
7496    }
7497
7498    /// Wipe all data in the sub-partition (write 0 to all bytes).
7499    pub fn r#wipe(
7500        &self,
7501    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
7502        SysconfigProxyInterface::r#wipe(self)
7503    }
7504}
7505
7506impl SysconfigProxyInterface for SysconfigProxy {
7507    type ReadResponseFut = fidl::client::QueryResponseFut<
7508        SysconfigReadResult,
7509        fidl::encoding::DefaultFuchsiaResourceDialect,
7510    >;
7511    fn r#read(&self) -> Self::ReadResponseFut {
7512        fn _decode(
7513            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7514        ) -> Result<SysconfigReadResult, fidl::Error> {
7515            let _response = fidl::client::decode_transaction_body::<
7516                fidl::encoding::ResultType<SysconfigReadResponse, i32>,
7517                fidl::encoding::DefaultFuchsiaResourceDialect,
7518                0x350c317c53c226fc,
7519            >(_buf?)?;
7520            Ok(_response.map(|x| x.data))
7521        }
7522        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SysconfigReadResult>(
7523            (),
7524            0x350c317c53c226fc,
7525            fidl::encoding::DynamicFlags::empty(),
7526            _decode,
7527        )
7528    }
7529
7530    type WriteResponseFut =
7531        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
7532    fn r#write(&self, mut payload: fidl_fuchsia_mem::Buffer) -> Self::WriteResponseFut {
7533        fn _decode(
7534            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7535        ) -> Result<i32, fidl::Error> {
7536            let _response = fidl::client::decode_transaction_body::<
7537                SysconfigWriteResponse,
7538                fidl::encoding::DefaultFuchsiaResourceDialect,
7539                0x393786c114caf171,
7540            >(_buf?)?;
7541            Ok(_response.status)
7542        }
7543        self.client.send_query_and_decode::<SysconfigWriteRequest, i32>(
7544            (&mut payload,),
7545            0x393786c114caf171,
7546            fidl::encoding::DynamicFlags::empty(),
7547            _decode,
7548        )
7549    }
7550
7551    type GetPartitionSizeResponseFut = fidl::client::QueryResponseFut<
7552        SysconfigGetPartitionSizeResult,
7553        fidl::encoding::DefaultFuchsiaResourceDialect,
7554    >;
7555    fn r#get_partition_size(&self) -> Self::GetPartitionSizeResponseFut {
7556        fn _decode(
7557            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7558        ) -> Result<SysconfigGetPartitionSizeResult, fidl::Error> {
7559            let _response = fidl::client::decode_transaction_body::<
7560                fidl::encoding::ResultType<SysconfigGetPartitionSizeResponse, i32>,
7561                fidl::encoding::DefaultFuchsiaResourceDialect,
7562                0x2570c58b74fb8957,
7563            >(_buf?)?;
7564            Ok(_response.map(|x| x.size))
7565        }
7566        self.client
7567            .send_query_and_decode::<fidl::encoding::EmptyPayload, SysconfigGetPartitionSizeResult>(
7568                (),
7569                0x2570c58b74fb8957,
7570                fidl::encoding::DynamicFlags::empty(),
7571                _decode,
7572            )
7573    }
7574
7575    type FlushResponseFut =
7576        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
7577    fn r#flush(&self) -> Self::FlushResponseFut {
7578        fn _decode(
7579            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7580        ) -> Result<i32, fidl::Error> {
7581            let _response = fidl::client::decode_transaction_body::<
7582                SysconfigFlushResponse,
7583                fidl::encoding::DefaultFuchsiaResourceDialect,
7584                0xc6c1bb233d003c6,
7585            >(_buf?)?;
7586            Ok(_response.status)
7587        }
7588        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
7589            (),
7590            0xc6c1bb233d003c6,
7591            fidl::encoding::DynamicFlags::empty(),
7592            _decode,
7593        )
7594    }
7595
7596    type WipeResponseFut =
7597        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
7598    fn r#wipe(&self) -> Self::WipeResponseFut {
7599        fn _decode(
7600            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7601        ) -> Result<i32, fidl::Error> {
7602            let _response = fidl::client::decode_transaction_body::<
7603                SysconfigWipeResponse,
7604                fidl::encoding::DefaultFuchsiaResourceDialect,
7605                0x34a634965ebfb702,
7606            >(_buf?)?;
7607            Ok(_response.status)
7608        }
7609        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
7610            (),
7611            0x34a634965ebfb702,
7612            fidl::encoding::DynamicFlags::empty(),
7613            _decode,
7614        )
7615    }
7616}
7617
7618pub struct SysconfigEventStream {
7619    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7620}
7621
7622impl std::marker::Unpin for SysconfigEventStream {}
7623
7624impl futures::stream::FusedStream for SysconfigEventStream {
7625    fn is_terminated(&self) -> bool {
7626        self.event_receiver.is_terminated()
7627    }
7628}
7629
7630impl futures::Stream for SysconfigEventStream {
7631    type Item = Result<SysconfigEvent, fidl::Error>;
7632
7633    fn poll_next(
7634        mut self: std::pin::Pin<&mut Self>,
7635        cx: &mut std::task::Context<'_>,
7636    ) -> std::task::Poll<Option<Self::Item>> {
7637        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7638            &mut self.event_receiver,
7639            cx
7640        )?) {
7641            Some(buf) => std::task::Poll::Ready(Some(SysconfigEvent::decode(buf))),
7642            None => std::task::Poll::Ready(None),
7643        }
7644    }
7645}
7646
7647#[derive(Debug)]
7648pub enum SysconfigEvent {}
7649
7650impl SysconfigEvent {
7651    /// Decodes a message buffer as a [`SysconfigEvent`].
7652    fn decode(
7653        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7654    ) -> Result<SysconfigEvent, fidl::Error> {
7655        let (bytes, _handles) = buf.split_mut();
7656        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7657        debug_assert_eq!(tx_header.tx_id, 0);
7658        match tx_header.ordinal {
7659            _ => Err(fidl::Error::UnknownOrdinal {
7660                ordinal: tx_header.ordinal,
7661                protocol_name: <SysconfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7662            }),
7663        }
7664    }
7665}
7666
7667/// A Stream of incoming requests for fuchsia.paver/Sysconfig.
7668pub struct SysconfigRequestStream {
7669    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7670    is_terminated: bool,
7671}
7672
7673impl std::marker::Unpin for SysconfigRequestStream {}
7674
7675impl futures::stream::FusedStream for SysconfigRequestStream {
7676    fn is_terminated(&self) -> bool {
7677        self.is_terminated
7678    }
7679}
7680
7681impl fidl::endpoints::RequestStream for SysconfigRequestStream {
7682    type Protocol = SysconfigMarker;
7683    type ControlHandle = SysconfigControlHandle;
7684
7685    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7686        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7687    }
7688
7689    fn control_handle(&self) -> Self::ControlHandle {
7690        SysconfigControlHandle { inner: self.inner.clone() }
7691    }
7692
7693    fn into_inner(
7694        self,
7695    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7696    {
7697        (self.inner, self.is_terminated)
7698    }
7699
7700    fn from_inner(
7701        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7702        is_terminated: bool,
7703    ) -> Self {
7704        Self { inner, is_terminated }
7705    }
7706}
7707
7708impl futures::Stream for SysconfigRequestStream {
7709    type Item = Result<SysconfigRequest, fidl::Error>;
7710
7711    fn poll_next(
7712        mut self: std::pin::Pin<&mut Self>,
7713        cx: &mut std::task::Context<'_>,
7714    ) -> std::task::Poll<Option<Self::Item>> {
7715        let this = &mut *self;
7716        if this.inner.check_shutdown(cx) {
7717            this.is_terminated = true;
7718            return std::task::Poll::Ready(None);
7719        }
7720        if this.is_terminated {
7721            panic!("polled SysconfigRequestStream after completion");
7722        }
7723        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7724            |bytes, handles| {
7725                match this.inner.channel().read_etc(cx, bytes, handles) {
7726                    std::task::Poll::Ready(Ok(())) => {}
7727                    std::task::Poll::Pending => return std::task::Poll::Pending,
7728                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7729                        this.is_terminated = true;
7730                        return std::task::Poll::Ready(None);
7731                    }
7732                    std::task::Poll::Ready(Err(e)) => {
7733                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7734                            e.into(),
7735                        ))));
7736                    }
7737                }
7738
7739                // A message has been received from the channel
7740                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7741
7742                std::task::Poll::Ready(Some(match header.ordinal {
7743                    0x350c317c53c226fc => {
7744                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7745                        let mut req = fidl::new_empty!(
7746                            fidl::encoding::EmptyPayload,
7747                            fidl::encoding::DefaultFuchsiaResourceDialect
7748                        );
7749                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7750                        let control_handle = SysconfigControlHandle { inner: this.inner.clone() };
7751                        Ok(SysconfigRequest::Read {
7752                            responder: SysconfigReadResponder {
7753                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7754                                tx_id: header.tx_id,
7755                            },
7756                        })
7757                    }
7758                    0x393786c114caf171 => {
7759                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7760                        let mut req = fidl::new_empty!(
7761                            SysconfigWriteRequest,
7762                            fidl::encoding::DefaultFuchsiaResourceDialect
7763                        );
7764                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SysconfigWriteRequest>(&header, _body_bytes, handles, &mut req)?;
7765                        let control_handle = SysconfigControlHandle { inner: this.inner.clone() };
7766                        Ok(SysconfigRequest::Write {
7767                            payload: req.payload,
7768
7769                            responder: SysconfigWriteResponder {
7770                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7771                                tx_id: header.tx_id,
7772                            },
7773                        })
7774                    }
7775                    0x2570c58b74fb8957 => {
7776                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7777                        let mut req = fidl::new_empty!(
7778                            fidl::encoding::EmptyPayload,
7779                            fidl::encoding::DefaultFuchsiaResourceDialect
7780                        );
7781                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7782                        let control_handle = SysconfigControlHandle { inner: this.inner.clone() };
7783                        Ok(SysconfigRequest::GetPartitionSize {
7784                            responder: SysconfigGetPartitionSizeResponder {
7785                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7786                                tx_id: header.tx_id,
7787                            },
7788                        })
7789                    }
7790                    0xc6c1bb233d003c6 => {
7791                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7792                        let mut req = fidl::new_empty!(
7793                            fidl::encoding::EmptyPayload,
7794                            fidl::encoding::DefaultFuchsiaResourceDialect
7795                        );
7796                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7797                        let control_handle = SysconfigControlHandle { inner: this.inner.clone() };
7798                        Ok(SysconfigRequest::Flush {
7799                            responder: SysconfigFlushResponder {
7800                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7801                                tx_id: header.tx_id,
7802                            },
7803                        })
7804                    }
7805                    0x34a634965ebfb702 => {
7806                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7807                        let mut req = fidl::new_empty!(
7808                            fidl::encoding::EmptyPayload,
7809                            fidl::encoding::DefaultFuchsiaResourceDialect
7810                        );
7811                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7812                        let control_handle = SysconfigControlHandle { inner: this.inner.clone() };
7813                        Ok(SysconfigRequest::Wipe {
7814                            responder: SysconfigWipeResponder {
7815                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7816                                tx_id: header.tx_id,
7817                            },
7818                        })
7819                    }
7820                    _ => Err(fidl::Error::UnknownOrdinal {
7821                        ordinal: header.ordinal,
7822                        protocol_name:
7823                            <SysconfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7824                    }),
7825                }))
7826            },
7827        )
7828    }
7829}
7830
7831/// Protocol that provides access to sysconfig-data sub-partition in sysconfig partition.
7832/// The main user of the protocol are pkg-solver and system update-checker, which need to
7833/// read/write sysconfig-data channel.
7834#[derive(Debug)]
7835pub enum SysconfigRequest {
7836    /// Read from the sub-partition
7837    Read { responder: SysconfigReadResponder },
7838    /// Writes to the sub-partition
7839    Write { payload: fidl_fuchsia_mem::Buffer, responder: SysconfigWriteResponder },
7840    /// Get sub-partition size.
7841    GetPartitionSize { responder: SysconfigGetPartitionSizeResponder },
7842    /// Flush all previously buffered data to persistent storage.
7843    Flush { responder: SysconfigFlushResponder },
7844    /// Wipe all data in the sub-partition (write 0 to all bytes).
7845    Wipe { responder: SysconfigWipeResponder },
7846}
7847
7848impl SysconfigRequest {
7849    #[allow(irrefutable_let_patterns)]
7850    pub fn into_read(self) -> Option<(SysconfigReadResponder)> {
7851        if let SysconfigRequest::Read { responder } = self { Some((responder)) } else { None }
7852    }
7853
7854    #[allow(irrefutable_let_patterns)]
7855    pub fn into_write(self) -> Option<(fidl_fuchsia_mem::Buffer, SysconfigWriteResponder)> {
7856        if let SysconfigRequest::Write { payload, responder } = self {
7857            Some((payload, responder))
7858        } else {
7859            None
7860        }
7861    }
7862
7863    #[allow(irrefutable_let_patterns)]
7864    pub fn into_get_partition_size(self) -> Option<(SysconfigGetPartitionSizeResponder)> {
7865        if let SysconfigRequest::GetPartitionSize { responder } = self {
7866            Some((responder))
7867        } else {
7868            None
7869        }
7870    }
7871
7872    #[allow(irrefutable_let_patterns)]
7873    pub fn into_flush(self) -> Option<(SysconfigFlushResponder)> {
7874        if let SysconfigRequest::Flush { responder } = self { Some((responder)) } else { None }
7875    }
7876
7877    #[allow(irrefutable_let_patterns)]
7878    pub fn into_wipe(self) -> Option<(SysconfigWipeResponder)> {
7879        if let SysconfigRequest::Wipe { responder } = self { Some((responder)) } else { None }
7880    }
7881
7882    /// Name of the method defined in FIDL
7883    pub fn method_name(&self) -> &'static str {
7884        match *self {
7885            SysconfigRequest::Read { .. } => "read",
7886            SysconfigRequest::Write { .. } => "write",
7887            SysconfigRequest::GetPartitionSize { .. } => "get_partition_size",
7888            SysconfigRequest::Flush { .. } => "flush",
7889            SysconfigRequest::Wipe { .. } => "wipe",
7890        }
7891    }
7892}
7893
7894#[derive(Debug, Clone)]
7895pub struct SysconfigControlHandle {
7896    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7897}
7898
7899impl fidl::endpoints::ControlHandle for SysconfigControlHandle {
7900    fn shutdown(&self) {
7901        self.inner.shutdown()
7902    }
7903
7904    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7905        self.inner.shutdown_with_epitaph(status)
7906    }
7907
7908    fn is_closed(&self) -> bool {
7909        self.inner.channel().is_closed()
7910    }
7911    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7912        self.inner.channel().on_closed()
7913    }
7914
7915    #[cfg(target_os = "fuchsia")]
7916    fn signal_peer(
7917        &self,
7918        clear_mask: zx::Signals,
7919        set_mask: zx::Signals,
7920    ) -> Result<(), zx_status::Status> {
7921        use fidl::Peered;
7922        self.inner.channel().signal_peer(clear_mask, set_mask)
7923    }
7924}
7925
7926impl SysconfigControlHandle {}
7927
7928#[must_use = "FIDL methods require a response to be sent"]
7929#[derive(Debug)]
7930pub struct SysconfigReadResponder {
7931    control_handle: std::mem::ManuallyDrop<SysconfigControlHandle>,
7932    tx_id: u32,
7933}
7934
7935/// Set the the channel to be shutdown (see [`SysconfigControlHandle::shutdown`])
7936/// if the responder is dropped without sending a response, so that the client
7937/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7938impl std::ops::Drop for SysconfigReadResponder {
7939    fn drop(&mut self) {
7940        self.control_handle.shutdown();
7941        // Safety: drops once, never accessed again
7942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7943    }
7944}
7945
7946impl fidl::endpoints::Responder for SysconfigReadResponder {
7947    type ControlHandle = SysconfigControlHandle;
7948
7949    fn control_handle(&self) -> &SysconfigControlHandle {
7950        &self.control_handle
7951    }
7952
7953    fn drop_without_shutdown(mut self) {
7954        // Safety: drops once, never accessed again due to mem::forget
7955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7956        // Prevent Drop from running (which would shut down the channel)
7957        std::mem::forget(self);
7958    }
7959}
7960
7961impl SysconfigReadResponder {
7962    /// Sends a response to the FIDL transaction.
7963    ///
7964    /// Sets the channel to shutdown if an error occurs.
7965    pub fn send(
7966        self,
7967        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
7968    ) -> Result<(), fidl::Error> {
7969        let _result = self.send_raw(result);
7970        if _result.is_err() {
7971            self.control_handle.shutdown();
7972        }
7973        self.drop_without_shutdown();
7974        _result
7975    }
7976
7977    /// Similar to "send" but does not shutdown the channel if an error occurs.
7978    pub fn send_no_shutdown_on_err(
7979        self,
7980        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
7981    ) -> Result<(), fidl::Error> {
7982        let _result = self.send_raw(result);
7983        self.drop_without_shutdown();
7984        _result
7985    }
7986
7987    fn send_raw(
7988        &self,
7989        mut result: Result<fidl_fuchsia_mem::Buffer, i32>,
7990    ) -> Result<(), fidl::Error> {
7991        self.control_handle.inner.send::<fidl::encoding::ResultType<SysconfigReadResponse, i32>>(
7992            result.as_mut().map_err(|e| *e).map(|data| (data,)),
7993            self.tx_id,
7994            0x350c317c53c226fc,
7995            fidl::encoding::DynamicFlags::empty(),
7996        )
7997    }
7998}
7999
8000#[must_use = "FIDL methods require a response to be sent"]
8001#[derive(Debug)]
8002pub struct SysconfigWriteResponder {
8003    control_handle: std::mem::ManuallyDrop<SysconfigControlHandle>,
8004    tx_id: u32,
8005}
8006
8007/// Set the the channel to be shutdown (see [`SysconfigControlHandle::shutdown`])
8008/// if the responder is dropped without sending a response, so that the client
8009/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8010impl std::ops::Drop for SysconfigWriteResponder {
8011    fn drop(&mut self) {
8012        self.control_handle.shutdown();
8013        // Safety: drops once, never accessed again
8014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8015    }
8016}
8017
8018impl fidl::endpoints::Responder for SysconfigWriteResponder {
8019    type ControlHandle = SysconfigControlHandle;
8020
8021    fn control_handle(&self) -> &SysconfigControlHandle {
8022        &self.control_handle
8023    }
8024
8025    fn drop_without_shutdown(mut self) {
8026        // Safety: drops once, never accessed again due to mem::forget
8027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8028        // Prevent Drop from running (which would shut down the channel)
8029        std::mem::forget(self);
8030    }
8031}
8032
8033impl SysconfigWriteResponder {
8034    /// Sends a response to the FIDL transaction.
8035    ///
8036    /// Sets the channel to shutdown if an error occurs.
8037    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
8038        let _result = self.send_raw(status);
8039        if _result.is_err() {
8040            self.control_handle.shutdown();
8041        }
8042        self.drop_without_shutdown();
8043        _result
8044    }
8045
8046    /// Similar to "send" but does not shutdown the channel if an error occurs.
8047    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
8048        let _result = self.send_raw(status);
8049        self.drop_without_shutdown();
8050        _result
8051    }
8052
8053    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
8054        self.control_handle.inner.send::<SysconfigWriteResponse>(
8055            (status,),
8056            self.tx_id,
8057            0x393786c114caf171,
8058            fidl::encoding::DynamicFlags::empty(),
8059        )
8060    }
8061}
8062
8063#[must_use = "FIDL methods require a response to be sent"]
8064#[derive(Debug)]
8065pub struct SysconfigGetPartitionSizeResponder {
8066    control_handle: std::mem::ManuallyDrop<SysconfigControlHandle>,
8067    tx_id: u32,
8068}
8069
8070/// Set the the channel to be shutdown (see [`SysconfigControlHandle::shutdown`])
8071/// if the responder is dropped without sending a response, so that the client
8072/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8073impl std::ops::Drop for SysconfigGetPartitionSizeResponder {
8074    fn drop(&mut self) {
8075        self.control_handle.shutdown();
8076        // Safety: drops once, never accessed again
8077        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8078    }
8079}
8080
8081impl fidl::endpoints::Responder for SysconfigGetPartitionSizeResponder {
8082    type ControlHandle = SysconfigControlHandle;
8083
8084    fn control_handle(&self) -> &SysconfigControlHandle {
8085        &self.control_handle
8086    }
8087
8088    fn drop_without_shutdown(mut self) {
8089        // Safety: drops once, never accessed again due to mem::forget
8090        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8091        // Prevent Drop from running (which would shut down the channel)
8092        std::mem::forget(self);
8093    }
8094}
8095
8096impl SysconfigGetPartitionSizeResponder {
8097    /// Sends a response to the FIDL transaction.
8098    ///
8099    /// Sets the channel to shutdown if an error occurs.
8100    pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
8101        let _result = self.send_raw(result);
8102        if _result.is_err() {
8103            self.control_handle.shutdown();
8104        }
8105        self.drop_without_shutdown();
8106        _result
8107    }
8108
8109    /// Similar to "send" but does not shutdown the channel if an error occurs.
8110    pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
8111        let _result = self.send_raw(result);
8112        self.drop_without_shutdown();
8113        _result
8114    }
8115
8116    fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
8117        self.control_handle
8118            .inner
8119            .send::<fidl::encoding::ResultType<SysconfigGetPartitionSizeResponse, i32>>(
8120                result.map(|size| (size,)),
8121                self.tx_id,
8122                0x2570c58b74fb8957,
8123                fidl::encoding::DynamicFlags::empty(),
8124            )
8125    }
8126}
8127
8128#[must_use = "FIDL methods require a response to be sent"]
8129#[derive(Debug)]
8130pub struct SysconfigFlushResponder {
8131    control_handle: std::mem::ManuallyDrop<SysconfigControlHandle>,
8132    tx_id: u32,
8133}
8134
8135/// Set the the channel to be shutdown (see [`SysconfigControlHandle::shutdown`])
8136/// if the responder is dropped without sending a response, so that the client
8137/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8138impl std::ops::Drop for SysconfigFlushResponder {
8139    fn drop(&mut self) {
8140        self.control_handle.shutdown();
8141        // Safety: drops once, never accessed again
8142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8143    }
8144}
8145
8146impl fidl::endpoints::Responder for SysconfigFlushResponder {
8147    type ControlHandle = SysconfigControlHandle;
8148
8149    fn control_handle(&self) -> &SysconfigControlHandle {
8150        &self.control_handle
8151    }
8152
8153    fn drop_without_shutdown(mut self) {
8154        // Safety: drops once, never accessed again due to mem::forget
8155        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8156        // Prevent Drop from running (which would shut down the channel)
8157        std::mem::forget(self);
8158    }
8159}
8160
8161impl SysconfigFlushResponder {
8162    /// Sends a response to the FIDL transaction.
8163    ///
8164    /// Sets the channel to shutdown if an error occurs.
8165    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
8166        let _result = self.send_raw(status);
8167        if _result.is_err() {
8168            self.control_handle.shutdown();
8169        }
8170        self.drop_without_shutdown();
8171        _result
8172    }
8173
8174    /// Similar to "send" but does not shutdown the channel if an error occurs.
8175    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
8176        let _result = self.send_raw(status);
8177        self.drop_without_shutdown();
8178        _result
8179    }
8180
8181    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
8182        self.control_handle.inner.send::<SysconfigFlushResponse>(
8183            (status,),
8184            self.tx_id,
8185            0xc6c1bb233d003c6,
8186            fidl::encoding::DynamicFlags::empty(),
8187        )
8188    }
8189}
8190
8191#[must_use = "FIDL methods require a response to be sent"]
8192#[derive(Debug)]
8193pub struct SysconfigWipeResponder {
8194    control_handle: std::mem::ManuallyDrop<SysconfigControlHandle>,
8195    tx_id: u32,
8196}
8197
8198/// Set the the channel to be shutdown (see [`SysconfigControlHandle::shutdown`])
8199/// if the responder is dropped without sending a response, so that the client
8200/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8201impl std::ops::Drop for SysconfigWipeResponder {
8202    fn drop(&mut self) {
8203        self.control_handle.shutdown();
8204        // Safety: drops once, never accessed again
8205        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8206    }
8207}
8208
8209impl fidl::endpoints::Responder for SysconfigWipeResponder {
8210    type ControlHandle = SysconfigControlHandle;
8211
8212    fn control_handle(&self) -> &SysconfigControlHandle {
8213        &self.control_handle
8214    }
8215
8216    fn drop_without_shutdown(mut self) {
8217        // Safety: drops once, never accessed again due to mem::forget
8218        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8219        // Prevent Drop from running (which would shut down the channel)
8220        std::mem::forget(self);
8221    }
8222}
8223
8224impl SysconfigWipeResponder {
8225    /// Sends a response to the FIDL transaction.
8226    ///
8227    /// Sets the channel to shutdown if an error occurs.
8228    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
8229        let _result = self.send_raw(status);
8230        if _result.is_err() {
8231            self.control_handle.shutdown();
8232        }
8233        self.drop_without_shutdown();
8234        _result
8235    }
8236
8237    /// Similar to "send" but does not shutdown the channel if an error occurs.
8238    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
8239        let _result = self.send_raw(status);
8240        self.drop_without_shutdown();
8241        _result
8242    }
8243
8244    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
8245        self.control_handle.inner.send::<SysconfigWipeResponse>(
8246            (status,),
8247            self.tx_id,
8248            0x34a634965ebfb702,
8249            fidl::encoding::DynamicFlags::empty(),
8250        )
8251    }
8252}
8253
8254mod internal {
8255    use super::*;
8256
8257    impl fidl::encoding::ResourceTypeMarker for DataSinkReadFirmwareRequest {
8258        type Borrowed<'a> = &'a mut Self;
8259        fn take_or_borrow<'a>(
8260            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8261        ) -> Self::Borrowed<'a> {
8262            value
8263        }
8264    }
8265
8266    unsafe impl fidl::encoding::TypeMarker for DataSinkReadFirmwareRequest {
8267        type Owned = Self;
8268
8269        #[inline(always)]
8270        fn inline_align(_context: fidl::encoding::Context) -> usize {
8271            8
8272        }
8273
8274        #[inline(always)]
8275        fn inline_size(_context: fidl::encoding::Context) -> usize {
8276            24
8277        }
8278    }
8279
8280    unsafe impl
8281        fidl::encoding::Encode<
8282            DataSinkReadFirmwareRequest,
8283            fidl::encoding::DefaultFuchsiaResourceDialect,
8284        > for &mut DataSinkReadFirmwareRequest
8285    {
8286        #[inline]
8287        unsafe fn encode(
8288            self,
8289            encoder: &mut fidl::encoding::Encoder<
8290                '_,
8291                fidl::encoding::DefaultFuchsiaResourceDialect,
8292            >,
8293            offset: usize,
8294            _depth: fidl::encoding::Depth,
8295        ) -> fidl::Result<()> {
8296            encoder.debug_check_bounds::<DataSinkReadFirmwareRequest>(offset);
8297            // Delegate to tuple encoding.
8298            fidl::encoding::Encode::<
8299                DataSinkReadFirmwareRequest,
8300                fidl::encoding::DefaultFuchsiaResourceDialect,
8301            >::encode(
8302                (
8303                    <Configuration as fidl::encoding::ValueTypeMarker>::borrow(&self.configuration),
8304                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
8305                        &self.type_,
8306                    ),
8307                ),
8308                encoder,
8309                offset,
8310                _depth,
8311            )
8312        }
8313    }
8314    unsafe impl<
8315        T0: fidl::encoding::Encode<Configuration, fidl::encoding::DefaultFuchsiaResourceDialect>,
8316        T1: fidl::encoding::Encode<
8317                fidl::encoding::BoundedString<256>,
8318                fidl::encoding::DefaultFuchsiaResourceDialect,
8319            >,
8320    >
8321        fidl::encoding::Encode<
8322            DataSinkReadFirmwareRequest,
8323            fidl::encoding::DefaultFuchsiaResourceDialect,
8324        > for (T0, T1)
8325    {
8326        #[inline]
8327        unsafe fn encode(
8328            self,
8329            encoder: &mut fidl::encoding::Encoder<
8330                '_,
8331                fidl::encoding::DefaultFuchsiaResourceDialect,
8332            >,
8333            offset: usize,
8334            depth: fidl::encoding::Depth,
8335        ) -> fidl::Result<()> {
8336            encoder.debug_check_bounds::<DataSinkReadFirmwareRequest>(offset);
8337            // Zero out padding regions. There's no need to apply masks
8338            // because the unmasked parts will be overwritten by fields.
8339            unsafe {
8340                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8341                (ptr as *mut u64).write_unaligned(0);
8342            }
8343            // Write the fields.
8344            self.0.encode(encoder, offset + 0, depth)?;
8345            self.1.encode(encoder, offset + 8, depth)?;
8346            Ok(())
8347        }
8348    }
8349
8350    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8351        for DataSinkReadFirmwareRequest
8352    {
8353        #[inline(always)]
8354        fn new_empty() -> Self {
8355            Self {
8356                configuration: fidl::new_empty!(
8357                    Configuration,
8358                    fidl::encoding::DefaultFuchsiaResourceDialect
8359                ),
8360                type_: fidl::new_empty!(
8361                    fidl::encoding::BoundedString<256>,
8362                    fidl::encoding::DefaultFuchsiaResourceDialect
8363                ),
8364            }
8365        }
8366
8367        #[inline]
8368        unsafe fn decode(
8369            &mut self,
8370            decoder: &mut fidl::encoding::Decoder<
8371                '_,
8372                fidl::encoding::DefaultFuchsiaResourceDialect,
8373            >,
8374            offset: usize,
8375            _depth: fidl::encoding::Depth,
8376        ) -> fidl::Result<()> {
8377            decoder.debug_check_bounds::<Self>(offset);
8378            // Verify that padding bytes are zero.
8379            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
8380            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8381            let mask = 0xffffffff00000000u64;
8382            let maskedval = padval & mask;
8383            if maskedval != 0 {
8384                return Err(fidl::Error::NonZeroPadding {
8385                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8386                });
8387            }
8388            fidl::decode!(
8389                Configuration,
8390                fidl::encoding::DefaultFuchsiaResourceDialect,
8391                &mut self.configuration,
8392                decoder,
8393                offset + 0,
8394                _depth
8395            )?;
8396            fidl::decode!(
8397                fidl::encoding::BoundedString<256>,
8398                fidl::encoding::DefaultFuchsiaResourceDialect,
8399                &mut self.type_,
8400                decoder,
8401                offset + 8,
8402                _depth
8403            )?;
8404            Ok(())
8405        }
8406    }
8407
8408    impl fidl::encoding::ResourceTypeMarker for DataSinkWriteAssetRequest {
8409        type Borrowed<'a> = &'a mut Self;
8410        fn take_or_borrow<'a>(
8411            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8412        ) -> Self::Borrowed<'a> {
8413            value
8414        }
8415    }
8416
8417    unsafe impl fidl::encoding::TypeMarker for DataSinkWriteAssetRequest {
8418        type Owned = Self;
8419
8420        #[inline(always)]
8421        fn inline_align(_context: fidl::encoding::Context) -> usize {
8422            8
8423        }
8424
8425        #[inline(always)]
8426        fn inline_size(_context: fidl::encoding::Context) -> usize {
8427            24
8428        }
8429    }
8430
8431    unsafe impl
8432        fidl::encoding::Encode<
8433            DataSinkWriteAssetRequest,
8434            fidl::encoding::DefaultFuchsiaResourceDialect,
8435        > for &mut DataSinkWriteAssetRequest
8436    {
8437        #[inline]
8438        unsafe fn encode(
8439            self,
8440            encoder: &mut fidl::encoding::Encoder<
8441                '_,
8442                fidl::encoding::DefaultFuchsiaResourceDialect,
8443            >,
8444            offset: usize,
8445            _depth: fidl::encoding::Depth,
8446        ) -> fidl::Result<()> {
8447            encoder.debug_check_bounds::<DataSinkWriteAssetRequest>(offset);
8448            // Delegate to tuple encoding.
8449            fidl::encoding::Encode::<DataSinkWriteAssetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8450                (
8451                    <Configuration as fidl::encoding::ValueTypeMarker>::borrow(&self.configuration),
8452                    <Asset as fidl::encoding::ValueTypeMarker>::borrow(&self.asset),
8453                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
8454                ),
8455                encoder, offset, _depth
8456            )
8457        }
8458    }
8459    unsafe impl<
8460        T0: fidl::encoding::Encode<Configuration, fidl::encoding::DefaultFuchsiaResourceDialect>,
8461        T1: fidl::encoding::Encode<Asset, fidl::encoding::DefaultFuchsiaResourceDialect>,
8462        T2: fidl::encoding::Encode<
8463                fidl_fuchsia_mem::Buffer,
8464                fidl::encoding::DefaultFuchsiaResourceDialect,
8465            >,
8466    >
8467        fidl::encoding::Encode<
8468            DataSinkWriteAssetRequest,
8469            fidl::encoding::DefaultFuchsiaResourceDialect,
8470        > for (T0, T1, T2)
8471    {
8472        #[inline]
8473        unsafe fn encode(
8474            self,
8475            encoder: &mut fidl::encoding::Encoder<
8476                '_,
8477                fidl::encoding::DefaultFuchsiaResourceDialect,
8478            >,
8479            offset: usize,
8480            depth: fidl::encoding::Depth,
8481        ) -> fidl::Result<()> {
8482            encoder.debug_check_bounds::<DataSinkWriteAssetRequest>(offset);
8483            // Zero out padding regions. There's no need to apply masks
8484            // because the unmasked parts will be overwritten by fields.
8485            // Write the fields.
8486            self.0.encode(encoder, offset + 0, depth)?;
8487            self.1.encode(encoder, offset + 4, depth)?;
8488            self.2.encode(encoder, offset + 8, depth)?;
8489            Ok(())
8490        }
8491    }
8492
8493    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8494        for DataSinkWriteAssetRequest
8495    {
8496        #[inline(always)]
8497        fn new_empty() -> Self {
8498            Self {
8499                configuration: fidl::new_empty!(
8500                    Configuration,
8501                    fidl::encoding::DefaultFuchsiaResourceDialect
8502                ),
8503                asset: fidl::new_empty!(Asset, fidl::encoding::DefaultFuchsiaResourceDialect),
8504                payload: fidl::new_empty!(
8505                    fidl_fuchsia_mem::Buffer,
8506                    fidl::encoding::DefaultFuchsiaResourceDialect
8507                ),
8508            }
8509        }
8510
8511        #[inline]
8512        unsafe fn decode(
8513            &mut self,
8514            decoder: &mut fidl::encoding::Decoder<
8515                '_,
8516                fidl::encoding::DefaultFuchsiaResourceDialect,
8517            >,
8518            offset: usize,
8519            _depth: fidl::encoding::Depth,
8520        ) -> fidl::Result<()> {
8521            decoder.debug_check_bounds::<Self>(offset);
8522            // Verify that padding bytes are zero.
8523            fidl::decode!(
8524                Configuration,
8525                fidl::encoding::DefaultFuchsiaResourceDialect,
8526                &mut self.configuration,
8527                decoder,
8528                offset + 0,
8529                _depth
8530            )?;
8531            fidl::decode!(
8532                Asset,
8533                fidl::encoding::DefaultFuchsiaResourceDialect,
8534                &mut self.asset,
8535                decoder,
8536                offset + 4,
8537                _depth
8538            )?;
8539            fidl::decode!(
8540                fidl_fuchsia_mem::Buffer,
8541                fidl::encoding::DefaultFuchsiaResourceDialect,
8542                &mut self.payload,
8543                decoder,
8544                offset + 8,
8545                _depth
8546            )?;
8547            Ok(())
8548        }
8549    }
8550
8551    impl fidl::encoding::ResourceTypeMarker for DataSinkWriteFirmwareRequest {
8552        type Borrowed<'a> = &'a mut Self;
8553        fn take_or_borrow<'a>(
8554            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8555        ) -> Self::Borrowed<'a> {
8556            value
8557        }
8558    }
8559
8560    unsafe impl fidl::encoding::TypeMarker for DataSinkWriteFirmwareRequest {
8561        type Owned = Self;
8562
8563        #[inline(always)]
8564        fn inline_align(_context: fidl::encoding::Context) -> usize {
8565            8
8566        }
8567
8568        #[inline(always)]
8569        fn inline_size(_context: fidl::encoding::Context) -> usize {
8570            40
8571        }
8572    }
8573
8574    unsafe impl
8575        fidl::encoding::Encode<
8576            DataSinkWriteFirmwareRequest,
8577            fidl::encoding::DefaultFuchsiaResourceDialect,
8578        > for &mut DataSinkWriteFirmwareRequest
8579    {
8580        #[inline]
8581        unsafe fn encode(
8582            self,
8583            encoder: &mut fidl::encoding::Encoder<
8584                '_,
8585                fidl::encoding::DefaultFuchsiaResourceDialect,
8586            >,
8587            offset: usize,
8588            _depth: fidl::encoding::Depth,
8589        ) -> fidl::Result<()> {
8590            encoder.debug_check_bounds::<DataSinkWriteFirmwareRequest>(offset);
8591            // Delegate to tuple encoding.
8592            fidl::encoding::Encode::<DataSinkWriteFirmwareRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8593                (
8594                    <Configuration as fidl::encoding::ValueTypeMarker>::borrow(&self.configuration),
8595                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
8596                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
8597                ),
8598                encoder, offset, _depth
8599            )
8600        }
8601    }
8602    unsafe impl<
8603        T0: fidl::encoding::Encode<Configuration, fidl::encoding::DefaultFuchsiaResourceDialect>,
8604        T1: fidl::encoding::Encode<
8605                fidl::encoding::BoundedString<256>,
8606                fidl::encoding::DefaultFuchsiaResourceDialect,
8607            >,
8608        T2: fidl::encoding::Encode<
8609                fidl_fuchsia_mem::Buffer,
8610                fidl::encoding::DefaultFuchsiaResourceDialect,
8611            >,
8612    >
8613        fidl::encoding::Encode<
8614            DataSinkWriteFirmwareRequest,
8615            fidl::encoding::DefaultFuchsiaResourceDialect,
8616        > for (T0, T1, T2)
8617    {
8618        #[inline]
8619        unsafe fn encode(
8620            self,
8621            encoder: &mut fidl::encoding::Encoder<
8622                '_,
8623                fidl::encoding::DefaultFuchsiaResourceDialect,
8624            >,
8625            offset: usize,
8626            depth: fidl::encoding::Depth,
8627        ) -> fidl::Result<()> {
8628            encoder.debug_check_bounds::<DataSinkWriteFirmwareRequest>(offset);
8629            // Zero out padding regions. There's no need to apply masks
8630            // because the unmasked parts will be overwritten by fields.
8631            unsafe {
8632                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8633                (ptr as *mut u64).write_unaligned(0);
8634            }
8635            // Write the fields.
8636            self.0.encode(encoder, offset + 0, depth)?;
8637            self.1.encode(encoder, offset + 8, depth)?;
8638            self.2.encode(encoder, offset + 24, depth)?;
8639            Ok(())
8640        }
8641    }
8642
8643    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8644        for DataSinkWriteFirmwareRequest
8645    {
8646        #[inline(always)]
8647        fn new_empty() -> Self {
8648            Self {
8649                configuration: fidl::new_empty!(
8650                    Configuration,
8651                    fidl::encoding::DefaultFuchsiaResourceDialect
8652                ),
8653                type_: fidl::new_empty!(
8654                    fidl::encoding::BoundedString<256>,
8655                    fidl::encoding::DefaultFuchsiaResourceDialect
8656                ),
8657                payload: fidl::new_empty!(
8658                    fidl_fuchsia_mem::Buffer,
8659                    fidl::encoding::DefaultFuchsiaResourceDialect
8660                ),
8661            }
8662        }
8663
8664        #[inline]
8665        unsafe fn decode(
8666            &mut self,
8667            decoder: &mut fidl::encoding::Decoder<
8668                '_,
8669                fidl::encoding::DefaultFuchsiaResourceDialect,
8670            >,
8671            offset: usize,
8672            _depth: fidl::encoding::Depth,
8673        ) -> fidl::Result<()> {
8674            decoder.debug_check_bounds::<Self>(offset);
8675            // Verify that padding bytes are zero.
8676            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
8677            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8678            let mask = 0xffffffff00000000u64;
8679            let maskedval = padval & mask;
8680            if maskedval != 0 {
8681                return Err(fidl::Error::NonZeroPadding {
8682                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8683                });
8684            }
8685            fidl::decode!(
8686                Configuration,
8687                fidl::encoding::DefaultFuchsiaResourceDialect,
8688                &mut self.configuration,
8689                decoder,
8690                offset + 0,
8691                _depth
8692            )?;
8693            fidl::decode!(
8694                fidl::encoding::BoundedString<256>,
8695                fidl::encoding::DefaultFuchsiaResourceDialect,
8696                &mut self.type_,
8697                decoder,
8698                offset + 8,
8699                _depth
8700            )?;
8701            fidl::decode!(
8702                fidl_fuchsia_mem::Buffer,
8703                fidl::encoding::DefaultFuchsiaResourceDialect,
8704                &mut self.payload,
8705                decoder,
8706                offset + 24,
8707                _depth
8708            )?;
8709            Ok(())
8710        }
8711    }
8712
8713    impl fidl::encoding::ResourceTypeMarker for DataSinkWriteOpaqueVolumeRequest {
8714        type Borrowed<'a> = &'a mut Self;
8715        fn take_or_borrow<'a>(
8716            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8717        ) -> Self::Borrowed<'a> {
8718            value
8719        }
8720    }
8721
8722    unsafe impl fidl::encoding::TypeMarker for DataSinkWriteOpaqueVolumeRequest {
8723        type Owned = Self;
8724
8725        #[inline(always)]
8726        fn inline_align(_context: fidl::encoding::Context) -> usize {
8727            8
8728        }
8729
8730        #[inline(always)]
8731        fn inline_size(_context: fidl::encoding::Context) -> usize {
8732            16
8733        }
8734    }
8735
8736    unsafe impl
8737        fidl::encoding::Encode<
8738            DataSinkWriteOpaqueVolumeRequest,
8739            fidl::encoding::DefaultFuchsiaResourceDialect,
8740        > for &mut DataSinkWriteOpaqueVolumeRequest
8741    {
8742        #[inline]
8743        unsafe fn encode(
8744            self,
8745            encoder: &mut fidl::encoding::Encoder<
8746                '_,
8747                fidl::encoding::DefaultFuchsiaResourceDialect,
8748            >,
8749            offset: usize,
8750            _depth: fidl::encoding::Depth,
8751        ) -> fidl::Result<()> {
8752            encoder.debug_check_bounds::<DataSinkWriteOpaqueVolumeRequest>(offset);
8753            // Delegate to tuple encoding.
8754            fidl::encoding::Encode::<
8755                DataSinkWriteOpaqueVolumeRequest,
8756                fidl::encoding::DefaultFuchsiaResourceDialect,
8757            >::encode(
8758                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8759                    &mut self.payload,
8760                ),),
8761                encoder,
8762                offset,
8763                _depth,
8764            )
8765        }
8766    }
8767    unsafe impl<
8768        T0: fidl::encoding::Encode<
8769                fidl_fuchsia_mem::Buffer,
8770                fidl::encoding::DefaultFuchsiaResourceDialect,
8771            >,
8772    >
8773        fidl::encoding::Encode<
8774            DataSinkWriteOpaqueVolumeRequest,
8775            fidl::encoding::DefaultFuchsiaResourceDialect,
8776        > for (T0,)
8777    {
8778        #[inline]
8779        unsafe fn encode(
8780            self,
8781            encoder: &mut fidl::encoding::Encoder<
8782                '_,
8783                fidl::encoding::DefaultFuchsiaResourceDialect,
8784            >,
8785            offset: usize,
8786            depth: fidl::encoding::Depth,
8787        ) -> fidl::Result<()> {
8788            encoder.debug_check_bounds::<DataSinkWriteOpaqueVolumeRequest>(offset);
8789            // Zero out padding regions. There's no need to apply masks
8790            // because the unmasked parts will be overwritten by fields.
8791            // Write the fields.
8792            self.0.encode(encoder, offset + 0, depth)?;
8793            Ok(())
8794        }
8795    }
8796
8797    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8798        for DataSinkWriteOpaqueVolumeRequest
8799    {
8800        #[inline(always)]
8801        fn new_empty() -> Self {
8802            Self {
8803                payload: fidl::new_empty!(
8804                    fidl_fuchsia_mem::Buffer,
8805                    fidl::encoding::DefaultFuchsiaResourceDialect
8806                ),
8807            }
8808        }
8809
8810        #[inline]
8811        unsafe fn decode(
8812            &mut self,
8813            decoder: &mut fidl::encoding::Decoder<
8814                '_,
8815                fidl::encoding::DefaultFuchsiaResourceDialect,
8816            >,
8817            offset: usize,
8818            _depth: fidl::encoding::Depth,
8819        ) -> fidl::Result<()> {
8820            decoder.debug_check_bounds::<Self>(offset);
8821            // Verify that padding bytes are zero.
8822            fidl::decode!(
8823                fidl_fuchsia_mem::Buffer,
8824                fidl::encoding::DefaultFuchsiaResourceDialect,
8825                &mut self.payload,
8826                decoder,
8827                offset + 0,
8828                _depth
8829            )?;
8830            Ok(())
8831        }
8832    }
8833
8834    impl fidl::encoding::ResourceTypeMarker for DataSinkWriteSparseVolumeRequest {
8835        type Borrowed<'a> = &'a mut Self;
8836        fn take_or_borrow<'a>(
8837            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8838        ) -> Self::Borrowed<'a> {
8839            value
8840        }
8841    }
8842
8843    unsafe impl fidl::encoding::TypeMarker for DataSinkWriteSparseVolumeRequest {
8844        type Owned = Self;
8845
8846        #[inline(always)]
8847        fn inline_align(_context: fidl::encoding::Context) -> usize {
8848            8
8849        }
8850
8851        #[inline(always)]
8852        fn inline_size(_context: fidl::encoding::Context) -> usize {
8853            16
8854        }
8855    }
8856
8857    unsafe impl
8858        fidl::encoding::Encode<
8859            DataSinkWriteSparseVolumeRequest,
8860            fidl::encoding::DefaultFuchsiaResourceDialect,
8861        > for &mut DataSinkWriteSparseVolumeRequest
8862    {
8863        #[inline]
8864        unsafe fn encode(
8865            self,
8866            encoder: &mut fidl::encoding::Encoder<
8867                '_,
8868                fidl::encoding::DefaultFuchsiaResourceDialect,
8869            >,
8870            offset: usize,
8871            _depth: fidl::encoding::Depth,
8872        ) -> fidl::Result<()> {
8873            encoder.debug_check_bounds::<DataSinkWriteSparseVolumeRequest>(offset);
8874            // Delegate to tuple encoding.
8875            fidl::encoding::Encode::<
8876                DataSinkWriteSparseVolumeRequest,
8877                fidl::encoding::DefaultFuchsiaResourceDialect,
8878            >::encode(
8879                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8880                    &mut self.payload,
8881                ),),
8882                encoder,
8883                offset,
8884                _depth,
8885            )
8886        }
8887    }
8888    unsafe impl<
8889        T0: fidl::encoding::Encode<
8890                fidl_fuchsia_mem::Buffer,
8891                fidl::encoding::DefaultFuchsiaResourceDialect,
8892            >,
8893    >
8894        fidl::encoding::Encode<
8895            DataSinkWriteSparseVolumeRequest,
8896            fidl::encoding::DefaultFuchsiaResourceDialect,
8897        > for (T0,)
8898    {
8899        #[inline]
8900        unsafe fn encode(
8901            self,
8902            encoder: &mut fidl::encoding::Encoder<
8903                '_,
8904                fidl::encoding::DefaultFuchsiaResourceDialect,
8905            >,
8906            offset: usize,
8907            depth: fidl::encoding::Depth,
8908        ) -> fidl::Result<()> {
8909            encoder.debug_check_bounds::<DataSinkWriteSparseVolumeRequest>(offset);
8910            // Zero out padding regions. There's no need to apply masks
8911            // because the unmasked parts will be overwritten by fields.
8912            // Write the fields.
8913            self.0.encode(encoder, offset + 0, depth)?;
8914            Ok(())
8915        }
8916    }
8917
8918    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8919        for DataSinkWriteSparseVolumeRequest
8920    {
8921        #[inline(always)]
8922        fn new_empty() -> Self {
8923            Self {
8924                payload: fidl::new_empty!(
8925                    fidl_fuchsia_mem::Buffer,
8926                    fidl::encoding::DefaultFuchsiaResourceDialect
8927                ),
8928            }
8929        }
8930
8931        #[inline]
8932        unsafe fn decode(
8933            &mut self,
8934            decoder: &mut fidl::encoding::Decoder<
8935                '_,
8936                fidl::encoding::DefaultFuchsiaResourceDialect,
8937            >,
8938            offset: usize,
8939            _depth: fidl::encoding::Depth,
8940        ) -> fidl::Result<()> {
8941            decoder.debug_check_bounds::<Self>(offset);
8942            // Verify that padding bytes are zero.
8943            fidl::decode!(
8944                fidl_fuchsia_mem::Buffer,
8945                fidl::encoding::DefaultFuchsiaResourceDialect,
8946                &mut self.payload,
8947                decoder,
8948                offset + 0,
8949                _depth
8950            )?;
8951            Ok(())
8952        }
8953    }
8954
8955    impl fidl::encoding::ResourceTypeMarker for DataSinkWriteVolumesRequest {
8956        type Borrowed<'a> = &'a mut Self;
8957        fn take_or_borrow<'a>(
8958            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8959        ) -> Self::Borrowed<'a> {
8960            value
8961        }
8962    }
8963
8964    unsafe impl fidl::encoding::TypeMarker for DataSinkWriteVolumesRequest {
8965        type Owned = Self;
8966
8967        #[inline(always)]
8968        fn inline_align(_context: fidl::encoding::Context) -> usize {
8969            4
8970        }
8971
8972        #[inline(always)]
8973        fn inline_size(_context: fidl::encoding::Context) -> usize {
8974            4
8975        }
8976    }
8977
8978    unsafe impl
8979        fidl::encoding::Encode<
8980            DataSinkWriteVolumesRequest,
8981            fidl::encoding::DefaultFuchsiaResourceDialect,
8982        > for &mut DataSinkWriteVolumesRequest
8983    {
8984        #[inline]
8985        unsafe fn encode(
8986            self,
8987            encoder: &mut fidl::encoding::Encoder<
8988                '_,
8989                fidl::encoding::DefaultFuchsiaResourceDialect,
8990            >,
8991            offset: usize,
8992            _depth: fidl::encoding::Depth,
8993        ) -> fidl::Result<()> {
8994            encoder.debug_check_bounds::<DataSinkWriteVolumesRequest>(offset);
8995            // Delegate to tuple encoding.
8996            fidl::encoding::Encode::<DataSinkWriteVolumesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8997                (
8998                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PayloadStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
8999                ),
9000                encoder, offset, _depth
9001            )
9002        }
9003    }
9004    unsafe impl<
9005        T0: fidl::encoding::Encode<
9006                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PayloadStreamMarker>>,
9007                fidl::encoding::DefaultFuchsiaResourceDialect,
9008            >,
9009    >
9010        fidl::encoding::Encode<
9011            DataSinkWriteVolumesRequest,
9012            fidl::encoding::DefaultFuchsiaResourceDialect,
9013        > for (T0,)
9014    {
9015        #[inline]
9016        unsafe fn encode(
9017            self,
9018            encoder: &mut fidl::encoding::Encoder<
9019                '_,
9020                fidl::encoding::DefaultFuchsiaResourceDialect,
9021            >,
9022            offset: usize,
9023            depth: fidl::encoding::Depth,
9024        ) -> fidl::Result<()> {
9025            encoder.debug_check_bounds::<DataSinkWriteVolumesRequest>(offset);
9026            // Zero out padding regions. There's no need to apply masks
9027            // because the unmasked parts will be overwritten by fields.
9028            // Write the fields.
9029            self.0.encode(encoder, offset + 0, depth)?;
9030            Ok(())
9031        }
9032    }
9033
9034    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9035        for DataSinkWriteVolumesRequest
9036    {
9037        #[inline(always)]
9038        fn new_empty() -> Self {
9039            Self {
9040                payload: fidl::new_empty!(
9041                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PayloadStreamMarker>>,
9042                    fidl::encoding::DefaultFuchsiaResourceDialect
9043                ),
9044            }
9045        }
9046
9047        #[inline]
9048        unsafe fn decode(
9049            &mut self,
9050            decoder: &mut fidl::encoding::Decoder<
9051                '_,
9052                fidl::encoding::DefaultFuchsiaResourceDialect,
9053            >,
9054            offset: usize,
9055            _depth: fidl::encoding::Depth,
9056        ) -> fidl::Result<()> {
9057            decoder.debug_check_bounds::<Self>(offset);
9058            // Verify that padding bytes are zero.
9059            fidl::decode!(
9060                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PayloadStreamMarker>>,
9061                fidl::encoding::DefaultFuchsiaResourceDialect,
9062                &mut self.payload,
9063                decoder,
9064                offset + 0,
9065                _depth
9066            )?;
9067            Ok(())
9068        }
9069    }
9070
9071    impl fidl::encoding::ResourceTypeMarker for DataSinkReadAssetResponse {
9072        type Borrowed<'a> = &'a mut Self;
9073        fn take_or_borrow<'a>(
9074            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9075        ) -> Self::Borrowed<'a> {
9076            value
9077        }
9078    }
9079
9080    unsafe impl fidl::encoding::TypeMarker for DataSinkReadAssetResponse {
9081        type Owned = Self;
9082
9083        #[inline(always)]
9084        fn inline_align(_context: fidl::encoding::Context) -> usize {
9085            8
9086        }
9087
9088        #[inline(always)]
9089        fn inline_size(_context: fidl::encoding::Context) -> usize {
9090            16
9091        }
9092    }
9093
9094    unsafe impl
9095        fidl::encoding::Encode<
9096            DataSinkReadAssetResponse,
9097            fidl::encoding::DefaultFuchsiaResourceDialect,
9098        > for &mut DataSinkReadAssetResponse
9099    {
9100        #[inline]
9101        unsafe fn encode(
9102            self,
9103            encoder: &mut fidl::encoding::Encoder<
9104                '_,
9105                fidl::encoding::DefaultFuchsiaResourceDialect,
9106            >,
9107            offset: usize,
9108            _depth: fidl::encoding::Depth,
9109        ) -> fidl::Result<()> {
9110            encoder.debug_check_bounds::<DataSinkReadAssetResponse>(offset);
9111            // Delegate to tuple encoding.
9112            fidl::encoding::Encode::<
9113                DataSinkReadAssetResponse,
9114                fidl::encoding::DefaultFuchsiaResourceDialect,
9115            >::encode(
9116                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9117                    &mut self.asset,
9118                ),),
9119                encoder,
9120                offset,
9121                _depth,
9122            )
9123        }
9124    }
9125    unsafe impl<
9126        T0: fidl::encoding::Encode<
9127                fidl_fuchsia_mem::Buffer,
9128                fidl::encoding::DefaultFuchsiaResourceDialect,
9129            >,
9130    >
9131        fidl::encoding::Encode<
9132            DataSinkReadAssetResponse,
9133            fidl::encoding::DefaultFuchsiaResourceDialect,
9134        > for (T0,)
9135    {
9136        #[inline]
9137        unsafe fn encode(
9138            self,
9139            encoder: &mut fidl::encoding::Encoder<
9140                '_,
9141                fidl::encoding::DefaultFuchsiaResourceDialect,
9142            >,
9143            offset: usize,
9144            depth: fidl::encoding::Depth,
9145        ) -> fidl::Result<()> {
9146            encoder.debug_check_bounds::<DataSinkReadAssetResponse>(offset);
9147            // Zero out padding regions. There's no need to apply masks
9148            // because the unmasked parts will be overwritten by fields.
9149            // Write the fields.
9150            self.0.encode(encoder, offset + 0, depth)?;
9151            Ok(())
9152        }
9153    }
9154
9155    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9156        for DataSinkReadAssetResponse
9157    {
9158        #[inline(always)]
9159        fn new_empty() -> Self {
9160            Self {
9161                asset: fidl::new_empty!(
9162                    fidl_fuchsia_mem::Buffer,
9163                    fidl::encoding::DefaultFuchsiaResourceDialect
9164                ),
9165            }
9166        }
9167
9168        #[inline]
9169        unsafe fn decode(
9170            &mut self,
9171            decoder: &mut fidl::encoding::Decoder<
9172                '_,
9173                fidl::encoding::DefaultFuchsiaResourceDialect,
9174            >,
9175            offset: usize,
9176            _depth: fidl::encoding::Depth,
9177        ) -> fidl::Result<()> {
9178            decoder.debug_check_bounds::<Self>(offset);
9179            // Verify that padding bytes are zero.
9180            fidl::decode!(
9181                fidl_fuchsia_mem::Buffer,
9182                fidl::encoding::DefaultFuchsiaResourceDialect,
9183                &mut self.asset,
9184                decoder,
9185                offset + 0,
9186                _depth
9187            )?;
9188            Ok(())
9189        }
9190    }
9191
9192    impl fidl::encoding::ResourceTypeMarker for DataSinkReadFirmwareResponse {
9193        type Borrowed<'a> = &'a mut Self;
9194        fn take_or_borrow<'a>(
9195            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9196        ) -> Self::Borrowed<'a> {
9197            value
9198        }
9199    }
9200
9201    unsafe impl fidl::encoding::TypeMarker for DataSinkReadFirmwareResponse {
9202        type Owned = Self;
9203
9204        #[inline(always)]
9205        fn inline_align(_context: fidl::encoding::Context) -> usize {
9206            8
9207        }
9208
9209        #[inline(always)]
9210        fn inline_size(_context: fidl::encoding::Context) -> usize {
9211            16
9212        }
9213    }
9214
9215    unsafe impl
9216        fidl::encoding::Encode<
9217            DataSinkReadFirmwareResponse,
9218            fidl::encoding::DefaultFuchsiaResourceDialect,
9219        > for &mut DataSinkReadFirmwareResponse
9220    {
9221        #[inline]
9222        unsafe fn encode(
9223            self,
9224            encoder: &mut fidl::encoding::Encoder<
9225                '_,
9226                fidl::encoding::DefaultFuchsiaResourceDialect,
9227            >,
9228            offset: usize,
9229            _depth: fidl::encoding::Depth,
9230        ) -> fidl::Result<()> {
9231            encoder.debug_check_bounds::<DataSinkReadFirmwareResponse>(offset);
9232            // Delegate to tuple encoding.
9233            fidl::encoding::Encode::<
9234                DataSinkReadFirmwareResponse,
9235                fidl::encoding::DefaultFuchsiaResourceDialect,
9236            >::encode(
9237                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9238                    &mut self.firmware,
9239                ),),
9240                encoder,
9241                offset,
9242                _depth,
9243            )
9244        }
9245    }
9246    unsafe impl<
9247        T0: fidl::encoding::Encode<
9248                fidl_fuchsia_mem::Buffer,
9249                fidl::encoding::DefaultFuchsiaResourceDialect,
9250            >,
9251    >
9252        fidl::encoding::Encode<
9253            DataSinkReadFirmwareResponse,
9254            fidl::encoding::DefaultFuchsiaResourceDialect,
9255        > for (T0,)
9256    {
9257        #[inline]
9258        unsafe fn encode(
9259            self,
9260            encoder: &mut fidl::encoding::Encoder<
9261                '_,
9262                fidl::encoding::DefaultFuchsiaResourceDialect,
9263            >,
9264            offset: usize,
9265            depth: fidl::encoding::Depth,
9266        ) -> fidl::Result<()> {
9267            encoder.debug_check_bounds::<DataSinkReadFirmwareResponse>(offset);
9268            // Zero out padding regions. There's no need to apply masks
9269            // because the unmasked parts will be overwritten by fields.
9270            // Write the fields.
9271            self.0.encode(encoder, offset + 0, depth)?;
9272            Ok(())
9273        }
9274    }
9275
9276    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9277        for DataSinkReadFirmwareResponse
9278    {
9279        #[inline(always)]
9280        fn new_empty() -> Self {
9281            Self {
9282                firmware: fidl::new_empty!(
9283                    fidl_fuchsia_mem::Buffer,
9284                    fidl::encoding::DefaultFuchsiaResourceDialect
9285                ),
9286            }
9287        }
9288
9289        #[inline]
9290        unsafe fn decode(
9291            &mut self,
9292            decoder: &mut fidl::encoding::Decoder<
9293                '_,
9294                fidl::encoding::DefaultFuchsiaResourceDialect,
9295            >,
9296            offset: usize,
9297            _depth: fidl::encoding::Depth,
9298        ) -> fidl::Result<()> {
9299            decoder.debug_check_bounds::<Self>(offset);
9300            // Verify that padding bytes are zero.
9301            fidl::decode!(
9302                fidl_fuchsia_mem::Buffer,
9303                fidl::encoding::DefaultFuchsiaResourceDialect,
9304                &mut self.firmware,
9305                decoder,
9306                offset + 0,
9307                _depth
9308            )?;
9309            Ok(())
9310        }
9311    }
9312
9313    impl fidl::encoding::ResourceTypeMarker for PaverFindBootManagerRequest {
9314        type Borrowed<'a> = &'a mut Self;
9315        fn take_or_borrow<'a>(
9316            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9317        ) -> Self::Borrowed<'a> {
9318            value
9319        }
9320    }
9321
9322    unsafe impl fidl::encoding::TypeMarker for PaverFindBootManagerRequest {
9323        type Owned = Self;
9324
9325        #[inline(always)]
9326        fn inline_align(_context: fidl::encoding::Context) -> usize {
9327            4
9328        }
9329
9330        #[inline(always)]
9331        fn inline_size(_context: fidl::encoding::Context) -> usize {
9332            4
9333        }
9334    }
9335
9336    unsafe impl
9337        fidl::encoding::Encode<
9338            PaverFindBootManagerRequest,
9339            fidl::encoding::DefaultFuchsiaResourceDialect,
9340        > for &mut PaverFindBootManagerRequest
9341    {
9342        #[inline]
9343        unsafe fn encode(
9344            self,
9345            encoder: &mut fidl::encoding::Encoder<
9346                '_,
9347                fidl::encoding::DefaultFuchsiaResourceDialect,
9348            >,
9349            offset: usize,
9350            _depth: fidl::encoding::Depth,
9351        ) -> fidl::Result<()> {
9352            encoder.debug_check_bounds::<PaverFindBootManagerRequest>(offset);
9353            // Delegate to tuple encoding.
9354            fidl::encoding::Encode::<PaverFindBootManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9355                (
9356                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BootManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.boot_manager),
9357                ),
9358                encoder, offset, _depth
9359            )
9360        }
9361    }
9362    unsafe impl<
9363        T0: fidl::encoding::Encode<
9364                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BootManagerMarker>>,
9365                fidl::encoding::DefaultFuchsiaResourceDialect,
9366            >,
9367    >
9368        fidl::encoding::Encode<
9369            PaverFindBootManagerRequest,
9370            fidl::encoding::DefaultFuchsiaResourceDialect,
9371        > for (T0,)
9372    {
9373        #[inline]
9374        unsafe fn encode(
9375            self,
9376            encoder: &mut fidl::encoding::Encoder<
9377                '_,
9378                fidl::encoding::DefaultFuchsiaResourceDialect,
9379            >,
9380            offset: usize,
9381            depth: fidl::encoding::Depth,
9382        ) -> fidl::Result<()> {
9383            encoder.debug_check_bounds::<PaverFindBootManagerRequest>(offset);
9384            // Zero out padding regions. There's no need to apply masks
9385            // because the unmasked parts will be overwritten by fields.
9386            // Write the fields.
9387            self.0.encode(encoder, offset + 0, depth)?;
9388            Ok(())
9389        }
9390    }
9391
9392    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9393        for PaverFindBootManagerRequest
9394    {
9395        #[inline(always)]
9396        fn new_empty() -> Self {
9397            Self {
9398                boot_manager: fidl::new_empty!(
9399                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BootManagerMarker>>,
9400                    fidl::encoding::DefaultFuchsiaResourceDialect
9401                ),
9402            }
9403        }
9404
9405        #[inline]
9406        unsafe fn decode(
9407            &mut self,
9408            decoder: &mut fidl::encoding::Decoder<
9409                '_,
9410                fidl::encoding::DefaultFuchsiaResourceDialect,
9411            >,
9412            offset: usize,
9413            _depth: fidl::encoding::Depth,
9414        ) -> fidl::Result<()> {
9415            decoder.debug_check_bounds::<Self>(offset);
9416            // Verify that padding bytes are zero.
9417            fidl::decode!(
9418                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BootManagerMarker>>,
9419                fidl::encoding::DefaultFuchsiaResourceDialect,
9420                &mut self.boot_manager,
9421                decoder,
9422                offset + 0,
9423                _depth
9424            )?;
9425            Ok(())
9426        }
9427    }
9428
9429    impl fidl::encoding::ResourceTypeMarker for PaverFindDataSinkRequest {
9430        type Borrowed<'a> = &'a mut Self;
9431        fn take_or_borrow<'a>(
9432            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9433        ) -> Self::Borrowed<'a> {
9434            value
9435        }
9436    }
9437
9438    unsafe impl fidl::encoding::TypeMarker for PaverFindDataSinkRequest {
9439        type Owned = Self;
9440
9441        #[inline(always)]
9442        fn inline_align(_context: fidl::encoding::Context) -> usize {
9443            4
9444        }
9445
9446        #[inline(always)]
9447        fn inline_size(_context: fidl::encoding::Context) -> usize {
9448            4
9449        }
9450    }
9451
9452    unsafe impl
9453        fidl::encoding::Encode<
9454            PaverFindDataSinkRequest,
9455            fidl::encoding::DefaultFuchsiaResourceDialect,
9456        > for &mut PaverFindDataSinkRequest
9457    {
9458        #[inline]
9459        unsafe fn encode(
9460            self,
9461            encoder: &mut fidl::encoding::Encoder<
9462                '_,
9463                fidl::encoding::DefaultFuchsiaResourceDialect,
9464            >,
9465            offset: usize,
9466            _depth: fidl::encoding::Depth,
9467        ) -> fidl::Result<()> {
9468            encoder.debug_check_bounds::<PaverFindDataSinkRequest>(offset);
9469            // Delegate to tuple encoding.
9470            fidl::encoding::Encode::<PaverFindDataSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9471                (
9472                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DataSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data_sink),
9473                ),
9474                encoder, offset, _depth
9475            )
9476        }
9477    }
9478    unsafe impl<
9479        T0: fidl::encoding::Encode<
9480                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DataSinkMarker>>,
9481                fidl::encoding::DefaultFuchsiaResourceDialect,
9482            >,
9483    >
9484        fidl::encoding::Encode<
9485            PaverFindDataSinkRequest,
9486            fidl::encoding::DefaultFuchsiaResourceDialect,
9487        > for (T0,)
9488    {
9489        #[inline]
9490        unsafe fn encode(
9491            self,
9492            encoder: &mut fidl::encoding::Encoder<
9493                '_,
9494                fidl::encoding::DefaultFuchsiaResourceDialect,
9495            >,
9496            offset: usize,
9497            depth: fidl::encoding::Depth,
9498        ) -> fidl::Result<()> {
9499            encoder.debug_check_bounds::<PaverFindDataSinkRequest>(offset);
9500            // Zero out padding regions. There's no need to apply masks
9501            // because the unmasked parts will be overwritten by fields.
9502            // Write the fields.
9503            self.0.encode(encoder, offset + 0, depth)?;
9504            Ok(())
9505        }
9506    }
9507
9508    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9509        for PaverFindDataSinkRequest
9510    {
9511        #[inline(always)]
9512        fn new_empty() -> Self {
9513            Self {
9514                data_sink: fidl::new_empty!(
9515                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DataSinkMarker>>,
9516                    fidl::encoding::DefaultFuchsiaResourceDialect
9517                ),
9518            }
9519        }
9520
9521        #[inline]
9522        unsafe fn decode(
9523            &mut self,
9524            decoder: &mut fidl::encoding::Decoder<
9525                '_,
9526                fidl::encoding::DefaultFuchsiaResourceDialect,
9527            >,
9528            offset: usize,
9529            _depth: fidl::encoding::Depth,
9530        ) -> fidl::Result<()> {
9531            decoder.debug_check_bounds::<Self>(offset);
9532            // Verify that padding bytes are zero.
9533            fidl::decode!(
9534                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DataSinkMarker>>,
9535                fidl::encoding::DefaultFuchsiaResourceDialect,
9536                &mut self.data_sink,
9537                decoder,
9538                offset + 0,
9539                _depth
9540            )?;
9541            Ok(())
9542        }
9543    }
9544
9545    impl fidl::encoding::ResourceTypeMarker for PaverFindPartitionTableManagerRequest {
9546        type Borrowed<'a> = &'a mut Self;
9547        fn take_or_borrow<'a>(
9548            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9549        ) -> Self::Borrowed<'a> {
9550            value
9551        }
9552    }
9553
9554    unsafe impl fidl::encoding::TypeMarker for PaverFindPartitionTableManagerRequest {
9555        type Owned = Self;
9556
9557        #[inline(always)]
9558        fn inline_align(_context: fidl::encoding::Context) -> usize {
9559            4
9560        }
9561
9562        #[inline(always)]
9563        fn inline_size(_context: fidl::encoding::Context) -> usize {
9564            4
9565        }
9566    }
9567
9568    unsafe impl
9569        fidl::encoding::Encode<
9570            PaverFindPartitionTableManagerRequest,
9571            fidl::encoding::DefaultFuchsiaResourceDialect,
9572        > for &mut PaverFindPartitionTableManagerRequest
9573    {
9574        #[inline]
9575        unsafe fn encode(
9576            self,
9577            encoder: &mut fidl::encoding::Encoder<
9578                '_,
9579                fidl::encoding::DefaultFuchsiaResourceDialect,
9580            >,
9581            offset: usize,
9582            _depth: fidl::encoding::Depth,
9583        ) -> fidl::Result<()> {
9584            encoder.debug_check_bounds::<PaverFindPartitionTableManagerRequest>(offset);
9585            // Delegate to tuple encoding.
9586            fidl::encoding::Encode::<PaverFindPartitionTableManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9587                (
9588                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DynamicDataSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data_sink),
9589                ),
9590                encoder, offset, _depth
9591            )
9592        }
9593    }
9594    unsafe impl<
9595        T0: fidl::encoding::Encode<
9596                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DynamicDataSinkMarker>>,
9597                fidl::encoding::DefaultFuchsiaResourceDialect,
9598            >,
9599    >
9600        fidl::encoding::Encode<
9601            PaverFindPartitionTableManagerRequest,
9602            fidl::encoding::DefaultFuchsiaResourceDialect,
9603        > for (T0,)
9604    {
9605        #[inline]
9606        unsafe fn encode(
9607            self,
9608            encoder: &mut fidl::encoding::Encoder<
9609                '_,
9610                fidl::encoding::DefaultFuchsiaResourceDialect,
9611            >,
9612            offset: usize,
9613            depth: fidl::encoding::Depth,
9614        ) -> fidl::Result<()> {
9615            encoder.debug_check_bounds::<PaverFindPartitionTableManagerRequest>(offset);
9616            // Zero out padding regions. There's no need to apply masks
9617            // because the unmasked parts will be overwritten by fields.
9618            // Write the fields.
9619            self.0.encode(encoder, offset + 0, depth)?;
9620            Ok(())
9621        }
9622    }
9623
9624    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9625        for PaverFindPartitionTableManagerRequest
9626    {
9627        #[inline(always)]
9628        fn new_empty() -> Self {
9629            Self {
9630                data_sink: fidl::new_empty!(
9631                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DynamicDataSinkMarker>>,
9632                    fidl::encoding::DefaultFuchsiaResourceDialect
9633                ),
9634            }
9635        }
9636
9637        #[inline]
9638        unsafe fn decode(
9639            &mut self,
9640            decoder: &mut fidl::encoding::Decoder<
9641                '_,
9642                fidl::encoding::DefaultFuchsiaResourceDialect,
9643            >,
9644            offset: usize,
9645            _depth: fidl::encoding::Depth,
9646        ) -> fidl::Result<()> {
9647            decoder.debug_check_bounds::<Self>(offset);
9648            // Verify that padding bytes are zero.
9649            fidl::decode!(
9650                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DynamicDataSinkMarker>>,
9651                fidl::encoding::DefaultFuchsiaResourceDialect,
9652                &mut self.data_sink,
9653                decoder,
9654                offset + 0,
9655                _depth
9656            )?;
9657            Ok(())
9658        }
9659    }
9660
9661    impl fidl::encoding::ResourceTypeMarker for PaverFindSysconfigRequest {
9662        type Borrowed<'a> = &'a mut Self;
9663        fn take_or_borrow<'a>(
9664            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9665        ) -> Self::Borrowed<'a> {
9666            value
9667        }
9668    }
9669
9670    unsafe impl fidl::encoding::TypeMarker for PaverFindSysconfigRequest {
9671        type Owned = Self;
9672
9673        #[inline(always)]
9674        fn inline_align(_context: fidl::encoding::Context) -> usize {
9675            4
9676        }
9677
9678        #[inline(always)]
9679        fn inline_size(_context: fidl::encoding::Context) -> usize {
9680            4
9681        }
9682    }
9683
9684    unsafe impl
9685        fidl::encoding::Encode<
9686            PaverFindSysconfigRequest,
9687            fidl::encoding::DefaultFuchsiaResourceDialect,
9688        > for &mut PaverFindSysconfigRequest
9689    {
9690        #[inline]
9691        unsafe fn encode(
9692            self,
9693            encoder: &mut fidl::encoding::Encoder<
9694                '_,
9695                fidl::encoding::DefaultFuchsiaResourceDialect,
9696            >,
9697            offset: usize,
9698            _depth: fidl::encoding::Depth,
9699        ) -> fidl::Result<()> {
9700            encoder.debug_check_bounds::<PaverFindSysconfigRequest>(offset);
9701            // Delegate to tuple encoding.
9702            fidl::encoding::Encode::<PaverFindSysconfigRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9703                (
9704                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SysconfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.sysconfig),
9705                ),
9706                encoder, offset, _depth
9707            )
9708        }
9709    }
9710    unsafe impl<
9711        T0: fidl::encoding::Encode<
9712                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SysconfigMarker>>,
9713                fidl::encoding::DefaultFuchsiaResourceDialect,
9714            >,
9715    >
9716        fidl::encoding::Encode<
9717            PaverFindSysconfigRequest,
9718            fidl::encoding::DefaultFuchsiaResourceDialect,
9719        > for (T0,)
9720    {
9721        #[inline]
9722        unsafe fn encode(
9723            self,
9724            encoder: &mut fidl::encoding::Encoder<
9725                '_,
9726                fidl::encoding::DefaultFuchsiaResourceDialect,
9727            >,
9728            offset: usize,
9729            depth: fidl::encoding::Depth,
9730        ) -> fidl::Result<()> {
9731            encoder.debug_check_bounds::<PaverFindSysconfigRequest>(offset);
9732            // Zero out padding regions. There's no need to apply masks
9733            // because the unmasked parts will be overwritten by fields.
9734            // Write the fields.
9735            self.0.encode(encoder, offset + 0, depth)?;
9736            Ok(())
9737        }
9738    }
9739
9740    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9741        for PaverFindSysconfigRequest
9742    {
9743        #[inline(always)]
9744        fn new_empty() -> Self {
9745            Self {
9746                sysconfig: fidl::new_empty!(
9747                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SysconfigMarker>>,
9748                    fidl::encoding::DefaultFuchsiaResourceDialect
9749                ),
9750            }
9751        }
9752
9753        #[inline]
9754        unsafe fn decode(
9755            &mut self,
9756            decoder: &mut fidl::encoding::Decoder<
9757                '_,
9758                fidl::encoding::DefaultFuchsiaResourceDialect,
9759            >,
9760            offset: usize,
9761            _depth: fidl::encoding::Depth,
9762        ) -> fidl::Result<()> {
9763            decoder.debug_check_bounds::<Self>(offset);
9764            // Verify that padding bytes are zero.
9765            fidl::decode!(
9766                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SysconfigMarker>>,
9767                fidl::encoding::DefaultFuchsiaResourceDialect,
9768                &mut self.sysconfig,
9769                decoder,
9770                offset + 0,
9771                _depth
9772            )?;
9773            Ok(())
9774        }
9775    }
9776
9777    impl fidl::encoding::ResourceTypeMarker for PayloadStreamRegisterVmoRequest {
9778        type Borrowed<'a> = &'a mut Self;
9779        fn take_or_borrow<'a>(
9780            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9781        ) -> Self::Borrowed<'a> {
9782            value
9783        }
9784    }
9785
9786    unsafe impl fidl::encoding::TypeMarker for PayloadStreamRegisterVmoRequest {
9787        type Owned = Self;
9788
9789        #[inline(always)]
9790        fn inline_align(_context: fidl::encoding::Context) -> usize {
9791            4
9792        }
9793
9794        #[inline(always)]
9795        fn inline_size(_context: fidl::encoding::Context) -> usize {
9796            4
9797        }
9798    }
9799
9800    unsafe impl
9801        fidl::encoding::Encode<
9802            PayloadStreamRegisterVmoRequest,
9803            fidl::encoding::DefaultFuchsiaResourceDialect,
9804        > for &mut PayloadStreamRegisterVmoRequest
9805    {
9806        #[inline]
9807        unsafe fn encode(
9808            self,
9809            encoder: &mut fidl::encoding::Encoder<
9810                '_,
9811                fidl::encoding::DefaultFuchsiaResourceDialect,
9812            >,
9813            offset: usize,
9814            _depth: fidl::encoding::Depth,
9815        ) -> fidl::Result<()> {
9816            encoder.debug_check_bounds::<PayloadStreamRegisterVmoRequest>(offset);
9817            // Delegate to tuple encoding.
9818            fidl::encoding::Encode::<
9819                PayloadStreamRegisterVmoRequest,
9820                fidl::encoding::DefaultFuchsiaResourceDialect,
9821            >::encode(
9822                (<fidl::encoding::HandleType<
9823                    fidl::Vmo,
9824                    { fidl::ObjectType::VMO.into_raw() },
9825                    2147483648,
9826                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9827                    &mut self.vmo
9828                ),),
9829                encoder,
9830                offset,
9831                _depth,
9832            )
9833        }
9834    }
9835    unsafe impl<
9836        T0: fidl::encoding::Encode<
9837                fidl::encoding::HandleType<
9838                    fidl::Vmo,
9839                    { fidl::ObjectType::VMO.into_raw() },
9840                    2147483648,
9841                >,
9842                fidl::encoding::DefaultFuchsiaResourceDialect,
9843            >,
9844    >
9845        fidl::encoding::Encode<
9846            PayloadStreamRegisterVmoRequest,
9847            fidl::encoding::DefaultFuchsiaResourceDialect,
9848        > for (T0,)
9849    {
9850        #[inline]
9851        unsafe fn encode(
9852            self,
9853            encoder: &mut fidl::encoding::Encoder<
9854                '_,
9855                fidl::encoding::DefaultFuchsiaResourceDialect,
9856            >,
9857            offset: usize,
9858            depth: fidl::encoding::Depth,
9859        ) -> fidl::Result<()> {
9860            encoder.debug_check_bounds::<PayloadStreamRegisterVmoRequest>(offset);
9861            // Zero out padding regions. There's no need to apply masks
9862            // because the unmasked parts will be overwritten by fields.
9863            // Write the fields.
9864            self.0.encode(encoder, offset + 0, depth)?;
9865            Ok(())
9866        }
9867    }
9868
9869    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9870        for PayloadStreamRegisterVmoRequest
9871    {
9872        #[inline(always)]
9873        fn new_empty() -> Self {
9874            Self {
9875                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9876            }
9877        }
9878
9879        #[inline]
9880        unsafe fn decode(
9881            &mut self,
9882            decoder: &mut fidl::encoding::Decoder<
9883                '_,
9884                fidl::encoding::DefaultFuchsiaResourceDialect,
9885            >,
9886            offset: usize,
9887            _depth: fidl::encoding::Depth,
9888        ) -> fidl::Result<()> {
9889            decoder.debug_check_bounds::<Self>(offset);
9890            // Verify that padding bytes are zero.
9891            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
9892            Ok(())
9893        }
9894    }
9895
9896    impl fidl::encoding::ResourceTypeMarker for SysconfigWriteRequest {
9897        type Borrowed<'a> = &'a mut Self;
9898        fn take_or_borrow<'a>(
9899            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9900        ) -> Self::Borrowed<'a> {
9901            value
9902        }
9903    }
9904
9905    unsafe impl fidl::encoding::TypeMarker for SysconfigWriteRequest {
9906        type Owned = Self;
9907
9908        #[inline(always)]
9909        fn inline_align(_context: fidl::encoding::Context) -> usize {
9910            8
9911        }
9912
9913        #[inline(always)]
9914        fn inline_size(_context: fidl::encoding::Context) -> usize {
9915            16
9916        }
9917    }
9918
9919    unsafe impl
9920        fidl::encoding::Encode<SysconfigWriteRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9921        for &mut SysconfigWriteRequest
9922    {
9923        #[inline]
9924        unsafe fn encode(
9925            self,
9926            encoder: &mut fidl::encoding::Encoder<
9927                '_,
9928                fidl::encoding::DefaultFuchsiaResourceDialect,
9929            >,
9930            offset: usize,
9931            _depth: fidl::encoding::Depth,
9932        ) -> fidl::Result<()> {
9933            encoder.debug_check_bounds::<SysconfigWriteRequest>(offset);
9934            // Delegate to tuple encoding.
9935            fidl::encoding::Encode::<
9936                SysconfigWriteRequest,
9937                fidl::encoding::DefaultFuchsiaResourceDialect,
9938            >::encode(
9939                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9940                    &mut self.payload,
9941                ),),
9942                encoder,
9943                offset,
9944                _depth,
9945            )
9946        }
9947    }
9948    unsafe impl<
9949        T0: fidl::encoding::Encode<
9950                fidl_fuchsia_mem::Buffer,
9951                fidl::encoding::DefaultFuchsiaResourceDialect,
9952            >,
9953    >
9954        fidl::encoding::Encode<SysconfigWriteRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9955        for (T0,)
9956    {
9957        #[inline]
9958        unsafe fn encode(
9959            self,
9960            encoder: &mut fidl::encoding::Encoder<
9961                '_,
9962                fidl::encoding::DefaultFuchsiaResourceDialect,
9963            >,
9964            offset: usize,
9965            depth: fidl::encoding::Depth,
9966        ) -> fidl::Result<()> {
9967            encoder.debug_check_bounds::<SysconfigWriteRequest>(offset);
9968            // Zero out padding regions. There's no need to apply masks
9969            // because the unmasked parts will be overwritten by fields.
9970            // Write the fields.
9971            self.0.encode(encoder, offset + 0, depth)?;
9972            Ok(())
9973        }
9974    }
9975
9976    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9977        for SysconfigWriteRequest
9978    {
9979        #[inline(always)]
9980        fn new_empty() -> Self {
9981            Self {
9982                payload: fidl::new_empty!(
9983                    fidl_fuchsia_mem::Buffer,
9984                    fidl::encoding::DefaultFuchsiaResourceDialect
9985                ),
9986            }
9987        }
9988
9989        #[inline]
9990        unsafe fn decode(
9991            &mut self,
9992            decoder: &mut fidl::encoding::Decoder<
9993                '_,
9994                fidl::encoding::DefaultFuchsiaResourceDialect,
9995            >,
9996            offset: usize,
9997            _depth: fidl::encoding::Depth,
9998        ) -> fidl::Result<()> {
9999            decoder.debug_check_bounds::<Self>(offset);
10000            // Verify that padding bytes are zero.
10001            fidl::decode!(
10002                fidl_fuchsia_mem::Buffer,
10003                fidl::encoding::DefaultFuchsiaResourceDialect,
10004                &mut self.payload,
10005                decoder,
10006                offset + 0,
10007                _depth
10008            )?;
10009            Ok(())
10010        }
10011    }
10012
10013    impl fidl::encoding::ResourceTypeMarker for SysconfigReadResponse {
10014        type Borrowed<'a> = &'a mut Self;
10015        fn take_or_borrow<'a>(
10016            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10017        ) -> Self::Borrowed<'a> {
10018            value
10019        }
10020    }
10021
10022    unsafe impl fidl::encoding::TypeMarker for SysconfigReadResponse {
10023        type Owned = Self;
10024
10025        #[inline(always)]
10026        fn inline_align(_context: fidl::encoding::Context) -> usize {
10027            8
10028        }
10029
10030        #[inline(always)]
10031        fn inline_size(_context: fidl::encoding::Context) -> usize {
10032            16
10033        }
10034    }
10035
10036    unsafe impl
10037        fidl::encoding::Encode<SysconfigReadResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
10038        for &mut SysconfigReadResponse
10039    {
10040        #[inline]
10041        unsafe fn encode(
10042            self,
10043            encoder: &mut fidl::encoding::Encoder<
10044                '_,
10045                fidl::encoding::DefaultFuchsiaResourceDialect,
10046            >,
10047            offset: usize,
10048            _depth: fidl::encoding::Depth,
10049        ) -> fidl::Result<()> {
10050            encoder.debug_check_bounds::<SysconfigReadResponse>(offset);
10051            // Delegate to tuple encoding.
10052            fidl::encoding::Encode::<
10053                SysconfigReadResponse,
10054                fidl::encoding::DefaultFuchsiaResourceDialect,
10055            >::encode(
10056                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10057                    &mut self.data,
10058                ),),
10059                encoder,
10060                offset,
10061                _depth,
10062            )
10063        }
10064    }
10065    unsafe impl<
10066        T0: fidl::encoding::Encode<
10067                fidl_fuchsia_mem::Buffer,
10068                fidl::encoding::DefaultFuchsiaResourceDialect,
10069            >,
10070    >
10071        fidl::encoding::Encode<SysconfigReadResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
10072        for (T0,)
10073    {
10074        #[inline]
10075        unsafe fn encode(
10076            self,
10077            encoder: &mut fidl::encoding::Encoder<
10078                '_,
10079                fidl::encoding::DefaultFuchsiaResourceDialect,
10080            >,
10081            offset: usize,
10082            depth: fidl::encoding::Depth,
10083        ) -> fidl::Result<()> {
10084            encoder.debug_check_bounds::<SysconfigReadResponse>(offset);
10085            // Zero out padding regions. There's no need to apply masks
10086            // because the unmasked parts will be overwritten by fields.
10087            // Write the fields.
10088            self.0.encode(encoder, offset + 0, depth)?;
10089            Ok(())
10090        }
10091    }
10092
10093    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10094        for SysconfigReadResponse
10095    {
10096        #[inline(always)]
10097        fn new_empty() -> Self {
10098            Self {
10099                data: fidl::new_empty!(
10100                    fidl_fuchsia_mem::Buffer,
10101                    fidl::encoding::DefaultFuchsiaResourceDialect
10102                ),
10103            }
10104        }
10105
10106        #[inline]
10107        unsafe fn decode(
10108            &mut self,
10109            decoder: &mut fidl::encoding::Decoder<
10110                '_,
10111                fidl::encoding::DefaultFuchsiaResourceDialect,
10112            >,
10113            offset: usize,
10114            _depth: fidl::encoding::Depth,
10115        ) -> fidl::Result<()> {
10116            decoder.debug_check_bounds::<Self>(offset);
10117            // Verify that padding bytes are zero.
10118            fidl::decode!(
10119                fidl_fuchsia_mem::Buffer,
10120                fidl::encoding::DefaultFuchsiaResourceDialect,
10121                &mut self.data,
10122                decoder,
10123                offset + 0,
10124                _depth
10125            )?;
10126            Ok(())
10127        }
10128    }
10129}