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