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_driver_host_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15#[repr(C)]
16pub struct DriverHostFindDriverCrashInfoByThreadKoidRequest {
17 pub thread_koid: u64,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for DriverHostFindDriverCrashInfoByThreadKoidRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct DriverHostInstallLoaderRequest {
27 pub loader: fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for DriverHostInstallLoaderRequest
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct DriverHostStartLoadedDriverRequest {
37 pub start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
38 pub dynamic_linking_abi: u64,
39 pub driver: fidl::endpoints::ServerEnd<DriverMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for DriverHostStartLoadedDriverRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct DriverHostStartRequest {
49 pub start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
50 pub driver: fidl::endpoints::ServerEnd<DriverMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverHostStartRequest {}
54
55#[derive(Debug, Default, PartialEq)]
57pub struct DriverCrashInfo {
58 pub url: Option<String>,
59 pub node_token: Option<fidl::Event>,
60 #[doc(hidden)]
61 pub __source_breaking: fidl::marker::SourceBreaking,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverCrashInfo {}
65
66#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
67pub struct DriverMarker;
68
69impl fidl::endpoints::ProtocolMarker for DriverMarker {
70 type Proxy = DriverProxy;
71 type RequestStream = DriverRequestStream;
72 #[cfg(target_os = "fuchsia")]
73 type SynchronousProxy = DriverSynchronousProxy;
74
75 const DEBUG_NAME: &'static str = "(anonymous) Driver";
76}
77
78pub trait DriverProxyInterface: Send + Sync {
79 fn r#stop(&self) -> Result<(), fidl::Error>;
80}
81#[derive(Debug)]
82#[cfg(target_os = "fuchsia")]
83pub struct DriverSynchronousProxy {
84 client: fidl::client::sync::Client,
85}
86
87#[cfg(target_os = "fuchsia")]
88impl fidl::endpoints::SynchronousProxy for DriverSynchronousProxy {
89 type Proxy = DriverProxy;
90 type Protocol = DriverMarker;
91
92 fn from_channel(inner: fidl::Channel) -> Self {
93 Self::new(inner)
94 }
95
96 fn into_channel(self) -> fidl::Channel {
97 self.client.into_channel()
98 }
99
100 fn as_channel(&self) -> &fidl::Channel {
101 self.client.as_channel()
102 }
103}
104
105#[cfg(target_os = "fuchsia")]
106impl DriverSynchronousProxy {
107 pub fn new(channel: fidl::Channel) -> Self {
108 let protocol_name = <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
109 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
110 }
111
112 pub fn into_channel(self) -> fidl::Channel {
113 self.client.into_channel()
114 }
115
116 pub fn wait_for_event(
119 &self,
120 deadline: zx::MonotonicInstant,
121 ) -> Result<DriverEvent, fidl::Error> {
122 DriverEvent::decode(self.client.wait_for_event(deadline)?)
123 }
124
125 pub fn r#stop(&self) -> Result<(), fidl::Error> {
131 self.client.send::<fidl::encoding::EmptyPayload>(
132 (),
133 0x4039e87556689b5f,
134 fidl::encoding::DynamicFlags::empty(),
135 )
136 }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl From<DriverSynchronousProxy> for zx::Handle {
141 fn from(value: DriverSynchronousProxy) -> Self {
142 value.into_channel().into()
143 }
144}
145
146#[cfg(target_os = "fuchsia")]
147impl From<fidl::Channel> for DriverSynchronousProxy {
148 fn from(value: fidl::Channel) -> Self {
149 Self::new(value)
150 }
151}
152
153#[derive(Debug, Clone)]
154pub struct DriverProxy {
155 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
156}
157
158impl fidl::endpoints::Proxy for DriverProxy {
159 type Protocol = DriverMarker;
160
161 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
162 Self::new(inner)
163 }
164
165 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
166 self.client.into_channel().map_err(|client| Self { client })
167 }
168
169 fn as_channel(&self) -> &::fidl::AsyncChannel {
170 self.client.as_channel()
171 }
172}
173
174impl DriverProxy {
175 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
177 let protocol_name = <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
178 Self { client: fidl::client::Client::new(channel, protocol_name) }
179 }
180
181 pub fn take_event_stream(&self) -> DriverEventStream {
187 DriverEventStream { event_receiver: self.client.take_event_receiver() }
188 }
189
190 pub fn r#stop(&self) -> Result<(), fidl::Error> {
196 DriverProxyInterface::r#stop(self)
197 }
198}
199
200impl DriverProxyInterface for DriverProxy {
201 fn r#stop(&self) -> Result<(), fidl::Error> {
202 self.client.send::<fidl::encoding::EmptyPayload>(
203 (),
204 0x4039e87556689b5f,
205 fidl::encoding::DynamicFlags::empty(),
206 )
207 }
208}
209
210pub struct DriverEventStream {
211 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
212}
213
214impl std::marker::Unpin for DriverEventStream {}
215
216impl futures::stream::FusedStream for DriverEventStream {
217 fn is_terminated(&self) -> bool {
218 self.event_receiver.is_terminated()
219 }
220}
221
222impl futures::Stream for DriverEventStream {
223 type Item = Result<DriverEvent, fidl::Error>;
224
225 fn poll_next(
226 mut self: std::pin::Pin<&mut Self>,
227 cx: &mut std::task::Context<'_>,
228 ) -> std::task::Poll<Option<Self::Item>> {
229 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
230 &mut self.event_receiver,
231 cx
232 )?) {
233 Some(buf) => std::task::Poll::Ready(Some(DriverEvent::decode(buf))),
234 None => std::task::Poll::Ready(None),
235 }
236 }
237}
238
239#[derive(Debug)]
240pub enum DriverEvent {}
241
242impl DriverEvent {
243 fn decode(
245 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
246 ) -> Result<DriverEvent, fidl::Error> {
247 let (bytes, _handles) = buf.split_mut();
248 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
249 debug_assert_eq!(tx_header.tx_id, 0);
250 match tx_header.ordinal {
251 _ => Err(fidl::Error::UnknownOrdinal {
252 ordinal: tx_header.ordinal,
253 protocol_name: <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
254 }),
255 }
256 }
257}
258
259pub struct DriverRequestStream {
261 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
262 is_terminated: bool,
263}
264
265impl std::marker::Unpin for DriverRequestStream {}
266
267impl futures::stream::FusedStream for DriverRequestStream {
268 fn is_terminated(&self) -> bool {
269 self.is_terminated
270 }
271}
272
273impl fidl::endpoints::RequestStream for DriverRequestStream {
274 type Protocol = DriverMarker;
275 type ControlHandle = DriverControlHandle;
276
277 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
278 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
279 }
280
281 fn control_handle(&self) -> Self::ControlHandle {
282 DriverControlHandle { inner: self.inner.clone() }
283 }
284
285 fn into_inner(
286 self,
287 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
288 {
289 (self.inner, self.is_terminated)
290 }
291
292 fn from_inner(
293 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
294 is_terminated: bool,
295 ) -> Self {
296 Self { inner, is_terminated }
297 }
298}
299
300impl futures::Stream for DriverRequestStream {
301 type Item = Result<DriverRequest, fidl::Error>;
302
303 fn poll_next(
304 mut self: std::pin::Pin<&mut Self>,
305 cx: &mut std::task::Context<'_>,
306 ) -> std::task::Poll<Option<Self::Item>> {
307 let this = &mut *self;
308 if this.inner.check_shutdown(cx) {
309 this.is_terminated = true;
310 return std::task::Poll::Ready(None);
311 }
312 if this.is_terminated {
313 panic!("polled DriverRequestStream after completion");
314 }
315 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
316 |bytes, handles| {
317 match this.inner.channel().read_etc(cx, bytes, handles) {
318 std::task::Poll::Ready(Ok(())) => {}
319 std::task::Poll::Pending => return std::task::Poll::Pending,
320 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
321 this.is_terminated = true;
322 return std::task::Poll::Ready(None);
323 }
324 std::task::Poll::Ready(Err(e)) => {
325 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
326 e.into(),
327 ))))
328 }
329 }
330
331 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
333
334 std::task::Poll::Ready(Some(match header.ordinal {
335 0x4039e87556689b5f => {
336 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
337 let mut req = fidl::new_empty!(
338 fidl::encoding::EmptyPayload,
339 fidl::encoding::DefaultFuchsiaResourceDialect
340 );
341 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
342 let control_handle = DriverControlHandle { inner: this.inner.clone() };
343 Ok(DriverRequest::Stop { control_handle })
344 }
345 _ => Err(fidl::Error::UnknownOrdinal {
346 ordinal: header.ordinal,
347 protocol_name:
348 <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
349 }),
350 }))
351 },
352 )
353 }
354}
355
356#[derive(Debug)]
371pub enum DriverRequest {
372 Stop { control_handle: DriverControlHandle },
378}
379
380impl DriverRequest {
381 #[allow(irrefutable_let_patterns)]
382 pub fn into_stop(self) -> Option<(DriverControlHandle)> {
383 if let DriverRequest::Stop { control_handle } = self {
384 Some((control_handle))
385 } else {
386 None
387 }
388 }
389
390 pub fn method_name(&self) -> &'static str {
392 match *self {
393 DriverRequest::Stop { .. } => "stop",
394 }
395 }
396}
397
398#[derive(Debug, Clone)]
399pub struct DriverControlHandle {
400 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
401}
402
403impl fidl::endpoints::ControlHandle for DriverControlHandle {
404 fn shutdown(&self) {
405 self.inner.shutdown()
406 }
407 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
408 self.inner.shutdown_with_epitaph(status)
409 }
410
411 fn is_closed(&self) -> bool {
412 self.inner.channel().is_closed()
413 }
414 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
415 self.inner.channel().on_closed()
416 }
417
418 #[cfg(target_os = "fuchsia")]
419 fn signal_peer(
420 &self,
421 clear_mask: zx::Signals,
422 set_mask: zx::Signals,
423 ) -> Result<(), zx_status::Status> {
424 use fidl::Peered;
425 self.inner.channel().signal_peer(clear_mask, set_mask)
426 }
427}
428
429impl DriverControlHandle {}
430
431#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
432pub struct DriverHostMarker;
433
434impl fidl::endpoints::ProtocolMarker for DriverHostMarker {
435 type Proxy = DriverHostProxy;
436 type RequestStream = DriverHostRequestStream;
437 #[cfg(target_os = "fuchsia")]
438 type SynchronousProxy = DriverHostSynchronousProxy;
439
440 const DEBUG_NAME: &'static str = "fuchsia.driver.host.DriverHost";
441}
442impl fidl::endpoints::DiscoverableProtocolMarker for DriverHostMarker {}
443pub type DriverHostStartResult = Result<(), i32>;
444pub type DriverHostStartLoadedDriverResult = Result<(), i32>;
445pub type DriverHostGetProcessInfoResult =
446 Result<(u64, u64, u64, Vec<ThreadInfo>, Vec<DispatcherInfo>), i32>;
447pub type DriverHostFindDriverCrashInfoByThreadKoidResult = Result<DriverCrashInfo, i32>;
448
449pub trait DriverHostProxyInterface: Send + Sync {
450 type StartResponseFut: std::future::Future<Output = Result<DriverHostStartResult, fidl::Error>>
451 + Send;
452 fn r#start(
453 &self,
454 start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
455 driver: fidl::endpoints::ServerEnd<DriverMarker>,
456 ) -> Self::StartResponseFut;
457 type StartLoadedDriverResponseFut: std::future::Future<Output = Result<DriverHostStartLoadedDriverResult, fidl::Error>>
458 + Send;
459 fn r#start_loaded_driver(
460 &self,
461 start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
462 dynamic_linking_abi: u64,
463 driver: fidl::endpoints::ServerEnd<DriverMarker>,
464 ) -> Self::StartLoadedDriverResponseFut;
465 type GetProcessInfoResponseFut: std::future::Future<Output = Result<DriverHostGetProcessInfoResult, fidl::Error>>
466 + Send;
467 fn r#get_process_info(&self) -> Self::GetProcessInfoResponseFut;
468 fn r#install_loader(
469 &self,
470 loader: fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
471 ) -> Result<(), fidl::Error>;
472 type FindDriverCrashInfoByThreadKoidResponseFut: std::future::Future<
473 Output = Result<DriverHostFindDriverCrashInfoByThreadKoidResult, fidl::Error>,
474 > + Send;
475 fn r#find_driver_crash_info_by_thread_koid(
476 &self,
477 thread_koid: u64,
478 ) -> Self::FindDriverCrashInfoByThreadKoidResponseFut;
479}
480#[derive(Debug)]
481#[cfg(target_os = "fuchsia")]
482pub struct DriverHostSynchronousProxy {
483 client: fidl::client::sync::Client,
484}
485
486#[cfg(target_os = "fuchsia")]
487impl fidl::endpoints::SynchronousProxy for DriverHostSynchronousProxy {
488 type Proxy = DriverHostProxy;
489 type Protocol = DriverHostMarker;
490
491 fn from_channel(inner: fidl::Channel) -> Self {
492 Self::new(inner)
493 }
494
495 fn into_channel(self) -> fidl::Channel {
496 self.client.into_channel()
497 }
498
499 fn as_channel(&self) -> &fidl::Channel {
500 self.client.as_channel()
501 }
502}
503
504#[cfg(target_os = "fuchsia")]
505impl DriverHostSynchronousProxy {
506 pub fn new(channel: fidl::Channel) -> Self {
507 let protocol_name = <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
508 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
509 }
510
511 pub fn into_channel(self) -> fidl::Channel {
512 self.client.into_channel()
513 }
514
515 pub fn wait_for_event(
518 &self,
519 deadline: zx::MonotonicInstant,
520 ) -> Result<DriverHostEvent, fidl::Error> {
521 DriverHostEvent::decode(self.client.wait_for_event(deadline)?)
522 }
523
524 pub fn r#start(
526 &self,
527 mut start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
528 mut driver: fidl::endpoints::ServerEnd<DriverMarker>,
529 ___deadline: zx::MonotonicInstant,
530 ) -> Result<DriverHostStartResult, fidl::Error> {
531 let _response = self.client.send_query::<
532 DriverHostStartRequest,
533 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
534 >(
535 (&mut start_args, driver,),
536 0x1848852bd195bde5,
537 fidl::encoding::DynamicFlags::empty(),
538 ___deadline,
539 )?;
540 Ok(_response.map(|x| x))
541 }
542
543 pub fn r#start_loaded_driver(
545 &self,
546 mut start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
547 mut dynamic_linking_abi: u64,
548 mut driver: fidl::endpoints::ServerEnd<DriverMarker>,
549 ___deadline: zx::MonotonicInstant,
550 ) -> Result<DriverHostStartLoadedDriverResult, fidl::Error> {
551 let _response = self.client.send_query::<
552 DriverHostStartLoadedDriverRequest,
553 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
554 >(
555 (&mut start_args, dynamic_linking_abi, driver,),
556 0x51957548318c9368,
557 fidl::encoding::DynamicFlags::empty(),
558 ___deadline,
559 )?;
560 Ok(_response.map(|x| x))
561 }
562
563 pub fn r#get_process_info(
565 &self,
566 ___deadline: zx::MonotonicInstant,
567 ) -> Result<DriverHostGetProcessInfoResult, fidl::Error> {
568 let _response = self.client.send_query::<
569 fidl::encoding::EmptyPayload,
570 fidl::encoding::ResultType<ProcessInfo, i32>,
571 >(
572 (),
573 0x1b2d1b727a614973,
574 fidl::encoding::DynamicFlags::empty(),
575 ___deadline,
576 )?;
577 Ok(_response
578 .map(|x| (x.job_koid, x.process_koid, x.main_thread_koid, x.threads, x.dispatchers)))
579 }
580
581 pub fn r#install_loader(
584 &self,
585 mut loader: fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
586 ) -> Result<(), fidl::Error> {
587 self.client.send::<DriverHostInstallLoaderRequest>(
588 (loader,),
589 0x7022edafc5fcf5a3,
590 fidl::encoding::DynamicFlags::empty(),
591 )
592 }
593
594 pub fn r#find_driver_crash_info_by_thread_koid(
598 &self,
599 mut thread_koid: u64,
600 ___deadline: zx::MonotonicInstant,
601 ) -> Result<DriverHostFindDriverCrashInfoByThreadKoidResult, fidl::Error> {
602 let _response = self.client.send_query::<
603 DriverHostFindDriverCrashInfoByThreadKoidRequest,
604 fidl::encoding::ResultType<DriverCrashInfo, i32>,
605 >(
606 (thread_koid,),
607 0x18b3b336b45a7916,
608 fidl::encoding::DynamicFlags::empty(),
609 ___deadline,
610 )?;
611 Ok(_response.map(|x| x))
612 }
613}
614
615#[cfg(target_os = "fuchsia")]
616impl From<DriverHostSynchronousProxy> for zx::Handle {
617 fn from(value: DriverHostSynchronousProxy) -> Self {
618 value.into_channel().into()
619 }
620}
621
622#[cfg(target_os = "fuchsia")]
623impl From<fidl::Channel> for DriverHostSynchronousProxy {
624 fn from(value: fidl::Channel) -> Self {
625 Self::new(value)
626 }
627}
628
629#[derive(Debug, Clone)]
630pub struct DriverHostProxy {
631 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
632}
633
634impl fidl::endpoints::Proxy for DriverHostProxy {
635 type Protocol = DriverHostMarker;
636
637 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
638 Self::new(inner)
639 }
640
641 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
642 self.client.into_channel().map_err(|client| Self { client })
643 }
644
645 fn as_channel(&self) -> &::fidl::AsyncChannel {
646 self.client.as_channel()
647 }
648}
649
650impl DriverHostProxy {
651 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
653 let protocol_name = <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
654 Self { client: fidl::client::Client::new(channel, protocol_name) }
655 }
656
657 pub fn take_event_stream(&self) -> DriverHostEventStream {
663 DriverHostEventStream { event_receiver: self.client.take_event_receiver() }
664 }
665
666 pub fn r#start(
668 &self,
669 mut start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
670 mut driver: fidl::endpoints::ServerEnd<DriverMarker>,
671 ) -> fidl::client::QueryResponseFut<
672 DriverHostStartResult,
673 fidl::encoding::DefaultFuchsiaResourceDialect,
674 > {
675 DriverHostProxyInterface::r#start(self, start_args, driver)
676 }
677
678 pub fn r#start_loaded_driver(
680 &self,
681 mut start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
682 mut dynamic_linking_abi: u64,
683 mut driver: fidl::endpoints::ServerEnd<DriverMarker>,
684 ) -> fidl::client::QueryResponseFut<
685 DriverHostStartLoadedDriverResult,
686 fidl::encoding::DefaultFuchsiaResourceDialect,
687 > {
688 DriverHostProxyInterface::r#start_loaded_driver(
689 self,
690 start_args,
691 dynamic_linking_abi,
692 driver,
693 )
694 }
695
696 pub fn r#get_process_info(
698 &self,
699 ) -> fidl::client::QueryResponseFut<
700 DriverHostGetProcessInfoResult,
701 fidl::encoding::DefaultFuchsiaResourceDialect,
702 > {
703 DriverHostProxyInterface::r#get_process_info(self)
704 }
705
706 pub fn r#install_loader(
709 &self,
710 mut loader: fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
711 ) -> Result<(), fidl::Error> {
712 DriverHostProxyInterface::r#install_loader(self, loader)
713 }
714
715 pub fn r#find_driver_crash_info_by_thread_koid(
719 &self,
720 mut thread_koid: u64,
721 ) -> fidl::client::QueryResponseFut<
722 DriverHostFindDriverCrashInfoByThreadKoidResult,
723 fidl::encoding::DefaultFuchsiaResourceDialect,
724 > {
725 DriverHostProxyInterface::r#find_driver_crash_info_by_thread_koid(self, thread_koid)
726 }
727}
728
729impl DriverHostProxyInterface for DriverHostProxy {
730 type StartResponseFut = fidl::client::QueryResponseFut<
731 DriverHostStartResult,
732 fidl::encoding::DefaultFuchsiaResourceDialect,
733 >;
734 fn r#start(
735 &self,
736 mut start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
737 mut driver: fidl::endpoints::ServerEnd<DriverMarker>,
738 ) -> Self::StartResponseFut {
739 fn _decode(
740 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
741 ) -> Result<DriverHostStartResult, fidl::Error> {
742 let _response = fidl::client::decode_transaction_body::<
743 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
744 fidl::encoding::DefaultFuchsiaResourceDialect,
745 0x1848852bd195bde5,
746 >(_buf?)?;
747 Ok(_response.map(|x| x))
748 }
749 self.client.send_query_and_decode::<DriverHostStartRequest, DriverHostStartResult>(
750 (&mut start_args, driver),
751 0x1848852bd195bde5,
752 fidl::encoding::DynamicFlags::empty(),
753 _decode,
754 )
755 }
756
757 type StartLoadedDriverResponseFut = fidl::client::QueryResponseFut<
758 DriverHostStartLoadedDriverResult,
759 fidl::encoding::DefaultFuchsiaResourceDialect,
760 >;
761 fn r#start_loaded_driver(
762 &self,
763 mut start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
764 mut dynamic_linking_abi: u64,
765 mut driver: fidl::endpoints::ServerEnd<DriverMarker>,
766 ) -> Self::StartLoadedDriverResponseFut {
767 fn _decode(
768 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
769 ) -> Result<DriverHostStartLoadedDriverResult, fidl::Error> {
770 let _response = fidl::client::decode_transaction_body::<
771 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
772 fidl::encoding::DefaultFuchsiaResourceDialect,
773 0x51957548318c9368,
774 >(_buf?)?;
775 Ok(_response.map(|x| x))
776 }
777 self.client.send_query_and_decode::<
778 DriverHostStartLoadedDriverRequest,
779 DriverHostStartLoadedDriverResult,
780 >(
781 (&mut start_args, dynamic_linking_abi, driver,),
782 0x51957548318c9368,
783 fidl::encoding::DynamicFlags::empty(),
784 _decode,
785 )
786 }
787
788 type GetProcessInfoResponseFut = fidl::client::QueryResponseFut<
789 DriverHostGetProcessInfoResult,
790 fidl::encoding::DefaultFuchsiaResourceDialect,
791 >;
792 fn r#get_process_info(&self) -> Self::GetProcessInfoResponseFut {
793 fn _decode(
794 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
795 ) -> Result<DriverHostGetProcessInfoResult, fidl::Error> {
796 let _response = fidl::client::decode_transaction_body::<
797 fidl::encoding::ResultType<ProcessInfo, i32>,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 0x1b2d1b727a614973,
800 >(_buf?)?;
801 Ok(_response.map(|x| {
802 (x.job_koid, x.process_koid, x.main_thread_koid, x.threads, x.dispatchers)
803 }))
804 }
805 self.client
806 .send_query_and_decode::<fidl::encoding::EmptyPayload, DriverHostGetProcessInfoResult>(
807 (),
808 0x1b2d1b727a614973,
809 fidl::encoding::DynamicFlags::empty(),
810 _decode,
811 )
812 }
813
814 fn r#install_loader(
815 &self,
816 mut loader: fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
817 ) -> Result<(), fidl::Error> {
818 self.client.send::<DriverHostInstallLoaderRequest>(
819 (loader,),
820 0x7022edafc5fcf5a3,
821 fidl::encoding::DynamicFlags::empty(),
822 )
823 }
824
825 type FindDriverCrashInfoByThreadKoidResponseFut = fidl::client::QueryResponseFut<
826 DriverHostFindDriverCrashInfoByThreadKoidResult,
827 fidl::encoding::DefaultFuchsiaResourceDialect,
828 >;
829 fn r#find_driver_crash_info_by_thread_koid(
830 &self,
831 mut thread_koid: u64,
832 ) -> Self::FindDriverCrashInfoByThreadKoidResponseFut {
833 fn _decode(
834 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
835 ) -> Result<DriverHostFindDriverCrashInfoByThreadKoidResult, fidl::Error> {
836 let _response = fidl::client::decode_transaction_body::<
837 fidl::encoding::ResultType<DriverCrashInfo, i32>,
838 fidl::encoding::DefaultFuchsiaResourceDialect,
839 0x18b3b336b45a7916,
840 >(_buf?)?;
841 Ok(_response.map(|x| x))
842 }
843 self.client.send_query_and_decode::<
844 DriverHostFindDriverCrashInfoByThreadKoidRequest,
845 DriverHostFindDriverCrashInfoByThreadKoidResult,
846 >(
847 (thread_koid,),
848 0x18b3b336b45a7916,
849 fidl::encoding::DynamicFlags::empty(),
850 _decode,
851 )
852 }
853}
854
855pub struct DriverHostEventStream {
856 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
857}
858
859impl std::marker::Unpin for DriverHostEventStream {}
860
861impl futures::stream::FusedStream for DriverHostEventStream {
862 fn is_terminated(&self) -> bool {
863 self.event_receiver.is_terminated()
864 }
865}
866
867impl futures::Stream for DriverHostEventStream {
868 type Item = Result<DriverHostEvent, fidl::Error>;
869
870 fn poll_next(
871 mut self: std::pin::Pin<&mut Self>,
872 cx: &mut std::task::Context<'_>,
873 ) -> std::task::Poll<Option<Self::Item>> {
874 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
875 &mut self.event_receiver,
876 cx
877 )?) {
878 Some(buf) => std::task::Poll::Ready(Some(DriverHostEvent::decode(buf))),
879 None => std::task::Poll::Ready(None),
880 }
881 }
882}
883
884#[derive(Debug)]
885pub enum DriverHostEvent {}
886
887impl DriverHostEvent {
888 fn decode(
890 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
891 ) -> Result<DriverHostEvent, fidl::Error> {
892 let (bytes, _handles) = buf.split_mut();
893 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
894 debug_assert_eq!(tx_header.tx_id, 0);
895 match tx_header.ordinal {
896 _ => Err(fidl::Error::UnknownOrdinal {
897 ordinal: tx_header.ordinal,
898 protocol_name: <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
899 }),
900 }
901 }
902}
903
904pub struct DriverHostRequestStream {
906 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
907 is_terminated: bool,
908}
909
910impl std::marker::Unpin for DriverHostRequestStream {}
911
912impl futures::stream::FusedStream for DriverHostRequestStream {
913 fn is_terminated(&self) -> bool {
914 self.is_terminated
915 }
916}
917
918impl fidl::endpoints::RequestStream for DriverHostRequestStream {
919 type Protocol = DriverHostMarker;
920 type ControlHandle = DriverHostControlHandle;
921
922 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
923 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
924 }
925
926 fn control_handle(&self) -> Self::ControlHandle {
927 DriverHostControlHandle { inner: self.inner.clone() }
928 }
929
930 fn into_inner(
931 self,
932 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
933 {
934 (self.inner, self.is_terminated)
935 }
936
937 fn from_inner(
938 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
939 is_terminated: bool,
940 ) -> Self {
941 Self { inner, is_terminated }
942 }
943}
944
945impl futures::Stream for DriverHostRequestStream {
946 type Item = Result<DriverHostRequest, fidl::Error>;
947
948 fn poll_next(
949 mut self: std::pin::Pin<&mut Self>,
950 cx: &mut std::task::Context<'_>,
951 ) -> std::task::Poll<Option<Self::Item>> {
952 let this = &mut *self;
953 if this.inner.check_shutdown(cx) {
954 this.is_terminated = true;
955 return std::task::Poll::Ready(None);
956 }
957 if this.is_terminated {
958 panic!("polled DriverHostRequestStream after completion");
959 }
960 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
961 |bytes, handles| {
962 match this.inner.channel().read_etc(cx, bytes, handles) {
963 std::task::Poll::Ready(Ok(())) => {}
964 std::task::Poll::Pending => return std::task::Poll::Pending,
965 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
966 this.is_terminated = true;
967 return std::task::Poll::Ready(None);
968 }
969 std::task::Poll::Ready(Err(e)) => {
970 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
971 e.into(),
972 ))))
973 }
974 }
975
976 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
978
979 std::task::Poll::Ready(Some(match header.ordinal {
980 0x1848852bd195bde5 => {
981 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
982 let mut req = fidl::new_empty!(
983 DriverHostStartRequest,
984 fidl::encoding::DefaultFuchsiaResourceDialect
985 );
986 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostStartRequest>(&header, _body_bytes, handles, &mut req)?;
987 let control_handle = DriverHostControlHandle { inner: this.inner.clone() };
988 Ok(DriverHostRequest::Start {
989 start_args: req.start_args,
990 driver: req.driver,
991
992 responder: DriverHostStartResponder {
993 control_handle: std::mem::ManuallyDrop::new(control_handle),
994 tx_id: header.tx_id,
995 },
996 })
997 }
998 0x51957548318c9368 => {
999 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1000 let mut req = fidl::new_empty!(
1001 DriverHostStartLoadedDriverRequest,
1002 fidl::encoding::DefaultFuchsiaResourceDialect
1003 );
1004 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostStartLoadedDriverRequest>(&header, _body_bytes, handles, &mut req)?;
1005 let control_handle = DriverHostControlHandle { inner: this.inner.clone() };
1006 Ok(DriverHostRequest::StartLoadedDriver {
1007 start_args: req.start_args,
1008 dynamic_linking_abi: req.dynamic_linking_abi,
1009 driver: req.driver,
1010
1011 responder: DriverHostStartLoadedDriverResponder {
1012 control_handle: std::mem::ManuallyDrop::new(control_handle),
1013 tx_id: header.tx_id,
1014 },
1015 })
1016 }
1017 0x1b2d1b727a614973 => {
1018 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1019 let mut req = fidl::new_empty!(
1020 fidl::encoding::EmptyPayload,
1021 fidl::encoding::DefaultFuchsiaResourceDialect
1022 );
1023 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1024 let control_handle = DriverHostControlHandle { inner: this.inner.clone() };
1025 Ok(DriverHostRequest::GetProcessInfo {
1026 responder: DriverHostGetProcessInfoResponder {
1027 control_handle: std::mem::ManuallyDrop::new(control_handle),
1028 tx_id: header.tx_id,
1029 },
1030 })
1031 }
1032 0x7022edafc5fcf5a3 => {
1033 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1034 let mut req = fidl::new_empty!(
1035 DriverHostInstallLoaderRequest,
1036 fidl::encoding::DefaultFuchsiaResourceDialect
1037 );
1038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostInstallLoaderRequest>(&header, _body_bytes, handles, &mut req)?;
1039 let control_handle = DriverHostControlHandle { inner: this.inner.clone() };
1040 Ok(DriverHostRequest::InstallLoader { loader: req.loader, control_handle })
1041 }
1042 0x18b3b336b45a7916 => {
1043 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1044 let mut req = fidl::new_empty!(
1045 DriverHostFindDriverCrashInfoByThreadKoidRequest,
1046 fidl::encoding::DefaultFuchsiaResourceDialect
1047 );
1048 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostFindDriverCrashInfoByThreadKoidRequest>(&header, _body_bytes, handles, &mut req)?;
1049 let control_handle = DriverHostControlHandle { inner: this.inner.clone() };
1050 Ok(DriverHostRequest::FindDriverCrashInfoByThreadKoid {
1051 thread_koid: req.thread_koid,
1052
1053 responder: DriverHostFindDriverCrashInfoByThreadKoidResponder {
1054 control_handle: std::mem::ManuallyDrop::new(control_handle),
1055 tx_id: header.tx_id,
1056 },
1057 })
1058 }
1059 _ => Err(fidl::Error::UnknownOrdinal {
1060 ordinal: header.ordinal,
1061 protocol_name:
1062 <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1063 }),
1064 }))
1065 },
1066 )
1067 }
1068}
1069
1070#[derive(Debug)]
1072pub enum DriverHostRequest {
1073 Start {
1075 start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
1076 driver: fidl::endpoints::ServerEnd<DriverMarker>,
1077 responder: DriverHostStartResponder,
1078 },
1079 StartLoadedDriver {
1081 start_args: fidl_fuchsia_driver_framework::DriverStartArgs,
1082 dynamic_linking_abi: u64,
1083 driver: fidl::endpoints::ServerEnd<DriverMarker>,
1084 responder: DriverHostStartLoadedDriverResponder,
1085 },
1086 GetProcessInfo { responder: DriverHostGetProcessInfoResponder },
1088 InstallLoader {
1091 loader: fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1092 control_handle: DriverHostControlHandle,
1093 },
1094 FindDriverCrashInfoByThreadKoid {
1098 thread_koid: u64,
1099 responder: DriverHostFindDriverCrashInfoByThreadKoidResponder,
1100 },
1101}
1102
1103impl DriverHostRequest {
1104 #[allow(irrefutable_let_patterns)]
1105 pub fn into_start(
1106 self,
1107 ) -> Option<(
1108 fidl_fuchsia_driver_framework::DriverStartArgs,
1109 fidl::endpoints::ServerEnd<DriverMarker>,
1110 DriverHostStartResponder,
1111 )> {
1112 if let DriverHostRequest::Start { start_args, driver, responder } = self {
1113 Some((start_args, driver, responder))
1114 } else {
1115 None
1116 }
1117 }
1118
1119 #[allow(irrefutable_let_patterns)]
1120 pub fn into_start_loaded_driver(
1121 self,
1122 ) -> Option<(
1123 fidl_fuchsia_driver_framework::DriverStartArgs,
1124 u64,
1125 fidl::endpoints::ServerEnd<DriverMarker>,
1126 DriverHostStartLoadedDriverResponder,
1127 )> {
1128 if let DriverHostRequest::StartLoadedDriver {
1129 start_args,
1130 dynamic_linking_abi,
1131 driver,
1132 responder,
1133 } = self
1134 {
1135 Some((start_args, dynamic_linking_abi, driver, responder))
1136 } else {
1137 None
1138 }
1139 }
1140
1141 #[allow(irrefutable_let_patterns)]
1142 pub fn into_get_process_info(self) -> Option<(DriverHostGetProcessInfoResponder)> {
1143 if let DriverHostRequest::GetProcessInfo { responder } = self {
1144 Some((responder))
1145 } else {
1146 None
1147 }
1148 }
1149
1150 #[allow(irrefutable_let_patterns)]
1151 pub fn into_install_loader(
1152 self,
1153 ) -> Option<(
1154 fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1155 DriverHostControlHandle,
1156 )> {
1157 if let DriverHostRequest::InstallLoader { loader, control_handle } = self {
1158 Some((loader, control_handle))
1159 } else {
1160 None
1161 }
1162 }
1163
1164 #[allow(irrefutable_let_patterns)]
1165 pub fn into_find_driver_crash_info_by_thread_koid(
1166 self,
1167 ) -> Option<(u64, DriverHostFindDriverCrashInfoByThreadKoidResponder)> {
1168 if let DriverHostRequest::FindDriverCrashInfoByThreadKoid { thread_koid, responder } = self
1169 {
1170 Some((thread_koid, responder))
1171 } else {
1172 None
1173 }
1174 }
1175
1176 pub fn method_name(&self) -> &'static str {
1178 match *self {
1179 DriverHostRequest::Start { .. } => "start",
1180 DriverHostRequest::StartLoadedDriver { .. } => "start_loaded_driver",
1181 DriverHostRequest::GetProcessInfo { .. } => "get_process_info",
1182 DriverHostRequest::InstallLoader { .. } => "install_loader",
1183 DriverHostRequest::FindDriverCrashInfoByThreadKoid { .. } => {
1184 "find_driver_crash_info_by_thread_koid"
1185 }
1186 }
1187 }
1188}
1189
1190#[derive(Debug, Clone)]
1191pub struct DriverHostControlHandle {
1192 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1193}
1194
1195impl fidl::endpoints::ControlHandle for DriverHostControlHandle {
1196 fn shutdown(&self) {
1197 self.inner.shutdown()
1198 }
1199 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1200 self.inner.shutdown_with_epitaph(status)
1201 }
1202
1203 fn is_closed(&self) -> bool {
1204 self.inner.channel().is_closed()
1205 }
1206 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1207 self.inner.channel().on_closed()
1208 }
1209
1210 #[cfg(target_os = "fuchsia")]
1211 fn signal_peer(
1212 &self,
1213 clear_mask: zx::Signals,
1214 set_mask: zx::Signals,
1215 ) -> Result<(), zx_status::Status> {
1216 use fidl::Peered;
1217 self.inner.channel().signal_peer(clear_mask, set_mask)
1218 }
1219}
1220
1221impl DriverHostControlHandle {}
1222
1223#[must_use = "FIDL methods require a response to be sent"]
1224#[derive(Debug)]
1225pub struct DriverHostStartResponder {
1226 control_handle: std::mem::ManuallyDrop<DriverHostControlHandle>,
1227 tx_id: u32,
1228}
1229
1230impl std::ops::Drop for DriverHostStartResponder {
1234 fn drop(&mut self) {
1235 self.control_handle.shutdown();
1236 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1238 }
1239}
1240
1241impl fidl::endpoints::Responder for DriverHostStartResponder {
1242 type ControlHandle = DriverHostControlHandle;
1243
1244 fn control_handle(&self) -> &DriverHostControlHandle {
1245 &self.control_handle
1246 }
1247
1248 fn drop_without_shutdown(mut self) {
1249 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1251 std::mem::forget(self);
1253 }
1254}
1255
1256impl DriverHostStartResponder {
1257 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1261 let _result = self.send_raw(result);
1262 if _result.is_err() {
1263 self.control_handle.shutdown();
1264 }
1265 self.drop_without_shutdown();
1266 _result
1267 }
1268
1269 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1271 let _result = self.send_raw(result);
1272 self.drop_without_shutdown();
1273 _result
1274 }
1275
1276 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1277 self.control_handle
1278 .inner
1279 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1280 result,
1281 self.tx_id,
1282 0x1848852bd195bde5,
1283 fidl::encoding::DynamicFlags::empty(),
1284 )
1285 }
1286}
1287
1288#[must_use = "FIDL methods require a response to be sent"]
1289#[derive(Debug)]
1290pub struct DriverHostStartLoadedDriverResponder {
1291 control_handle: std::mem::ManuallyDrop<DriverHostControlHandle>,
1292 tx_id: u32,
1293}
1294
1295impl std::ops::Drop for DriverHostStartLoadedDriverResponder {
1299 fn drop(&mut self) {
1300 self.control_handle.shutdown();
1301 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1303 }
1304}
1305
1306impl fidl::endpoints::Responder for DriverHostStartLoadedDriverResponder {
1307 type ControlHandle = DriverHostControlHandle;
1308
1309 fn control_handle(&self) -> &DriverHostControlHandle {
1310 &self.control_handle
1311 }
1312
1313 fn drop_without_shutdown(mut self) {
1314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1316 std::mem::forget(self);
1318 }
1319}
1320
1321impl DriverHostStartLoadedDriverResponder {
1322 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1326 let _result = self.send_raw(result);
1327 if _result.is_err() {
1328 self.control_handle.shutdown();
1329 }
1330 self.drop_without_shutdown();
1331 _result
1332 }
1333
1334 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1336 let _result = self.send_raw(result);
1337 self.drop_without_shutdown();
1338 _result
1339 }
1340
1341 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1342 self.control_handle
1343 .inner
1344 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1345 result,
1346 self.tx_id,
1347 0x51957548318c9368,
1348 fidl::encoding::DynamicFlags::empty(),
1349 )
1350 }
1351}
1352
1353#[must_use = "FIDL methods require a response to be sent"]
1354#[derive(Debug)]
1355pub struct DriverHostGetProcessInfoResponder {
1356 control_handle: std::mem::ManuallyDrop<DriverHostControlHandle>,
1357 tx_id: u32,
1358}
1359
1360impl std::ops::Drop for DriverHostGetProcessInfoResponder {
1364 fn drop(&mut self) {
1365 self.control_handle.shutdown();
1366 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368 }
1369}
1370
1371impl fidl::endpoints::Responder for DriverHostGetProcessInfoResponder {
1372 type ControlHandle = DriverHostControlHandle;
1373
1374 fn control_handle(&self) -> &DriverHostControlHandle {
1375 &self.control_handle
1376 }
1377
1378 fn drop_without_shutdown(mut self) {
1379 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1381 std::mem::forget(self);
1383 }
1384}
1385
1386impl DriverHostGetProcessInfoResponder {
1387 pub fn send(
1391 self,
1392 mut result: Result<(u64, u64, u64, &[ThreadInfo], &[DispatcherInfo]), i32>,
1393 ) -> Result<(), fidl::Error> {
1394 let _result = self.send_raw(result);
1395 if _result.is_err() {
1396 self.control_handle.shutdown();
1397 }
1398 self.drop_without_shutdown();
1399 _result
1400 }
1401
1402 pub fn send_no_shutdown_on_err(
1404 self,
1405 mut result: Result<(u64, u64, u64, &[ThreadInfo], &[DispatcherInfo]), i32>,
1406 ) -> Result<(), fidl::Error> {
1407 let _result = self.send_raw(result);
1408 self.drop_without_shutdown();
1409 _result
1410 }
1411
1412 fn send_raw(
1413 &self,
1414 mut result: Result<(u64, u64, u64, &[ThreadInfo], &[DispatcherInfo]), i32>,
1415 ) -> Result<(), fidl::Error> {
1416 self.control_handle.inner.send::<fidl::encoding::ResultType<ProcessInfo, i32>>(
1417 result,
1418 self.tx_id,
1419 0x1b2d1b727a614973,
1420 fidl::encoding::DynamicFlags::empty(),
1421 )
1422 }
1423}
1424
1425#[must_use = "FIDL methods require a response to be sent"]
1426#[derive(Debug)]
1427pub struct DriverHostFindDriverCrashInfoByThreadKoidResponder {
1428 control_handle: std::mem::ManuallyDrop<DriverHostControlHandle>,
1429 tx_id: u32,
1430}
1431
1432impl std::ops::Drop for DriverHostFindDriverCrashInfoByThreadKoidResponder {
1436 fn drop(&mut self) {
1437 self.control_handle.shutdown();
1438 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1440 }
1441}
1442
1443impl fidl::endpoints::Responder for DriverHostFindDriverCrashInfoByThreadKoidResponder {
1444 type ControlHandle = DriverHostControlHandle;
1445
1446 fn control_handle(&self) -> &DriverHostControlHandle {
1447 &self.control_handle
1448 }
1449
1450 fn drop_without_shutdown(mut self) {
1451 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1453 std::mem::forget(self);
1455 }
1456}
1457
1458impl DriverHostFindDriverCrashInfoByThreadKoidResponder {
1459 pub fn send(self, mut result: Result<DriverCrashInfo, i32>) -> Result<(), fidl::Error> {
1463 let _result = self.send_raw(result);
1464 if _result.is_err() {
1465 self.control_handle.shutdown();
1466 }
1467 self.drop_without_shutdown();
1468 _result
1469 }
1470
1471 pub fn send_no_shutdown_on_err(
1473 self,
1474 mut result: Result<DriverCrashInfo, i32>,
1475 ) -> Result<(), fidl::Error> {
1476 let _result = self.send_raw(result);
1477 self.drop_without_shutdown();
1478 _result
1479 }
1480
1481 fn send_raw(&self, mut result: Result<DriverCrashInfo, i32>) -> Result<(), fidl::Error> {
1482 self.control_handle.inner.send::<fidl::encoding::ResultType<DriverCrashInfo, i32>>(
1483 result.as_mut().map_err(|e| *e),
1484 self.tx_id,
1485 0x18b3b336b45a7916,
1486 fidl::encoding::DynamicFlags::empty(),
1487 )
1488 }
1489}
1490
1491mod internal {
1492 use super::*;
1493
1494 impl fidl::encoding::ResourceTypeMarker for DriverHostFindDriverCrashInfoByThreadKoidRequest {
1495 type Borrowed<'a> = &'a mut Self;
1496 fn take_or_borrow<'a>(
1497 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1498 ) -> Self::Borrowed<'a> {
1499 value
1500 }
1501 }
1502
1503 unsafe impl fidl::encoding::TypeMarker for DriverHostFindDriverCrashInfoByThreadKoidRequest {
1504 type Owned = Self;
1505
1506 #[inline(always)]
1507 fn inline_align(_context: fidl::encoding::Context) -> usize {
1508 8
1509 }
1510
1511 #[inline(always)]
1512 fn inline_size(_context: fidl::encoding::Context) -> usize {
1513 8
1514 }
1515 #[inline(always)]
1516 fn encode_is_copy() -> bool {
1517 true
1518 }
1519
1520 #[inline(always)]
1521 fn decode_is_copy() -> bool {
1522 true
1523 }
1524 }
1525
1526 unsafe impl
1527 fidl::encoding::Encode<
1528 DriverHostFindDriverCrashInfoByThreadKoidRequest,
1529 fidl::encoding::DefaultFuchsiaResourceDialect,
1530 > for &mut DriverHostFindDriverCrashInfoByThreadKoidRequest
1531 {
1532 #[inline]
1533 unsafe fn encode(
1534 self,
1535 encoder: &mut fidl::encoding::Encoder<
1536 '_,
1537 fidl::encoding::DefaultFuchsiaResourceDialect,
1538 >,
1539 offset: usize,
1540 _depth: fidl::encoding::Depth,
1541 ) -> fidl::Result<()> {
1542 encoder.debug_check_bounds::<DriverHostFindDriverCrashInfoByThreadKoidRequest>(offset);
1543 unsafe {
1544 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1546 (buf_ptr as *mut DriverHostFindDriverCrashInfoByThreadKoidRequest).write_unaligned(
1547 (self as *const DriverHostFindDriverCrashInfoByThreadKoidRequest).read(),
1548 );
1549 }
1552 Ok(())
1553 }
1554 }
1555 unsafe impl<T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>>
1556 fidl::encoding::Encode<
1557 DriverHostFindDriverCrashInfoByThreadKoidRequest,
1558 fidl::encoding::DefaultFuchsiaResourceDialect,
1559 > for (T0,)
1560 {
1561 #[inline]
1562 unsafe fn encode(
1563 self,
1564 encoder: &mut fidl::encoding::Encoder<
1565 '_,
1566 fidl::encoding::DefaultFuchsiaResourceDialect,
1567 >,
1568 offset: usize,
1569 depth: fidl::encoding::Depth,
1570 ) -> fidl::Result<()> {
1571 encoder.debug_check_bounds::<DriverHostFindDriverCrashInfoByThreadKoidRequest>(offset);
1572 self.0.encode(encoder, offset + 0, depth)?;
1576 Ok(())
1577 }
1578 }
1579
1580 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1581 for DriverHostFindDriverCrashInfoByThreadKoidRequest
1582 {
1583 #[inline(always)]
1584 fn new_empty() -> Self {
1585 Self {
1586 thread_koid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
1587 }
1588 }
1589
1590 #[inline]
1591 unsafe fn decode(
1592 &mut self,
1593 decoder: &mut fidl::encoding::Decoder<
1594 '_,
1595 fidl::encoding::DefaultFuchsiaResourceDialect,
1596 >,
1597 offset: usize,
1598 _depth: fidl::encoding::Depth,
1599 ) -> fidl::Result<()> {
1600 decoder.debug_check_bounds::<Self>(offset);
1601 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1602 unsafe {
1605 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1606 }
1607 Ok(())
1608 }
1609 }
1610
1611 impl fidl::encoding::ResourceTypeMarker for DriverHostInstallLoaderRequest {
1612 type Borrowed<'a> = &'a mut Self;
1613 fn take_or_borrow<'a>(
1614 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1615 ) -> Self::Borrowed<'a> {
1616 value
1617 }
1618 }
1619
1620 unsafe impl fidl::encoding::TypeMarker for DriverHostInstallLoaderRequest {
1621 type Owned = Self;
1622
1623 #[inline(always)]
1624 fn inline_align(_context: fidl::encoding::Context) -> usize {
1625 4
1626 }
1627
1628 #[inline(always)]
1629 fn inline_size(_context: fidl::encoding::Context) -> usize {
1630 4
1631 }
1632 }
1633
1634 unsafe impl
1635 fidl::encoding::Encode<
1636 DriverHostInstallLoaderRequest,
1637 fidl::encoding::DefaultFuchsiaResourceDialect,
1638 > for &mut DriverHostInstallLoaderRequest
1639 {
1640 #[inline]
1641 unsafe fn encode(
1642 self,
1643 encoder: &mut fidl::encoding::Encoder<
1644 '_,
1645 fidl::encoding::DefaultFuchsiaResourceDialect,
1646 >,
1647 offset: usize,
1648 _depth: fidl::encoding::Depth,
1649 ) -> fidl::Result<()> {
1650 encoder.debug_check_bounds::<DriverHostInstallLoaderRequest>(offset);
1651 fidl::encoding::Encode::<
1653 DriverHostInstallLoaderRequest,
1654 fidl::encoding::DefaultFuchsiaResourceDialect,
1655 >::encode(
1656 (<fidl::encoding::Endpoint<
1657 fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1658 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1659 &mut self.loader
1660 ),),
1661 encoder,
1662 offset,
1663 _depth,
1664 )
1665 }
1666 }
1667 unsafe impl<
1668 T0: fidl::encoding::Encode<
1669 fidl::encoding::Endpoint<
1670 fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1671 >,
1672 fidl::encoding::DefaultFuchsiaResourceDialect,
1673 >,
1674 >
1675 fidl::encoding::Encode<
1676 DriverHostInstallLoaderRequest,
1677 fidl::encoding::DefaultFuchsiaResourceDialect,
1678 > for (T0,)
1679 {
1680 #[inline]
1681 unsafe fn encode(
1682 self,
1683 encoder: &mut fidl::encoding::Encoder<
1684 '_,
1685 fidl::encoding::DefaultFuchsiaResourceDialect,
1686 >,
1687 offset: usize,
1688 depth: fidl::encoding::Depth,
1689 ) -> fidl::Result<()> {
1690 encoder.debug_check_bounds::<DriverHostInstallLoaderRequest>(offset);
1691 self.0.encode(encoder, offset + 0, depth)?;
1695 Ok(())
1696 }
1697 }
1698
1699 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1700 for DriverHostInstallLoaderRequest
1701 {
1702 #[inline(always)]
1703 fn new_empty() -> Self {
1704 Self {
1705 loader: fidl::new_empty!(
1706 fidl::encoding::Endpoint<
1707 fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1708 >,
1709 fidl::encoding::DefaultFuchsiaResourceDialect
1710 ),
1711 }
1712 }
1713
1714 #[inline]
1715 unsafe fn decode(
1716 &mut self,
1717 decoder: &mut fidl::encoding::Decoder<
1718 '_,
1719 fidl::encoding::DefaultFuchsiaResourceDialect,
1720 >,
1721 offset: usize,
1722 _depth: fidl::encoding::Depth,
1723 ) -> fidl::Result<()> {
1724 decoder.debug_check_bounds::<Self>(offset);
1725 fidl::decode!(
1727 fidl::encoding::Endpoint<
1728 fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1729 >,
1730 fidl::encoding::DefaultFuchsiaResourceDialect,
1731 &mut self.loader,
1732 decoder,
1733 offset + 0,
1734 _depth
1735 )?;
1736 Ok(())
1737 }
1738 }
1739
1740 impl fidl::encoding::ResourceTypeMarker for DriverHostStartLoadedDriverRequest {
1741 type Borrowed<'a> = &'a mut Self;
1742 fn take_or_borrow<'a>(
1743 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1744 ) -> Self::Borrowed<'a> {
1745 value
1746 }
1747 }
1748
1749 unsafe impl fidl::encoding::TypeMarker for DriverHostStartLoadedDriverRequest {
1750 type Owned = Self;
1751
1752 #[inline(always)]
1753 fn inline_align(_context: fidl::encoding::Context) -> usize {
1754 8
1755 }
1756
1757 #[inline(always)]
1758 fn inline_size(_context: fidl::encoding::Context) -> usize {
1759 32
1760 }
1761 }
1762
1763 unsafe impl
1764 fidl::encoding::Encode<
1765 DriverHostStartLoadedDriverRequest,
1766 fidl::encoding::DefaultFuchsiaResourceDialect,
1767 > for &mut DriverHostStartLoadedDriverRequest
1768 {
1769 #[inline]
1770 unsafe fn encode(
1771 self,
1772 encoder: &mut fidl::encoding::Encoder<
1773 '_,
1774 fidl::encoding::DefaultFuchsiaResourceDialect,
1775 >,
1776 offset: usize,
1777 _depth: fidl::encoding::Depth,
1778 ) -> fidl::Result<()> {
1779 encoder.debug_check_bounds::<DriverHostStartLoadedDriverRequest>(offset);
1780 fidl::encoding::Encode::<DriverHostStartLoadedDriverRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1782 (
1783 <fidl_fuchsia_driver_framework::DriverStartArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_args),
1784 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dynamic_linking_abi),
1785 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.driver),
1786 ),
1787 encoder, offset, _depth
1788 )
1789 }
1790 }
1791 unsafe impl<
1792 T0: fidl::encoding::Encode<
1793 fidl_fuchsia_driver_framework::DriverStartArgs,
1794 fidl::encoding::DefaultFuchsiaResourceDialect,
1795 >,
1796 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1797 T2: fidl::encoding::Encode<
1798 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>>,
1799 fidl::encoding::DefaultFuchsiaResourceDialect,
1800 >,
1801 >
1802 fidl::encoding::Encode<
1803 DriverHostStartLoadedDriverRequest,
1804 fidl::encoding::DefaultFuchsiaResourceDialect,
1805 > for (T0, T1, T2)
1806 {
1807 #[inline]
1808 unsafe fn encode(
1809 self,
1810 encoder: &mut fidl::encoding::Encoder<
1811 '_,
1812 fidl::encoding::DefaultFuchsiaResourceDialect,
1813 >,
1814 offset: usize,
1815 depth: fidl::encoding::Depth,
1816 ) -> fidl::Result<()> {
1817 encoder.debug_check_bounds::<DriverHostStartLoadedDriverRequest>(offset);
1818 unsafe {
1821 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1822 (ptr as *mut u64).write_unaligned(0);
1823 }
1824 self.0.encode(encoder, offset + 0, depth)?;
1826 self.1.encode(encoder, offset + 16, depth)?;
1827 self.2.encode(encoder, offset + 24, depth)?;
1828 Ok(())
1829 }
1830 }
1831
1832 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1833 for DriverHostStartLoadedDriverRequest
1834 {
1835 #[inline(always)]
1836 fn new_empty() -> Self {
1837 Self {
1838 start_args: fidl::new_empty!(
1839 fidl_fuchsia_driver_framework::DriverStartArgs,
1840 fidl::encoding::DefaultFuchsiaResourceDialect
1841 ),
1842 dynamic_linking_abi: fidl::new_empty!(
1843 u64,
1844 fidl::encoding::DefaultFuchsiaResourceDialect
1845 ),
1846 driver: fidl::new_empty!(
1847 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>>,
1848 fidl::encoding::DefaultFuchsiaResourceDialect
1849 ),
1850 }
1851 }
1852
1853 #[inline]
1854 unsafe fn decode(
1855 &mut self,
1856 decoder: &mut fidl::encoding::Decoder<
1857 '_,
1858 fidl::encoding::DefaultFuchsiaResourceDialect,
1859 >,
1860 offset: usize,
1861 _depth: fidl::encoding::Depth,
1862 ) -> fidl::Result<()> {
1863 decoder.debug_check_bounds::<Self>(offset);
1864 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1866 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1867 let mask = 0xffffffff00000000u64;
1868 let maskedval = padval & mask;
1869 if maskedval != 0 {
1870 return Err(fidl::Error::NonZeroPadding {
1871 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1872 });
1873 }
1874 fidl::decode!(
1875 fidl_fuchsia_driver_framework::DriverStartArgs,
1876 fidl::encoding::DefaultFuchsiaResourceDialect,
1877 &mut self.start_args,
1878 decoder,
1879 offset + 0,
1880 _depth
1881 )?;
1882 fidl::decode!(
1883 u64,
1884 fidl::encoding::DefaultFuchsiaResourceDialect,
1885 &mut self.dynamic_linking_abi,
1886 decoder,
1887 offset + 16,
1888 _depth
1889 )?;
1890 fidl::decode!(
1891 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>>,
1892 fidl::encoding::DefaultFuchsiaResourceDialect,
1893 &mut self.driver,
1894 decoder,
1895 offset + 24,
1896 _depth
1897 )?;
1898 Ok(())
1899 }
1900 }
1901
1902 impl fidl::encoding::ResourceTypeMarker for DriverHostStartRequest {
1903 type Borrowed<'a> = &'a mut Self;
1904 fn take_or_borrow<'a>(
1905 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1906 ) -> Self::Borrowed<'a> {
1907 value
1908 }
1909 }
1910
1911 unsafe impl fidl::encoding::TypeMarker for DriverHostStartRequest {
1912 type Owned = Self;
1913
1914 #[inline(always)]
1915 fn inline_align(_context: fidl::encoding::Context) -> usize {
1916 8
1917 }
1918
1919 #[inline(always)]
1920 fn inline_size(_context: fidl::encoding::Context) -> usize {
1921 24
1922 }
1923 }
1924
1925 unsafe impl
1926 fidl::encoding::Encode<
1927 DriverHostStartRequest,
1928 fidl::encoding::DefaultFuchsiaResourceDialect,
1929 > for &mut DriverHostStartRequest
1930 {
1931 #[inline]
1932 unsafe fn encode(
1933 self,
1934 encoder: &mut fidl::encoding::Encoder<
1935 '_,
1936 fidl::encoding::DefaultFuchsiaResourceDialect,
1937 >,
1938 offset: usize,
1939 _depth: fidl::encoding::Depth,
1940 ) -> fidl::Result<()> {
1941 encoder.debug_check_bounds::<DriverHostStartRequest>(offset);
1942 fidl::encoding::Encode::<DriverHostStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1944 (
1945 <fidl_fuchsia_driver_framework::DriverStartArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_args),
1946 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.driver),
1947 ),
1948 encoder, offset, _depth
1949 )
1950 }
1951 }
1952 unsafe impl<
1953 T0: fidl::encoding::Encode<
1954 fidl_fuchsia_driver_framework::DriverStartArgs,
1955 fidl::encoding::DefaultFuchsiaResourceDialect,
1956 >,
1957 T1: fidl::encoding::Encode<
1958 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>>,
1959 fidl::encoding::DefaultFuchsiaResourceDialect,
1960 >,
1961 >
1962 fidl::encoding::Encode<
1963 DriverHostStartRequest,
1964 fidl::encoding::DefaultFuchsiaResourceDialect,
1965 > for (T0, T1)
1966 {
1967 #[inline]
1968 unsafe fn encode(
1969 self,
1970 encoder: &mut fidl::encoding::Encoder<
1971 '_,
1972 fidl::encoding::DefaultFuchsiaResourceDialect,
1973 >,
1974 offset: usize,
1975 depth: fidl::encoding::Depth,
1976 ) -> fidl::Result<()> {
1977 encoder.debug_check_bounds::<DriverHostStartRequest>(offset);
1978 unsafe {
1981 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1982 (ptr as *mut u64).write_unaligned(0);
1983 }
1984 self.0.encode(encoder, offset + 0, depth)?;
1986 self.1.encode(encoder, offset + 16, depth)?;
1987 Ok(())
1988 }
1989 }
1990
1991 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1992 for DriverHostStartRequest
1993 {
1994 #[inline(always)]
1995 fn new_empty() -> Self {
1996 Self {
1997 start_args: fidl::new_empty!(
1998 fidl_fuchsia_driver_framework::DriverStartArgs,
1999 fidl::encoding::DefaultFuchsiaResourceDialect
2000 ),
2001 driver: fidl::new_empty!(
2002 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>>,
2003 fidl::encoding::DefaultFuchsiaResourceDialect
2004 ),
2005 }
2006 }
2007
2008 #[inline]
2009 unsafe fn decode(
2010 &mut self,
2011 decoder: &mut fidl::encoding::Decoder<
2012 '_,
2013 fidl::encoding::DefaultFuchsiaResourceDialect,
2014 >,
2015 offset: usize,
2016 _depth: fidl::encoding::Depth,
2017 ) -> fidl::Result<()> {
2018 decoder.debug_check_bounds::<Self>(offset);
2019 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2021 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2022 let mask = 0xffffffff00000000u64;
2023 let maskedval = padval & mask;
2024 if maskedval != 0 {
2025 return Err(fidl::Error::NonZeroPadding {
2026 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2027 });
2028 }
2029 fidl::decode!(
2030 fidl_fuchsia_driver_framework::DriverStartArgs,
2031 fidl::encoding::DefaultFuchsiaResourceDialect,
2032 &mut self.start_args,
2033 decoder,
2034 offset + 0,
2035 _depth
2036 )?;
2037 fidl::decode!(
2038 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverMarker>>,
2039 fidl::encoding::DefaultFuchsiaResourceDialect,
2040 &mut self.driver,
2041 decoder,
2042 offset + 16,
2043 _depth
2044 )?;
2045 Ok(())
2046 }
2047 }
2048
2049 impl DriverCrashInfo {
2050 #[inline(always)]
2051 fn max_ordinal_present(&self) -> u64 {
2052 if let Some(_) = self.node_token {
2053 return 2;
2054 }
2055 if let Some(_) = self.url {
2056 return 1;
2057 }
2058 0
2059 }
2060 }
2061
2062 impl fidl::encoding::ResourceTypeMarker for DriverCrashInfo {
2063 type Borrowed<'a> = &'a mut Self;
2064 fn take_or_borrow<'a>(
2065 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2066 ) -> Self::Borrowed<'a> {
2067 value
2068 }
2069 }
2070
2071 unsafe impl fidl::encoding::TypeMarker for DriverCrashInfo {
2072 type Owned = Self;
2073
2074 #[inline(always)]
2075 fn inline_align(_context: fidl::encoding::Context) -> usize {
2076 8
2077 }
2078
2079 #[inline(always)]
2080 fn inline_size(_context: fidl::encoding::Context) -> usize {
2081 16
2082 }
2083 }
2084
2085 unsafe impl
2086 fidl::encoding::Encode<DriverCrashInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2087 for &mut DriverCrashInfo
2088 {
2089 unsafe fn encode(
2090 self,
2091 encoder: &mut fidl::encoding::Encoder<
2092 '_,
2093 fidl::encoding::DefaultFuchsiaResourceDialect,
2094 >,
2095 offset: usize,
2096 mut depth: fidl::encoding::Depth,
2097 ) -> fidl::Result<()> {
2098 encoder.debug_check_bounds::<DriverCrashInfo>(offset);
2099 let max_ordinal: u64 = self.max_ordinal_present();
2101 encoder.write_num(max_ordinal, offset);
2102 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2103 if max_ordinal == 0 {
2105 return Ok(());
2106 }
2107 depth.increment()?;
2108 let envelope_size = 8;
2109 let bytes_len = max_ordinal as usize * envelope_size;
2110 #[allow(unused_variables)]
2111 let offset = encoder.out_of_line_offset(bytes_len);
2112 let mut _prev_end_offset: usize = 0;
2113 if 1 > max_ordinal {
2114 return Ok(());
2115 }
2116
2117 let cur_offset: usize = (1 - 1) * envelope_size;
2120
2121 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2123
2124 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2129 self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2130 encoder, offset + cur_offset, depth
2131 )?;
2132
2133 _prev_end_offset = cur_offset + envelope_size;
2134 if 2 > max_ordinal {
2135 return Ok(());
2136 }
2137
2138 let cur_offset: usize = (2 - 1) * envelope_size;
2141
2142 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2144
2145 fidl::encoding::encode_in_envelope_optional::<
2150 fidl::encoding::HandleType<
2151 fidl::Event,
2152 { fidl::ObjectType::EVENT.into_raw() },
2153 2147483648,
2154 >,
2155 fidl::encoding::DefaultFuchsiaResourceDialect,
2156 >(
2157 self.node_token.as_mut().map(
2158 <fidl::encoding::HandleType<
2159 fidl::Event,
2160 { fidl::ObjectType::EVENT.into_raw() },
2161 2147483648,
2162 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2163 ),
2164 encoder,
2165 offset + cur_offset,
2166 depth,
2167 )?;
2168
2169 _prev_end_offset = cur_offset + envelope_size;
2170
2171 Ok(())
2172 }
2173 }
2174
2175 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2176 for DriverCrashInfo
2177 {
2178 #[inline(always)]
2179 fn new_empty() -> Self {
2180 Self::default()
2181 }
2182
2183 unsafe fn decode(
2184 &mut self,
2185 decoder: &mut fidl::encoding::Decoder<
2186 '_,
2187 fidl::encoding::DefaultFuchsiaResourceDialect,
2188 >,
2189 offset: usize,
2190 mut depth: fidl::encoding::Depth,
2191 ) -> fidl::Result<()> {
2192 decoder.debug_check_bounds::<Self>(offset);
2193 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2194 None => return Err(fidl::Error::NotNullable),
2195 Some(len) => len,
2196 };
2197 if len == 0 {
2199 return Ok(());
2200 };
2201 depth.increment()?;
2202 let envelope_size = 8;
2203 let bytes_len = len * envelope_size;
2204 let offset = decoder.out_of_line_offset(bytes_len)?;
2205 let mut _next_ordinal_to_read = 0;
2207 let mut next_offset = offset;
2208 let end_offset = offset + bytes_len;
2209 _next_ordinal_to_read += 1;
2210 if next_offset >= end_offset {
2211 return Ok(());
2212 }
2213
2214 while _next_ordinal_to_read < 1 {
2216 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2217 _next_ordinal_to_read += 1;
2218 next_offset += envelope_size;
2219 }
2220
2221 let next_out_of_line = decoder.next_out_of_line();
2222 let handles_before = decoder.remaining_handles();
2223 if let Some((inlined, num_bytes, num_handles)) =
2224 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2225 {
2226 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2227 if inlined != (member_inline_size <= 4) {
2228 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2229 }
2230 let inner_offset;
2231 let mut inner_depth = depth.clone();
2232 if inlined {
2233 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2234 inner_offset = next_offset;
2235 } else {
2236 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2237 inner_depth.increment()?;
2238 }
2239 let val_ref = self.url.get_or_insert_with(|| {
2240 fidl::new_empty!(
2241 fidl::encoding::BoundedString<4096>,
2242 fidl::encoding::DefaultFuchsiaResourceDialect
2243 )
2244 });
2245 fidl::decode!(
2246 fidl::encoding::BoundedString<4096>,
2247 fidl::encoding::DefaultFuchsiaResourceDialect,
2248 val_ref,
2249 decoder,
2250 inner_offset,
2251 inner_depth
2252 )?;
2253 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2254 {
2255 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2256 }
2257 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2258 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2259 }
2260 }
2261
2262 next_offset += envelope_size;
2263 _next_ordinal_to_read += 1;
2264 if next_offset >= end_offset {
2265 return Ok(());
2266 }
2267
2268 while _next_ordinal_to_read < 2 {
2270 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2271 _next_ordinal_to_read += 1;
2272 next_offset += envelope_size;
2273 }
2274
2275 let next_out_of_line = decoder.next_out_of_line();
2276 let handles_before = decoder.remaining_handles();
2277 if let Some((inlined, num_bytes, num_handles)) =
2278 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2279 {
2280 let member_inline_size = <fidl::encoding::HandleType<
2281 fidl::Event,
2282 { fidl::ObjectType::EVENT.into_raw() },
2283 2147483648,
2284 > as fidl::encoding::TypeMarker>::inline_size(
2285 decoder.context
2286 );
2287 if inlined != (member_inline_size <= 4) {
2288 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2289 }
2290 let inner_offset;
2291 let mut inner_depth = depth.clone();
2292 if inlined {
2293 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2294 inner_offset = next_offset;
2295 } else {
2296 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2297 inner_depth.increment()?;
2298 }
2299 let val_ref =
2300 self.node_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2301 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2302 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2303 {
2304 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2305 }
2306 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2307 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2308 }
2309 }
2310
2311 next_offset += envelope_size;
2312
2313 while next_offset < end_offset {
2315 _next_ordinal_to_read += 1;
2316 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2317 next_offset += envelope_size;
2318 }
2319
2320 Ok(())
2321 }
2322 }
2323}