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