1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_net_http_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, PartialEq)]
14pub struct LoaderClientOnResponseRequest {
15 pub response: Response,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
19 for LoaderClientOnResponseRequest
20{
21}
22
23#[derive(Debug, PartialEq)]
24pub struct LoaderFetchRequest {
25 pub request: Request,
26}
27
28impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for LoaderFetchRequest {}
29
30#[derive(Debug, PartialEq)]
31pub struct LoaderFetchResponse {
32 pub response: Response,
33}
34
35impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for LoaderFetchResponse {}
36
37#[derive(Debug, PartialEq)]
38pub struct LoaderStartRequest {
39 pub request: Request,
40 pub client: fdomain_client::fidl::ClientEnd<LoaderClientMarker>,
41}
42
43impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for LoaderStartRequest {}
44
45#[derive(Debug, Default, PartialEq)]
47pub struct Request {
48 pub method: Option<String>,
52 pub url: Option<String>,
56 pub headers: Option<Vec<Header>>,
58 pub body: Option<Body>,
62 pub deadline: Option<i64>,
65 #[doc(hidden)]
66 pub __source_breaking: fidl::marker::SourceBreaking,
67}
68
69impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for Request {}
70
71#[derive(Debug, Default, PartialEq)]
73pub struct Response {
74 pub error: Option<Error>,
77 pub body: Option<fdomain_client::Socket>,
79 pub final_url: Option<String>,
81 pub status_code: Option<u32>,
83 pub status_line: Option<Vec<u8>>,
85 pub headers: Option<Vec<Header>>,
87 pub redirect: Option<RedirectTarget>,
89 #[doc(hidden)]
90 pub __source_breaking: fidl::marker::SourceBreaking,
91}
92
93impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for Response {}
94
95#[derive(Debug, PartialEq)]
97pub enum Body {
98 Buffer(fdomain_fuchsia_mem::Buffer),
100 Stream(fdomain_client::Socket),
102}
103
104impl Body {
105 #[inline]
106 pub fn ordinal(&self) -> u64 {
107 match *self {
108 Self::Buffer(_) => 1,
109 Self::Stream(_) => 2,
110 }
111 }
112}
113
114impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for Body {}
115
116#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
117pub struct LoaderMarker;
118
119impl fdomain_client::fidl::ProtocolMarker for LoaderMarker {
120 type Proxy = LoaderProxy;
121 type RequestStream = LoaderRequestStream;
122
123 const DEBUG_NAME: &'static str = "fuchsia.net.http.Loader";
124}
125impl fdomain_client::fidl::DiscoverableProtocolMarker for LoaderMarker {}
126
127pub trait LoaderProxyInterface: Send + Sync {
128 type FetchResponseFut: std::future::Future<Output = Result<Response, fidl::Error>> + Send;
129 fn r#fetch(&self, request: Request) -> Self::FetchResponseFut;
130 fn r#start(
131 &self,
132 request: Request,
133 client: fdomain_client::fidl::ClientEnd<LoaderClientMarker>,
134 ) -> Result<(), fidl::Error>;
135}
136
137#[derive(Debug, Clone)]
138pub struct LoaderProxy {
139 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
140}
141
142impl fdomain_client::fidl::Proxy for LoaderProxy {
143 type Protocol = LoaderMarker;
144
145 fn from_channel(inner: fdomain_client::Channel) -> Self {
146 Self::new(inner)
147 }
148
149 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
150 self.client.into_channel().map_err(|client| Self { client })
151 }
152
153 fn as_channel(&self) -> &fdomain_client::Channel {
154 self.client.as_channel()
155 }
156}
157
158impl LoaderProxy {
159 pub fn new(channel: fdomain_client::Channel) -> Self {
161 let protocol_name = <LoaderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
162 Self { client: fidl::client::Client::new(channel, protocol_name) }
163 }
164
165 pub fn take_event_stream(&self) -> LoaderEventStream {
171 LoaderEventStream { event_receiver: self.client.take_event_receiver() }
172 }
173
174 pub fn r#fetch(
181 &self,
182 mut request: Request,
183 ) -> fidl::client::QueryResponseFut<Response, fdomain_client::fidl::FDomainResourceDialect>
184 {
185 LoaderProxyInterface::r#fetch(self, request)
186 }
187
188 pub fn r#start(
195 &self,
196 mut request: Request,
197 mut client: fdomain_client::fidl::ClientEnd<LoaderClientMarker>,
198 ) -> Result<(), fidl::Error> {
199 LoaderProxyInterface::r#start(self, request, client)
200 }
201}
202
203impl LoaderProxyInterface for LoaderProxy {
204 type FetchResponseFut =
205 fidl::client::QueryResponseFut<Response, fdomain_client::fidl::FDomainResourceDialect>;
206 fn r#fetch(&self, mut request: Request) -> Self::FetchResponseFut {
207 fn _decode(
208 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
209 ) -> Result<Response, fidl::Error> {
210 let _response = fidl::client::decode_transaction_body::<
211 LoaderFetchResponse,
212 fdomain_client::fidl::FDomainResourceDialect,
213 0x66d973be70dc2029,
214 >(_buf?)?;
215 Ok(_response.response)
216 }
217 self.client.send_query_and_decode::<LoaderFetchRequest, Response>(
218 (&mut request,),
219 0x66d973be70dc2029,
220 fidl::encoding::DynamicFlags::empty(),
221 _decode,
222 )
223 }
224
225 fn r#start(
226 &self,
227 mut request: Request,
228 mut client: fdomain_client::fidl::ClientEnd<LoaderClientMarker>,
229 ) -> Result<(), fidl::Error> {
230 self.client.send::<LoaderStartRequest>(
231 (&mut request, client),
232 0x7165335e1d7dd48e,
233 fidl::encoding::DynamicFlags::empty(),
234 )
235 }
236}
237
238pub struct LoaderEventStream {
239 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
240}
241
242impl std::marker::Unpin for LoaderEventStream {}
243
244impl futures::stream::FusedStream for LoaderEventStream {
245 fn is_terminated(&self) -> bool {
246 self.event_receiver.is_terminated()
247 }
248}
249
250impl futures::Stream for LoaderEventStream {
251 type Item = Result<LoaderEvent, fidl::Error>;
252
253 fn poll_next(
254 mut self: std::pin::Pin<&mut Self>,
255 cx: &mut std::task::Context<'_>,
256 ) -> std::task::Poll<Option<Self::Item>> {
257 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
258 &mut self.event_receiver,
259 cx
260 )?) {
261 Some(buf) => std::task::Poll::Ready(Some(LoaderEvent::decode(buf))),
262 None => std::task::Poll::Ready(None),
263 }
264 }
265}
266
267#[derive(Debug)]
268pub enum LoaderEvent {}
269
270impl LoaderEvent {
271 fn decode(
273 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
274 ) -> Result<LoaderEvent, fidl::Error> {
275 let (bytes, _handles) = buf.split_mut();
276 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
277 debug_assert_eq!(tx_header.tx_id, 0);
278 match tx_header.ordinal {
279 _ => Err(fidl::Error::UnknownOrdinal {
280 ordinal: tx_header.ordinal,
281 protocol_name: <LoaderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
282 }),
283 }
284 }
285}
286
287pub struct LoaderRequestStream {
289 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
290 is_terminated: bool,
291}
292
293impl std::marker::Unpin for LoaderRequestStream {}
294
295impl futures::stream::FusedStream for LoaderRequestStream {
296 fn is_terminated(&self) -> bool {
297 self.is_terminated
298 }
299}
300
301impl fdomain_client::fidl::RequestStream for LoaderRequestStream {
302 type Protocol = LoaderMarker;
303 type ControlHandle = LoaderControlHandle;
304
305 fn from_channel(channel: fdomain_client::Channel) -> Self {
306 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
307 }
308
309 fn control_handle(&self) -> Self::ControlHandle {
310 LoaderControlHandle { inner: self.inner.clone() }
311 }
312
313 fn into_inner(
314 self,
315 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
316 {
317 (self.inner, self.is_terminated)
318 }
319
320 fn from_inner(
321 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
322 is_terminated: bool,
323 ) -> Self {
324 Self { inner, is_terminated }
325 }
326}
327
328impl futures::Stream for LoaderRequestStream {
329 type Item = Result<LoaderRequest, fidl::Error>;
330
331 fn poll_next(
332 mut self: std::pin::Pin<&mut Self>,
333 cx: &mut std::task::Context<'_>,
334 ) -> std::task::Poll<Option<Self::Item>> {
335 let this = &mut *self;
336 if this.inner.check_shutdown(cx) {
337 this.is_terminated = true;
338 return std::task::Poll::Ready(None);
339 }
340 if this.is_terminated {
341 panic!("polled LoaderRequestStream after completion");
342 }
343 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
344 |bytes, handles| {
345 match this.inner.channel().read_etc(cx, bytes, handles) {
346 std::task::Poll::Ready(Ok(())) => {}
347 std::task::Poll::Pending => return std::task::Poll::Pending,
348 std::task::Poll::Ready(Err(None)) => {
349 this.is_terminated = true;
350 return std::task::Poll::Ready(None);
351 }
352 std::task::Poll::Ready(Err(Some(e))) => {
353 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
354 e.into(),
355 ))));
356 }
357 }
358
359 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
361
362 std::task::Poll::Ready(Some(match header.ordinal {
363 0x66d973be70dc2029 => {
364 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
365 let mut req = fidl::new_empty!(
366 LoaderFetchRequest,
367 fdomain_client::fidl::FDomainResourceDialect
368 );
369 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LoaderFetchRequest>(&header, _body_bytes, handles, &mut req)?;
370 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
371 Ok(LoaderRequest::Fetch {
372 request: req.request,
373
374 responder: LoaderFetchResponder {
375 control_handle: std::mem::ManuallyDrop::new(control_handle),
376 tx_id: header.tx_id,
377 },
378 })
379 }
380 0x7165335e1d7dd48e => {
381 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
382 let mut req = fidl::new_empty!(
383 LoaderStartRequest,
384 fdomain_client::fidl::FDomainResourceDialect
385 );
386 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LoaderStartRequest>(&header, _body_bytes, handles, &mut req)?;
387 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
388 Ok(LoaderRequest::Start {
389 request: req.request,
390 client: req.client,
391
392 control_handle,
393 })
394 }
395 _ => Err(fidl::Error::UnknownOrdinal {
396 ordinal: header.ordinal,
397 protocol_name:
398 <LoaderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
399 }),
400 }))
401 },
402 )
403 }
404}
405
406#[derive(Debug)]
412pub enum LoaderRequest {
413 Fetch { request: Request, responder: LoaderFetchResponder },
420 Start {
427 request: Request,
428 client: fdomain_client::fidl::ClientEnd<LoaderClientMarker>,
429 control_handle: LoaderControlHandle,
430 },
431}
432
433impl LoaderRequest {
434 #[allow(irrefutable_let_patterns)]
435 pub fn into_fetch(self) -> Option<(Request, LoaderFetchResponder)> {
436 if let LoaderRequest::Fetch { request, responder } = self {
437 Some((request, responder))
438 } else {
439 None
440 }
441 }
442
443 #[allow(irrefutable_let_patterns)]
444 pub fn into_start(
445 self,
446 ) -> Option<(Request, fdomain_client::fidl::ClientEnd<LoaderClientMarker>, LoaderControlHandle)>
447 {
448 if let LoaderRequest::Start { request, client, control_handle } = self {
449 Some((request, client, control_handle))
450 } else {
451 None
452 }
453 }
454
455 pub fn method_name(&self) -> &'static str {
457 match *self {
458 LoaderRequest::Fetch { .. } => "fetch",
459 LoaderRequest::Start { .. } => "start",
460 }
461 }
462}
463
464#[derive(Debug, Clone)]
465pub struct LoaderControlHandle {
466 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
467}
468
469impl LoaderControlHandle {
470 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
471 self.inner.shutdown_with_epitaph(status.into())
472 }
473}
474
475impl fdomain_client::fidl::ControlHandle for LoaderControlHandle {
476 fn shutdown(&self) {
477 self.inner.shutdown()
478 }
479
480 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
481 self.inner.shutdown_with_epitaph(status)
482 }
483
484 fn is_closed(&self) -> bool {
485 self.inner.channel().is_closed()
486 }
487 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
488 self.inner.channel().on_closed()
489 }
490}
491
492impl LoaderControlHandle {}
493
494#[must_use = "FIDL methods require a response to be sent"]
495#[derive(Debug)]
496pub struct LoaderFetchResponder {
497 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
498 tx_id: u32,
499}
500
501impl std::ops::Drop for LoaderFetchResponder {
505 fn drop(&mut self) {
506 self.control_handle.shutdown();
507 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
509 }
510}
511
512impl fdomain_client::fidl::Responder for LoaderFetchResponder {
513 type ControlHandle = LoaderControlHandle;
514
515 fn control_handle(&self) -> &LoaderControlHandle {
516 &self.control_handle
517 }
518
519 fn drop_without_shutdown(mut self) {
520 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
522 std::mem::forget(self);
524 }
525}
526
527impl LoaderFetchResponder {
528 pub fn send(self, mut response: Response) -> Result<(), fidl::Error> {
532 let _result = self.send_raw(response);
533 if _result.is_err() {
534 self.control_handle.shutdown();
535 }
536 self.drop_without_shutdown();
537 _result
538 }
539
540 pub fn send_no_shutdown_on_err(self, mut response: Response) -> Result<(), fidl::Error> {
542 let _result = self.send_raw(response);
543 self.drop_without_shutdown();
544 _result
545 }
546
547 fn send_raw(&self, mut response: Response) -> Result<(), fidl::Error> {
548 self.control_handle.inner.send::<LoaderFetchResponse>(
549 (&mut response,),
550 self.tx_id,
551 0x66d973be70dc2029,
552 fidl::encoding::DynamicFlags::empty(),
553 )
554 }
555}
556
557#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
558pub struct LoaderClientMarker;
559
560impl fdomain_client::fidl::ProtocolMarker for LoaderClientMarker {
561 type Proxy = LoaderClientProxy;
562 type RequestStream = LoaderClientRequestStream;
563
564 const DEBUG_NAME: &'static str = "(anonymous) LoaderClient";
565}
566
567pub trait LoaderClientProxyInterface: Send + Sync {
568 type OnResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
569 fn r#on_response(&self, response: Response) -> Self::OnResponseResponseFut;
570}
571
572#[derive(Debug, Clone)]
573pub struct LoaderClientProxy {
574 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
575}
576
577impl fdomain_client::fidl::Proxy for LoaderClientProxy {
578 type Protocol = LoaderClientMarker;
579
580 fn from_channel(inner: fdomain_client::Channel) -> Self {
581 Self::new(inner)
582 }
583
584 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
585 self.client.into_channel().map_err(|client| Self { client })
586 }
587
588 fn as_channel(&self) -> &fdomain_client::Channel {
589 self.client.as_channel()
590 }
591}
592
593impl LoaderClientProxy {
594 pub fn new(channel: fdomain_client::Channel) -> Self {
596 let protocol_name =
597 <LoaderClientMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
598 Self { client: fidl::client::Client::new(channel, protocol_name) }
599 }
600
601 pub fn take_event_stream(&self) -> LoaderClientEventStream {
607 LoaderClientEventStream { event_receiver: self.client.take_event_receiver() }
608 }
609
610 pub fn r#on_response(
617 &self,
618 mut response: Response,
619 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
620 LoaderClientProxyInterface::r#on_response(self, response)
621 }
622}
623
624impl LoaderClientProxyInterface for LoaderClientProxy {
625 type OnResponseResponseFut =
626 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
627 fn r#on_response(&self, mut response: Response) -> Self::OnResponseResponseFut {
628 fn _decode(
629 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
630 ) -> Result<(), fidl::Error> {
631 let _response = fidl::client::decode_transaction_body::<
632 fidl::encoding::EmptyPayload,
633 fdomain_client::fidl::FDomainResourceDialect,
634 0x595ada171c7ebf89,
635 >(_buf?)?;
636 Ok(_response)
637 }
638 self.client.send_query_and_decode::<LoaderClientOnResponseRequest, ()>(
639 (&mut response,),
640 0x595ada171c7ebf89,
641 fidl::encoding::DynamicFlags::empty(),
642 _decode,
643 )
644 }
645}
646
647pub struct LoaderClientEventStream {
648 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
649}
650
651impl std::marker::Unpin for LoaderClientEventStream {}
652
653impl futures::stream::FusedStream for LoaderClientEventStream {
654 fn is_terminated(&self) -> bool {
655 self.event_receiver.is_terminated()
656 }
657}
658
659impl futures::Stream for LoaderClientEventStream {
660 type Item = Result<LoaderClientEvent, fidl::Error>;
661
662 fn poll_next(
663 mut self: std::pin::Pin<&mut Self>,
664 cx: &mut std::task::Context<'_>,
665 ) -> std::task::Poll<Option<Self::Item>> {
666 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
667 &mut self.event_receiver,
668 cx
669 )?) {
670 Some(buf) => std::task::Poll::Ready(Some(LoaderClientEvent::decode(buf))),
671 None => std::task::Poll::Ready(None),
672 }
673 }
674}
675
676#[derive(Debug)]
677pub enum LoaderClientEvent {}
678
679impl LoaderClientEvent {
680 fn decode(
682 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
683 ) -> Result<LoaderClientEvent, fidl::Error> {
684 let (bytes, _handles) = buf.split_mut();
685 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
686 debug_assert_eq!(tx_header.tx_id, 0);
687 match tx_header.ordinal {
688 _ => Err(fidl::Error::UnknownOrdinal {
689 ordinal: tx_header.ordinal,
690 protocol_name:
691 <LoaderClientMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
692 }),
693 }
694 }
695}
696
697pub struct LoaderClientRequestStream {
699 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
700 is_terminated: bool,
701}
702
703impl std::marker::Unpin for LoaderClientRequestStream {}
704
705impl futures::stream::FusedStream for LoaderClientRequestStream {
706 fn is_terminated(&self) -> bool {
707 self.is_terminated
708 }
709}
710
711impl fdomain_client::fidl::RequestStream for LoaderClientRequestStream {
712 type Protocol = LoaderClientMarker;
713 type ControlHandle = LoaderClientControlHandle;
714
715 fn from_channel(channel: fdomain_client::Channel) -> Self {
716 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
717 }
718
719 fn control_handle(&self) -> Self::ControlHandle {
720 LoaderClientControlHandle { inner: self.inner.clone() }
721 }
722
723 fn into_inner(
724 self,
725 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
726 {
727 (self.inner, self.is_terminated)
728 }
729
730 fn from_inner(
731 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
732 is_terminated: bool,
733 ) -> Self {
734 Self { inner, is_terminated }
735 }
736}
737
738impl futures::Stream for LoaderClientRequestStream {
739 type Item = Result<LoaderClientRequest, fidl::Error>;
740
741 fn poll_next(
742 mut self: std::pin::Pin<&mut Self>,
743 cx: &mut std::task::Context<'_>,
744 ) -> std::task::Poll<Option<Self::Item>> {
745 let this = &mut *self;
746 if this.inner.check_shutdown(cx) {
747 this.is_terminated = true;
748 return std::task::Poll::Ready(None);
749 }
750 if this.is_terminated {
751 panic!("polled LoaderClientRequestStream after completion");
752 }
753 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
754 |bytes, handles| {
755 match this.inner.channel().read_etc(cx, bytes, handles) {
756 std::task::Poll::Ready(Ok(())) => {}
757 std::task::Poll::Pending => return std::task::Poll::Pending,
758 std::task::Poll::Ready(Err(None)) => {
759 this.is_terminated = true;
760 return std::task::Poll::Ready(None);
761 }
762 std::task::Poll::Ready(Err(Some(e))) => {
763 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
764 e.into(),
765 ))));
766 }
767 }
768
769 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
771
772 std::task::Poll::Ready(Some(match header.ordinal {
773 0x595ada171c7ebf89 => {
774 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
775 let mut req = fidl::new_empty!(
776 LoaderClientOnResponseRequest,
777 fdomain_client::fidl::FDomainResourceDialect
778 );
779 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LoaderClientOnResponseRequest>(&header, _body_bytes, handles, &mut req)?;
780 let control_handle =
781 LoaderClientControlHandle { inner: this.inner.clone() };
782 Ok(LoaderClientRequest::OnResponse {
783 response: req.response,
784
785 responder: LoaderClientOnResponseResponder {
786 control_handle: std::mem::ManuallyDrop::new(control_handle),
787 tx_id: header.tx_id,
788 },
789 })
790 }
791 _ => Err(fidl::Error::UnknownOrdinal {
792 ordinal: header.ordinal,
793 protocol_name:
794 <LoaderClientMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
795 }),
796 }))
797 },
798 )
799 }
800}
801
802#[derive(Debug)]
806pub enum LoaderClientRequest {
807 OnResponse { response: Response, responder: LoaderClientOnResponseResponder },
814}
815
816impl LoaderClientRequest {
817 #[allow(irrefutable_let_patterns)]
818 pub fn into_on_response(self) -> Option<(Response, LoaderClientOnResponseResponder)> {
819 if let LoaderClientRequest::OnResponse { response, responder } = self {
820 Some((response, responder))
821 } else {
822 None
823 }
824 }
825
826 pub fn method_name(&self) -> &'static str {
828 match *self {
829 LoaderClientRequest::OnResponse { .. } => "on_response",
830 }
831 }
832}
833
834#[derive(Debug, Clone)]
835pub struct LoaderClientControlHandle {
836 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
837}
838
839impl LoaderClientControlHandle {
840 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
841 self.inner.shutdown_with_epitaph(status.into())
842 }
843}
844
845impl fdomain_client::fidl::ControlHandle for LoaderClientControlHandle {
846 fn shutdown(&self) {
847 self.inner.shutdown()
848 }
849
850 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
851 self.inner.shutdown_with_epitaph(status)
852 }
853
854 fn is_closed(&self) -> bool {
855 self.inner.channel().is_closed()
856 }
857 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
858 self.inner.channel().on_closed()
859 }
860}
861
862impl LoaderClientControlHandle {}
863
864#[must_use = "FIDL methods require a response to be sent"]
865#[derive(Debug)]
866pub struct LoaderClientOnResponseResponder {
867 control_handle: std::mem::ManuallyDrop<LoaderClientControlHandle>,
868 tx_id: u32,
869}
870
871impl std::ops::Drop for LoaderClientOnResponseResponder {
875 fn drop(&mut self) {
876 self.control_handle.shutdown();
877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
879 }
880}
881
882impl fdomain_client::fidl::Responder for LoaderClientOnResponseResponder {
883 type ControlHandle = LoaderClientControlHandle;
884
885 fn control_handle(&self) -> &LoaderClientControlHandle {
886 &self.control_handle
887 }
888
889 fn drop_without_shutdown(mut self) {
890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
892 std::mem::forget(self);
894 }
895}
896
897impl LoaderClientOnResponseResponder {
898 pub fn send(self) -> Result<(), fidl::Error> {
902 let _result = self.send_raw();
903 if _result.is_err() {
904 self.control_handle.shutdown();
905 }
906 self.drop_without_shutdown();
907 _result
908 }
909
910 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
912 let _result = self.send_raw();
913 self.drop_without_shutdown();
914 _result
915 }
916
917 fn send_raw(&self) -> Result<(), fidl::Error> {
918 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
919 (),
920 self.tx_id,
921 0x595ada171c7ebf89,
922 fidl::encoding::DynamicFlags::empty(),
923 )
924 }
925}
926
927mod internal {
928 use super::*;
929
930 impl fidl::encoding::ResourceTypeMarker for LoaderClientOnResponseRequest {
931 type Borrowed<'a> = &'a mut Self;
932 fn take_or_borrow<'a>(
933 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
934 ) -> Self::Borrowed<'a> {
935 value
936 }
937 }
938
939 unsafe impl fidl::encoding::TypeMarker for LoaderClientOnResponseRequest {
940 type Owned = Self;
941
942 #[inline(always)]
943 fn inline_align(_context: fidl::encoding::Context) -> usize {
944 8
945 }
946
947 #[inline(always)]
948 fn inline_size(_context: fidl::encoding::Context) -> usize {
949 16
950 }
951 }
952
953 unsafe impl
954 fidl::encoding::Encode<
955 LoaderClientOnResponseRequest,
956 fdomain_client::fidl::FDomainResourceDialect,
957 > for &mut LoaderClientOnResponseRequest
958 {
959 #[inline]
960 unsafe fn encode(
961 self,
962 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
963 offset: usize,
964 _depth: fidl::encoding::Depth,
965 ) -> fidl::Result<()> {
966 encoder.debug_check_bounds::<LoaderClientOnResponseRequest>(offset);
967 fidl::encoding::Encode::<
969 LoaderClientOnResponseRequest,
970 fdomain_client::fidl::FDomainResourceDialect,
971 >::encode(
972 (<Response as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
973 &mut self.response,
974 ),),
975 encoder,
976 offset,
977 _depth,
978 )
979 }
980 }
981 unsafe impl<T0: fidl::encoding::Encode<Response, fdomain_client::fidl::FDomainResourceDialect>>
982 fidl::encoding::Encode<
983 LoaderClientOnResponseRequest,
984 fdomain_client::fidl::FDomainResourceDialect,
985 > for (T0,)
986 {
987 #[inline]
988 unsafe fn encode(
989 self,
990 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
991 offset: usize,
992 depth: fidl::encoding::Depth,
993 ) -> fidl::Result<()> {
994 encoder.debug_check_bounds::<LoaderClientOnResponseRequest>(offset);
995 self.0.encode(encoder, offset + 0, depth)?;
999 Ok(())
1000 }
1001 }
1002
1003 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1004 for LoaderClientOnResponseRequest
1005 {
1006 #[inline(always)]
1007 fn new_empty() -> Self {
1008 Self {
1009 response: fidl::new_empty!(Response, fdomain_client::fidl::FDomainResourceDialect),
1010 }
1011 }
1012
1013 #[inline]
1014 unsafe fn decode(
1015 &mut self,
1016 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1017 offset: usize,
1018 _depth: fidl::encoding::Depth,
1019 ) -> fidl::Result<()> {
1020 decoder.debug_check_bounds::<Self>(offset);
1021 fidl::decode!(
1023 Response,
1024 fdomain_client::fidl::FDomainResourceDialect,
1025 &mut self.response,
1026 decoder,
1027 offset + 0,
1028 _depth
1029 )?;
1030 Ok(())
1031 }
1032 }
1033
1034 impl fidl::encoding::ResourceTypeMarker for LoaderFetchRequest {
1035 type Borrowed<'a> = &'a mut Self;
1036 fn take_or_borrow<'a>(
1037 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1038 ) -> Self::Borrowed<'a> {
1039 value
1040 }
1041 }
1042
1043 unsafe impl fidl::encoding::TypeMarker for LoaderFetchRequest {
1044 type Owned = Self;
1045
1046 #[inline(always)]
1047 fn inline_align(_context: fidl::encoding::Context) -> usize {
1048 8
1049 }
1050
1051 #[inline(always)]
1052 fn inline_size(_context: fidl::encoding::Context) -> usize {
1053 16
1054 }
1055 }
1056
1057 unsafe impl
1058 fidl::encoding::Encode<LoaderFetchRequest, fdomain_client::fidl::FDomainResourceDialect>
1059 for &mut LoaderFetchRequest
1060 {
1061 #[inline]
1062 unsafe fn encode(
1063 self,
1064 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1065 offset: usize,
1066 _depth: fidl::encoding::Depth,
1067 ) -> fidl::Result<()> {
1068 encoder.debug_check_bounds::<LoaderFetchRequest>(offset);
1069 fidl::encoding::Encode::<LoaderFetchRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1071 (
1072 <Request as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1073 ),
1074 encoder, offset, _depth
1075 )
1076 }
1077 }
1078 unsafe impl<T0: fidl::encoding::Encode<Request, fdomain_client::fidl::FDomainResourceDialect>>
1079 fidl::encoding::Encode<LoaderFetchRequest, fdomain_client::fidl::FDomainResourceDialect>
1080 for (T0,)
1081 {
1082 #[inline]
1083 unsafe fn encode(
1084 self,
1085 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1086 offset: usize,
1087 depth: fidl::encoding::Depth,
1088 ) -> fidl::Result<()> {
1089 encoder.debug_check_bounds::<LoaderFetchRequest>(offset);
1090 self.0.encode(encoder, offset + 0, depth)?;
1094 Ok(())
1095 }
1096 }
1097
1098 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1099 for LoaderFetchRequest
1100 {
1101 #[inline(always)]
1102 fn new_empty() -> Self {
1103 Self {
1104 request: fidl::new_empty!(Request, fdomain_client::fidl::FDomainResourceDialect),
1105 }
1106 }
1107
1108 #[inline]
1109 unsafe fn decode(
1110 &mut self,
1111 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1112 offset: usize,
1113 _depth: fidl::encoding::Depth,
1114 ) -> fidl::Result<()> {
1115 decoder.debug_check_bounds::<Self>(offset);
1116 fidl::decode!(
1118 Request,
1119 fdomain_client::fidl::FDomainResourceDialect,
1120 &mut self.request,
1121 decoder,
1122 offset + 0,
1123 _depth
1124 )?;
1125 Ok(())
1126 }
1127 }
1128
1129 impl fidl::encoding::ResourceTypeMarker for LoaderFetchResponse {
1130 type Borrowed<'a> = &'a mut Self;
1131 fn take_or_borrow<'a>(
1132 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1133 ) -> Self::Borrowed<'a> {
1134 value
1135 }
1136 }
1137
1138 unsafe impl fidl::encoding::TypeMarker for LoaderFetchResponse {
1139 type Owned = Self;
1140
1141 #[inline(always)]
1142 fn inline_align(_context: fidl::encoding::Context) -> usize {
1143 8
1144 }
1145
1146 #[inline(always)]
1147 fn inline_size(_context: fidl::encoding::Context) -> usize {
1148 16
1149 }
1150 }
1151
1152 unsafe impl
1153 fidl::encoding::Encode<LoaderFetchResponse, fdomain_client::fidl::FDomainResourceDialect>
1154 for &mut LoaderFetchResponse
1155 {
1156 #[inline]
1157 unsafe fn encode(
1158 self,
1159 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1160 offset: usize,
1161 _depth: fidl::encoding::Depth,
1162 ) -> fidl::Result<()> {
1163 encoder.debug_check_bounds::<LoaderFetchResponse>(offset);
1164 fidl::encoding::Encode::<
1166 LoaderFetchResponse,
1167 fdomain_client::fidl::FDomainResourceDialect,
1168 >::encode(
1169 (<Response as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1170 &mut self.response,
1171 ),),
1172 encoder,
1173 offset,
1174 _depth,
1175 )
1176 }
1177 }
1178 unsafe impl<T0: fidl::encoding::Encode<Response, fdomain_client::fidl::FDomainResourceDialect>>
1179 fidl::encoding::Encode<LoaderFetchResponse, fdomain_client::fidl::FDomainResourceDialect>
1180 for (T0,)
1181 {
1182 #[inline]
1183 unsafe fn encode(
1184 self,
1185 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1186 offset: usize,
1187 depth: fidl::encoding::Depth,
1188 ) -> fidl::Result<()> {
1189 encoder.debug_check_bounds::<LoaderFetchResponse>(offset);
1190 self.0.encode(encoder, offset + 0, depth)?;
1194 Ok(())
1195 }
1196 }
1197
1198 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1199 for LoaderFetchResponse
1200 {
1201 #[inline(always)]
1202 fn new_empty() -> Self {
1203 Self {
1204 response: fidl::new_empty!(Response, fdomain_client::fidl::FDomainResourceDialect),
1205 }
1206 }
1207
1208 #[inline]
1209 unsafe fn decode(
1210 &mut self,
1211 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1212 offset: usize,
1213 _depth: fidl::encoding::Depth,
1214 ) -> fidl::Result<()> {
1215 decoder.debug_check_bounds::<Self>(offset);
1216 fidl::decode!(
1218 Response,
1219 fdomain_client::fidl::FDomainResourceDialect,
1220 &mut self.response,
1221 decoder,
1222 offset + 0,
1223 _depth
1224 )?;
1225 Ok(())
1226 }
1227 }
1228
1229 impl fidl::encoding::ResourceTypeMarker for LoaderStartRequest {
1230 type Borrowed<'a> = &'a mut Self;
1231 fn take_or_borrow<'a>(
1232 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1233 ) -> Self::Borrowed<'a> {
1234 value
1235 }
1236 }
1237
1238 unsafe impl fidl::encoding::TypeMarker for LoaderStartRequest {
1239 type Owned = Self;
1240
1241 #[inline(always)]
1242 fn inline_align(_context: fidl::encoding::Context) -> usize {
1243 8
1244 }
1245
1246 #[inline(always)]
1247 fn inline_size(_context: fidl::encoding::Context) -> usize {
1248 24
1249 }
1250 }
1251
1252 unsafe impl
1253 fidl::encoding::Encode<LoaderStartRequest, fdomain_client::fidl::FDomainResourceDialect>
1254 for &mut LoaderStartRequest
1255 {
1256 #[inline]
1257 unsafe fn encode(
1258 self,
1259 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1260 offset: usize,
1261 _depth: fidl::encoding::Depth,
1262 ) -> fidl::Result<()> {
1263 encoder.debug_check_bounds::<LoaderStartRequest>(offset);
1264 fidl::encoding::Encode::<LoaderStartRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1266 (
1267 <Request as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1268 <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<LoaderClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
1269 ),
1270 encoder, offset, _depth
1271 )
1272 }
1273 }
1274 unsafe impl<
1275 T0: fidl::encoding::Encode<Request, fdomain_client::fidl::FDomainResourceDialect>,
1276 T1: fidl::encoding::Encode<
1277 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<LoaderClientMarker>>,
1278 fdomain_client::fidl::FDomainResourceDialect,
1279 >,
1280 > fidl::encoding::Encode<LoaderStartRequest, fdomain_client::fidl::FDomainResourceDialect>
1281 for (T0, T1)
1282 {
1283 #[inline]
1284 unsafe fn encode(
1285 self,
1286 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1287 offset: usize,
1288 depth: fidl::encoding::Depth,
1289 ) -> fidl::Result<()> {
1290 encoder.debug_check_bounds::<LoaderStartRequest>(offset);
1291 unsafe {
1294 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1295 (ptr as *mut u64).write_unaligned(0);
1296 }
1297 self.0.encode(encoder, offset + 0, depth)?;
1299 self.1.encode(encoder, offset + 16, depth)?;
1300 Ok(())
1301 }
1302 }
1303
1304 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1305 for LoaderStartRequest
1306 {
1307 #[inline(always)]
1308 fn new_empty() -> Self {
1309 Self {
1310 request: fidl::new_empty!(Request, fdomain_client::fidl::FDomainResourceDialect),
1311 client: fidl::new_empty!(
1312 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<LoaderClientMarker>>,
1313 fdomain_client::fidl::FDomainResourceDialect
1314 ),
1315 }
1316 }
1317
1318 #[inline]
1319 unsafe fn decode(
1320 &mut self,
1321 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1322 offset: usize,
1323 _depth: fidl::encoding::Depth,
1324 ) -> fidl::Result<()> {
1325 decoder.debug_check_bounds::<Self>(offset);
1326 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1328 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1329 let mask = 0xffffffff00000000u64;
1330 let maskedval = padval & mask;
1331 if maskedval != 0 {
1332 return Err(fidl::Error::NonZeroPadding {
1333 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1334 });
1335 }
1336 fidl::decode!(
1337 Request,
1338 fdomain_client::fidl::FDomainResourceDialect,
1339 &mut self.request,
1340 decoder,
1341 offset + 0,
1342 _depth
1343 )?;
1344 fidl::decode!(
1345 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<LoaderClientMarker>>,
1346 fdomain_client::fidl::FDomainResourceDialect,
1347 &mut self.client,
1348 decoder,
1349 offset + 16,
1350 _depth
1351 )?;
1352 Ok(())
1353 }
1354 }
1355
1356 impl Request {
1357 #[inline(always)]
1358 fn max_ordinal_present(&self) -> u64 {
1359 if let Some(_) = self.deadline {
1360 return 5;
1361 }
1362 if let Some(_) = self.body {
1363 return 4;
1364 }
1365 if let Some(_) = self.headers {
1366 return 3;
1367 }
1368 if let Some(_) = self.url {
1369 return 2;
1370 }
1371 if let Some(_) = self.method {
1372 return 1;
1373 }
1374 0
1375 }
1376 }
1377
1378 impl fidl::encoding::ResourceTypeMarker for Request {
1379 type Borrowed<'a> = &'a mut Self;
1380 fn take_or_borrow<'a>(
1381 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1382 ) -> Self::Borrowed<'a> {
1383 value
1384 }
1385 }
1386
1387 unsafe impl fidl::encoding::TypeMarker for Request {
1388 type Owned = Self;
1389
1390 #[inline(always)]
1391 fn inline_align(_context: fidl::encoding::Context) -> usize {
1392 8
1393 }
1394
1395 #[inline(always)]
1396 fn inline_size(_context: fidl::encoding::Context) -> usize {
1397 16
1398 }
1399 }
1400
1401 unsafe impl fidl::encoding::Encode<Request, fdomain_client::fidl::FDomainResourceDialect>
1402 for &mut Request
1403 {
1404 unsafe fn encode(
1405 self,
1406 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1407 offset: usize,
1408 mut depth: fidl::encoding::Depth,
1409 ) -> fidl::Result<()> {
1410 encoder.debug_check_bounds::<Request>(offset);
1411 let max_ordinal: u64 = self.max_ordinal_present();
1413 encoder.write_num(max_ordinal, offset);
1414 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1415 if max_ordinal == 0 {
1417 return Ok(());
1418 }
1419 depth.increment()?;
1420 let envelope_size = 8;
1421 let bytes_len = max_ordinal as usize * envelope_size;
1422 #[allow(unused_variables)]
1423 let offset = encoder.out_of_line_offset(bytes_len);
1424 let mut _prev_end_offset: usize = 0;
1425 if 1 > max_ordinal {
1426 return Ok(());
1427 }
1428
1429 let cur_offset: usize = (1 - 1) * envelope_size;
1432
1433 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1435
1436 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, fdomain_client::fidl::FDomainResourceDialect>(
1441 self.method.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1442 encoder, offset + cur_offset, depth
1443 )?;
1444
1445 _prev_end_offset = cur_offset + envelope_size;
1446 if 2 > max_ordinal {
1447 return Ok(());
1448 }
1449
1450 let cur_offset: usize = (2 - 1) * envelope_size;
1453
1454 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1456
1457 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fdomain_client::fidl::FDomainResourceDialect>(
1462 self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1463 encoder, offset + cur_offset, depth
1464 )?;
1465
1466 _prev_end_offset = cur_offset + envelope_size;
1467 if 3 > max_ordinal {
1468 return Ok(());
1469 }
1470
1471 let cur_offset: usize = (3 - 1) * envelope_size;
1474
1475 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1477
1478 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Header>, fdomain_client::fidl::FDomainResourceDialect>(
1483 self.headers.as_ref().map(<fidl::encoding::UnboundedVector<Header> as fidl::encoding::ValueTypeMarker>::borrow),
1484 encoder, offset + cur_offset, depth
1485 )?;
1486
1487 _prev_end_offset = cur_offset + envelope_size;
1488 if 4 > max_ordinal {
1489 return Ok(());
1490 }
1491
1492 let cur_offset: usize = (4 - 1) * envelope_size;
1495
1496 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1498
1499 fidl::encoding::encode_in_envelope_optional::<
1504 Body,
1505 fdomain_client::fidl::FDomainResourceDialect,
1506 >(
1507 self.body
1508 .as_mut()
1509 .map(<Body as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1510 encoder,
1511 offset + cur_offset,
1512 depth,
1513 )?;
1514
1515 _prev_end_offset = cur_offset + envelope_size;
1516 if 5 > max_ordinal {
1517 return Ok(());
1518 }
1519
1520 let cur_offset: usize = (5 - 1) * envelope_size;
1523
1524 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1526
1527 fidl::encoding::encode_in_envelope_optional::<
1532 i64,
1533 fdomain_client::fidl::FDomainResourceDialect,
1534 >(
1535 self.deadline.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1536 encoder,
1537 offset + cur_offset,
1538 depth,
1539 )?;
1540
1541 _prev_end_offset = cur_offset + envelope_size;
1542
1543 Ok(())
1544 }
1545 }
1546
1547 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for Request {
1548 #[inline(always)]
1549 fn new_empty() -> Self {
1550 Self::default()
1551 }
1552
1553 unsafe fn decode(
1554 &mut self,
1555 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1556 offset: usize,
1557 mut depth: fidl::encoding::Depth,
1558 ) -> fidl::Result<()> {
1559 decoder.debug_check_bounds::<Self>(offset);
1560 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1561 None => return Err(fidl::Error::NotNullable),
1562 Some(len) => len,
1563 };
1564 if len == 0 {
1566 return Ok(());
1567 };
1568 depth.increment()?;
1569 let envelope_size = 8;
1570 let bytes_len = len * envelope_size;
1571 let offset = decoder.out_of_line_offset(bytes_len)?;
1572 let mut _next_ordinal_to_read = 0;
1574 let mut next_offset = offset;
1575 let end_offset = offset + bytes_len;
1576 _next_ordinal_to_read += 1;
1577 if next_offset >= end_offset {
1578 return Ok(());
1579 }
1580
1581 while _next_ordinal_to_read < 1 {
1583 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1584 _next_ordinal_to_read += 1;
1585 next_offset += envelope_size;
1586 }
1587
1588 let next_out_of_line = decoder.next_out_of_line();
1589 let handles_before = decoder.remaining_handles();
1590 if let Some((inlined, num_bytes, num_handles)) =
1591 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1592 {
1593 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1594 if inlined != (member_inline_size <= 4) {
1595 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1596 }
1597 let inner_offset;
1598 let mut inner_depth = depth.clone();
1599 if inlined {
1600 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1601 inner_offset = next_offset;
1602 } else {
1603 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1604 inner_depth.increment()?;
1605 }
1606 let val_ref = self.method.get_or_insert_with(|| {
1607 fidl::new_empty!(
1608 fidl::encoding::BoundedString<1024>,
1609 fdomain_client::fidl::FDomainResourceDialect
1610 )
1611 });
1612 fidl::decode!(
1613 fidl::encoding::BoundedString<1024>,
1614 fdomain_client::fidl::FDomainResourceDialect,
1615 val_ref,
1616 decoder,
1617 inner_offset,
1618 inner_depth
1619 )?;
1620 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1621 {
1622 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1623 }
1624 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1625 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1626 }
1627 }
1628
1629 next_offset += envelope_size;
1630 _next_ordinal_to_read += 1;
1631 if next_offset >= end_offset {
1632 return Ok(());
1633 }
1634
1635 while _next_ordinal_to_read < 2 {
1637 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1638 _next_ordinal_to_read += 1;
1639 next_offset += envelope_size;
1640 }
1641
1642 let next_out_of_line = decoder.next_out_of_line();
1643 let handles_before = decoder.remaining_handles();
1644 if let Some((inlined, num_bytes, num_handles)) =
1645 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1646 {
1647 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1648 if inlined != (member_inline_size <= 4) {
1649 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1650 }
1651 let inner_offset;
1652 let mut inner_depth = depth.clone();
1653 if inlined {
1654 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1655 inner_offset = next_offset;
1656 } else {
1657 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1658 inner_depth.increment()?;
1659 }
1660 let val_ref = self.url.get_or_insert_with(|| {
1661 fidl::new_empty!(
1662 fidl::encoding::BoundedString<4096>,
1663 fdomain_client::fidl::FDomainResourceDialect
1664 )
1665 });
1666 fidl::decode!(
1667 fidl::encoding::BoundedString<4096>,
1668 fdomain_client::fidl::FDomainResourceDialect,
1669 val_ref,
1670 decoder,
1671 inner_offset,
1672 inner_depth
1673 )?;
1674 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1675 {
1676 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1677 }
1678 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1679 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1680 }
1681 }
1682
1683 next_offset += envelope_size;
1684 _next_ordinal_to_read += 1;
1685 if next_offset >= end_offset {
1686 return Ok(());
1687 }
1688
1689 while _next_ordinal_to_read < 3 {
1691 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1692 _next_ordinal_to_read += 1;
1693 next_offset += envelope_size;
1694 }
1695
1696 let next_out_of_line = decoder.next_out_of_line();
1697 let handles_before = decoder.remaining_handles();
1698 if let Some((inlined, num_bytes, num_handles)) =
1699 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1700 {
1701 let member_inline_size = <fidl::encoding::UnboundedVector<Header> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1702 if inlined != (member_inline_size <= 4) {
1703 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1704 }
1705 let inner_offset;
1706 let mut inner_depth = depth.clone();
1707 if inlined {
1708 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1709 inner_offset = next_offset;
1710 } else {
1711 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1712 inner_depth.increment()?;
1713 }
1714 let val_ref = self.headers.get_or_insert_with(|| {
1715 fidl::new_empty!(
1716 fidl::encoding::UnboundedVector<Header>,
1717 fdomain_client::fidl::FDomainResourceDialect
1718 )
1719 });
1720 fidl::decode!(
1721 fidl::encoding::UnboundedVector<Header>,
1722 fdomain_client::fidl::FDomainResourceDialect,
1723 val_ref,
1724 decoder,
1725 inner_offset,
1726 inner_depth
1727 )?;
1728 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1729 {
1730 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1731 }
1732 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1733 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1734 }
1735 }
1736
1737 next_offset += envelope_size;
1738 _next_ordinal_to_read += 1;
1739 if next_offset >= end_offset {
1740 return Ok(());
1741 }
1742
1743 while _next_ordinal_to_read < 4 {
1745 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1746 _next_ordinal_to_read += 1;
1747 next_offset += envelope_size;
1748 }
1749
1750 let next_out_of_line = decoder.next_out_of_line();
1751 let handles_before = decoder.remaining_handles();
1752 if let Some((inlined, num_bytes, num_handles)) =
1753 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1754 {
1755 let member_inline_size =
1756 <Body as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1757 if inlined != (member_inline_size <= 4) {
1758 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1759 }
1760 let inner_offset;
1761 let mut inner_depth = depth.clone();
1762 if inlined {
1763 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1764 inner_offset = next_offset;
1765 } else {
1766 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1767 inner_depth.increment()?;
1768 }
1769 let val_ref = self.body.get_or_insert_with(|| {
1770 fidl::new_empty!(Body, fdomain_client::fidl::FDomainResourceDialect)
1771 });
1772 fidl::decode!(
1773 Body,
1774 fdomain_client::fidl::FDomainResourceDialect,
1775 val_ref,
1776 decoder,
1777 inner_offset,
1778 inner_depth
1779 )?;
1780 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1781 {
1782 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1783 }
1784 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1785 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1786 }
1787 }
1788
1789 next_offset += envelope_size;
1790 _next_ordinal_to_read += 1;
1791 if next_offset >= end_offset {
1792 return Ok(());
1793 }
1794
1795 while _next_ordinal_to_read < 5 {
1797 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1798 _next_ordinal_to_read += 1;
1799 next_offset += envelope_size;
1800 }
1801
1802 let next_out_of_line = decoder.next_out_of_line();
1803 let handles_before = decoder.remaining_handles();
1804 if let Some((inlined, num_bytes, num_handles)) =
1805 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1806 {
1807 let member_inline_size =
1808 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1809 if inlined != (member_inline_size <= 4) {
1810 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1811 }
1812 let inner_offset;
1813 let mut inner_depth = depth.clone();
1814 if inlined {
1815 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1816 inner_offset = next_offset;
1817 } else {
1818 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1819 inner_depth.increment()?;
1820 }
1821 let val_ref = self.deadline.get_or_insert_with(|| {
1822 fidl::new_empty!(i64, fdomain_client::fidl::FDomainResourceDialect)
1823 });
1824 fidl::decode!(
1825 i64,
1826 fdomain_client::fidl::FDomainResourceDialect,
1827 val_ref,
1828 decoder,
1829 inner_offset,
1830 inner_depth
1831 )?;
1832 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1833 {
1834 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1835 }
1836 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1837 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1838 }
1839 }
1840
1841 next_offset += envelope_size;
1842
1843 while next_offset < end_offset {
1845 _next_ordinal_to_read += 1;
1846 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1847 next_offset += envelope_size;
1848 }
1849
1850 Ok(())
1851 }
1852 }
1853
1854 impl Response {
1855 #[inline(always)]
1856 fn max_ordinal_present(&self) -> u64 {
1857 if let Some(_) = self.redirect {
1858 return 7;
1859 }
1860 if let Some(_) = self.headers {
1861 return 6;
1862 }
1863 if let Some(_) = self.status_line {
1864 return 5;
1865 }
1866 if let Some(_) = self.status_code {
1867 return 4;
1868 }
1869 if let Some(_) = self.final_url {
1870 return 3;
1871 }
1872 if let Some(_) = self.body {
1873 return 2;
1874 }
1875 if let Some(_) = self.error {
1876 return 1;
1877 }
1878 0
1879 }
1880 }
1881
1882 impl fidl::encoding::ResourceTypeMarker for Response {
1883 type Borrowed<'a> = &'a mut Self;
1884 fn take_or_borrow<'a>(
1885 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1886 ) -> Self::Borrowed<'a> {
1887 value
1888 }
1889 }
1890
1891 unsafe impl fidl::encoding::TypeMarker for Response {
1892 type Owned = Self;
1893
1894 #[inline(always)]
1895 fn inline_align(_context: fidl::encoding::Context) -> usize {
1896 8
1897 }
1898
1899 #[inline(always)]
1900 fn inline_size(_context: fidl::encoding::Context) -> usize {
1901 16
1902 }
1903 }
1904
1905 unsafe impl fidl::encoding::Encode<Response, fdomain_client::fidl::FDomainResourceDialect>
1906 for &mut Response
1907 {
1908 unsafe fn encode(
1909 self,
1910 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1911 offset: usize,
1912 mut depth: fidl::encoding::Depth,
1913 ) -> fidl::Result<()> {
1914 encoder.debug_check_bounds::<Response>(offset);
1915 let max_ordinal: u64 = self.max_ordinal_present();
1917 encoder.write_num(max_ordinal, offset);
1918 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1919 if max_ordinal == 0 {
1921 return Ok(());
1922 }
1923 depth.increment()?;
1924 let envelope_size = 8;
1925 let bytes_len = max_ordinal as usize * envelope_size;
1926 #[allow(unused_variables)]
1927 let offset = encoder.out_of_line_offset(bytes_len);
1928 let mut _prev_end_offset: usize = 0;
1929 if 1 > max_ordinal {
1930 return Ok(());
1931 }
1932
1933 let cur_offset: usize = (1 - 1) * envelope_size;
1936
1937 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1939
1940 fidl::encoding::encode_in_envelope_optional::<
1945 Error,
1946 fdomain_client::fidl::FDomainResourceDialect,
1947 >(
1948 self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
1949 encoder,
1950 offset + cur_offset,
1951 depth,
1952 )?;
1953
1954 _prev_end_offset = cur_offset + envelope_size;
1955 if 2 > max_ordinal {
1956 return Ok(());
1957 }
1958
1959 let cur_offset: usize = (2 - 1) * envelope_size;
1962
1963 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1965
1966 fidl::encoding::encode_in_envelope_optional::<
1971 fidl::encoding::HandleType<
1972 fdomain_client::Socket,
1973 { fidl::ObjectType::SOCKET.into_raw() },
1974 2147483648,
1975 >,
1976 fdomain_client::fidl::FDomainResourceDialect,
1977 >(
1978 self.body.as_mut().map(
1979 <fidl::encoding::HandleType<
1980 fdomain_client::Socket,
1981 { fidl::ObjectType::SOCKET.into_raw() },
1982 2147483648,
1983 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1984 ),
1985 encoder,
1986 offset + cur_offset,
1987 depth,
1988 )?;
1989
1990 _prev_end_offset = cur_offset + envelope_size;
1991 if 3 > max_ordinal {
1992 return Ok(());
1993 }
1994
1995 let cur_offset: usize = (3 - 1) * envelope_size;
1998
1999 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2001
2002 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fdomain_client::fidl::FDomainResourceDialect>(
2007 self.final_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2008 encoder, offset + cur_offset, depth
2009 )?;
2010
2011 _prev_end_offset = cur_offset + envelope_size;
2012 if 4 > max_ordinal {
2013 return Ok(());
2014 }
2015
2016 let cur_offset: usize = (4 - 1) * envelope_size;
2019
2020 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2022
2023 fidl::encoding::encode_in_envelope_optional::<
2028 u32,
2029 fdomain_client::fidl::FDomainResourceDialect,
2030 >(
2031 self.status_code.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2032 encoder,
2033 offset + cur_offset,
2034 depth,
2035 )?;
2036
2037 _prev_end_offset = cur_offset + envelope_size;
2038 if 5 > max_ordinal {
2039 return Ok(());
2040 }
2041
2042 let cur_offset: usize = (5 - 1) * envelope_size;
2045
2046 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2048
2049 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, fdomain_client::fidl::FDomainResourceDialect>(
2054 self.status_line.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
2055 encoder, offset + cur_offset, depth
2056 )?;
2057
2058 _prev_end_offset = cur_offset + envelope_size;
2059 if 6 > max_ordinal {
2060 return Ok(());
2061 }
2062
2063 let cur_offset: usize = (6 - 1) * envelope_size;
2066
2067 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2069
2070 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Header>, fdomain_client::fidl::FDomainResourceDialect>(
2075 self.headers.as_ref().map(<fidl::encoding::UnboundedVector<Header> as fidl::encoding::ValueTypeMarker>::borrow),
2076 encoder, offset + cur_offset, depth
2077 )?;
2078
2079 _prev_end_offset = cur_offset + envelope_size;
2080 if 7 > max_ordinal {
2081 return Ok(());
2082 }
2083
2084 let cur_offset: usize = (7 - 1) * envelope_size;
2087
2088 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2090
2091 fidl::encoding::encode_in_envelope_optional::<
2096 RedirectTarget,
2097 fdomain_client::fidl::FDomainResourceDialect,
2098 >(
2099 self.redirect
2100 .as_ref()
2101 .map(<RedirectTarget as fidl::encoding::ValueTypeMarker>::borrow),
2102 encoder,
2103 offset + cur_offset,
2104 depth,
2105 )?;
2106
2107 _prev_end_offset = cur_offset + envelope_size;
2108
2109 Ok(())
2110 }
2111 }
2112
2113 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for Response {
2114 #[inline(always)]
2115 fn new_empty() -> Self {
2116 Self::default()
2117 }
2118
2119 unsafe fn decode(
2120 &mut self,
2121 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2122 offset: usize,
2123 mut depth: fidl::encoding::Depth,
2124 ) -> fidl::Result<()> {
2125 decoder.debug_check_bounds::<Self>(offset);
2126 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2127 None => return Err(fidl::Error::NotNullable),
2128 Some(len) => len,
2129 };
2130 if len == 0 {
2132 return Ok(());
2133 };
2134 depth.increment()?;
2135 let envelope_size = 8;
2136 let bytes_len = len * envelope_size;
2137 let offset = decoder.out_of_line_offset(bytes_len)?;
2138 let mut _next_ordinal_to_read = 0;
2140 let mut next_offset = offset;
2141 let end_offset = offset + bytes_len;
2142 _next_ordinal_to_read += 1;
2143 if next_offset >= end_offset {
2144 return Ok(());
2145 }
2146
2147 while _next_ordinal_to_read < 1 {
2149 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2150 _next_ordinal_to_read += 1;
2151 next_offset += envelope_size;
2152 }
2153
2154 let next_out_of_line = decoder.next_out_of_line();
2155 let handles_before = decoder.remaining_handles();
2156 if let Some((inlined, num_bytes, num_handles)) =
2157 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2158 {
2159 let member_inline_size =
2160 <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2161 if inlined != (member_inline_size <= 4) {
2162 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2163 }
2164 let inner_offset;
2165 let mut inner_depth = depth.clone();
2166 if inlined {
2167 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2168 inner_offset = next_offset;
2169 } else {
2170 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2171 inner_depth.increment()?;
2172 }
2173 let val_ref = self.error.get_or_insert_with(|| {
2174 fidl::new_empty!(Error, fdomain_client::fidl::FDomainResourceDialect)
2175 });
2176 fidl::decode!(
2177 Error,
2178 fdomain_client::fidl::FDomainResourceDialect,
2179 val_ref,
2180 decoder,
2181 inner_offset,
2182 inner_depth
2183 )?;
2184 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2185 {
2186 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2187 }
2188 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2189 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2190 }
2191 }
2192
2193 next_offset += envelope_size;
2194 _next_ordinal_to_read += 1;
2195 if next_offset >= end_offset {
2196 return Ok(());
2197 }
2198
2199 while _next_ordinal_to_read < 2 {
2201 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2202 _next_ordinal_to_read += 1;
2203 next_offset += envelope_size;
2204 }
2205
2206 let next_out_of_line = decoder.next_out_of_line();
2207 let handles_before = decoder.remaining_handles();
2208 if let Some((inlined, num_bytes, num_handles)) =
2209 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2210 {
2211 let member_inline_size = <fidl::encoding::HandleType<
2212 fdomain_client::Socket,
2213 { fidl::ObjectType::SOCKET.into_raw() },
2214 2147483648,
2215 > as fidl::encoding::TypeMarker>::inline_size(
2216 decoder.context
2217 );
2218 if inlined != (member_inline_size <= 4) {
2219 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2220 }
2221 let inner_offset;
2222 let mut inner_depth = depth.clone();
2223 if inlined {
2224 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2225 inner_offset = next_offset;
2226 } else {
2227 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2228 inner_depth.increment()?;
2229 }
2230 let val_ref =
2231 self.body.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
2232 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2233 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2234 {
2235 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2236 }
2237 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2238 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2239 }
2240 }
2241
2242 next_offset += envelope_size;
2243 _next_ordinal_to_read += 1;
2244 if next_offset >= end_offset {
2245 return Ok(());
2246 }
2247
2248 while _next_ordinal_to_read < 3 {
2250 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2251 _next_ordinal_to_read += 1;
2252 next_offset += envelope_size;
2253 }
2254
2255 let next_out_of_line = decoder.next_out_of_line();
2256 let handles_before = decoder.remaining_handles();
2257 if let Some((inlined, num_bytes, num_handles)) =
2258 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2259 {
2260 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2261 if inlined != (member_inline_size <= 4) {
2262 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2263 }
2264 let inner_offset;
2265 let mut inner_depth = depth.clone();
2266 if inlined {
2267 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2268 inner_offset = next_offset;
2269 } else {
2270 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2271 inner_depth.increment()?;
2272 }
2273 let val_ref = self.final_url.get_or_insert_with(|| {
2274 fidl::new_empty!(
2275 fidl::encoding::BoundedString<4096>,
2276 fdomain_client::fidl::FDomainResourceDialect
2277 )
2278 });
2279 fidl::decode!(
2280 fidl::encoding::BoundedString<4096>,
2281 fdomain_client::fidl::FDomainResourceDialect,
2282 val_ref,
2283 decoder,
2284 inner_offset,
2285 inner_depth
2286 )?;
2287 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2288 {
2289 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2290 }
2291 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2292 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2293 }
2294 }
2295
2296 next_offset += envelope_size;
2297 _next_ordinal_to_read += 1;
2298 if next_offset >= end_offset {
2299 return Ok(());
2300 }
2301
2302 while _next_ordinal_to_read < 4 {
2304 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2305 _next_ordinal_to_read += 1;
2306 next_offset += envelope_size;
2307 }
2308
2309 let next_out_of_line = decoder.next_out_of_line();
2310 let handles_before = decoder.remaining_handles();
2311 if let Some((inlined, num_bytes, num_handles)) =
2312 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2313 {
2314 let member_inline_size =
2315 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2316 if inlined != (member_inline_size <= 4) {
2317 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2318 }
2319 let inner_offset;
2320 let mut inner_depth = depth.clone();
2321 if inlined {
2322 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2323 inner_offset = next_offset;
2324 } else {
2325 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2326 inner_depth.increment()?;
2327 }
2328 let val_ref = self.status_code.get_or_insert_with(|| {
2329 fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect)
2330 });
2331 fidl::decode!(
2332 u32,
2333 fdomain_client::fidl::FDomainResourceDialect,
2334 val_ref,
2335 decoder,
2336 inner_offset,
2337 inner_depth
2338 )?;
2339 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2340 {
2341 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2342 }
2343 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2344 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2345 }
2346 }
2347
2348 next_offset += envelope_size;
2349 _next_ordinal_to_read += 1;
2350 if next_offset >= end_offset {
2351 return Ok(());
2352 }
2353
2354 while _next_ordinal_to_read < 5 {
2356 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2357 _next_ordinal_to_read += 1;
2358 next_offset += envelope_size;
2359 }
2360
2361 let next_out_of_line = decoder.next_out_of_line();
2362 let handles_before = decoder.remaining_handles();
2363 if let Some((inlined, num_bytes, num_handles)) =
2364 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2365 {
2366 let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2367 if inlined != (member_inline_size <= 4) {
2368 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2369 }
2370 let inner_offset;
2371 let mut inner_depth = depth.clone();
2372 if inlined {
2373 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2374 inner_offset = next_offset;
2375 } else {
2376 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2377 inner_depth.increment()?;
2378 }
2379 let val_ref = self.status_line.get_or_insert_with(|| {
2380 fidl::new_empty!(
2381 fidl::encoding::UnboundedVector<u8>,
2382 fdomain_client::fidl::FDomainResourceDialect
2383 )
2384 });
2385 fidl::decode!(
2386 fidl::encoding::UnboundedVector<u8>,
2387 fdomain_client::fidl::FDomainResourceDialect,
2388 val_ref,
2389 decoder,
2390 inner_offset,
2391 inner_depth
2392 )?;
2393 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2394 {
2395 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2396 }
2397 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2398 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2399 }
2400 }
2401
2402 next_offset += envelope_size;
2403 _next_ordinal_to_read += 1;
2404 if next_offset >= end_offset {
2405 return Ok(());
2406 }
2407
2408 while _next_ordinal_to_read < 6 {
2410 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2411 _next_ordinal_to_read += 1;
2412 next_offset += envelope_size;
2413 }
2414
2415 let next_out_of_line = decoder.next_out_of_line();
2416 let handles_before = decoder.remaining_handles();
2417 if let Some((inlined, num_bytes, num_handles)) =
2418 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2419 {
2420 let member_inline_size = <fidl::encoding::UnboundedVector<Header> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2421 if inlined != (member_inline_size <= 4) {
2422 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2423 }
2424 let inner_offset;
2425 let mut inner_depth = depth.clone();
2426 if inlined {
2427 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2428 inner_offset = next_offset;
2429 } else {
2430 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2431 inner_depth.increment()?;
2432 }
2433 let val_ref = self.headers.get_or_insert_with(|| {
2434 fidl::new_empty!(
2435 fidl::encoding::UnboundedVector<Header>,
2436 fdomain_client::fidl::FDomainResourceDialect
2437 )
2438 });
2439 fidl::decode!(
2440 fidl::encoding::UnboundedVector<Header>,
2441 fdomain_client::fidl::FDomainResourceDialect,
2442 val_ref,
2443 decoder,
2444 inner_offset,
2445 inner_depth
2446 )?;
2447 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2448 {
2449 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2450 }
2451 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2452 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2453 }
2454 }
2455
2456 next_offset += envelope_size;
2457 _next_ordinal_to_read += 1;
2458 if next_offset >= end_offset {
2459 return Ok(());
2460 }
2461
2462 while _next_ordinal_to_read < 7 {
2464 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2465 _next_ordinal_to_read += 1;
2466 next_offset += envelope_size;
2467 }
2468
2469 let next_out_of_line = decoder.next_out_of_line();
2470 let handles_before = decoder.remaining_handles();
2471 if let Some((inlined, num_bytes, num_handles)) =
2472 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2473 {
2474 let member_inline_size =
2475 <RedirectTarget as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2476 if inlined != (member_inline_size <= 4) {
2477 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2478 }
2479 let inner_offset;
2480 let mut inner_depth = depth.clone();
2481 if inlined {
2482 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2483 inner_offset = next_offset;
2484 } else {
2485 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2486 inner_depth.increment()?;
2487 }
2488 let val_ref = self.redirect.get_or_insert_with(|| {
2489 fidl::new_empty!(RedirectTarget, fdomain_client::fidl::FDomainResourceDialect)
2490 });
2491 fidl::decode!(
2492 RedirectTarget,
2493 fdomain_client::fidl::FDomainResourceDialect,
2494 val_ref,
2495 decoder,
2496 inner_offset,
2497 inner_depth
2498 )?;
2499 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2500 {
2501 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2502 }
2503 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2504 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2505 }
2506 }
2507
2508 next_offset += envelope_size;
2509
2510 while next_offset < end_offset {
2512 _next_ordinal_to_read += 1;
2513 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2514 next_offset += envelope_size;
2515 }
2516
2517 Ok(())
2518 }
2519 }
2520
2521 impl fidl::encoding::ResourceTypeMarker for Body {
2522 type Borrowed<'a> = &'a mut Self;
2523 fn take_or_borrow<'a>(
2524 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2525 ) -> Self::Borrowed<'a> {
2526 value
2527 }
2528 }
2529
2530 unsafe impl fidl::encoding::TypeMarker for Body {
2531 type Owned = Self;
2532
2533 #[inline(always)]
2534 fn inline_align(_context: fidl::encoding::Context) -> usize {
2535 8
2536 }
2537
2538 #[inline(always)]
2539 fn inline_size(_context: fidl::encoding::Context) -> usize {
2540 16
2541 }
2542 }
2543
2544 unsafe impl fidl::encoding::Encode<Body, fdomain_client::fidl::FDomainResourceDialect>
2545 for &mut Body
2546 {
2547 #[inline]
2548 unsafe fn encode(
2549 self,
2550 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2551 offset: usize,
2552 _depth: fidl::encoding::Depth,
2553 ) -> fidl::Result<()> {
2554 encoder.debug_check_bounds::<Body>(offset);
2555 encoder.write_num::<u64>(self.ordinal(), offset);
2556 match self {
2557 Body::Buffer(ref mut val) => {
2558 fidl::encoding::encode_in_envelope::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
2559 <fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2560 encoder, offset + 8, _depth
2561 )
2562 }
2563 Body::Stream(ref mut val) => {
2564 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
2565 <fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2566 encoder, offset + 8, _depth
2567 )
2568 }
2569 }
2570 }
2571 }
2572
2573 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for Body {
2574 #[inline(always)]
2575 fn new_empty() -> Self {
2576 Self::Buffer(fidl::new_empty!(
2577 fdomain_fuchsia_mem::Buffer,
2578 fdomain_client::fidl::FDomainResourceDialect
2579 ))
2580 }
2581
2582 #[inline]
2583 unsafe fn decode(
2584 &mut self,
2585 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2586 offset: usize,
2587 mut depth: fidl::encoding::Depth,
2588 ) -> fidl::Result<()> {
2589 decoder.debug_check_bounds::<Self>(offset);
2590 #[allow(unused_variables)]
2591 let next_out_of_line = decoder.next_out_of_line();
2592 let handles_before = decoder.remaining_handles();
2593 let (ordinal, inlined, num_bytes, num_handles) =
2594 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2595
2596 let member_inline_size = match ordinal {
2597 1 => <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2598 decoder.context,
2599 ),
2600 2 => <fidl::encoding::HandleType<
2601 fdomain_client::Socket,
2602 { fidl::ObjectType::SOCKET.into_raw() },
2603 2147483648,
2604 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2605 _ => return Err(fidl::Error::UnknownUnionTag),
2606 };
2607
2608 if inlined != (member_inline_size <= 4) {
2609 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2610 }
2611 let _inner_offset;
2612 if inlined {
2613 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2614 _inner_offset = offset + 8;
2615 } else {
2616 depth.increment()?;
2617 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2618 }
2619 match ordinal {
2620 1 => {
2621 #[allow(irrefutable_let_patterns)]
2622 if let Body::Buffer(_) = self {
2623 } else {
2625 *self = Body::Buffer(fidl::new_empty!(
2627 fdomain_fuchsia_mem::Buffer,
2628 fdomain_client::fidl::FDomainResourceDialect
2629 ));
2630 }
2631 #[allow(irrefutable_let_patterns)]
2632 if let Body::Buffer(ref mut val) = self {
2633 fidl::decode!(
2634 fdomain_fuchsia_mem::Buffer,
2635 fdomain_client::fidl::FDomainResourceDialect,
2636 val,
2637 decoder,
2638 _inner_offset,
2639 depth
2640 )?;
2641 } else {
2642 unreachable!()
2643 }
2644 }
2645 2 => {
2646 #[allow(irrefutable_let_patterns)]
2647 if let Body::Stream(_) = self {
2648 } else {
2650 *self = Body::Stream(
2652 fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
2653 );
2654 }
2655 #[allow(irrefutable_let_patterns)]
2656 if let Body::Stream(ref mut val) = self {
2657 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
2658 } else {
2659 unreachable!()
2660 }
2661 }
2662 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2663 }
2664 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2665 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2666 }
2667 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2668 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2669 }
2670 Ok(())
2671 }
2672 }
2673}