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