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