1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_net_http_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct LoaderClientOnResponseRequest {
16 pub response: Response,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for LoaderClientOnResponseRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct LoaderFetchRequest {
26 pub request: Request,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderFetchRequest {}
30
31#[derive(Debug, PartialEq)]
32pub struct LoaderFetchResponse {
33 pub response: Response,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderFetchResponse {}
37
38#[derive(Debug, PartialEq)]
39pub struct LoaderStartRequest {
40 pub request: Request,
41 pub client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderStartRequest {}
45
46#[derive(Debug, Default, PartialEq)]
48pub struct Request {
49 pub method: Option<String>,
53 pub url: Option<String>,
57 pub headers: Option<Vec<Header>>,
59 pub body: Option<Body>,
63 pub deadline: Option<i64>,
66 #[doc(hidden)]
67 pub __source_breaking: fidl::marker::SourceBreaking,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Request {}
71
72#[derive(Debug, Default, PartialEq)]
74pub struct Response {
75 pub error: Option<Error>,
78 pub body: Option<fidl::Socket>,
80 pub final_url: Option<String>,
82 pub status_code: Option<u32>,
84 pub status_line: Option<Vec<u8>>,
86 pub headers: Option<Vec<Header>>,
88 pub redirect: Option<RedirectTarget>,
90 #[doc(hidden)]
91 pub __source_breaking: fidl::marker::SourceBreaking,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Response {}
95
96#[derive(Debug, PartialEq)]
98pub enum Body {
99 Buffer(fidl_fuchsia_mem::Buffer),
101 Stream(fidl::Socket),
103}
104
105impl Body {
106 #[inline]
107 pub fn ordinal(&self) -> u64 {
108 match *self {
109 Self::Buffer(_) => 1,
110 Self::Stream(_) => 2,
111 }
112 }
113
114 #[deprecated = "Strict unions should not use `is_unknown`"]
115 #[inline]
116 pub fn is_unknown(&self) -> bool {
117 false
118 }
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Body {}
122
123#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
124pub struct LoaderMarker;
125
126impl fidl::endpoints::ProtocolMarker for LoaderMarker {
127 type Proxy = LoaderProxy;
128 type RequestStream = LoaderRequestStream;
129 #[cfg(target_os = "fuchsia")]
130 type SynchronousProxy = LoaderSynchronousProxy;
131
132 const DEBUG_NAME: &'static str = "fuchsia.net.http.Loader";
133}
134impl fidl::endpoints::DiscoverableProtocolMarker for LoaderMarker {}
135
136pub trait LoaderProxyInterface: Send + Sync {
137 type FetchResponseFut: std::future::Future<Output = Result<Response, fidl::Error>> + Send;
138 fn r#fetch(&self, request: Request) -> Self::FetchResponseFut;
139 fn r#start(
140 &self,
141 request: Request,
142 client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
143 ) -> Result<(), fidl::Error>;
144}
145#[derive(Debug)]
146#[cfg(target_os = "fuchsia")]
147pub struct LoaderSynchronousProxy {
148 client: fidl::client::sync::Client,
149}
150
151#[cfg(target_os = "fuchsia")]
152impl fidl::endpoints::SynchronousProxy for LoaderSynchronousProxy {
153 type Proxy = LoaderProxy;
154 type Protocol = LoaderMarker;
155
156 fn from_channel(inner: fidl::Channel) -> Self {
157 Self::new(inner)
158 }
159
160 fn into_channel(self) -> fidl::Channel {
161 self.client.into_channel()
162 }
163
164 fn as_channel(&self) -> &fidl::Channel {
165 self.client.as_channel()
166 }
167}
168
169#[cfg(target_os = "fuchsia")]
170impl LoaderSynchronousProxy {
171 pub fn new(channel: fidl::Channel) -> Self {
172 let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
173 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
174 }
175
176 pub fn into_channel(self) -> fidl::Channel {
177 self.client.into_channel()
178 }
179
180 pub fn wait_for_event(
183 &self,
184 deadline: zx::MonotonicInstant,
185 ) -> Result<LoaderEvent, fidl::Error> {
186 LoaderEvent::decode(self.client.wait_for_event(deadline)?)
187 }
188
189 pub fn r#fetch(
196 &self,
197 mut request: Request,
198 ___deadline: zx::MonotonicInstant,
199 ) -> Result<Response, fidl::Error> {
200 let _response = self.client.send_query::<LoaderFetchRequest, LoaderFetchResponse>(
201 (&mut request,),
202 0x66d973be70dc2029,
203 fidl::encoding::DynamicFlags::empty(),
204 ___deadline,
205 )?;
206 Ok(_response.response)
207 }
208
209 pub fn r#start(
216 &self,
217 mut request: Request,
218 mut client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
219 ) -> Result<(), fidl::Error> {
220 self.client.send::<LoaderStartRequest>(
221 (&mut request, client),
222 0x7165335e1d7dd48e,
223 fidl::encoding::DynamicFlags::empty(),
224 )
225 }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl From<LoaderSynchronousProxy> for zx::Handle {
230 fn from(value: LoaderSynchronousProxy) -> Self {
231 value.into_channel().into()
232 }
233}
234
235#[cfg(target_os = "fuchsia")]
236impl From<fidl::Channel> for LoaderSynchronousProxy {
237 fn from(value: fidl::Channel) -> Self {
238 Self::new(value)
239 }
240}
241
242#[derive(Debug, Clone)]
243pub struct LoaderProxy {
244 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
245}
246
247impl fidl::endpoints::Proxy for LoaderProxy {
248 type Protocol = LoaderMarker;
249
250 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
251 Self::new(inner)
252 }
253
254 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
255 self.client.into_channel().map_err(|client| Self { client })
256 }
257
258 fn as_channel(&self) -> &::fidl::AsyncChannel {
259 self.client.as_channel()
260 }
261}
262
263impl LoaderProxy {
264 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
266 let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
267 Self { client: fidl::client::Client::new(channel, protocol_name) }
268 }
269
270 pub fn take_event_stream(&self) -> LoaderEventStream {
276 LoaderEventStream { event_receiver: self.client.take_event_receiver() }
277 }
278
279 pub fn r#fetch(
286 &self,
287 mut request: Request,
288 ) -> fidl::client::QueryResponseFut<Response, fidl::encoding::DefaultFuchsiaResourceDialect>
289 {
290 LoaderProxyInterface::r#fetch(self, request)
291 }
292
293 pub fn r#start(
300 &self,
301 mut request: Request,
302 mut client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
303 ) -> Result<(), fidl::Error> {
304 LoaderProxyInterface::r#start(self, request, client)
305 }
306}
307
308impl LoaderProxyInterface for LoaderProxy {
309 type FetchResponseFut =
310 fidl::client::QueryResponseFut<Response, fidl::encoding::DefaultFuchsiaResourceDialect>;
311 fn r#fetch(&self, mut request: Request) -> Self::FetchResponseFut {
312 fn _decode(
313 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
314 ) -> Result<Response, fidl::Error> {
315 let _response = fidl::client::decode_transaction_body::<
316 LoaderFetchResponse,
317 fidl::encoding::DefaultFuchsiaResourceDialect,
318 0x66d973be70dc2029,
319 >(_buf?)?;
320 Ok(_response.response)
321 }
322 self.client.send_query_and_decode::<LoaderFetchRequest, Response>(
323 (&mut request,),
324 0x66d973be70dc2029,
325 fidl::encoding::DynamicFlags::empty(),
326 _decode,
327 )
328 }
329
330 fn r#start(
331 &self,
332 mut request: Request,
333 mut client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
334 ) -> Result<(), fidl::Error> {
335 self.client.send::<LoaderStartRequest>(
336 (&mut request, client),
337 0x7165335e1d7dd48e,
338 fidl::encoding::DynamicFlags::empty(),
339 )
340 }
341}
342
343pub struct LoaderEventStream {
344 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
345}
346
347impl std::marker::Unpin for LoaderEventStream {}
348
349impl futures::stream::FusedStream for LoaderEventStream {
350 fn is_terminated(&self) -> bool {
351 self.event_receiver.is_terminated()
352 }
353}
354
355impl futures::Stream for LoaderEventStream {
356 type Item = Result<LoaderEvent, fidl::Error>;
357
358 fn poll_next(
359 mut self: std::pin::Pin<&mut Self>,
360 cx: &mut std::task::Context<'_>,
361 ) -> std::task::Poll<Option<Self::Item>> {
362 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
363 &mut self.event_receiver,
364 cx
365 )?) {
366 Some(buf) => std::task::Poll::Ready(Some(LoaderEvent::decode(buf))),
367 None => std::task::Poll::Ready(None),
368 }
369 }
370}
371
372#[derive(Debug)]
373pub enum LoaderEvent {}
374
375impl LoaderEvent {
376 fn decode(
378 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
379 ) -> Result<LoaderEvent, fidl::Error> {
380 let (bytes, _handles) = buf.split_mut();
381 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
382 debug_assert_eq!(tx_header.tx_id, 0);
383 match tx_header.ordinal {
384 _ => Err(fidl::Error::UnknownOrdinal {
385 ordinal: tx_header.ordinal,
386 protocol_name: <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
387 }),
388 }
389 }
390}
391
392pub struct LoaderRequestStream {
394 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
395 is_terminated: bool,
396}
397
398impl std::marker::Unpin for LoaderRequestStream {}
399
400impl futures::stream::FusedStream for LoaderRequestStream {
401 fn is_terminated(&self) -> bool {
402 self.is_terminated
403 }
404}
405
406impl fidl::endpoints::RequestStream for LoaderRequestStream {
407 type Protocol = LoaderMarker;
408 type ControlHandle = LoaderControlHandle;
409
410 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
411 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
412 }
413
414 fn control_handle(&self) -> Self::ControlHandle {
415 LoaderControlHandle { inner: self.inner.clone() }
416 }
417
418 fn into_inner(
419 self,
420 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
421 {
422 (self.inner, self.is_terminated)
423 }
424
425 fn from_inner(
426 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
427 is_terminated: bool,
428 ) -> Self {
429 Self { inner, is_terminated }
430 }
431}
432
433impl futures::Stream for LoaderRequestStream {
434 type Item = Result<LoaderRequest, fidl::Error>;
435
436 fn poll_next(
437 mut self: std::pin::Pin<&mut Self>,
438 cx: &mut std::task::Context<'_>,
439 ) -> std::task::Poll<Option<Self::Item>> {
440 let this = &mut *self;
441 if this.inner.check_shutdown(cx) {
442 this.is_terminated = true;
443 return std::task::Poll::Ready(None);
444 }
445 if this.is_terminated {
446 panic!("polled LoaderRequestStream after completion");
447 }
448 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
449 |bytes, handles| {
450 match this.inner.channel().read_etc(cx, bytes, handles) {
451 std::task::Poll::Ready(Ok(())) => {}
452 std::task::Poll::Pending => return std::task::Poll::Pending,
453 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
454 this.is_terminated = true;
455 return std::task::Poll::Ready(None);
456 }
457 std::task::Poll::Ready(Err(e)) => {
458 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
459 e.into(),
460 ))))
461 }
462 }
463
464 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
466
467 std::task::Poll::Ready(Some(match header.ordinal {
468 0x66d973be70dc2029 => {
469 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
470 let mut req = fidl::new_empty!(
471 LoaderFetchRequest,
472 fidl::encoding::DefaultFuchsiaResourceDialect
473 );
474 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderFetchRequest>(&header, _body_bytes, handles, &mut req)?;
475 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
476 Ok(LoaderRequest::Fetch {
477 request: req.request,
478
479 responder: LoaderFetchResponder {
480 control_handle: std::mem::ManuallyDrop::new(control_handle),
481 tx_id: header.tx_id,
482 },
483 })
484 }
485 0x7165335e1d7dd48e => {
486 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
487 let mut req = fidl::new_empty!(
488 LoaderStartRequest,
489 fidl::encoding::DefaultFuchsiaResourceDialect
490 );
491 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderStartRequest>(&header, _body_bytes, handles, &mut req)?;
492 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
493 Ok(LoaderRequest::Start {
494 request: req.request,
495 client: req.client,
496
497 control_handle,
498 })
499 }
500 _ => Err(fidl::Error::UnknownOrdinal {
501 ordinal: header.ordinal,
502 protocol_name:
503 <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
504 }),
505 }))
506 },
507 )
508 }
509}
510
511#[derive(Debug)]
517pub enum LoaderRequest {
518 Fetch { request: Request, responder: LoaderFetchResponder },
525 Start {
532 request: Request,
533 client: fidl::endpoints::ClientEnd<LoaderClientMarker>,
534 control_handle: LoaderControlHandle,
535 },
536}
537
538impl LoaderRequest {
539 #[allow(irrefutable_let_patterns)]
540 pub fn into_fetch(self) -> Option<(Request, LoaderFetchResponder)> {
541 if let LoaderRequest::Fetch { request, responder } = self {
542 Some((request, responder))
543 } else {
544 None
545 }
546 }
547
548 #[allow(irrefutable_let_patterns)]
549 pub fn into_start(
550 self,
551 ) -> Option<(Request, fidl::endpoints::ClientEnd<LoaderClientMarker>, LoaderControlHandle)>
552 {
553 if let LoaderRequest::Start { request, client, control_handle } = self {
554 Some((request, client, control_handle))
555 } else {
556 None
557 }
558 }
559
560 pub fn method_name(&self) -> &'static str {
562 match *self {
563 LoaderRequest::Fetch { .. } => "fetch",
564 LoaderRequest::Start { .. } => "start",
565 }
566 }
567}
568
569#[derive(Debug, Clone)]
570pub struct LoaderControlHandle {
571 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
572}
573
574impl fidl::endpoints::ControlHandle for LoaderControlHandle {
575 fn shutdown(&self) {
576 self.inner.shutdown()
577 }
578 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
579 self.inner.shutdown_with_epitaph(status)
580 }
581
582 fn is_closed(&self) -> bool {
583 self.inner.channel().is_closed()
584 }
585 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
586 self.inner.channel().on_closed()
587 }
588
589 #[cfg(target_os = "fuchsia")]
590 fn signal_peer(
591 &self,
592 clear_mask: zx::Signals,
593 set_mask: zx::Signals,
594 ) -> Result<(), zx_status::Status> {
595 use fidl::Peered;
596 self.inner.channel().signal_peer(clear_mask, set_mask)
597 }
598}
599
600impl LoaderControlHandle {}
601
602#[must_use = "FIDL methods require a response to be sent"]
603#[derive(Debug)]
604pub struct LoaderFetchResponder {
605 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
606 tx_id: u32,
607}
608
609impl std::ops::Drop for LoaderFetchResponder {
613 fn drop(&mut self) {
614 self.control_handle.shutdown();
615 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
617 }
618}
619
620impl fidl::endpoints::Responder for LoaderFetchResponder {
621 type ControlHandle = LoaderControlHandle;
622
623 fn control_handle(&self) -> &LoaderControlHandle {
624 &self.control_handle
625 }
626
627 fn drop_without_shutdown(mut self) {
628 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
630 std::mem::forget(self);
632 }
633}
634
635impl LoaderFetchResponder {
636 pub fn send(self, mut response: Response) -> Result<(), fidl::Error> {
640 let _result = self.send_raw(response);
641 if _result.is_err() {
642 self.control_handle.shutdown();
643 }
644 self.drop_without_shutdown();
645 _result
646 }
647
648 pub fn send_no_shutdown_on_err(self, mut response: Response) -> Result<(), fidl::Error> {
650 let _result = self.send_raw(response);
651 self.drop_without_shutdown();
652 _result
653 }
654
655 fn send_raw(&self, mut response: Response) -> Result<(), fidl::Error> {
656 self.control_handle.inner.send::<LoaderFetchResponse>(
657 (&mut response,),
658 self.tx_id,
659 0x66d973be70dc2029,
660 fidl::encoding::DynamicFlags::empty(),
661 )
662 }
663}
664
665#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
666pub struct LoaderClientMarker;
667
668impl fidl::endpoints::ProtocolMarker for LoaderClientMarker {
669 type Proxy = LoaderClientProxy;
670 type RequestStream = LoaderClientRequestStream;
671 #[cfg(target_os = "fuchsia")]
672 type SynchronousProxy = LoaderClientSynchronousProxy;
673
674 const DEBUG_NAME: &'static str = "(anonymous) LoaderClient";
675}
676
677pub trait LoaderClientProxyInterface: Send + Sync {
678 type OnResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
679 fn r#on_response(&self, response: Response) -> Self::OnResponseResponseFut;
680}
681#[derive(Debug)]
682#[cfg(target_os = "fuchsia")]
683pub struct LoaderClientSynchronousProxy {
684 client: fidl::client::sync::Client,
685}
686
687#[cfg(target_os = "fuchsia")]
688impl fidl::endpoints::SynchronousProxy for LoaderClientSynchronousProxy {
689 type Proxy = LoaderClientProxy;
690 type Protocol = LoaderClientMarker;
691
692 fn from_channel(inner: fidl::Channel) -> Self {
693 Self::new(inner)
694 }
695
696 fn into_channel(self) -> fidl::Channel {
697 self.client.into_channel()
698 }
699
700 fn as_channel(&self) -> &fidl::Channel {
701 self.client.as_channel()
702 }
703}
704
705#[cfg(target_os = "fuchsia")]
706impl LoaderClientSynchronousProxy {
707 pub fn new(channel: fidl::Channel) -> Self {
708 let protocol_name = <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
709 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
710 }
711
712 pub fn into_channel(self) -> fidl::Channel {
713 self.client.into_channel()
714 }
715
716 pub fn wait_for_event(
719 &self,
720 deadline: zx::MonotonicInstant,
721 ) -> Result<LoaderClientEvent, fidl::Error> {
722 LoaderClientEvent::decode(self.client.wait_for_event(deadline)?)
723 }
724
725 pub fn r#on_response(
732 &self,
733 mut response: Response,
734 ___deadline: zx::MonotonicInstant,
735 ) -> Result<(), fidl::Error> {
736 let _response =
737 self.client.send_query::<LoaderClientOnResponseRequest, fidl::encoding::EmptyPayload>(
738 (&mut response,),
739 0x595ada171c7ebf89,
740 fidl::encoding::DynamicFlags::empty(),
741 ___deadline,
742 )?;
743 Ok(_response)
744 }
745}
746
747#[cfg(target_os = "fuchsia")]
748impl From<LoaderClientSynchronousProxy> for zx::Handle {
749 fn from(value: LoaderClientSynchronousProxy) -> Self {
750 value.into_channel().into()
751 }
752}
753
754#[cfg(target_os = "fuchsia")]
755impl From<fidl::Channel> for LoaderClientSynchronousProxy {
756 fn from(value: fidl::Channel) -> Self {
757 Self::new(value)
758 }
759}
760
761#[derive(Debug, Clone)]
762pub struct LoaderClientProxy {
763 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
764}
765
766impl fidl::endpoints::Proxy for LoaderClientProxy {
767 type Protocol = LoaderClientMarker;
768
769 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
770 Self::new(inner)
771 }
772
773 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
774 self.client.into_channel().map_err(|client| Self { client })
775 }
776
777 fn as_channel(&self) -> &::fidl::AsyncChannel {
778 self.client.as_channel()
779 }
780}
781
782impl LoaderClientProxy {
783 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
785 let protocol_name = <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
786 Self { client: fidl::client::Client::new(channel, protocol_name) }
787 }
788
789 pub fn take_event_stream(&self) -> LoaderClientEventStream {
795 LoaderClientEventStream { event_receiver: self.client.take_event_receiver() }
796 }
797
798 pub fn r#on_response(
805 &self,
806 mut response: Response,
807 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
808 LoaderClientProxyInterface::r#on_response(self, response)
809 }
810}
811
812impl LoaderClientProxyInterface for LoaderClientProxy {
813 type OnResponseResponseFut =
814 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
815 fn r#on_response(&self, mut response: Response) -> Self::OnResponseResponseFut {
816 fn _decode(
817 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
818 ) -> Result<(), fidl::Error> {
819 let _response = fidl::client::decode_transaction_body::<
820 fidl::encoding::EmptyPayload,
821 fidl::encoding::DefaultFuchsiaResourceDialect,
822 0x595ada171c7ebf89,
823 >(_buf?)?;
824 Ok(_response)
825 }
826 self.client.send_query_and_decode::<LoaderClientOnResponseRequest, ()>(
827 (&mut response,),
828 0x595ada171c7ebf89,
829 fidl::encoding::DynamicFlags::empty(),
830 _decode,
831 )
832 }
833}
834
835pub struct LoaderClientEventStream {
836 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
837}
838
839impl std::marker::Unpin for LoaderClientEventStream {}
840
841impl futures::stream::FusedStream for LoaderClientEventStream {
842 fn is_terminated(&self) -> bool {
843 self.event_receiver.is_terminated()
844 }
845}
846
847impl futures::Stream for LoaderClientEventStream {
848 type Item = Result<LoaderClientEvent, fidl::Error>;
849
850 fn poll_next(
851 mut self: std::pin::Pin<&mut Self>,
852 cx: &mut std::task::Context<'_>,
853 ) -> std::task::Poll<Option<Self::Item>> {
854 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
855 &mut self.event_receiver,
856 cx
857 )?) {
858 Some(buf) => std::task::Poll::Ready(Some(LoaderClientEvent::decode(buf))),
859 None => std::task::Poll::Ready(None),
860 }
861 }
862}
863
864#[derive(Debug)]
865pub enum LoaderClientEvent {}
866
867impl LoaderClientEvent {
868 fn decode(
870 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
871 ) -> Result<LoaderClientEvent, fidl::Error> {
872 let (bytes, _handles) = buf.split_mut();
873 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
874 debug_assert_eq!(tx_header.tx_id, 0);
875 match tx_header.ordinal {
876 _ => Err(fidl::Error::UnknownOrdinal {
877 ordinal: tx_header.ordinal,
878 protocol_name: <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
879 }),
880 }
881 }
882}
883
884pub struct LoaderClientRequestStream {
886 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
887 is_terminated: bool,
888}
889
890impl std::marker::Unpin for LoaderClientRequestStream {}
891
892impl futures::stream::FusedStream for LoaderClientRequestStream {
893 fn is_terminated(&self) -> bool {
894 self.is_terminated
895 }
896}
897
898impl fidl::endpoints::RequestStream for LoaderClientRequestStream {
899 type Protocol = LoaderClientMarker;
900 type ControlHandle = LoaderClientControlHandle;
901
902 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
903 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
904 }
905
906 fn control_handle(&self) -> Self::ControlHandle {
907 LoaderClientControlHandle { inner: self.inner.clone() }
908 }
909
910 fn into_inner(
911 self,
912 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
913 {
914 (self.inner, self.is_terminated)
915 }
916
917 fn from_inner(
918 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
919 is_terminated: bool,
920 ) -> Self {
921 Self { inner, is_terminated }
922 }
923}
924
925impl futures::Stream for LoaderClientRequestStream {
926 type Item = Result<LoaderClientRequest, fidl::Error>;
927
928 fn poll_next(
929 mut self: std::pin::Pin<&mut Self>,
930 cx: &mut std::task::Context<'_>,
931 ) -> std::task::Poll<Option<Self::Item>> {
932 let this = &mut *self;
933 if this.inner.check_shutdown(cx) {
934 this.is_terminated = true;
935 return std::task::Poll::Ready(None);
936 }
937 if this.is_terminated {
938 panic!("polled LoaderClientRequestStream after completion");
939 }
940 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
941 |bytes, handles| {
942 match this.inner.channel().read_etc(cx, bytes, handles) {
943 std::task::Poll::Ready(Ok(())) => {}
944 std::task::Poll::Pending => return std::task::Poll::Pending,
945 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
946 this.is_terminated = true;
947 return std::task::Poll::Ready(None);
948 }
949 std::task::Poll::Ready(Err(e)) => {
950 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
951 e.into(),
952 ))))
953 }
954 }
955
956 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
958
959 std::task::Poll::Ready(Some(match header.ordinal {
960 0x595ada171c7ebf89 => {
961 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
962 let mut req = fidl::new_empty!(
963 LoaderClientOnResponseRequest,
964 fidl::encoding::DefaultFuchsiaResourceDialect
965 );
966 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderClientOnResponseRequest>(&header, _body_bytes, handles, &mut req)?;
967 let control_handle =
968 LoaderClientControlHandle { inner: this.inner.clone() };
969 Ok(LoaderClientRequest::OnResponse {
970 response: req.response,
971
972 responder: LoaderClientOnResponseResponder {
973 control_handle: std::mem::ManuallyDrop::new(control_handle),
974 tx_id: header.tx_id,
975 },
976 })
977 }
978 _ => Err(fidl::Error::UnknownOrdinal {
979 ordinal: header.ordinal,
980 protocol_name:
981 <LoaderClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
982 }),
983 }))
984 },
985 )
986 }
987}
988
989#[derive(Debug)]
993pub enum LoaderClientRequest {
994 OnResponse { response: Response, responder: LoaderClientOnResponseResponder },
1001}
1002
1003impl LoaderClientRequest {
1004 #[allow(irrefutable_let_patterns)]
1005 pub fn into_on_response(self) -> Option<(Response, LoaderClientOnResponseResponder)> {
1006 if let LoaderClientRequest::OnResponse { response, responder } = self {
1007 Some((response, responder))
1008 } else {
1009 None
1010 }
1011 }
1012
1013 pub fn method_name(&self) -> &'static str {
1015 match *self {
1016 LoaderClientRequest::OnResponse { .. } => "on_response",
1017 }
1018 }
1019}
1020
1021#[derive(Debug, Clone)]
1022pub struct LoaderClientControlHandle {
1023 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1024}
1025
1026impl fidl::endpoints::ControlHandle for LoaderClientControlHandle {
1027 fn shutdown(&self) {
1028 self.inner.shutdown()
1029 }
1030 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1031 self.inner.shutdown_with_epitaph(status)
1032 }
1033
1034 fn is_closed(&self) -> bool {
1035 self.inner.channel().is_closed()
1036 }
1037 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1038 self.inner.channel().on_closed()
1039 }
1040
1041 #[cfg(target_os = "fuchsia")]
1042 fn signal_peer(
1043 &self,
1044 clear_mask: zx::Signals,
1045 set_mask: zx::Signals,
1046 ) -> Result<(), zx_status::Status> {
1047 use fidl::Peered;
1048 self.inner.channel().signal_peer(clear_mask, set_mask)
1049 }
1050}
1051
1052impl LoaderClientControlHandle {}
1053
1054#[must_use = "FIDL methods require a response to be sent"]
1055#[derive(Debug)]
1056pub struct LoaderClientOnResponseResponder {
1057 control_handle: std::mem::ManuallyDrop<LoaderClientControlHandle>,
1058 tx_id: u32,
1059}
1060
1061impl std::ops::Drop for LoaderClientOnResponseResponder {
1065 fn drop(&mut self) {
1066 self.control_handle.shutdown();
1067 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1069 }
1070}
1071
1072impl fidl::endpoints::Responder for LoaderClientOnResponseResponder {
1073 type ControlHandle = LoaderClientControlHandle;
1074
1075 fn control_handle(&self) -> &LoaderClientControlHandle {
1076 &self.control_handle
1077 }
1078
1079 fn drop_without_shutdown(mut self) {
1080 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1082 std::mem::forget(self);
1084 }
1085}
1086
1087impl LoaderClientOnResponseResponder {
1088 pub fn send(self) -> Result<(), fidl::Error> {
1092 let _result = self.send_raw();
1093 if _result.is_err() {
1094 self.control_handle.shutdown();
1095 }
1096 self.drop_without_shutdown();
1097 _result
1098 }
1099
1100 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1102 let _result = self.send_raw();
1103 self.drop_without_shutdown();
1104 _result
1105 }
1106
1107 fn send_raw(&self) -> Result<(), fidl::Error> {
1108 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1109 (),
1110 self.tx_id,
1111 0x595ada171c7ebf89,
1112 fidl::encoding::DynamicFlags::empty(),
1113 )
1114 }
1115}
1116
1117mod internal {
1118 use super::*;
1119
1120 impl fidl::encoding::ResourceTypeMarker for LoaderClientOnResponseRequest {
1121 type Borrowed<'a> = &'a mut Self;
1122 fn take_or_borrow<'a>(
1123 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1124 ) -> Self::Borrowed<'a> {
1125 value
1126 }
1127 }
1128
1129 unsafe impl fidl::encoding::TypeMarker for LoaderClientOnResponseRequest {
1130 type Owned = Self;
1131
1132 #[inline(always)]
1133 fn inline_align(_context: fidl::encoding::Context) -> usize {
1134 8
1135 }
1136
1137 #[inline(always)]
1138 fn inline_size(_context: fidl::encoding::Context) -> usize {
1139 16
1140 }
1141 }
1142
1143 unsafe impl
1144 fidl::encoding::Encode<
1145 LoaderClientOnResponseRequest,
1146 fidl::encoding::DefaultFuchsiaResourceDialect,
1147 > for &mut LoaderClientOnResponseRequest
1148 {
1149 #[inline]
1150 unsafe fn encode(
1151 self,
1152 encoder: &mut fidl::encoding::Encoder<
1153 '_,
1154 fidl::encoding::DefaultFuchsiaResourceDialect,
1155 >,
1156 offset: usize,
1157 _depth: fidl::encoding::Depth,
1158 ) -> fidl::Result<()> {
1159 encoder.debug_check_bounds::<LoaderClientOnResponseRequest>(offset);
1160 fidl::encoding::Encode::<
1162 LoaderClientOnResponseRequest,
1163 fidl::encoding::DefaultFuchsiaResourceDialect,
1164 >::encode(
1165 (<Response as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1166 &mut self.response,
1167 ),),
1168 encoder,
1169 offset,
1170 _depth,
1171 )
1172 }
1173 }
1174 unsafe impl<T0: fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>>
1175 fidl::encoding::Encode<
1176 LoaderClientOnResponseRequest,
1177 fidl::encoding::DefaultFuchsiaResourceDialect,
1178 > for (T0,)
1179 {
1180 #[inline]
1181 unsafe fn encode(
1182 self,
1183 encoder: &mut fidl::encoding::Encoder<
1184 '_,
1185 fidl::encoding::DefaultFuchsiaResourceDialect,
1186 >,
1187 offset: usize,
1188 depth: fidl::encoding::Depth,
1189 ) -> fidl::Result<()> {
1190 encoder.debug_check_bounds::<LoaderClientOnResponseRequest>(offset);
1191 self.0.encode(encoder, offset + 0, depth)?;
1195 Ok(())
1196 }
1197 }
1198
1199 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1200 for LoaderClientOnResponseRequest
1201 {
1202 #[inline(always)]
1203 fn new_empty() -> Self {
1204 Self {
1205 response: fidl::new_empty!(Response, fidl::encoding::DefaultFuchsiaResourceDialect),
1206 }
1207 }
1208
1209 #[inline]
1210 unsafe fn decode(
1211 &mut self,
1212 decoder: &mut fidl::encoding::Decoder<
1213 '_,
1214 fidl::encoding::DefaultFuchsiaResourceDialect,
1215 >,
1216 offset: usize,
1217 _depth: fidl::encoding::Depth,
1218 ) -> fidl::Result<()> {
1219 decoder.debug_check_bounds::<Self>(offset);
1220 fidl::decode!(
1222 Response,
1223 fidl::encoding::DefaultFuchsiaResourceDialect,
1224 &mut self.response,
1225 decoder,
1226 offset + 0,
1227 _depth
1228 )?;
1229 Ok(())
1230 }
1231 }
1232
1233 impl fidl::encoding::ResourceTypeMarker for LoaderFetchRequest {
1234 type Borrowed<'a> = &'a mut Self;
1235 fn take_or_borrow<'a>(
1236 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1237 ) -> Self::Borrowed<'a> {
1238 value
1239 }
1240 }
1241
1242 unsafe impl fidl::encoding::TypeMarker for LoaderFetchRequest {
1243 type Owned = Self;
1244
1245 #[inline(always)]
1246 fn inline_align(_context: fidl::encoding::Context) -> usize {
1247 8
1248 }
1249
1250 #[inline(always)]
1251 fn inline_size(_context: fidl::encoding::Context) -> usize {
1252 16
1253 }
1254 }
1255
1256 unsafe impl
1257 fidl::encoding::Encode<LoaderFetchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1258 for &mut LoaderFetchRequest
1259 {
1260 #[inline]
1261 unsafe fn encode(
1262 self,
1263 encoder: &mut fidl::encoding::Encoder<
1264 '_,
1265 fidl::encoding::DefaultFuchsiaResourceDialect,
1266 >,
1267 offset: usize,
1268 _depth: fidl::encoding::Depth,
1269 ) -> fidl::Result<()> {
1270 encoder.debug_check_bounds::<LoaderFetchRequest>(offset);
1271 fidl::encoding::Encode::<
1273 LoaderFetchRequest,
1274 fidl::encoding::DefaultFuchsiaResourceDialect,
1275 >::encode(
1276 (<Request as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1277 &mut self.request,
1278 ),),
1279 encoder,
1280 offset,
1281 _depth,
1282 )
1283 }
1284 }
1285 unsafe impl<T0: fidl::encoding::Encode<Request, fidl::encoding::DefaultFuchsiaResourceDialect>>
1286 fidl::encoding::Encode<LoaderFetchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1287 for (T0,)
1288 {
1289 #[inline]
1290 unsafe fn encode(
1291 self,
1292 encoder: &mut fidl::encoding::Encoder<
1293 '_,
1294 fidl::encoding::DefaultFuchsiaResourceDialect,
1295 >,
1296 offset: usize,
1297 depth: fidl::encoding::Depth,
1298 ) -> fidl::Result<()> {
1299 encoder.debug_check_bounds::<LoaderFetchRequest>(offset);
1300 self.0.encode(encoder, offset + 0, depth)?;
1304 Ok(())
1305 }
1306 }
1307
1308 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1309 for LoaderFetchRequest
1310 {
1311 #[inline(always)]
1312 fn new_empty() -> Self {
1313 Self {
1314 request: fidl::new_empty!(Request, fidl::encoding::DefaultFuchsiaResourceDialect),
1315 }
1316 }
1317
1318 #[inline]
1319 unsafe fn decode(
1320 &mut self,
1321 decoder: &mut fidl::encoding::Decoder<
1322 '_,
1323 fidl::encoding::DefaultFuchsiaResourceDialect,
1324 >,
1325 offset: usize,
1326 _depth: fidl::encoding::Depth,
1327 ) -> fidl::Result<()> {
1328 decoder.debug_check_bounds::<Self>(offset);
1329 fidl::decode!(
1331 Request,
1332 fidl::encoding::DefaultFuchsiaResourceDialect,
1333 &mut self.request,
1334 decoder,
1335 offset + 0,
1336 _depth
1337 )?;
1338 Ok(())
1339 }
1340 }
1341
1342 impl fidl::encoding::ResourceTypeMarker for LoaderFetchResponse {
1343 type Borrowed<'a> = &'a mut Self;
1344 fn take_or_borrow<'a>(
1345 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1346 ) -> Self::Borrowed<'a> {
1347 value
1348 }
1349 }
1350
1351 unsafe impl fidl::encoding::TypeMarker for LoaderFetchResponse {
1352 type Owned = Self;
1353
1354 #[inline(always)]
1355 fn inline_align(_context: fidl::encoding::Context) -> usize {
1356 8
1357 }
1358
1359 #[inline(always)]
1360 fn inline_size(_context: fidl::encoding::Context) -> usize {
1361 16
1362 }
1363 }
1364
1365 unsafe impl
1366 fidl::encoding::Encode<LoaderFetchResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1367 for &mut LoaderFetchResponse
1368 {
1369 #[inline]
1370 unsafe fn encode(
1371 self,
1372 encoder: &mut fidl::encoding::Encoder<
1373 '_,
1374 fidl::encoding::DefaultFuchsiaResourceDialect,
1375 >,
1376 offset: usize,
1377 _depth: fidl::encoding::Depth,
1378 ) -> fidl::Result<()> {
1379 encoder.debug_check_bounds::<LoaderFetchResponse>(offset);
1380 fidl::encoding::Encode::<
1382 LoaderFetchResponse,
1383 fidl::encoding::DefaultFuchsiaResourceDialect,
1384 >::encode(
1385 (<Response as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1386 &mut self.response,
1387 ),),
1388 encoder,
1389 offset,
1390 _depth,
1391 )
1392 }
1393 }
1394 unsafe impl<T0: fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>>
1395 fidl::encoding::Encode<LoaderFetchResponse, 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::<LoaderFetchResponse>(offset);
1409 self.0.encode(encoder, offset + 0, depth)?;
1413 Ok(())
1414 }
1415 }
1416
1417 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1418 for LoaderFetchResponse
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 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 LoaderStartRequest {
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 LoaderStartRequest {
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 24
1471 }
1472 }
1473
1474 unsafe impl
1475 fidl::encoding::Encode<LoaderStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1476 for &mut LoaderStartRequest
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::<LoaderStartRequest>(offset);
1489 fidl::encoding::Encode::<LoaderStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1491 (
1492 <Request as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1493 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
1494 ),
1495 encoder, offset, _depth
1496 )
1497 }
1498 }
1499 unsafe impl<
1500 T0: fidl::encoding::Encode<Request, fidl::encoding::DefaultFuchsiaResourceDialect>,
1501 T1: fidl::encoding::Encode<
1502 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>>,
1503 fidl::encoding::DefaultFuchsiaResourceDialect,
1504 >,
1505 >
1506 fidl::encoding::Encode<LoaderStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1507 for (T0, T1)
1508 {
1509 #[inline]
1510 unsafe fn encode(
1511 self,
1512 encoder: &mut fidl::encoding::Encoder<
1513 '_,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 >,
1516 offset: usize,
1517 depth: fidl::encoding::Depth,
1518 ) -> fidl::Result<()> {
1519 encoder.debug_check_bounds::<LoaderStartRequest>(offset);
1520 unsafe {
1523 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1524 (ptr as *mut u64).write_unaligned(0);
1525 }
1526 self.0.encode(encoder, offset + 0, depth)?;
1528 self.1.encode(encoder, offset + 16, depth)?;
1529 Ok(())
1530 }
1531 }
1532
1533 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1534 for LoaderStartRequest
1535 {
1536 #[inline(always)]
1537 fn new_empty() -> Self {
1538 Self {
1539 request: fidl::new_empty!(Request, fidl::encoding::DefaultFuchsiaResourceDialect),
1540 client: fidl::new_empty!(
1541 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>>,
1542 fidl::encoding::DefaultFuchsiaResourceDialect
1543 ),
1544 }
1545 }
1546
1547 #[inline]
1548 unsafe fn decode(
1549 &mut self,
1550 decoder: &mut fidl::encoding::Decoder<
1551 '_,
1552 fidl::encoding::DefaultFuchsiaResourceDialect,
1553 >,
1554 offset: usize,
1555 _depth: fidl::encoding::Depth,
1556 ) -> fidl::Result<()> {
1557 decoder.debug_check_bounds::<Self>(offset);
1558 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1560 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1561 let mask = 0xffffffff00000000u64;
1562 let maskedval = padval & mask;
1563 if maskedval != 0 {
1564 return Err(fidl::Error::NonZeroPadding {
1565 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1566 });
1567 }
1568 fidl::decode!(
1569 Request,
1570 fidl::encoding::DefaultFuchsiaResourceDialect,
1571 &mut self.request,
1572 decoder,
1573 offset + 0,
1574 _depth
1575 )?;
1576 fidl::decode!(
1577 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LoaderClientMarker>>,
1578 fidl::encoding::DefaultFuchsiaResourceDialect,
1579 &mut self.client,
1580 decoder,
1581 offset + 16,
1582 _depth
1583 )?;
1584 Ok(())
1585 }
1586 }
1587
1588 impl Request {
1589 #[inline(always)]
1590 fn max_ordinal_present(&self) -> u64 {
1591 if let Some(_) = self.deadline {
1592 return 5;
1593 }
1594 if let Some(_) = self.body {
1595 return 4;
1596 }
1597 if let Some(_) = self.headers {
1598 return 3;
1599 }
1600 if let Some(_) = self.url {
1601 return 2;
1602 }
1603 if let Some(_) = self.method {
1604 return 1;
1605 }
1606 0
1607 }
1608 }
1609
1610 impl fidl::encoding::ResourceTypeMarker for Request {
1611 type Borrowed<'a> = &'a mut Self;
1612 fn take_or_borrow<'a>(
1613 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1614 ) -> Self::Borrowed<'a> {
1615 value
1616 }
1617 }
1618
1619 unsafe impl fidl::encoding::TypeMarker for Request {
1620 type Owned = Self;
1621
1622 #[inline(always)]
1623 fn inline_align(_context: fidl::encoding::Context) -> usize {
1624 8
1625 }
1626
1627 #[inline(always)]
1628 fn inline_size(_context: fidl::encoding::Context) -> usize {
1629 16
1630 }
1631 }
1632
1633 unsafe impl fidl::encoding::Encode<Request, fidl::encoding::DefaultFuchsiaResourceDialect>
1634 for &mut Request
1635 {
1636 unsafe fn encode(
1637 self,
1638 encoder: &mut fidl::encoding::Encoder<
1639 '_,
1640 fidl::encoding::DefaultFuchsiaResourceDialect,
1641 >,
1642 offset: usize,
1643 mut depth: fidl::encoding::Depth,
1644 ) -> fidl::Result<()> {
1645 encoder.debug_check_bounds::<Request>(offset);
1646 let max_ordinal: u64 = self.max_ordinal_present();
1648 encoder.write_num(max_ordinal, offset);
1649 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1650 if max_ordinal == 0 {
1652 return Ok(());
1653 }
1654 depth.increment()?;
1655 let envelope_size = 8;
1656 let bytes_len = max_ordinal as usize * envelope_size;
1657 #[allow(unused_variables)]
1658 let offset = encoder.out_of_line_offset(bytes_len);
1659 let mut _prev_end_offset: usize = 0;
1660 if 1 > max_ordinal {
1661 return Ok(());
1662 }
1663
1664 let cur_offset: usize = (1 - 1) * envelope_size;
1667
1668 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1670
1671 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1676 self.method.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1677 encoder, offset + cur_offset, depth
1678 )?;
1679
1680 _prev_end_offset = cur_offset + envelope_size;
1681 if 2 > max_ordinal {
1682 return Ok(());
1683 }
1684
1685 let cur_offset: usize = (2 - 1) * envelope_size;
1688
1689 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1691
1692 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1697 self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1698 encoder, offset + cur_offset, depth
1699 )?;
1700
1701 _prev_end_offset = cur_offset + envelope_size;
1702 if 3 > max_ordinal {
1703 return Ok(());
1704 }
1705
1706 let cur_offset: usize = (3 - 1) * envelope_size;
1709
1710 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1712
1713 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1718 self.headers.as_ref().map(<fidl::encoding::UnboundedVector<Header> as fidl::encoding::ValueTypeMarker>::borrow),
1719 encoder, offset + cur_offset, depth
1720 )?;
1721
1722 _prev_end_offset = cur_offset + envelope_size;
1723 if 4 > max_ordinal {
1724 return Ok(());
1725 }
1726
1727 let cur_offset: usize = (4 - 1) * envelope_size;
1730
1731 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1733
1734 fidl::encoding::encode_in_envelope_optional::<
1739 Body,
1740 fidl::encoding::DefaultFuchsiaResourceDialect,
1741 >(
1742 self.body
1743 .as_mut()
1744 .map(<Body as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1745 encoder,
1746 offset + cur_offset,
1747 depth,
1748 )?;
1749
1750 _prev_end_offset = cur_offset + envelope_size;
1751 if 5 > max_ordinal {
1752 return Ok(());
1753 }
1754
1755 let cur_offset: usize = (5 - 1) * envelope_size;
1758
1759 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1761
1762 fidl::encoding::encode_in_envelope_optional::<
1767 i64,
1768 fidl::encoding::DefaultFuchsiaResourceDialect,
1769 >(
1770 self.deadline.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1771 encoder,
1772 offset + cur_offset,
1773 depth,
1774 )?;
1775
1776 _prev_end_offset = cur_offset + envelope_size;
1777
1778 Ok(())
1779 }
1780 }
1781
1782 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Request {
1783 #[inline(always)]
1784 fn new_empty() -> Self {
1785 Self::default()
1786 }
1787
1788 unsafe fn decode(
1789 &mut self,
1790 decoder: &mut fidl::encoding::Decoder<
1791 '_,
1792 fidl::encoding::DefaultFuchsiaResourceDialect,
1793 >,
1794 offset: usize,
1795 mut depth: fidl::encoding::Depth,
1796 ) -> fidl::Result<()> {
1797 decoder.debug_check_bounds::<Self>(offset);
1798 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1799 None => return Err(fidl::Error::NotNullable),
1800 Some(len) => len,
1801 };
1802 if len == 0 {
1804 return Ok(());
1805 };
1806 depth.increment()?;
1807 let envelope_size = 8;
1808 let bytes_len = len * envelope_size;
1809 let offset = decoder.out_of_line_offset(bytes_len)?;
1810 let mut _next_ordinal_to_read = 0;
1812 let mut next_offset = offset;
1813 let end_offset = offset + bytes_len;
1814 _next_ordinal_to_read += 1;
1815 if next_offset >= end_offset {
1816 return Ok(());
1817 }
1818
1819 while _next_ordinal_to_read < 1 {
1821 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1822 _next_ordinal_to_read += 1;
1823 next_offset += envelope_size;
1824 }
1825
1826 let next_out_of_line = decoder.next_out_of_line();
1827 let handles_before = decoder.remaining_handles();
1828 if let Some((inlined, num_bytes, num_handles)) =
1829 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1830 {
1831 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1832 if inlined != (member_inline_size <= 4) {
1833 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1834 }
1835 let inner_offset;
1836 let mut inner_depth = depth.clone();
1837 if inlined {
1838 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1839 inner_offset = next_offset;
1840 } else {
1841 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1842 inner_depth.increment()?;
1843 }
1844 let val_ref = self.method.get_or_insert_with(|| {
1845 fidl::new_empty!(
1846 fidl::encoding::BoundedString<1024>,
1847 fidl::encoding::DefaultFuchsiaResourceDialect
1848 )
1849 });
1850 fidl::decode!(
1851 fidl::encoding::BoundedString<1024>,
1852 fidl::encoding::DefaultFuchsiaResourceDialect,
1853 val_ref,
1854 decoder,
1855 inner_offset,
1856 inner_depth
1857 )?;
1858 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1859 {
1860 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1861 }
1862 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1863 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1864 }
1865 }
1866
1867 next_offset += envelope_size;
1868 _next_ordinal_to_read += 1;
1869 if next_offset >= end_offset {
1870 return Ok(());
1871 }
1872
1873 while _next_ordinal_to_read < 2 {
1875 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1876 _next_ordinal_to_read += 1;
1877 next_offset += envelope_size;
1878 }
1879
1880 let next_out_of_line = decoder.next_out_of_line();
1881 let handles_before = decoder.remaining_handles();
1882 if let Some((inlined, num_bytes, num_handles)) =
1883 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1884 {
1885 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1886 if inlined != (member_inline_size <= 4) {
1887 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1888 }
1889 let inner_offset;
1890 let mut inner_depth = depth.clone();
1891 if inlined {
1892 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1893 inner_offset = next_offset;
1894 } else {
1895 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1896 inner_depth.increment()?;
1897 }
1898 let val_ref = self.url.get_or_insert_with(|| {
1899 fidl::new_empty!(
1900 fidl::encoding::BoundedString<4096>,
1901 fidl::encoding::DefaultFuchsiaResourceDialect
1902 )
1903 });
1904 fidl::decode!(
1905 fidl::encoding::BoundedString<4096>,
1906 fidl::encoding::DefaultFuchsiaResourceDialect,
1907 val_ref,
1908 decoder,
1909 inner_offset,
1910 inner_depth
1911 )?;
1912 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1913 {
1914 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1915 }
1916 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1917 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1918 }
1919 }
1920
1921 next_offset += envelope_size;
1922 _next_ordinal_to_read += 1;
1923 if next_offset >= end_offset {
1924 return Ok(());
1925 }
1926
1927 while _next_ordinal_to_read < 3 {
1929 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1930 _next_ordinal_to_read += 1;
1931 next_offset += envelope_size;
1932 }
1933
1934 let next_out_of_line = decoder.next_out_of_line();
1935 let handles_before = decoder.remaining_handles();
1936 if let Some((inlined, num_bytes, num_handles)) =
1937 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1938 {
1939 let member_inline_size = <fidl::encoding::UnboundedVector<Header> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1940 if inlined != (member_inline_size <= 4) {
1941 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1942 }
1943 let inner_offset;
1944 let mut inner_depth = depth.clone();
1945 if inlined {
1946 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1947 inner_offset = next_offset;
1948 } else {
1949 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1950 inner_depth.increment()?;
1951 }
1952 let val_ref = self.headers.get_or_insert_with(|| {
1953 fidl::new_empty!(
1954 fidl::encoding::UnboundedVector<Header>,
1955 fidl::encoding::DefaultFuchsiaResourceDialect
1956 )
1957 });
1958 fidl::decode!(
1959 fidl::encoding::UnboundedVector<Header>,
1960 fidl::encoding::DefaultFuchsiaResourceDialect,
1961 val_ref,
1962 decoder,
1963 inner_offset,
1964 inner_depth
1965 )?;
1966 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1967 {
1968 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1969 }
1970 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1971 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1972 }
1973 }
1974
1975 next_offset += envelope_size;
1976 _next_ordinal_to_read += 1;
1977 if next_offset >= end_offset {
1978 return Ok(());
1979 }
1980
1981 while _next_ordinal_to_read < 4 {
1983 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1984 _next_ordinal_to_read += 1;
1985 next_offset += envelope_size;
1986 }
1987
1988 let next_out_of_line = decoder.next_out_of_line();
1989 let handles_before = decoder.remaining_handles();
1990 if let Some((inlined, num_bytes, num_handles)) =
1991 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1992 {
1993 let member_inline_size =
1994 <Body as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1995 if inlined != (member_inline_size <= 4) {
1996 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1997 }
1998 let inner_offset;
1999 let mut inner_depth = depth.clone();
2000 if inlined {
2001 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2002 inner_offset = next_offset;
2003 } else {
2004 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2005 inner_depth.increment()?;
2006 }
2007 let val_ref = self.body.get_or_insert_with(|| {
2008 fidl::new_empty!(Body, fidl::encoding::DefaultFuchsiaResourceDialect)
2009 });
2010 fidl::decode!(
2011 Body,
2012 fidl::encoding::DefaultFuchsiaResourceDialect,
2013 val_ref,
2014 decoder,
2015 inner_offset,
2016 inner_depth
2017 )?;
2018 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2019 {
2020 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2021 }
2022 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2023 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2024 }
2025 }
2026
2027 next_offset += envelope_size;
2028 _next_ordinal_to_read += 1;
2029 if next_offset >= end_offset {
2030 return Ok(());
2031 }
2032
2033 while _next_ordinal_to_read < 5 {
2035 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2036 _next_ordinal_to_read += 1;
2037 next_offset += envelope_size;
2038 }
2039
2040 let next_out_of_line = decoder.next_out_of_line();
2041 let handles_before = decoder.remaining_handles();
2042 if let Some((inlined, num_bytes, num_handles)) =
2043 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2044 {
2045 let member_inline_size =
2046 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2047 if inlined != (member_inline_size <= 4) {
2048 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2049 }
2050 let inner_offset;
2051 let mut inner_depth = depth.clone();
2052 if inlined {
2053 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2054 inner_offset = next_offset;
2055 } else {
2056 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2057 inner_depth.increment()?;
2058 }
2059 let val_ref = self.deadline.get_or_insert_with(|| {
2060 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
2061 });
2062 fidl::decode!(
2063 i64,
2064 fidl::encoding::DefaultFuchsiaResourceDialect,
2065 val_ref,
2066 decoder,
2067 inner_offset,
2068 inner_depth
2069 )?;
2070 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2071 {
2072 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2073 }
2074 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2075 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2076 }
2077 }
2078
2079 next_offset += envelope_size;
2080
2081 while next_offset < end_offset {
2083 _next_ordinal_to_read += 1;
2084 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2085 next_offset += envelope_size;
2086 }
2087
2088 Ok(())
2089 }
2090 }
2091
2092 impl Response {
2093 #[inline(always)]
2094 fn max_ordinal_present(&self) -> u64 {
2095 if let Some(_) = self.redirect {
2096 return 7;
2097 }
2098 if let Some(_) = self.headers {
2099 return 6;
2100 }
2101 if let Some(_) = self.status_line {
2102 return 5;
2103 }
2104 if let Some(_) = self.status_code {
2105 return 4;
2106 }
2107 if let Some(_) = self.final_url {
2108 return 3;
2109 }
2110 if let Some(_) = self.body {
2111 return 2;
2112 }
2113 if let Some(_) = self.error {
2114 return 1;
2115 }
2116 0
2117 }
2118 }
2119
2120 impl fidl::encoding::ResourceTypeMarker for Response {
2121 type Borrowed<'a> = &'a mut Self;
2122 fn take_or_borrow<'a>(
2123 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2124 ) -> Self::Borrowed<'a> {
2125 value
2126 }
2127 }
2128
2129 unsafe impl fidl::encoding::TypeMarker for Response {
2130 type Owned = Self;
2131
2132 #[inline(always)]
2133 fn inline_align(_context: fidl::encoding::Context) -> usize {
2134 8
2135 }
2136
2137 #[inline(always)]
2138 fn inline_size(_context: fidl::encoding::Context) -> usize {
2139 16
2140 }
2141 }
2142
2143 unsafe impl fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>
2144 for &mut Response
2145 {
2146 unsafe fn encode(
2147 self,
2148 encoder: &mut fidl::encoding::Encoder<
2149 '_,
2150 fidl::encoding::DefaultFuchsiaResourceDialect,
2151 >,
2152 offset: usize,
2153 mut depth: fidl::encoding::Depth,
2154 ) -> fidl::Result<()> {
2155 encoder.debug_check_bounds::<Response>(offset);
2156 let max_ordinal: u64 = self.max_ordinal_present();
2158 encoder.write_num(max_ordinal, offset);
2159 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2160 if max_ordinal == 0 {
2162 return Ok(());
2163 }
2164 depth.increment()?;
2165 let envelope_size = 8;
2166 let bytes_len = max_ordinal as usize * envelope_size;
2167 #[allow(unused_variables)]
2168 let offset = encoder.out_of_line_offset(bytes_len);
2169 let mut _prev_end_offset: usize = 0;
2170 if 1 > max_ordinal {
2171 return Ok(());
2172 }
2173
2174 let cur_offset: usize = (1 - 1) * envelope_size;
2177
2178 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2180
2181 fidl::encoding::encode_in_envelope_optional::<
2186 Error,
2187 fidl::encoding::DefaultFuchsiaResourceDialect,
2188 >(
2189 self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
2190 encoder,
2191 offset + cur_offset,
2192 depth,
2193 )?;
2194
2195 _prev_end_offset = cur_offset + envelope_size;
2196 if 2 > max_ordinal {
2197 return Ok(());
2198 }
2199
2200 let cur_offset: usize = (2 - 1) * envelope_size;
2203
2204 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2206
2207 fidl::encoding::encode_in_envelope_optional::<
2212 fidl::encoding::HandleType<
2213 fidl::Socket,
2214 { fidl::ObjectType::SOCKET.into_raw() },
2215 2147483648,
2216 >,
2217 fidl::encoding::DefaultFuchsiaResourceDialect,
2218 >(
2219 self.body.as_mut().map(
2220 <fidl::encoding::HandleType<
2221 fidl::Socket,
2222 { fidl::ObjectType::SOCKET.into_raw() },
2223 2147483648,
2224 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2225 ),
2226 encoder,
2227 offset + cur_offset,
2228 depth,
2229 )?;
2230
2231 _prev_end_offset = cur_offset + envelope_size;
2232 if 3 > max_ordinal {
2233 return Ok(());
2234 }
2235
2236 let cur_offset: usize = (3 - 1) * envelope_size;
2239
2240 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2242
2243 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2248 self.final_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2249 encoder, offset + cur_offset, depth
2250 )?;
2251
2252 _prev_end_offset = cur_offset + envelope_size;
2253 if 4 > max_ordinal {
2254 return Ok(());
2255 }
2256
2257 let cur_offset: usize = (4 - 1) * envelope_size;
2260
2261 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2263
2264 fidl::encoding::encode_in_envelope_optional::<
2269 u32,
2270 fidl::encoding::DefaultFuchsiaResourceDialect,
2271 >(
2272 self.status_code.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2273 encoder,
2274 offset + cur_offset,
2275 depth,
2276 )?;
2277
2278 _prev_end_offset = cur_offset + envelope_size;
2279 if 5 > max_ordinal {
2280 return Ok(());
2281 }
2282
2283 let cur_offset: usize = (5 - 1) * envelope_size;
2286
2287 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2289
2290 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2295 self.status_line.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
2296 encoder, offset + cur_offset, depth
2297 )?;
2298
2299 _prev_end_offset = cur_offset + envelope_size;
2300 if 6 > max_ordinal {
2301 return Ok(());
2302 }
2303
2304 let cur_offset: usize = (6 - 1) * envelope_size;
2307
2308 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2310
2311 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2316 self.headers.as_ref().map(<fidl::encoding::UnboundedVector<Header> as fidl::encoding::ValueTypeMarker>::borrow),
2317 encoder, offset + cur_offset, depth
2318 )?;
2319
2320 _prev_end_offset = cur_offset + envelope_size;
2321 if 7 > max_ordinal {
2322 return Ok(());
2323 }
2324
2325 let cur_offset: usize = (7 - 1) * envelope_size;
2328
2329 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2331
2332 fidl::encoding::encode_in_envelope_optional::<
2337 RedirectTarget,
2338 fidl::encoding::DefaultFuchsiaResourceDialect,
2339 >(
2340 self.redirect
2341 .as_ref()
2342 .map(<RedirectTarget as fidl::encoding::ValueTypeMarker>::borrow),
2343 encoder,
2344 offset + cur_offset,
2345 depth,
2346 )?;
2347
2348 _prev_end_offset = cur_offset + envelope_size;
2349
2350 Ok(())
2351 }
2352 }
2353
2354 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Response {
2355 #[inline(always)]
2356 fn new_empty() -> Self {
2357 Self::default()
2358 }
2359
2360 unsafe fn decode(
2361 &mut self,
2362 decoder: &mut fidl::encoding::Decoder<
2363 '_,
2364 fidl::encoding::DefaultFuchsiaResourceDialect,
2365 >,
2366 offset: usize,
2367 mut depth: fidl::encoding::Depth,
2368 ) -> fidl::Result<()> {
2369 decoder.debug_check_bounds::<Self>(offset);
2370 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2371 None => return Err(fidl::Error::NotNullable),
2372 Some(len) => len,
2373 };
2374 if len == 0 {
2376 return Ok(());
2377 };
2378 depth.increment()?;
2379 let envelope_size = 8;
2380 let bytes_len = len * envelope_size;
2381 let offset = decoder.out_of_line_offset(bytes_len)?;
2382 let mut _next_ordinal_to_read = 0;
2384 let mut next_offset = offset;
2385 let end_offset = offset + bytes_len;
2386 _next_ordinal_to_read += 1;
2387 if next_offset >= end_offset {
2388 return Ok(());
2389 }
2390
2391 while _next_ordinal_to_read < 1 {
2393 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2394 _next_ordinal_to_read += 1;
2395 next_offset += envelope_size;
2396 }
2397
2398 let next_out_of_line = decoder.next_out_of_line();
2399 let handles_before = decoder.remaining_handles();
2400 if let Some((inlined, num_bytes, num_handles)) =
2401 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2402 {
2403 let member_inline_size =
2404 <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2405 if inlined != (member_inline_size <= 4) {
2406 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2407 }
2408 let inner_offset;
2409 let mut inner_depth = depth.clone();
2410 if inlined {
2411 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2412 inner_offset = next_offset;
2413 } else {
2414 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2415 inner_depth.increment()?;
2416 }
2417 let val_ref = self.error.get_or_insert_with(|| {
2418 fidl::new_empty!(Error, fidl::encoding::DefaultFuchsiaResourceDialect)
2419 });
2420 fidl::decode!(
2421 Error,
2422 fidl::encoding::DefaultFuchsiaResourceDialect,
2423 val_ref,
2424 decoder,
2425 inner_offset,
2426 inner_depth
2427 )?;
2428 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2429 {
2430 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2431 }
2432 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2433 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2434 }
2435 }
2436
2437 next_offset += envelope_size;
2438 _next_ordinal_to_read += 1;
2439 if next_offset >= end_offset {
2440 return Ok(());
2441 }
2442
2443 while _next_ordinal_to_read < 2 {
2445 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2446 _next_ordinal_to_read += 1;
2447 next_offset += envelope_size;
2448 }
2449
2450 let next_out_of_line = decoder.next_out_of_line();
2451 let handles_before = decoder.remaining_handles();
2452 if let Some((inlined, num_bytes, num_handles)) =
2453 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2454 {
2455 let member_inline_size = <fidl::encoding::HandleType<
2456 fidl::Socket,
2457 { fidl::ObjectType::SOCKET.into_raw() },
2458 2147483648,
2459 > as fidl::encoding::TypeMarker>::inline_size(
2460 decoder.context
2461 );
2462 if inlined != (member_inline_size <= 4) {
2463 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2464 }
2465 let inner_offset;
2466 let mut inner_depth = depth.clone();
2467 if inlined {
2468 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2469 inner_offset = next_offset;
2470 } else {
2471 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2472 inner_depth.increment()?;
2473 }
2474 let val_ref =
2475 self.body.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2476 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2477 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2478 {
2479 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2480 }
2481 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2482 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2483 }
2484 }
2485
2486 next_offset += envelope_size;
2487 _next_ordinal_to_read += 1;
2488 if next_offset >= end_offset {
2489 return Ok(());
2490 }
2491
2492 while _next_ordinal_to_read < 3 {
2494 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2495 _next_ordinal_to_read += 1;
2496 next_offset += envelope_size;
2497 }
2498
2499 let next_out_of_line = decoder.next_out_of_line();
2500 let handles_before = decoder.remaining_handles();
2501 if let Some((inlined, num_bytes, num_handles)) =
2502 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2503 {
2504 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2505 if inlined != (member_inline_size <= 4) {
2506 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2507 }
2508 let inner_offset;
2509 let mut inner_depth = depth.clone();
2510 if inlined {
2511 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2512 inner_offset = next_offset;
2513 } else {
2514 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2515 inner_depth.increment()?;
2516 }
2517 let val_ref = self.final_url.get_or_insert_with(|| {
2518 fidl::new_empty!(
2519 fidl::encoding::BoundedString<4096>,
2520 fidl::encoding::DefaultFuchsiaResourceDialect
2521 )
2522 });
2523 fidl::decode!(
2524 fidl::encoding::BoundedString<4096>,
2525 fidl::encoding::DefaultFuchsiaResourceDialect,
2526 val_ref,
2527 decoder,
2528 inner_offset,
2529 inner_depth
2530 )?;
2531 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2532 {
2533 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2534 }
2535 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2536 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2537 }
2538 }
2539
2540 next_offset += envelope_size;
2541 _next_ordinal_to_read += 1;
2542 if next_offset >= end_offset {
2543 return Ok(());
2544 }
2545
2546 while _next_ordinal_to_read < 4 {
2548 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2549 _next_ordinal_to_read += 1;
2550 next_offset += envelope_size;
2551 }
2552
2553 let next_out_of_line = decoder.next_out_of_line();
2554 let handles_before = decoder.remaining_handles();
2555 if let Some((inlined, num_bytes, num_handles)) =
2556 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2557 {
2558 let member_inline_size =
2559 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2560 if inlined != (member_inline_size <= 4) {
2561 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2562 }
2563 let inner_offset;
2564 let mut inner_depth = depth.clone();
2565 if inlined {
2566 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2567 inner_offset = next_offset;
2568 } else {
2569 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2570 inner_depth.increment()?;
2571 }
2572 let val_ref = self.status_code.get_or_insert_with(|| {
2573 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2574 });
2575 fidl::decode!(
2576 u32,
2577 fidl::encoding::DefaultFuchsiaResourceDialect,
2578 val_ref,
2579 decoder,
2580 inner_offset,
2581 inner_depth
2582 )?;
2583 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2584 {
2585 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2586 }
2587 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2588 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2589 }
2590 }
2591
2592 next_offset += envelope_size;
2593 _next_ordinal_to_read += 1;
2594 if next_offset >= end_offset {
2595 return Ok(());
2596 }
2597
2598 while _next_ordinal_to_read < 5 {
2600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2601 _next_ordinal_to_read += 1;
2602 next_offset += envelope_size;
2603 }
2604
2605 let next_out_of_line = decoder.next_out_of_line();
2606 let handles_before = decoder.remaining_handles();
2607 if let Some((inlined, num_bytes, num_handles)) =
2608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2609 {
2610 let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2611 if inlined != (member_inline_size <= 4) {
2612 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2613 }
2614 let inner_offset;
2615 let mut inner_depth = depth.clone();
2616 if inlined {
2617 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2618 inner_offset = next_offset;
2619 } else {
2620 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2621 inner_depth.increment()?;
2622 }
2623 let val_ref = self.status_line.get_or_insert_with(|| {
2624 fidl::new_empty!(
2625 fidl::encoding::UnboundedVector<u8>,
2626 fidl::encoding::DefaultFuchsiaResourceDialect
2627 )
2628 });
2629 fidl::decode!(
2630 fidl::encoding::UnboundedVector<u8>,
2631 fidl::encoding::DefaultFuchsiaResourceDialect,
2632 val_ref,
2633 decoder,
2634 inner_offset,
2635 inner_depth
2636 )?;
2637 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2638 {
2639 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2640 }
2641 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2642 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2643 }
2644 }
2645
2646 next_offset += envelope_size;
2647 _next_ordinal_to_read += 1;
2648 if next_offset >= end_offset {
2649 return Ok(());
2650 }
2651
2652 while _next_ordinal_to_read < 6 {
2654 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2655 _next_ordinal_to_read += 1;
2656 next_offset += envelope_size;
2657 }
2658
2659 let next_out_of_line = decoder.next_out_of_line();
2660 let handles_before = decoder.remaining_handles();
2661 if let Some((inlined, num_bytes, num_handles)) =
2662 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2663 {
2664 let member_inline_size = <fidl::encoding::UnboundedVector<Header> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2665 if inlined != (member_inline_size <= 4) {
2666 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2667 }
2668 let inner_offset;
2669 let mut inner_depth = depth.clone();
2670 if inlined {
2671 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2672 inner_offset = next_offset;
2673 } else {
2674 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2675 inner_depth.increment()?;
2676 }
2677 let val_ref = self.headers.get_or_insert_with(|| {
2678 fidl::new_empty!(
2679 fidl::encoding::UnboundedVector<Header>,
2680 fidl::encoding::DefaultFuchsiaResourceDialect
2681 )
2682 });
2683 fidl::decode!(
2684 fidl::encoding::UnboundedVector<Header>,
2685 fidl::encoding::DefaultFuchsiaResourceDialect,
2686 val_ref,
2687 decoder,
2688 inner_offset,
2689 inner_depth
2690 )?;
2691 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2692 {
2693 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2694 }
2695 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2696 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2697 }
2698 }
2699
2700 next_offset += envelope_size;
2701 _next_ordinal_to_read += 1;
2702 if next_offset >= end_offset {
2703 return Ok(());
2704 }
2705
2706 while _next_ordinal_to_read < 7 {
2708 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2709 _next_ordinal_to_read += 1;
2710 next_offset += envelope_size;
2711 }
2712
2713 let next_out_of_line = decoder.next_out_of_line();
2714 let handles_before = decoder.remaining_handles();
2715 if let Some((inlined, num_bytes, num_handles)) =
2716 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2717 {
2718 let member_inline_size =
2719 <RedirectTarget as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2720 if inlined != (member_inline_size <= 4) {
2721 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2722 }
2723 let inner_offset;
2724 let mut inner_depth = depth.clone();
2725 if inlined {
2726 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2727 inner_offset = next_offset;
2728 } else {
2729 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2730 inner_depth.increment()?;
2731 }
2732 let val_ref = self.redirect.get_or_insert_with(|| {
2733 fidl::new_empty!(RedirectTarget, fidl::encoding::DefaultFuchsiaResourceDialect)
2734 });
2735 fidl::decode!(
2736 RedirectTarget,
2737 fidl::encoding::DefaultFuchsiaResourceDialect,
2738 val_ref,
2739 decoder,
2740 inner_offset,
2741 inner_depth
2742 )?;
2743 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2744 {
2745 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2746 }
2747 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2748 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2749 }
2750 }
2751
2752 next_offset += envelope_size;
2753
2754 while next_offset < end_offset {
2756 _next_ordinal_to_read += 1;
2757 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2758 next_offset += envelope_size;
2759 }
2760
2761 Ok(())
2762 }
2763 }
2764
2765 impl fidl::encoding::ResourceTypeMarker for Body {
2766 type Borrowed<'a> = &'a mut Self;
2767 fn take_or_borrow<'a>(
2768 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2769 ) -> Self::Borrowed<'a> {
2770 value
2771 }
2772 }
2773
2774 unsafe impl fidl::encoding::TypeMarker for Body {
2775 type Owned = Self;
2776
2777 #[inline(always)]
2778 fn inline_align(_context: fidl::encoding::Context) -> usize {
2779 8
2780 }
2781
2782 #[inline(always)]
2783 fn inline_size(_context: fidl::encoding::Context) -> usize {
2784 16
2785 }
2786 }
2787
2788 unsafe impl fidl::encoding::Encode<Body, fidl::encoding::DefaultFuchsiaResourceDialect>
2789 for &mut Body
2790 {
2791 #[inline]
2792 unsafe fn encode(
2793 self,
2794 encoder: &mut fidl::encoding::Encoder<
2795 '_,
2796 fidl::encoding::DefaultFuchsiaResourceDialect,
2797 >,
2798 offset: usize,
2799 _depth: fidl::encoding::Depth,
2800 ) -> fidl::Result<()> {
2801 encoder.debug_check_bounds::<Body>(offset);
2802 encoder.write_num::<u64>(self.ordinal(), offset);
2803 match self {
2804 Body::Buffer(ref mut val) => {
2805 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
2806 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2807 encoder, offset + 8, _depth
2808 )
2809 }
2810 Body::Stream(ref mut val) => {
2811 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2812 <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2813 encoder, offset + 8, _depth
2814 )
2815 }
2816 }
2817 }
2818 }
2819
2820 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Body {
2821 #[inline(always)]
2822 fn new_empty() -> Self {
2823 Self::Buffer(fidl::new_empty!(
2824 fidl_fuchsia_mem::Buffer,
2825 fidl::encoding::DefaultFuchsiaResourceDialect
2826 ))
2827 }
2828
2829 #[inline]
2830 unsafe fn decode(
2831 &mut self,
2832 decoder: &mut fidl::encoding::Decoder<
2833 '_,
2834 fidl::encoding::DefaultFuchsiaResourceDialect,
2835 >,
2836 offset: usize,
2837 mut depth: fidl::encoding::Depth,
2838 ) -> fidl::Result<()> {
2839 decoder.debug_check_bounds::<Self>(offset);
2840 #[allow(unused_variables)]
2841 let next_out_of_line = decoder.next_out_of_line();
2842 let handles_before = decoder.remaining_handles();
2843 let (ordinal, inlined, num_bytes, num_handles) =
2844 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2845
2846 let member_inline_size = match ordinal {
2847 1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2848 decoder.context,
2849 ),
2850 2 => <fidl::encoding::HandleType<
2851 fidl::Socket,
2852 { fidl::ObjectType::SOCKET.into_raw() },
2853 2147483648,
2854 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2855 _ => return Err(fidl::Error::UnknownUnionTag),
2856 };
2857
2858 if inlined != (member_inline_size <= 4) {
2859 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2860 }
2861 let _inner_offset;
2862 if inlined {
2863 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2864 _inner_offset = offset + 8;
2865 } else {
2866 depth.increment()?;
2867 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2868 }
2869 match ordinal {
2870 1 => {
2871 #[allow(irrefutable_let_patterns)]
2872 if let Body::Buffer(_) = self {
2873 } else {
2875 *self = Body::Buffer(fidl::new_empty!(
2877 fidl_fuchsia_mem::Buffer,
2878 fidl::encoding::DefaultFuchsiaResourceDialect
2879 ));
2880 }
2881 #[allow(irrefutable_let_patterns)]
2882 if let Body::Buffer(ref mut val) = self {
2883 fidl::decode!(
2884 fidl_fuchsia_mem::Buffer,
2885 fidl::encoding::DefaultFuchsiaResourceDialect,
2886 val,
2887 decoder,
2888 _inner_offset,
2889 depth
2890 )?;
2891 } else {
2892 unreachable!()
2893 }
2894 }
2895 2 => {
2896 #[allow(irrefutable_let_patterns)]
2897 if let Body::Stream(_) = self {
2898 } else {
2900 *self = Body::Stream(
2902 fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2903 );
2904 }
2905 #[allow(irrefutable_let_patterns)]
2906 if let Body::Stream(ref mut val) = self {
2907 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2908 } else {
2909 unreachable!()
2910 }
2911 }
2912 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2913 }
2914 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2915 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2916 }
2917 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2918 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2919 }
2920 Ok(())
2921 }
2922 }
2923}