fidl_fuchsia_net_http/
fidl_fuchsia_net_http.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// Friendly alias for a vector of bytes containing a header name.
14pub type HeaderName = Vec<u8>;
15
16/// Friendly alias for a vector of bytes containing a header value.
17pub type HeaderValue = Vec<u8>;
18
19pub type Method = String;
20
21/// An error occurred during the HTTP transaction.
22#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
23#[repr(u32)]
24pub enum Error {
25    /// Some other problem occurred that cannot be classified using one of the
26    /// more specific statuses. Retry is optional.
27    Internal = 1,
28    /// An HTTP parse error.
29    UnableToParse = 2,
30    /// Indicates a channel (client or body sender) is closed.
31    ChannelClosed = 3,
32    /// Error occurred while connecting.
33    Connect = 4,
34    /// The deadline specified in Request has passed
35    DeadlineExceeded = 5,
36}
37
38impl Error {
39    #[inline]
40    pub fn from_primitive(prim: u32) -> Option<Self> {
41        match prim {
42            1 => Some(Self::Internal),
43            2 => Some(Self::UnableToParse),
44            3 => Some(Self::ChannelClosed),
45            4 => Some(Self::Connect),
46            5 => Some(Self::DeadlineExceeded),
47            _ => None,
48        }
49    }
50
51    #[inline]
52    pub const fn into_primitive(self) -> u32 {
53        self as u32
54    }
55
56    #[deprecated = "Strict enums should not use `is_unknown`"]
57    #[inline]
58    pub fn is_unknown(&self) -> bool {
59        false
60    }
61}
62
63/// An HTTP header field.
64#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct Header {
66    /// The name of the header field.
67    pub name: Vec<u8>,
68    /// The value of the header field.
69    pub value: Vec<u8>,
70}
71
72impl fidl::Persistable for Header {}
73
74#[derive(Debug, PartialEq)]
75pub struct LoaderClientOnResponseRequest {
76    pub response: Response,
77}
78
79impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
80    for LoaderClientOnResponseRequest
81{
82}
83
84#[derive(Debug, PartialEq)]
85pub struct LoaderFetchRequest {
86    pub request: Request,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderFetchRequest {}
90
91#[derive(Debug, PartialEq)]
92pub struct LoaderFetchResponse {
93    pub response: Response,
94}
95
96impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderFetchResponse {}
97
98#[derive(Debug, PartialEq)]
99pub struct LoaderStartRequest {
100    pub request: Request,
101    pub client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
102}
103
104impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderStartRequest {}
105
106/// A description of the redirect the server requested.
107///
108/// The semantics of an HTTP redirect vary according to the status code use to
109/// generate the redirect. This structure ensures that the loader and its client
110/// agree on the interpretation of the redirect response from the server.
111#[derive(Clone, Debug, Default, PartialEq)]
112pub struct RedirectTarget {
113    /// The HTTP method the server suggested for the redirect.
114    pub method: Option<String>,
115    /// The URL the server suggested for the redirect.
116    pub url: Option<String>,
117    /// The referrer the server suggested for the redirect.
118    pub referrer: Option<String>,
119    #[doc(hidden)]
120    pub __source_breaking: fidl::marker::SourceBreaking,
121}
122
123impl fidl::Persistable for RedirectTarget {}
124
125/// An HTTP request.
126#[derive(Debug, Default, PartialEq)]
127pub struct Request {
128    /// The HTTP method if applicable.
129    ///
130    /// Defaults to "GET".
131    pub method: Option<String>,
132    /// The URL to load.
133    ///
134    /// Required.
135    pub url: Option<String>,
136    /// Additional HTTP request headers.
137    pub headers: Option<Vec<Header>>,
138    /// The payload for the request body. For HTTP requests, the method must be
139    /// set to "POST" or "PUT". If a buffer is used for the body, a
140    /// Content-Length header will automatically be added.
141    pub body: Option<Body>,
142    /// Determines when to give up on waiting for a response from the server. If no deadline is
143    /// provided, the implementation will provide a reasonable default.
144    pub deadline: Option<i64>,
145    #[doc(hidden)]
146    pub __source_breaking: fidl::marker::SourceBreaking,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Request {}
150
151/// A response to an HTTP request.
152#[derive(Debug, Default, PartialEq)]
153pub struct Response {
154    /// If the response resulted in a network level error, this field will be
155    /// set.
156    pub error: Option<Error>,
157    /// The response body.
158    pub body: Option<fidl::Socket>,
159    /// The final URL of the response, after redirects have been followed.
160    pub final_url: Option<String>,
161    /// The HTTP status code.
162    pub status_code: Option<u32>,
163    /// The HTTP status line.
164    pub status_line: Option<Vec<u8>>,
165    /// The HTTP response headers.
166    pub headers: Option<Vec<Header>>,
167    /// A description of the redirect the server requested, if any.
168    pub redirect: Option<RedirectTarget>,
169    #[doc(hidden)]
170    pub __source_breaking: fidl::marker::SourceBreaking,
171}
172
173impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Response {}
174
175/// The body of an HTTP request.
176#[derive(Debug, PartialEq)]
177pub enum Body {
178    /// A buffer that will contain the complete request or response body.
179    Buffer(fidl_fuchsia_mem::Buffer),
180    /// A socket that will contain the streaming request or response body.
181    Stream(fidl::Socket),
182}
183
184impl Body {
185    #[inline]
186    pub fn ordinal(&self) -> u64 {
187        match *self {
188            Self::Buffer(_) => 1,
189            Self::Stream(_) => 2,
190        }
191    }
192
193    #[deprecated = "Strict unions should not use `is_unknown`"]
194    #[inline]
195    pub fn is_unknown(&self) -> bool {
196        false
197    }
198}
199
200impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Body {}
201
202#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
203pub struct LoaderMarker;
204
205impl fidl::endpoints::ProtocolMarker for LoaderMarker {
206    type Proxy = LoaderProxy;
207    type RequestStream = LoaderRequestStream;
208    #[cfg(target_os = "fuchsia")]
209    type SynchronousProxy = LoaderSynchronousProxy;
210
211    const DEBUG_NAME: &'static str = "fuchsia.net.http.Loader";
212}
213impl fidl::endpoints::DiscoverableProtocolMarker for LoaderMarker {}
214
215pub trait LoaderProxyInterface: Send + Sync {
216    type FetchResponseFut: std::future::Future<Output = Result<Response, fidl::Error>> + Send;
217    fn r#fetch(&self, request: Request) -> Self::FetchResponseFut;
218    fn r#start(
219        &self,
220        request: Request,
221        client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
222    ) -> Result<(), fidl::Error>;
223}
224#[derive(Debug)]
225#[cfg(target_os = "fuchsia")]
226pub struct LoaderSynchronousProxy {
227    client: fidl::client::sync::Client,
228}
229
230#[cfg(target_os = "fuchsia")]
231impl fidl::endpoints::SynchronousProxy for LoaderSynchronousProxy {
232    type Proxy = LoaderProxy;
233    type Protocol = LoaderMarker;
234
235    fn from_channel(inner: fidl::Channel) -> Self {
236        Self::new(inner)
237    }
238
239    fn into_channel(self) -> fidl::Channel {
240        self.client.into_channel()
241    }
242
243    fn as_channel(&self) -> &fidl::Channel {
244        self.client.as_channel()
245    }
246}
247
248#[cfg(target_os = "fuchsia")]
249impl LoaderSynchronousProxy {
250    pub fn new(channel: fidl::Channel) -> Self {
251        let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
252        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
253    }
254
255    pub fn into_channel(self) -> fidl::Channel {
256        self.client.into_channel()
257    }
258
259    /// Waits until an event arrives and returns it. It is safe for other
260    /// threads to make concurrent requests while waiting for an event.
261    pub fn wait_for_event(
262        &self,
263        deadline: zx::MonotonicInstant,
264    ) -> Result<LoaderEvent, fidl::Error> {
265        LoaderEvent::decode(self.client.wait_for_event(deadline)?)
266    }
267
268    /// Initiate the given HTTP or HTTPS request, follow redirects, and return the final
269    /// response.
270    ///
271    /// The loader will follow redirects (up to an implementation-defined limit)
272    /// and return the final response as a reply to this message. To cancel the
273    /// request, close the loader interface.
274    pub fn r#fetch(
275        &self,
276        mut request: Request,
277        ___deadline: zx::MonotonicInstant,
278    ) -> Result<Response, fidl::Error> {
279        let _response = self.client.send_query::<LoaderFetchRequest, LoaderFetchResponse>(
280            (&mut request,),
281            0x66d973be70dc2029,
282            fidl::encoding::DynamicFlags::empty(),
283            ___deadline,
284        )?;
285        Ok(_response.response)
286    }
287
288    /// Initiate the given HTTP or HTTPS request and return all intermediate responses to
289    /// the given client.
290    ///
291    /// Unlike `Fetch`, `Start` does not automatically follow all redirects.
292    /// Instead, each individual response along the redirect chain is delivered
293    /// to the `LoaderClient`.
294    pub fn r#start(
295        &self,
296        mut request: Request,
297        mut client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
298    ) -> Result<(), fidl::Error> {
299        self.client.send::<LoaderStartRequest>(
300            (&mut request, client),
301            0x7165335e1d7dd48e,
302            fidl::encoding::DynamicFlags::empty(),
303        )
304    }
305}
306
307#[derive(Debug, Clone)]
308pub struct LoaderProxy {
309    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
310}
311
312impl fidl::endpoints::Proxy for LoaderProxy {
313    type Protocol = LoaderMarker;
314
315    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
316        Self::new(inner)
317    }
318
319    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
320        self.client.into_channel().map_err(|client| Self { client })
321    }
322
323    fn as_channel(&self) -> &::fidl::AsyncChannel {
324        self.client.as_channel()
325    }
326}
327
328impl LoaderProxy {
329    /// Create a new Proxy for fuchsia.net.http/Loader.
330    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
331        let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
332        Self { client: fidl::client::Client::new(channel, protocol_name) }
333    }
334
335    /// Get a Stream of events from the remote end of the protocol.
336    ///
337    /// # Panics
338    ///
339    /// Panics if the event stream was already taken.
340    pub fn take_event_stream(&self) -> LoaderEventStream {
341        LoaderEventStream { event_receiver: self.client.take_event_receiver() }
342    }
343
344    /// Initiate the given HTTP or HTTPS request, follow redirects, and return the final
345    /// response.
346    ///
347    /// The loader will follow redirects (up to an implementation-defined limit)
348    /// and return the final response as a reply to this message. To cancel the
349    /// request, close the loader interface.
350    pub fn r#fetch(
351        &self,
352        mut request: Request,
353    ) -> fidl::client::QueryResponseFut<Response, fidl::encoding::DefaultFuchsiaResourceDialect>
354    {
355        LoaderProxyInterface::r#fetch(self, request)
356    }
357
358    /// Initiate the given HTTP or HTTPS request and return all intermediate responses to
359    /// the given client.
360    ///
361    /// Unlike `Fetch`, `Start` does not automatically follow all redirects.
362    /// Instead, each individual response along the redirect chain is delivered
363    /// to the `LoaderClient`.
364    pub fn r#start(
365        &self,
366        mut request: Request,
367        mut client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
368    ) -> Result<(), fidl::Error> {
369        LoaderProxyInterface::r#start(self, request, client)
370    }
371}
372
373impl LoaderProxyInterface for LoaderProxy {
374    type FetchResponseFut =
375        fidl::client::QueryResponseFut<Response, fidl::encoding::DefaultFuchsiaResourceDialect>;
376    fn r#fetch(&self, mut request: Request) -> Self::FetchResponseFut {
377        fn _decode(
378            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
379        ) -> Result<Response, fidl::Error> {
380            let _response = fidl::client::decode_transaction_body::<
381                LoaderFetchResponse,
382                fidl::encoding::DefaultFuchsiaResourceDialect,
383                0x66d973be70dc2029,
384            >(_buf?)?;
385            Ok(_response.response)
386        }
387        self.client.send_query_and_decode::<LoaderFetchRequest, Response>(
388            (&mut request,),
389            0x66d973be70dc2029,
390            fidl::encoding::DynamicFlags::empty(),
391            _decode,
392        )
393    }
394
395    fn r#start(
396        &self,
397        mut request: Request,
398        mut client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
399    ) -> Result<(), fidl::Error> {
400        self.client.send::<LoaderStartRequest>(
401            (&mut request, client),
402            0x7165335e1d7dd48e,
403            fidl::encoding::DynamicFlags::empty(),
404        )
405    }
406}
407
408pub struct LoaderEventStream {
409    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
410}
411
412impl std::marker::Unpin for LoaderEventStream {}
413
414impl futures::stream::FusedStream for LoaderEventStream {
415    fn is_terminated(&self) -> bool {
416        self.event_receiver.is_terminated()
417    }
418}
419
420impl futures::Stream for LoaderEventStream {
421    type Item = Result<LoaderEvent, fidl::Error>;
422
423    fn poll_next(
424        mut self: std::pin::Pin<&mut Self>,
425        cx: &mut std::task::Context<'_>,
426    ) -> std::task::Poll<Option<Self::Item>> {
427        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
428            &mut self.event_receiver,
429            cx
430        )?) {
431            Some(buf) => std::task::Poll::Ready(Some(LoaderEvent::decode(buf))),
432            None => std::task::Poll::Ready(None),
433        }
434    }
435}
436
437#[derive(Debug)]
438pub enum LoaderEvent {}
439
440impl LoaderEvent {
441    /// Decodes a message buffer as a [`LoaderEvent`].
442    fn decode(
443        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
444    ) -> Result<LoaderEvent, fidl::Error> {
445        let (bytes, _handles) = buf.split_mut();
446        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
447        debug_assert_eq!(tx_header.tx_id, 0);
448        match tx_header.ordinal {
449            _ => Err(fidl::Error::UnknownOrdinal {
450                ordinal: tx_header.ordinal,
451                protocol_name: <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
452            }),
453        }
454    }
455}
456
457/// A Stream of incoming requests for fuchsia.net.http/Loader.
458pub struct LoaderRequestStream {
459    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
460    is_terminated: bool,
461}
462
463impl std::marker::Unpin for LoaderRequestStream {}
464
465impl futures::stream::FusedStream for LoaderRequestStream {
466    fn is_terminated(&self) -> bool {
467        self.is_terminated
468    }
469}
470
471impl fidl::endpoints::RequestStream for LoaderRequestStream {
472    type Protocol = LoaderMarker;
473    type ControlHandle = LoaderControlHandle;
474
475    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
476        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
477    }
478
479    fn control_handle(&self) -> Self::ControlHandle {
480        LoaderControlHandle { inner: self.inner.clone() }
481    }
482
483    fn into_inner(
484        self,
485    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
486    {
487        (self.inner, self.is_terminated)
488    }
489
490    fn from_inner(
491        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
492        is_terminated: bool,
493    ) -> Self {
494        Self { inner, is_terminated }
495    }
496}
497
498impl futures::Stream for LoaderRequestStream {
499    type Item = Result<LoaderRequest, fidl::Error>;
500
501    fn poll_next(
502        mut self: std::pin::Pin<&mut Self>,
503        cx: &mut std::task::Context<'_>,
504    ) -> std::task::Poll<Option<Self::Item>> {
505        let this = &mut *self;
506        if this.inner.check_shutdown(cx) {
507            this.is_terminated = true;
508            return std::task::Poll::Ready(None);
509        }
510        if this.is_terminated {
511            panic!("polled LoaderRequestStream after completion");
512        }
513        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
514            |bytes, handles| {
515                match this.inner.channel().read_etc(cx, bytes, handles) {
516                    std::task::Poll::Ready(Ok(())) => {}
517                    std::task::Poll::Pending => return std::task::Poll::Pending,
518                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
519                        this.is_terminated = true;
520                        return std::task::Poll::Ready(None);
521                    }
522                    std::task::Poll::Ready(Err(e)) => {
523                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
524                            e.into(),
525                        ))))
526                    }
527                }
528
529                // A message has been received from the channel
530                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
531
532                std::task::Poll::Ready(Some(match header.ordinal {
533                    0x66d973be70dc2029 => {
534                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
535                        let mut req = fidl::new_empty!(
536                            LoaderFetchRequest,
537                            fidl::encoding::DefaultFuchsiaResourceDialect
538                        );
539                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderFetchRequest>(&header, _body_bytes, handles, &mut req)?;
540                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
541                        Ok(LoaderRequest::Fetch {
542                            request: req.request,
543
544                            responder: LoaderFetchResponder {
545                                control_handle: std::mem::ManuallyDrop::new(control_handle),
546                                tx_id: header.tx_id,
547                            },
548                        })
549                    }
550                    0x7165335e1d7dd48e => {
551                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
552                        let mut req = fidl::new_empty!(
553                            LoaderStartRequest,
554                            fidl::encoding::DefaultFuchsiaResourceDialect
555                        );
556                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderStartRequest>(&header, _body_bytes, handles, &mut req)?;
557                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
558                        Ok(LoaderRequest::Start {
559                            request: req.request,
560                            client: req.client,
561
562                            control_handle,
563                        })
564                    }
565                    _ => Err(fidl::Error::UnknownOrdinal {
566                        ordinal: header.ordinal,
567                        protocol_name:
568                            <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
569                    }),
570                }))
571            },
572        )
573    }
574}
575
576/// An HTTP and HTTPS loader.
577///
578/// The loader can service many HTTP or HTTPS requests concurrently. The loader tracks
579/// all the outstanding requests and will cancel them all if the client closes
580/// the loader interface.
581#[derive(Debug)]
582pub enum LoaderRequest {
583    /// Initiate the given HTTP or HTTPS request, follow redirects, and return the final
584    /// response.
585    ///
586    /// The loader will follow redirects (up to an implementation-defined limit)
587    /// and return the final response as a reply to this message. To cancel the
588    /// request, close the loader interface.
589    Fetch { request: Request, responder: LoaderFetchResponder },
590    /// Initiate the given HTTP or HTTPS request and return all intermediate responses to
591    /// the given client.
592    ///
593    /// Unlike `Fetch`, `Start` does not automatically follow all redirects.
594    /// Instead, each individual response along the redirect chain is delivered
595    /// to the `LoaderClient`.
596    Start {
597        request: Request,
598        client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
599        control_handle: LoaderControlHandle,
600    },
601}
602
603impl LoaderRequest {
604    #[allow(irrefutable_let_patterns)]
605    pub fn into_fetch(self) -> Option<(Request, LoaderFetchResponder)> {
606        if let LoaderRequest::Fetch { request, responder } = self {
607            Some((request, responder))
608        } else {
609            None
610        }
611    }
612
613    #[allow(irrefutable_let_patterns)]
614    pub fn into_start(
615        self,
616    ) -> Option<(Request, fidl::endpoints::ClientEnd<LoaderClientMarker>, LoaderControlHandle)>
617    {
618        if let LoaderRequest::Start { request, client, control_handle } = self {
619            Some((request, client, control_handle))
620        } else {
621            None
622        }
623    }
624
625    /// Name of the method defined in FIDL
626    pub fn method_name(&self) -> &'static str {
627        match *self {
628            LoaderRequest::Fetch { .. } => "fetch",
629            LoaderRequest::Start { .. } => "start",
630        }
631    }
632}
633
634#[derive(Debug, Clone)]
635pub struct LoaderControlHandle {
636    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
637}
638
639impl fidl::endpoints::ControlHandle for LoaderControlHandle {
640    fn shutdown(&self) {
641        self.inner.shutdown()
642    }
643    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
644        self.inner.shutdown_with_epitaph(status)
645    }
646
647    fn is_closed(&self) -> bool {
648        self.inner.channel().is_closed()
649    }
650    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
651        self.inner.channel().on_closed()
652    }
653
654    #[cfg(target_os = "fuchsia")]
655    fn signal_peer(
656        &self,
657        clear_mask: zx::Signals,
658        set_mask: zx::Signals,
659    ) -> Result<(), zx_status::Status> {
660        use fidl::Peered;
661        self.inner.channel().signal_peer(clear_mask, set_mask)
662    }
663}
664
665impl LoaderControlHandle {}
666
667#[must_use = "FIDL methods require a response to be sent"]
668#[derive(Debug)]
669pub struct LoaderFetchResponder {
670    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
671    tx_id: u32,
672}
673
674/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
675/// if the responder is dropped without sending a response, so that the client
676/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
677impl std::ops::Drop for LoaderFetchResponder {
678    fn drop(&mut self) {
679        self.control_handle.shutdown();
680        // Safety: drops once, never accessed again
681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
682    }
683}
684
685impl fidl::endpoints::Responder for LoaderFetchResponder {
686    type ControlHandle = LoaderControlHandle;
687
688    fn control_handle(&self) -> &LoaderControlHandle {
689        &self.control_handle
690    }
691
692    fn drop_without_shutdown(mut self) {
693        // Safety: drops once, never accessed again due to mem::forget
694        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
695        // Prevent Drop from running (which would shut down the channel)
696        std::mem::forget(self);
697    }
698}
699
700impl LoaderFetchResponder {
701    /// Sends a response to the FIDL transaction.
702    ///
703    /// Sets the channel to shutdown if an error occurs.
704    pub fn send(self, mut response: Response) -> Result<(), fidl::Error> {
705        let _result = self.send_raw(response);
706        if _result.is_err() {
707            self.control_handle.shutdown();
708        }
709        self.drop_without_shutdown();
710        _result
711    }
712
713    /// Similar to "send" but does not shutdown the channel if an error occurs.
714    pub fn send_no_shutdown_on_err(self, mut response: Response) -> Result<(), fidl::Error> {
715        let _result = self.send_raw(response);
716        self.drop_without_shutdown();
717        _result
718    }
719
720    fn send_raw(&self, mut response: Response) -> Result<(), fidl::Error> {
721        self.control_handle.inner.send::<LoaderFetchResponse>(
722            (&mut response,),
723            self.tx_id,
724            0x66d973be70dc2029,
725            fidl::encoding::DynamicFlags::empty(),
726        )
727    }
728}
729
730#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
731pub struct LoaderClientMarker;
732
733impl fidl::endpoints::ProtocolMarker for LoaderClientMarker {
734    type Proxy = LoaderClientProxy;
735    type RequestStream = LoaderClientRequestStream;
736    #[cfg(target_os = "fuchsia")]
737    type SynchronousProxy = LoaderClientSynchronousProxy;
738
739    const DEBUG_NAME: &'static str = "(anonymous) LoaderClient";
740}
741
742pub trait LoaderClientProxyInterface: Send + Sync {
743    type OnResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
744    fn r#on_response(&self, response: Response) -> Self::OnResponseResponseFut;
745}
746#[derive(Debug)]
747#[cfg(target_os = "fuchsia")]
748pub struct LoaderClientSynchronousProxy {
749    client: fidl::client::sync::Client,
750}
751
752#[cfg(target_os = "fuchsia")]
753impl fidl::endpoints::SynchronousProxy for LoaderClientSynchronousProxy {
754    type Proxy = LoaderClientProxy;
755    type Protocol = LoaderClientMarker;
756
757    fn from_channel(inner: fidl::Channel) -> Self {
758        Self::new(inner)
759    }
760
761    fn into_channel(self) -> fidl::Channel {
762        self.client.into_channel()
763    }
764
765    fn as_channel(&self) -> &fidl::Channel {
766        self.client.as_channel()
767    }
768}
769
770#[cfg(target_os = "fuchsia")]
771impl LoaderClientSynchronousProxy {
772    pub fn new(channel: fidl::Channel) -> Self {
773        let protocol_name = <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
774        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
775    }
776
777    pub fn into_channel(self) -> fidl::Channel {
778        self.client.into_channel()
779    }
780
781    /// Waits until an event arrives and returns it. It is safe for other
782    /// threads to make concurrent requests while waiting for an event.
783    pub fn wait_for_event(
784        &self,
785        deadline: zx::MonotonicInstant,
786    ) -> Result<LoaderClientEvent, fidl::Error> {
787        LoaderClientEvent::decode(self.client.wait_for_event(deadline)?)
788    }
789
790    /// Called by the loader when the loader receives an HTTP response.
791    ///
792    /// If the server has requested a redirect, then `redirect` in `response`
793    /// table will describe the target the server requested. To follow the
794    /// redirect, reply to this message. To not follow the redirect, close the
795    /// underlying channel.
796    pub fn r#on_response(
797        &self,
798        mut response: Response,
799        ___deadline: zx::MonotonicInstant,
800    ) -> Result<(), fidl::Error> {
801        let _response =
802            self.client.send_query::<LoaderClientOnResponseRequest, fidl::encoding::EmptyPayload>(
803                (&mut response,),
804                0x595ada171c7ebf89,
805                fidl::encoding::DynamicFlags::empty(),
806                ___deadline,
807            )?;
808        Ok(_response)
809    }
810}
811
812#[derive(Debug, Clone)]
813pub struct LoaderClientProxy {
814    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
815}
816
817impl fidl::endpoints::Proxy for LoaderClientProxy {
818    type Protocol = LoaderClientMarker;
819
820    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
821        Self::new(inner)
822    }
823
824    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
825        self.client.into_channel().map_err(|client| Self { client })
826    }
827
828    fn as_channel(&self) -> &::fidl::AsyncChannel {
829        self.client.as_channel()
830    }
831}
832
833impl LoaderClientProxy {
834    /// Create a new Proxy for fuchsia.net.http/LoaderClient.
835    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
836        let protocol_name = <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
837        Self { client: fidl::client::Client::new(channel, protocol_name) }
838    }
839
840    /// Get a Stream of events from the remote end of the protocol.
841    ///
842    /// # Panics
843    ///
844    /// Panics if the event stream was already taken.
845    pub fn take_event_stream(&self) -> LoaderClientEventStream {
846        LoaderClientEventStream { event_receiver: self.client.take_event_receiver() }
847    }
848
849    /// Called by the loader when the loader receives an HTTP response.
850    ///
851    /// If the server has requested a redirect, then `redirect` in `response`
852    /// table will describe the target the server requested. To follow the
853    /// redirect, reply to this message. To not follow the redirect, close the
854    /// underlying channel.
855    pub fn r#on_response(
856        &self,
857        mut response: Response,
858    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
859        LoaderClientProxyInterface::r#on_response(self, response)
860    }
861}
862
863impl LoaderClientProxyInterface for LoaderClientProxy {
864    type OnResponseResponseFut =
865        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
866    fn r#on_response(&self, mut response: Response) -> Self::OnResponseResponseFut {
867        fn _decode(
868            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
869        ) -> Result<(), fidl::Error> {
870            let _response = fidl::client::decode_transaction_body::<
871                fidl::encoding::EmptyPayload,
872                fidl::encoding::DefaultFuchsiaResourceDialect,
873                0x595ada171c7ebf89,
874            >(_buf?)?;
875            Ok(_response)
876        }
877        self.client.send_query_and_decode::<LoaderClientOnResponseRequest, ()>(
878            (&mut response,),
879            0x595ada171c7ebf89,
880            fidl::encoding::DynamicFlags::empty(),
881            _decode,
882        )
883    }
884}
885
886pub struct LoaderClientEventStream {
887    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
888}
889
890impl std::marker::Unpin for LoaderClientEventStream {}
891
892impl futures::stream::FusedStream for LoaderClientEventStream {
893    fn is_terminated(&self) -> bool {
894        self.event_receiver.is_terminated()
895    }
896}
897
898impl futures::Stream for LoaderClientEventStream {
899    type Item = Result<LoaderClientEvent, fidl::Error>;
900
901    fn poll_next(
902        mut self: std::pin::Pin<&mut Self>,
903        cx: &mut std::task::Context<'_>,
904    ) -> std::task::Poll<Option<Self::Item>> {
905        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
906            &mut self.event_receiver,
907            cx
908        )?) {
909            Some(buf) => std::task::Poll::Ready(Some(LoaderClientEvent::decode(buf))),
910            None => std::task::Poll::Ready(None),
911        }
912    }
913}
914
915#[derive(Debug)]
916pub enum LoaderClientEvent {}
917
918impl LoaderClientEvent {
919    /// Decodes a message buffer as a [`LoaderClientEvent`].
920    fn decode(
921        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
922    ) -> Result<LoaderClientEvent, fidl::Error> {
923        let (bytes, _handles) = buf.split_mut();
924        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
925        debug_assert_eq!(tx_header.tx_id, 0);
926        match tx_header.ordinal {
927            _ => Err(fidl::Error::UnknownOrdinal {
928                ordinal: tx_header.ordinal,
929                protocol_name: <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
930            }),
931        }
932    }
933}
934
935/// A Stream of incoming requests for fuchsia.net.http/LoaderClient.
936pub struct LoaderClientRequestStream {
937    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
938    is_terminated: bool,
939}
940
941impl std::marker::Unpin for LoaderClientRequestStream {}
942
943impl futures::stream::FusedStream for LoaderClientRequestStream {
944    fn is_terminated(&self) -> bool {
945        self.is_terminated
946    }
947}
948
949impl fidl::endpoints::RequestStream for LoaderClientRequestStream {
950    type Protocol = LoaderClientMarker;
951    type ControlHandle = LoaderClientControlHandle;
952
953    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
954        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
955    }
956
957    fn control_handle(&self) -> Self::ControlHandle {
958        LoaderClientControlHandle { inner: self.inner.clone() }
959    }
960
961    fn into_inner(
962        self,
963    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
964    {
965        (self.inner, self.is_terminated)
966    }
967
968    fn from_inner(
969        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
970        is_terminated: bool,
971    ) -> Self {
972        Self { inner, is_terminated }
973    }
974}
975
976impl futures::Stream for LoaderClientRequestStream {
977    type Item = Result<LoaderClientRequest, fidl::Error>;
978
979    fn poll_next(
980        mut self: std::pin::Pin<&mut Self>,
981        cx: &mut std::task::Context<'_>,
982    ) -> std::task::Poll<Option<Self::Item>> {
983        let this = &mut *self;
984        if this.inner.check_shutdown(cx) {
985            this.is_terminated = true;
986            return std::task::Poll::Ready(None);
987        }
988        if this.is_terminated {
989            panic!("polled LoaderClientRequestStream after completion");
990        }
991        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
992            |bytes, handles| {
993                match this.inner.channel().read_etc(cx, bytes, handles) {
994                    std::task::Poll::Ready(Ok(())) => {}
995                    std::task::Poll::Pending => return std::task::Poll::Pending,
996                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
997                        this.is_terminated = true;
998                        return std::task::Poll::Ready(None);
999                    }
1000                    std::task::Poll::Ready(Err(e)) => {
1001                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1002                            e.into(),
1003                        ))))
1004                    }
1005                }
1006
1007                // A message has been received from the channel
1008                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1009
1010                std::task::Poll::Ready(Some(match header.ordinal {
1011                    0x595ada171c7ebf89 => {
1012                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1013                        let mut req = fidl::new_empty!(
1014                            LoaderClientOnResponseRequest,
1015                            fidl::encoding::DefaultFuchsiaResourceDialect
1016                        );
1017                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderClientOnResponseRequest>(&header, _body_bytes, handles, &mut req)?;
1018                        let control_handle =
1019                            LoaderClientControlHandle { inner: this.inner.clone() };
1020                        Ok(LoaderClientRequest::OnResponse {
1021                            response: req.response,
1022
1023                            responder: LoaderClientOnResponseResponder {
1024                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1025                                tx_id: header.tx_id,
1026                            },
1027                        })
1028                    }
1029                    _ => Err(fidl::Error::UnknownOrdinal {
1030                        ordinal: header.ordinal,
1031                        protocol_name:
1032                            <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1033                    }),
1034                }))
1035            },
1036        )
1037    }
1038}
1039
1040/// A client interface used with `Loader.Start`.
1041///
1042/// Closing the underlying channel will cancel the associated HTTP transaction.
1043#[derive(Debug)]
1044pub enum LoaderClientRequest {
1045    /// Called by the loader when the loader receives an HTTP response.
1046    ///
1047    /// If the server has requested a redirect, then `redirect` in `response`
1048    /// table will describe the target the server requested. To follow the
1049    /// redirect, reply to this message. To not follow the redirect, close the
1050    /// underlying channel.
1051    OnResponse { response: Response, responder: LoaderClientOnResponseResponder },
1052}
1053
1054impl LoaderClientRequest {
1055    #[allow(irrefutable_let_patterns)]
1056    pub fn into_on_response(self) -> Option<(Response, LoaderClientOnResponseResponder)> {
1057        if let LoaderClientRequest::OnResponse { response, responder } = self {
1058            Some((response, responder))
1059        } else {
1060            None
1061        }
1062    }
1063
1064    /// Name of the method defined in FIDL
1065    pub fn method_name(&self) -> &'static str {
1066        match *self {
1067            LoaderClientRequest::OnResponse { .. } => "on_response",
1068        }
1069    }
1070}
1071
1072#[derive(Debug, Clone)]
1073pub struct LoaderClientControlHandle {
1074    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1075}
1076
1077impl fidl::endpoints::ControlHandle for LoaderClientControlHandle {
1078    fn shutdown(&self) {
1079        self.inner.shutdown()
1080    }
1081    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1082        self.inner.shutdown_with_epitaph(status)
1083    }
1084
1085    fn is_closed(&self) -> bool {
1086        self.inner.channel().is_closed()
1087    }
1088    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1089        self.inner.channel().on_closed()
1090    }
1091
1092    #[cfg(target_os = "fuchsia")]
1093    fn signal_peer(
1094        &self,
1095        clear_mask: zx::Signals,
1096        set_mask: zx::Signals,
1097    ) -> Result<(), zx_status::Status> {
1098        use fidl::Peered;
1099        self.inner.channel().signal_peer(clear_mask, set_mask)
1100    }
1101}
1102
1103impl LoaderClientControlHandle {}
1104
1105#[must_use = "FIDL methods require a response to be sent"]
1106#[derive(Debug)]
1107pub struct LoaderClientOnResponseResponder {
1108    control_handle: std::mem::ManuallyDrop<LoaderClientControlHandle>,
1109    tx_id: u32,
1110}
1111
1112/// Set the the channel to be shutdown (see [`LoaderClientControlHandle::shutdown`])
1113/// if the responder is dropped without sending a response, so that the client
1114/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1115impl std::ops::Drop for LoaderClientOnResponseResponder {
1116    fn drop(&mut self) {
1117        self.control_handle.shutdown();
1118        // Safety: drops once, never accessed again
1119        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1120    }
1121}
1122
1123impl fidl::endpoints::Responder for LoaderClientOnResponseResponder {
1124    type ControlHandle = LoaderClientControlHandle;
1125
1126    fn control_handle(&self) -> &LoaderClientControlHandle {
1127        &self.control_handle
1128    }
1129
1130    fn drop_without_shutdown(mut self) {
1131        // Safety: drops once, never accessed again due to mem::forget
1132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133        // Prevent Drop from running (which would shut down the channel)
1134        std::mem::forget(self);
1135    }
1136}
1137
1138impl LoaderClientOnResponseResponder {
1139    /// Sends a response to the FIDL transaction.
1140    ///
1141    /// Sets the channel to shutdown if an error occurs.
1142    pub fn send(self) -> Result<(), fidl::Error> {
1143        let _result = self.send_raw();
1144        if _result.is_err() {
1145            self.control_handle.shutdown();
1146        }
1147        self.drop_without_shutdown();
1148        _result
1149    }
1150
1151    /// Similar to "send" but does not shutdown the channel if an error occurs.
1152    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1153        let _result = self.send_raw();
1154        self.drop_without_shutdown();
1155        _result
1156    }
1157
1158    fn send_raw(&self) -> Result<(), fidl::Error> {
1159        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1160            (),
1161            self.tx_id,
1162            0x595ada171c7ebf89,
1163            fidl::encoding::DynamicFlags::empty(),
1164        )
1165    }
1166}
1167
1168mod internal {
1169    use super::*;
1170    unsafe impl fidl::encoding::TypeMarker for Error {
1171        type Owned = Self;
1172
1173        #[inline(always)]
1174        fn inline_align(_context: fidl::encoding::Context) -> usize {
1175            std::mem::align_of::<u32>()
1176        }
1177
1178        #[inline(always)]
1179        fn inline_size(_context: fidl::encoding::Context) -> usize {
1180            std::mem::size_of::<u32>()
1181        }
1182
1183        #[inline(always)]
1184        fn encode_is_copy() -> bool {
1185            true
1186        }
1187
1188        #[inline(always)]
1189        fn decode_is_copy() -> bool {
1190            false
1191        }
1192    }
1193
1194    impl fidl::encoding::ValueTypeMarker for Error {
1195        type Borrowed<'a> = Self;
1196        #[inline(always)]
1197        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1198            *value
1199        }
1200    }
1201
1202    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
1203        #[inline]
1204        unsafe fn encode(
1205            self,
1206            encoder: &mut fidl::encoding::Encoder<'_, D>,
1207            offset: usize,
1208            _depth: fidl::encoding::Depth,
1209        ) -> fidl::Result<()> {
1210            encoder.debug_check_bounds::<Self>(offset);
1211            encoder.write_num(self.into_primitive(), offset);
1212            Ok(())
1213        }
1214    }
1215
1216    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
1217        #[inline(always)]
1218        fn new_empty() -> Self {
1219            Self::Internal
1220        }
1221
1222        #[inline]
1223        unsafe fn decode(
1224            &mut self,
1225            decoder: &mut fidl::encoding::Decoder<'_, D>,
1226            offset: usize,
1227            _depth: fidl::encoding::Depth,
1228        ) -> fidl::Result<()> {
1229            decoder.debug_check_bounds::<Self>(offset);
1230            let prim = decoder.read_num::<u32>(offset);
1231
1232            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1233            Ok(())
1234        }
1235    }
1236
1237    impl fidl::encoding::ValueTypeMarker for Header {
1238        type Borrowed<'a> = &'a Self;
1239        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1240            value
1241        }
1242    }
1243
1244    unsafe impl fidl::encoding::TypeMarker for Header {
1245        type Owned = Self;
1246
1247        #[inline(always)]
1248        fn inline_align(_context: fidl::encoding::Context) -> usize {
1249            8
1250        }
1251
1252        #[inline(always)]
1253        fn inline_size(_context: fidl::encoding::Context) -> usize {
1254            32
1255        }
1256    }
1257
1258    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Header, D> for &Header {
1259        #[inline]
1260        unsafe fn encode(
1261            self,
1262            encoder: &mut fidl::encoding::Encoder<'_, D>,
1263            offset: usize,
1264            _depth: fidl::encoding::Depth,
1265        ) -> fidl::Result<()> {
1266            encoder.debug_check_bounds::<Header>(offset);
1267            // Delegate to tuple encoding.
1268            fidl::encoding::Encode::<Header, D>::encode(
1269                (
1270                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1271                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1272                ),
1273                encoder, offset, _depth
1274            )
1275        }
1276    }
1277    unsafe impl<
1278            D: fidl::encoding::ResourceDialect,
1279            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1280            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1281        > fidl::encoding::Encode<Header, D> for (T0, T1)
1282    {
1283        #[inline]
1284        unsafe fn encode(
1285            self,
1286            encoder: &mut fidl::encoding::Encoder<'_, D>,
1287            offset: usize,
1288            depth: fidl::encoding::Depth,
1289        ) -> fidl::Result<()> {
1290            encoder.debug_check_bounds::<Header>(offset);
1291            // Zero out padding regions. There's no need to apply masks
1292            // because the unmasked parts will be overwritten by fields.
1293            // Write the fields.
1294            self.0.encode(encoder, offset + 0, depth)?;
1295            self.1.encode(encoder, offset + 16, depth)?;
1296            Ok(())
1297        }
1298    }
1299
1300    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Header {
1301        #[inline(always)]
1302        fn new_empty() -> Self {
1303            Self {
1304                name: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1305                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1306            }
1307        }
1308
1309        #[inline]
1310        unsafe fn decode(
1311            &mut self,
1312            decoder: &mut fidl::encoding::Decoder<'_, D>,
1313            offset: usize,
1314            _depth: fidl::encoding::Depth,
1315        ) -> fidl::Result<()> {
1316            decoder.debug_check_bounds::<Self>(offset);
1317            // Verify that padding bytes are zero.
1318            fidl::decode!(
1319                fidl::encoding::UnboundedVector<u8>,
1320                D,
1321                &mut self.name,
1322                decoder,
1323                offset + 0,
1324                _depth
1325            )?;
1326            fidl::decode!(
1327                fidl::encoding::UnboundedVector<u8>,
1328                D,
1329                &mut self.value,
1330                decoder,
1331                offset + 16,
1332                _depth
1333            )?;
1334            Ok(())
1335        }
1336    }
1337
1338    impl fidl::encoding::ResourceTypeMarker for LoaderClientOnResponseRequest {
1339        type Borrowed<'a> = &'a mut Self;
1340        fn take_or_borrow<'a>(
1341            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1342        ) -> Self::Borrowed<'a> {
1343            value
1344        }
1345    }
1346
1347    unsafe impl fidl::encoding::TypeMarker for LoaderClientOnResponseRequest {
1348        type Owned = Self;
1349
1350        #[inline(always)]
1351        fn inline_align(_context: fidl::encoding::Context) -> usize {
1352            8
1353        }
1354
1355        #[inline(always)]
1356        fn inline_size(_context: fidl::encoding::Context) -> usize {
1357            16
1358        }
1359    }
1360
1361    unsafe impl
1362        fidl::encoding::Encode<
1363            LoaderClientOnResponseRequest,
1364            fidl::encoding::DefaultFuchsiaResourceDialect,
1365        > for &mut LoaderClientOnResponseRequest
1366    {
1367        #[inline]
1368        unsafe fn encode(
1369            self,
1370            encoder: &mut fidl::encoding::Encoder<
1371                '_,
1372                fidl::encoding::DefaultFuchsiaResourceDialect,
1373            >,
1374            offset: usize,
1375            _depth: fidl::encoding::Depth,
1376        ) -> fidl::Result<()> {
1377            encoder.debug_check_bounds::<LoaderClientOnResponseRequest>(offset);
1378            // Delegate to tuple encoding.
1379            fidl::encoding::Encode::<
1380                LoaderClientOnResponseRequest,
1381                fidl::encoding::DefaultFuchsiaResourceDialect,
1382            >::encode(
1383                (<Response as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1384                    &mut self.response,
1385                ),),
1386                encoder,
1387                offset,
1388                _depth,
1389            )
1390        }
1391    }
1392    unsafe impl<T0: fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>>
1393        fidl::encoding::Encode<
1394            LoaderClientOnResponseRequest,
1395            fidl::encoding::DefaultFuchsiaResourceDialect,
1396        > for (T0,)
1397    {
1398        #[inline]
1399        unsafe fn encode(
1400            self,
1401            encoder: &mut fidl::encoding::Encoder<
1402                '_,
1403                fidl::encoding::DefaultFuchsiaResourceDialect,
1404            >,
1405            offset: usize,
1406            depth: fidl::encoding::Depth,
1407        ) -> fidl::Result<()> {
1408            encoder.debug_check_bounds::<LoaderClientOnResponseRequest>(offset);
1409            // Zero out padding regions. There's no need to apply masks
1410            // because the unmasked parts will be overwritten by fields.
1411            // Write the fields.
1412            self.0.encode(encoder, offset + 0, depth)?;
1413            Ok(())
1414        }
1415    }
1416
1417    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1418        for LoaderClientOnResponseRequest
1419    {
1420        #[inline(always)]
1421        fn new_empty() -> Self {
1422            Self {
1423                response: fidl::new_empty!(Response, fidl::encoding::DefaultFuchsiaResourceDialect),
1424            }
1425        }
1426
1427        #[inline]
1428        unsafe fn decode(
1429            &mut self,
1430            decoder: &mut fidl::encoding::Decoder<
1431                '_,
1432                fidl::encoding::DefaultFuchsiaResourceDialect,
1433            >,
1434            offset: usize,
1435            _depth: fidl::encoding::Depth,
1436        ) -> fidl::Result<()> {
1437            decoder.debug_check_bounds::<Self>(offset);
1438            // Verify that padding bytes are zero.
1439            fidl::decode!(
1440                Response,
1441                fidl::encoding::DefaultFuchsiaResourceDialect,
1442                &mut self.response,
1443                decoder,
1444                offset + 0,
1445                _depth
1446            )?;
1447            Ok(())
1448        }
1449    }
1450
1451    impl fidl::encoding::ResourceTypeMarker for LoaderFetchRequest {
1452        type Borrowed<'a> = &'a mut Self;
1453        fn take_or_borrow<'a>(
1454            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1455        ) -> Self::Borrowed<'a> {
1456            value
1457        }
1458    }
1459
1460    unsafe impl fidl::encoding::TypeMarker for LoaderFetchRequest {
1461        type Owned = Self;
1462
1463        #[inline(always)]
1464        fn inline_align(_context: fidl::encoding::Context) -> usize {
1465            8
1466        }
1467
1468        #[inline(always)]
1469        fn inline_size(_context: fidl::encoding::Context) -> usize {
1470            16
1471        }
1472    }
1473
1474    unsafe impl
1475        fidl::encoding::Encode<LoaderFetchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1476        for &mut LoaderFetchRequest
1477    {
1478        #[inline]
1479        unsafe fn encode(
1480            self,
1481            encoder: &mut fidl::encoding::Encoder<
1482                '_,
1483                fidl::encoding::DefaultFuchsiaResourceDialect,
1484            >,
1485            offset: usize,
1486            _depth: fidl::encoding::Depth,
1487        ) -> fidl::Result<()> {
1488            encoder.debug_check_bounds::<LoaderFetchRequest>(offset);
1489            // Delegate to tuple encoding.
1490            fidl::encoding::Encode::<
1491                LoaderFetchRequest,
1492                fidl::encoding::DefaultFuchsiaResourceDialect,
1493            >::encode(
1494                (<Request as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1495                    &mut self.request,
1496                ),),
1497                encoder,
1498                offset,
1499                _depth,
1500            )
1501        }
1502    }
1503    unsafe impl<T0: fidl::encoding::Encode<Request, fidl::encoding::DefaultFuchsiaResourceDialect>>
1504        fidl::encoding::Encode<LoaderFetchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1505        for (T0,)
1506    {
1507        #[inline]
1508        unsafe fn encode(
1509            self,
1510            encoder: &mut fidl::encoding::Encoder<
1511                '_,
1512                fidl::encoding::DefaultFuchsiaResourceDialect,
1513            >,
1514            offset: usize,
1515            depth: fidl::encoding::Depth,
1516        ) -> fidl::Result<()> {
1517            encoder.debug_check_bounds::<LoaderFetchRequest>(offset);
1518            // Zero out padding regions. There's no need to apply masks
1519            // because the unmasked parts will be overwritten by fields.
1520            // Write the fields.
1521            self.0.encode(encoder, offset + 0, depth)?;
1522            Ok(())
1523        }
1524    }
1525
1526    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1527        for LoaderFetchRequest
1528    {
1529        #[inline(always)]
1530        fn new_empty() -> Self {
1531            Self {
1532                request: fidl::new_empty!(Request, fidl::encoding::DefaultFuchsiaResourceDialect),
1533            }
1534        }
1535
1536        #[inline]
1537        unsafe fn decode(
1538            &mut self,
1539            decoder: &mut fidl::encoding::Decoder<
1540                '_,
1541                fidl::encoding::DefaultFuchsiaResourceDialect,
1542            >,
1543            offset: usize,
1544            _depth: fidl::encoding::Depth,
1545        ) -> fidl::Result<()> {
1546            decoder.debug_check_bounds::<Self>(offset);
1547            // Verify that padding bytes are zero.
1548            fidl::decode!(
1549                Request,
1550                fidl::encoding::DefaultFuchsiaResourceDialect,
1551                &mut self.request,
1552                decoder,
1553                offset + 0,
1554                _depth
1555            )?;
1556            Ok(())
1557        }
1558    }
1559
1560    impl fidl::encoding::ResourceTypeMarker for LoaderFetchResponse {
1561        type Borrowed<'a> = &'a mut Self;
1562        fn take_or_borrow<'a>(
1563            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1564        ) -> Self::Borrowed<'a> {
1565            value
1566        }
1567    }
1568
1569    unsafe impl fidl::encoding::TypeMarker for LoaderFetchResponse {
1570        type Owned = Self;
1571
1572        #[inline(always)]
1573        fn inline_align(_context: fidl::encoding::Context) -> usize {
1574            8
1575        }
1576
1577        #[inline(always)]
1578        fn inline_size(_context: fidl::encoding::Context) -> usize {
1579            16
1580        }
1581    }
1582
1583    unsafe impl
1584        fidl::encoding::Encode<LoaderFetchResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1585        for &mut LoaderFetchResponse
1586    {
1587        #[inline]
1588        unsafe fn encode(
1589            self,
1590            encoder: &mut fidl::encoding::Encoder<
1591                '_,
1592                fidl::encoding::DefaultFuchsiaResourceDialect,
1593            >,
1594            offset: usize,
1595            _depth: fidl::encoding::Depth,
1596        ) -> fidl::Result<()> {
1597            encoder.debug_check_bounds::<LoaderFetchResponse>(offset);
1598            // Delegate to tuple encoding.
1599            fidl::encoding::Encode::<
1600                LoaderFetchResponse,
1601                fidl::encoding::DefaultFuchsiaResourceDialect,
1602            >::encode(
1603                (<Response as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1604                    &mut self.response,
1605                ),),
1606                encoder,
1607                offset,
1608                _depth,
1609            )
1610        }
1611    }
1612    unsafe impl<T0: fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>>
1613        fidl::encoding::Encode<LoaderFetchResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1614        for (T0,)
1615    {
1616        #[inline]
1617        unsafe fn encode(
1618            self,
1619            encoder: &mut fidl::encoding::Encoder<
1620                '_,
1621                fidl::encoding::DefaultFuchsiaResourceDialect,
1622            >,
1623            offset: usize,
1624            depth: fidl::encoding::Depth,
1625        ) -> fidl::Result<()> {
1626            encoder.debug_check_bounds::<LoaderFetchResponse>(offset);
1627            // Zero out padding regions. There's no need to apply masks
1628            // because the unmasked parts will be overwritten by fields.
1629            // Write the fields.
1630            self.0.encode(encoder, offset + 0, depth)?;
1631            Ok(())
1632        }
1633    }
1634
1635    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1636        for LoaderFetchResponse
1637    {
1638        #[inline(always)]
1639        fn new_empty() -> Self {
1640            Self {
1641                response: fidl::new_empty!(Response, fidl::encoding::DefaultFuchsiaResourceDialect),
1642            }
1643        }
1644
1645        #[inline]
1646        unsafe fn decode(
1647            &mut self,
1648            decoder: &mut fidl::encoding::Decoder<
1649                '_,
1650                fidl::encoding::DefaultFuchsiaResourceDialect,
1651            >,
1652            offset: usize,
1653            _depth: fidl::encoding::Depth,
1654        ) -> fidl::Result<()> {
1655            decoder.debug_check_bounds::<Self>(offset);
1656            // Verify that padding bytes are zero.
1657            fidl::decode!(
1658                Response,
1659                fidl::encoding::DefaultFuchsiaResourceDialect,
1660                &mut self.response,
1661                decoder,
1662                offset + 0,
1663                _depth
1664            )?;
1665            Ok(())
1666        }
1667    }
1668
1669    impl fidl::encoding::ResourceTypeMarker for LoaderStartRequest {
1670        type Borrowed<'a> = &'a mut Self;
1671        fn take_or_borrow<'a>(
1672            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1673        ) -> Self::Borrowed<'a> {
1674            value
1675        }
1676    }
1677
1678    unsafe impl fidl::encoding::TypeMarker for LoaderStartRequest {
1679        type Owned = Self;
1680
1681        #[inline(always)]
1682        fn inline_align(_context: fidl::encoding::Context) -> usize {
1683            8
1684        }
1685
1686        #[inline(always)]
1687        fn inline_size(_context: fidl::encoding::Context) -> usize {
1688            24
1689        }
1690    }
1691
1692    unsafe impl
1693        fidl::encoding::Encode<LoaderStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1694        for &mut LoaderStartRequest
1695    {
1696        #[inline]
1697        unsafe fn encode(
1698            self,
1699            encoder: &mut fidl::encoding::Encoder<
1700                '_,
1701                fidl::encoding::DefaultFuchsiaResourceDialect,
1702            >,
1703            offset: usize,
1704            _depth: fidl::encoding::Depth,
1705        ) -> fidl::Result<()> {
1706            encoder.debug_check_bounds::<LoaderStartRequest>(offset);
1707            // Delegate to tuple encoding.
1708            fidl::encoding::Encode::<LoaderStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1709                (
1710                    <Request as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1711                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
1712                ),
1713                encoder, offset, _depth
1714            )
1715        }
1716    }
1717    unsafe impl<
1718            T0: fidl::encoding::Encode<Request, fidl::encoding::DefaultFuchsiaResourceDialect>,
1719            T1: fidl::encoding::Encode<
1720                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>>,
1721                fidl::encoding::DefaultFuchsiaResourceDialect,
1722            >,
1723        >
1724        fidl::encoding::Encode<LoaderStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1725        for (T0, T1)
1726    {
1727        #[inline]
1728        unsafe fn encode(
1729            self,
1730            encoder: &mut fidl::encoding::Encoder<
1731                '_,
1732                fidl::encoding::DefaultFuchsiaResourceDialect,
1733            >,
1734            offset: usize,
1735            depth: fidl::encoding::Depth,
1736        ) -> fidl::Result<()> {
1737            encoder.debug_check_bounds::<LoaderStartRequest>(offset);
1738            // Zero out padding regions. There's no need to apply masks
1739            // because the unmasked parts will be overwritten by fields.
1740            unsafe {
1741                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1742                (ptr as *mut u64).write_unaligned(0);
1743            }
1744            // Write the fields.
1745            self.0.encode(encoder, offset + 0, depth)?;
1746            self.1.encode(encoder, offset + 16, depth)?;
1747            Ok(())
1748        }
1749    }
1750
1751    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1752        for LoaderStartRequest
1753    {
1754        #[inline(always)]
1755        fn new_empty() -> Self {
1756            Self {
1757                request: fidl::new_empty!(Request, fidl::encoding::DefaultFuchsiaResourceDialect),
1758                client: fidl::new_empty!(
1759                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>>,
1760                    fidl::encoding::DefaultFuchsiaResourceDialect
1761                ),
1762            }
1763        }
1764
1765        #[inline]
1766        unsafe fn decode(
1767            &mut self,
1768            decoder: &mut fidl::encoding::Decoder<
1769                '_,
1770                fidl::encoding::DefaultFuchsiaResourceDialect,
1771            >,
1772            offset: usize,
1773            _depth: fidl::encoding::Depth,
1774        ) -> fidl::Result<()> {
1775            decoder.debug_check_bounds::<Self>(offset);
1776            // Verify that padding bytes are zero.
1777            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1778            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1779            let mask = 0xffffffff00000000u64;
1780            let maskedval = padval & mask;
1781            if maskedval != 0 {
1782                return Err(fidl::Error::NonZeroPadding {
1783                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1784                });
1785            }
1786            fidl::decode!(
1787                Request,
1788                fidl::encoding::DefaultFuchsiaResourceDialect,
1789                &mut self.request,
1790                decoder,
1791                offset + 0,
1792                _depth
1793            )?;
1794            fidl::decode!(
1795                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>>,
1796                fidl::encoding::DefaultFuchsiaResourceDialect,
1797                &mut self.client,
1798                decoder,
1799                offset + 16,
1800                _depth
1801            )?;
1802            Ok(())
1803        }
1804    }
1805
1806    impl RedirectTarget {
1807        #[inline(always)]
1808        fn max_ordinal_present(&self) -> u64 {
1809            if let Some(_) = self.referrer {
1810                return 3;
1811            }
1812            if let Some(_) = self.url {
1813                return 2;
1814            }
1815            if let Some(_) = self.method {
1816                return 1;
1817            }
1818            0
1819        }
1820    }
1821
1822    impl fidl::encoding::ValueTypeMarker for RedirectTarget {
1823        type Borrowed<'a> = &'a Self;
1824        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1825            value
1826        }
1827    }
1828
1829    unsafe impl fidl::encoding::TypeMarker for RedirectTarget {
1830        type Owned = Self;
1831
1832        #[inline(always)]
1833        fn inline_align(_context: fidl::encoding::Context) -> usize {
1834            8
1835        }
1836
1837        #[inline(always)]
1838        fn inline_size(_context: fidl::encoding::Context) -> usize {
1839            16
1840        }
1841    }
1842
1843    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RedirectTarget, D>
1844        for &RedirectTarget
1845    {
1846        unsafe fn encode(
1847            self,
1848            encoder: &mut fidl::encoding::Encoder<'_, D>,
1849            offset: usize,
1850            mut depth: fidl::encoding::Depth,
1851        ) -> fidl::Result<()> {
1852            encoder.debug_check_bounds::<RedirectTarget>(offset);
1853            // Vector header
1854            let max_ordinal: u64 = self.max_ordinal_present();
1855            encoder.write_num(max_ordinal, offset);
1856            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1857            // Calling encoder.out_of_line_offset(0) is not allowed.
1858            if max_ordinal == 0 {
1859                return Ok(());
1860            }
1861            depth.increment()?;
1862            let envelope_size = 8;
1863            let bytes_len = max_ordinal as usize * envelope_size;
1864            #[allow(unused_variables)]
1865            let offset = encoder.out_of_line_offset(bytes_len);
1866            let mut _prev_end_offset: usize = 0;
1867            if 1 > max_ordinal {
1868                return Ok(());
1869            }
1870
1871            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1872            // are envelope_size bytes.
1873            let cur_offset: usize = (1 - 1) * envelope_size;
1874
1875            // Zero reserved fields.
1876            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1877
1878            // Safety:
1879            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1880            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1881            //   envelope_size bytes, there is always sufficient room.
1882            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1883            self.method.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1884            encoder, offset + cur_offset, depth
1885        )?;
1886
1887            _prev_end_offset = cur_offset + envelope_size;
1888            if 2 > max_ordinal {
1889                return Ok(());
1890            }
1891
1892            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1893            // are envelope_size bytes.
1894            let cur_offset: usize = (2 - 1) * envelope_size;
1895
1896            // Zero reserved fields.
1897            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1898
1899            // Safety:
1900            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1901            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1902            //   envelope_size bytes, there is always sufficient room.
1903            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
1904            self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1905            encoder, offset + cur_offset, depth
1906        )?;
1907
1908            _prev_end_offset = cur_offset + envelope_size;
1909            if 3 > max_ordinal {
1910                return Ok(());
1911            }
1912
1913            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1914            // are envelope_size bytes.
1915            let cur_offset: usize = (3 - 1) * envelope_size;
1916
1917            // Zero reserved fields.
1918            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1919
1920            // Safety:
1921            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1922            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1923            //   envelope_size bytes, there is always sufficient room.
1924            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
1925            self.referrer.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1926            encoder, offset + cur_offset, depth
1927        )?;
1928
1929            _prev_end_offset = cur_offset + envelope_size;
1930
1931            Ok(())
1932        }
1933    }
1934
1935    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RedirectTarget {
1936        #[inline(always)]
1937        fn new_empty() -> Self {
1938            Self::default()
1939        }
1940
1941        unsafe fn decode(
1942            &mut self,
1943            decoder: &mut fidl::encoding::Decoder<'_, D>,
1944            offset: usize,
1945            mut depth: fidl::encoding::Depth,
1946        ) -> fidl::Result<()> {
1947            decoder.debug_check_bounds::<Self>(offset);
1948            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1949                None => return Err(fidl::Error::NotNullable),
1950                Some(len) => len,
1951            };
1952            // Calling decoder.out_of_line_offset(0) is not allowed.
1953            if len == 0 {
1954                return Ok(());
1955            };
1956            depth.increment()?;
1957            let envelope_size = 8;
1958            let bytes_len = len * envelope_size;
1959            let offset = decoder.out_of_line_offset(bytes_len)?;
1960            // Decode the envelope for each type.
1961            let mut _next_ordinal_to_read = 0;
1962            let mut next_offset = offset;
1963            let end_offset = offset + bytes_len;
1964            _next_ordinal_to_read += 1;
1965            if next_offset >= end_offset {
1966                return Ok(());
1967            }
1968
1969            // Decode unknown envelopes for gaps in ordinals.
1970            while _next_ordinal_to_read < 1 {
1971                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1972                _next_ordinal_to_read += 1;
1973                next_offset += envelope_size;
1974            }
1975
1976            let next_out_of_line = decoder.next_out_of_line();
1977            let handles_before = decoder.remaining_handles();
1978            if let Some((inlined, num_bytes, num_handles)) =
1979                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1980            {
1981                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1982                if inlined != (member_inline_size <= 4) {
1983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1984                }
1985                let inner_offset;
1986                let mut inner_depth = depth.clone();
1987                if inlined {
1988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1989                    inner_offset = next_offset;
1990                } else {
1991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1992                    inner_depth.increment()?;
1993                }
1994                let val_ref = self.method.get_or_insert_with(|| {
1995                    fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1996                });
1997                fidl::decode!(
1998                    fidl::encoding::BoundedString<1024>,
1999                    D,
2000                    val_ref,
2001                    decoder,
2002                    inner_offset,
2003                    inner_depth
2004                )?;
2005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2006                {
2007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2008                }
2009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2011                }
2012            }
2013
2014            next_offset += envelope_size;
2015            _next_ordinal_to_read += 1;
2016            if next_offset >= end_offset {
2017                return Ok(());
2018            }
2019
2020            // Decode unknown envelopes for gaps in ordinals.
2021            while _next_ordinal_to_read < 2 {
2022                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2023                _next_ordinal_to_read += 1;
2024                next_offset += envelope_size;
2025            }
2026
2027            let next_out_of_line = decoder.next_out_of_line();
2028            let handles_before = decoder.remaining_handles();
2029            if let Some((inlined, num_bytes, num_handles)) =
2030                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2031            {
2032                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2033                if inlined != (member_inline_size <= 4) {
2034                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2035                }
2036                let inner_offset;
2037                let mut inner_depth = depth.clone();
2038                if inlined {
2039                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2040                    inner_offset = next_offset;
2041                } else {
2042                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2043                    inner_depth.increment()?;
2044                }
2045                let val_ref = self.url.get_or_insert_with(|| {
2046                    fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
2047                });
2048                fidl::decode!(
2049                    fidl::encoding::BoundedString<4096>,
2050                    D,
2051                    val_ref,
2052                    decoder,
2053                    inner_offset,
2054                    inner_depth
2055                )?;
2056                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2057                {
2058                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2059                }
2060                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2061                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2062                }
2063            }
2064
2065            next_offset += envelope_size;
2066            _next_ordinal_to_read += 1;
2067            if next_offset >= end_offset {
2068                return Ok(());
2069            }
2070
2071            // Decode unknown envelopes for gaps in ordinals.
2072            while _next_ordinal_to_read < 3 {
2073                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2074                _next_ordinal_to_read += 1;
2075                next_offset += envelope_size;
2076            }
2077
2078            let next_out_of_line = decoder.next_out_of_line();
2079            let handles_before = decoder.remaining_handles();
2080            if let Some((inlined, num_bytes, num_handles)) =
2081                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2082            {
2083                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2084                if inlined != (member_inline_size <= 4) {
2085                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2086                }
2087                let inner_offset;
2088                let mut inner_depth = depth.clone();
2089                if inlined {
2090                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2091                    inner_offset = next_offset;
2092                } else {
2093                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2094                    inner_depth.increment()?;
2095                }
2096                let val_ref = self.referrer.get_or_insert_with(|| {
2097                    fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
2098                });
2099                fidl::decode!(
2100                    fidl::encoding::BoundedString<4096>,
2101                    D,
2102                    val_ref,
2103                    decoder,
2104                    inner_offset,
2105                    inner_depth
2106                )?;
2107                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2108                {
2109                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2110                }
2111                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2112                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2113                }
2114            }
2115
2116            next_offset += envelope_size;
2117
2118            // Decode the remaining unknown envelopes.
2119            while next_offset < end_offset {
2120                _next_ordinal_to_read += 1;
2121                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2122                next_offset += envelope_size;
2123            }
2124
2125            Ok(())
2126        }
2127    }
2128
2129    impl Request {
2130        #[inline(always)]
2131        fn max_ordinal_present(&self) -> u64 {
2132            if let Some(_) = self.deadline {
2133                return 5;
2134            }
2135            if let Some(_) = self.body {
2136                return 4;
2137            }
2138            if let Some(_) = self.headers {
2139                return 3;
2140            }
2141            if let Some(_) = self.url {
2142                return 2;
2143            }
2144            if let Some(_) = self.method {
2145                return 1;
2146            }
2147            0
2148        }
2149    }
2150
2151    impl fidl::encoding::ResourceTypeMarker for Request {
2152        type Borrowed<'a> = &'a mut Self;
2153        fn take_or_borrow<'a>(
2154            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2155        ) -> Self::Borrowed<'a> {
2156            value
2157        }
2158    }
2159
2160    unsafe impl fidl::encoding::TypeMarker for Request {
2161        type Owned = Self;
2162
2163        #[inline(always)]
2164        fn inline_align(_context: fidl::encoding::Context) -> usize {
2165            8
2166        }
2167
2168        #[inline(always)]
2169        fn inline_size(_context: fidl::encoding::Context) -> usize {
2170            16
2171        }
2172    }
2173
2174    unsafe impl fidl::encoding::Encode<Request, fidl::encoding::DefaultFuchsiaResourceDialect>
2175        for &mut Request
2176    {
2177        unsafe fn encode(
2178            self,
2179            encoder: &mut fidl::encoding::Encoder<
2180                '_,
2181                fidl::encoding::DefaultFuchsiaResourceDialect,
2182            >,
2183            offset: usize,
2184            mut depth: fidl::encoding::Depth,
2185        ) -> fidl::Result<()> {
2186            encoder.debug_check_bounds::<Request>(offset);
2187            // Vector header
2188            let max_ordinal: u64 = self.max_ordinal_present();
2189            encoder.write_num(max_ordinal, offset);
2190            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2191            // Calling encoder.out_of_line_offset(0) is not allowed.
2192            if max_ordinal == 0 {
2193                return Ok(());
2194            }
2195            depth.increment()?;
2196            let envelope_size = 8;
2197            let bytes_len = max_ordinal as usize * envelope_size;
2198            #[allow(unused_variables)]
2199            let offset = encoder.out_of_line_offset(bytes_len);
2200            let mut _prev_end_offset: usize = 0;
2201            if 1 > max_ordinal {
2202                return Ok(());
2203            }
2204
2205            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2206            // are envelope_size bytes.
2207            let cur_offset: usize = (1 - 1) * envelope_size;
2208
2209            // Zero reserved fields.
2210            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2211
2212            // Safety:
2213            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2214            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2215            //   envelope_size bytes, there is always sufficient room.
2216            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2217            self.method.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
2218            encoder, offset + cur_offset, depth
2219        )?;
2220
2221            _prev_end_offset = cur_offset + envelope_size;
2222            if 2 > max_ordinal {
2223                return Ok(());
2224            }
2225
2226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2227            // are envelope_size bytes.
2228            let cur_offset: usize = (2 - 1) * envelope_size;
2229
2230            // Zero reserved fields.
2231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2232
2233            // Safety:
2234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2236            //   envelope_size bytes, there is always sufficient room.
2237            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2238            self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2239            encoder, offset + cur_offset, depth
2240        )?;
2241
2242            _prev_end_offset = cur_offset + envelope_size;
2243            if 3 > max_ordinal {
2244                return Ok(());
2245            }
2246
2247            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2248            // are envelope_size bytes.
2249            let cur_offset: usize = (3 - 1) * envelope_size;
2250
2251            // Zero reserved fields.
2252            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2253
2254            // Safety:
2255            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2256            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2257            //   envelope_size bytes, there is always sufficient room.
2258            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2259            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<Header> as fidl::encoding::ValueTypeMarker>::borrow),
2260            encoder, offset + cur_offset, depth
2261        )?;
2262
2263            _prev_end_offset = cur_offset + envelope_size;
2264            if 4 > max_ordinal {
2265                return Ok(());
2266            }
2267
2268            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2269            // are envelope_size bytes.
2270            let cur_offset: usize = (4 - 1) * envelope_size;
2271
2272            // Zero reserved fields.
2273            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2274
2275            // Safety:
2276            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2277            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2278            //   envelope_size bytes, there is always sufficient room.
2279            fidl::encoding::encode_in_envelope_optional::<
2280                Body,
2281                fidl::encoding::DefaultFuchsiaResourceDialect,
2282            >(
2283                self.body
2284                    .as_mut()
2285                    .map(<Body as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2286                encoder,
2287                offset + cur_offset,
2288                depth,
2289            )?;
2290
2291            _prev_end_offset = cur_offset + envelope_size;
2292            if 5 > max_ordinal {
2293                return Ok(());
2294            }
2295
2296            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2297            // are envelope_size bytes.
2298            let cur_offset: usize = (5 - 1) * envelope_size;
2299
2300            // Zero reserved fields.
2301            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2302
2303            // Safety:
2304            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2305            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2306            //   envelope_size bytes, there is always sufficient room.
2307            fidl::encoding::encode_in_envelope_optional::<
2308                i64,
2309                fidl::encoding::DefaultFuchsiaResourceDialect,
2310            >(
2311                self.deadline.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2312                encoder,
2313                offset + cur_offset,
2314                depth,
2315            )?;
2316
2317            _prev_end_offset = cur_offset + envelope_size;
2318
2319            Ok(())
2320        }
2321    }
2322
2323    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Request {
2324        #[inline(always)]
2325        fn new_empty() -> Self {
2326            Self::default()
2327        }
2328
2329        unsafe fn decode(
2330            &mut self,
2331            decoder: &mut fidl::encoding::Decoder<
2332                '_,
2333                fidl::encoding::DefaultFuchsiaResourceDialect,
2334            >,
2335            offset: usize,
2336            mut depth: fidl::encoding::Depth,
2337        ) -> fidl::Result<()> {
2338            decoder.debug_check_bounds::<Self>(offset);
2339            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2340                None => return Err(fidl::Error::NotNullable),
2341                Some(len) => len,
2342            };
2343            // Calling decoder.out_of_line_offset(0) is not allowed.
2344            if len == 0 {
2345                return Ok(());
2346            };
2347            depth.increment()?;
2348            let envelope_size = 8;
2349            let bytes_len = len * envelope_size;
2350            let offset = decoder.out_of_line_offset(bytes_len)?;
2351            // Decode the envelope for each type.
2352            let mut _next_ordinal_to_read = 0;
2353            let mut next_offset = offset;
2354            let end_offset = offset + bytes_len;
2355            _next_ordinal_to_read += 1;
2356            if next_offset >= end_offset {
2357                return Ok(());
2358            }
2359
2360            // Decode unknown envelopes for gaps in ordinals.
2361            while _next_ordinal_to_read < 1 {
2362                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2363                _next_ordinal_to_read += 1;
2364                next_offset += envelope_size;
2365            }
2366
2367            let next_out_of_line = decoder.next_out_of_line();
2368            let handles_before = decoder.remaining_handles();
2369            if let Some((inlined, num_bytes, num_handles)) =
2370                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2371            {
2372                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2373                if inlined != (member_inline_size <= 4) {
2374                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2375                }
2376                let inner_offset;
2377                let mut inner_depth = depth.clone();
2378                if inlined {
2379                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2380                    inner_offset = next_offset;
2381                } else {
2382                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2383                    inner_depth.increment()?;
2384                }
2385                let val_ref = self.method.get_or_insert_with(|| {
2386                    fidl::new_empty!(
2387                        fidl::encoding::BoundedString<1024>,
2388                        fidl::encoding::DefaultFuchsiaResourceDialect
2389                    )
2390                });
2391                fidl::decode!(
2392                    fidl::encoding::BoundedString<1024>,
2393                    fidl::encoding::DefaultFuchsiaResourceDialect,
2394                    val_ref,
2395                    decoder,
2396                    inner_offset,
2397                    inner_depth
2398                )?;
2399                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2400                {
2401                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2402                }
2403                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2404                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2405                }
2406            }
2407
2408            next_offset += envelope_size;
2409            _next_ordinal_to_read += 1;
2410            if next_offset >= end_offset {
2411                return Ok(());
2412            }
2413
2414            // Decode unknown envelopes for gaps in ordinals.
2415            while _next_ordinal_to_read < 2 {
2416                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2417                _next_ordinal_to_read += 1;
2418                next_offset += envelope_size;
2419            }
2420
2421            let next_out_of_line = decoder.next_out_of_line();
2422            let handles_before = decoder.remaining_handles();
2423            if let Some((inlined, num_bytes, num_handles)) =
2424                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2425            {
2426                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2427                if inlined != (member_inline_size <= 4) {
2428                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2429                }
2430                let inner_offset;
2431                let mut inner_depth = depth.clone();
2432                if inlined {
2433                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2434                    inner_offset = next_offset;
2435                } else {
2436                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2437                    inner_depth.increment()?;
2438                }
2439                let val_ref = self.url.get_or_insert_with(|| {
2440                    fidl::new_empty!(
2441                        fidl::encoding::BoundedString<4096>,
2442                        fidl::encoding::DefaultFuchsiaResourceDialect
2443                    )
2444                });
2445                fidl::decode!(
2446                    fidl::encoding::BoundedString<4096>,
2447                    fidl::encoding::DefaultFuchsiaResourceDialect,
2448                    val_ref,
2449                    decoder,
2450                    inner_offset,
2451                    inner_depth
2452                )?;
2453                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2454                {
2455                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2456                }
2457                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2458                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2459                }
2460            }
2461
2462            next_offset += envelope_size;
2463            _next_ordinal_to_read += 1;
2464            if next_offset >= end_offset {
2465                return Ok(());
2466            }
2467
2468            // Decode unknown envelopes for gaps in ordinals.
2469            while _next_ordinal_to_read < 3 {
2470                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2471                _next_ordinal_to_read += 1;
2472                next_offset += envelope_size;
2473            }
2474
2475            let next_out_of_line = decoder.next_out_of_line();
2476            let handles_before = decoder.remaining_handles();
2477            if let Some((inlined, num_bytes, num_handles)) =
2478                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2479            {
2480                let member_inline_size = <fidl::encoding::UnboundedVector<Header> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2481                if inlined != (member_inline_size <= 4) {
2482                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2483                }
2484                let inner_offset;
2485                let mut inner_depth = depth.clone();
2486                if inlined {
2487                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2488                    inner_offset = next_offset;
2489                } else {
2490                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2491                    inner_depth.increment()?;
2492                }
2493                let val_ref = self.headers.get_or_insert_with(|| {
2494                    fidl::new_empty!(
2495                        fidl::encoding::UnboundedVector<Header>,
2496                        fidl::encoding::DefaultFuchsiaResourceDialect
2497                    )
2498                });
2499                fidl::decode!(
2500                    fidl::encoding::UnboundedVector<Header>,
2501                    fidl::encoding::DefaultFuchsiaResourceDialect,
2502                    val_ref,
2503                    decoder,
2504                    inner_offset,
2505                    inner_depth
2506                )?;
2507                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2508                {
2509                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2510                }
2511                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2512                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2513                }
2514            }
2515
2516            next_offset += envelope_size;
2517            _next_ordinal_to_read += 1;
2518            if next_offset >= end_offset {
2519                return Ok(());
2520            }
2521
2522            // Decode unknown envelopes for gaps in ordinals.
2523            while _next_ordinal_to_read < 4 {
2524                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2525                _next_ordinal_to_read += 1;
2526                next_offset += envelope_size;
2527            }
2528
2529            let next_out_of_line = decoder.next_out_of_line();
2530            let handles_before = decoder.remaining_handles();
2531            if let Some((inlined, num_bytes, num_handles)) =
2532                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2533            {
2534                let member_inline_size =
2535                    <Body as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2536                if inlined != (member_inline_size <= 4) {
2537                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2538                }
2539                let inner_offset;
2540                let mut inner_depth = depth.clone();
2541                if inlined {
2542                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2543                    inner_offset = next_offset;
2544                } else {
2545                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2546                    inner_depth.increment()?;
2547                }
2548                let val_ref = self.body.get_or_insert_with(|| {
2549                    fidl::new_empty!(Body, fidl::encoding::DefaultFuchsiaResourceDialect)
2550                });
2551                fidl::decode!(
2552                    Body,
2553                    fidl::encoding::DefaultFuchsiaResourceDialect,
2554                    val_ref,
2555                    decoder,
2556                    inner_offset,
2557                    inner_depth
2558                )?;
2559                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2560                {
2561                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2562                }
2563                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2564                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2565                }
2566            }
2567
2568            next_offset += envelope_size;
2569            _next_ordinal_to_read += 1;
2570            if next_offset >= end_offset {
2571                return Ok(());
2572            }
2573
2574            // Decode unknown envelopes for gaps in ordinals.
2575            while _next_ordinal_to_read < 5 {
2576                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2577                _next_ordinal_to_read += 1;
2578                next_offset += envelope_size;
2579            }
2580
2581            let next_out_of_line = decoder.next_out_of_line();
2582            let handles_before = decoder.remaining_handles();
2583            if let Some((inlined, num_bytes, num_handles)) =
2584                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2585            {
2586                let member_inline_size =
2587                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2588                if inlined != (member_inline_size <= 4) {
2589                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2590                }
2591                let inner_offset;
2592                let mut inner_depth = depth.clone();
2593                if inlined {
2594                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2595                    inner_offset = next_offset;
2596                } else {
2597                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2598                    inner_depth.increment()?;
2599                }
2600                let val_ref = self.deadline.get_or_insert_with(|| {
2601                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
2602                });
2603                fidl::decode!(
2604                    i64,
2605                    fidl::encoding::DefaultFuchsiaResourceDialect,
2606                    val_ref,
2607                    decoder,
2608                    inner_offset,
2609                    inner_depth
2610                )?;
2611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2612                {
2613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2614                }
2615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2617                }
2618            }
2619
2620            next_offset += envelope_size;
2621
2622            // Decode the remaining unknown envelopes.
2623            while next_offset < end_offset {
2624                _next_ordinal_to_read += 1;
2625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2626                next_offset += envelope_size;
2627            }
2628
2629            Ok(())
2630        }
2631    }
2632
2633    impl Response {
2634        #[inline(always)]
2635        fn max_ordinal_present(&self) -> u64 {
2636            if let Some(_) = self.redirect {
2637                return 7;
2638            }
2639            if let Some(_) = self.headers {
2640                return 6;
2641            }
2642            if let Some(_) = self.status_line {
2643                return 5;
2644            }
2645            if let Some(_) = self.status_code {
2646                return 4;
2647            }
2648            if let Some(_) = self.final_url {
2649                return 3;
2650            }
2651            if let Some(_) = self.body {
2652                return 2;
2653            }
2654            if let Some(_) = self.error {
2655                return 1;
2656            }
2657            0
2658        }
2659    }
2660
2661    impl fidl::encoding::ResourceTypeMarker for Response {
2662        type Borrowed<'a> = &'a mut Self;
2663        fn take_or_borrow<'a>(
2664            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2665        ) -> Self::Borrowed<'a> {
2666            value
2667        }
2668    }
2669
2670    unsafe impl fidl::encoding::TypeMarker for Response {
2671        type Owned = Self;
2672
2673        #[inline(always)]
2674        fn inline_align(_context: fidl::encoding::Context) -> usize {
2675            8
2676        }
2677
2678        #[inline(always)]
2679        fn inline_size(_context: fidl::encoding::Context) -> usize {
2680            16
2681        }
2682    }
2683
2684    unsafe impl fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>
2685        for &mut Response
2686    {
2687        unsafe fn encode(
2688            self,
2689            encoder: &mut fidl::encoding::Encoder<
2690                '_,
2691                fidl::encoding::DefaultFuchsiaResourceDialect,
2692            >,
2693            offset: usize,
2694            mut depth: fidl::encoding::Depth,
2695        ) -> fidl::Result<()> {
2696            encoder.debug_check_bounds::<Response>(offset);
2697            // Vector header
2698            let max_ordinal: u64 = self.max_ordinal_present();
2699            encoder.write_num(max_ordinal, offset);
2700            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2701            // Calling encoder.out_of_line_offset(0) is not allowed.
2702            if max_ordinal == 0 {
2703                return Ok(());
2704            }
2705            depth.increment()?;
2706            let envelope_size = 8;
2707            let bytes_len = max_ordinal as usize * envelope_size;
2708            #[allow(unused_variables)]
2709            let offset = encoder.out_of_line_offset(bytes_len);
2710            let mut _prev_end_offset: usize = 0;
2711            if 1 > max_ordinal {
2712                return Ok(());
2713            }
2714
2715            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2716            // are envelope_size bytes.
2717            let cur_offset: usize = (1 - 1) * envelope_size;
2718
2719            // Zero reserved fields.
2720            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2721
2722            // Safety:
2723            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2724            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2725            //   envelope_size bytes, there is always sufficient room.
2726            fidl::encoding::encode_in_envelope_optional::<
2727                Error,
2728                fidl::encoding::DefaultFuchsiaResourceDialect,
2729            >(
2730                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
2731                encoder,
2732                offset + cur_offset,
2733                depth,
2734            )?;
2735
2736            _prev_end_offset = cur_offset + envelope_size;
2737            if 2 > max_ordinal {
2738                return Ok(());
2739            }
2740
2741            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2742            // are envelope_size bytes.
2743            let cur_offset: usize = (2 - 1) * envelope_size;
2744
2745            // Zero reserved fields.
2746            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2747
2748            // Safety:
2749            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2750            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2751            //   envelope_size bytes, there is always sufficient room.
2752            fidl::encoding::encode_in_envelope_optional::<
2753                fidl::encoding::HandleType<
2754                    fidl::Socket,
2755                    { fidl::ObjectType::SOCKET.into_raw() },
2756                    2147483648,
2757                >,
2758                fidl::encoding::DefaultFuchsiaResourceDialect,
2759            >(
2760                self.body.as_mut().map(
2761                    <fidl::encoding::HandleType<
2762                        fidl::Socket,
2763                        { fidl::ObjectType::SOCKET.into_raw() },
2764                        2147483648,
2765                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2766                ),
2767                encoder,
2768                offset + cur_offset,
2769                depth,
2770            )?;
2771
2772            _prev_end_offset = cur_offset + envelope_size;
2773            if 3 > max_ordinal {
2774                return Ok(());
2775            }
2776
2777            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2778            // are envelope_size bytes.
2779            let cur_offset: usize = (3 - 1) * envelope_size;
2780
2781            // Zero reserved fields.
2782            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2783
2784            // Safety:
2785            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2786            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2787            //   envelope_size bytes, there is always sufficient room.
2788            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2789            self.final_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2790            encoder, offset + cur_offset, depth
2791        )?;
2792
2793            _prev_end_offset = cur_offset + envelope_size;
2794            if 4 > max_ordinal {
2795                return Ok(());
2796            }
2797
2798            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2799            // are envelope_size bytes.
2800            let cur_offset: usize = (4 - 1) * envelope_size;
2801
2802            // Zero reserved fields.
2803            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2804
2805            // Safety:
2806            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2807            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2808            //   envelope_size bytes, there is always sufficient room.
2809            fidl::encoding::encode_in_envelope_optional::<
2810                u32,
2811                fidl::encoding::DefaultFuchsiaResourceDialect,
2812            >(
2813                self.status_code.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2814                encoder,
2815                offset + cur_offset,
2816                depth,
2817            )?;
2818
2819            _prev_end_offset = cur_offset + envelope_size;
2820            if 5 > max_ordinal {
2821                return Ok(());
2822            }
2823
2824            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2825            // are envelope_size bytes.
2826            let cur_offset: usize = (5 - 1) * envelope_size;
2827
2828            // Zero reserved fields.
2829            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2830
2831            // Safety:
2832            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2833            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2834            //   envelope_size bytes, there is always sufficient room.
2835            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2836            self.status_line.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
2837            encoder, offset + cur_offset, depth
2838        )?;
2839
2840            _prev_end_offset = cur_offset + envelope_size;
2841            if 6 > max_ordinal {
2842                return Ok(());
2843            }
2844
2845            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2846            // are envelope_size bytes.
2847            let cur_offset: usize = (6 - 1) * envelope_size;
2848
2849            // Zero reserved fields.
2850            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2851
2852            // Safety:
2853            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2854            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2855            //   envelope_size bytes, there is always sufficient room.
2856            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2857            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<Header> as fidl::encoding::ValueTypeMarker>::borrow),
2858            encoder, offset + cur_offset, depth
2859        )?;
2860
2861            _prev_end_offset = cur_offset + envelope_size;
2862            if 7 > max_ordinal {
2863                return Ok(());
2864            }
2865
2866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2867            // are envelope_size bytes.
2868            let cur_offset: usize = (7 - 1) * envelope_size;
2869
2870            // Zero reserved fields.
2871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2872
2873            // Safety:
2874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2876            //   envelope_size bytes, there is always sufficient room.
2877            fidl::encoding::encode_in_envelope_optional::<
2878                RedirectTarget,
2879                fidl::encoding::DefaultFuchsiaResourceDialect,
2880            >(
2881                self.redirect
2882                    .as_ref()
2883                    .map(<RedirectTarget as fidl::encoding::ValueTypeMarker>::borrow),
2884                encoder,
2885                offset + cur_offset,
2886                depth,
2887            )?;
2888
2889            _prev_end_offset = cur_offset + envelope_size;
2890
2891            Ok(())
2892        }
2893    }
2894
2895    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Response {
2896        #[inline(always)]
2897        fn new_empty() -> Self {
2898            Self::default()
2899        }
2900
2901        unsafe fn decode(
2902            &mut self,
2903            decoder: &mut fidl::encoding::Decoder<
2904                '_,
2905                fidl::encoding::DefaultFuchsiaResourceDialect,
2906            >,
2907            offset: usize,
2908            mut depth: fidl::encoding::Depth,
2909        ) -> fidl::Result<()> {
2910            decoder.debug_check_bounds::<Self>(offset);
2911            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2912                None => return Err(fidl::Error::NotNullable),
2913                Some(len) => len,
2914            };
2915            // Calling decoder.out_of_line_offset(0) is not allowed.
2916            if len == 0 {
2917                return Ok(());
2918            };
2919            depth.increment()?;
2920            let envelope_size = 8;
2921            let bytes_len = len * envelope_size;
2922            let offset = decoder.out_of_line_offset(bytes_len)?;
2923            // Decode the envelope for each type.
2924            let mut _next_ordinal_to_read = 0;
2925            let mut next_offset = offset;
2926            let end_offset = offset + bytes_len;
2927            _next_ordinal_to_read += 1;
2928            if next_offset >= end_offset {
2929                return Ok(());
2930            }
2931
2932            // Decode unknown envelopes for gaps in ordinals.
2933            while _next_ordinal_to_read < 1 {
2934                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2935                _next_ordinal_to_read += 1;
2936                next_offset += envelope_size;
2937            }
2938
2939            let next_out_of_line = decoder.next_out_of_line();
2940            let handles_before = decoder.remaining_handles();
2941            if let Some((inlined, num_bytes, num_handles)) =
2942                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2943            {
2944                let member_inline_size =
2945                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2946                if inlined != (member_inline_size <= 4) {
2947                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2948                }
2949                let inner_offset;
2950                let mut inner_depth = depth.clone();
2951                if inlined {
2952                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2953                    inner_offset = next_offset;
2954                } else {
2955                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2956                    inner_depth.increment()?;
2957                }
2958                let val_ref = self.error.get_or_insert_with(|| {
2959                    fidl::new_empty!(Error, fidl::encoding::DefaultFuchsiaResourceDialect)
2960                });
2961                fidl::decode!(
2962                    Error,
2963                    fidl::encoding::DefaultFuchsiaResourceDialect,
2964                    val_ref,
2965                    decoder,
2966                    inner_offset,
2967                    inner_depth
2968                )?;
2969                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2970                {
2971                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2972                }
2973                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2974                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2975                }
2976            }
2977
2978            next_offset += envelope_size;
2979            _next_ordinal_to_read += 1;
2980            if next_offset >= end_offset {
2981                return Ok(());
2982            }
2983
2984            // Decode unknown envelopes for gaps in ordinals.
2985            while _next_ordinal_to_read < 2 {
2986                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2987                _next_ordinal_to_read += 1;
2988                next_offset += envelope_size;
2989            }
2990
2991            let next_out_of_line = decoder.next_out_of_line();
2992            let handles_before = decoder.remaining_handles();
2993            if let Some((inlined, num_bytes, num_handles)) =
2994                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2995            {
2996                let member_inline_size = <fidl::encoding::HandleType<
2997                    fidl::Socket,
2998                    { fidl::ObjectType::SOCKET.into_raw() },
2999                    2147483648,
3000                > as fidl::encoding::TypeMarker>::inline_size(
3001                    decoder.context
3002                );
3003                if inlined != (member_inline_size <= 4) {
3004                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3005                }
3006                let inner_offset;
3007                let mut inner_depth = depth.clone();
3008                if inlined {
3009                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3010                    inner_offset = next_offset;
3011                } else {
3012                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3013                    inner_depth.increment()?;
3014                }
3015                let val_ref =
3016                self.body.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3017                fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3018                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3019                {
3020                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3021                }
3022                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3023                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3024                }
3025            }
3026
3027            next_offset += envelope_size;
3028            _next_ordinal_to_read += 1;
3029            if next_offset >= end_offset {
3030                return Ok(());
3031            }
3032
3033            // Decode unknown envelopes for gaps in ordinals.
3034            while _next_ordinal_to_read < 3 {
3035                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3036                _next_ordinal_to_read += 1;
3037                next_offset += envelope_size;
3038            }
3039
3040            let next_out_of_line = decoder.next_out_of_line();
3041            let handles_before = decoder.remaining_handles();
3042            if let Some((inlined, num_bytes, num_handles)) =
3043                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3044            {
3045                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3046                if inlined != (member_inline_size <= 4) {
3047                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3048                }
3049                let inner_offset;
3050                let mut inner_depth = depth.clone();
3051                if inlined {
3052                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3053                    inner_offset = next_offset;
3054                } else {
3055                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3056                    inner_depth.increment()?;
3057                }
3058                let val_ref = self.final_url.get_or_insert_with(|| {
3059                    fidl::new_empty!(
3060                        fidl::encoding::BoundedString<4096>,
3061                        fidl::encoding::DefaultFuchsiaResourceDialect
3062                    )
3063                });
3064                fidl::decode!(
3065                    fidl::encoding::BoundedString<4096>,
3066                    fidl::encoding::DefaultFuchsiaResourceDialect,
3067                    val_ref,
3068                    decoder,
3069                    inner_offset,
3070                    inner_depth
3071                )?;
3072                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3073                {
3074                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3075                }
3076                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3077                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3078                }
3079            }
3080
3081            next_offset += envelope_size;
3082            _next_ordinal_to_read += 1;
3083            if next_offset >= end_offset {
3084                return Ok(());
3085            }
3086
3087            // Decode unknown envelopes for gaps in ordinals.
3088            while _next_ordinal_to_read < 4 {
3089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3090                _next_ordinal_to_read += 1;
3091                next_offset += envelope_size;
3092            }
3093
3094            let next_out_of_line = decoder.next_out_of_line();
3095            let handles_before = decoder.remaining_handles();
3096            if let Some((inlined, num_bytes, num_handles)) =
3097                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3098            {
3099                let member_inline_size =
3100                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3101                if inlined != (member_inline_size <= 4) {
3102                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3103                }
3104                let inner_offset;
3105                let mut inner_depth = depth.clone();
3106                if inlined {
3107                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3108                    inner_offset = next_offset;
3109                } else {
3110                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3111                    inner_depth.increment()?;
3112                }
3113                let val_ref = self.status_code.get_or_insert_with(|| {
3114                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
3115                });
3116                fidl::decode!(
3117                    u32,
3118                    fidl::encoding::DefaultFuchsiaResourceDialect,
3119                    val_ref,
3120                    decoder,
3121                    inner_offset,
3122                    inner_depth
3123                )?;
3124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3125                {
3126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3127                }
3128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3130                }
3131            }
3132
3133            next_offset += envelope_size;
3134            _next_ordinal_to_read += 1;
3135            if next_offset >= end_offset {
3136                return Ok(());
3137            }
3138
3139            // Decode unknown envelopes for gaps in ordinals.
3140            while _next_ordinal_to_read < 5 {
3141                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3142                _next_ordinal_to_read += 1;
3143                next_offset += envelope_size;
3144            }
3145
3146            let next_out_of_line = decoder.next_out_of_line();
3147            let handles_before = decoder.remaining_handles();
3148            if let Some((inlined, num_bytes, num_handles)) =
3149                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3150            {
3151                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3152                if inlined != (member_inline_size <= 4) {
3153                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3154                }
3155                let inner_offset;
3156                let mut inner_depth = depth.clone();
3157                if inlined {
3158                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3159                    inner_offset = next_offset;
3160                } else {
3161                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3162                    inner_depth.increment()?;
3163                }
3164                let val_ref = self.status_line.get_or_insert_with(|| {
3165                    fidl::new_empty!(
3166                        fidl::encoding::UnboundedVector<u8>,
3167                        fidl::encoding::DefaultFuchsiaResourceDialect
3168                    )
3169                });
3170                fidl::decode!(
3171                    fidl::encoding::UnboundedVector<u8>,
3172                    fidl::encoding::DefaultFuchsiaResourceDialect,
3173                    val_ref,
3174                    decoder,
3175                    inner_offset,
3176                    inner_depth
3177                )?;
3178                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3179                {
3180                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3181                }
3182                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3183                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3184                }
3185            }
3186
3187            next_offset += envelope_size;
3188            _next_ordinal_to_read += 1;
3189            if next_offset >= end_offset {
3190                return Ok(());
3191            }
3192
3193            // Decode unknown envelopes for gaps in ordinals.
3194            while _next_ordinal_to_read < 6 {
3195                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3196                _next_ordinal_to_read += 1;
3197                next_offset += envelope_size;
3198            }
3199
3200            let next_out_of_line = decoder.next_out_of_line();
3201            let handles_before = decoder.remaining_handles();
3202            if let Some((inlined, num_bytes, num_handles)) =
3203                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3204            {
3205                let member_inline_size = <fidl::encoding::UnboundedVector<Header> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3206                if inlined != (member_inline_size <= 4) {
3207                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3208                }
3209                let inner_offset;
3210                let mut inner_depth = depth.clone();
3211                if inlined {
3212                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3213                    inner_offset = next_offset;
3214                } else {
3215                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3216                    inner_depth.increment()?;
3217                }
3218                let val_ref = self.headers.get_or_insert_with(|| {
3219                    fidl::new_empty!(
3220                        fidl::encoding::UnboundedVector<Header>,
3221                        fidl::encoding::DefaultFuchsiaResourceDialect
3222                    )
3223                });
3224                fidl::decode!(
3225                    fidl::encoding::UnboundedVector<Header>,
3226                    fidl::encoding::DefaultFuchsiaResourceDialect,
3227                    val_ref,
3228                    decoder,
3229                    inner_offset,
3230                    inner_depth
3231                )?;
3232                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3233                {
3234                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3235                }
3236                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3237                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3238                }
3239            }
3240
3241            next_offset += envelope_size;
3242            _next_ordinal_to_read += 1;
3243            if next_offset >= end_offset {
3244                return Ok(());
3245            }
3246
3247            // Decode unknown envelopes for gaps in ordinals.
3248            while _next_ordinal_to_read < 7 {
3249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3250                _next_ordinal_to_read += 1;
3251                next_offset += envelope_size;
3252            }
3253
3254            let next_out_of_line = decoder.next_out_of_line();
3255            let handles_before = decoder.remaining_handles();
3256            if let Some((inlined, num_bytes, num_handles)) =
3257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3258            {
3259                let member_inline_size =
3260                    <RedirectTarget as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3261                if inlined != (member_inline_size <= 4) {
3262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3263                }
3264                let inner_offset;
3265                let mut inner_depth = depth.clone();
3266                if inlined {
3267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3268                    inner_offset = next_offset;
3269                } else {
3270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3271                    inner_depth.increment()?;
3272                }
3273                let val_ref = self.redirect.get_or_insert_with(|| {
3274                    fidl::new_empty!(RedirectTarget, fidl::encoding::DefaultFuchsiaResourceDialect)
3275                });
3276                fidl::decode!(
3277                    RedirectTarget,
3278                    fidl::encoding::DefaultFuchsiaResourceDialect,
3279                    val_ref,
3280                    decoder,
3281                    inner_offset,
3282                    inner_depth
3283                )?;
3284                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3285                {
3286                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3287                }
3288                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3289                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3290                }
3291            }
3292
3293            next_offset += envelope_size;
3294
3295            // Decode the remaining unknown envelopes.
3296            while next_offset < end_offset {
3297                _next_ordinal_to_read += 1;
3298                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3299                next_offset += envelope_size;
3300            }
3301
3302            Ok(())
3303        }
3304    }
3305
3306    impl fidl::encoding::ResourceTypeMarker for Body {
3307        type Borrowed<'a> = &'a mut Self;
3308        fn take_or_borrow<'a>(
3309            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3310        ) -> Self::Borrowed<'a> {
3311            value
3312        }
3313    }
3314
3315    unsafe impl fidl::encoding::TypeMarker for Body {
3316        type Owned = Self;
3317
3318        #[inline(always)]
3319        fn inline_align(_context: fidl::encoding::Context) -> usize {
3320            8
3321        }
3322
3323        #[inline(always)]
3324        fn inline_size(_context: fidl::encoding::Context) -> usize {
3325            16
3326        }
3327    }
3328
3329    unsafe impl fidl::encoding::Encode<Body, fidl::encoding::DefaultFuchsiaResourceDialect>
3330        for &mut Body
3331    {
3332        #[inline]
3333        unsafe fn encode(
3334            self,
3335            encoder: &mut fidl::encoding::Encoder<
3336                '_,
3337                fidl::encoding::DefaultFuchsiaResourceDialect,
3338            >,
3339            offset: usize,
3340            _depth: fidl::encoding::Depth,
3341        ) -> fidl::Result<()> {
3342            encoder.debug_check_bounds::<Body>(offset);
3343            encoder.write_num::<u64>(self.ordinal(), offset);
3344            match self {
3345            Body::Buffer(ref mut val) => {
3346                fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3347                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3348                    encoder, offset + 8, _depth
3349                )
3350            }
3351            Body::Stream(ref mut val) => {
3352                fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3353                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3354                    encoder, offset + 8, _depth
3355                )
3356            }
3357        }
3358        }
3359    }
3360
3361    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Body {
3362        #[inline(always)]
3363        fn new_empty() -> Self {
3364            Self::Buffer(fidl::new_empty!(
3365                fidl_fuchsia_mem::Buffer,
3366                fidl::encoding::DefaultFuchsiaResourceDialect
3367            ))
3368        }
3369
3370        #[inline]
3371        unsafe fn decode(
3372            &mut self,
3373            decoder: &mut fidl::encoding::Decoder<
3374                '_,
3375                fidl::encoding::DefaultFuchsiaResourceDialect,
3376            >,
3377            offset: usize,
3378            mut depth: fidl::encoding::Depth,
3379        ) -> fidl::Result<()> {
3380            decoder.debug_check_bounds::<Self>(offset);
3381            #[allow(unused_variables)]
3382            let next_out_of_line = decoder.next_out_of_line();
3383            let handles_before = decoder.remaining_handles();
3384            let (ordinal, inlined, num_bytes, num_handles) =
3385                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3386
3387            let member_inline_size = match ordinal {
3388                1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3389                    decoder.context,
3390                ),
3391                2 => <fidl::encoding::HandleType<
3392                    fidl::Socket,
3393                    { fidl::ObjectType::SOCKET.into_raw() },
3394                    2147483648,
3395                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3396                _ => return Err(fidl::Error::UnknownUnionTag),
3397            };
3398
3399            if inlined != (member_inline_size <= 4) {
3400                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3401            }
3402            let _inner_offset;
3403            if inlined {
3404                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3405                _inner_offset = offset + 8;
3406            } else {
3407                depth.increment()?;
3408                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3409            }
3410            match ordinal {
3411                1 => {
3412                    #[allow(irrefutable_let_patterns)]
3413                    if let Body::Buffer(_) = self {
3414                        // Do nothing, read the value into the object
3415                    } else {
3416                        // Initialize `self` to the right variant
3417                        *self = Body::Buffer(fidl::new_empty!(
3418                            fidl_fuchsia_mem::Buffer,
3419                            fidl::encoding::DefaultFuchsiaResourceDialect
3420                        ));
3421                    }
3422                    #[allow(irrefutable_let_patterns)]
3423                    if let Body::Buffer(ref mut val) = self {
3424                        fidl::decode!(
3425                            fidl_fuchsia_mem::Buffer,
3426                            fidl::encoding::DefaultFuchsiaResourceDialect,
3427                            val,
3428                            decoder,
3429                            _inner_offset,
3430                            depth
3431                        )?;
3432                    } else {
3433                        unreachable!()
3434                    }
3435                }
3436                2 => {
3437                    #[allow(irrefutable_let_patterns)]
3438                    if let Body::Stream(_) = self {
3439                        // Do nothing, read the value into the object
3440                    } else {
3441                        // Initialize `self` to the right variant
3442                        *self = Body::Stream(
3443                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3444                        );
3445                    }
3446                    #[allow(irrefutable_let_patterns)]
3447                    if let Body::Stream(ref mut val) = self {
3448                        fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3449                    } else {
3450                        unreachable!()
3451                    }
3452                }
3453                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3454            }
3455            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3456                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3457            }
3458            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3459                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3460            }
3461            Ok(())
3462        }
3463    }
3464}