Skip to main content

fidl_fuchsia_boot/
fidl_fuchsia_boot.rs

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