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