Skip to main content

fidl_fuchsia_boot/
fidl_fuchsia_boot.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_boot_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14/// Refers to a VMO that has been created from the big bootfs VMO.
15#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct BootfsFileVmo {
17    /// Offset of the VMO in the bootfs VMO.
18    pub offset: u32,
19    /// VMO with the contents from the decoded file.
20    pub contents: fidl::Vmo,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BootfsFileVmo {}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct FactoryItemsGetResponse {
27    pub payload: Option<fidl::Vmo>,
28    pub length: u32,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FactoryItemsGetResponse {}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct ItemsGetBootloaderFileResponse {
35    pub payload: Option<fidl::Vmo>,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
39    for ItemsGetBootloaderFileResponse
40{
41}
42
43#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct ItemsGetResponse {
45    pub payload: Option<fidl::Vmo>,
46    pub length: u32,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ItemsGetResponse {}
50
51#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52pub struct ItemsGet2Response {
53    pub retrieved_items: Vec<RetrievedItems>,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ItemsGet2Response {}
57
58#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59pub struct ReadOnlyLogGetResponse {
60    pub log: fidl::DebugLog,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ReadOnlyLogGetResponse {}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct RetrievedItems {
67    pub payload: fidl::Vmo,
68    pub length: u32,
69    pub extra: u32,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RetrievedItems {}
73
74#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75pub struct SvcStashProviderGetResponse {
76    pub resource: fidl::endpoints::ServerEnd<SvcStashMarker>,
77}
78
79impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
80    for SvcStashProviderGetResponse
81{
82}
83
84#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct SvcStashStoreRequest {
86    pub svc_endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SvcStashStoreRequest {}
90
91#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92pub struct UserbootPostBootfsFilesRequest {
93    pub files: Vec<BootfsFileVmo>,
94}
95
96impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
97    for UserbootPostBootfsFilesRequest
98{
99}
100
101#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
102pub struct UserbootPostBootfsVmoRequest {
103    pub bootfs: fidl::Vmo,
104}
105
106impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
107    for UserbootPostBootfsVmoRequest
108{
109}
110
111#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
112pub struct UserbootPostStashSvcRequest {
113    pub stash_svc_endpoint: fidl::endpoints::ServerEnd<SvcStashMarker>,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
117    for UserbootPostStashSvcRequest
118{
119}
120
121#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
122pub struct WriteOnlyLogGetResponse {
123    pub log: fidl::DebugLog,
124}
125
126impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WriteOnlyLogGetResponse {}
127
128#[derive(Debug, Default, PartialEq)]
129pub struct UserbootPostBootHandlesRequest {
130    /// ZBI (bootdata) VMO.
131    pub zbi_vmo: Option<fidl::Vmo>,
132    /// Kernel file VMOs to be published under `/boot/kernel/`.
133    pub kernel_files: Option<Vec<fidl::Vmo>>,
134    /// System resource handle.
135    pub system_resource: Option<fidl::Resource>,
136    /// MMIO resource handle.
137    pub mmio_resource: Option<fidl::Resource>,
138    /// IRQ resource handle.
139    pub irq_resource: Option<fidl::Resource>,
140    /// I/O port resource handle (x86_64).
141    pub ioport_resource: Option<fidl::Resource>,
142    /// SMC resource handle (aarch64).
143    pub smc_resource: Option<fidl::Resource>,
144    #[doc(hidden)]
145    pub __source_breaking: fidl::marker::SourceBreaking,
146}
147
148impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
149    for UserbootPostBootHandlesRequest
150{
151}
152
153#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
154pub struct ArgumentsMarker;
155
156impl fidl::endpoints::ProtocolMarker for ArgumentsMarker {
157    type Proxy = ArgumentsProxy;
158    type RequestStream = ArgumentsRequestStream;
159    #[cfg(target_os = "fuchsia")]
160    type SynchronousProxy = ArgumentsSynchronousProxy;
161
162    const DEBUG_NAME: &'static str = "fuchsia.boot.Arguments";
163}
164impl fidl::endpoints::DiscoverableProtocolMarker for ArgumentsMarker {}
165
166pub trait ArgumentsProxyInterface: Send + Sync {
167    type GetStringResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
168        + Send;
169    fn r#get_string(&self, key: &str) -> Self::GetStringResponseFut;
170    type GetStringsResponseFut: std::future::Future<Output = Result<Vec<Option<String>>, fidl::Error>>
171        + Send;
172    fn r#get_strings(&self, keys: &[String]) -> Self::GetStringsResponseFut;
173    type GetBoolResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
174    fn r#get_bool(&self, key: &str, defaultval: bool) -> Self::GetBoolResponseFut;
175    type GetBoolsResponseFut: std::future::Future<Output = Result<Vec<bool>, fidl::Error>> + Send;
176    fn r#get_bools(&self, keys: &[BoolPair]) -> Self::GetBoolsResponseFut;
177    type CollectResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
178    fn r#collect(&self, prefix: &str) -> Self::CollectResponseFut;
179}
180#[derive(Debug)]
181#[cfg(target_os = "fuchsia")]
182pub struct ArgumentsSynchronousProxy {
183    client: fidl::client::sync::Client,
184}
185
186#[cfg(target_os = "fuchsia")]
187impl fidl::endpoints::SynchronousProxy for ArgumentsSynchronousProxy {
188    type Proxy = ArgumentsProxy;
189    type Protocol = ArgumentsMarker;
190
191    fn from_channel(inner: fidl::Channel) -> Self {
192        Self::new(inner)
193    }
194
195    fn into_channel(self) -> fidl::Channel {
196        self.client.into_channel()
197    }
198
199    fn as_channel(&self) -> &fidl::Channel {
200        self.client.as_channel()
201    }
202}
203
204#[cfg(target_os = "fuchsia")]
205impl ArgumentsSynchronousProxy {
206    pub fn new(channel: fidl::Channel) -> Self {
207        Self { client: fidl::client::sync::Client::new(channel) }
208    }
209
210    pub fn into_channel(self) -> fidl::Channel {
211        self.client.into_channel()
212    }
213
214    /// Waits until an event arrives and returns it. It is safe for other
215    /// threads to make concurrent requests while waiting for an event.
216    pub fn wait_for_event(
217        &self,
218        deadline: zx::MonotonicInstant,
219    ) -> Result<ArgumentsEvent, fidl::Error> {
220        ArgumentsEvent::decode(self.client.wait_for_event::<ArgumentsMarker>(deadline)?)
221    }
222
223    /// Get the value of a boot argument `key`.
224    pub fn r#get_string(
225        &self,
226        mut key: &str,
227        ___deadline: zx::MonotonicInstant,
228    ) -> Result<Option<String>, fidl::Error> {
229        let _response = self
230            .client
231            .send_query::<ArgumentsGetStringRequest, ArgumentsGetStringResponse, ArgumentsMarker>(
232                (key,),
233                0x426c026d966f8fe,
234                fidl::encoding::DynamicFlags::empty(),
235                ___deadline,
236            )?;
237        Ok(_response.value)
238    }
239
240    /// Get the values of a list of arguments specified in `keys`.
241    pub fn r#get_strings(
242        &self,
243        mut keys: &[String],
244        ___deadline: zx::MonotonicInstant,
245    ) -> Result<Vec<Option<String>>, fidl::Error> {
246        let _response = self
247            .client
248            .send_query::<ArgumentsGetStringsRequest, ArgumentsGetStringsResponse, ArgumentsMarker>(
249                (keys,),
250                0x328fb6b545aa96f7,
251                fidl::encoding::DynamicFlags::empty(),
252                ___deadline,
253            )?;
254        Ok(_response.values)
255    }
256
257    /// Get the boolean value of a boot argument `keys`,
258    /// or return `defaultval` if the argument is not present.
259    /// A key is considered to be false if its string value is exactly
260    /// "off", "0", or "false". Any other value (including empty) is returned
261    /// as true.
262    pub fn r#get_bool(
263        &self,
264        mut key: &str,
265        mut defaultval: bool,
266        ___deadline: zx::MonotonicInstant,
267    ) -> Result<bool, fidl::Error> {
268        let _response = self
269            .client
270            .send_query::<ArgumentsGetBoolRequest, ArgumentsGetBoolResponse, ArgumentsMarker>(
271                (key, defaultval),
272                0x4c5dd3149815cccd,
273                fidl::encoding::DynamicFlags::empty(),
274                ___deadline,
275            )?;
276        Ok(_response.value)
277    }
278
279    /// Get the boolean values of a list of boot arguments `keys.key`,
280    /// or return `keys.defaultval` for each if not present.
281    pub fn r#get_bools(
282        &self,
283        mut keys: &[BoolPair],
284        ___deadline: zx::MonotonicInstant,
285    ) -> Result<Vec<bool>, fidl::Error> {
286        let _response = self
287            .client
288            .send_query::<ArgumentsGetBoolsRequest, ArgumentsGetBoolsResponse, ArgumentsMarker>(
289                (keys,),
290                0xfcc9fc9a0f22615,
291                fidl::encoding::DynamicFlags::empty(),
292                ___deadline,
293            )?;
294        Ok(_response.values)
295    }
296
297    /// Get all boot arguments with keys starting with
298    /// `prefix`. Returns a vector with strings of the form 'key=value'.
299    /// TODO(https://fxbug.dev/42108659) - remove Collect once boot arguments have been componentised.
300    pub fn r#collect(
301        &self,
302        mut prefix: &str,
303        ___deadline: zx::MonotonicInstant,
304    ) -> Result<Vec<String>, fidl::Error> {
305        let _response = self
306            .client
307            .send_query::<ArgumentsCollectRequest, ArgumentsCollectResponse, ArgumentsMarker>(
308                (prefix,),
309                0x24e5acd864546e30,
310                fidl::encoding::DynamicFlags::empty(),
311                ___deadline,
312            )?;
313        Ok(_response.results)
314    }
315}
316
317#[cfg(target_os = "fuchsia")]
318impl From<ArgumentsSynchronousProxy> for zx::NullableHandle {
319    fn from(value: ArgumentsSynchronousProxy) -> Self {
320        value.into_channel().into()
321    }
322}
323
324#[cfg(target_os = "fuchsia")]
325impl From<fidl::Channel> for ArgumentsSynchronousProxy {
326    fn from(value: fidl::Channel) -> Self {
327        Self::new(value)
328    }
329}
330
331#[cfg(target_os = "fuchsia")]
332impl fidl::endpoints::FromClient for ArgumentsSynchronousProxy {
333    type Protocol = ArgumentsMarker;
334
335    fn from_client(value: fidl::endpoints::ClientEnd<ArgumentsMarker>) -> Self {
336        Self::new(value.into_channel())
337    }
338}
339
340#[derive(Debug, Clone)]
341pub struct ArgumentsProxy {
342    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
343}
344
345impl fidl::endpoints::Proxy for ArgumentsProxy {
346    type Protocol = ArgumentsMarker;
347
348    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
349        Self::new(inner)
350    }
351
352    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
353        self.client.into_channel().map_err(|client| Self { client })
354    }
355
356    fn as_channel(&self) -> &::fidl::AsyncChannel {
357        self.client.as_channel()
358    }
359}
360
361impl ArgumentsProxy {
362    /// Create a new Proxy for fuchsia.boot/Arguments.
363    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
364        let protocol_name = <ArgumentsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
365        Self { client: fidl::client::Client::new(channel, protocol_name) }
366    }
367
368    /// Get a Stream of events from the remote end of the protocol.
369    ///
370    /// # Panics
371    ///
372    /// Panics if the event stream was already taken.
373    pub fn take_event_stream(&self) -> ArgumentsEventStream {
374        ArgumentsEventStream { event_receiver: self.client.take_event_receiver() }
375    }
376
377    /// Get the value of a boot argument `key`.
378    pub fn r#get_string(
379        &self,
380        mut key: &str,
381    ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
382    {
383        ArgumentsProxyInterface::r#get_string(self, key)
384    }
385
386    /// Get the values of a list of arguments specified in `keys`.
387    pub fn r#get_strings(
388        &self,
389        mut keys: &[String],
390    ) -> fidl::client::QueryResponseFut<
391        Vec<Option<String>>,
392        fidl::encoding::DefaultFuchsiaResourceDialect,
393    > {
394        ArgumentsProxyInterface::r#get_strings(self, keys)
395    }
396
397    /// Get the boolean value of a boot argument `keys`,
398    /// or return `defaultval` if the argument is not present.
399    /// A key is considered to be false if its string value is exactly
400    /// "off", "0", or "false". Any other value (including empty) is returned
401    /// as true.
402    pub fn r#get_bool(
403        &self,
404        mut key: &str,
405        mut defaultval: bool,
406    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
407        ArgumentsProxyInterface::r#get_bool(self, key, defaultval)
408    }
409
410    /// Get the boolean values of a list of boot arguments `keys.key`,
411    /// or return `keys.defaultval` for each if not present.
412    pub fn r#get_bools(
413        &self,
414        mut keys: &[BoolPair],
415    ) -> fidl::client::QueryResponseFut<Vec<bool>, fidl::encoding::DefaultFuchsiaResourceDialect>
416    {
417        ArgumentsProxyInterface::r#get_bools(self, keys)
418    }
419
420    /// Get all boot arguments with keys starting with
421    /// `prefix`. Returns a vector with strings of the form 'key=value'.
422    /// TODO(https://fxbug.dev/42108659) - remove Collect once boot arguments have been componentised.
423    pub fn r#collect(
424        &self,
425        mut prefix: &str,
426    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
427    {
428        ArgumentsProxyInterface::r#collect(self, prefix)
429    }
430}
431
432impl ArgumentsProxyInterface for ArgumentsProxy {
433    type GetStringResponseFut = fidl::client::QueryResponseFut<
434        Option<String>,
435        fidl::encoding::DefaultFuchsiaResourceDialect,
436    >;
437    fn r#get_string(&self, mut key: &str) -> Self::GetStringResponseFut {
438        fn _decode(
439            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
440        ) -> Result<Option<String>, fidl::Error> {
441            let _response = fidl::client::decode_transaction_body::<
442                ArgumentsGetStringResponse,
443                fidl::encoding::DefaultFuchsiaResourceDialect,
444                0x426c026d966f8fe,
445            >(_buf?)?;
446            Ok(_response.value)
447        }
448        self.client.send_query_and_decode::<ArgumentsGetStringRequest, Option<String>>(
449            (key,),
450            0x426c026d966f8fe,
451            fidl::encoding::DynamicFlags::empty(),
452            _decode,
453        )
454    }
455
456    type GetStringsResponseFut = fidl::client::QueryResponseFut<
457        Vec<Option<String>>,
458        fidl::encoding::DefaultFuchsiaResourceDialect,
459    >;
460    fn r#get_strings(&self, mut keys: &[String]) -> Self::GetStringsResponseFut {
461        fn _decode(
462            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
463        ) -> Result<Vec<Option<String>>, fidl::Error> {
464            let _response = fidl::client::decode_transaction_body::<
465                ArgumentsGetStringsResponse,
466                fidl::encoding::DefaultFuchsiaResourceDialect,
467                0x328fb6b545aa96f7,
468            >(_buf?)?;
469            Ok(_response.values)
470        }
471        self.client.send_query_and_decode::<ArgumentsGetStringsRequest, Vec<Option<String>>>(
472            (keys,),
473            0x328fb6b545aa96f7,
474            fidl::encoding::DynamicFlags::empty(),
475            _decode,
476        )
477    }
478
479    type GetBoolResponseFut =
480        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
481    fn r#get_bool(&self, mut key: &str, mut defaultval: bool) -> Self::GetBoolResponseFut {
482        fn _decode(
483            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
484        ) -> Result<bool, fidl::Error> {
485            let _response = fidl::client::decode_transaction_body::<
486                ArgumentsGetBoolResponse,
487                fidl::encoding::DefaultFuchsiaResourceDialect,
488                0x4c5dd3149815cccd,
489            >(_buf?)?;
490            Ok(_response.value)
491        }
492        self.client.send_query_and_decode::<ArgumentsGetBoolRequest, bool>(
493            (key, defaultval),
494            0x4c5dd3149815cccd,
495            fidl::encoding::DynamicFlags::empty(),
496            _decode,
497        )
498    }
499
500    type GetBoolsResponseFut =
501        fidl::client::QueryResponseFut<Vec<bool>, fidl::encoding::DefaultFuchsiaResourceDialect>;
502    fn r#get_bools(&self, mut keys: &[BoolPair]) -> Self::GetBoolsResponseFut {
503        fn _decode(
504            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
505        ) -> Result<Vec<bool>, fidl::Error> {
506            let _response = fidl::client::decode_transaction_body::<
507                ArgumentsGetBoolsResponse,
508                fidl::encoding::DefaultFuchsiaResourceDialect,
509                0xfcc9fc9a0f22615,
510            >(_buf?)?;
511            Ok(_response.values)
512        }
513        self.client.send_query_and_decode::<ArgumentsGetBoolsRequest, Vec<bool>>(
514            (keys,),
515            0xfcc9fc9a0f22615,
516            fidl::encoding::DynamicFlags::empty(),
517            _decode,
518        )
519    }
520
521    type CollectResponseFut =
522        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
523    fn r#collect(&self, mut prefix: &str) -> Self::CollectResponseFut {
524        fn _decode(
525            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
526        ) -> Result<Vec<String>, fidl::Error> {
527            let _response = fidl::client::decode_transaction_body::<
528                ArgumentsCollectResponse,
529                fidl::encoding::DefaultFuchsiaResourceDialect,
530                0x24e5acd864546e30,
531            >(_buf?)?;
532            Ok(_response.results)
533        }
534        self.client.send_query_and_decode::<ArgumentsCollectRequest, Vec<String>>(
535            (prefix,),
536            0x24e5acd864546e30,
537            fidl::encoding::DynamicFlags::empty(),
538            _decode,
539        )
540    }
541}
542
543pub struct ArgumentsEventStream {
544    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
545}
546
547impl std::marker::Unpin for ArgumentsEventStream {}
548
549impl futures::stream::FusedStream for ArgumentsEventStream {
550    fn is_terminated(&self) -> bool {
551        self.event_receiver.is_terminated()
552    }
553}
554
555impl futures::Stream for ArgumentsEventStream {
556    type Item = Result<ArgumentsEvent, fidl::Error>;
557
558    fn poll_next(
559        mut self: std::pin::Pin<&mut Self>,
560        cx: &mut std::task::Context<'_>,
561    ) -> std::task::Poll<Option<Self::Item>> {
562        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
563            &mut self.event_receiver,
564            cx
565        )?) {
566            Some(buf) => std::task::Poll::Ready(Some(ArgumentsEvent::decode(buf))),
567            None => std::task::Poll::Ready(None),
568        }
569    }
570}
571
572#[derive(Debug)]
573pub enum ArgumentsEvent {}
574
575impl ArgumentsEvent {
576    /// Decodes a message buffer as a [`ArgumentsEvent`].
577    fn decode(
578        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
579    ) -> Result<ArgumentsEvent, fidl::Error> {
580        let (bytes, _handles) = buf.split_mut();
581        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
582        debug_assert_eq!(tx_header.tx_id, 0);
583        match tx_header.ordinal {
584            _ => Err(fidl::Error::UnknownOrdinal {
585                ordinal: tx_header.ordinal,
586                protocol_name: <ArgumentsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
587            }),
588        }
589    }
590}
591
592/// A Stream of incoming requests for fuchsia.boot/Arguments.
593pub struct ArgumentsRequestStream {
594    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
595    is_terminated: bool,
596}
597
598impl std::marker::Unpin for ArgumentsRequestStream {}
599
600impl futures::stream::FusedStream for ArgumentsRequestStream {
601    fn is_terminated(&self) -> bool {
602        self.is_terminated
603    }
604}
605
606impl fidl::endpoints::RequestStream for ArgumentsRequestStream {
607    type Protocol = ArgumentsMarker;
608    type ControlHandle = ArgumentsControlHandle;
609
610    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
611        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
612    }
613
614    fn control_handle(&self) -> Self::ControlHandle {
615        ArgumentsControlHandle { inner: self.inner.clone() }
616    }
617
618    fn into_inner(
619        self,
620    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
621    {
622        (self.inner, self.is_terminated)
623    }
624
625    fn from_inner(
626        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
627        is_terminated: bool,
628    ) -> Self {
629        Self { inner, is_terminated }
630    }
631}
632
633impl futures::Stream for ArgumentsRequestStream {
634    type Item = Result<ArgumentsRequest, fidl::Error>;
635
636    fn poll_next(
637        mut self: std::pin::Pin<&mut Self>,
638        cx: &mut std::task::Context<'_>,
639    ) -> std::task::Poll<Option<Self::Item>> {
640        let this = &mut *self;
641        if this.inner.check_shutdown(cx) {
642            this.is_terminated = true;
643            return std::task::Poll::Ready(None);
644        }
645        if this.is_terminated {
646            panic!("polled ArgumentsRequestStream after completion");
647        }
648        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
649            |bytes, handles| {
650                match this.inner.channel().read_etc(cx, bytes, handles) {
651                    std::task::Poll::Ready(Ok(())) => {}
652                    std::task::Poll::Pending => return std::task::Poll::Pending,
653                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
654                        this.is_terminated = true;
655                        return std::task::Poll::Ready(None);
656                    }
657                    std::task::Poll::Ready(Err(e)) => {
658                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
659                            e.into(),
660                        ))));
661                    }
662                }
663
664                // A message has been received from the channel
665                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
666
667                std::task::Poll::Ready(Some(match header.ordinal {
668                    0x426c026d966f8fe => {
669                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
670                        let mut req = fidl::new_empty!(
671                            ArgumentsGetStringRequest,
672                            fidl::encoding::DefaultFuchsiaResourceDialect
673                        );
674                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArgumentsGetStringRequest>(&header, _body_bytes, handles, &mut req)?;
675                        let control_handle = ArgumentsControlHandle { inner: this.inner.clone() };
676                        Ok(ArgumentsRequest::GetString {
677                            key: req.key,
678
679                            responder: ArgumentsGetStringResponder {
680                                control_handle: std::mem::ManuallyDrop::new(control_handle),
681                                tx_id: header.tx_id,
682                            },
683                        })
684                    }
685                    0x328fb6b545aa96f7 => {
686                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
687                        let mut req = fidl::new_empty!(
688                            ArgumentsGetStringsRequest,
689                            fidl::encoding::DefaultFuchsiaResourceDialect
690                        );
691                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArgumentsGetStringsRequest>(&header, _body_bytes, handles, &mut req)?;
692                        let control_handle = ArgumentsControlHandle { inner: this.inner.clone() };
693                        Ok(ArgumentsRequest::GetStrings {
694                            keys: req.keys,
695
696                            responder: ArgumentsGetStringsResponder {
697                                control_handle: std::mem::ManuallyDrop::new(control_handle),
698                                tx_id: header.tx_id,
699                            },
700                        })
701                    }
702                    0x4c5dd3149815cccd => {
703                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
704                        let mut req = fidl::new_empty!(
705                            ArgumentsGetBoolRequest,
706                            fidl::encoding::DefaultFuchsiaResourceDialect
707                        );
708                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArgumentsGetBoolRequest>(&header, _body_bytes, handles, &mut req)?;
709                        let control_handle = ArgumentsControlHandle { inner: this.inner.clone() };
710                        Ok(ArgumentsRequest::GetBool {
711                            key: req.key,
712                            defaultval: req.defaultval,
713
714                            responder: ArgumentsGetBoolResponder {
715                                control_handle: std::mem::ManuallyDrop::new(control_handle),
716                                tx_id: header.tx_id,
717                            },
718                        })
719                    }
720                    0xfcc9fc9a0f22615 => {
721                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
722                        let mut req = fidl::new_empty!(
723                            ArgumentsGetBoolsRequest,
724                            fidl::encoding::DefaultFuchsiaResourceDialect
725                        );
726                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArgumentsGetBoolsRequest>(&header, _body_bytes, handles, &mut req)?;
727                        let control_handle = ArgumentsControlHandle { inner: this.inner.clone() };
728                        Ok(ArgumentsRequest::GetBools {
729                            keys: req.keys,
730
731                            responder: ArgumentsGetBoolsResponder {
732                                control_handle: std::mem::ManuallyDrop::new(control_handle),
733                                tx_id: header.tx_id,
734                            },
735                        })
736                    }
737                    0x24e5acd864546e30 => {
738                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
739                        let mut req = fidl::new_empty!(
740                            ArgumentsCollectRequest,
741                            fidl::encoding::DefaultFuchsiaResourceDialect
742                        );
743                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArgumentsCollectRequest>(&header, _body_bytes, handles, &mut req)?;
744                        let control_handle = ArgumentsControlHandle { inner: this.inner.clone() };
745                        Ok(ArgumentsRequest::Collect {
746                            prefix: req.prefix,
747
748                            responder: ArgumentsCollectResponder {
749                                control_handle: std::mem::ManuallyDrop::new(control_handle),
750                                tx_id: header.tx_id,
751                            },
752                        })
753                    }
754                    _ => Err(fidl::Error::UnknownOrdinal {
755                        ordinal: header.ordinal,
756                        protocol_name:
757                            <ArgumentsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
758                    }),
759                }))
760            },
761        )
762    }
763}
764
765/// Protocol for retrieving boot arguments.
766#[derive(Debug)]
767pub enum ArgumentsRequest {
768    /// Get the value of a boot argument `key`.
769    GetString { key: String, responder: ArgumentsGetStringResponder },
770    /// Get the values of a list of arguments specified in `keys`.
771    GetStrings { keys: Vec<String>, responder: ArgumentsGetStringsResponder },
772    /// Get the boolean value of a boot argument `keys`,
773    /// or return `defaultval` if the argument is not present.
774    /// A key is considered to be false if its string value is exactly
775    /// "off", "0", or "false". Any other value (including empty) is returned
776    /// as true.
777    GetBool { key: String, defaultval: bool, responder: ArgumentsGetBoolResponder },
778    /// Get the boolean values of a list of boot arguments `keys.key`,
779    /// or return `keys.defaultval` for each if not present.
780    GetBools { keys: Vec<BoolPair>, responder: ArgumentsGetBoolsResponder },
781    /// Get all boot arguments with keys starting with
782    /// `prefix`. Returns a vector with strings of the form 'key=value'.
783    /// TODO(https://fxbug.dev/42108659) - remove Collect once boot arguments have been componentised.
784    Collect { prefix: String, responder: ArgumentsCollectResponder },
785}
786
787impl ArgumentsRequest {
788    #[allow(irrefutable_let_patterns)]
789    pub fn into_get_string(self) -> Option<(String, ArgumentsGetStringResponder)> {
790        if let ArgumentsRequest::GetString { key, responder } = self {
791            Some((key, responder))
792        } else {
793            None
794        }
795    }
796
797    #[allow(irrefutable_let_patterns)]
798    pub fn into_get_strings(self) -> Option<(Vec<String>, ArgumentsGetStringsResponder)> {
799        if let ArgumentsRequest::GetStrings { keys, responder } = self {
800            Some((keys, responder))
801        } else {
802            None
803        }
804    }
805
806    #[allow(irrefutable_let_patterns)]
807    pub fn into_get_bool(self) -> Option<(String, bool, ArgumentsGetBoolResponder)> {
808        if let ArgumentsRequest::GetBool { key, defaultval, responder } = self {
809            Some((key, defaultval, responder))
810        } else {
811            None
812        }
813    }
814
815    #[allow(irrefutable_let_patterns)]
816    pub fn into_get_bools(self) -> Option<(Vec<BoolPair>, ArgumentsGetBoolsResponder)> {
817        if let ArgumentsRequest::GetBools { keys, responder } = self {
818            Some((keys, responder))
819        } else {
820            None
821        }
822    }
823
824    #[allow(irrefutable_let_patterns)]
825    pub fn into_collect(self) -> Option<(String, ArgumentsCollectResponder)> {
826        if let ArgumentsRequest::Collect { prefix, responder } = self {
827            Some((prefix, responder))
828        } else {
829            None
830        }
831    }
832
833    /// Name of the method defined in FIDL
834    pub fn method_name(&self) -> &'static str {
835        match *self {
836            ArgumentsRequest::GetString { .. } => "get_string",
837            ArgumentsRequest::GetStrings { .. } => "get_strings",
838            ArgumentsRequest::GetBool { .. } => "get_bool",
839            ArgumentsRequest::GetBools { .. } => "get_bools",
840            ArgumentsRequest::Collect { .. } => "collect",
841        }
842    }
843}
844
845#[derive(Debug, Clone)]
846pub struct ArgumentsControlHandle {
847    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
848}
849
850impl ArgumentsControlHandle {
851    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
852        self.inner.shutdown_with_epitaph(status.into())
853    }
854}
855
856impl fidl::endpoints::ControlHandle for ArgumentsControlHandle {
857    fn shutdown(&self) {
858        self.inner.shutdown()
859    }
860
861    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
862        self.inner.shutdown_with_epitaph(status)
863    }
864
865    fn is_closed(&self) -> bool {
866        self.inner.channel().is_closed()
867    }
868    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
869        self.inner.channel().on_closed()
870    }
871
872    #[cfg(target_os = "fuchsia")]
873    fn signal_peer(
874        &self,
875        clear_mask: zx::Signals,
876        set_mask: zx::Signals,
877    ) -> Result<(), zx_status::Status> {
878        use fidl::Peered;
879        self.inner.channel().signal_peer(clear_mask, set_mask)
880    }
881}
882
883impl ArgumentsControlHandle {}
884
885#[must_use = "FIDL methods require a response to be sent"]
886#[derive(Debug)]
887pub struct ArgumentsGetStringResponder {
888    control_handle: std::mem::ManuallyDrop<ArgumentsControlHandle>,
889    tx_id: u32,
890}
891
892/// Set the the channel to be shutdown (see [`ArgumentsControlHandle::shutdown`])
893/// if the responder is dropped without sending a response, so that the client
894/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
895impl std::ops::Drop for ArgumentsGetStringResponder {
896    fn drop(&mut self) {
897        self.control_handle.shutdown();
898        // Safety: drops once, never accessed again
899        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
900    }
901}
902
903impl fidl::endpoints::Responder for ArgumentsGetStringResponder {
904    type ControlHandle = ArgumentsControlHandle;
905
906    fn control_handle(&self) -> &ArgumentsControlHandle {
907        &self.control_handle
908    }
909
910    fn drop_without_shutdown(mut self) {
911        // Safety: drops once, never accessed again due to mem::forget
912        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
913        // Prevent Drop from running (which would shut down the channel)
914        std::mem::forget(self);
915    }
916}
917
918impl ArgumentsGetStringResponder {
919    /// Sends a response to the FIDL transaction.
920    ///
921    /// Sets the channel to shutdown if an error occurs.
922    pub fn send(self, mut value: Option<&str>) -> Result<(), fidl::Error> {
923        let _result = self.send_raw(value);
924        if _result.is_err() {
925            self.control_handle.shutdown();
926        }
927        self.drop_without_shutdown();
928        _result
929    }
930
931    /// Similar to "send" but does not shutdown the channel if an error occurs.
932    pub fn send_no_shutdown_on_err(self, mut value: Option<&str>) -> Result<(), fidl::Error> {
933        let _result = self.send_raw(value);
934        self.drop_without_shutdown();
935        _result
936    }
937
938    fn send_raw(&self, mut value: Option<&str>) -> Result<(), fidl::Error> {
939        self.control_handle.inner.send::<ArgumentsGetStringResponse>(
940            (value,),
941            self.tx_id,
942            0x426c026d966f8fe,
943            fidl::encoding::DynamicFlags::empty(),
944        )
945    }
946}
947
948#[must_use = "FIDL methods require a response to be sent"]
949#[derive(Debug)]
950pub struct ArgumentsGetStringsResponder {
951    control_handle: std::mem::ManuallyDrop<ArgumentsControlHandle>,
952    tx_id: u32,
953}
954
955/// Set the the channel to be shutdown (see [`ArgumentsControlHandle::shutdown`])
956/// if the responder is dropped without sending a response, so that the client
957/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
958impl std::ops::Drop for ArgumentsGetStringsResponder {
959    fn drop(&mut self) {
960        self.control_handle.shutdown();
961        // Safety: drops once, never accessed again
962        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
963    }
964}
965
966impl fidl::endpoints::Responder for ArgumentsGetStringsResponder {
967    type ControlHandle = ArgumentsControlHandle;
968
969    fn control_handle(&self) -> &ArgumentsControlHandle {
970        &self.control_handle
971    }
972
973    fn drop_without_shutdown(mut self) {
974        // Safety: drops once, never accessed again due to mem::forget
975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
976        // Prevent Drop from running (which would shut down the channel)
977        std::mem::forget(self);
978    }
979}
980
981impl ArgumentsGetStringsResponder {
982    /// Sends a response to the FIDL transaction.
983    ///
984    /// Sets the channel to shutdown if an error occurs.
985    pub fn send(self, mut values: &[Option<String>]) -> Result<(), fidl::Error> {
986        let _result = self.send_raw(values);
987        if _result.is_err() {
988            self.control_handle.shutdown();
989        }
990        self.drop_without_shutdown();
991        _result
992    }
993
994    /// Similar to "send" but does not shutdown the channel if an error occurs.
995    pub fn send_no_shutdown_on_err(self, mut values: &[Option<String>]) -> Result<(), fidl::Error> {
996        let _result = self.send_raw(values);
997        self.drop_without_shutdown();
998        _result
999    }
1000
1001    fn send_raw(&self, mut values: &[Option<String>]) -> Result<(), fidl::Error> {
1002        self.control_handle.inner.send::<ArgumentsGetStringsResponse>(
1003            (values,),
1004            self.tx_id,
1005            0x328fb6b545aa96f7,
1006            fidl::encoding::DynamicFlags::empty(),
1007        )
1008    }
1009}
1010
1011#[must_use = "FIDL methods require a response to be sent"]
1012#[derive(Debug)]
1013pub struct ArgumentsGetBoolResponder {
1014    control_handle: std::mem::ManuallyDrop<ArgumentsControlHandle>,
1015    tx_id: u32,
1016}
1017
1018/// Set the the channel to be shutdown (see [`ArgumentsControlHandle::shutdown`])
1019/// if the responder is dropped without sending a response, so that the client
1020/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1021impl std::ops::Drop for ArgumentsGetBoolResponder {
1022    fn drop(&mut self) {
1023        self.control_handle.shutdown();
1024        // Safety: drops once, never accessed again
1025        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1026    }
1027}
1028
1029impl fidl::endpoints::Responder for ArgumentsGetBoolResponder {
1030    type ControlHandle = ArgumentsControlHandle;
1031
1032    fn control_handle(&self) -> &ArgumentsControlHandle {
1033        &self.control_handle
1034    }
1035
1036    fn drop_without_shutdown(mut self) {
1037        // Safety: drops once, never accessed again due to mem::forget
1038        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1039        // Prevent Drop from running (which would shut down the channel)
1040        std::mem::forget(self);
1041    }
1042}
1043
1044impl ArgumentsGetBoolResponder {
1045    /// Sends a response to the FIDL transaction.
1046    ///
1047    /// Sets the channel to shutdown if an error occurs.
1048    pub fn send(self, mut value: bool) -> Result<(), fidl::Error> {
1049        let _result = self.send_raw(value);
1050        if _result.is_err() {
1051            self.control_handle.shutdown();
1052        }
1053        self.drop_without_shutdown();
1054        _result
1055    }
1056
1057    /// Similar to "send" but does not shutdown the channel if an error occurs.
1058    pub fn send_no_shutdown_on_err(self, mut value: bool) -> Result<(), fidl::Error> {
1059        let _result = self.send_raw(value);
1060        self.drop_without_shutdown();
1061        _result
1062    }
1063
1064    fn send_raw(&self, mut value: bool) -> Result<(), fidl::Error> {
1065        self.control_handle.inner.send::<ArgumentsGetBoolResponse>(
1066            (value,),
1067            self.tx_id,
1068            0x4c5dd3149815cccd,
1069            fidl::encoding::DynamicFlags::empty(),
1070        )
1071    }
1072}
1073
1074#[must_use = "FIDL methods require a response to be sent"]
1075#[derive(Debug)]
1076pub struct ArgumentsGetBoolsResponder {
1077    control_handle: std::mem::ManuallyDrop<ArgumentsControlHandle>,
1078    tx_id: u32,
1079}
1080
1081/// Set the the channel to be shutdown (see [`ArgumentsControlHandle::shutdown`])
1082/// if the responder is dropped without sending a response, so that the client
1083/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1084impl std::ops::Drop for ArgumentsGetBoolsResponder {
1085    fn drop(&mut self) {
1086        self.control_handle.shutdown();
1087        // Safety: drops once, never accessed again
1088        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1089    }
1090}
1091
1092impl fidl::endpoints::Responder for ArgumentsGetBoolsResponder {
1093    type ControlHandle = ArgumentsControlHandle;
1094
1095    fn control_handle(&self) -> &ArgumentsControlHandle {
1096        &self.control_handle
1097    }
1098
1099    fn drop_without_shutdown(mut self) {
1100        // Safety: drops once, never accessed again due to mem::forget
1101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1102        // Prevent Drop from running (which would shut down the channel)
1103        std::mem::forget(self);
1104    }
1105}
1106
1107impl ArgumentsGetBoolsResponder {
1108    /// Sends a response to the FIDL transaction.
1109    ///
1110    /// Sets the channel to shutdown if an error occurs.
1111    pub fn send(self, mut values: &[bool]) -> Result<(), fidl::Error> {
1112        let _result = self.send_raw(values);
1113        if _result.is_err() {
1114            self.control_handle.shutdown();
1115        }
1116        self.drop_without_shutdown();
1117        _result
1118    }
1119
1120    /// Similar to "send" but does not shutdown the channel if an error occurs.
1121    pub fn send_no_shutdown_on_err(self, mut values: &[bool]) -> Result<(), fidl::Error> {
1122        let _result = self.send_raw(values);
1123        self.drop_without_shutdown();
1124        _result
1125    }
1126
1127    fn send_raw(&self, mut values: &[bool]) -> Result<(), fidl::Error> {
1128        self.control_handle.inner.send::<ArgumentsGetBoolsResponse>(
1129            (values,),
1130            self.tx_id,
1131            0xfcc9fc9a0f22615,
1132            fidl::encoding::DynamicFlags::empty(),
1133        )
1134    }
1135}
1136
1137#[must_use = "FIDL methods require a response to be sent"]
1138#[derive(Debug)]
1139pub struct ArgumentsCollectResponder {
1140    control_handle: std::mem::ManuallyDrop<ArgumentsControlHandle>,
1141    tx_id: u32,
1142}
1143
1144/// Set the the channel to be shutdown (see [`ArgumentsControlHandle::shutdown`])
1145/// if the responder is dropped without sending a response, so that the client
1146/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1147impl std::ops::Drop for ArgumentsCollectResponder {
1148    fn drop(&mut self) {
1149        self.control_handle.shutdown();
1150        // Safety: drops once, never accessed again
1151        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1152    }
1153}
1154
1155impl fidl::endpoints::Responder for ArgumentsCollectResponder {
1156    type ControlHandle = ArgumentsControlHandle;
1157
1158    fn control_handle(&self) -> &ArgumentsControlHandle {
1159        &self.control_handle
1160    }
1161
1162    fn drop_without_shutdown(mut self) {
1163        // Safety: drops once, never accessed again due to mem::forget
1164        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1165        // Prevent Drop from running (which would shut down the channel)
1166        std::mem::forget(self);
1167    }
1168}
1169
1170impl ArgumentsCollectResponder {
1171    /// Sends a response to the FIDL transaction.
1172    ///
1173    /// Sets the channel to shutdown if an error occurs.
1174    pub fn send(self, mut results: &[String]) -> Result<(), fidl::Error> {
1175        let _result = self.send_raw(results);
1176        if _result.is_err() {
1177            self.control_handle.shutdown();
1178        }
1179        self.drop_without_shutdown();
1180        _result
1181    }
1182
1183    /// Similar to "send" but does not shutdown the channel if an error occurs.
1184    pub fn send_no_shutdown_on_err(self, mut results: &[String]) -> Result<(), fidl::Error> {
1185        let _result = self.send_raw(results);
1186        self.drop_without_shutdown();
1187        _result
1188    }
1189
1190    fn send_raw(&self, mut results: &[String]) -> Result<(), fidl::Error> {
1191        self.control_handle.inner.send::<ArgumentsCollectResponse>(
1192            (results,),
1193            self.tx_id,
1194            0x24e5acd864546e30,
1195            fidl::encoding::DynamicFlags::empty(),
1196        )
1197    }
1198}
1199
1200#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1201pub struct FactoryItemsMarker;
1202
1203impl fidl::endpoints::ProtocolMarker for FactoryItemsMarker {
1204    type Proxy = FactoryItemsProxy;
1205    type RequestStream = FactoryItemsRequestStream;
1206    #[cfg(target_os = "fuchsia")]
1207    type SynchronousProxy = FactoryItemsSynchronousProxy;
1208
1209    const DEBUG_NAME: &'static str = "fuchsia.boot.FactoryItems";
1210}
1211impl fidl::endpoints::DiscoverableProtocolMarker for FactoryItemsMarker {}
1212
1213pub trait FactoryItemsProxyInterface: Send + Sync {
1214    type GetResponseFut: std::future::Future<Output = Result<(Option<fidl::Vmo>, u32), fidl::Error>>
1215        + Send;
1216    fn r#get(&self, extra: u32) -> Self::GetResponseFut;
1217}
1218#[derive(Debug)]
1219#[cfg(target_os = "fuchsia")]
1220pub struct FactoryItemsSynchronousProxy {
1221    client: fidl::client::sync::Client,
1222}
1223
1224#[cfg(target_os = "fuchsia")]
1225impl fidl::endpoints::SynchronousProxy for FactoryItemsSynchronousProxy {
1226    type Proxy = FactoryItemsProxy;
1227    type Protocol = FactoryItemsMarker;
1228
1229    fn from_channel(inner: fidl::Channel) -> Self {
1230        Self::new(inner)
1231    }
1232
1233    fn into_channel(self) -> fidl::Channel {
1234        self.client.into_channel()
1235    }
1236
1237    fn as_channel(&self) -> &fidl::Channel {
1238        self.client.as_channel()
1239    }
1240}
1241
1242#[cfg(target_os = "fuchsia")]
1243impl FactoryItemsSynchronousProxy {
1244    pub fn new(channel: fidl::Channel) -> Self {
1245        Self { client: fidl::client::sync::Client::new(channel) }
1246    }
1247
1248    pub fn into_channel(self) -> fidl::Channel {
1249        self.client.into_channel()
1250    }
1251
1252    /// Waits until an event arrives and returns it. It is safe for other
1253    /// threads to make concurrent requests while waiting for an event.
1254    pub fn wait_for_event(
1255        &self,
1256        deadline: zx::MonotonicInstant,
1257    ) -> Result<FactoryItemsEvent, fidl::Error> {
1258        FactoryItemsEvent::decode(self.client.wait_for_event::<FactoryItemsMarker>(deadline)?)
1259    }
1260
1261    /// Gets a `payload` for a `ZBI_TYPE_STORAGE_BOOTFS_FACTORY` boot item with
1262    /// extra field set to `extra`.
1263    ///
1264    /// NOTE: We return the `length` of the item, as VMOs must be page-aligned.
1265    pub fn r#get(
1266        &self,
1267        mut extra: u32,
1268        ___deadline: zx::MonotonicInstant,
1269    ) -> Result<(Option<fidl::Vmo>, u32), fidl::Error> {
1270        let _response = self
1271            .client
1272            .send_query::<FactoryItemsGetRequest, FactoryItemsGetResponse, FactoryItemsMarker>(
1273                (extra,),
1274                0x2f0dcb1aba41b6d9,
1275                fidl::encoding::DynamicFlags::empty(),
1276                ___deadline,
1277            )?;
1278        Ok((_response.payload, _response.length))
1279    }
1280}
1281
1282#[cfg(target_os = "fuchsia")]
1283impl From<FactoryItemsSynchronousProxy> for zx::NullableHandle {
1284    fn from(value: FactoryItemsSynchronousProxy) -> Self {
1285        value.into_channel().into()
1286    }
1287}
1288
1289#[cfg(target_os = "fuchsia")]
1290impl From<fidl::Channel> for FactoryItemsSynchronousProxy {
1291    fn from(value: fidl::Channel) -> Self {
1292        Self::new(value)
1293    }
1294}
1295
1296#[cfg(target_os = "fuchsia")]
1297impl fidl::endpoints::FromClient for FactoryItemsSynchronousProxy {
1298    type Protocol = FactoryItemsMarker;
1299
1300    fn from_client(value: fidl::endpoints::ClientEnd<FactoryItemsMarker>) -> Self {
1301        Self::new(value.into_channel())
1302    }
1303}
1304
1305#[derive(Debug, Clone)]
1306pub struct FactoryItemsProxy {
1307    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1308}
1309
1310impl fidl::endpoints::Proxy for FactoryItemsProxy {
1311    type Protocol = FactoryItemsMarker;
1312
1313    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1314        Self::new(inner)
1315    }
1316
1317    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1318        self.client.into_channel().map_err(|client| Self { client })
1319    }
1320
1321    fn as_channel(&self) -> &::fidl::AsyncChannel {
1322        self.client.as_channel()
1323    }
1324}
1325
1326impl FactoryItemsProxy {
1327    /// Create a new Proxy for fuchsia.boot/FactoryItems.
1328    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1329        let protocol_name = <FactoryItemsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1330        Self { client: fidl::client::Client::new(channel, protocol_name) }
1331    }
1332
1333    /// Get a Stream of events from the remote end of the protocol.
1334    ///
1335    /// # Panics
1336    ///
1337    /// Panics if the event stream was already taken.
1338    pub fn take_event_stream(&self) -> FactoryItemsEventStream {
1339        FactoryItemsEventStream { event_receiver: self.client.take_event_receiver() }
1340    }
1341
1342    /// Gets a `payload` for a `ZBI_TYPE_STORAGE_BOOTFS_FACTORY` boot item with
1343    /// extra field set to `extra`.
1344    ///
1345    /// NOTE: We return the `length` of the item, as VMOs must be page-aligned.
1346    pub fn r#get(
1347        &self,
1348        mut extra: u32,
1349    ) -> fidl::client::QueryResponseFut<
1350        (Option<fidl::Vmo>, u32),
1351        fidl::encoding::DefaultFuchsiaResourceDialect,
1352    > {
1353        FactoryItemsProxyInterface::r#get(self, extra)
1354    }
1355}
1356
1357impl FactoryItemsProxyInterface for FactoryItemsProxy {
1358    type GetResponseFut = fidl::client::QueryResponseFut<
1359        (Option<fidl::Vmo>, u32),
1360        fidl::encoding::DefaultFuchsiaResourceDialect,
1361    >;
1362    fn r#get(&self, mut extra: u32) -> Self::GetResponseFut {
1363        fn _decode(
1364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1365        ) -> Result<(Option<fidl::Vmo>, u32), fidl::Error> {
1366            let _response = fidl::client::decode_transaction_body::<
1367                FactoryItemsGetResponse,
1368                fidl::encoding::DefaultFuchsiaResourceDialect,
1369                0x2f0dcb1aba41b6d9,
1370            >(_buf?)?;
1371            Ok((_response.payload, _response.length))
1372        }
1373        self.client.send_query_and_decode::<FactoryItemsGetRequest, (Option<fidl::Vmo>, u32)>(
1374            (extra,),
1375            0x2f0dcb1aba41b6d9,
1376            fidl::encoding::DynamicFlags::empty(),
1377            _decode,
1378        )
1379    }
1380}
1381
1382pub struct FactoryItemsEventStream {
1383    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1384}
1385
1386impl std::marker::Unpin for FactoryItemsEventStream {}
1387
1388impl futures::stream::FusedStream for FactoryItemsEventStream {
1389    fn is_terminated(&self) -> bool {
1390        self.event_receiver.is_terminated()
1391    }
1392}
1393
1394impl futures::Stream for FactoryItemsEventStream {
1395    type Item = Result<FactoryItemsEvent, fidl::Error>;
1396
1397    fn poll_next(
1398        mut self: std::pin::Pin<&mut Self>,
1399        cx: &mut std::task::Context<'_>,
1400    ) -> std::task::Poll<Option<Self::Item>> {
1401        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1402            &mut self.event_receiver,
1403            cx
1404        )?) {
1405            Some(buf) => std::task::Poll::Ready(Some(FactoryItemsEvent::decode(buf))),
1406            None => std::task::Poll::Ready(None),
1407        }
1408    }
1409}
1410
1411#[derive(Debug)]
1412pub enum FactoryItemsEvent {}
1413
1414impl FactoryItemsEvent {
1415    /// Decodes a message buffer as a [`FactoryItemsEvent`].
1416    fn decode(
1417        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1418    ) -> Result<FactoryItemsEvent, fidl::Error> {
1419        let (bytes, _handles) = buf.split_mut();
1420        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1421        debug_assert_eq!(tx_header.tx_id, 0);
1422        match tx_header.ordinal {
1423            _ => Err(fidl::Error::UnknownOrdinal {
1424                ordinal: tx_header.ordinal,
1425                protocol_name: <FactoryItemsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1426            }),
1427        }
1428    }
1429}
1430
1431/// A Stream of incoming requests for fuchsia.boot/FactoryItems.
1432pub struct FactoryItemsRequestStream {
1433    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1434    is_terminated: bool,
1435}
1436
1437impl std::marker::Unpin for FactoryItemsRequestStream {}
1438
1439impl futures::stream::FusedStream for FactoryItemsRequestStream {
1440    fn is_terminated(&self) -> bool {
1441        self.is_terminated
1442    }
1443}
1444
1445impl fidl::endpoints::RequestStream for FactoryItemsRequestStream {
1446    type Protocol = FactoryItemsMarker;
1447    type ControlHandle = FactoryItemsControlHandle;
1448
1449    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1450        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1451    }
1452
1453    fn control_handle(&self) -> Self::ControlHandle {
1454        FactoryItemsControlHandle { inner: self.inner.clone() }
1455    }
1456
1457    fn into_inner(
1458        self,
1459    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1460    {
1461        (self.inner, self.is_terminated)
1462    }
1463
1464    fn from_inner(
1465        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1466        is_terminated: bool,
1467    ) -> Self {
1468        Self { inner, is_terminated }
1469    }
1470}
1471
1472impl futures::Stream for FactoryItemsRequestStream {
1473    type Item = Result<FactoryItemsRequest, fidl::Error>;
1474
1475    fn poll_next(
1476        mut self: std::pin::Pin<&mut Self>,
1477        cx: &mut std::task::Context<'_>,
1478    ) -> std::task::Poll<Option<Self::Item>> {
1479        let this = &mut *self;
1480        if this.inner.check_shutdown(cx) {
1481            this.is_terminated = true;
1482            return std::task::Poll::Ready(None);
1483        }
1484        if this.is_terminated {
1485            panic!("polled FactoryItemsRequestStream after completion");
1486        }
1487        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1488            |bytes, handles| {
1489                match this.inner.channel().read_etc(cx, bytes, handles) {
1490                    std::task::Poll::Ready(Ok(())) => {}
1491                    std::task::Poll::Pending => return std::task::Poll::Pending,
1492                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1493                        this.is_terminated = true;
1494                        return std::task::Poll::Ready(None);
1495                    }
1496                    std::task::Poll::Ready(Err(e)) => {
1497                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1498                            e.into(),
1499                        ))));
1500                    }
1501                }
1502
1503                // A message has been received from the channel
1504                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1505
1506                std::task::Poll::Ready(Some(match header.ordinal {
1507                    0x2f0dcb1aba41b6d9 => {
1508                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1509                        let mut req = fidl::new_empty!(
1510                            FactoryItemsGetRequest,
1511                            fidl::encoding::DefaultFuchsiaResourceDialect
1512                        );
1513                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryItemsGetRequest>(&header, _body_bytes, handles, &mut req)?;
1514                        let control_handle =
1515                            FactoryItemsControlHandle { inner: this.inner.clone() };
1516                        Ok(FactoryItemsRequest::Get {
1517                            extra: req.extra,
1518
1519                            responder: FactoryItemsGetResponder {
1520                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1521                                tx_id: header.tx_id,
1522                            },
1523                        })
1524                    }
1525                    _ => Err(fidl::Error::UnknownOrdinal {
1526                        ordinal: header.ordinal,
1527                        protocol_name:
1528                            <FactoryItemsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1529                    }),
1530                }))
1531            },
1532        )
1533    }
1534}
1535
1536/// Protocol for retrieving factory boot item payloads.
1537#[derive(Debug)]
1538pub enum FactoryItemsRequest {
1539    /// Gets a `payload` for a `ZBI_TYPE_STORAGE_BOOTFS_FACTORY` boot item with
1540    /// extra field set to `extra`.
1541    ///
1542    /// NOTE: We return the `length` of the item, as VMOs must be page-aligned.
1543    Get { extra: u32, responder: FactoryItemsGetResponder },
1544}
1545
1546impl FactoryItemsRequest {
1547    #[allow(irrefutable_let_patterns)]
1548    pub fn into_get(self) -> Option<(u32, FactoryItemsGetResponder)> {
1549        if let FactoryItemsRequest::Get { extra, responder } = self {
1550            Some((extra, responder))
1551        } else {
1552            None
1553        }
1554    }
1555
1556    /// Name of the method defined in FIDL
1557    pub fn method_name(&self) -> &'static str {
1558        match *self {
1559            FactoryItemsRequest::Get { .. } => "get",
1560        }
1561    }
1562}
1563
1564#[derive(Debug, Clone)]
1565pub struct FactoryItemsControlHandle {
1566    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1567}
1568
1569impl FactoryItemsControlHandle {
1570    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1571        self.inner.shutdown_with_epitaph(status.into())
1572    }
1573}
1574
1575impl fidl::endpoints::ControlHandle for FactoryItemsControlHandle {
1576    fn shutdown(&self) {
1577        self.inner.shutdown()
1578    }
1579
1580    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1581        self.inner.shutdown_with_epitaph(status)
1582    }
1583
1584    fn is_closed(&self) -> bool {
1585        self.inner.channel().is_closed()
1586    }
1587    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1588        self.inner.channel().on_closed()
1589    }
1590
1591    #[cfg(target_os = "fuchsia")]
1592    fn signal_peer(
1593        &self,
1594        clear_mask: zx::Signals,
1595        set_mask: zx::Signals,
1596    ) -> Result<(), zx_status::Status> {
1597        use fidl::Peered;
1598        self.inner.channel().signal_peer(clear_mask, set_mask)
1599    }
1600}
1601
1602impl FactoryItemsControlHandle {}
1603
1604#[must_use = "FIDL methods require a response to be sent"]
1605#[derive(Debug)]
1606pub struct FactoryItemsGetResponder {
1607    control_handle: std::mem::ManuallyDrop<FactoryItemsControlHandle>,
1608    tx_id: u32,
1609}
1610
1611/// Set the the channel to be shutdown (see [`FactoryItemsControlHandle::shutdown`])
1612/// if the responder is dropped without sending a response, so that the client
1613/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1614impl std::ops::Drop for FactoryItemsGetResponder {
1615    fn drop(&mut self) {
1616        self.control_handle.shutdown();
1617        // Safety: drops once, never accessed again
1618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1619    }
1620}
1621
1622impl fidl::endpoints::Responder for FactoryItemsGetResponder {
1623    type ControlHandle = FactoryItemsControlHandle;
1624
1625    fn control_handle(&self) -> &FactoryItemsControlHandle {
1626        &self.control_handle
1627    }
1628
1629    fn drop_without_shutdown(mut self) {
1630        // Safety: drops once, never accessed again due to mem::forget
1631        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1632        // Prevent Drop from running (which would shut down the channel)
1633        std::mem::forget(self);
1634    }
1635}
1636
1637impl FactoryItemsGetResponder {
1638    /// Sends a response to the FIDL transaction.
1639    ///
1640    /// Sets the channel to shutdown if an error occurs.
1641    pub fn send(self, mut payload: Option<fidl::Vmo>, mut length: u32) -> Result<(), fidl::Error> {
1642        let _result = self.send_raw(payload, length);
1643        if _result.is_err() {
1644            self.control_handle.shutdown();
1645        }
1646        self.drop_without_shutdown();
1647        _result
1648    }
1649
1650    /// Similar to "send" but does not shutdown the channel if an error occurs.
1651    pub fn send_no_shutdown_on_err(
1652        self,
1653        mut payload: Option<fidl::Vmo>,
1654        mut length: u32,
1655    ) -> Result<(), fidl::Error> {
1656        let _result = self.send_raw(payload, length);
1657        self.drop_without_shutdown();
1658        _result
1659    }
1660
1661    fn send_raw(&self, mut payload: Option<fidl::Vmo>, mut length: u32) -> Result<(), fidl::Error> {
1662        self.control_handle.inner.send::<FactoryItemsGetResponse>(
1663            (payload, length),
1664            self.tx_id,
1665            0x2f0dcb1aba41b6d9,
1666            fidl::encoding::DynamicFlags::empty(),
1667        )
1668    }
1669}
1670
1671#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1672pub struct ItemsMarker;
1673
1674impl fidl::endpoints::ProtocolMarker for ItemsMarker {
1675    type Proxy = ItemsProxy;
1676    type RequestStream = ItemsRequestStream;
1677    #[cfg(target_os = "fuchsia")]
1678    type SynchronousProxy = ItemsSynchronousProxy;
1679
1680    const DEBUG_NAME: &'static str = "fuchsia.boot.Items";
1681}
1682impl fidl::endpoints::DiscoverableProtocolMarker for ItemsMarker {}
1683pub type ItemsGet2Result = Result<Vec<RetrievedItems>, i32>;
1684
1685pub trait ItemsProxyInterface: Send + Sync {
1686    type GetResponseFut: std::future::Future<Output = Result<(Option<fidl::Vmo>, u32), fidl::Error>>
1687        + Send;
1688    fn r#get(&self, type_: u32, extra: u32) -> Self::GetResponseFut;
1689    type Get2ResponseFut: std::future::Future<Output = Result<ItemsGet2Result, fidl::Error>> + Send;
1690    fn r#get2(&self, type_: u32, extra: Option<&Extra>) -> Self::Get2ResponseFut;
1691    type GetBootloaderFileResponseFut: std::future::Future<Output = Result<Option<fidl::Vmo>, fidl::Error>>
1692        + Send;
1693    fn r#get_bootloader_file(&self, filename: &str) -> Self::GetBootloaderFileResponseFut;
1694}
1695#[derive(Debug)]
1696#[cfg(target_os = "fuchsia")]
1697pub struct ItemsSynchronousProxy {
1698    client: fidl::client::sync::Client,
1699}
1700
1701#[cfg(target_os = "fuchsia")]
1702impl fidl::endpoints::SynchronousProxy for ItemsSynchronousProxy {
1703    type Proxy = ItemsProxy;
1704    type Protocol = ItemsMarker;
1705
1706    fn from_channel(inner: fidl::Channel) -> Self {
1707        Self::new(inner)
1708    }
1709
1710    fn into_channel(self) -> fidl::Channel {
1711        self.client.into_channel()
1712    }
1713
1714    fn as_channel(&self) -> &fidl::Channel {
1715        self.client.as_channel()
1716    }
1717}
1718
1719#[cfg(target_os = "fuchsia")]
1720impl ItemsSynchronousProxy {
1721    pub fn new(channel: fidl::Channel) -> Self {
1722        Self { client: fidl::client::sync::Client::new(channel) }
1723    }
1724
1725    pub fn into_channel(self) -> fidl::Channel {
1726        self.client.into_channel()
1727    }
1728
1729    /// Waits until an event arrives and returns it. It is safe for other
1730    /// threads to make concurrent requests while waiting for an event.
1731    pub fn wait_for_event(
1732        &self,
1733        deadline: zx::MonotonicInstant,
1734    ) -> Result<ItemsEvent, fidl::Error> {
1735        ItemsEvent::decode(self.client.wait_for_event::<ItemsMarker>(deadline)?)
1736    }
1737
1738    /// Get a `payload` for a boot item of `type` and `extra`.
1739    /// NOTE: We return the `length` of the item, as VMOs must be page-aligned.
1740    ///
1741    /// TODO: Refactor API: https://fxbug.dev/42109921
1742    ///
1743    /// For a list of `type`s, refer to <lib/zbi-format/zbi.h>.
1744    /// For a list of `extra`s, refer to <lib/zbi-format/driver-config.h>.
1745    pub fn r#get(
1746        &self,
1747        mut type_: u32,
1748        mut extra: u32,
1749        ___deadline: zx::MonotonicInstant,
1750    ) -> Result<(Option<fidl::Vmo>, u32), fidl::Error> {
1751        let _response = self.client.send_query::<ItemsGetRequest, ItemsGetResponse, ItemsMarker>(
1752            (type_, extra),
1753            0x542db3f176641edc,
1754            fidl::encoding::DynamicFlags::empty(),
1755            ___deadline,
1756        )?;
1757        Ok((_response.payload, _response.length))
1758    }
1759
1760    /// Get all stored items of `type`, optionally also restricted by `extra`. Note that
1761    /// length is returned for each item as VMOs are page-aligned.
1762    ///
1763    /// Returns ZX_ERR_NOT_SUPPORTED if this is an untracked item which will never be stored.
1764    pub fn r#get2(
1765        &self,
1766        mut type_: u32,
1767        mut extra: Option<&Extra>,
1768        ___deadline: zx::MonotonicInstant,
1769    ) -> Result<ItemsGet2Result, fidl::Error> {
1770        let _response = self.client.send_query::<
1771            ItemsGet2Request,
1772            fidl::encoding::ResultType<ItemsGet2Response, i32>,
1773            ItemsMarker,
1774        >(
1775            (type_, extra,),
1776            0x2a64bd32f9ba3f2e,
1777            fidl::encoding::DynamicFlags::empty(),
1778            ___deadline,
1779        )?;
1780        Ok(_response.map(|x| x.retrieved_items))
1781    }
1782
1783    /// Gets the `payload` for a `ZBI_TYPE_BOOTLOADER_FILE` boot item.
1784    /// Note: ZX_PROP_VMO_CONTENT_SIZE will be set to the actual file content size
1785    pub fn r#get_bootloader_file(
1786        &self,
1787        mut filename: &str,
1788        ___deadline: zx::MonotonicInstant,
1789    ) -> Result<Option<fidl::Vmo>, fidl::Error> {
1790        let _response = self.client.send_query::<
1791            ItemsGetBootloaderFileRequest,
1792            ItemsGetBootloaderFileResponse,
1793            ItemsMarker,
1794        >(
1795            (filename,),
1796            0x5a004db3c9378e8c,
1797            fidl::encoding::DynamicFlags::empty(),
1798            ___deadline,
1799        )?;
1800        Ok(_response.payload)
1801    }
1802}
1803
1804#[cfg(target_os = "fuchsia")]
1805impl From<ItemsSynchronousProxy> for zx::NullableHandle {
1806    fn from(value: ItemsSynchronousProxy) -> Self {
1807        value.into_channel().into()
1808    }
1809}
1810
1811#[cfg(target_os = "fuchsia")]
1812impl From<fidl::Channel> for ItemsSynchronousProxy {
1813    fn from(value: fidl::Channel) -> Self {
1814        Self::new(value)
1815    }
1816}
1817
1818#[cfg(target_os = "fuchsia")]
1819impl fidl::endpoints::FromClient for ItemsSynchronousProxy {
1820    type Protocol = ItemsMarker;
1821
1822    fn from_client(value: fidl::endpoints::ClientEnd<ItemsMarker>) -> Self {
1823        Self::new(value.into_channel())
1824    }
1825}
1826
1827#[derive(Debug, Clone)]
1828pub struct ItemsProxy {
1829    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1830}
1831
1832impl fidl::endpoints::Proxy for ItemsProxy {
1833    type Protocol = ItemsMarker;
1834
1835    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1836        Self::new(inner)
1837    }
1838
1839    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1840        self.client.into_channel().map_err(|client| Self { client })
1841    }
1842
1843    fn as_channel(&self) -> &::fidl::AsyncChannel {
1844        self.client.as_channel()
1845    }
1846}
1847
1848impl ItemsProxy {
1849    /// Create a new Proxy for fuchsia.boot/Items.
1850    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1851        let protocol_name = <ItemsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1852        Self { client: fidl::client::Client::new(channel, protocol_name) }
1853    }
1854
1855    /// Get a Stream of events from the remote end of the protocol.
1856    ///
1857    /// # Panics
1858    ///
1859    /// Panics if the event stream was already taken.
1860    pub fn take_event_stream(&self) -> ItemsEventStream {
1861        ItemsEventStream { event_receiver: self.client.take_event_receiver() }
1862    }
1863
1864    /// Get a `payload` for a boot item of `type` and `extra`.
1865    /// NOTE: We return the `length` of the item, as VMOs must be page-aligned.
1866    ///
1867    /// TODO: Refactor API: https://fxbug.dev/42109921
1868    ///
1869    /// For a list of `type`s, refer to <lib/zbi-format/zbi.h>.
1870    /// For a list of `extra`s, refer to <lib/zbi-format/driver-config.h>.
1871    pub fn r#get(
1872        &self,
1873        mut type_: u32,
1874        mut extra: u32,
1875    ) -> fidl::client::QueryResponseFut<
1876        (Option<fidl::Vmo>, u32),
1877        fidl::encoding::DefaultFuchsiaResourceDialect,
1878    > {
1879        ItemsProxyInterface::r#get(self, type_, extra)
1880    }
1881
1882    /// Get all stored items of `type`, optionally also restricted by `extra`. Note that
1883    /// length is returned for each item as VMOs are page-aligned.
1884    ///
1885    /// Returns ZX_ERR_NOT_SUPPORTED if this is an untracked item which will never be stored.
1886    pub fn r#get2(
1887        &self,
1888        mut type_: u32,
1889        mut extra: Option<&Extra>,
1890    ) -> fidl::client::QueryResponseFut<
1891        ItemsGet2Result,
1892        fidl::encoding::DefaultFuchsiaResourceDialect,
1893    > {
1894        ItemsProxyInterface::r#get2(self, type_, extra)
1895    }
1896
1897    /// Gets the `payload` for a `ZBI_TYPE_BOOTLOADER_FILE` boot item.
1898    /// Note: ZX_PROP_VMO_CONTENT_SIZE will be set to the actual file content size
1899    pub fn r#get_bootloader_file(
1900        &self,
1901        mut filename: &str,
1902    ) -> fidl::client::QueryResponseFut<
1903        Option<fidl::Vmo>,
1904        fidl::encoding::DefaultFuchsiaResourceDialect,
1905    > {
1906        ItemsProxyInterface::r#get_bootloader_file(self, filename)
1907    }
1908}
1909
1910impl ItemsProxyInterface for ItemsProxy {
1911    type GetResponseFut = fidl::client::QueryResponseFut<
1912        (Option<fidl::Vmo>, u32),
1913        fidl::encoding::DefaultFuchsiaResourceDialect,
1914    >;
1915    fn r#get(&self, mut type_: u32, mut extra: u32) -> Self::GetResponseFut {
1916        fn _decode(
1917            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1918        ) -> Result<(Option<fidl::Vmo>, u32), fidl::Error> {
1919            let _response = fidl::client::decode_transaction_body::<
1920                ItemsGetResponse,
1921                fidl::encoding::DefaultFuchsiaResourceDialect,
1922                0x542db3f176641edc,
1923            >(_buf?)?;
1924            Ok((_response.payload, _response.length))
1925        }
1926        self.client.send_query_and_decode::<ItemsGetRequest, (Option<fidl::Vmo>, u32)>(
1927            (type_, extra),
1928            0x542db3f176641edc,
1929            fidl::encoding::DynamicFlags::empty(),
1930            _decode,
1931        )
1932    }
1933
1934    type Get2ResponseFut = fidl::client::QueryResponseFut<
1935        ItemsGet2Result,
1936        fidl::encoding::DefaultFuchsiaResourceDialect,
1937    >;
1938    fn r#get2(&self, mut type_: u32, mut extra: Option<&Extra>) -> Self::Get2ResponseFut {
1939        fn _decode(
1940            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1941        ) -> Result<ItemsGet2Result, fidl::Error> {
1942            let _response = fidl::client::decode_transaction_body::<
1943                fidl::encoding::ResultType<ItemsGet2Response, i32>,
1944                fidl::encoding::DefaultFuchsiaResourceDialect,
1945                0x2a64bd32f9ba3f2e,
1946            >(_buf?)?;
1947            Ok(_response.map(|x| x.retrieved_items))
1948        }
1949        self.client.send_query_and_decode::<ItemsGet2Request, ItemsGet2Result>(
1950            (type_, extra),
1951            0x2a64bd32f9ba3f2e,
1952            fidl::encoding::DynamicFlags::empty(),
1953            _decode,
1954        )
1955    }
1956
1957    type GetBootloaderFileResponseFut = fidl::client::QueryResponseFut<
1958        Option<fidl::Vmo>,
1959        fidl::encoding::DefaultFuchsiaResourceDialect,
1960    >;
1961    fn r#get_bootloader_file(&self, mut filename: &str) -> Self::GetBootloaderFileResponseFut {
1962        fn _decode(
1963            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1964        ) -> Result<Option<fidl::Vmo>, fidl::Error> {
1965            let _response = fidl::client::decode_transaction_body::<
1966                ItemsGetBootloaderFileResponse,
1967                fidl::encoding::DefaultFuchsiaResourceDialect,
1968                0x5a004db3c9378e8c,
1969            >(_buf?)?;
1970            Ok(_response.payload)
1971        }
1972        self.client.send_query_and_decode::<ItemsGetBootloaderFileRequest, Option<fidl::Vmo>>(
1973            (filename,),
1974            0x5a004db3c9378e8c,
1975            fidl::encoding::DynamicFlags::empty(),
1976            _decode,
1977        )
1978    }
1979}
1980
1981pub struct ItemsEventStream {
1982    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1983}
1984
1985impl std::marker::Unpin for ItemsEventStream {}
1986
1987impl futures::stream::FusedStream for ItemsEventStream {
1988    fn is_terminated(&self) -> bool {
1989        self.event_receiver.is_terminated()
1990    }
1991}
1992
1993impl futures::Stream for ItemsEventStream {
1994    type Item = Result<ItemsEvent, fidl::Error>;
1995
1996    fn poll_next(
1997        mut self: std::pin::Pin<&mut Self>,
1998        cx: &mut std::task::Context<'_>,
1999    ) -> std::task::Poll<Option<Self::Item>> {
2000        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2001            &mut self.event_receiver,
2002            cx
2003        )?) {
2004            Some(buf) => std::task::Poll::Ready(Some(ItemsEvent::decode(buf))),
2005            None => std::task::Poll::Ready(None),
2006        }
2007    }
2008}
2009
2010#[derive(Debug)]
2011pub enum ItemsEvent {}
2012
2013impl ItemsEvent {
2014    /// Decodes a message buffer as a [`ItemsEvent`].
2015    fn decode(
2016        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2017    ) -> Result<ItemsEvent, fidl::Error> {
2018        let (bytes, _handles) = buf.split_mut();
2019        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2020        debug_assert_eq!(tx_header.tx_id, 0);
2021        match tx_header.ordinal {
2022            _ => Err(fidl::Error::UnknownOrdinal {
2023                ordinal: tx_header.ordinal,
2024                protocol_name: <ItemsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2025            }),
2026        }
2027    }
2028}
2029
2030/// A Stream of incoming requests for fuchsia.boot/Items.
2031pub struct ItemsRequestStream {
2032    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2033    is_terminated: bool,
2034}
2035
2036impl std::marker::Unpin for ItemsRequestStream {}
2037
2038impl futures::stream::FusedStream for ItemsRequestStream {
2039    fn is_terminated(&self) -> bool {
2040        self.is_terminated
2041    }
2042}
2043
2044impl fidl::endpoints::RequestStream for ItemsRequestStream {
2045    type Protocol = ItemsMarker;
2046    type ControlHandle = ItemsControlHandle;
2047
2048    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2049        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2050    }
2051
2052    fn control_handle(&self) -> Self::ControlHandle {
2053        ItemsControlHandle { inner: self.inner.clone() }
2054    }
2055
2056    fn into_inner(
2057        self,
2058    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2059    {
2060        (self.inner, self.is_terminated)
2061    }
2062
2063    fn from_inner(
2064        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2065        is_terminated: bool,
2066    ) -> Self {
2067        Self { inner, is_terminated }
2068    }
2069}
2070
2071impl futures::Stream for ItemsRequestStream {
2072    type Item = Result<ItemsRequest, fidl::Error>;
2073
2074    fn poll_next(
2075        mut self: std::pin::Pin<&mut Self>,
2076        cx: &mut std::task::Context<'_>,
2077    ) -> std::task::Poll<Option<Self::Item>> {
2078        let this = &mut *self;
2079        if this.inner.check_shutdown(cx) {
2080            this.is_terminated = true;
2081            return std::task::Poll::Ready(None);
2082        }
2083        if this.is_terminated {
2084            panic!("polled ItemsRequestStream after completion");
2085        }
2086        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2087            |bytes, handles| {
2088                match this.inner.channel().read_etc(cx, bytes, handles) {
2089                    std::task::Poll::Ready(Ok(())) => {}
2090                    std::task::Poll::Pending => return std::task::Poll::Pending,
2091                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2092                        this.is_terminated = true;
2093                        return std::task::Poll::Ready(None);
2094                    }
2095                    std::task::Poll::Ready(Err(e)) => {
2096                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2097                            e.into(),
2098                        ))));
2099                    }
2100                }
2101
2102                // A message has been received from the channel
2103                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2104
2105                std::task::Poll::Ready(Some(match header.ordinal {
2106                    0x542db3f176641edc => {
2107                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2108                        let mut req = fidl::new_empty!(
2109                            ItemsGetRequest,
2110                            fidl::encoding::DefaultFuchsiaResourceDialect
2111                        );
2112                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ItemsGetRequest>(&header, _body_bytes, handles, &mut req)?;
2113                        let control_handle = ItemsControlHandle { inner: this.inner.clone() };
2114                        Ok(ItemsRequest::Get {
2115                            type_: req.type_,
2116                            extra: req.extra,
2117
2118                            responder: ItemsGetResponder {
2119                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2120                                tx_id: header.tx_id,
2121                            },
2122                        })
2123                    }
2124                    0x2a64bd32f9ba3f2e => {
2125                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2126                        let mut req = fidl::new_empty!(
2127                            ItemsGet2Request,
2128                            fidl::encoding::DefaultFuchsiaResourceDialect
2129                        );
2130                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ItemsGet2Request>(&header, _body_bytes, handles, &mut req)?;
2131                        let control_handle = ItemsControlHandle { inner: this.inner.clone() };
2132                        Ok(ItemsRequest::Get2 {
2133                            type_: req.type_,
2134                            extra: req.extra,
2135
2136                            responder: ItemsGet2Responder {
2137                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2138                                tx_id: header.tx_id,
2139                            },
2140                        })
2141                    }
2142                    0x5a004db3c9378e8c => {
2143                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2144                        let mut req = fidl::new_empty!(
2145                            ItemsGetBootloaderFileRequest,
2146                            fidl::encoding::DefaultFuchsiaResourceDialect
2147                        );
2148                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ItemsGetBootloaderFileRequest>(&header, _body_bytes, handles, &mut req)?;
2149                        let control_handle = ItemsControlHandle { inner: this.inner.clone() };
2150                        Ok(ItemsRequest::GetBootloaderFile {
2151                            filename: req.filename,
2152
2153                            responder: ItemsGetBootloaderFileResponder {
2154                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2155                                tx_id: header.tx_id,
2156                            },
2157                        })
2158                    }
2159                    _ => Err(fidl::Error::UnknownOrdinal {
2160                        ordinal: header.ordinal,
2161                        protocol_name: <ItemsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2162                    }),
2163                }))
2164            },
2165        )
2166    }
2167}
2168
2169/// Protocol for retrieving boot item payloads.
2170#[derive(Debug)]
2171pub enum ItemsRequest {
2172    /// Get a `payload` for a boot item of `type` and `extra`.
2173    /// NOTE: We return the `length` of the item, as VMOs must be page-aligned.
2174    ///
2175    /// TODO: Refactor API: https://fxbug.dev/42109921
2176    ///
2177    /// For a list of `type`s, refer to <lib/zbi-format/zbi.h>.
2178    /// For a list of `extra`s, refer to <lib/zbi-format/driver-config.h>.
2179    Get { type_: u32, extra: u32, responder: ItemsGetResponder },
2180    /// Get all stored items of `type`, optionally also restricted by `extra`. Note that
2181    /// length is returned for each item as VMOs are page-aligned.
2182    ///
2183    /// Returns ZX_ERR_NOT_SUPPORTED if this is an untracked item which will never be stored.
2184    Get2 { type_: u32, extra: Option<Box<Extra>>, responder: ItemsGet2Responder },
2185    /// Gets the `payload` for a `ZBI_TYPE_BOOTLOADER_FILE` boot item.
2186    /// Note: ZX_PROP_VMO_CONTENT_SIZE will be set to the actual file content size
2187    GetBootloaderFile { filename: String, responder: ItemsGetBootloaderFileResponder },
2188}
2189
2190impl ItemsRequest {
2191    #[allow(irrefutable_let_patterns)]
2192    pub fn into_get(self) -> Option<(u32, u32, ItemsGetResponder)> {
2193        if let ItemsRequest::Get { type_, extra, responder } = self {
2194            Some((type_, extra, responder))
2195        } else {
2196            None
2197        }
2198    }
2199
2200    #[allow(irrefutable_let_patterns)]
2201    pub fn into_get2(self) -> Option<(u32, Option<Box<Extra>>, ItemsGet2Responder)> {
2202        if let ItemsRequest::Get2 { type_, extra, responder } = self {
2203            Some((type_, extra, responder))
2204        } else {
2205            None
2206        }
2207    }
2208
2209    #[allow(irrefutable_let_patterns)]
2210    pub fn into_get_bootloader_file(self) -> Option<(String, ItemsGetBootloaderFileResponder)> {
2211        if let ItemsRequest::GetBootloaderFile { filename, responder } = self {
2212            Some((filename, responder))
2213        } else {
2214            None
2215        }
2216    }
2217
2218    /// Name of the method defined in FIDL
2219    pub fn method_name(&self) -> &'static str {
2220        match *self {
2221            ItemsRequest::Get { .. } => "get",
2222            ItemsRequest::Get2 { .. } => "get2",
2223            ItemsRequest::GetBootloaderFile { .. } => "get_bootloader_file",
2224        }
2225    }
2226}
2227
2228#[derive(Debug, Clone)]
2229pub struct ItemsControlHandle {
2230    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2231}
2232
2233impl ItemsControlHandle {
2234    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2235        self.inner.shutdown_with_epitaph(status.into())
2236    }
2237}
2238
2239impl fidl::endpoints::ControlHandle for ItemsControlHandle {
2240    fn shutdown(&self) {
2241        self.inner.shutdown()
2242    }
2243
2244    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2245        self.inner.shutdown_with_epitaph(status)
2246    }
2247
2248    fn is_closed(&self) -> bool {
2249        self.inner.channel().is_closed()
2250    }
2251    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2252        self.inner.channel().on_closed()
2253    }
2254
2255    #[cfg(target_os = "fuchsia")]
2256    fn signal_peer(
2257        &self,
2258        clear_mask: zx::Signals,
2259        set_mask: zx::Signals,
2260    ) -> Result<(), zx_status::Status> {
2261        use fidl::Peered;
2262        self.inner.channel().signal_peer(clear_mask, set_mask)
2263    }
2264}
2265
2266impl ItemsControlHandle {}
2267
2268#[must_use = "FIDL methods require a response to be sent"]
2269#[derive(Debug)]
2270pub struct ItemsGetResponder {
2271    control_handle: std::mem::ManuallyDrop<ItemsControlHandle>,
2272    tx_id: u32,
2273}
2274
2275/// Set the the channel to be shutdown (see [`ItemsControlHandle::shutdown`])
2276/// if the responder is dropped without sending a response, so that the client
2277/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2278impl std::ops::Drop for ItemsGetResponder {
2279    fn drop(&mut self) {
2280        self.control_handle.shutdown();
2281        // Safety: drops once, never accessed again
2282        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2283    }
2284}
2285
2286impl fidl::endpoints::Responder for ItemsGetResponder {
2287    type ControlHandle = ItemsControlHandle;
2288
2289    fn control_handle(&self) -> &ItemsControlHandle {
2290        &self.control_handle
2291    }
2292
2293    fn drop_without_shutdown(mut self) {
2294        // Safety: drops once, never accessed again due to mem::forget
2295        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2296        // Prevent Drop from running (which would shut down the channel)
2297        std::mem::forget(self);
2298    }
2299}
2300
2301impl ItemsGetResponder {
2302    /// Sends a response to the FIDL transaction.
2303    ///
2304    /// Sets the channel to shutdown if an error occurs.
2305    pub fn send(self, mut payload: Option<fidl::Vmo>, mut length: u32) -> Result<(), fidl::Error> {
2306        let _result = self.send_raw(payload, length);
2307        if _result.is_err() {
2308            self.control_handle.shutdown();
2309        }
2310        self.drop_without_shutdown();
2311        _result
2312    }
2313
2314    /// Similar to "send" but does not shutdown the channel if an error occurs.
2315    pub fn send_no_shutdown_on_err(
2316        self,
2317        mut payload: Option<fidl::Vmo>,
2318        mut length: u32,
2319    ) -> Result<(), fidl::Error> {
2320        let _result = self.send_raw(payload, length);
2321        self.drop_without_shutdown();
2322        _result
2323    }
2324
2325    fn send_raw(&self, mut payload: Option<fidl::Vmo>, mut length: u32) -> Result<(), fidl::Error> {
2326        self.control_handle.inner.send::<ItemsGetResponse>(
2327            (payload, length),
2328            self.tx_id,
2329            0x542db3f176641edc,
2330            fidl::encoding::DynamicFlags::empty(),
2331        )
2332    }
2333}
2334
2335#[must_use = "FIDL methods require a response to be sent"]
2336#[derive(Debug)]
2337pub struct ItemsGet2Responder {
2338    control_handle: std::mem::ManuallyDrop<ItemsControlHandle>,
2339    tx_id: u32,
2340}
2341
2342/// Set the the channel to be shutdown (see [`ItemsControlHandle::shutdown`])
2343/// if the responder is dropped without sending a response, so that the client
2344/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2345impl std::ops::Drop for ItemsGet2Responder {
2346    fn drop(&mut self) {
2347        self.control_handle.shutdown();
2348        // Safety: drops once, never accessed again
2349        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2350    }
2351}
2352
2353impl fidl::endpoints::Responder for ItemsGet2Responder {
2354    type ControlHandle = ItemsControlHandle;
2355
2356    fn control_handle(&self) -> &ItemsControlHandle {
2357        &self.control_handle
2358    }
2359
2360    fn drop_without_shutdown(mut self) {
2361        // Safety: drops once, never accessed again due to mem::forget
2362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2363        // Prevent Drop from running (which would shut down the channel)
2364        std::mem::forget(self);
2365    }
2366}
2367
2368impl ItemsGet2Responder {
2369    /// Sends a response to the FIDL transaction.
2370    ///
2371    /// Sets the channel to shutdown if an error occurs.
2372    pub fn send(self, mut result: Result<Vec<RetrievedItems>, i32>) -> Result<(), fidl::Error> {
2373        let _result = self.send_raw(result);
2374        if _result.is_err() {
2375            self.control_handle.shutdown();
2376        }
2377        self.drop_without_shutdown();
2378        _result
2379    }
2380
2381    /// Similar to "send" but does not shutdown the channel if an error occurs.
2382    pub fn send_no_shutdown_on_err(
2383        self,
2384        mut result: Result<Vec<RetrievedItems>, i32>,
2385    ) -> Result<(), fidl::Error> {
2386        let _result = self.send_raw(result);
2387        self.drop_without_shutdown();
2388        _result
2389    }
2390
2391    fn send_raw(&self, mut result: Result<Vec<RetrievedItems>, i32>) -> Result<(), fidl::Error> {
2392        self.control_handle.inner.send::<fidl::encoding::ResultType<ItemsGet2Response, i32>>(
2393            result
2394                .as_mut()
2395                .map_err(|e| *e)
2396                .map(|retrieved_items| (retrieved_items.as_mut_slice(),)),
2397            self.tx_id,
2398            0x2a64bd32f9ba3f2e,
2399            fidl::encoding::DynamicFlags::empty(),
2400        )
2401    }
2402}
2403
2404#[must_use = "FIDL methods require a response to be sent"]
2405#[derive(Debug)]
2406pub struct ItemsGetBootloaderFileResponder {
2407    control_handle: std::mem::ManuallyDrop<ItemsControlHandle>,
2408    tx_id: u32,
2409}
2410
2411/// Set the the channel to be shutdown (see [`ItemsControlHandle::shutdown`])
2412/// if the responder is dropped without sending a response, so that the client
2413/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2414impl std::ops::Drop for ItemsGetBootloaderFileResponder {
2415    fn drop(&mut self) {
2416        self.control_handle.shutdown();
2417        // Safety: drops once, never accessed again
2418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2419    }
2420}
2421
2422impl fidl::endpoints::Responder for ItemsGetBootloaderFileResponder {
2423    type ControlHandle = ItemsControlHandle;
2424
2425    fn control_handle(&self) -> &ItemsControlHandle {
2426        &self.control_handle
2427    }
2428
2429    fn drop_without_shutdown(mut self) {
2430        // Safety: drops once, never accessed again due to mem::forget
2431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2432        // Prevent Drop from running (which would shut down the channel)
2433        std::mem::forget(self);
2434    }
2435}
2436
2437impl ItemsGetBootloaderFileResponder {
2438    /// Sends a response to the FIDL transaction.
2439    ///
2440    /// Sets the channel to shutdown if an error occurs.
2441    pub fn send(self, mut payload: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
2442        let _result = self.send_raw(payload);
2443        if _result.is_err() {
2444            self.control_handle.shutdown();
2445        }
2446        self.drop_without_shutdown();
2447        _result
2448    }
2449
2450    /// Similar to "send" but does not shutdown the channel if an error occurs.
2451    pub fn send_no_shutdown_on_err(
2452        self,
2453        mut payload: Option<fidl::Vmo>,
2454    ) -> Result<(), fidl::Error> {
2455        let _result = self.send_raw(payload);
2456        self.drop_without_shutdown();
2457        _result
2458    }
2459
2460    fn send_raw(&self, mut payload: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
2461        self.control_handle.inner.send::<ItemsGetBootloaderFileResponse>(
2462            (payload,),
2463            self.tx_id,
2464            0x5a004db3c9378e8c,
2465            fidl::encoding::DynamicFlags::empty(),
2466        )
2467    }
2468}
2469
2470#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2471pub struct ReadOnlyLogMarker;
2472
2473impl fidl::endpoints::ProtocolMarker for ReadOnlyLogMarker {
2474    type Proxy = ReadOnlyLogProxy;
2475    type RequestStream = ReadOnlyLogRequestStream;
2476    #[cfg(target_os = "fuchsia")]
2477    type SynchronousProxy = ReadOnlyLogSynchronousProxy;
2478
2479    const DEBUG_NAME: &'static str = "fuchsia.boot.ReadOnlyLog";
2480}
2481impl fidl::endpoints::DiscoverableProtocolMarker for ReadOnlyLogMarker {}
2482
2483pub trait ReadOnlyLogProxyInterface: Send + Sync {
2484    type GetResponseFut: std::future::Future<Output = Result<fidl::DebugLog, fidl::Error>> + Send;
2485    fn r#get(&self) -> Self::GetResponseFut;
2486}
2487#[derive(Debug)]
2488#[cfg(target_os = "fuchsia")]
2489pub struct ReadOnlyLogSynchronousProxy {
2490    client: fidl::client::sync::Client,
2491}
2492
2493#[cfg(target_os = "fuchsia")]
2494impl fidl::endpoints::SynchronousProxy for ReadOnlyLogSynchronousProxy {
2495    type Proxy = ReadOnlyLogProxy;
2496    type Protocol = ReadOnlyLogMarker;
2497
2498    fn from_channel(inner: fidl::Channel) -> Self {
2499        Self::new(inner)
2500    }
2501
2502    fn into_channel(self) -> fidl::Channel {
2503        self.client.into_channel()
2504    }
2505
2506    fn as_channel(&self) -> &fidl::Channel {
2507        self.client.as_channel()
2508    }
2509}
2510
2511#[cfg(target_os = "fuchsia")]
2512impl ReadOnlyLogSynchronousProxy {
2513    pub fn new(channel: fidl::Channel) -> Self {
2514        Self { client: fidl::client::sync::Client::new(channel) }
2515    }
2516
2517    pub fn into_channel(self) -> fidl::Channel {
2518        self.client.into_channel()
2519    }
2520
2521    /// Waits until an event arrives and returns it. It is safe for other
2522    /// threads to make concurrent requests while waiting for an event.
2523    pub fn wait_for_event(
2524        &self,
2525        deadline: zx::MonotonicInstant,
2526    ) -> Result<ReadOnlyLogEvent, fidl::Error> {
2527        ReadOnlyLogEvent::decode(self.client.wait_for_event::<ReadOnlyLogMarker>(deadline)?)
2528    }
2529
2530    /// Get read-only handle to the kernel `log`.
2531    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::DebugLog, fidl::Error> {
2532        let _response = self
2533            .client
2534            .send_query::<fidl::encoding::EmptyPayload, ReadOnlyLogGetResponse, ReadOnlyLogMarker>(
2535                (),
2536                0x6f3ceba5eca871ff,
2537                fidl::encoding::DynamicFlags::empty(),
2538                ___deadline,
2539            )?;
2540        Ok(_response.log)
2541    }
2542}
2543
2544#[cfg(target_os = "fuchsia")]
2545impl From<ReadOnlyLogSynchronousProxy> for zx::NullableHandle {
2546    fn from(value: ReadOnlyLogSynchronousProxy) -> Self {
2547        value.into_channel().into()
2548    }
2549}
2550
2551#[cfg(target_os = "fuchsia")]
2552impl From<fidl::Channel> for ReadOnlyLogSynchronousProxy {
2553    fn from(value: fidl::Channel) -> Self {
2554        Self::new(value)
2555    }
2556}
2557
2558#[cfg(target_os = "fuchsia")]
2559impl fidl::endpoints::FromClient for ReadOnlyLogSynchronousProxy {
2560    type Protocol = ReadOnlyLogMarker;
2561
2562    fn from_client(value: fidl::endpoints::ClientEnd<ReadOnlyLogMarker>) -> Self {
2563        Self::new(value.into_channel())
2564    }
2565}
2566
2567#[derive(Debug, Clone)]
2568pub struct ReadOnlyLogProxy {
2569    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2570}
2571
2572impl fidl::endpoints::Proxy for ReadOnlyLogProxy {
2573    type Protocol = ReadOnlyLogMarker;
2574
2575    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2576        Self::new(inner)
2577    }
2578
2579    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2580        self.client.into_channel().map_err(|client| Self { client })
2581    }
2582
2583    fn as_channel(&self) -> &::fidl::AsyncChannel {
2584        self.client.as_channel()
2585    }
2586}
2587
2588impl ReadOnlyLogProxy {
2589    /// Create a new Proxy for fuchsia.boot/ReadOnlyLog.
2590    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2591        let protocol_name = <ReadOnlyLogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2592        Self { client: fidl::client::Client::new(channel, protocol_name) }
2593    }
2594
2595    /// Get a Stream of events from the remote end of the protocol.
2596    ///
2597    /// # Panics
2598    ///
2599    /// Panics if the event stream was already taken.
2600    pub fn take_event_stream(&self) -> ReadOnlyLogEventStream {
2601        ReadOnlyLogEventStream { event_receiver: self.client.take_event_receiver() }
2602    }
2603
2604    /// Get read-only handle to the kernel `log`.
2605    pub fn r#get(
2606        &self,
2607    ) -> fidl::client::QueryResponseFut<fidl::DebugLog, fidl::encoding::DefaultFuchsiaResourceDialect>
2608    {
2609        ReadOnlyLogProxyInterface::r#get(self)
2610    }
2611}
2612
2613impl ReadOnlyLogProxyInterface for ReadOnlyLogProxy {
2614    type GetResponseFut = fidl::client::QueryResponseFut<
2615        fidl::DebugLog,
2616        fidl::encoding::DefaultFuchsiaResourceDialect,
2617    >;
2618    fn r#get(&self) -> Self::GetResponseFut {
2619        fn _decode(
2620            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2621        ) -> Result<fidl::DebugLog, fidl::Error> {
2622            let _response = fidl::client::decode_transaction_body::<
2623                ReadOnlyLogGetResponse,
2624                fidl::encoding::DefaultFuchsiaResourceDialect,
2625                0x6f3ceba5eca871ff,
2626            >(_buf?)?;
2627            Ok(_response.log)
2628        }
2629        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::DebugLog>(
2630            (),
2631            0x6f3ceba5eca871ff,
2632            fidl::encoding::DynamicFlags::empty(),
2633            _decode,
2634        )
2635    }
2636}
2637
2638pub struct ReadOnlyLogEventStream {
2639    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2640}
2641
2642impl std::marker::Unpin for ReadOnlyLogEventStream {}
2643
2644impl futures::stream::FusedStream for ReadOnlyLogEventStream {
2645    fn is_terminated(&self) -> bool {
2646        self.event_receiver.is_terminated()
2647    }
2648}
2649
2650impl futures::Stream for ReadOnlyLogEventStream {
2651    type Item = Result<ReadOnlyLogEvent, fidl::Error>;
2652
2653    fn poll_next(
2654        mut self: std::pin::Pin<&mut Self>,
2655        cx: &mut std::task::Context<'_>,
2656    ) -> std::task::Poll<Option<Self::Item>> {
2657        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2658            &mut self.event_receiver,
2659            cx
2660        )?) {
2661            Some(buf) => std::task::Poll::Ready(Some(ReadOnlyLogEvent::decode(buf))),
2662            None => std::task::Poll::Ready(None),
2663        }
2664    }
2665}
2666
2667#[derive(Debug)]
2668pub enum ReadOnlyLogEvent {}
2669
2670impl ReadOnlyLogEvent {
2671    /// Decodes a message buffer as a [`ReadOnlyLogEvent`].
2672    fn decode(
2673        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2674    ) -> Result<ReadOnlyLogEvent, fidl::Error> {
2675        let (bytes, _handles) = buf.split_mut();
2676        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2677        debug_assert_eq!(tx_header.tx_id, 0);
2678        match tx_header.ordinal {
2679            _ => Err(fidl::Error::UnknownOrdinal {
2680                ordinal: tx_header.ordinal,
2681                protocol_name: <ReadOnlyLogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2682            }),
2683        }
2684    }
2685}
2686
2687/// A Stream of incoming requests for fuchsia.boot/ReadOnlyLog.
2688pub struct ReadOnlyLogRequestStream {
2689    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2690    is_terminated: bool,
2691}
2692
2693impl std::marker::Unpin for ReadOnlyLogRequestStream {}
2694
2695impl futures::stream::FusedStream for ReadOnlyLogRequestStream {
2696    fn is_terminated(&self) -> bool {
2697        self.is_terminated
2698    }
2699}
2700
2701impl fidl::endpoints::RequestStream for ReadOnlyLogRequestStream {
2702    type Protocol = ReadOnlyLogMarker;
2703    type ControlHandle = ReadOnlyLogControlHandle;
2704
2705    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2706        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2707    }
2708
2709    fn control_handle(&self) -> Self::ControlHandle {
2710        ReadOnlyLogControlHandle { inner: self.inner.clone() }
2711    }
2712
2713    fn into_inner(
2714        self,
2715    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2716    {
2717        (self.inner, self.is_terminated)
2718    }
2719
2720    fn from_inner(
2721        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2722        is_terminated: bool,
2723    ) -> Self {
2724        Self { inner, is_terminated }
2725    }
2726}
2727
2728impl futures::Stream for ReadOnlyLogRequestStream {
2729    type Item = Result<ReadOnlyLogRequest, fidl::Error>;
2730
2731    fn poll_next(
2732        mut self: std::pin::Pin<&mut Self>,
2733        cx: &mut std::task::Context<'_>,
2734    ) -> std::task::Poll<Option<Self::Item>> {
2735        let this = &mut *self;
2736        if this.inner.check_shutdown(cx) {
2737            this.is_terminated = true;
2738            return std::task::Poll::Ready(None);
2739        }
2740        if this.is_terminated {
2741            panic!("polled ReadOnlyLogRequestStream after completion");
2742        }
2743        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2744            |bytes, handles| {
2745                match this.inner.channel().read_etc(cx, bytes, handles) {
2746                    std::task::Poll::Ready(Ok(())) => {}
2747                    std::task::Poll::Pending => return std::task::Poll::Pending,
2748                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2749                        this.is_terminated = true;
2750                        return std::task::Poll::Ready(None);
2751                    }
2752                    std::task::Poll::Ready(Err(e)) => {
2753                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2754                            e.into(),
2755                        ))));
2756                    }
2757                }
2758
2759                // A message has been received from the channel
2760                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2761
2762                std::task::Poll::Ready(Some(match header.ordinal {
2763                    0x6f3ceba5eca871ff => {
2764                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2765                        let mut req = fidl::new_empty!(
2766                            fidl::encoding::EmptyPayload,
2767                            fidl::encoding::DefaultFuchsiaResourceDialect
2768                        );
2769                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2770                        let control_handle = ReadOnlyLogControlHandle { inner: this.inner.clone() };
2771                        Ok(ReadOnlyLogRequest::Get {
2772                            responder: ReadOnlyLogGetResponder {
2773                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2774                                tx_id: header.tx_id,
2775                            },
2776                        })
2777                    }
2778                    _ => Err(fidl::Error::UnknownOrdinal {
2779                        ordinal: header.ordinal,
2780                        protocol_name:
2781                            <ReadOnlyLogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2782                    }),
2783                }))
2784            },
2785        )
2786    }
2787}
2788
2789/// Protocol for providing the kernel log, readable.
2790#[derive(Debug)]
2791pub enum ReadOnlyLogRequest {
2792    /// Get read-only handle to the kernel `log`.
2793    Get { responder: ReadOnlyLogGetResponder },
2794}
2795
2796impl ReadOnlyLogRequest {
2797    #[allow(irrefutable_let_patterns)]
2798    pub fn into_get(self) -> Option<(ReadOnlyLogGetResponder)> {
2799        if let ReadOnlyLogRequest::Get { responder } = self { Some((responder)) } else { None }
2800    }
2801
2802    /// Name of the method defined in FIDL
2803    pub fn method_name(&self) -> &'static str {
2804        match *self {
2805            ReadOnlyLogRequest::Get { .. } => "get",
2806        }
2807    }
2808}
2809
2810#[derive(Debug, Clone)]
2811pub struct ReadOnlyLogControlHandle {
2812    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2813}
2814
2815impl ReadOnlyLogControlHandle {
2816    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2817        self.inner.shutdown_with_epitaph(status.into())
2818    }
2819}
2820
2821impl fidl::endpoints::ControlHandle for ReadOnlyLogControlHandle {
2822    fn shutdown(&self) {
2823        self.inner.shutdown()
2824    }
2825
2826    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2827        self.inner.shutdown_with_epitaph(status)
2828    }
2829
2830    fn is_closed(&self) -> bool {
2831        self.inner.channel().is_closed()
2832    }
2833    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2834        self.inner.channel().on_closed()
2835    }
2836
2837    #[cfg(target_os = "fuchsia")]
2838    fn signal_peer(
2839        &self,
2840        clear_mask: zx::Signals,
2841        set_mask: zx::Signals,
2842    ) -> Result<(), zx_status::Status> {
2843        use fidl::Peered;
2844        self.inner.channel().signal_peer(clear_mask, set_mask)
2845    }
2846}
2847
2848impl ReadOnlyLogControlHandle {}
2849
2850#[must_use = "FIDL methods require a response to be sent"]
2851#[derive(Debug)]
2852pub struct ReadOnlyLogGetResponder {
2853    control_handle: std::mem::ManuallyDrop<ReadOnlyLogControlHandle>,
2854    tx_id: u32,
2855}
2856
2857/// Set the the channel to be shutdown (see [`ReadOnlyLogControlHandle::shutdown`])
2858/// if the responder is dropped without sending a response, so that the client
2859/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2860impl std::ops::Drop for ReadOnlyLogGetResponder {
2861    fn drop(&mut self) {
2862        self.control_handle.shutdown();
2863        // Safety: drops once, never accessed again
2864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2865    }
2866}
2867
2868impl fidl::endpoints::Responder for ReadOnlyLogGetResponder {
2869    type ControlHandle = ReadOnlyLogControlHandle;
2870
2871    fn control_handle(&self) -> &ReadOnlyLogControlHandle {
2872        &self.control_handle
2873    }
2874
2875    fn drop_without_shutdown(mut self) {
2876        // Safety: drops once, never accessed again due to mem::forget
2877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2878        // Prevent Drop from running (which would shut down the channel)
2879        std::mem::forget(self);
2880    }
2881}
2882
2883impl ReadOnlyLogGetResponder {
2884    /// Sends a response to the FIDL transaction.
2885    ///
2886    /// Sets the channel to shutdown if an error occurs.
2887    pub fn send(self, mut log: fidl::DebugLog) -> Result<(), fidl::Error> {
2888        let _result = self.send_raw(log);
2889        if _result.is_err() {
2890            self.control_handle.shutdown();
2891        }
2892        self.drop_without_shutdown();
2893        _result
2894    }
2895
2896    /// Similar to "send" but does not shutdown the channel if an error occurs.
2897    pub fn send_no_shutdown_on_err(self, mut log: fidl::DebugLog) -> Result<(), fidl::Error> {
2898        let _result = self.send_raw(log);
2899        self.drop_without_shutdown();
2900        _result
2901    }
2902
2903    fn send_raw(&self, mut log: fidl::DebugLog) -> Result<(), fidl::Error> {
2904        self.control_handle.inner.send::<ReadOnlyLogGetResponse>(
2905            (log,),
2906            self.tx_id,
2907            0x6f3ceba5eca871ff,
2908            fidl::encoding::DynamicFlags::empty(),
2909        )
2910    }
2911}
2912
2913#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2914pub struct SvcStashMarker;
2915
2916impl fidl::endpoints::ProtocolMarker for SvcStashMarker {
2917    type Proxy = SvcStashProxy;
2918    type RequestStream = SvcStashRequestStream;
2919    #[cfg(target_os = "fuchsia")]
2920    type SynchronousProxy = SvcStashSynchronousProxy;
2921
2922    const DEBUG_NAME: &'static str = "(anonymous) SvcStash";
2923}
2924
2925pub trait SvcStashProxyInterface: Send + Sync {
2926    fn r#store(
2927        &self,
2928        svc_endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2929    ) -> Result<(), fidl::Error>;
2930}
2931#[derive(Debug)]
2932#[cfg(target_os = "fuchsia")]
2933pub struct SvcStashSynchronousProxy {
2934    client: fidl::client::sync::Client,
2935}
2936
2937#[cfg(target_os = "fuchsia")]
2938impl fidl::endpoints::SynchronousProxy for SvcStashSynchronousProxy {
2939    type Proxy = SvcStashProxy;
2940    type Protocol = SvcStashMarker;
2941
2942    fn from_channel(inner: fidl::Channel) -> Self {
2943        Self::new(inner)
2944    }
2945
2946    fn into_channel(self) -> fidl::Channel {
2947        self.client.into_channel()
2948    }
2949
2950    fn as_channel(&self) -> &fidl::Channel {
2951        self.client.as_channel()
2952    }
2953}
2954
2955#[cfg(target_os = "fuchsia")]
2956impl SvcStashSynchronousProxy {
2957    pub fn new(channel: fidl::Channel) -> Self {
2958        Self { client: fidl::client::sync::Client::new(channel) }
2959    }
2960
2961    pub fn into_channel(self) -> fidl::Channel {
2962        self.client.into_channel()
2963    }
2964
2965    /// Waits until an event arrives and returns it. It is safe for other
2966    /// threads to make concurrent requests while waiting for an event.
2967    pub fn wait_for_event(
2968        &self,
2969        deadline: zx::MonotonicInstant,
2970    ) -> Result<SvcStashEvent, fidl::Error> {
2971        SvcStashEvent::decode(self.client.wait_for_event::<SvcStashMarker>(deadline)?)
2972    }
2973
2974    /// Store a svc_endpoint in the stash. Stored endpoints will remain in transit,
2975    /// since there might not be a server side implementation. The server end
2976    /// is retrieved by |SvcStashProvider/Get|.
2977    pub fn r#store(
2978        &self,
2979        mut svc_endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2980    ) -> Result<(), fidl::Error> {
2981        self.client.send::<SvcStashStoreRequest>(
2982            (svc_endpoint,),
2983            0xc2648e356ca2870,
2984            fidl::encoding::DynamicFlags::empty(),
2985        )
2986    }
2987}
2988
2989#[cfg(target_os = "fuchsia")]
2990impl From<SvcStashSynchronousProxy> for zx::NullableHandle {
2991    fn from(value: SvcStashSynchronousProxy) -> Self {
2992        value.into_channel().into()
2993    }
2994}
2995
2996#[cfg(target_os = "fuchsia")]
2997impl From<fidl::Channel> for SvcStashSynchronousProxy {
2998    fn from(value: fidl::Channel) -> Self {
2999        Self::new(value)
3000    }
3001}
3002
3003#[cfg(target_os = "fuchsia")]
3004impl fidl::endpoints::FromClient for SvcStashSynchronousProxy {
3005    type Protocol = SvcStashMarker;
3006
3007    fn from_client(value: fidl::endpoints::ClientEnd<SvcStashMarker>) -> Self {
3008        Self::new(value.into_channel())
3009    }
3010}
3011
3012#[derive(Debug, Clone)]
3013pub struct SvcStashProxy {
3014    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3015}
3016
3017impl fidl::endpoints::Proxy for SvcStashProxy {
3018    type Protocol = SvcStashMarker;
3019
3020    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3021        Self::new(inner)
3022    }
3023
3024    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3025        self.client.into_channel().map_err(|client| Self { client })
3026    }
3027
3028    fn as_channel(&self) -> &::fidl::AsyncChannel {
3029        self.client.as_channel()
3030    }
3031}
3032
3033impl SvcStashProxy {
3034    /// Create a new Proxy for fuchsia.boot/SvcStash.
3035    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3036        let protocol_name = <SvcStashMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3037        Self { client: fidl::client::Client::new(channel, protocol_name) }
3038    }
3039
3040    /// Get a Stream of events from the remote end of the protocol.
3041    ///
3042    /// # Panics
3043    ///
3044    /// Panics if the event stream was already taken.
3045    pub fn take_event_stream(&self) -> SvcStashEventStream {
3046        SvcStashEventStream { event_receiver: self.client.take_event_receiver() }
3047    }
3048
3049    /// Store a svc_endpoint in the stash. Stored endpoints will remain in transit,
3050    /// since there might not be a server side implementation. The server end
3051    /// is retrieved by |SvcStashProvider/Get|.
3052    pub fn r#store(
3053        &self,
3054        mut svc_endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3055    ) -> Result<(), fidl::Error> {
3056        SvcStashProxyInterface::r#store(self, svc_endpoint)
3057    }
3058}
3059
3060impl SvcStashProxyInterface for SvcStashProxy {
3061    fn r#store(
3062        &self,
3063        mut svc_endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3064    ) -> Result<(), fidl::Error> {
3065        self.client.send::<SvcStashStoreRequest>(
3066            (svc_endpoint,),
3067            0xc2648e356ca2870,
3068            fidl::encoding::DynamicFlags::empty(),
3069        )
3070    }
3071}
3072
3073pub struct SvcStashEventStream {
3074    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3075}
3076
3077impl std::marker::Unpin for SvcStashEventStream {}
3078
3079impl futures::stream::FusedStream for SvcStashEventStream {
3080    fn is_terminated(&self) -> bool {
3081        self.event_receiver.is_terminated()
3082    }
3083}
3084
3085impl futures::Stream for SvcStashEventStream {
3086    type Item = Result<SvcStashEvent, fidl::Error>;
3087
3088    fn poll_next(
3089        mut self: std::pin::Pin<&mut Self>,
3090        cx: &mut std::task::Context<'_>,
3091    ) -> std::task::Poll<Option<Self::Item>> {
3092        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3093            &mut self.event_receiver,
3094            cx
3095        )?) {
3096            Some(buf) => std::task::Poll::Ready(Some(SvcStashEvent::decode(buf))),
3097            None => std::task::Poll::Ready(None),
3098        }
3099    }
3100}
3101
3102#[derive(Debug)]
3103pub enum SvcStashEvent {}
3104
3105impl SvcStashEvent {
3106    /// Decodes a message buffer as a [`SvcStashEvent`].
3107    fn decode(
3108        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3109    ) -> Result<SvcStashEvent, fidl::Error> {
3110        let (bytes, _handles) = buf.split_mut();
3111        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3112        debug_assert_eq!(tx_header.tx_id, 0);
3113        match tx_header.ordinal {
3114            _ => Err(fidl::Error::UnknownOrdinal {
3115                ordinal: tx_header.ordinal,
3116                protocol_name: <SvcStashMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3117            }),
3118        }
3119    }
3120}
3121
3122/// A Stream of incoming requests for fuchsia.boot/SvcStash.
3123pub struct SvcStashRequestStream {
3124    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3125    is_terminated: bool,
3126}
3127
3128impl std::marker::Unpin for SvcStashRequestStream {}
3129
3130impl futures::stream::FusedStream for SvcStashRequestStream {
3131    fn is_terminated(&self) -> bool {
3132        self.is_terminated
3133    }
3134}
3135
3136impl fidl::endpoints::RequestStream for SvcStashRequestStream {
3137    type Protocol = SvcStashMarker;
3138    type ControlHandle = SvcStashControlHandle;
3139
3140    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3141        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3142    }
3143
3144    fn control_handle(&self) -> Self::ControlHandle {
3145        SvcStashControlHandle { inner: self.inner.clone() }
3146    }
3147
3148    fn into_inner(
3149        self,
3150    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3151    {
3152        (self.inner, self.is_terminated)
3153    }
3154
3155    fn from_inner(
3156        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3157        is_terminated: bool,
3158    ) -> Self {
3159        Self { inner, is_terminated }
3160    }
3161}
3162
3163impl futures::Stream for SvcStashRequestStream {
3164    type Item = Result<SvcStashRequest, fidl::Error>;
3165
3166    fn poll_next(
3167        mut self: std::pin::Pin<&mut Self>,
3168        cx: &mut std::task::Context<'_>,
3169    ) -> std::task::Poll<Option<Self::Item>> {
3170        let this = &mut *self;
3171        if this.inner.check_shutdown(cx) {
3172            this.is_terminated = true;
3173            return std::task::Poll::Ready(None);
3174        }
3175        if this.is_terminated {
3176            panic!("polled SvcStashRequestStream after completion");
3177        }
3178        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3179            |bytes, handles| {
3180                match this.inner.channel().read_etc(cx, bytes, handles) {
3181                    std::task::Poll::Ready(Ok(())) => {}
3182                    std::task::Poll::Pending => return std::task::Poll::Pending,
3183                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3184                        this.is_terminated = true;
3185                        return std::task::Poll::Ready(None);
3186                    }
3187                    std::task::Poll::Ready(Err(e)) => {
3188                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3189                            e.into(),
3190                        ))));
3191                    }
3192                }
3193
3194                // A message has been received from the channel
3195                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3196
3197                std::task::Poll::Ready(Some(match header.ordinal {
3198                    0xc2648e356ca2870 => {
3199                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3200                        let mut req = fidl::new_empty!(
3201                            SvcStashStoreRequest,
3202                            fidl::encoding::DefaultFuchsiaResourceDialect
3203                        );
3204                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SvcStashStoreRequest>(&header, _body_bytes, handles, &mut req)?;
3205                        let control_handle = SvcStashControlHandle { inner: this.inner.clone() };
3206                        Ok(SvcStashRequest::Store {
3207                            svc_endpoint: req.svc_endpoint,
3208
3209                            control_handle,
3210                        })
3211                    }
3212                    _ => Err(fidl::Error::UnknownOrdinal {
3213                        ordinal: header.ordinal,
3214                        protocol_name:
3215                            <SvcStashMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3216                    }),
3217                }))
3218            },
3219        )
3220    }
3221}
3222
3223/// Protocol for storing svc server ends of 'svc' for later processing during early boot.
3224#[derive(Debug)]
3225pub enum SvcStashRequest {
3226    /// Store a svc_endpoint in the stash. Stored endpoints will remain in transit,
3227    /// since there might not be a server side implementation. The server end
3228    /// is retrieved by |SvcStashProvider/Get|.
3229    Store {
3230        svc_endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3231        control_handle: SvcStashControlHandle,
3232    },
3233}
3234
3235impl SvcStashRequest {
3236    #[allow(irrefutable_let_patterns)]
3237    pub fn into_store(
3238        self,
3239    ) -> Option<(fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>, SvcStashControlHandle)>
3240    {
3241        if let SvcStashRequest::Store { svc_endpoint, control_handle } = self {
3242            Some((svc_endpoint, control_handle))
3243        } else {
3244            None
3245        }
3246    }
3247
3248    /// Name of the method defined in FIDL
3249    pub fn method_name(&self) -> &'static str {
3250        match *self {
3251            SvcStashRequest::Store { .. } => "store",
3252        }
3253    }
3254}
3255
3256#[derive(Debug, Clone)]
3257pub struct SvcStashControlHandle {
3258    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3259}
3260
3261impl SvcStashControlHandle {
3262    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3263        self.inner.shutdown_with_epitaph(status.into())
3264    }
3265}
3266
3267impl fidl::endpoints::ControlHandle for SvcStashControlHandle {
3268    fn shutdown(&self) {
3269        self.inner.shutdown()
3270    }
3271
3272    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3273        self.inner.shutdown_with_epitaph(status)
3274    }
3275
3276    fn is_closed(&self) -> bool {
3277        self.inner.channel().is_closed()
3278    }
3279    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3280        self.inner.channel().on_closed()
3281    }
3282
3283    #[cfg(target_os = "fuchsia")]
3284    fn signal_peer(
3285        &self,
3286        clear_mask: zx::Signals,
3287        set_mask: zx::Signals,
3288    ) -> Result<(), zx_status::Status> {
3289        use fidl::Peered;
3290        self.inner.channel().signal_peer(clear_mask, set_mask)
3291    }
3292}
3293
3294impl SvcStashControlHandle {}
3295
3296#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3297pub struct SvcStashProviderMarker;
3298
3299impl fidl::endpoints::ProtocolMarker for SvcStashProviderMarker {
3300    type Proxy = SvcStashProviderProxy;
3301    type RequestStream = SvcStashProviderRequestStream;
3302    #[cfg(target_os = "fuchsia")]
3303    type SynchronousProxy = SvcStashProviderSynchronousProxy;
3304
3305    const DEBUG_NAME: &'static str = "fuchsia.boot.SvcStashProvider";
3306}
3307impl fidl::endpoints::DiscoverableProtocolMarker for SvcStashProviderMarker {}
3308pub type SvcStashProviderGetResult = Result<fidl::endpoints::ServerEnd<SvcStashMarker>, i32>;
3309
3310pub trait SvcStashProviderProxyInterface: Send + Sync {
3311    type GetResponseFut: std::future::Future<Output = Result<SvcStashProviderGetResult, fidl::Error>>
3312        + Send;
3313    fn r#get(&self) -> Self::GetResponseFut;
3314}
3315#[derive(Debug)]
3316#[cfg(target_os = "fuchsia")]
3317pub struct SvcStashProviderSynchronousProxy {
3318    client: fidl::client::sync::Client,
3319}
3320
3321#[cfg(target_os = "fuchsia")]
3322impl fidl::endpoints::SynchronousProxy for SvcStashProviderSynchronousProxy {
3323    type Proxy = SvcStashProviderProxy;
3324    type Protocol = SvcStashProviderMarker;
3325
3326    fn from_channel(inner: fidl::Channel) -> Self {
3327        Self::new(inner)
3328    }
3329
3330    fn into_channel(self) -> fidl::Channel {
3331        self.client.into_channel()
3332    }
3333
3334    fn as_channel(&self) -> &fidl::Channel {
3335        self.client.as_channel()
3336    }
3337}
3338
3339#[cfg(target_os = "fuchsia")]
3340impl SvcStashProviderSynchronousProxy {
3341    pub fn new(channel: fidl::Channel) -> Self {
3342        Self { client: fidl::client::sync::Client::new(channel) }
3343    }
3344
3345    pub fn into_channel(self) -> fidl::Channel {
3346        self.client.into_channel()
3347    }
3348
3349    /// Waits until an event arrives and returns it. It is safe for other
3350    /// threads to make concurrent requests while waiting for an event.
3351    pub fn wait_for_event(
3352        &self,
3353        deadline: zx::MonotonicInstant,
3354    ) -> Result<SvcStashProviderEvent, fidl::Error> {
3355        SvcStashProviderEvent::decode(
3356            self.client.wait_for_event::<SvcStashProviderMarker>(deadline)?,
3357        )
3358    }
3359
3360    /// Get the SvcStash server endpoint.
3361    ///
3362    /// There is at most one instance for the system, meaning only the first caller
3363    /// may consume the handle.
3364    pub fn r#get(
3365        &self,
3366        ___deadline: zx::MonotonicInstant,
3367    ) -> Result<SvcStashProviderGetResult, fidl::Error> {
3368        let _response = self.client.send_query::<
3369            fidl::encoding::EmptyPayload,
3370            fidl::encoding::ResultType<SvcStashProviderGetResponse, i32>,
3371            SvcStashProviderMarker,
3372        >(
3373            (),
3374            0x3885bad5b734f883,
3375            fidl::encoding::DynamicFlags::empty(),
3376            ___deadline,
3377        )?;
3378        Ok(_response.map(|x| x.resource))
3379    }
3380}
3381
3382#[cfg(target_os = "fuchsia")]
3383impl From<SvcStashProviderSynchronousProxy> for zx::NullableHandle {
3384    fn from(value: SvcStashProviderSynchronousProxy) -> Self {
3385        value.into_channel().into()
3386    }
3387}
3388
3389#[cfg(target_os = "fuchsia")]
3390impl From<fidl::Channel> for SvcStashProviderSynchronousProxy {
3391    fn from(value: fidl::Channel) -> Self {
3392        Self::new(value)
3393    }
3394}
3395
3396#[cfg(target_os = "fuchsia")]
3397impl fidl::endpoints::FromClient for SvcStashProviderSynchronousProxy {
3398    type Protocol = SvcStashProviderMarker;
3399
3400    fn from_client(value: fidl::endpoints::ClientEnd<SvcStashProviderMarker>) -> Self {
3401        Self::new(value.into_channel())
3402    }
3403}
3404
3405#[derive(Debug, Clone)]
3406pub struct SvcStashProviderProxy {
3407    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3408}
3409
3410impl fidl::endpoints::Proxy for SvcStashProviderProxy {
3411    type Protocol = SvcStashProviderMarker;
3412
3413    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3414        Self::new(inner)
3415    }
3416
3417    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3418        self.client.into_channel().map_err(|client| Self { client })
3419    }
3420
3421    fn as_channel(&self) -> &::fidl::AsyncChannel {
3422        self.client.as_channel()
3423    }
3424}
3425
3426impl SvcStashProviderProxy {
3427    /// Create a new Proxy for fuchsia.boot/SvcStashProvider.
3428    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3429        let protocol_name = <SvcStashProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3430        Self { client: fidl::client::Client::new(channel, protocol_name) }
3431    }
3432
3433    /// Get a Stream of events from the remote end of the protocol.
3434    ///
3435    /// # Panics
3436    ///
3437    /// Panics if the event stream was already taken.
3438    pub fn take_event_stream(&self) -> SvcStashProviderEventStream {
3439        SvcStashProviderEventStream { event_receiver: self.client.take_event_receiver() }
3440    }
3441
3442    /// Get the SvcStash server endpoint.
3443    ///
3444    /// There is at most one instance for the system, meaning only the first caller
3445    /// may consume the handle.
3446    pub fn r#get(
3447        &self,
3448    ) -> fidl::client::QueryResponseFut<
3449        SvcStashProviderGetResult,
3450        fidl::encoding::DefaultFuchsiaResourceDialect,
3451    > {
3452        SvcStashProviderProxyInterface::r#get(self)
3453    }
3454}
3455
3456impl SvcStashProviderProxyInterface for SvcStashProviderProxy {
3457    type GetResponseFut = fidl::client::QueryResponseFut<
3458        SvcStashProviderGetResult,
3459        fidl::encoding::DefaultFuchsiaResourceDialect,
3460    >;
3461    fn r#get(&self) -> Self::GetResponseFut {
3462        fn _decode(
3463            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3464        ) -> Result<SvcStashProviderGetResult, fidl::Error> {
3465            let _response = fidl::client::decode_transaction_body::<
3466                fidl::encoding::ResultType<SvcStashProviderGetResponse, i32>,
3467                fidl::encoding::DefaultFuchsiaResourceDialect,
3468                0x3885bad5b734f883,
3469            >(_buf?)?;
3470            Ok(_response.map(|x| x.resource))
3471        }
3472        self.client
3473            .send_query_and_decode::<fidl::encoding::EmptyPayload, SvcStashProviderGetResult>(
3474                (),
3475                0x3885bad5b734f883,
3476                fidl::encoding::DynamicFlags::empty(),
3477                _decode,
3478            )
3479    }
3480}
3481
3482pub struct SvcStashProviderEventStream {
3483    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3484}
3485
3486impl std::marker::Unpin for SvcStashProviderEventStream {}
3487
3488impl futures::stream::FusedStream for SvcStashProviderEventStream {
3489    fn is_terminated(&self) -> bool {
3490        self.event_receiver.is_terminated()
3491    }
3492}
3493
3494impl futures::Stream for SvcStashProviderEventStream {
3495    type Item = Result<SvcStashProviderEvent, fidl::Error>;
3496
3497    fn poll_next(
3498        mut self: std::pin::Pin<&mut Self>,
3499        cx: &mut std::task::Context<'_>,
3500    ) -> std::task::Poll<Option<Self::Item>> {
3501        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3502            &mut self.event_receiver,
3503            cx
3504        )?) {
3505            Some(buf) => std::task::Poll::Ready(Some(SvcStashProviderEvent::decode(buf))),
3506            None => std::task::Poll::Ready(None),
3507        }
3508    }
3509}
3510
3511#[derive(Debug)]
3512pub enum SvcStashProviderEvent {}
3513
3514impl SvcStashProviderEvent {
3515    /// Decodes a message buffer as a [`SvcStashProviderEvent`].
3516    fn decode(
3517        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3518    ) -> Result<SvcStashProviderEvent, fidl::Error> {
3519        let (bytes, _handles) = buf.split_mut();
3520        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3521        debug_assert_eq!(tx_header.tx_id, 0);
3522        match tx_header.ordinal {
3523            _ => Err(fidl::Error::UnknownOrdinal {
3524                ordinal: tx_header.ordinal,
3525                protocol_name:
3526                    <SvcStashProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3527            }),
3528        }
3529    }
3530}
3531
3532/// A Stream of incoming requests for fuchsia.boot/SvcStashProvider.
3533pub struct SvcStashProviderRequestStream {
3534    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3535    is_terminated: bool,
3536}
3537
3538impl std::marker::Unpin for SvcStashProviderRequestStream {}
3539
3540impl futures::stream::FusedStream for SvcStashProviderRequestStream {
3541    fn is_terminated(&self) -> bool {
3542        self.is_terminated
3543    }
3544}
3545
3546impl fidl::endpoints::RequestStream for SvcStashProviderRequestStream {
3547    type Protocol = SvcStashProviderMarker;
3548    type ControlHandle = SvcStashProviderControlHandle;
3549
3550    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3551        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3552    }
3553
3554    fn control_handle(&self) -> Self::ControlHandle {
3555        SvcStashProviderControlHandle { inner: self.inner.clone() }
3556    }
3557
3558    fn into_inner(
3559        self,
3560    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3561    {
3562        (self.inner, self.is_terminated)
3563    }
3564
3565    fn from_inner(
3566        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3567        is_terminated: bool,
3568    ) -> Self {
3569        Self { inner, is_terminated }
3570    }
3571}
3572
3573impl futures::Stream for SvcStashProviderRequestStream {
3574    type Item = Result<SvcStashProviderRequest, fidl::Error>;
3575
3576    fn poll_next(
3577        mut self: std::pin::Pin<&mut Self>,
3578        cx: &mut std::task::Context<'_>,
3579    ) -> std::task::Poll<Option<Self::Item>> {
3580        let this = &mut *self;
3581        if this.inner.check_shutdown(cx) {
3582            this.is_terminated = true;
3583            return std::task::Poll::Ready(None);
3584        }
3585        if this.is_terminated {
3586            panic!("polled SvcStashProviderRequestStream after completion");
3587        }
3588        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3589            |bytes, handles| {
3590                match this.inner.channel().read_etc(cx, bytes, handles) {
3591                    std::task::Poll::Ready(Ok(())) => {}
3592                    std::task::Poll::Pending => return std::task::Poll::Pending,
3593                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3594                        this.is_terminated = true;
3595                        return std::task::Poll::Ready(None);
3596                    }
3597                    std::task::Poll::Ready(Err(e)) => {
3598                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3599                            e.into(),
3600                        ))));
3601                    }
3602                }
3603
3604                // A message has been received from the channel
3605                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3606
3607                std::task::Poll::Ready(Some(match header.ordinal {
3608                    0x3885bad5b734f883 => {
3609                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3610                        let mut req = fidl::new_empty!(
3611                            fidl::encoding::EmptyPayload,
3612                            fidl::encoding::DefaultFuchsiaResourceDialect
3613                        );
3614                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3615                        let control_handle =
3616                            SvcStashProviderControlHandle { inner: this.inner.clone() };
3617                        Ok(SvcStashProviderRequest::Get {
3618                            responder: SvcStashProviderGetResponder {
3619                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3620                                tx_id: header.tx_id,
3621                            },
3622                        })
3623                    }
3624                    _ => Err(fidl::Error::UnknownOrdinal {
3625                        ordinal: header.ordinal,
3626                        protocol_name:
3627                            <SvcStashProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3628                    }),
3629                }))
3630            },
3631        )
3632    }
3633}
3634
3635/// Protocol for providing the server end of the 'SvcStash'.
3636#[derive(Debug)]
3637pub enum SvcStashProviderRequest {
3638    /// Get the SvcStash server endpoint.
3639    ///
3640    /// There is at most one instance for the system, meaning only the first caller
3641    /// may consume the handle.
3642    Get { responder: SvcStashProviderGetResponder },
3643}
3644
3645impl SvcStashProviderRequest {
3646    #[allow(irrefutable_let_patterns)]
3647    pub fn into_get(self) -> Option<(SvcStashProviderGetResponder)> {
3648        if let SvcStashProviderRequest::Get { responder } = self { Some((responder)) } else { None }
3649    }
3650
3651    /// Name of the method defined in FIDL
3652    pub fn method_name(&self) -> &'static str {
3653        match *self {
3654            SvcStashProviderRequest::Get { .. } => "get",
3655        }
3656    }
3657}
3658
3659#[derive(Debug, Clone)]
3660pub struct SvcStashProviderControlHandle {
3661    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3662}
3663
3664impl SvcStashProviderControlHandle {
3665    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3666        self.inner.shutdown_with_epitaph(status.into())
3667    }
3668}
3669
3670impl fidl::endpoints::ControlHandle for SvcStashProviderControlHandle {
3671    fn shutdown(&self) {
3672        self.inner.shutdown()
3673    }
3674
3675    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3676        self.inner.shutdown_with_epitaph(status)
3677    }
3678
3679    fn is_closed(&self) -> bool {
3680        self.inner.channel().is_closed()
3681    }
3682    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3683        self.inner.channel().on_closed()
3684    }
3685
3686    #[cfg(target_os = "fuchsia")]
3687    fn signal_peer(
3688        &self,
3689        clear_mask: zx::Signals,
3690        set_mask: zx::Signals,
3691    ) -> Result<(), zx_status::Status> {
3692        use fidl::Peered;
3693        self.inner.channel().signal_peer(clear_mask, set_mask)
3694    }
3695}
3696
3697impl SvcStashProviderControlHandle {}
3698
3699#[must_use = "FIDL methods require a response to be sent"]
3700#[derive(Debug)]
3701pub struct SvcStashProviderGetResponder {
3702    control_handle: std::mem::ManuallyDrop<SvcStashProviderControlHandle>,
3703    tx_id: u32,
3704}
3705
3706/// Set the the channel to be shutdown (see [`SvcStashProviderControlHandle::shutdown`])
3707/// if the responder is dropped without sending a response, so that the client
3708/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3709impl std::ops::Drop for SvcStashProviderGetResponder {
3710    fn drop(&mut self) {
3711        self.control_handle.shutdown();
3712        // Safety: drops once, never accessed again
3713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3714    }
3715}
3716
3717impl fidl::endpoints::Responder for SvcStashProviderGetResponder {
3718    type ControlHandle = SvcStashProviderControlHandle;
3719
3720    fn control_handle(&self) -> &SvcStashProviderControlHandle {
3721        &self.control_handle
3722    }
3723
3724    fn drop_without_shutdown(mut self) {
3725        // Safety: drops once, never accessed again due to mem::forget
3726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3727        // Prevent Drop from running (which would shut down the channel)
3728        std::mem::forget(self);
3729    }
3730}
3731
3732impl SvcStashProviderGetResponder {
3733    /// Sends a response to the FIDL transaction.
3734    ///
3735    /// Sets the channel to shutdown if an error occurs.
3736    pub fn send(
3737        self,
3738        mut result: Result<fidl::endpoints::ServerEnd<SvcStashMarker>, i32>,
3739    ) -> Result<(), fidl::Error> {
3740        let _result = self.send_raw(result);
3741        if _result.is_err() {
3742            self.control_handle.shutdown();
3743        }
3744        self.drop_without_shutdown();
3745        _result
3746    }
3747
3748    /// Similar to "send" but does not shutdown the channel if an error occurs.
3749    pub fn send_no_shutdown_on_err(
3750        self,
3751        mut result: Result<fidl::endpoints::ServerEnd<SvcStashMarker>, i32>,
3752    ) -> Result<(), fidl::Error> {
3753        let _result = self.send_raw(result);
3754        self.drop_without_shutdown();
3755        _result
3756    }
3757
3758    fn send_raw(
3759        &self,
3760        mut result: Result<fidl::endpoints::ServerEnd<SvcStashMarker>, i32>,
3761    ) -> Result<(), fidl::Error> {
3762        self.control_handle
3763            .inner
3764            .send::<fidl::encoding::ResultType<SvcStashProviderGetResponse, i32>>(
3765                result.map(|resource| (resource,)),
3766                self.tx_id,
3767                0x3885bad5b734f883,
3768                fidl::encoding::DynamicFlags::empty(),
3769            )
3770    }
3771}
3772
3773#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3774pub struct UserbootMarker;
3775
3776impl fidl::endpoints::ProtocolMarker for UserbootMarker {
3777    type Proxy = UserbootProxy;
3778    type RequestStream = UserbootRequestStream;
3779    #[cfg(target_os = "fuchsia")]
3780    type SynchronousProxy = UserbootSynchronousProxy;
3781
3782    const DEBUG_NAME: &'static str = "(anonymous) Userboot";
3783}
3784
3785pub trait UserbootProxyInterface: Send + Sync {
3786    fn r#post_bootfs_vmo(&self, bootfs: fidl::Vmo) -> Result<(), fidl::Error>;
3787    fn r#post_bootfs_files(&self, files: Vec<BootfsFileVmo>) -> Result<(), fidl::Error>;
3788    fn r#post_boot_handles(
3789        &self,
3790        payload: UserbootPostBootHandlesRequest,
3791    ) -> Result<(), fidl::Error>;
3792    fn r#post_stash_svc(
3793        &self,
3794        stash_svc_endpoint: fidl::endpoints::ServerEnd<SvcStashMarker>,
3795    ) -> Result<(), fidl::Error>;
3796}
3797#[derive(Debug)]
3798#[cfg(target_os = "fuchsia")]
3799pub struct UserbootSynchronousProxy {
3800    client: fidl::client::sync::Client,
3801}
3802
3803#[cfg(target_os = "fuchsia")]
3804impl fidl::endpoints::SynchronousProxy for UserbootSynchronousProxy {
3805    type Proxy = UserbootProxy;
3806    type Protocol = UserbootMarker;
3807
3808    fn from_channel(inner: fidl::Channel) -> Self {
3809        Self::new(inner)
3810    }
3811
3812    fn into_channel(self) -> fidl::Channel {
3813        self.client.into_channel()
3814    }
3815
3816    fn as_channel(&self) -> &fidl::Channel {
3817        self.client.as_channel()
3818    }
3819}
3820
3821#[cfg(target_os = "fuchsia")]
3822impl UserbootSynchronousProxy {
3823    pub fn new(channel: fidl::Channel) -> Self {
3824        Self { client: fidl::client::sync::Client::new(channel) }
3825    }
3826
3827    pub fn into_channel(self) -> fidl::Channel {
3828        self.client.into_channel()
3829    }
3830
3831    /// Waits until an event arrives and returns it. It is safe for other
3832    /// threads to make concurrent requests while waiting for an event.
3833    pub fn wait_for_event(
3834        &self,
3835        deadline: zx::MonotonicInstant,
3836    ) -> Result<UserbootEvent, fidl::Error> {
3837        UserbootEvent::decode(self.client.wait_for_event::<UserbootMarker>(deadline)?)
3838    }
3839
3840    /// Posts the uncompressed bootfs VMO.
3841    pub fn r#post_bootfs_vmo(&self, mut bootfs: fidl::Vmo) -> Result<(), fidl::Error> {
3842        self.client.send::<UserbootPostBootfsVmoRequest>(
3843            (bootfs,),
3844            0x3ba75f7fdc77fff3,
3845            fidl::encoding::DynamicFlags::empty(),
3846        )
3847    }
3848
3849    /// Posts a set of `BootfsFileVmo` that were used for launching the `userboot.next=` program and are no longer
3850    /// available in the big BootfsVmo.
3851    ///
3852    /// Messages will only become available after the `Userboot` protocol client end (userboot's handle)
3853    /// has been closed.
3854    pub fn r#post_bootfs_files(&self, mut files: Vec<BootfsFileVmo>) -> Result<(), fidl::Error> {
3855        self.client.send::<UserbootPostBootfsFilesRequest>(
3856            (files.as_mut(),),
3857            0x296d4420db7cc694,
3858            fidl::encoding::DynamicFlags::empty(),
3859        )
3860    }
3861
3862    /// Posts non-bootstrap handles provided by the kernel to the booted process.
3863    pub fn r#post_boot_handles(
3864        &self,
3865        mut payload: UserbootPostBootHandlesRequest,
3866    ) -> Result<(), fidl::Error> {
3867        self.client.send::<UserbootPostBootHandlesRequest>(
3868            &mut payload,
3869            0x6102b54175b3f1eb,
3870            fidl::encoding::DynamicFlags::empty(),
3871        )
3872    }
3873
3874    /// Posts `svc_stash` server endpoint. For more information refer to `fuchsia.boot.SvcStash`.
3875    pub fn r#post_stash_svc(
3876        &self,
3877        mut stash_svc_endpoint: fidl::endpoints::ServerEnd<SvcStashMarker>,
3878    ) -> Result<(), fidl::Error> {
3879        self.client.send::<UserbootPostStashSvcRequest>(
3880            (stash_svc_endpoint,),
3881            0x506ecf7db01adeac,
3882            fidl::encoding::DynamicFlags::empty(),
3883        )
3884    }
3885}
3886
3887#[cfg(target_os = "fuchsia")]
3888impl From<UserbootSynchronousProxy> for zx::NullableHandle {
3889    fn from(value: UserbootSynchronousProxy) -> Self {
3890        value.into_channel().into()
3891    }
3892}
3893
3894#[cfg(target_os = "fuchsia")]
3895impl From<fidl::Channel> for UserbootSynchronousProxy {
3896    fn from(value: fidl::Channel) -> Self {
3897        Self::new(value)
3898    }
3899}
3900
3901#[cfg(target_os = "fuchsia")]
3902impl fidl::endpoints::FromClient for UserbootSynchronousProxy {
3903    type Protocol = UserbootMarker;
3904
3905    fn from_client(value: fidl::endpoints::ClientEnd<UserbootMarker>) -> Self {
3906        Self::new(value.into_channel())
3907    }
3908}
3909
3910#[derive(Debug, Clone)]
3911pub struct UserbootProxy {
3912    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3913}
3914
3915impl fidl::endpoints::Proxy for UserbootProxy {
3916    type Protocol = UserbootMarker;
3917
3918    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3919        Self::new(inner)
3920    }
3921
3922    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3923        self.client.into_channel().map_err(|client| Self { client })
3924    }
3925
3926    fn as_channel(&self) -> &::fidl::AsyncChannel {
3927        self.client.as_channel()
3928    }
3929}
3930
3931impl UserbootProxy {
3932    /// Create a new Proxy for fuchsia.boot/Userboot.
3933    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3934        let protocol_name = <UserbootMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3935        Self { client: fidl::client::Client::new(channel, protocol_name) }
3936    }
3937
3938    /// Get a Stream of events from the remote end of the protocol.
3939    ///
3940    /// # Panics
3941    ///
3942    /// Panics if the event stream was already taken.
3943    pub fn take_event_stream(&self) -> UserbootEventStream {
3944        UserbootEventStream { event_receiver: self.client.take_event_receiver() }
3945    }
3946
3947    /// Posts the uncompressed bootfs VMO.
3948    pub fn r#post_bootfs_vmo(&self, mut bootfs: fidl::Vmo) -> Result<(), fidl::Error> {
3949        UserbootProxyInterface::r#post_bootfs_vmo(self, bootfs)
3950    }
3951
3952    /// Posts a set of `BootfsFileVmo` that were used for launching the `userboot.next=` program and are no longer
3953    /// available in the big BootfsVmo.
3954    ///
3955    /// Messages will only become available after the `Userboot` protocol client end (userboot's handle)
3956    /// has been closed.
3957    pub fn r#post_bootfs_files(&self, mut files: Vec<BootfsFileVmo>) -> Result<(), fidl::Error> {
3958        UserbootProxyInterface::r#post_bootfs_files(self, files)
3959    }
3960
3961    /// Posts non-bootstrap handles provided by the kernel to the booted process.
3962    pub fn r#post_boot_handles(
3963        &self,
3964        mut payload: UserbootPostBootHandlesRequest,
3965    ) -> Result<(), fidl::Error> {
3966        UserbootProxyInterface::r#post_boot_handles(self, payload)
3967    }
3968
3969    /// Posts `svc_stash` server endpoint. For more information refer to `fuchsia.boot.SvcStash`.
3970    pub fn r#post_stash_svc(
3971        &self,
3972        mut stash_svc_endpoint: fidl::endpoints::ServerEnd<SvcStashMarker>,
3973    ) -> Result<(), fidl::Error> {
3974        UserbootProxyInterface::r#post_stash_svc(self, stash_svc_endpoint)
3975    }
3976}
3977
3978impl UserbootProxyInterface for UserbootProxy {
3979    fn r#post_bootfs_vmo(&self, mut bootfs: fidl::Vmo) -> Result<(), fidl::Error> {
3980        self.client.send::<UserbootPostBootfsVmoRequest>(
3981            (bootfs,),
3982            0x3ba75f7fdc77fff3,
3983            fidl::encoding::DynamicFlags::empty(),
3984        )
3985    }
3986
3987    fn r#post_bootfs_files(&self, mut files: Vec<BootfsFileVmo>) -> Result<(), fidl::Error> {
3988        self.client.send::<UserbootPostBootfsFilesRequest>(
3989            (files.as_mut(),),
3990            0x296d4420db7cc694,
3991            fidl::encoding::DynamicFlags::empty(),
3992        )
3993    }
3994
3995    fn r#post_boot_handles(
3996        &self,
3997        mut payload: UserbootPostBootHandlesRequest,
3998    ) -> Result<(), fidl::Error> {
3999        self.client.send::<UserbootPostBootHandlesRequest>(
4000            &mut payload,
4001            0x6102b54175b3f1eb,
4002            fidl::encoding::DynamicFlags::empty(),
4003        )
4004    }
4005
4006    fn r#post_stash_svc(
4007        &self,
4008        mut stash_svc_endpoint: fidl::endpoints::ServerEnd<SvcStashMarker>,
4009    ) -> Result<(), fidl::Error> {
4010        self.client.send::<UserbootPostStashSvcRequest>(
4011            (stash_svc_endpoint,),
4012            0x506ecf7db01adeac,
4013            fidl::encoding::DynamicFlags::empty(),
4014        )
4015    }
4016}
4017
4018pub struct UserbootEventStream {
4019    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4020}
4021
4022impl std::marker::Unpin for UserbootEventStream {}
4023
4024impl futures::stream::FusedStream for UserbootEventStream {
4025    fn is_terminated(&self) -> bool {
4026        self.event_receiver.is_terminated()
4027    }
4028}
4029
4030impl futures::Stream for UserbootEventStream {
4031    type Item = Result<UserbootEvent, fidl::Error>;
4032
4033    fn poll_next(
4034        mut self: std::pin::Pin<&mut Self>,
4035        cx: &mut std::task::Context<'_>,
4036    ) -> std::task::Poll<Option<Self::Item>> {
4037        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4038            &mut self.event_receiver,
4039            cx
4040        )?) {
4041            Some(buf) => std::task::Poll::Ready(Some(UserbootEvent::decode(buf))),
4042            None => std::task::Poll::Ready(None),
4043        }
4044    }
4045}
4046
4047#[derive(Debug)]
4048pub enum UserbootEvent {}
4049
4050impl UserbootEvent {
4051    /// Decodes a message buffer as a [`UserbootEvent`].
4052    fn decode(
4053        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4054    ) -> Result<UserbootEvent, fidl::Error> {
4055        let (bytes, _handles) = buf.split_mut();
4056        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4057        debug_assert_eq!(tx_header.tx_id, 0);
4058        match tx_header.ordinal {
4059            _ => Err(fidl::Error::UnknownOrdinal {
4060                ordinal: tx_header.ordinal,
4061                protocol_name: <UserbootMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4062            }),
4063        }
4064    }
4065}
4066
4067/// A Stream of incoming requests for fuchsia.boot/Userboot.
4068pub struct UserbootRequestStream {
4069    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4070    is_terminated: bool,
4071}
4072
4073impl std::marker::Unpin for UserbootRequestStream {}
4074
4075impl futures::stream::FusedStream for UserbootRequestStream {
4076    fn is_terminated(&self) -> bool {
4077        self.is_terminated
4078    }
4079}
4080
4081impl fidl::endpoints::RequestStream for UserbootRequestStream {
4082    type Protocol = UserbootMarker;
4083    type ControlHandle = UserbootControlHandle;
4084
4085    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4086        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4087    }
4088
4089    fn control_handle(&self) -> Self::ControlHandle {
4090        UserbootControlHandle { inner: self.inner.clone() }
4091    }
4092
4093    fn into_inner(
4094        self,
4095    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4096    {
4097        (self.inner, self.is_terminated)
4098    }
4099
4100    fn from_inner(
4101        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4102        is_terminated: bool,
4103    ) -> Self {
4104        Self { inner, is_terminated }
4105    }
4106}
4107
4108impl futures::Stream for UserbootRequestStream {
4109    type Item = Result<UserbootRequest, fidl::Error>;
4110
4111    fn poll_next(
4112        mut self: std::pin::Pin<&mut Self>,
4113        cx: &mut std::task::Context<'_>,
4114    ) -> std::task::Poll<Option<Self::Item>> {
4115        let this = &mut *self;
4116        if this.inner.check_shutdown(cx) {
4117            this.is_terminated = true;
4118            return std::task::Poll::Ready(None);
4119        }
4120        if this.is_terminated {
4121            panic!("polled UserbootRequestStream after completion");
4122        }
4123        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4124            |bytes, handles| {
4125                match this.inner.channel().read_etc(cx, bytes, handles) {
4126                    std::task::Poll::Ready(Ok(())) => {}
4127                    std::task::Poll::Pending => return std::task::Poll::Pending,
4128                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4129                        this.is_terminated = true;
4130                        return std::task::Poll::Ready(None);
4131                    }
4132                    std::task::Poll::Ready(Err(e)) => {
4133                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4134                            e.into(),
4135                        ))));
4136                    }
4137                }
4138
4139                // A message has been received from the channel
4140                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4141
4142                std::task::Poll::Ready(Some(match header.ordinal {
4143                    0x3ba75f7fdc77fff3 => {
4144                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4145                        let mut req = fidl::new_empty!(
4146                            UserbootPostBootfsVmoRequest,
4147                            fidl::encoding::DefaultFuchsiaResourceDialect
4148                        );
4149                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UserbootPostBootfsVmoRequest>(&header, _body_bytes, handles, &mut req)?;
4150                        let control_handle = UserbootControlHandle { inner: this.inner.clone() };
4151                        Ok(UserbootRequest::PostBootfsVmo { bootfs: req.bootfs, control_handle })
4152                    }
4153                    0x296d4420db7cc694 => {
4154                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4155                        let mut req = fidl::new_empty!(
4156                            UserbootPostBootfsFilesRequest,
4157                            fidl::encoding::DefaultFuchsiaResourceDialect
4158                        );
4159                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UserbootPostBootfsFilesRequest>(&header, _body_bytes, handles, &mut req)?;
4160                        let control_handle = UserbootControlHandle { inner: this.inner.clone() };
4161                        Ok(UserbootRequest::PostBootfsFiles { files: req.files, control_handle })
4162                    }
4163                    0x6102b54175b3f1eb => {
4164                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4165                        let mut req = fidl::new_empty!(
4166                            UserbootPostBootHandlesRequest,
4167                            fidl::encoding::DefaultFuchsiaResourceDialect
4168                        );
4169                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UserbootPostBootHandlesRequest>(&header, _body_bytes, handles, &mut req)?;
4170                        let control_handle = UserbootControlHandle { inner: this.inner.clone() };
4171                        Ok(UserbootRequest::PostBootHandles { payload: req, control_handle })
4172                    }
4173                    0x506ecf7db01adeac => {
4174                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4175                        let mut req = fidl::new_empty!(
4176                            UserbootPostStashSvcRequest,
4177                            fidl::encoding::DefaultFuchsiaResourceDialect
4178                        );
4179                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UserbootPostStashSvcRequest>(&header, _body_bytes, handles, &mut req)?;
4180                        let control_handle = UserbootControlHandle { inner: this.inner.clone() };
4181                        Ok(UserbootRequest::PostStashSvc {
4182                            stash_svc_endpoint: req.stash_svc_endpoint,
4183
4184                            control_handle,
4185                        })
4186                    }
4187                    _ => Err(fidl::Error::UnknownOrdinal {
4188                        ordinal: header.ordinal,
4189                        protocol_name:
4190                            <UserbootMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4191                    }),
4192                }))
4193            },
4194        )
4195    }
4196}
4197
4198/// Protocol for communication between `userboot` and the process booted by userboot.
4199///
4200/// The userboot process will act as a client, pipelining requests containing information and/or handles that might
4201/// be useful for the booted process. The booted process, or whoever processes the server endpoint of this protocol,
4202/// will then process the pipelined requests from userboot.
4203#[derive(Debug)]
4204pub enum UserbootRequest {
4205    /// Posts the uncompressed bootfs VMO.
4206    PostBootfsVmo { bootfs: fidl::Vmo, control_handle: UserbootControlHandle },
4207    /// Posts a set of `BootfsFileVmo` that were used for launching the `userboot.next=` program and are no longer
4208    /// available in the big BootfsVmo.
4209    ///
4210    /// Messages will only become available after the `Userboot` protocol client end (userboot's handle)
4211    /// has been closed.
4212    PostBootfsFiles { files: Vec<BootfsFileVmo>, control_handle: UserbootControlHandle },
4213    /// Posts non-bootstrap handles provided by the kernel to the booted process.
4214    PostBootHandles {
4215        payload: UserbootPostBootHandlesRequest,
4216        control_handle: UserbootControlHandle,
4217    },
4218    /// Posts `svc_stash` server endpoint. For more information refer to `fuchsia.boot.SvcStash`.
4219    PostStashSvc {
4220        stash_svc_endpoint: fidl::endpoints::ServerEnd<SvcStashMarker>,
4221        control_handle: UserbootControlHandle,
4222    },
4223}
4224
4225impl UserbootRequest {
4226    #[allow(irrefutable_let_patterns)]
4227    pub fn into_post_bootfs_vmo(self) -> Option<(fidl::Vmo, UserbootControlHandle)> {
4228        if let UserbootRequest::PostBootfsVmo { bootfs, control_handle } = self {
4229            Some((bootfs, control_handle))
4230        } else {
4231            None
4232        }
4233    }
4234
4235    #[allow(irrefutable_let_patterns)]
4236    pub fn into_post_bootfs_files(self) -> Option<(Vec<BootfsFileVmo>, UserbootControlHandle)> {
4237        if let UserbootRequest::PostBootfsFiles { files, control_handle } = self {
4238            Some((files, control_handle))
4239        } else {
4240            None
4241        }
4242    }
4243
4244    #[allow(irrefutable_let_patterns)]
4245    pub fn into_post_boot_handles(
4246        self,
4247    ) -> Option<(UserbootPostBootHandlesRequest, UserbootControlHandle)> {
4248        if let UserbootRequest::PostBootHandles { payload, control_handle } = self {
4249            Some((payload, control_handle))
4250        } else {
4251            None
4252        }
4253    }
4254
4255    #[allow(irrefutable_let_patterns)]
4256    pub fn into_post_stash_svc(
4257        self,
4258    ) -> Option<(fidl::endpoints::ServerEnd<SvcStashMarker>, UserbootControlHandle)> {
4259        if let UserbootRequest::PostStashSvc { stash_svc_endpoint, control_handle } = self {
4260            Some((stash_svc_endpoint, control_handle))
4261        } else {
4262            None
4263        }
4264    }
4265
4266    /// Name of the method defined in FIDL
4267    pub fn method_name(&self) -> &'static str {
4268        match *self {
4269            UserbootRequest::PostBootfsVmo { .. } => "post_bootfs_vmo",
4270            UserbootRequest::PostBootfsFiles { .. } => "post_bootfs_files",
4271            UserbootRequest::PostBootHandles { .. } => "post_boot_handles",
4272            UserbootRequest::PostStashSvc { .. } => "post_stash_svc",
4273        }
4274    }
4275}
4276
4277#[derive(Debug, Clone)]
4278pub struct UserbootControlHandle {
4279    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4280}
4281
4282impl UserbootControlHandle {
4283    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4284        self.inner.shutdown_with_epitaph(status.into())
4285    }
4286}
4287
4288impl fidl::endpoints::ControlHandle for UserbootControlHandle {
4289    fn shutdown(&self) {
4290        self.inner.shutdown()
4291    }
4292
4293    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4294        self.inner.shutdown_with_epitaph(status)
4295    }
4296
4297    fn is_closed(&self) -> bool {
4298        self.inner.channel().is_closed()
4299    }
4300    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4301        self.inner.channel().on_closed()
4302    }
4303
4304    #[cfg(target_os = "fuchsia")]
4305    fn signal_peer(
4306        &self,
4307        clear_mask: zx::Signals,
4308        set_mask: zx::Signals,
4309    ) -> Result<(), zx_status::Status> {
4310        use fidl::Peered;
4311        self.inner.channel().signal_peer(clear_mask, set_mask)
4312    }
4313}
4314
4315impl UserbootControlHandle {}
4316
4317#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4318pub struct WriteOnlyLogMarker;
4319
4320impl fidl::endpoints::ProtocolMarker for WriteOnlyLogMarker {
4321    type Proxy = WriteOnlyLogProxy;
4322    type RequestStream = WriteOnlyLogRequestStream;
4323    #[cfg(target_os = "fuchsia")]
4324    type SynchronousProxy = WriteOnlyLogSynchronousProxy;
4325
4326    const DEBUG_NAME: &'static str = "fuchsia.boot.WriteOnlyLog";
4327}
4328impl fidl::endpoints::DiscoverableProtocolMarker for WriteOnlyLogMarker {}
4329
4330pub trait WriteOnlyLogProxyInterface: Send + Sync {
4331    type GetResponseFut: std::future::Future<Output = Result<fidl::DebugLog, fidl::Error>> + Send;
4332    fn r#get(&self) -> Self::GetResponseFut;
4333}
4334#[derive(Debug)]
4335#[cfg(target_os = "fuchsia")]
4336pub struct WriteOnlyLogSynchronousProxy {
4337    client: fidl::client::sync::Client,
4338}
4339
4340#[cfg(target_os = "fuchsia")]
4341impl fidl::endpoints::SynchronousProxy for WriteOnlyLogSynchronousProxy {
4342    type Proxy = WriteOnlyLogProxy;
4343    type Protocol = WriteOnlyLogMarker;
4344
4345    fn from_channel(inner: fidl::Channel) -> Self {
4346        Self::new(inner)
4347    }
4348
4349    fn into_channel(self) -> fidl::Channel {
4350        self.client.into_channel()
4351    }
4352
4353    fn as_channel(&self) -> &fidl::Channel {
4354        self.client.as_channel()
4355    }
4356}
4357
4358#[cfg(target_os = "fuchsia")]
4359impl WriteOnlyLogSynchronousProxy {
4360    pub fn new(channel: fidl::Channel) -> Self {
4361        Self { client: fidl::client::sync::Client::new(channel) }
4362    }
4363
4364    pub fn into_channel(self) -> fidl::Channel {
4365        self.client.into_channel()
4366    }
4367
4368    /// Waits until an event arrives and returns it. It is safe for other
4369    /// threads to make concurrent requests while waiting for an event.
4370    pub fn wait_for_event(
4371        &self,
4372        deadline: zx::MonotonicInstant,
4373    ) -> Result<WriteOnlyLogEvent, fidl::Error> {
4374        WriteOnlyLogEvent::decode(self.client.wait_for_event::<WriteOnlyLogMarker>(deadline)?)
4375    }
4376
4377    /// Get write-only handle to the kernel `log`.
4378    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::DebugLog, fidl::Error> {
4379        let _response = self.client.send_query::<
4380            fidl::encoding::EmptyPayload,
4381            WriteOnlyLogGetResponse,
4382            WriteOnlyLogMarker,
4383        >(
4384            (),
4385            0x4579dac289d3007,
4386            fidl::encoding::DynamicFlags::empty(),
4387            ___deadline,
4388        )?;
4389        Ok(_response.log)
4390    }
4391}
4392
4393#[cfg(target_os = "fuchsia")]
4394impl From<WriteOnlyLogSynchronousProxy> for zx::NullableHandle {
4395    fn from(value: WriteOnlyLogSynchronousProxy) -> Self {
4396        value.into_channel().into()
4397    }
4398}
4399
4400#[cfg(target_os = "fuchsia")]
4401impl From<fidl::Channel> for WriteOnlyLogSynchronousProxy {
4402    fn from(value: fidl::Channel) -> Self {
4403        Self::new(value)
4404    }
4405}
4406
4407#[cfg(target_os = "fuchsia")]
4408impl fidl::endpoints::FromClient for WriteOnlyLogSynchronousProxy {
4409    type Protocol = WriteOnlyLogMarker;
4410
4411    fn from_client(value: fidl::endpoints::ClientEnd<WriteOnlyLogMarker>) -> Self {
4412        Self::new(value.into_channel())
4413    }
4414}
4415
4416#[derive(Debug, Clone)]
4417pub struct WriteOnlyLogProxy {
4418    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4419}
4420
4421impl fidl::endpoints::Proxy for WriteOnlyLogProxy {
4422    type Protocol = WriteOnlyLogMarker;
4423
4424    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4425        Self::new(inner)
4426    }
4427
4428    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4429        self.client.into_channel().map_err(|client| Self { client })
4430    }
4431
4432    fn as_channel(&self) -> &::fidl::AsyncChannel {
4433        self.client.as_channel()
4434    }
4435}
4436
4437impl WriteOnlyLogProxy {
4438    /// Create a new Proxy for fuchsia.boot/WriteOnlyLog.
4439    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4440        let protocol_name = <WriteOnlyLogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4441        Self { client: fidl::client::Client::new(channel, protocol_name) }
4442    }
4443
4444    /// Get a Stream of events from the remote end of the protocol.
4445    ///
4446    /// # Panics
4447    ///
4448    /// Panics if the event stream was already taken.
4449    pub fn take_event_stream(&self) -> WriteOnlyLogEventStream {
4450        WriteOnlyLogEventStream { event_receiver: self.client.take_event_receiver() }
4451    }
4452
4453    /// Get write-only handle to the kernel `log`.
4454    pub fn r#get(
4455        &self,
4456    ) -> fidl::client::QueryResponseFut<fidl::DebugLog, fidl::encoding::DefaultFuchsiaResourceDialect>
4457    {
4458        WriteOnlyLogProxyInterface::r#get(self)
4459    }
4460}
4461
4462impl WriteOnlyLogProxyInterface for WriteOnlyLogProxy {
4463    type GetResponseFut = fidl::client::QueryResponseFut<
4464        fidl::DebugLog,
4465        fidl::encoding::DefaultFuchsiaResourceDialect,
4466    >;
4467    fn r#get(&self) -> Self::GetResponseFut {
4468        fn _decode(
4469            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4470        ) -> Result<fidl::DebugLog, fidl::Error> {
4471            let _response = fidl::client::decode_transaction_body::<
4472                WriteOnlyLogGetResponse,
4473                fidl::encoding::DefaultFuchsiaResourceDialect,
4474                0x4579dac289d3007,
4475            >(_buf?)?;
4476            Ok(_response.log)
4477        }
4478        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::DebugLog>(
4479            (),
4480            0x4579dac289d3007,
4481            fidl::encoding::DynamicFlags::empty(),
4482            _decode,
4483        )
4484    }
4485}
4486
4487pub struct WriteOnlyLogEventStream {
4488    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4489}
4490
4491impl std::marker::Unpin for WriteOnlyLogEventStream {}
4492
4493impl futures::stream::FusedStream for WriteOnlyLogEventStream {
4494    fn is_terminated(&self) -> bool {
4495        self.event_receiver.is_terminated()
4496    }
4497}
4498
4499impl futures::Stream for WriteOnlyLogEventStream {
4500    type Item = Result<WriteOnlyLogEvent, fidl::Error>;
4501
4502    fn poll_next(
4503        mut self: std::pin::Pin<&mut Self>,
4504        cx: &mut std::task::Context<'_>,
4505    ) -> std::task::Poll<Option<Self::Item>> {
4506        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4507            &mut self.event_receiver,
4508            cx
4509        )?) {
4510            Some(buf) => std::task::Poll::Ready(Some(WriteOnlyLogEvent::decode(buf))),
4511            None => std::task::Poll::Ready(None),
4512        }
4513    }
4514}
4515
4516#[derive(Debug)]
4517pub enum WriteOnlyLogEvent {}
4518
4519impl WriteOnlyLogEvent {
4520    /// Decodes a message buffer as a [`WriteOnlyLogEvent`].
4521    fn decode(
4522        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4523    ) -> Result<WriteOnlyLogEvent, fidl::Error> {
4524        let (bytes, _handles) = buf.split_mut();
4525        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4526        debug_assert_eq!(tx_header.tx_id, 0);
4527        match tx_header.ordinal {
4528            _ => Err(fidl::Error::UnknownOrdinal {
4529                ordinal: tx_header.ordinal,
4530                protocol_name: <WriteOnlyLogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4531            }),
4532        }
4533    }
4534}
4535
4536/// A Stream of incoming requests for fuchsia.boot/WriteOnlyLog.
4537pub struct WriteOnlyLogRequestStream {
4538    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4539    is_terminated: bool,
4540}
4541
4542impl std::marker::Unpin for WriteOnlyLogRequestStream {}
4543
4544impl futures::stream::FusedStream for WriteOnlyLogRequestStream {
4545    fn is_terminated(&self) -> bool {
4546        self.is_terminated
4547    }
4548}
4549
4550impl fidl::endpoints::RequestStream for WriteOnlyLogRequestStream {
4551    type Protocol = WriteOnlyLogMarker;
4552    type ControlHandle = WriteOnlyLogControlHandle;
4553
4554    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4555        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4556    }
4557
4558    fn control_handle(&self) -> Self::ControlHandle {
4559        WriteOnlyLogControlHandle { inner: self.inner.clone() }
4560    }
4561
4562    fn into_inner(
4563        self,
4564    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4565    {
4566        (self.inner, self.is_terminated)
4567    }
4568
4569    fn from_inner(
4570        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4571        is_terminated: bool,
4572    ) -> Self {
4573        Self { inner, is_terminated }
4574    }
4575}
4576
4577impl futures::Stream for WriteOnlyLogRequestStream {
4578    type Item = Result<WriteOnlyLogRequest, fidl::Error>;
4579
4580    fn poll_next(
4581        mut self: std::pin::Pin<&mut Self>,
4582        cx: &mut std::task::Context<'_>,
4583    ) -> std::task::Poll<Option<Self::Item>> {
4584        let this = &mut *self;
4585        if this.inner.check_shutdown(cx) {
4586            this.is_terminated = true;
4587            return std::task::Poll::Ready(None);
4588        }
4589        if this.is_terminated {
4590            panic!("polled WriteOnlyLogRequestStream after completion");
4591        }
4592        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4593            |bytes, handles| {
4594                match this.inner.channel().read_etc(cx, bytes, handles) {
4595                    std::task::Poll::Ready(Ok(())) => {}
4596                    std::task::Poll::Pending => return std::task::Poll::Pending,
4597                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4598                        this.is_terminated = true;
4599                        return std::task::Poll::Ready(None);
4600                    }
4601                    std::task::Poll::Ready(Err(e)) => {
4602                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4603                            e.into(),
4604                        ))));
4605                    }
4606                }
4607
4608                // A message has been received from the channel
4609                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4610
4611                std::task::Poll::Ready(Some(match header.ordinal {
4612                    0x4579dac289d3007 => {
4613                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4614                        let mut req = fidl::new_empty!(
4615                            fidl::encoding::EmptyPayload,
4616                            fidl::encoding::DefaultFuchsiaResourceDialect
4617                        );
4618                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4619                        let control_handle =
4620                            WriteOnlyLogControlHandle { inner: this.inner.clone() };
4621                        Ok(WriteOnlyLogRequest::Get {
4622                            responder: WriteOnlyLogGetResponder {
4623                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4624                                tx_id: header.tx_id,
4625                            },
4626                        })
4627                    }
4628                    _ => Err(fidl::Error::UnknownOrdinal {
4629                        ordinal: header.ordinal,
4630                        protocol_name:
4631                            <WriteOnlyLogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4632                    }),
4633                }))
4634            },
4635        )
4636    }
4637}
4638
4639/// Protocol for providing the kernel log, writable.
4640#[derive(Debug)]
4641pub enum WriteOnlyLogRequest {
4642    /// Get write-only handle to the kernel `log`.
4643    Get { responder: WriteOnlyLogGetResponder },
4644}
4645
4646impl WriteOnlyLogRequest {
4647    #[allow(irrefutable_let_patterns)]
4648    pub fn into_get(self) -> Option<(WriteOnlyLogGetResponder)> {
4649        if let WriteOnlyLogRequest::Get { responder } = self { Some((responder)) } else { None }
4650    }
4651
4652    /// Name of the method defined in FIDL
4653    pub fn method_name(&self) -> &'static str {
4654        match *self {
4655            WriteOnlyLogRequest::Get { .. } => "get",
4656        }
4657    }
4658}
4659
4660#[derive(Debug, Clone)]
4661pub struct WriteOnlyLogControlHandle {
4662    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4663}
4664
4665impl WriteOnlyLogControlHandle {
4666    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4667        self.inner.shutdown_with_epitaph(status.into())
4668    }
4669}
4670
4671impl fidl::endpoints::ControlHandle for WriteOnlyLogControlHandle {
4672    fn shutdown(&self) {
4673        self.inner.shutdown()
4674    }
4675
4676    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4677        self.inner.shutdown_with_epitaph(status)
4678    }
4679
4680    fn is_closed(&self) -> bool {
4681        self.inner.channel().is_closed()
4682    }
4683    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4684        self.inner.channel().on_closed()
4685    }
4686
4687    #[cfg(target_os = "fuchsia")]
4688    fn signal_peer(
4689        &self,
4690        clear_mask: zx::Signals,
4691        set_mask: zx::Signals,
4692    ) -> Result<(), zx_status::Status> {
4693        use fidl::Peered;
4694        self.inner.channel().signal_peer(clear_mask, set_mask)
4695    }
4696}
4697
4698impl WriteOnlyLogControlHandle {}
4699
4700#[must_use = "FIDL methods require a response to be sent"]
4701#[derive(Debug)]
4702pub struct WriteOnlyLogGetResponder {
4703    control_handle: std::mem::ManuallyDrop<WriteOnlyLogControlHandle>,
4704    tx_id: u32,
4705}
4706
4707/// Set the the channel to be shutdown (see [`WriteOnlyLogControlHandle::shutdown`])
4708/// if the responder is dropped without sending a response, so that the client
4709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4710impl std::ops::Drop for WriteOnlyLogGetResponder {
4711    fn drop(&mut self) {
4712        self.control_handle.shutdown();
4713        // Safety: drops once, never accessed again
4714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4715    }
4716}
4717
4718impl fidl::endpoints::Responder for WriteOnlyLogGetResponder {
4719    type ControlHandle = WriteOnlyLogControlHandle;
4720
4721    fn control_handle(&self) -> &WriteOnlyLogControlHandle {
4722        &self.control_handle
4723    }
4724
4725    fn drop_without_shutdown(mut self) {
4726        // Safety: drops once, never accessed again due to mem::forget
4727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4728        // Prevent Drop from running (which would shut down the channel)
4729        std::mem::forget(self);
4730    }
4731}
4732
4733impl WriteOnlyLogGetResponder {
4734    /// Sends a response to the FIDL transaction.
4735    ///
4736    /// Sets the channel to shutdown if an error occurs.
4737    pub fn send(self, mut log: fidl::DebugLog) -> Result<(), fidl::Error> {
4738        let _result = self.send_raw(log);
4739        if _result.is_err() {
4740            self.control_handle.shutdown();
4741        }
4742        self.drop_without_shutdown();
4743        _result
4744    }
4745
4746    /// Similar to "send" but does not shutdown the channel if an error occurs.
4747    pub fn send_no_shutdown_on_err(self, mut log: fidl::DebugLog) -> Result<(), fidl::Error> {
4748        let _result = self.send_raw(log);
4749        self.drop_without_shutdown();
4750        _result
4751    }
4752
4753    fn send_raw(&self, mut log: fidl::DebugLog) -> Result<(), fidl::Error> {
4754        self.control_handle.inner.send::<WriteOnlyLogGetResponse>(
4755            (log,),
4756            self.tx_id,
4757            0x4579dac289d3007,
4758            fidl::encoding::DynamicFlags::empty(),
4759        )
4760    }
4761}
4762
4763mod internal {
4764    use super::*;
4765
4766    impl fidl::encoding::ResourceTypeMarker for BootfsFileVmo {
4767        type Borrowed<'a> = &'a mut Self;
4768        fn take_or_borrow<'a>(
4769            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4770        ) -> Self::Borrowed<'a> {
4771            value
4772        }
4773    }
4774
4775    unsafe impl fidl::encoding::TypeMarker for BootfsFileVmo {
4776        type Owned = Self;
4777
4778        #[inline(always)]
4779        fn inline_align(_context: fidl::encoding::Context) -> usize {
4780            4
4781        }
4782
4783        #[inline(always)]
4784        fn inline_size(_context: fidl::encoding::Context) -> usize {
4785            8
4786        }
4787    }
4788
4789    unsafe impl fidl::encoding::Encode<BootfsFileVmo, fidl::encoding::DefaultFuchsiaResourceDialect>
4790        for &mut BootfsFileVmo
4791    {
4792        #[inline]
4793        unsafe fn encode(
4794            self,
4795            encoder: &mut fidl::encoding::Encoder<
4796                '_,
4797                fidl::encoding::DefaultFuchsiaResourceDialect,
4798            >,
4799            offset: usize,
4800            _depth: fidl::encoding::Depth,
4801        ) -> fidl::Result<()> {
4802            encoder.debug_check_bounds::<BootfsFileVmo>(offset);
4803            // Delegate to tuple encoding.
4804            fidl::encoding::Encode::<BootfsFileVmo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4805                (
4806                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4807                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.contents),
4808                ),
4809                encoder, offset, _depth
4810            )
4811        }
4812    }
4813    unsafe impl<
4814        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4815        T1: fidl::encoding::Encode<
4816                fidl::encoding::HandleType<
4817                    fidl::Vmo,
4818                    { fidl::ObjectType::VMO.into_raw() },
4819                    2147483648,
4820                >,
4821                fidl::encoding::DefaultFuchsiaResourceDialect,
4822            >,
4823    > fidl::encoding::Encode<BootfsFileVmo, fidl::encoding::DefaultFuchsiaResourceDialect>
4824        for (T0, T1)
4825    {
4826        #[inline]
4827        unsafe fn encode(
4828            self,
4829            encoder: &mut fidl::encoding::Encoder<
4830                '_,
4831                fidl::encoding::DefaultFuchsiaResourceDialect,
4832            >,
4833            offset: usize,
4834            depth: fidl::encoding::Depth,
4835        ) -> fidl::Result<()> {
4836            encoder.debug_check_bounds::<BootfsFileVmo>(offset);
4837            // Zero out padding regions. There's no need to apply masks
4838            // because the unmasked parts will be overwritten by fields.
4839            // Write the fields.
4840            self.0.encode(encoder, offset + 0, depth)?;
4841            self.1.encode(encoder, offset + 4, depth)?;
4842            Ok(())
4843        }
4844    }
4845
4846    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BootfsFileVmo {
4847        #[inline(always)]
4848        fn new_empty() -> Self {
4849            Self {
4850                offset: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4851                contents: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4852            }
4853        }
4854
4855        #[inline]
4856        unsafe fn decode(
4857            &mut self,
4858            decoder: &mut fidl::encoding::Decoder<
4859                '_,
4860                fidl::encoding::DefaultFuchsiaResourceDialect,
4861            >,
4862            offset: usize,
4863            _depth: fidl::encoding::Depth,
4864        ) -> fidl::Result<()> {
4865            decoder.debug_check_bounds::<Self>(offset);
4866            // Verify that padding bytes are zero.
4867            fidl::decode!(
4868                u32,
4869                fidl::encoding::DefaultFuchsiaResourceDialect,
4870                &mut self.offset,
4871                decoder,
4872                offset + 0,
4873                _depth
4874            )?;
4875            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.contents, decoder, offset + 4, _depth)?;
4876            Ok(())
4877        }
4878    }
4879
4880    impl fidl::encoding::ResourceTypeMarker for FactoryItemsGetResponse {
4881        type Borrowed<'a> = &'a mut Self;
4882        fn take_or_borrow<'a>(
4883            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4884        ) -> Self::Borrowed<'a> {
4885            value
4886        }
4887    }
4888
4889    unsafe impl fidl::encoding::TypeMarker for FactoryItemsGetResponse {
4890        type Owned = Self;
4891
4892        #[inline(always)]
4893        fn inline_align(_context: fidl::encoding::Context) -> usize {
4894            4
4895        }
4896
4897        #[inline(always)]
4898        fn inline_size(_context: fidl::encoding::Context) -> usize {
4899            8
4900        }
4901    }
4902
4903    unsafe impl
4904        fidl::encoding::Encode<
4905            FactoryItemsGetResponse,
4906            fidl::encoding::DefaultFuchsiaResourceDialect,
4907        > for &mut FactoryItemsGetResponse
4908    {
4909        #[inline]
4910        unsafe fn encode(
4911            self,
4912            encoder: &mut fidl::encoding::Encoder<
4913                '_,
4914                fidl::encoding::DefaultFuchsiaResourceDialect,
4915            >,
4916            offset: usize,
4917            _depth: fidl::encoding::Depth,
4918        ) -> fidl::Result<()> {
4919            encoder.debug_check_bounds::<FactoryItemsGetResponse>(offset);
4920            // Delegate to tuple encoding.
4921            fidl::encoding::Encode::<
4922                FactoryItemsGetResponse,
4923                fidl::encoding::DefaultFuchsiaResourceDialect,
4924            >::encode(
4925                (
4926                    <fidl::encoding::Optional<
4927                        fidl::encoding::HandleType<
4928                            fidl::Vmo,
4929                            { fidl::ObjectType::VMO.into_raw() },
4930                            2147483648,
4931                        >,
4932                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4933                        &mut self.payload
4934                    ),
4935                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.length),
4936                ),
4937                encoder,
4938                offset,
4939                _depth,
4940            )
4941        }
4942    }
4943    unsafe impl<
4944        T0: fidl::encoding::Encode<
4945                fidl::encoding::Optional<
4946                    fidl::encoding::HandleType<
4947                        fidl::Vmo,
4948                        { fidl::ObjectType::VMO.into_raw() },
4949                        2147483648,
4950                    >,
4951                >,
4952                fidl::encoding::DefaultFuchsiaResourceDialect,
4953            >,
4954        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4955    >
4956        fidl::encoding::Encode<
4957            FactoryItemsGetResponse,
4958            fidl::encoding::DefaultFuchsiaResourceDialect,
4959        > for (T0, T1)
4960    {
4961        #[inline]
4962        unsafe fn encode(
4963            self,
4964            encoder: &mut fidl::encoding::Encoder<
4965                '_,
4966                fidl::encoding::DefaultFuchsiaResourceDialect,
4967            >,
4968            offset: usize,
4969            depth: fidl::encoding::Depth,
4970        ) -> fidl::Result<()> {
4971            encoder.debug_check_bounds::<FactoryItemsGetResponse>(offset);
4972            // Zero out padding regions. There's no need to apply masks
4973            // because the unmasked parts will be overwritten by fields.
4974            // Write the fields.
4975            self.0.encode(encoder, offset + 0, depth)?;
4976            self.1.encode(encoder, offset + 4, depth)?;
4977            Ok(())
4978        }
4979    }
4980
4981    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4982        for FactoryItemsGetResponse
4983    {
4984        #[inline(always)]
4985        fn new_empty() -> Self {
4986            Self {
4987                payload: fidl::new_empty!(
4988                    fidl::encoding::Optional<
4989                        fidl::encoding::HandleType<
4990                            fidl::Vmo,
4991                            { fidl::ObjectType::VMO.into_raw() },
4992                            2147483648,
4993                        >,
4994                    >,
4995                    fidl::encoding::DefaultFuchsiaResourceDialect
4996                ),
4997                length: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4998            }
4999        }
5000
5001        #[inline]
5002        unsafe fn decode(
5003            &mut self,
5004            decoder: &mut fidl::encoding::Decoder<
5005                '_,
5006                fidl::encoding::DefaultFuchsiaResourceDialect,
5007            >,
5008            offset: usize,
5009            _depth: fidl::encoding::Depth,
5010        ) -> fidl::Result<()> {
5011            decoder.debug_check_bounds::<Self>(offset);
5012            // Verify that padding bytes are zero.
5013            fidl::decode!(
5014                fidl::encoding::Optional<
5015                    fidl::encoding::HandleType<
5016                        fidl::Vmo,
5017                        { fidl::ObjectType::VMO.into_raw() },
5018                        2147483648,
5019                    >,
5020                >,
5021                fidl::encoding::DefaultFuchsiaResourceDialect,
5022                &mut self.payload,
5023                decoder,
5024                offset + 0,
5025                _depth
5026            )?;
5027            fidl::decode!(
5028                u32,
5029                fidl::encoding::DefaultFuchsiaResourceDialect,
5030                &mut self.length,
5031                decoder,
5032                offset + 4,
5033                _depth
5034            )?;
5035            Ok(())
5036        }
5037    }
5038
5039    impl fidl::encoding::ResourceTypeMarker for ItemsGetBootloaderFileResponse {
5040        type Borrowed<'a> = &'a mut Self;
5041        fn take_or_borrow<'a>(
5042            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5043        ) -> Self::Borrowed<'a> {
5044            value
5045        }
5046    }
5047
5048    unsafe impl fidl::encoding::TypeMarker for ItemsGetBootloaderFileResponse {
5049        type Owned = Self;
5050
5051        #[inline(always)]
5052        fn inline_align(_context: fidl::encoding::Context) -> usize {
5053            4
5054        }
5055
5056        #[inline(always)]
5057        fn inline_size(_context: fidl::encoding::Context) -> usize {
5058            4
5059        }
5060    }
5061
5062    unsafe impl
5063        fidl::encoding::Encode<
5064            ItemsGetBootloaderFileResponse,
5065            fidl::encoding::DefaultFuchsiaResourceDialect,
5066        > for &mut ItemsGetBootloaderFileResponse
5067    {
5068        #[inline]
5069        unsafe fn encode(
5070            self,
5071            encoder: &mut fidl::encoding::Encoder<
5072                '_,
5073                fidl::encoding::DefaultFuchsiaResourceDialect,
5074            >,
5075            offset: usize,
5076            _depth: fidl::encoding::Depth,
5077        ) -> fidl::Result<()> {
5078            encoder.debug_check_bounds::<ItemsGetBootloaderFileResponse>(offset);
5079            // Delegate to tuple encoding.
5080            fidl::encoding::Encode::<
5081                ItemsGetBootloaderFileResponse,
5082                fidl::encoding::DefaultFuchsiaResourceDialect,
5083            >::encode(
5084                (<fidl::encoding::Optional<
5085                    fidl::encoding::HandleType<
5086                        fidl::Vmo,
5087                        { fidl::ObjectType::VMO.into_raw() },
5088                        2147483648,
5089                    >,
5090                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5091                    &mut self.payload
5092                ),),
5093                encoder,
5094                offset,
5095                _depth,
5096            )
5097        }
5098    }
5099    unsafe impl<
5100        T0: fidl::encoding::Encode<
5101                fidl::encoding::Optional<
5102                    fidl::encoding::HandleType<
5103                        fidl::Vmo,
5104                        { fidl::ObjectType::VMO.into_raw() },
5105                        2147483648,
5106                    >,
5107                >,
5108                fidl::encoding::DefaultFuchsiaResourceDialect,
5109            >,
5110    >
5111        fidl::encoding::Encode<
5112            ItemsGetBootloaderFileResponse,
5113            fidl::encoding::DefaultFuchsiaResourceDialect,
5114        > for (T0,)
5115    {
5116        #[inline]
5117        unsafe fn encode(
5118            self,
5119            encoder: &mut fidl::encoding::Encoder<
5120                '_,
5121                fidl::encoding::DefaultFuchsiaResourceDialect,
5122            >,
5123            offset: usize,
5124            depth: fidl::encoding::Depth,
5125        ) -> fidl::Result<()> {
5126            encoder.debug_check_bounds::<ItemsGetBootloaderFileResponse>(offset);
5127            // Zero out padding regions. There's no need to apply masks
5128            // because the unmasked parts will be overwritten by fields.
5129            // Write the fields.
5130            self.0.encode(encoder, offset + 0, depth)?;
5131            Ok(())
5132        }
5133    }
5134
5135    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5136        for ItemsGetBootloaderFileResponse
5137    {
5138        #[inline(always)]
5139        fn new_empty() -> Self {
5140            Self {
5141                payload: fidl::new_empty!(
5142                    fidl::encoding::Optional<
5143                        fidl::encoding::HandleType<
5144                            fidl::Vmo,
5145                            { fidl::ObjectType::VMO.into_raw() },
5146                            2147483648,
5147                        >,
5148                    >,
5149                    fidl::encoding::DefaultFuchsiaResourceDialect
5150                ),
5151            }
5152        }
5153
5154        #[inline]
5155        unsafe fn decode(
5156            &mut self,
5157            decoder: &mut fidl::encoding::Decoder<
5158                '_,
5159                fidl::encoding::DefaultFuchsiaResourceDialect,
5160            >,
5161            offset: usize,
5162            _depth: fidl::encoding::Depth,
5163        ) -> fidl::Result<()> {
5164            decoder.debug_check_bounds::<Self>(offset);
5165            // Verify that padding bytes are zero.
5166            fidl::decode!(
5167                fidl::encoding::Optional<
5168                    fidl::encoding::HandleType<
5169                        fidl::Vmo,
5170                        { fidl::ObjectType::VMO.into_raw() },
5171                        2147483648,
5172                    >,
5173                >,
5174                fidl::encoding::DefaultFuchsiaResourceDialect,
5175                &mut self.payload,
5176                decoder,
5177                offset + 0,
5178                _depth
5179            )?;
5180            Ok(())
5181        }
5182    }
5183
5184    impl fidl::encoding::ResourceTypeMarker for ItemsGetResponse {
5185        type Borrowed<'a> = &'a mut Self;
5186        fn take_or_borrow<'a>(
5187            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5188        ) -> Self::Borrowed<'a> {
5189            value
5190        }
5191    }
5192
5193    unsafe impl fidl::encoding::TypeMarker for ItemsGetResponse {
5194        type Owned = Self;
5195
5196        #[inline(always)]
5197        fn inline_align(_context: fidl::encoding::Context) -> usize {
5198            4
5199        }
5200
5201        #[inline(always)]
5202        fn inline_size(_context: fidl::encoding::Context) -> usize {
5203            8
5204        }
5205    }
5206
5207    unsafe impl
5208        fidl::encoding::Encode<ItemsGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
5209        for &mut ItemsGetResponse
5210    {
5211        #[inline]
5212        unsafe fn encode(
5213            self,
5214            encoder: &mut fidl::encoding::Encoder<
5215                '_,
5216                fidl::encoding::DefaultFuchsiaResourceDialect,
5217            >,
5218            offset: usize,
5219            _depth: fidl::encoding::Depth,
5220        ) -> fidl::Result<()> {
5221            encoder.debug_check_bounds::<ItemsGetResponse>(offset);
5222            // Delegate to tuple encoding.
5223            fidl::encoding::Encode::<ItemsGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5224                (
5225                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
5226                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.length),
5227                ),
5228                encoder, offset, _depth
5229            )
5230        }
5231    }
5232    unsafe impl<
5233        T0: fidl::encoding::Encode<
5234                fidl::encoding::Optional<
5235                    fidl::encoding::HandleType<
5236                        fidl::Vmo,
5237                        { fidl::ObjectType::VMO.into_raw() },
5238                        2147483648,
5239                    >,
5240                >,
5241                fidl::encoding::DefaultFuchsiaResourceDialect,
5242            >,
5243        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
5244    > fidl::encoding::Encode<ItemsGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
5245        for (T0, T1)
5246    {
5247        #[inline]
5248        unsafe fn encode(
5249            self,
5250            encoder: &mut fidl::encoding::Encoder<
5251                '_,
5252                fidl::encoding::DefaultFuchsiaResourceDialect,
5253            >,
5254            offset: usize,
5255            depth: fidl::encoding::Depth,
5256        ) -> fidl::Result<()> {
5257            encoder.debug_check_bounds::<ItemsGetResponse>(offset);
5258            // Zero out padding regions. There's no need to apply masks
5259            // because the unmasked parts will be overwritten by fields.
5260            // Write the fields.
5261            self.0.encode(encoder, offset + 0, depth)?;
5262            self.1.encode(encoder, offset + 4, depth)?;
5263            Ok(())
5264        }
5265    }
5266
5267    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5268        for ItemsGetResponse
5269    {
5270        #[inline(always)]
5271        fn new_empty() -> Self {
5272            Self {
5273                payload: fidl::new_empty!(
5274                    fidl::encoding::Optional<
5275                        fidl::encoding::HandleType<
5276                            fidl::Vmo,
5277                            { fidl::ObjectType::VMO.into_raw() },
5278                            2147483648,
5279                        >,
5280                    >,
5281                    fidl::encoding::DefaultFuchsiaResourceDialect
5282                ),
5283                length: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
5284            }
5285        }
5286
5287        #[inline]
5288        unsafe fn decode(
5289            &mut self,
5290            decoder: &mut fidl::encoding::Decoder<
5291                '_,
5292                fidl::encoding::DefaultFuchsiaResourceDialect,
5293            >,
5294            offset: usize,
5295            _depth: fidl::encoding::Depth,
5296        ) -> fidl::Result<()> {
5297            decoder.debug_check_bounds::<Self>(offset);
5298            // Verify that padding bytes are zero.
5299            fidl::decode!(
5300                fidl::encoding::Optional<
5301                    fidl::encoding::HandleType<
5302                        fidl::Vmo,
5303                        { fidl::ObjectType::VMO.into_raw() },
5304                        2147483648,
5305                    >,
5306                >,
5307                fidl::encoding::DefaultFuchsiaResourceDialect,
5308                &mut self.payload,
5309                decoder,
5310                offset + 0,
5311                _depth
5312            )?;
5313            fidl::decode!(
5314                u32,
5315                fidl::encoding::DefaultFuchsiaResourceDialect,
5316                &mut self.length,
5317                decoder,
5318                offset + 4,
5319                _depth
5320            )?;
5321            Ok(())
5322        }
5323    }
5324
5325    impl fidl::encoding::ResourceTypeMarker for ItemsGet2Response {
5326        type Borrowed<'a> = &'a mut Self;
5327        fn take_or_borrow<'a>(
5328            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5329        ) -> Self::Borrowed<'a> {
5330            value
5331        }
5332    }
5333
5334    unsafe impl fidl::encoding::TypeMarker for ItemsGet2Response {
5335        type Owned = Self;
5336
5337        #[inline(always)]
5338        fn inline_align(_context: fidl::encoding::Context) -> usize {
5339            8
5340        }
5341
5342        #[inline(always)]
5343        fn inline_size(_context: fidl::encoding::Context) -> usize {
5344            16
5345        }
5346    }
5347
5348    unsafe impl
5349        fidl::encoding::Encode<ItemsGet2Response, fidl::encoding::DefaultFuchsiaResourceDialect>
5350        for &mut ItemsGet2Response
5351    {
5352        #[inline]
5353        unsafe fn encode(
5354            self,
5355            encoder: &mut fidl::encoding::Encoder<
5356                '_,
5357                fidl::encoding::DefaultFuchsiaResourceDialect,
5358            >,
5359            offset: usize,
5360            _depth: fidl::encoding::Depth,
5361        ) -> fidl::Result<()> {
5362            encoder.debug_check_bounds::<ItemsGet2Response>(offset);
5363            // Delegate to tuple encoding.
5364            fidl::encoding::Encode::<ItemsGet2Response, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5365                (
5366                    <fidl::encoding::UnboundedVector<RetrievedItems> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.retrieved_items),
5367                ),
5368                encoder, offset, _depth
5369            )
5370        }
5371    }
5372    unsafe impl<
5373        T0: fidl::encoding::Encode<
5374                fidl::encoding::UnboundedVector<RetrievedItems>,
5375                fidl::encoding::DefaultFuchsiaResourceDialect,
5376            >,
5377    > fidl::encoding::Encode<ItemsGet2Response, fidl::encoding::DefaultFuchsiaResourceDialect>
5378        for (T0,)
5379    {
5380        #[inline]
5381        unsafe fn encode(
5382            self,
5383            encoder: &mut fidl::encoding::Encoder<
5384                '_,
5385                fidl::encoding::DefaultFuchsiaResourceDialect,
5386            >,
5387            offset: usize,
5388            depth: fidl::encoding::Depth,
5389        ) -> fidl::Result<()> {
5390            encoder.debug_check_bounds::<ItemsGet2Response>(offset);
5391            // Zero out padding regions. There's no need to apply masks
5392            // because the unmasked parts will be overwritten by fields.
5393            // Write the fields.
5394            self.0.encode(encoder, offset + 0, depth)?;
5395            Ok(())
5396        }
5397    }
5398
5399    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5400        for ItemsGet2Response
5401    {
5402        #[inline(always)]
5403        fn new_empty() -> Self {
5404            Self {
5405                retrieved_items: fidl::new_empty!(
5406                    fidl::encoding::UnboundedVector<RetrievedItems>,
5407                    fidl::encoding::DefaultFuchsiaResourceDialect
5408                ),
5409            }
5410        }
5411
5412        #[inline]
5413        unsafe fn decode(
5414            &mut self,
5415            decoder: &mut fidl::encoding::Decoder<
5416                '_,
5417                fidl::encoding::DefaultFuchsiaResourceDialect,
5418            >,
5419            offset: usize,
5420            _depth: fidl::encoding::Depth,
5421        ) -> fidl::Result<()> {
5422            decoder.debug_check_bounds::<Self>(offset);
5423            // Verify that padding bytes are zero.
5424            fidl::decode!(
5425                fidl::encoding::UnboundedVector<RetrievedItems>,
5426                fidl::encoding::DefaultFuchsiaResourceDialect,
5427                &mut self.retrieved_items,
5428                decoder,
5429                offset + 0,
5430                _depth
5431            )?;
5432            Ok(())
5433        }
5434    }
5435
5436    impl fidl::encoding::ResourceTypeMarker for ReadOnlyLogGetResponse {
5437        type Borrowed<'a> = &'a mut Self;
5438        fn take_or_borrow<'a>(
5439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5440        ) -> Self::Borrowed<'a> {
5441            value
5442        }
5443    }
5444
5445    unsafe impl fidl::encoding::TypeMarker for ReadOnlyLogGetResponse {
5446        type Owned = Self;
5447
5448        #[inline(always)]
5449        fn inline_align(_context: fidl::encoding::Context) -> usize {
5450            4
5451        }
5452
5453        #[inline(always)]
5454        fn inline_size(_context: fidl::encoding::Context) -> usize {
5455            4
5456        }
5457    }
5458
5459    unsafe impl
5460        fidl::encoding::Encode<
5461            ReadOnlyLogGetResponse,
5462            fidl::encoding::DefaultFuchsiaResourceDialect,
5463        > for &mut ReadOnlyLogGetResponse
5464    {
5465        #[inline]
5466        unsafe fn encode(
5467            self,
5468            encoder: &mut fidl::encoding::Encoder<
5469                '_,
5470                fidl::encoding::DefaultFuchsiaResourceDialect,
5471            >,
5472            offset: usize,
5473            _depth: fidl::encoding::Depth,
5474        ) -> fidl::Result<()> {
5475            encoder.debug_check_bounds::<ReadOnlyLogGetResponse>(offset);
5476            // Delegate to tuple encoding.
5477            fidl::encoding::Encode::<
5478                ReadOnlyLogGetResponse,
5479                fidl::encoding::DefaultFuchsiaResourceDialect,
5480            >::encode(
5481                (<fidl::encoding::HandleType<
5482                    fidl::DebugLog,
5483                    { fidl::ObjectType::DEBUGLOG.into_raw() },
5484                    2147483648,
5485                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5486                    &mut self.log
5487                ),),
5488                encoder,
5489                offset,
5490                _depth,
5491            )
5492        }
5493    }
5494    unsafe impl<
5495        T0: fidl::encoding::Encode<
5496                fidl::encoding::HandleType<
5497                    fidl::DebugLog,
5498                    { fidl::ObjectType::DEBUGLOG.into_raw() },
5499                    2147483648,
5500                >,
5501                fidl::encoding::DefaultFuchsiaResourceDialect,
5502            >,
5503    >
5504        fidl::encoding::Encode<
5505            ReadOnlyLogGetResponse,
5506            fidl::encoding::DefaultFuchsiaResourceDialect,
5507        > for (T0,)
5508    {
5509        #[inline]
5510        unsafe fn encode(
5511            self,
5512            encoder: &mut fidl::encoding::Encoder<
5513                '_,
5514                fidl::encoding::DefaultFuchsiaResourceDialect,
5515            >,
5516            offset: usize,
5517            depth: fidl::encoding::Depth,
5518        ) -> fidl::Result<()> {
5519            encoder.debug_check_bounds::<ReadOnlyLogGetResponse>(offset);
5520            // Zero out padding regions. There's no need to apply masks
5521            // because the unmasked parts will be overwritten by fields.
5522            // Write the fields.
5523            self.0.encode(encoder, offset + 0, depth)?;
5524            Ok(())
5525        }
5526    }
5527
5528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5529        for ReadOnlyLogGetResponse
5530    {
5531        #[inline(always)]
5532        fn new_empty() -> Self {
5533            Self {
5534                log: fidl::new_empty!(fidl::encoding::HandleType<fidl::DebugLog, { fidl::ObjectType::DEBUGLOG.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5535            }
5536        }
5537
5538        #[inline]
5539        unsafe fn decode(
5540            &mut self,
5541            decoder: &mut fidl::encoding::Decoder<
5542                '_,
5543                fidl::encoding::DefaultFuchsiaResourceDialect,
5544            >,
5545            offset: usize,
5546            _depth: fidl::encoding::Depth,
5547        ) -> fidl::Result<()> {
5548            decoder.debug_check_bounds::<Self>(offset);
5549            // Verify that padding bytes are zero.
5550            fidl::decode!(fidl::encoding::HandleType<fidl::DebugLog, { fidl::ObjectType::DEBUGLOG.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.log, decoder, offset + 0, _depth)?;
5551            Ok(())
5552        }
5553    }
5554
5555    impl fidl::encoding::ResourceTypeMarker for RetrievedItems {
5556        type Borrowed<'a> = &'a mut Self;
5557        fn take_or_borrow<'a>(
5558            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5559        ) -> Self::Borrowed<'a> {
5560            value
5561        }
5562    }
5563
5564    unsafe impl fidl::encoding::TypeMarker for RetrievedItems {
5565        type Owned = Self;
5566
5567        #[inline(always)]
5568        fn inline_align(_context: fidl::encoding::Context) -> usize {
5569            4
5570        }
5571
5572        #[inline(always)]
5573        fn inline_size(_context: fidl::encoding::Context) -> usize {
5574            12
5575        }
5576    }
5577
5578    unsafe impl
5579        fidl::encoding::Encode<RetrievedItems, fidl::encoding::DefaultFuchsiaResourceDialect>
5580        for &mut RetrievedItems
5581    {
5582        #[inline]
5583        unsafe fn encode(
5584            self,
5585            encoder: &mut fidl::encoding::Encoder<
5586                '_,
5587                fidl::encoding::DefaultFuchsiaResourceDialect,
5588            >,
5589            offset: usize,
5590            _depth: fidl::encoding::Depth,
5591        ) -> fidl::Result<()> {
5592            encoder.debug_check_bounds::<RetrievedItems>(offset);
5593            // Delegate to tuple encoding.
5594            fidl::encoding::Encode::<RetrievedItems, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5595                (
5596                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
5597                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.length),
5598                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.extra),
5599                ),
5600                encoder, offset, _depth
5601            )
5602        }
5603    }
5604    unsafe impl<
5605        T0: fidl::encoding::Encode<
5606                fidl::encoding::HandleType<
5607                    fidl::Vmo,
5608                    { fidl::ObjectType::VMO.into_raw() },
5609                    2147483648,
5610                >,
5611                fidl::encoding::DefaultFuchsiaResourceDialect,
5612            >,
5613        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
5614        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
5615    > fidl::encoding::Encode<RetrievedItems, fidl::encoding::DefaultFuchsiaResourceDialect>
5616        for (T0, T1, T2)
5617    {
5618        #[inline]
5619        unsafe fn encode(
5620            self,
5621            encoder: &mut fidl::encoding::Encoder<
5622                '_,
5623                fidl::encoding::DefaultFuchsiaResourceDialect,
5624            >,
5625            offset: usize,
5626            depth: fidl::encoding::Depth,
5627        ) -> fidl::Result<()> {
5628            encoder.debug_check_bounds::<RetrievedItems>(offset);
5629            // Zero out padding regions. There's no need to apply masks
5630            // because the unmasked parts will be overwritten by fields.
5631            // Write the fields.
5632            self.0.encode(encoder, offset + 0, depth)?;
5633            self.1.encode(encoder, offset + 4, depth)?;
5634            self.2.encode(encoder, offset + 8, depth)?;
5635            Ok(())
5636        }
5637    }
5638
5639    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5640        for RetrievedItems
5641    {
5642        #[inline(always)]
5643        fn new_empty() -> Self {
5644            Self {
5645                payload: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5646                length: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
5647                extra: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
5648            }
5649        }
5650
5651        #[inline]
5652        unsafe fn decode(
5653            &mut self,
5654            decoder: &mut fidl::encoding::Decoder<
5655                '_,
5656                fidl::encoding::DefaultFuchsiaResourceDialect,
5657            >,
5658            offset: usize,
5659            _depth: fidl::encoding::Depth,
5660        ) -> fidl::Result<()> {
5661            decoder.debug_check_bounds::<Self>(offset);
5662            // Verify that padding bytes are zero.
5663            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.payload, decoder, offset + 0, _depth)?;
5664            fidl::decode!(
5665                u32,
5666                fidl::encoding::DefaultFuchsiaResourceDialect,
5667                &mut self.length,
5668                decoder,
5669                offset + 4,
5670                _depth
5671            )?;
5672            fidl::decode!(
5673                u32,
5674                fidl::encoding::DefaultFuchsiaResourceDialect,
5675                &mut self.extra,
5676                decoder,
5677                offset + 8,
5678                _depth
5679            )?;
5680            Ok(())
5681        }
5682    }
5683
5684    impl fidl::encoding::ResourceTypeMarker for SvcStashProviderGetResponse {
5685        type Borrowed<'a> = &'a mut Self;
5686        fn take_or_borrow<'a>(
5687            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5688        ) -> Self::Borrowed<'a> {
5689            value
5690        }
5691    }
5692
5693    unsafe impl fidl::encoding::TypeMarker for SvcStashProviderGetResponse {
5694        type Owned = Self;
5695
5696        #[inline(always)]
5697        fn inline_align(_context: fidl::encoding::Context) -> usize {
5698            4
5699        }
5700
5701        #[inline(always)]
5702        fn inline_size(_context: fidl::encoding::Context) -> usize {
5703            4
5704        }
5705    }
5706
5707    unsafe impl
5708        fidl::encoding::Encode<
5709            SvcStashProviderGetResponse,
5710            fidl::encoding::DefaultFuchsiaResourceDialect,
5711        > for &mut SvcStashProviderGetResponse
5712    {
5713        #[inline]
5714        unsafe fn encode(
5715            self,
5716            encoder: &mut fidl::encoding::Encoder<
5717                '_,
5718                fidl::encoding::DefaultFuchsiaResourceDialect,
5719            >,
5720            offset: usize,
5721            _depth: fidl::encoding::Depth,
5722        ) -> fidl::Result<()> {
5723            encoder.debug_check_bounds::<SvcStashProviderGetResponse>(offset);
5724            // Delegate to tuple encoding.
5725            fidl::encoding::Encode::<SvcStashProviderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5726                (
5727                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resource),
5728                ),
5729                encoder, offset, _depth
5730            )
5731        }
5732    }
5733    unsafe impl<
5734        T0: fidl::encoding::Encode<
5735                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>>,
5736                fidl::encoding::DefaultFuchsiaResourceDialect,
5737            >,
5738    >
5739        fidl::encoding::Encode<
5740            SvcStashProviderGetResponse,
5741            fidl::encoding::DefaultFuchsiaResourceDialect,
5742        > for (T0,)
5743    {
5744        #[inline]
5745        unsafe fn encode(
5746            self,
5747            encoder: &mut fidl::encoding::Encoder<
5748                '_,
5749                fidl::encoding::DefaultFuchsiaResourceDialect,
5750            >,
5751            offset: usize,
5752            depth: fidl::encoding::Depth,
5753        ) -> fidl::Result<()> {
5754            encoder.debug_check_bounds::<SvcStashProviderGetResponse>(offset);
5755            // Zero out padding regions. There's no need to apply masks
5756            // because the unmasked parts will be overwritten by fields.
5757            // Write the fields.
5758            self.0.encode(encoder, offset + 0, depth)?;
5759            Ok(())
5760        }
5761    }
5762
5763    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5764        for SvcStashProviderGetResponse
5765    {
5766        #[inline(always)]
5767        fn new_empty() -> Self {
5768            Self {
5769                resource: fidl::new_empty!(
5770                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>>,
5771                    fidl::encoding::DefaultFuchsiaResourceDialect
5772                ),
5773            }
5774        }
5775
5776        #[inline]
5777        unsafe fn decode(
5778            &mut self,
5779            decoder: &mut fidl::encoding::Decoder<
5780                '_,
5781                fidl::encoding::DefaultFuchsiaResourceDialect,
5782            >,
5783            offset: usize,
5784            _depth: fidl::encoding::Depth,
5785        ) -> fidl::Result<()> {
5786            decoder.debug_check_bounds::<Self>(offset);
5787            // Verify that padding bytes are zero.
5788            fidl::decode!(
5789                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>>,
5790                fidl::encoding::DefaultFuchsiaResourceDialect,
5791                &mut self.resource,
5792                decoder,
5793                offset + 0,
5794                _depth
5795            )?;
5796            Ok(())
5797        }
5798    }
5799
5800    impl fidl::encoding::ResourceTypeMarker for SvcStashStoreRequest {
5801        type Borrowed<'a> = &'a mut Self;
5802        fn take_or_borrow<'a>(
5803            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5804        ) -> Self::Borrowed<'a> {
5805            value
5806        }
5807    }
5808
5809    unsafe impl fidl::encoding::TypeMarker for SvcStashStoreRequest {
5810        type Owned = Self;
5811
5812        #[inline(always)]
5813        fn inline_align(_context: fidl::encoding::Context) -> usize {
5814            4
5815        }
5816
5817        #[inline(always)]
5818        fn inline_size(_context: fidl::encoding::Context) -> usize {
5819            4
5820        }
5821    }
5822
5823    unsafe impl
5824        fidl::encoding::Encode<SvcStashStoreRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5825        for &mut SvcStashStoreRequest
5826    {
5827        #[inline]
5828        unsafe fn encode(
5829            self,
5830            encoder: &mut fidl::encoding::Encoder<
5831                '_,
5832                fidl::encoding::DefaultFuchsiaResourceDialect,
5833            >,
5834            offset: usize,
5835            _depth: fidl::encoding::Depth,
5836        ) -> fidl::Result<()> {
5837            encoder.debug_check_bounds::<SvcStashStoreRequest>(offset);
5838            // Delegate to tuple encoding.
5839            fidl::encoding::Encode::<
5840                SvcStashStoreRequest,
5841                fidl::encoding::DefaultFuchsiaResourceDialect,
5842            >::encode(
5843                (<fidl::encoding::Endpoint<
5844                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5845                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5846                    &mut self.svc_endpoint
5847                ),),
5848                encoder,
5849                offset,
5850                _depth,
5851            )
5852        }
5853    }
5854    unsafe impl<
5855        T0: fidl::encoding::Encode<
5856                fidl::encoding::Endpoint<
5857                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5858                >,
5859                fidl::encoding::DefaultFuchsiaResourceDialect,
5860            >,
5861    >
5862        fidl::encoding::Encode<SvcStashStoreRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5863        for (T0,)
5864    {
5865        #[inline]
5866        unsafe fn encode(
5867            self,
5868            encoder: &mut fidl::encoding::Encoder<
5869                '_,
5870                fidl::encoding::DefaultFuchsiaResourceDialect,
5871            >,
5872            offset: usize,
5873            depth: fidl::encoding::Depth,
5874        ) -> fidl::Result<()> {
5875            encoder.debug_check_bounds::<SvcStashStoreRequest>(offset);
5876            // Zero out padding regions. There's no need to apply masks
5877            // because the unmasked parts will be overwritten by fields.
5878            // Write the fields.
5879            self.0.encode(encoder, offset + 0, depth)?;
5880            Ok(())
5881        }
5882    }
5883
5884    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5885        for SvcStashStoreRequest
5886    {
5887        #[inline(always)]
5888        fn new_empty() -> Self {
5889            Self {
5890                svc_endpoint: fidl::new_empty!(
5891                    fidl::encoding::Endpoint<
5892                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5893                    >,
5894                    fidl::encoding::DefaultFuchsiaResourceDialect
5895                ),
5896            }
5897        }
5898
5899        #[inline]
5900        unsafe fn decode(
5901            &mut self,
5902            decoder: &mut fidl::encoding::Decoder<
5903                '_,
5904                fidl::encoding::DefaultFuchsiaResourceDialect,
5905            >,
5906            offset: usize,
5907            _depth: fidl::encoding::Depth,
5908        ) -> fidl::Result<()> {
5909            decoder.debug_check_bounds::<Self>(offset);
5910            // Verify that padding bytes are zero.
5911            fidl::decode!(
5912                fidl::encoding::Endpoint<
5913                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5914                >,
5915                fidl::encoding::DefaultFuchsiaResourceDialect,
5916                &mut self.svc_endpoint,
5917                decoder,
5918                offset + 0,
5919                _depth
5920            )?;
5921            Ok(())
5922        }
5923    }
5924
5925    impl fidl::encoding::ResourceTypeMarker for UserbootPostBootfsFilesRequest {
5926        type Borrowed<'a> = &'a mut Self;
5927        fn take_or_borrow<'a>(
5928            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5929        ) -> Self::Borrowed<'a> {
5930            value
5931        }
5932    }
5933
5934    unsafe impl fidl::encoding::TypeMarker for UserbootPostBootfsFilesRequest {
5935        type Owned = Self;
5936
5937        #[inline(always)]
5938        fn inline_align(_context: fidl::encoding::Context) -> usize {
5939            8
5940        }
5941
5942        #[inline(always)]
5943        fn inline_size(_context: fidl::encoding::Context) -> usize {
5944            16
5945        }
5946    }
5947
5948    unsafe impl
5949        fidl::encoding::Encode<
5950            UserbootPostBootfsFilesRequest,
5951            fidl::encoding::DefaultFuchsiaResourceDialect,
5952        > for &mut UserbootPostBootfsFilesRequest
5953    {
5954        #[inline]
5955        unsafe fn encode(
5956            self,
5957            encoder: &mut fidl::encoding::Encoder<
5958                '_,
5959                fidl::encoding::DefaultFuchsiaResourceDialect,
5960            >,
5961            offset: usize,
5962            _depth: fidl::encoding::Depth,
5963        ) -> fidl::Result<()> {
5964            encoder.debug_check_bounds::<UserbootPostBootfsFilesRequest>(offset);
5965            // Delegate to tuple encoding.
5966            fidl::encoding::Encode::<UserbootPostBootfsFilesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5967                (
5968                    <fidl::encoding::Vector<BootfsFileVmo, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.files),
5969                ),
5970                encoder, offset, _depth
5971            )
5972        }
5973    }
5974    unsafe impl<
5975        T0: fidl::encoding::Encode<
5976                fidl::encoding::Vector<BootfsFileVmo, 64>,
5977                fidl::encoding::DefaultFuchsiaResourceDialect,
5978            >,
5979    >
5980        fidl::encoding::Encode<
5981            UserbootPostBootfsFilesRequest,
5982            fidl::encoding::DefaultFuchsiaResourceDialect,
5983        > for (T0,)
5984    {
5985        #[inline]
5986        unsafe fn encode(
5987            self,
5988            encoder: &mut fidl::encoding::Encoder<
5989                '_,
5990                fidl::encoding::DefaultFuchsiaResourceDialect,
5991            >,
5992            offset: usize,
5993            depth: fidl::encoding::Depth,
5994        ) -> fidl::Result<()> {
5995            encoder.debug_check_bounds::<UserbootPostBootfsFilesRequest>(offset);
5996            // Zero out padding regions. There's no need to apply masks
5997            // because the unmasked parts will be overwritten by fields.
5998            // Write the fields.
5999            self.0.encode(encoder, offset + 0, depth)?;
6000            Ok(())
6001        }
6002    }
6003
6004    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6005        for UserbootPostBootfsFilesRequest
6006    {
6007        #[inline(always)]
6008        fn new_empty() -> Self {
6009            Self {
6010                files: fidl::new_empty!(fidl::encoding::Vector<BootfsFileVmo, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
6011            }
6012        }
6013
6014        #[inline]
6015        unsafe fn decode(
6016            &mut self,
6017            decoder: &mut fidl::encoding::Decoder<
6018                '_,
6019                fidl::encoding::DefaultFuchsiaResourceDialect,
6020            >,
6021            offset: usize,
6022            _depth: fidl::encoding::Depth,
6023        ) -> fidl::Result<()> {
6024            decoder.debug_check_bounds::<Self>(offset);
6025            // Verify that padding bytes are zero.
6026            fidl::decode!(fidl::encoding::Vector<BootfsFileVmo, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.files, decoder, offset + 0, _depth)?;
6027            Ok(())
6028        }
6029    }
6030
6031    impl fidl::encoding::ResourceTypeMarker for UserbootPostBootfsVmoRequest {
6032        type Borrowed<'a> = &'a mut Self;
6033        fn take_or_borrow<'a>(
6034            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6035        ) -> Self::Borrowed<'a> {
6036            value
6037        }
6038    }
6039
6040    unsafe impl fidl::encoding::TypeMarker for UserbootPostBootfsVmoRequest {
6041        type Owned = Self;
6042
6043        #[inline(always)]
6044        fn inline_align(_context: fidl::encoding::Context) -> usize {
6045            4
6046        }
6047
6048        #[inline(always)]
6049        fn inline_size(_context: fidl::encoding::Context) -> usize {
6050            4
6051        }
6052    }
6053
6054    unsafe impl
6055        fidl::encoding::Encode<
6056            UserbootPostBootfsVmoRequest,
6057            fidl::encoding::DefaultFuchsiaResourceDialect,
6058        > for &mut UserbootPostBootfsVmoRequest
6059    {
6060        #[inline]
6061        unsafe fn encode(
6062            self,
6063            encoder: &mut fidl::encoding::Encoder<
6064                '_,
6065                fidl::encoding::DefaultFuchsiaResourceDialect,
6066            >,
6067            offset: usize,
6068            _depth: fidl::encoding::Depth,
6069        ) -> fidl::Result<()> {
6070            encoder.debug_check_bounds::<UserbootPostBootfsVmoRequest>(offset);
6071            // Delegate to tuple encoding.
6072            fidl::encoding::Encode::<
6073                UserbootPostBootfsVmoRequest,
6074                fidl::encoding::DefaultFuchsiaResourceDialect,
6075            >::encode(
6076                (<fidl::encoding::HandleType<
6077                    fidl::Vmo,
6078                    { fidl::ObjectType::VMO.into_raw() },
6079                    2147483648,
6080                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6081                    &mut self.bootfs
6082                ),),
6083                encoder,
6084                offset,
6085                _depth,
6086            )
6087        }
6088    }
6089    unsafe impl<
6090        T0: fidl::encoding::Encode<
6091                fidl::encoding::HandleType<
6092                    fidl::Vmo,
6093                    { fidl::ObjectType::VMO.into_raw() },
6094                    2147483648,
6095                >,
6096                fidl::encoding::DefaultFuchsiaResourceDialect,
6097            >,
6098    >
6099        fidl::encoding::Encode<
6100            UserbootPostBootfsVmoRequest,
6101            fidl::encoding::DefaultFuchsiaResourceDialect,
6102        > for (T0,)
6103    {
6104        #[inline]
6105        unsafe fn encode(
6106            self,
6107            encoder: &mut fidl::encoding::Encoder<
6108                '_,
6109                fidl::encoding::DefaultFuchsiaResourceDialect,
6110            >,
6111            offset: usize,
6112            depth: fidl::encoding::Depth,
6113        ) -> fidl::Result<()> {
6114            encoder.debug_check_bounds::<UserbootPostBootfsVmoRequest>(offset);
6115            // Zero out padding regions. There's no need to apply masks
6116            // because the unmasked parts will be overwritten by fields.
6117            // Write the fields.
6118            self.0.encode(encoder, offset + 0, depth)?;
6119            Ok(())
6120        }
6121    }
6122
6123    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6124        for UserbootPostBootfsVmoRequest
6125    {
6126        #[inline(always)]
6127        fn new_empty() -> Self {
6128            Self {
6129                bootfs: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6130            }
6131        }
6132
6133        #[inline]
6134        unsafe fn decode(
6135            &mut self,
6136            decoder: &mut fidl::encoding::Decoder<
6137                '_,
6138                fidl::encoding::DefaultFuchsiaResourceDialect,
6139            >,
6140            offset: usize,
6141            _depth: fidl::encoding::Depth,
6142        ) -> fidl::Result<()> {
6143            decoder.debug_check_bounds::<Self>(offset);
6144            // Verify that padding bytes are zero.
6145            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bootfs, decoder, offset + 0, _depth)?;
6146            Ok(())
6147        }
6148    }
6149
6150    impl fidl::encoding::ResourceTypeMarker for UserbootPostStashSvcRequest {
6151        type Borrowed<'a> = &'a mut Self;
6152        fn take_or_borrow<'a>(
6153            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6154        ) -> Self::Borrowed<'a> {
6155            value
6156        }
6157    }
6158
6159    unsafe impl fidl::encoding::TypeMarker for UserbootPostStashSvcRequest {
6160        type Owned = Self;
6161
6162        #[inline(always)]
6163        fn inline_align(_context: fidl::encoding::Context) -> usize {
6164            4
6165        }
6166
6167        #[inline(always)]
6168        fn inline_size(_context: fidl::encoding::Context) -> usize {
6169            4
6170        }
6171    }
6172
6173    unsafe impl
6174        fidl::encoding::Encode<
6175            UserbootPostStashSvcRequest,
6176            fidl::encoding::DefaultFuchsiaResourceDialect,
6177        > for &mut UserbootPostStashSvcRequest
6178    {
6179        #[inline]
6180        unsafe fn encode(
6181            self,
6182            encoder: &mut fidl::encoding::Encoder<
6183                '_,
6184                fidl::encoding::DefaultFuchsiaResourceDialect,
6185            >,
6186            offset: usize,
6187            _depth: fidl::encoding::Depth,
6188        ) -> fidl::Result<()> {
6189            encoder.debug_check_bounds::<UserbootPostStashSvcRequest>(offset);
6190            // Delegate to tuple encoding.
6191            fidl::encoding::Encode::<UserbootPostStashSvcRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6192                (
6193                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stash_svc_endpoint),
6194                ),
6195                encoder, offset, _depth
6196            )
6197        }
6198    }
6199    unsafe impl<
6200        T0: fidl::encoding::Encode<
6201                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>>,
6202                fidl::encoding::DefaultFuchsiaResourceDialect,
6203            >,
6204    >
6205        fidl::encoding::Encode<
6206            UserbootPostStashSvcRequest,
6207            fidl::encoding::DefaultFuchsiaResourceDialect,
6208        > for (T0,)
6209    {
6210        #[inline]
6211        unsafe fn encode(
6212            self,
6213            encoder: &mut fidl::encoding::Encoder<
6214                '_,
6215                fidl::encoding::DefaultFuchsiaResourceDialect,
6216            >,
6217            offset: usize,
6218            depth: fidl::encoding::Depth,
6219        ) -> fidl::Result<()> {
6220            encoder.debug_check_bounds::<UserbootPostStashSvcRequest>(offset);
6221            // Zero out padding regions. There's no need to apply masks
6222            // because the unmasked parts will be overwritten by fields.
6223            // Write the fields.
6224            self.0.encode(encoder, offset + 0, depth)?;
6225            Ok(())
6226        }
6227    }
6228
6229    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6230        for UserbootPostStashSvcRequest
6231    {
6232        #[inline(always)]
6233        fn new_empty() -> Self {
6234            Self {
6235                stash_svc_endpoint: fidl::new_empty!(
6236                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>>,
6237                    fidl::encoding::DefaultFuchsiaResourceDialect
6238                ),
6239            }
6240        }
6241
6242        #[inline]
6243        unsafe fn decode(
6244            &mut self,
6245            decoder: &mut fidl::encoding::Decoder<
6246                '_,
6247                fidl::encoding::DefaultFuchsiaResourceDialect,
6248            >,
6249            offset: usize,
6250            _depth: fidl::encoding::Depth,
6251        ) -> fidl::Result<()> {
6252            decoder.debug_check_bounds::<Self>(offset);
6253            // Verify that padding bytes are zero.
6254            fidl::decode!(
6255                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcStashMarker>>,
6256                fidl::encoding::DefaultFuchsiaResourceDialect,
6257                &mut self.stash_svc_endpoint,
6258                decoder,
6259                offset + 0,
6260                _depth
6261            )?;
6262            Ok(())
6263        }
6264    }
6265
6266    impl fidl::encoding::ResourceTypeMarker for WriteOnlyLogGetResponse {
6267        type Borrowed<'a> = &'a mut Self;
6268        fn take_or_borrow<'a>(
6269            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6270        ) -> Self::Borrowed<'a> {
6271            value
6272        }
6273    }
6274
6275    unsafe impl fidl::encoding::TypeMarker for WriteOnlyLogGetResponse {
6276        type Owned = Self;
6277
6278        #[inline(always)]
6279        fn inline_align(_context: fidl::encoding::Context) -> usize {
6280            4
6281        }
6282
6283        #[inline(always)]
6284        fn inline_size(_context: fidl::encoding::Context) -> usize {
6285            4
6286        }
6287    }
6288
6289    unsafe impl
6290        fidl::encoding::Encode<
6291            WriteOnlyLogGetResponse,
6292            fidl::encoding::DefaultFuchsiaResourceDialect,
6293        > for &mut WriteOnlyLogGetResponse
6294    {
6295        #[inline]
6296        unsafe fn encode(
6297            self,
6298            encoder: &mut fidl::encoding::Encoder<
6299                '_,
6300                fidl::encoding::DefaultFuchsiaResourceDialect,
6301            >,
6302            offset: usize,
6303            _depth: fidl::encoding::Depth,
6304        ) -> fidl::Result<()> {
6305            encoder.debug_check_bounds::<WriteOnlyLogGetResponse>(offset);
6306            // Delegate to tuple encoding.
6307            fidl::encoding::Encode::<
6308                WriteOnlyLogGetResponse,
6309                fidl::encoding::DefaultFuchsiaResourceDialect,
6310            >::encode(
6311                (<fidl::encoding::HandleType<
6312                    fidl::DebugLog,
6313                    { fidl::ObjectType::DEBUGLOG.into_raw() },
6314                    2147483648,
6315                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6316                    &mut self.log
6317                ),),
6318                encoder,
6319                offset,
6320                _depth,
6321            )
6322        }
6323    }
6324    unsafe impl<
6325        T0: fidl::encoding::Encode<
6326                fidl::encoding::HandleType<
6327                    fidl::DebugLog,
6328                    { fidl::ObjectType::DEBUGLOG.into_raw() },
6329                    2147483648,
6330                >,
6331                fidl::encoding::DefaultFuchsiaResourceDialect,
6332            >,
6333    >
6334        fidl::encoding::Encode<
6335            WriteOnlyLogGetResponse,
6336            fidl::encoding::DefaultFuchsiaResourceDialect,
6337        > for (T0,)
6338    {
6339        #[inline]
6340        unsafe fn encode(
6341            self,
6342            encoder: &mut fidl::encoding::Encoder<
6343                '_,
6344                fidl::encoding::DefaultFuchsiaResourceDialect,
6345            >,
6346            offset: usize,
6347            depth: fidl::encoding::Depth,
6348        ) -> fidl::Result<()> {
6349            encoder.debug_check_bounds::<WriteOnlyLogGetResponse>(offset);
6350            // Zero out padding regions. There's no need to apply masks
6351            // because the unmasked parts will be overwritten by fields.
6352            // Write the fields.
6353            self.0.encode(encoder, offset + 0, depth)?;
6354            Ok(())
6355        }
6356    }
6357
6358    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6359        for WriteOnlyLogGetResponse
6360    {
6361        #[inline(always)]
6362        fn new_empty() -> Self {
6363            Self {
6364                log: fidl::new_empty!(fidl::encoding::HandleType<fidl::DebugLog, { fidl::ObjectType::DEBUGLOG.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6365            }
6366        }
6367
6368        #[inline]
6369        unsafe fn decode(
6370            &mut self,
6371            decoder: &mut fidl::encoding::Decoder<
6372                '_,
6373                fidl::encoding::DefaultFuchsiaResourceDialect,
6374            >,
6375            offset: usize,
6376            _depth: fidl::encoding::Depth,
6377        ) -> fidl::Result<()> {
6378            decoder.debug_check_bounds::<Self>(offset);
6379            // Verify that padding bytes are zero.
6380            fidl::decode!(fidl::encoding::HandleType<fidl::DebugLog, { fidl::ObjectType::DEBUGLOG.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.log, decoder, offset + 0, _depth)?;
6381            Ok(())
6382        }
6383    }
6384
6385    impl UserbootPostBootHandlesRequest {
6386        #[inline(always)]
6387        fn max_ordinal_present(&self) -> u64 {
6388            if let Some(_) = self.smc_resource {
6389                return 7;
6390            }
6391            if let Some(_) = self.ioport_resource {
6392                return 6;
6393            }
6394            if let Some(_) = self.irq_resource {
6395                return 5;
6396            }
6397            if let Some(_) = self.mmio_resource {
6398                return 4;
6399            }
6400            if let Some(_) = self.system_resource {
6401                return 3;
6402            }
6403            if let Some(_) = self.kernel_files {
6404                return 2;
6405            }
6406            if let Some(_) = self.zbi_vmo {
6407                return 1;
6408            }
6409            0
6410        }
6411    }
6412
6413    impl fidl::encoding::ResourceTypeMarker for UserbootPostBootHandlesRequest {
6414        type Borrowed<'a> = &'a mut Self;
6415        fn take_or_borrow<'a>(
6416            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6417        ) -> Self::Borrowed<'a> {
6418            value
6419        }
6420    }
6421
6422    unsafe impl fidl::encoding::TypeMarker for UserbootPostBootHandlesRequest {
6423        type Owned = Self;
6424
6425        #[inline(always)]
6426        fn inline_align(_context: fidl::encoding::Context) -> usize {
6427            8
6428        }
6429
6430        #[inline(always)]
6431        fn inline_size(_context: fidl::encoding::Context) -> usize {
6432            16
6433        }
6434    }
6435
6436    unsafe impl
6437        fidl::encoding::Encode<
6438            UserbootPostBootHandlesRequest,
6439            fidl::encoding::DefaultFuchsiaResourceDialect,
6440        > for &mut UserbootPostBootHandlesRequest
6441    {
6442        unsafe fn encode(
6443            self,
6444            encoder: &mut fidl::encoding::Encoder<
6445                '_,
6446                fidl::encoding::DefaultFuchsiaResourceDialect,
6447            >,
6448            offset: usize,
6449            mut depth: fidl::encoding::Depth,
6450        ) -> fidl::Result<()> {
6451            encoder.debug_check_bounds::<UserbootPostBootHandlesRequest>(offset);
6452            // Vector header
6453            let max_ordinal: u64 = self.max_ordinal_present();
6454            encoder.write_num(max_ordinal, offset);
6455            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6456            // Calling encoder.out_of_line_offset(0) is not allowed.
6457            if max_ordinal == 0 {
6458                return Ok(());
6459            }
6460            depth.increment()?;
6461            let envelope_size = 8;
6462            let bytes_len = max_ordinal as usize * envelope_size;
6463            #[allow(unused_variables)]
6464            let offset = encoder.out_of_line_offset(bytes_len);
6465            let mut _prev_end_offset: usize = 0;
6466            if 1 > max_ordinal {
6467                return Ok(());
6468            }
6469
6470            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6471            // are envelope_size bytes.
6472            let cur_offset: usize = (1 - 1) * envelope_size;
6473
6474            // Zero reserved fields.
6475            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6476
6477            // Safety:
6478            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6479            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6480            //   envelope_size bytes, there is always sufficient room.
6481            fidl::encoding::encode_in_envelope_optional::<
6482                fidl::encoding::HandleType<
6483                    fidl::Vmo,
6484                    { fidl::ObjectType::VMO.into_raw() },
6485                    2147483648,
6486                >,
6487                fidl::encoding::DefaultFuchsiaResourceDialect,
6488            >(
6489                self.zbi_vmo.as_mut().map(
6490                    <fidl::encoding::HandleType<
6491                        fidl::Vmo,
6492                        { fidl::ObjectType::VMO.into_raw() },
6493                        2147483648,
6494                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6495                ),
6496                encoder,
6497                offset + cur_offset,
6498                depth,
6499            )?;
6500
6501            _prev_end_offset = cur_offset + envelope_size;
6502            if 2 > max_ordinal {
6503                return Ok(());
6504            }
6505
6506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6507            // are envelope_size bytes.
6508            let cur_offset: usize = (2 - 1) * envelope_size;
6509
6510            // Zero reserved fields.
6511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6512
6513            // Safety:
6514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6516            //   envelope_size bytes, there is always sufficient room.
6517            fidl::encoding::encode_in_envelope_optional::<
6518                fidl::encoding::Vector<
6519                    fidl::encoding::HandleType<
6520                        fidl::Vmo,
6521                        { fidl::ObjectType::VMO.into_raw() },
6522                        2147483648,
6523                    >,
6524                    64,
6525                >,
6526                fidl::encoding::DefaultFuchsiaResourceDialect,
6527            >(
6528                self.kernel_files.as_mut().map(
6529                    <fidl::encoding::Vector<
6530                        fidl::encoding::HandleType<
6531                            fidl::Vmo,
6532                            { fidl::ObjectType::VMO.into_raw() },
6533                            2147483648,
6534                        >,
6535                        64,
6536                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6537                ),
6538                encoder,
6539                offset + cur_offset,
6540                depth,
6541            )?;
6542
6543            _prev_end_offset = cur_offset + envelope_size;
6544            if 3 > max_ordinal {
6545                return Ok(());
6546            }
6547
6548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6549            // are envelope_size bytes.
6550            let cur_offset: usize = (3 - 1) * envelope_size;
6551
6552            // Zero reserved fields.
6553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6554
6555            // Safety:
6556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6558            //   envelope_size bytes, there is always sufficient room.
6559            fidl::encoding::encode_in_envelope_optional::<
6560                fidl::encoding::HandleType<
6561                    fidl::Resource,
6562                    { fidl::ObjectType::RESOURCE.into_raw() },
6563                    2147483648,
6564                >,
6565                fidl::encoding::DefaultFuchsiaResourceDialect,
6566            >(
6567                self.system_resource.as_mut().map(
6568                    <fidl::encoding::HandleType<
6569                        fidl::Resource,
6570                        { fidl::ObjectType::RESOURCE.into_raw() },
6571                        2147483648,
6572                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6573                ),
6574                encoder,
6575                offset + cur_offset,
6576                depth,
6577            )?;
6578
6579            _prev_end_offset = cur_offset + envelope_size;
6580            if 4 > max_ordinal {
6581                return Ok(());
6582            }
6583
6584            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6585            // are envelope_size bytes.
6586            let cur_offset: usize = (4 - 1) * envelope_size;
6587
6588            // Zero reserved fields.
6589            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6590
6591            // Safety:
6592            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6593            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6594            //   envelope_size bytes, there is always sufficient room.
6595            fidl::encoding::encode_in_envelope_optional::<
6596                fidl::encoding::HandleType<
6597                    fidl::Resource,
6598                    { fidl::ObjectType::RESOURCE.into_raw() },
6599                    2147483648,
6600                >,
6601                fidl::encoding::DefaultFuchsiaResourceDialect,
6602            >(
6603                self.mmio_resource.as_mut().map(
6604                    <fidl::encoding::HandleType<
6605                        fidl::Resource,
6606                        { fidl::ObjectType::RESOURCE.into_raw() },
6607                        2147483648,
6608                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6609                ),
6610                encoder,
6611                offset + cur_offset,
6612                depth,
6613            )?;
6614
6615            _prev_end_offset = cur_offset + envelope_size;
6616            if 5 > max_ordinal {
6617                return Ok(());
6618            }
6619
6620            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6621            // are envelope_size bytes.
6622            let cur_offset: usize = (5 - 1) * envelope_size;
6623
6624            // Zero reserved fields.
6625            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6626
6627            // Safety:
6628            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6629            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6630            //   envelope_size bytes, there is always sufficient room.
6631            fidl::encoding::encode_in_envelope_optional::<
6632                fidl::encoding::HandleType<
6633                    fidl::Resource,
6634                    { fidl::ObjectType::RESOURCE.into_raw() },
6635                    2147483648,
6636                >,
6637                fidl::encoding::DefaultFuchsiaResourceDialect,
6638            >(
6639                self.irq_resource.as_mut().map(
6640                    <fidl::encoding::HandleType<
6641                        fidl::Resource,
6642                        { fidl::ObjectType::RESOURCE.into_raw() },
6643                        2147483648,
6644                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6645                ),
6646                encoder,
6647                offset + cur_offset,
6648                depth,
6649            )?;
6650
6651            _prev_end_offset = cur_offset + envelope_size;
6652            if 6 > max_ordinal {
6653                return Ok(());
6654            }
6655
6656            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6657            // are envelope_size bytes.
6658            let cur_offset: usize = (6 - 1) * envelope_size;
6659
6660            // Zero reserved fields.
6661            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6662
6663            // Safety:
6664            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6665            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6666            //   envelope_size bytes, there is always sufficient room.
6667            fidl::encoding::encode_in_envelope_optional::<
6668                fidl::encoding::HandleType<
6669                    fidl::Resource,
6670                    { fidl::ObjectType::RESOURCE.into_raw() },
6671                    2147483648,
6672                >,
6673                fidl::encoding::DefaultFuchsiaResourceDialect,
6674            >(
6675                self.ioport_resource.as_mut().map(
6676                    <fidl::encoding::HandleType<
6677                        fidl::Resource,
6678                        { fidl::ObjectType::RESOURCE.into_raw() },
6679                        2147483648,
6680                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6681                ),
6682                encoder,
6683                offset + cur_offset,
6684                depth,
6685            )?;
6686
6687            _prev_end_offset = cur_offset + envelope_size;
6688            if 7 > max_ordinal {
6689                return Ok(());
6690            }
6691
6692            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6693            // are envelope_size bytes.
6694            let cur_offset: usize = (7 - 1) * envelope_size;
6695
6696            // Zero reserved fields.
6697            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6698
6699            // Safety:
6700            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6701            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6702            //   envelope_size bytes, there is always sufficient room.
6703            fidl::encoding::encode_in_envelope_optional::<
6704                fidl::encoding::HandleType<
6705                    fidl::Resource,
6706                    { fidl::ObjectType::RESOURCE.into_raw() },
6707                    2147483648,
6708                >,
6709                fidl::encoding::DefaultFuchsiaResourceDialect,
6710            >(
6711                self.smc_resource.as_mut().map(
6712                    <fidl::encoding::HandleType<
6713                        fidl::Resource,
6714                        { fidl::ObjectType::RESOURCE.into_raw() },
6715                        2147483648,
6716                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6717                ),
6718                encoder,
6719                offset + cur_offset,
6720                depth,
6721            )?;
6722
6723            _prev_end_offset = cur_offset + envelope_size;
6724
6725            Ok(())
6726        }
6727    }
6728
6729    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6730        for UserbootPostBootHandlesRequest
6731    {
6732        #[inline(always)]
6733        fn new_empty() -> Self {
6734            Self::default()
6735        }
6736
6737        unsafe fn decode(
6738            &mut self,
6739            decoder: &mut fidl::encoding::Decoder<
6740                '_,
6741                fidl::encoding::DefaultFuchsiaResourceDialect,
6742            >,
6743            offset: usize,
6744            mut depth: fidl::encoding::Depth,
6745        ) -> fidl::Result<()> {
6746            decoder.debug_check_bounds::<Self>(offset);
6747            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6748                None => return Err(fidl::Error::NotNullable),
6749                Some(len) => len,
6750            };
6751            // Calling decoder.out_of_line_offset(0) is not allowed.
6752            if len == 0 {
6753                return Ok(());
6754            };
6755            depth.increment()?;
6756            let envelope_size = 8;
6757            let bytes_len = len * envelope_size;
6758            let offset = decoder.out_of_line_offset(bytes_len)?;
6759            // Decode the envelope for each type.
6760            let mut _next_ordinal_to_read = 0;
6761            let mut next_offset = offset;
6762            let end_offset = offset + bytes_len;
6763            _next_ordinal_to_read += 1;
6764            if next_offset >= end_offset {
6765                return Ok(());
6766            }
6767
6768            // Decode unknown envelopes for gaps in ordinals.
6769            while _next_ordinal_to_read < 1 {
6770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6771                _next_ordinal_to_read += 1;
6772                next_offset += envelope_size;
6773            }
6774
6775            let next_out_of_line = decoder.next_out_of_line();
6776            let handles_before = decoder.remaining_handles();
6777            if let Some((inlined, num_bytes, num_handles)) =
6778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6779            {
6780                let member_inline_size = <fidl::encoding::HandleType<
6781                    fidl::Vmo,
6782                    { fidl::ObjectType::VMO.into_raw() },
6783                    2147483648,
6784                > as fidl::encoding::TypeMarker>::inline_size(
6785                    decoder.context
6786                );
6787                if inlined != (member_inline_size <= 4) {
6788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6789                }
6790                let inner_offset;
6791                let mut inner_depth = depth.clone();
6792                if inlined {
6793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6794                    inner_offset = next_offset;
6795                } else {
6796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6797                    inner_depth.increment()?;
6798                }
6799                let val_ref =
6800                self.zbi_vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6801                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6802                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6803                {
6804                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6805                }
6806                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6807                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6808                }
6809            }
6810
6811            next_offset += envelope_size;
6812            _next_ordinal_to_read += 1;
6813            if next_offset >= end_offset {
6814                return Ok(());
6815            }
6816
6817            // Decode unknown envelopes for gaps in ordinals.
6818            while _next_ordinal_to_read < 2 {
6819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6820                _next_ordinal_to_read += 1;
6821                next_offset += envelope_size;
6822            }
6823
6824            let next_out_of_line = decoder.next_out_of_line();
6825            let handles_before = decoder.remaining_handles();
6826            if let Some((inlined, num_bytes, num_handles)) =
6827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6828            {
6829                let member_inline_size = <fidl::encoding::Vector<
6830                    fidl::encoding::HandleType<
6831                        fidl::Vmo,
6832                        { fidl::ObjectType::VMO.into_raw() },
6833                        2147483648,
6834                    >,
6835                    64,
6836                > as fidl::encoding::TypeMarker>::inline_size(
6837                    decoder.context
6838                );
6839                if inlined != (member_inline_size <= 4) {
6840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6841                }
6842                let inner_offset;
6843                let mut inner_depth = depth.clone();
6844                if inlined {
6845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6846                    inner_offset = next_offset;
6847                } else {
6848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6849                    inner_depth.increment()?;
6850                }
6851                let val_ref = self.kernel_files.get_or_insert_with(|| {
6852                    fidl::new_empty!(
6853                        fidl::encoding::Vector<
6854                            fidl::encoding::HandleType<
6855                                fidl::Vmo,
6856                                { fidl::ObjectType::VMO.into_raw() },
6857                                2147483648,
6858                            >,
6859                            64,
6860                        >,
6861                        fidl::encoding::DefaultFuchsiaResourceDialect
6862                    )
6863                });
6864                fidl::decode!(
6865                    fidl::encoding::Vector<
6866                        fidl::encoding::HandleType<
6867                            fidl::Vmo,
6868                            { fidl::ObjectType::VMO.into_raw() },
6869                            2147483648,
6870                        >,
6871                        64,
6872                    >,
6873                    fidl::encoding::DefaultFuchsiaResourceDialect,
6874                    val_ref,
6875                    decoder,
6876                    inner_offset,
6877                    inner_depth
6878                )?;
6879                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6880                {
6881                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6882                }
6883                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6884                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6885                }
6886            }
6887
6888            next_offset += envelope_size;
6889            _next_ordinal_to_read += 1;
6890            if next_offset >= end_offset {
6891                return Ok(());
6892            }
6893
6894            // Decode unknown envelopes for gaps in ordinals.
6895            while _next_ordinal_to_read < 3 {
6896                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6897                _next_ordinal_to_read += 1;
6898                next_offset += envelope_size;
6899            }
6900
6901            let next_out_of_line = decoder.next_out_of_line();
6902            let handles_before = decoder.remaining_handles();
6903            if let Some((inlined, num_bytes, num_handles)) =
6904                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6905            {
6906                let member_inline_size = <fidl::encoding::HandleType<
6907                    fidl::Resource,
6908                    { fidl::ObjectType::RESOURCE.into_raw() },
6909                    2147483648,
6910                > as fidl::encoding::TypeMarker>::inline_size(
6911                    decoder.context
6912                );
6913                if inlined != (member_inline_size <= 4) {
6914                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6915                }
6916                let inner_offset;
6917                let mut inner_depth = depth.clone();
6918                if inlined {
6919                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6920                    inner_offset = next_offset;
6921                } else {
6922                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6923                    inner_depth.increment()?;
6924                }
6925                let val_ref =
6926                self.system_resource.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6927                fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6928                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6929                {
6930                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6931                }
6932                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6933                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6934                }
6935            }
6936
6937            next_offset += envelope_size;
6938            _next_ordinal_to_read += 1;
6939            if next_offset >= end_offset {
6940                return Ok(());
6941            }
6942
6943            // Decode unknown envelopes for gaps in ordinals.
6944            while _next_ordinal_to_read < 4 {
6945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6946                _next_ordinal_to_read += 1;
6947                next_offset += envelope_size;
6948            }
6949
6950            let next_out_of_line = decoder.next_out_of_line();
6951            let handles_before = decoder.remaining_handles();
6952            if let Some((inlined, num_bytes, num_handles)) =
6953                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6954            {
6955                let member_inline_size = <fidl::encoding::HandleType<
6956                    fidl::Resource,
6957                    { fidl::ObjectType::RESOURCE.into_raw() },
6958                    2147483648,
6959                > as fidl::encoding::TypeMarker>::inline_size(
6960                    decoder.context
6961                );
6962                if inlined != (member_inline_size <= 4) {
6963                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6964                }
6965                let inner_offset;
6966                let mut inner_depth = depth.clone();
6967                if inlined {
6968                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6969                    inner_offset = next_offset;
6970                } else {
6971                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6972                    inner_depth.increment()?;
6973                }
6974                let val_ref =
6975                self.mmio_resource.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6976                fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6977                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6978                {
6979                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6980                }
6981                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6982                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6983                }
6984            }
6985
6986            next_offset += envelope_size;
6987            _next_ordinal_to_read += 1;
6988            if next_offset >= end_offset {
6989                return Ok(());
6990            }
6991
6992            // Decode unknown envelopes for gaps in ordinals.
6993            while _next_ordinal_to_read < 5 {
6994                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6995                _next_ordinal_to_read += 1;
6996                next_offset += envelope_size;
6997            }
6998
6999            let next_out_of_line = decoder.next_out_of_line();
7000            let handles_before = decoder.remaining_handles();
7001            if let Some((inlined, num_bytes, num_handles)) =
7002                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7003            {
7004                let member_inline_size = <fidl::encoding::HandleType<
7005                    fidl::Resource,
7006                    { fidl::ObjectType::RESOURCE.into_raw() },
7007                    2147483648,
7008                > as fidl::encoding::TypeMarker>::inline_size(
7009                    decoder.context
7010                );
7011                if inlined != (member_inline_size <= 4) {
7012                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7013                }
7014                let inner_offset;
7015                let mut inner_depth = depth.clone();
7016                if inlined {
7017                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7018                    inner_offset = next_offset;
7019                } else {
7020                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7021                    inner_depth.increment()?;
7022                }
7023                let val_ref =
7024                self.irq_resource.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7025                fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7026                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7027                {
7028                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7029                }
7030                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7031                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7032                }
7033            }
7034
7035            next_offset += envelope_size;
7036            _next_ordinal_to_read += 1;
7037            if next_offset >= end_offset {
7038                return Ok(());
7039            }
7040
7041            // Decode unknown envelopes for gaps in ordinals.
7042            while _next_ordinal_to_read < 6 {
7043                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7044                _next_ordinal_to_read += 1;
7045                next_offset += envelope_size;
7046            }
7047
7048            let next_out_of_line = decoder.next_out_of_line();
7049            let handles_before = decoder.remaining_handles();
7050            if let Some((inlined, num_bytes, num_handles)) =
7051                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7052            {
7053                let member_inline_size = <fidl::encoding::HandleType<
7054                    fidl::Resource,
7055                    { fidl::ObjectType::RESOURCE.into_raw() },
7056                    2147483648,
7057                > as fidl::encoding::TypeMarker>::inline_size(
7058                    decoder.context
7059                );
7060                if inlined != (member_inline_size <= 4) {
7061                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7062                }
7063                let inner_offset;
7064                let mut inner_depth = depth.clone();
7065                if inlined {
7066                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7067                    inner_offset = next_offset;
7068                } else {
7069                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7070                    inner_depth.increment()?;
7071                }
7072                let val_ref =
7073                self.ioport_resource.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7074                fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7075                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7076                {
7077                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7078                }
7079                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7080                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7081                }
7082            }
7083
7084            next_offset += envelope_size;
7085            _next_ordinal_to_read += 1;
7086            if next_offset >= end_offset {
7087                return Ok(());
7088            }
7089
7090            // Decode unknown envelopes for gaps in ordinals.
7091            while _next_ordinal_to_read < 7 {
7092                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7093                _next_ordinal_to_read += 1;
7094                next_offset += envelope_size;
7095            }
7096
7097            let next_out_of_line = decoder.next_out_of_line();
7098            let handles_before = decoder.remaining_handles();
7099            if let Some((inlined, num_bytes, num_handles)) =
7100                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7101            {
7102                let member_inline_size = <fidl::encoding::HandleType<
7103                    fidl::Resource,
7104                    { fidl::ObjectType::RESOURCE.into_raw() },
7105                    2147483648,
7106                > as fidl::encoding::TypeMarker>::inline_size(
7107                    decoder.context
7108                );
7109                if inlined != (member_inline_size <= 4) {
7110                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7111                }
7112                let inner_offset;
7113                let mut inner_depth = depth.clone();
7114                if inlined {
7115                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7116                    inner_offset = next_offset;
7117                } else {
7118                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7119                    inner_depth.increment()?;
7120                }
7121                let val_ref =
7122                self.smc_resource.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7123                fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7125                {
7126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7127                }
7128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7130                }
7131            }
7132
7133            next_offset += envelope_size;
7134
7135            // Decode the remaining unknown envelopes.
7136            while next_offset < end_offset {
7137                _next_ordinal_to_read += 1;
7138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7139                next_offset += envelope_size;
7140            }
7141
7142            Ok(())
7143        }
7144    }
7145}