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_ldsvc_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct LoaderCloneRequest {
16 pub loader: fidl::endpoints::ServerEnd<LoaderMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderCloneRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct LoaderLoadObjectResponse {
23 pub rv: i32,
24 pub object: Option<fidl::Vmo>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderLoadObjectResponse {}
28
29#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
30pub struct LoaderMarker;
31
32impl fidl::endpoints::ProtocolMarker for LoaderMarker {
33 type Proxy = LoaderProxy;
34 type RequestStream = LoaderRequestStream;
35 #[cfg(target_os = "fuchsia")]
36 type SynchronousProxy = LoaderSynchronousProxy;
37
38 const DEBUG_NAME: &'static str = "(anonymous) Loader";
39}
40
41pub trait LoaderProxyInterface: Send + Sync {
42 fn r#done(&self) -> Result<(), fidl::Error>;
43 type LoadObjectResponseFut: std::future::Future<Output = Result<(i32, Option<fidl::Vmo>), fidl::Error>>
44 + Send;
45 fn r#load_object(&self, object_name: &str) -> Self::LoadObjectResponseFut;
46 type ConfigResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
47 fn r#config(&self, config: &str) -> Self::ConfigResponseFut;
48 type CloneResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
49 fn r#clone(&self, loader: fidl::endpoints::ServerEnd<LoaderMarker>) -> Self::CloneResponseFut;
50}
51#[derive(Debug)]
52#[cfg(target_os = "fuchsia")]
53pub struct LoaderSynchronousProxy {
54 client: fidl::client::sync::Client,
55}
56
57#[cfg(target_os = "fuchsia")]
58impl fidl::endpoints::SynchronousProxy for LoaderSynchronousProxy {
59 type Proxy = LoaderProxy;
60 type Protocol = LoaderMarker;
61
62 fn from_channel(inner: fidl::Channel) -> Self {
63 Self::new(inner)
64 }
65
66 fn into_channel(self) -> fidl::Channel {
67 self.client.into_channel()
68 }
69
70 fn as_channel(&self) -> &fidl::Channel {
71 self.client.as_channel()
72 }
73}
74
75#[cfg(target_os = "fuchsia")]
76impl LoaderSynchronousProxy {
77 pub fn new(channel: fidl::Channel) -> Self {
78 let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
79 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
80 }
81
82 pub fn into_channel(self) -> fidl::Channel {
83 self.client.into_channel()
84 }
85
86 pub fn wait_for_event(
89 &self,
90 deadline: zx::MonotonicInstant,
91 ) -> Result<LoaderEvent, fidl::Error> {
92 LoaderEvent::decode(self.client.wait_for_event(deadline)?)
93 }
94
95 pub fn r#done(&self) -> Result<(), fidl::Error> {
97 self.client.send::<fidl::encoding::EmptyPayload>(
98 (),
99 0x63ba6b76d3671001,
100 fidl::encoding::DynamicFlags::empty(),
101 )
102 }
103
104 pub fn r#load_object(
107 &self,
108 mut object_name: &str,
109 ___deadline: zx::MonotonicInstant,
110 ) -> Result<(i32, Option<fidl::Vmo>), fidl::Error> {
111 let _response =
112 self.client.send_query::<LoaderLoadObjectRequest, LoaderLoadObjectResponse>(
113 (object_name,),
114 0x48c5a151d6df2853,
115 fidl::encoding::DynamicFlags::empty(),
116 ___deadline,
117 )?;
118 Ok((_response.rv, _response.object))
119 }
120
121 pub fn r#config(
126 &self,
127 mut config: &str,
128 ___deadline: zx::MonotonicInstant,
129 ) -> Result<i32, fidl::Error> {
130 let _response = self.client.send_query::<LoaderConfigRequest, LoaderConfigResponse>(
131 (config,),
132 0x6a8a1a1464632841,
133 fidl::encoding::DynamicFlags::empty(),
134 ___deadline,
135 )?;
136 Ok(_response.rv)
137 }
138
139 pub fn r#clone(
141 &self,
142 mut loader: fidl::endpoints::ServerEnd<LoaderMarker>,
143 ___deadline: zx::MonotonicInstant,
144 ) -> Result<i32, fidl::Error> {
145 let _response = self.client.send_query::<LoaderCloneRequest, LoaderCloneResponse>(
146 (loader,),
147 0x57e643a9ab6e4c29,
148 fidl::encoding::DynamicFlags::empty(),
149 ___deadline,
150 )?;
151 Ok(_response.rv)
152 }
153}
154
155#[cfg(target_os = "fuchsia")]
156impl From<LoaderSynchronousProxy> for zx::Handle {
157 fn from(value: LoaderSynchronousProxy) -> Self {
158 value.into_channel().into()
159 }
160}
161
162#[cfg(target_os = "fuchsia")]
163impl From<fidl::Channel> for LoaderSynchronousProxy {
164 fn from(value: fidl::Channel) -> Self {
165 Self::new(value)
166 }
167}
168
169#[derive(Debug, Clone)]
170pub struct LoaderProxy {
171 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
172}
173
174impl fidl::endpoints::Proxy for LoaderProxy {
175 type Protocol = LoaderMarker;
176
177 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
178 Self::new(inner)
179 }
180
181 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
182 self.client.into_channel().map_err(|client| Self { client })
183 }
184
185 fn as_channel(&self) -> &::fidl::AsyncChannel {
186 self.client.as_channel()
187 }
188}
189
190impl LoaderProxy {
191 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
193 let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
194 Self { client: fidl::client::Client::new(channel, protocol_name) }
195 }
196
197 pub fn take_event_stream(&self) -> LoaderEventStream {
203 LoaderEventStream { event_receiver: self.client.take_event_receiver() }
204 }
205
206 pub fn r#done(&self) -> Result<(), fidl::Error> {
208 LoaderProxyInterface::r#done(self)
209 }
210
211 pub fn r#load_object(
214 &self,
215 mut object_name: &str,
216 ) -> fidl::client::QueryResponseFut<
217 (i32, Option<fidl::Vmo>),
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 > {
220 LoaderProxyInterface::r#load_object(self, object_name)
221 }
222
223 pub fn r#config(
228 &self,
229 mut config: &str,
230 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
231 LoaderProxyInterface::r#config(self, config)
232 }
233
234 pub fn r#clone(
236 &self,
237 mut loader: fidl::endpoints::ServerEnd<LoaderMarker>,
238 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
239 LoaderProxyInterface::r#clone(self, loader)
240 }
241}
242
243impl LoaderProxyInterface for LoaderProxy {
244 fn r#done(&self) -> Result<(), fidl::Error> {
245 self.client.send::<fidl::encoding::EmptyPayload>(
246 (),
247 0x63ba6b76d3671001,
248 fidl::encoding::DynamicFlags::empty(),
249 )
250 }
251
252 type LoadObjectResponseFut = fidl::client::QueryResponseFut<
253 (i32, Option<fidl::Vmo>),
254 fidl::encoding::DefaultFuchsiaResourceDialect,
255 >;
256 fn r#load_object(&self, mut object_name: &str) -> Self::LoadObjectResponseFut {
257 fn _decode(
258 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
259 ) -> Result<(i32, Option<fidl::Vmo>), fidl::Error> {
260 let _response = fidl::client::decode_transaction_body::<
261 LoaderLoadObjectResponse,
262 fidl::encoding::DefaultFuchsiaResourceDialect,
263 0x48c5a151d6df2853,
264 >(_buf?)?;
265 Ok((_response.rv, _response.object))
266 }
267 self.client.send_query_and_decode::<LoaderLoadObjectRequest, (i32, Option<fidl::Vmo>)>(
268 (object_name,),
269 0x48c5a151d6df2853,
270 fidl::encoding::DynamicFlags::empty(),
271 _decode,
272 )
273 }
274
275 type ConfigResponseFut =
276 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
277 fn r#config(&self, mut config: &str) -> Self::ConfigResponseFut {
278 fn _decode(
279 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
280 ) -> Result<i32, fidl::Error> {
281 let _response = fidl::client::decode_transaction_body::<
282 LoaderConfigResponse,
283 fidl::encoding::DefaultFuchsiaResourceDialect,
284 0x6a8a1a1464632841,
285 >(_buf?)?;
286 Ok(_response.rv)
287 }
288 self.client.send_query_and_decode::<LoaderConfigRequest, i32>(
289 (config,),
290 0x6a8a1a1464632841,
291 fidl::encoding::DynamicFlags::empty(),
292 _decode,
293 )
294 }
295
296 type CloneResponseFut =
297 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
298 fn r#clone(
299 &self,
300 mut loader: fidl::endpoints::ServerEnd<LoaderMarker>,
301 ) -> Self::CloneResponseFut {
302 fn _decode(
303 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
304 ) -> Result<i32, fidl::Error> {
305 let _response = fidl::client::decode_transaction_body::<
306 LoaderCloneResponse,
307 fidl::encoding::DefaultFuchsiaResourceDialect,
308 0x57e643a9ab6e4c29,
309 >(_buf?)?;
310 Ok(_response.rv)
311 }
312 self.client.send_query_and_decode::<LoaderCloneRequest, i32>(
313 (loader,),
314 0x57e643a9ab6e4c29,
315 fidl::encoding::DynamicFlags::empty(),
316 _decode,
317 )
318 }
319}
320
321pub struct LoaderEventStream {
322 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
323}
324
325impl std::marker::Unpin for LoaderEventStream {}
326
327impl futures::stream::FusedStream for LoaderEventStream {
328 fn is_terminated(&self) -> bool {
329 self.event_receiver.is_terminated()
330 }
331}
332
333impl futures::Stream for LoaderEventStream {
334 type Item = Result<LoaderEvent, fidl::Error>;
335
336 fn poll_next(
337 mut self: std::pin::Pin<&mut Self>,
338 cx: &mut std::task::Context<'_>,
339 ) -> std::task::Poll<Option<Self::Item>> {
340 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
341 &mut self.event_receiver,
342 cx
343 )?) {
344 Some(buf) => std::task::Poll::Ready(Some(LoaderEvent::decode(buf))),
345 None => std::task::Poll::Ready(None),
346 }
347 }
348}
349
350#[derive(Debug)]
351pub enum LoaderEvent {}
352
353impl LoaderEvent {
354 fn decode(
356 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
357 ) -> Result<LoaderEvent, fidl::Error> {
358 let (bytes, _handles) = buf.split_mut();
359 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
360 debug_assert_eq!(tx_header.tx_id, 0);
361 match tx_header.ordinal {
362 _ => Err(fidl::Error::UnknownOrdinal {
363 ordinal: tx_header.ordinal,
364 protocol_name: <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
365 }),
366 }
367 }
368}
369
370pub struct LoaderRequestStream {
372 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
373 is_terminated: bool,
374}
375
376impl std::marker::Unpin for LoaderRequestStream {}
377
378impl futures::stream::FusedStream for LoaderRequestStream {
379 fn is_terminated(&self) -> bool {
380 self.is_terminated
381 }
382}
383
384impl fidl::endpoints::RequestStream for LoaderRequestStream {
385 type Protocol = LoaderMarker;
386 type ControlHandle = LoaderControlHandle;
387
388 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
389 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
390 }
391
392 fn control_handle(&self) -> Self::ControlHandle {
393 LoaderControlHandle { inner: self.inner.clone() }
394 }
395
396 fn into_inner(
397 self,
398 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
399 {
400 (self.inner, self.is_terminated)
401 }
402
403 fn from_inner(
404 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
405 is_terminated: bool,
406 ) -> Self {
407 Self { inner, is_terminated }
408 }
409}
410
411impl futures::Stream for LoaderRequestStream {
412 type Item = Result<LoaderRequest, fidl::Error>;
413
414 fn poll_next(
415 mut self: std::pin::Pin<&mut Self>,
416 cx: &mut std::task::Context<'_>,
417 ) -> std::task::Poll<Option<Self::Item>> {
418 let this = &mut *self;
419 if this.inner.check_shutdown(cx) {
420 this.is_terminated = true;
421 return std::task::Poll::Ready(None);
422 }
423 if this.is_terminated {
424 panic!("polled LoaderRequestStream after completion");
425 }
426 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
427 |bytes, handles| {
428 match this.inner.channel().read_etc(cx, bytes, handles) {
429 std::task::Poll::Ready(Ok(())) => {}
430 std::task::Poll::Pending => return std::task::Poll::Pending,
431 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
432 this.is_terminated = true;
433 return std::task::Poll::Ready(None);
434 }
435 std::task::Poll::Ready(Err(e)) => {
436 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
437 e.into(),
438 ))))
439 }
440 }
441
442 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
444
445 std::task::Poll::Ready(Some(match header.ordinal {
446 0x63ba6b76d3671001 => {
447 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
448 let mut req = fidl::new_empty!(
449 fidl::encoding::EmptyPayload,
450 fidl::encoding::DefaultFuchsiaResourceDialect
451 );
452 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
453 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
454 Ok(LoaderRequest::Done { control_handle })
455 }
456 0x48c5a151d6df2853 => {
457 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
458 let mut req = fidl::new_empty!(
459 LoaderLoadObjectRequest,
460 fidl::encoding::DefaultFuchsiaResourceDialect
461 );
462 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderLoadObjectRequest>(&header, _body_bytes, handles, &mut req)?;
463 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
464 Ok(LoaderRequest::LoadObject {
465 object_name: req.object_name,
466
467 responder: LoaderLoadObjectResponder {
468 control_handle: std::mem::ManuallyDrop::new(control_handle),
469 tx_id: header.tx_id,
470 },
471 })
472 }
473 0x6a8a1a1464632841 => {
474 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
475 let mut req = fidl::new_empty!(
476 LoaderConfigRequest,
477 fidl::encoding::DefaultFuchsiaResourceDialect
478 );
479 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderConfigRequest>(&header, _body_bytes, handles, &mut req)?;
480 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
481 Ok(LoaderRequest::Config {
482 config: req.config,
483
484 responder: LoaderConfigResponder {
485 control_handle: std::mem::ManuallyDrop::new(control_handle),
486 tx_id: header.tx_id,
487 },
488 })
489 }
490 0x57e643a9ab6e4c29 => {
491 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
492 let mut req = fidl::new_empty!(
493 LoaderCloneRequest,
494 fidl::encoding::DefaultFuchsiaResourceDialect
495 );
496 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderCloneRequest>(&header, _body_bytes, handles, &mut req)?;
497 let control_handle = LoaderControlHandle { inner: this.inner.clone() };
498 Ok(LoaderRequest::Clone {
499 loader: req.loader,
500
501 responder: LoaderCloneResponder {
502 control_handle: std::mem::ManuallyDrop::new(control_handle),
503 tx_id: header.tx_id,
504 },
505 })
506 }
507 _ => Err(fidl::Error::UnknownOrdinal {
508 ordinal: header.ordinal,
509 protocol_name:
510 <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
511 }),
512 }))
513 },
514 )
515 }
516}
517
518#[derive(Debug)]
523pub enum LoaderRequest {
524 Done { control_handle: LoaderControlHandle },
526 LoadObject { object_name: String, responder: LoaderLoadObjectResponder },
529 Config { config: String, responder: LoaderConfigResponder },
534 Clone { loader: fidl::endpoints::ServerEnd<LoaderMarker>, responder: LoaderCloneResponder },
536}
537
538impl LoaderRequest {
539 #[allow(irrefutable_let_patterns)]
540 pub fn into_done(self) -> Option<(LoaderControlHandle)> {
541 if let LoaderRequest::Done { control_handle } = self {
542 Some((control_handle))
543 } else {
544 None
545 }
546 }
547
548 #[allow(irrefutable_let_patterns)]
549 pub fn into_load_object(self) -> Option<(String, LoaderLoadObjectResponder)> {
550 if let LoaderRequest::LoadObject { object_name, responder } = self {
551 Some((object_name, responder))
552 } else {
553 None
554 }
555 }
556
557 #[allow(irrefutable_let_patterns)]
558 pub fn into_config(self) -> Option<(String, LoaderConfigResponder)> {
559 if let LoaderRequest::Config { config, responder } = self {
560 Some((config, responder))
561 } else {
562 None
563 }
564 }
565
566 #[allow(irrefutable_let_patterns)]
567 pub fn into_clone(
568 self,
569 ) -> Option<(fidl::endpoints::ServerEnd<LoaderMarker>, LoaderCloneResponder)> {
570 if let LoaderRequest::Clone { loader, responder } = self {
571 Some((loader, responder))
572 } else {
573 None
574 }
575 }
576
577 pub fn method_name(&self) -> &'static str {
579 match *self {
580 LoaderRequest::Done { .. } => "done",
581 LoaderRequest::LoadObject { .. } => "load_object",
582 LoaderRequest::Config { .. } => "config",
583 LoaderRequest::Clone { .. } => "clone",
584 }
585 }
586}
587
588#[derive(Debug, Clone)]
589pub struct LoaderControlHandle {
590 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
591}
592
593impl fidl::endpoints::ControlHandle for LoaderControlHandle {
594 fn shutdown(&self) {
595 self.inner.shutdown()
596 }
597 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
598 self.inner.shutdown_with_epitaph(status)
599 }
600
601 fn is_closed(&self) -> bool {
602 self.inner.channel().is_closed()
603 }
604 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
605 self.inner.channel().on_closed()
606 }
607
608 #[cfg(target_os = "fuchsia")]
609 fn signal_peer(
610 &self,
611 clear_mask: zx::Signals,
612 set_mask: zx::Signals,
613 ) -> Result<(), zx_status::Status> {
614 use fidl::Peered;
615 self.inner.channel().signal_peer(clear_mask, set_mask)
616 }
617}
618
619impl LoaderControlHandle {}
620
621#[must_use = "FIDL methods require a response to be sent"]
622#[derive(Debug)]
623pub struct LoaderLoadObjectResponder {
624 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
625 tx_id: u32,
626}
627
628impl std::ops::Drop for LoaderLoadObjectResponder {
632 fn drop(&mut self) {
633 self.control_handle.shutdown();
634 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
636 }
637}
638
639impl fidl::endpoints::Responder for LoaderLoadObjectResponder {
640 type ControlHandle = LoaderControlHandle;
641
642 fn control_handle(&self) -> &LoaderControlHandle {
643 &self.control_handle
644 }
645
646 fn drop_without_shutdown(mut self) {
647 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
649 std::mem::forget(self);
651 }
652}
653
654impl LoaderLoadObjectResponder {
655 pub fn send(self, mut rv: i32, mut object: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
659 let _result = self.send_raw(rv, object);
660 if _result.is_err() {
661 self.control_handle.shutdown();
662 }
663 self.drop_without_shutdown();
664 _result
665 }
666
667 pub fn send_no_shutdown_on_err(
669 self,
670 mut rv: i32,
671 mut object: Option<fidl::Vmo>,
672 ) -> Result<(), fidl::Error> {
673 let _result = self.send_raw(rv, object);
674 self.drop_without_shutdown();
675 _result
676 }
677
678 fn send_raw(&self, mut rv: i32, mut object: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
679 self.control_handle.inner.send::<LoaderLoadObjectResponse>(
680 (rv, object),
681 self.tx_id,
682 0x48c5a151d6df2853,
683 fidl::encoding::DynamicFlags::empty(),
684 )
685 }
686}
687
688#[must_use = "FIDL methods require a response to be sent"]
689#[derive(Debug)]
690pub struct LoaderConfigResponder {
691 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
692 tx_id: u32,
693}
694
695impl std::ops::Drop for LoaderConfigResponder {
699 fn drop(&mut self) {
700 self.control_handle.shutdown();
701 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
703 }
704}
705
706impl fidl::endpoints::Responder for LoaderConfigResponder {
707 type ControlHandle = LoaderControlHandle;
708
709 fn control_handle(&self) -> &LoaderControlHandle {
710 &self.control_handle
711 }
712
713 fn drop_without_shutdown(mut self) {
714 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
716 std::mem::forget(self);
718 }
719}
720
721impl LoaderConfigResponder {
722 pub fn send(self, mut rv: i32) -> Result<(), fidl::Error> {
726 let _result = self.send_raw(rv);
727 if _result.is_err() {
728 self.control_handle.shutdown();
729 }
730 self.drop_without_shutdown();
731 _result
732 }
733
734 pub fn send_no_shutdown_on_err(self, mut rv: i32) -> Result<(), fidl::Error> {
736 let _result = self.send_raw(rv);
737 self.drop_without_shutdown();
738 _result
739 }
740
741 fn send_raw(&self, mut rv: i32) -> Result<(), fidl::Error> {
742 self.control_handle.inner.send::<LoaderConfigResponse>(
743 (rv,),
744 self.tx_id,
745 0x6a8a1a1464632841,
746 fidl::encoding::DynamicFlags::empty(),
747 )
748 }
749}
750
751#[must_use = "FIDL methods require a response to be sent"]
752#[derive(Debug)]
753pub struct LoaderCloneResponder {
754 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
755 tx_id: u32,
756}
757
758impl std::ops::Drop for LoaderCloneResponder {
762 fn drop(&mut self) {
763 self.control_handle.shutdown();
764 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
766 }
767}
768
769impl fidl::endpoints::Responder for LoaderCloneResponder {
770 type ControlHandle = LoaderControlHandle;
771
772 fn control_handle(&self) -> &LoaderControlHandle {
773 &self.control_handle
774 }
775
776 fn drop_without_shutdown(mut self) {
777 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
779 std::mem::forget(self);
781 }
782}
783
784impl LoaderCloneResponder {
785 pub fn send(self, mut rv: i32) -> Result<(), fidl::Error> {
789 let _result = self.send_raw(rv);
790 if _result.is_err() {
791 self.control_handle.shutdown();
792 }
793 self.drop_without_shutdown();
794 _result
795 }
796
797 pub fn send_no_shutdown_on_err(self, mut rv: i32) -> Result<(), fidl::Error> {
799 let _result = self.send_raw(rv);
800 self.drop_without_shutdown();
801 _result
802 }
803
804 fn send_raw(&self, mut rv: i32) -> Result<(), fidl::Error> {
805 self.control_handle.inner.send::<LoaderCloneResponse>(
806 (rv,),
807 self.tx_id,
808 0x57e643a9ab6e4c29,
809 fidl::encoding::DynamicFlags::empty(),
810 )
811 }
812}
813
814mod internal {
815 use super::*;
816
817 impl fidl::encoding::ResourceTypeMarker for LoaderCloneRequest {
818 type Borrowed<'a> = &'a mut Self;
819 fn take_or_borrow<'a>(
820 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
821 ) -> Self::Borrowed<'a> {
822 value
823 }
824 }
825
826 unsafe impl fidl::encoding::TypeMarker for LoaderCloneRequest {
827 type Owned = Self;
828
829 #[inline(always)]
830 fn inline_align(_context: fidl::encoding::Context) -> usize {
831 4
832 }
833
834 #[inline(always)]
835 fn inline_size(_context: fidl::encoding::Context) -> usize {
836 4
837 }
838 }
839
840 unsafe impl
841 fidl::encoding::Encode<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
842 for &mut LoaderCloneRequest
843 {
844 #[inline]
845 unsafe fn encode(
846 self,
847 encoder: &mut fidl::encoding::Encoder<
848 '_,
849 fidl::encoding::DefaultFuchsiaResourceDialect,
850 >,
851 offset: usize,
852 _depth: fidl::encoding::Depth,
853 ) -> fidl::Result<()> {
854 encoder.debug_check_bounds::<LoaderCloneRequest>(offset);
855 fidl::encoding::Encode::<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
857 (
858 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.loader),
859 ),
860 encoder, offset, _depth
861 )
862 }
863 }
864 unsafe impl<
865 T0: fidl::encoding::Encode<
866 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
867 fidl::encoding::DefaultFuchsiaResourceDialect,
868 >,
869 >
870 fidl::encoding::Encode<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
871 for (T0,)
872 {
873 #[inline]
874 unsafe fn encode(
875 self,
876 encoder: &mut fidl::encoding::Encoder<
877 '_,
878 fidl::encoding::DefaultFuchsiaResourceDialect,
879 >,
880 offset: usize,
881 depth: fidl::encoding::Depth,
882 ) -> fidl::Result<()> {
883 encoder.debug_check_bounds::<LoaderCloneRequest>(offset);
884 self.0.encode(encoder, offset + 0, depth)?;
888 Ok(())
889 }
890 }
891
892 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
893 for LoaderCloneRequest
894 {
895 #[inline(always)]
896 fn new_empty() -> Self {
897 Self {
898 loader: fidl::new_empty!(
899 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
900 fidl::encoding::DefaultFuchsiaResourceDialect
901 ),
902 }
903 }
904
905 #[inline]
906 unsafe fn decode(
907 &mut self,
908 decoder: &mut fidl::encoding::Decoder<
909 '_,
910 fidl::encoding::DefaultFuchsiaResourceDialect,
911 >,
912 offset: usize,
913 _depth: fidl::encoding::Depth,
914 ) -> fidl::Result<()> {
915 decoder.debug_check_bounds::<Self>(offset);
916 fidl::decode!(
918 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
919 fidl::encoding::DefaultFuchsiaResourceDialect,
920 &mut self.loader,
921 decoder,
922 offset + 0,
923 _depth
924 )?;
925 Ok(())
926 }
927 }
928
929 impl fidl::encoding::ResourceTypeMarker for LoaderLoadObjectResponse {
930 type Borrowed<'a> = &'a mut Self;
931 fn take_or_borrow<'a>(
932 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
933 ) -> Self::Borrowed<'a> {
934 value
935 }
936 }
937
938 unsafe impl fidl::encoding::TypeMarker for LoaderLoadObjectResponse {
939 type Owned = Self;
940
941 #[inline(always)]
942 fn inline_align(_context: fidl::encoding::Context) -> usize {
943 4
944 }
945
946 #[inline(always)]
947 fn inline_size(_context: fidl::encoding::Context) -> usize {
948 8
949 }
950 }
951
952 unsafe impl
953 fidl::encoding::Encode<
954 LoaderLoadObjectResponse,
955 fidl::encoding::DefaultFuchsiaResourceDialect,
956 > for &mut LoaderLoadObjectResponse
957 {
958 #[inline]
959 unsafe fn encode(
960 self,
961 encoder: &mut fidl::encoding::Encoder<
962 '_,
963 fidl::encoding::DefaultFuchsiaResourceDialect,
964 >,
965 offset: usize,
966 _depth: fidl::encoding::Depth,
967 ) -> fidl::Result<()> {
968 encoder.debug_check_bounds::<LoaderLoadObjectResponse>(offset);
969 fidl::encoding::Encode::<
971 LoaderLoadObjectResponse,
972 fidl::encoding::DefaultFuchsiaResourceDialect,
973 >::encode(
974 (
975 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.rv),
976 <fidl::encoding::Optional<
977 fidl::encoding::HandleType<
978 fidl::Vmo,
979 { fidl::ObjectType::VMO.into_raw() },
980 2147483648,
981 >,
982 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
983 &mut self.object
984 ),
985 ),
986 encoder,
987 offset,
988 _depth,
989 )
990 }
991 }
992 unsafe impl<
993 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
994 T1: fidl::encoding::Encode<
995 fidl::encoding::Optional<
996 fidl::encoding::HandleType<
997 fidl::Vmo,
998 { fidl::ObjectType::VMO.into_raw() },
999 2147483648,
1000 >,
1001 >,
1002 fidl::encoding::DefaultFuchsiaResourceDialect,
1003 >,
1004 >
1005 fidl::encoding::Encode<
1006 LoaderLoadObjectResponse,
1007 fidl::encoding::DefaultFuchsiaResourceDialect,
1008 > for (T0, T1)
1009 {
1010 #[inline]
1011 unsafe fn encode(
1012 self,
1013 encoder: &mut fidl::encoding::Encoder<
1014 '_,
1015 fidl::encoding::DefaultFuchsiaResourceDialect,
1016 >,
1017 offset: usize,
1018 depth: fidl::encoding::Depth,
1019 ) -> fidl::Result<()> {
1020 encoder.debug_check_bounds::<LoaderLoadObjectResponse>(offset);
1021 self.0.encode(encoder, offset + 0, depth)?;
1025 self.1.encode(encoder, offset + 4, depth)?;
1026 Ok(())
1027 }
1028 }
1029
1030 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1031 for LoaderLoadObjectResponse
1032 {
1033 #[inline(always)]
1034 fn new_empty() -> Self {
1035 Self {
1036 rv: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1037 object: fidl::new_empty!(
1038 fidl::encoding::Optional<
1039 fidl::encoding::HandleType<
1040 fidl::Vmo,
1041 { fidl::ObjectType::VMO.into_raw() },
1042 2147483648,
1043 >,
1044 >,
1045 fidl::encoding::DefaultFuchsiaResourceDialect
1046 ),
1047 }
1048 }
1049
1050 #[inline]
1051 unsafe fn decode(
1052 &mut self,
1053 decoder: &mut fidl::encoding::Decoder<
1054 '_,
1055 fidl::encoding::DefaultFuchsiaResourceDialect,
1056 >,
1057 offset: usize,
1058 _depth: fidl::encoding::Depth,
1059 ) -> fidl::Result<()> {
1060 decoder.debug_check_bounds::<Self>(offset);
1061 fidl::decode!(
1063 i32,
1064 fidl::encoding::DefaultFuchsiaResourceDialect,
1065 &mut self.rv,
1066 decoder,
1067 offset + 0,
1068 _depth
1069 )?;
1070 fidl::decode!(
1071 fidl::encoding::Optional<
1072 fidl::encoding::HandleType<
1073 fidl::Vmo,
1074 { fidl::ObjectType::VMO.into_raw() },
1075 2147483648,
1076 >,
1077 >,
1078 fidl::encoding::DefaultFuchsiaResourceDialect,
1079 &mut self.object,
1080 decoder,
1081 offset + 4,
1082 _depth
1083 )?;
1084 Ok(())
1085 }
1086 }
1087}