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 fidl::endpoints::ControlHandle for LoaderControlHandle {
605 fn shutdown(&self) {
606 self.inner.shutdown()
607 }
608
609 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
610 self.inner.shutdown_with_epitaph(status)
611 }
612
613 fn is_closed(&self) -> bool {
614 self.inner.channel().is_closed()
615 }
616 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
617 self.inner.channel().on_closed()
618 }
619
620 #[cfg(target_os = "fuchsia")]
621 fn signal_peer(
622 &self,
623 clear_mask: zx::Signals,
624 set_mask: zx::Signals,
625 ) -> Result<(), zx_status::Status> {
626 use fidl::Peered;
627 self.inner.channel().signal_peer(clear_mask, set_mask)
628 }
629}
630
631impl LoaderControlHandle {}
632
633#[must_use = "FIDL methods require a response to be sent"]
634#[derive(Debug)]
635pub struct LoaderLoadObjectResponder {
636 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
637 tx_id: u32,
638}
639
640impl std::ops::Drop for LoaderLoadObjectResponder {
644 fn drop(&mut self) {
645 self.control_handle.shutdown();
646 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
648 }
649}
650
651impl fidl::endpoints::Responder for LoaderLoadObjectResponder {
652 type ControlHandle = LoaderControlHandle;
653
654 fn control_handle(&self) -> &LoaderControlHandle {
655 &self.control_handle
656 }
657
658 fn drop_without_shutdown(mut self) {
659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
661 std::mem::forget(self);
663 }
664}
665
666impl LoaderLoadObjectResponder {
667 pub fn send(self, mut rv: i32, mut object: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
671 let _result = self.send_raw(rv, object);
672 if _result.is_err() {
673 self.control_handle.shutdown();
674 }
675 self.drop_without_shutdown();
676 _result
677 }
678
679 pub fn send_no_shutdown_on_err(
681 self,
682 mut rv: i32,
683 mut object: Option<fidl::Vmo>,
684 ) -> Result<(), fidl::Error> {
685 let _result = self.send_raw(rv, object);
686 self.drop_without_shutdown();
687 _result
688 }
689
690 fn send_raw(&self, mut rv: i32, mut object: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
691 self.control_handle.inner.send::<LoaderLoadObjectResponse>(
692 (rv, object),
693 self.tx_id,
694 0x48c5a151d6df2853,
695 fidl::encoding::DynamicFlags::empty(),
696 )
697 }
698}
699
700#[must_use = "FIDL methods require a response to be sent"]
701#[derive(Debug)]
702pub struct LoaderConfigResponder {
703 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
704 tx_id: u32,
705}
706
707impl std::ops::Drop for LoaderConfigResponder {
711 fn drop(&mut self) {
712 self.control_handle.shutdown();
713 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
715 }
716}
717
718impl fidl::endpoints::Responder for LoaderConfigResponder {
719 type ControlHandle = LoaderControlHandle;
720
721 fn control_handle(&self) -> &LoaderControlHandle {
722 &self.control_handle
723 }
724
725 fn drop_without_shutdown(mut self) {
726 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
728 std::mem::forget(self);
730 }
731}
732
733impl LoaderConfigResponder {
734 pub fn send(self, mut rv: i32) -> Result<(), fidl::Error> {
738 let _result = self.send_raw(rv);
739 if _result.is_err() {
740 self.control_handle.shutdown();
741 }
742 self.drop_without_shutdown();
743 _result
744 }
745
746 pub fn send_no_shutdown_on_err(self, mut rv: i32) -> Result<(), fidl::Error> {
748 let _result = self.send_raw(rv);
749 self.drop_without_shutdown();
750 _result
751 }
752
753 fn send_raw(&self, mut rv: i32) -> Result<(), fidl::Error> {
754 self.control_handle.inner.send::<LoaderConfigResponse>(
755 (rv,),
756 self.tx_id,
757 0x6a8a1a1464632841,
758 fidl::encoding::DynamicFlags::empty(),
759 )
760 }
761}
762
763#[must_use = "FIDL methods require a response to be sent"]
764#[derive(Debug)]
765pub struct LoaderCloneResponder {
766 control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
767 tx_id: u32,
768}
769
770impl std::ops::Drop for LoaderCloneResponder {
774 fn drop(&mut self) {
775 self.control_handle.shutdown();
776 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
778 }
779}
780
781impl fidl::endpoints::Responder for LoaderCloneResponder {
782 type ControlHandle = LoaderControlHandle;
783
784 fn control_handle(&self) -> &LoaderControlHandle {
785 &self.control_handle
786 }
787
788 fn drop_without_shutdown(mut self) {
789 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
791 std::mem::forget(self);
793 }
794}
795
796impl LoaderCloneResponder {
797 pub fn send(self, mut rv: i32) -> Result<(), fidl::Error> {
801 let _result = self.send_raw(rv);
802 if _result.is_err() {
803 self.control_handle.shutdown();
804 }
805 self.drop_without_shutdown();
806 _result
807 }
808
809 pub fn send_no_shutdown_on_err(self, mut rv: i32) -> Result<(), fidl::Error> {
811 let _result = self.send_raw(rv);
812 self.drop_without_shutdown();
813 _result
814 }
815
816 fn send_raw(&self, mut rv: i32) -> Result<(), fidl::Error> {
817 self.control_handle.inner.send::<LoaderCloneResponse>(
818 (rv,),
819 self.tx_id,
820 0x57e643a9ab6e4c29,
821 fidl::encoding::DynamicFlags::empty(),
822 )
823 }
824}
825
826mod internal {
827 use super::*;
828
829 impl fidl::encoding::ResourceTypeMarker for LoaderCloneRequest {
830 type Borrowed<'a> = &'a mut Self;
831 fn take_or_borrow<'a>(
832 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
833 ) -> Self::Borrowed<'a> {
834 value
835 }
836 }
837
838 unsafe impl fidl::encoding::TypeMarker for LoaderCloneRequest {
839 type Owned = Self;
840
841 #[inline(always)]
842 fn inline_align(_context: fidl::encoding::Context) -> usize {
843 4
844 }
845
846 #[inline(always)]
847 fn inline_size(_context: fidl::encoding::Context) -> usize {
848 4
849 }
850 }
851
852 unsafe impl
853 fidl::encoding::Encode<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
854 for &mut LoaderCloneRequest
855 {
856 #[inline]
857 unsafe fn encode(
858 self,
859 encoder: &mut fidl::encoding::Encoder<
860 '_,
861 fidl::encoding::DefaultFuchsiaResourceDialect,
862 >,
863 offset: usize,
864 _depth: fidl::encoding::Depth,
865 ) -> fidl::Result<()> {
866 encoder.debug_check_bounds::<LoaderCloneRequest>(offset);
867 fidl::encoding::Encode::<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
869 (
870 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.loader),
871 ),
872 encoder, offset, _depth
873 )
874 }
875 }
876 unsafe impl<
877 T0: fidl::encoding::Encode<
878 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
879 fidl::encoding::DefaultFuchsiaResourceDialect,
880 >,
881 > fidl::encoding::Encode<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
882 for (T0,)
883 {
884 #[inline]
885 unsafe fn encode(
886 self,
887 encoder: &mut fidl::encoding::Encoder<
888 '_,
889 fidl::encoding::DefaultFuchsiaResourceDialect,
890 >,
891 offset: usize,
892 depth: fidl::encoding::Depth,
893 ) -> fidl::Result<()> {
894 encoder.debug_check_bounds::<LoaderCloneRequest>(offset);
895 self.0.encode(encoder, offset + 0, depth)?;
899 Ok(())
900 }
901 }
902
903 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
904 for LoaderCloneRequest
905 {
906 #[inline(always)]
907 fn new_empty() -> Self {
908 Self {
909 loader: fidl::new_empty!(
910 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
911 fidl::encoding::DefaultFuchsiaResourceDialect
912 ),
913 }
914 }
915
916 #[inline]
917 unsafe fn decode(
918 &mut self,
919 decoder: &mut fidl::encoding::Decoder<
920 '_,
921 fidl::encoding::DefaultFuchsiaResourceDialect,
922 >,
923 offset: usize,
924 _depth: fidl::encoding::Depth,
925 ) -> fidl::Result<()> {
926 decoder.debug_check_bounds::<Self>(offset);
927 fidl::decode!(
929 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
930 fidl::encoding::DefaultFuchsiaResourceDialect,
931 &mut self.loader,
932 decoder,
933 offset + 0,
934 _depth
935 )?;
936 Ok(())
937 }
938 }
939
940 impl fidl::encoding::ResourceTypeMarker for LoaderLoadObjectResponse {
941 type Borrowed<'a> = &'a mut Self;
942 fn take_or_borrow<'a>(
943 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
944 ) -> Self::Borrowed<'a> {
945 value
946 }
947 }
948
949 unsafe impl fidl::encoding::TypeMarker for LoaderLoadObjectResponse {
950 type Owned = Self;
951
952 #[inline(always)]
953 fn inline_align(_context: fidl::encoding::Context) -> usize {
954 4
955 }
956
957 #[inline(always)]
958 fn inline_size(_context: fidl::encoding::Context) -> usize {
959 8
960 }
961 }
962
963 unsafe impl
964 fidl::encoding::Encode<
965 LoaderLoadObjectResponse,
966 fidl::encoding::DefaultFuchsiaResourceDialect,
967 > for &mut LoaderLoadObjectResponse
968 {
969 #[inline]
970 unsafe fn encode(
971 self,
972 encoder: &mut fidl::encoding::Encoder<
973 '_,
974 fidl::encoding::DefaultFuchsiaResourceDialect,
975 >,
976 offset: usize,
977 _depth: fidl::encoding::Depth,
978 ) -> fidl::Result<()> {
979 encoder.debug_check_bounds::<LoaderLoadObjectResponse>(offset);
980 fidl::encoding::Encode::<
982 LoaderLoadObjectResponse,
983 fidl::encoding::DefaultFuchsiaResourceDialect,
984 >::encode(
985 (
986 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.rv),
987 <fidl::encoding::Optional<
988 fidl::encoding::HandleType<
989 fidl::Vmo,
990 { fidl::ObjectType::VMO.into_raw() },
991 2147483648,
992 >,
993 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
994 &mut self.object
995 ),
996 ),
997 encoder,
998 offset,
999 _depth,
1000 )
1001 }
1002 }
1003 unsafe impl<
1004 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1005 T1: fidl::encoding::Encode<
1006 fidl::encoding::Optional<
1007 fidl::encoding::HandleType<
1008 fidl::Vmo,
1009 { fidl::ObjectType::VMO.into_raw() },
1010 2147483648,
1011 >,
1012 >,
1013 fidl::encoding::DefaultFuchsiaResourceDialect,
1014 >,
1015 >
1016 fidl::encoding::Encode<
1017 LoaderLoadObjectResponse,
1018 fidl::encoding::DefaultFuchsiaResourceDialect,
1019 > for (T0, T1)
1020 {
1021 #[inline]
1022 unsafe fn encode(
1023 self,
1024 encoder: &mut fidl::encoding::Encoder<
1025 '_,
1026 fidl::encoding::DefaultFuchsiaResourceDialect,
1027 >,
1028 offset: usize,
1029 depth: fidl::encoding::Depth,
1030 ) -> fidl::Result<()> {
1031 encoder.debug_check_bounds::<LoaderLoadObjectResponse>(offset);
1032 self.0.encode(encoder, offset + 0, depth)?;
1036 self.1.encode(encoder, offset + 4, depth)?;
1037 Ok(())
1038 }
1039 }
1040
1041 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1042 for LoaderLoadObjectResponse
1043 {
1044 #[inline(always)]
1045 fn new_empty() -> Self {
1046 Self {
1047 rv: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1048 object: fidl::new_empty!(
1049 fidl::encoding::Optional<
1050 fidl::encoding::HandleType<
1051 fidl::Vmo,
1052 { fidl::ObjectType::VMO.into_raw() },
1053 2147483648,
1054 >,
1055 >,
1056 fidl::encoding::DefaultFuchsiaResourceDialect
1057 ),
1058 }
1059 }
1060
1061 #[inline]
1062 unsafe fn decode(
1063 &mut self,
1064 decoder: &mut fidl::encoding::Decoder<
1065 '_,
1066 fidl::encoding::DefaultFuchsiaResourceDialect,
1067 >,
1068 offset: usize,
1069 _depth: fidl::encoding::Depth,
1070 ) -> fidl::Result<()> {
1071 decoder.debug_check_bounds::<Self>(offset);
1072 fidl::decode!(
1074 i32,
1075 fidl::encoding::DefaultFuchsiaResourceDialect,
1076 &mut self.rv,
1077 decoder,
1078 offset + 0,
1079 _depth
1080 )?;
1081 fidl::decode!(
1082 fidl::encoding::Optional<
1083 fidl::encoding::HandleType<
1084 fidl::Vmo,
1085 { fidl::ObjectType::VMO.into_raw() },
1086 2147483648,
1087 >,
1088 >,
1089 fidl::encoding::DefaultFuchsiaResourceDialect,
1090 &mut self.object,
1091 decoder,
1092 offset + 4,
1093 _depth
1094 )?;
1095 Ok(())
1096 }
1097 }
1098}