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_loader_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct DriverHostLauncherLaunchRequest {
16 pub process: Option<fidl::Process>,
19 pub root_vmar: Option<fidl::Vmar>,
21 pub driver_host_binary: Option<fidl::Vmo>,
23 pub vdso: Option<fidl::Vmo>,
25 pub driver_host_libs: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
27 pub driver_host: Option<fidl::endpoints::ServerEnd<DriverHostMarker>>,
29 #[doc(hidden)]
30 pub __source_breaking: fidl::marker::SourceBreaking,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34 for DriverHostLauncherLaunchRequest
35{
36}
37
38#[derive(Debug, Default, PartialEq)]
39pub struct DriverHostLoadDriverRequest {
40 pub driver_soname: Option<String>,
42 pub driver_binary: Option<fidl::Vmo>,
44 pub driver_libs: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
46 pub additional_root_modules: Option<Vec<RootModule>>,
49 #[doc(hidden)]
50 pub __source_breaking: fidl::marker::SourceBreaking,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for DriverHostLoadDriverRequest
55{
56}
57
58#[derive(Debug, Default, PartialEq)]
60pub struct RootModule {
61 pub name: Option<String>,
63 pub binary: Option<fidl::Vmo>,
65 #[doc(hidden)]
66 pub __source_breaking: fidl::marker::SourceBreaking,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RootModule {}
70
71#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
72pub struct DriverHostMarker;
73
74impl fidl::endpoints::ProtocolMarker for DriverHostMarker {
75 type Proxy = DriverHostProxy;
76 type RequestStream = DriverHostRequestStream;
77 #[cfg(target_os = "fuchsia")]
78 type SynchronousProxy = DriverHostSynchronousProxy;
79
80 const DEBUG_NAME: &'static str = "fuchsia.driver.loader.DriverHost";
81}
82impl fidl::endpoints::DiscoverableProtocolMarker for DriverHostMarker {}
83pub type DriverHostLoadDriverResult = Result<DriverHostLoadDriverResponse, i32>;
84
85pub trait DriverHostProxyInterface: Send + Sync {
86 type LoadDriverResponseFut: std::future::Future<Output = Result<DriverHostLoadDriverResult, fidl::Error>>
87 + Send;
88 fn r#load_driver(&self, payload: DriverHostLoadDriverRequest) -> Self::LoadDriverResponseFut;
89}
90#[derive(Debug)]
91#[cfg(target_os = "fuchsia")]
92pub struct DriverHostSynchronousProxy {
93 client: fidl::client::sync::Client,
94}
95
96#[cfg(target_os = "fuchsia")]
97impl fidl::endpoints::SynchronousProxy for DriverHostSynchronousProxy {
98 type Proxy = DriverHostProxy;
99 type Protocol = DriverHostMarker;
100
101 fn from_channel(inner: fidl::Channel) -> Self {
102 Self::new(inner)
103 }
104
105 fn into_channel(self) -> fidl::Channel {
106 self.client.into_channel()
107 }
108
109 fn as_channel(&self) -> &fidl::Channel {
110 self.client.as_channel()
111 }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl DriverHostSynchronousProxy {
116 pub fn new(channel: fidl::Channel) -> Self {
117 Self { client: fidl::client::sync::Client::new(channel) }
118 }
119
120 pub fn into_channel(self) -> fidl::Channel {
121 self.client.into_channel()
122 }
123
124 pub fn wait_for_event(
127 &self,
128 deadline: zx::MonotonicInstant,
129 ) -> Result<DriverHostEvent, fidl::Error> {
130 DriverHostEvent::decode(self.client.wait_for_event::<DriverHostMarker>(deadline)?)
131 }
132
133 pub fn r#load_driver(
135 &self,
136 mut payload: DriverHostLoadDriverRequest,
137 ___deadline: zx::MonotonicInstant,
138 ) -> Result<DriverHostLoadDriverResult, fidl::Error> {
139 let _response = self.client.send_query::<
140 DriverHostLoadDriverRequest,
141 fidl::encoding::FlexibleResultType<DriverHostLoadDriverResponse, i32>,
142 DriverHostMarker,
143 >(
144 &mut payload,
145 0x5c43a774b3fd4930,
146 fidl::encoding::DynamicFlags::FLEXIBLE,
147 ___deadline,
148 )?
149 .into_result::<DriverHostMarker>("load_driver")?;
150 Ok(_response.map(|x| x))
151 }
152}
153
154#[cfg(target_os = "fuchsia")]
155impl From<DriverHostSynchronousProxy> for zx::NullableHandle {
156 fn from(value: DriverHostSynchronousProxy) -> Self {
157 value.into_channel().into()
158 }
159}
160
161#[cfg(target_os = "fuchsia")]
162impl From<fidl::Channel> for DriverHostSynchronousProxy {
163 fn from(value: fidl::Channel) -> Self {
164 Self::new(value)
165 }
166}
167
168#[cfg(target_os = "fuchsia")]
169impl fidl::endpoints::FromClient for DriverHostSynchronousProxy {
170 type Protocol = DriverHostMarker;
171
172 fn from_client(value: fidl::endpoints::ClientEnd<DriverHostMarker>) -> Self {
173 Self::new(value.into_channel())
174 }
175}
176
177#[derive(Debug, Clone)]
178pub struct DriverHostProxy {
179 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
180}
181
182impl fidl::endpoints::Proxy for DriverHostProxy {
183 type Protocol = DriverHostMarker;
184
185 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
186 Self::new(inner)
187 }
188
189 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
190 self.client.into_channel().map_err(|client| Self { client })
191 }
192
193 fn as_channel(&self) -> &::fidl::AsyncChannel {
194 self.client.as_channel()
195 }
196}
197
198impl DriverHostProxy {
199 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
201 let protocol_name = <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
202 Self { client: fidl::client::Client::new(channel, protocol_name) }
203 }
204
205 pub fn take_event_stream(&self) -> DriverHostEventStream {
211 DriverHostEventStream { event_receiver: self.client.take_event_receiver() }
212 }
213
214 pub fn r#load_driver(
216 &self,
217 mut payload: DriverHostLoadDriverRequest,
218 ) -> fidl::client::QueryResponseFut<
219 DriverHostLoadDriverResult,
220 fidl::encoding::DefaultFuchsiaResourceDialect,
221 > {
222 DriverHostProxyInterface::r#load_driver(self, payload)
223 }
224}
225
226impl DriverHostProxyInterface for DriverHostProxy {
227 type LoadDriverResponseFut = fidl::client::QueryResponseFut<
228 DriverHostLoadDriverResult,
229 fidl::encoding::DefaultFuchsiaResourceDialect,
230 >;
231 fn r#load_driver(
232 &self,
233 mut payload: DriverHostLoadDriverRequest,
234 ) -> Self::LoadDriverResponseFut {
235 fn _decode(
236 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
237 ) -> Result<DriverHostLoadDriverResult, fidl::Error> {
238 let _response = fidl::client::decode_transaction_body::<
239 fidl::encoding::FlexibleResultType<DriverHostLoadDriverResponse, i32>,
240 fidl::encoding::DefaultFuchsiaResourceDialect,
241 0x5c43a774b3fd4930,
242 >(_buf?)?
243 .into_result::<DriverHostMarker>("load_driver")?;
244 Ok(_response.map(|x| x))
245 }
246 self.client
247 .send_query_and_decode::<DriverHostLoadDriverRequest, DriverHostLoadDriverResult>(
248 &mut payload,
249 0x5c43a774b3fd4930,
250 fidl::encoding::DynamicFlags::FLEXIBLE,
251 _decode,
252 )
253 }
254}
255
256pub struct DriverHostEventStream {
257 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
258}
259
260impl std::marker::Unpin for DriverHostEventStream {}
261
262impl futures::stream::FusedStream for DriverHostEventStream {
263 fn is_terminated(&self) -> bool {
264 self.event_receiver.is_terminated()
265 }
266}
267
268impl futures::Stream for DriverHostEventStream {
269 type Item = Result<DriverHostEvent, fidl::Error>;
270
271 fn poll_next(
272 mut self: std::pin::Pin<&mut Self>,
273 cx: &mut std::task::Context<'_>,
274 ) -> std::task::Poll<Option<Self::Item>> {
275 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
276 &mut self.event_receiver,
277 cx
278 )?) {
279 Some(buf) => std::task::Poll::Ready(Some(DriverHostEvent::decode(buf))),
280 None => std::task::Poll::Ready(None),
281 }
282 }
283}
284
285#[derive(Debug)]
286pub enum DriverHostEvent {
287 #[non_exhaustive]
288 _UnknownEvent {
289 ordinal: u64,
291 },
292}
293
294impl DriverHostEvent {
295 fn decode(
297 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
298 ) -> Result<DriverHostEvent, fidl::Error> {
299 let (bytes, _handles) = buf.split_mut();
300 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
301 debug_assert_eq!(tx_header.tx_id, 0);
302 match tx_header.ordinal {
303 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
304 Ok(DriverHostEvent::_UnknownEvent { ordinal: tx_header.ordinal })
305 }
306 _ => Err(fidl::Error::UnknownOrdinal {
307 ordinal: tx_header.ordinal,
308 protocol_name: <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
309 }),
310 }
311 }
312}
313
314pub struct DriverHostRequestStream {
316 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317 is_terminated: bool,
318}
319
320impl std::marker::Unpin for DriverHostRequestStream {}
321
322impl futures::stream::FusedStream for DriverHostRequestStream {
323 fn is_terminated(&self) -> bool {
324 self.is_terminated
325 }
326}
327
328impl fidl::endpoints::RequestStream for DriverHostRequestStream {
329 type Protocol = DriverHostMarker;
330 type ControlHandle = DriverHostControlHandle;
331
332 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
333 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
334 }
335
336 fn control_handle(&self) -> Self::ControlHandle {
337 DriverHostControlHandle { inner: self.inner.clone() }
338 }
339
340 fn into_inner(
341 self,
342 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
343 {
344 (self.inner, self.is_terminated)
345 }
346
347 fn from_inner(
348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
349 is_terminated: bool,
350 ) -> Self {
351 Self { inner, is_terminated }
352 }
353}
354
355impl futures::Stream for DriverHostRequestStream {
356 type Item = Result<DriverHostRequest, fidl::Error>;
357
358 fn poll_next(
359 mut self: std::pin::Pin<&mut Self>,
360 cx: &mut std::task::Context<'_>,
361 ) -> std::task::Poll<Option<Self::Item>> {
362 let this = &mut *self;
363 if this.inner.check_shutdown(cx) {
364 this.is_terminated = true;
365 return std::task::Poll::Ready(None);
366 }
367 if this.is_terminated {
368 panic!("polled DriverHostRequestStream after completion");
369 }
370 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
371 |bytes, handles| {
372 match this.inner.channel().read_etc(cx, bytes, handles) {
373 std::task::Poll::Ready(Ok(())) => {}
374 std::task::Poll::Pending => return std::task::Poll::Pending,
375 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
376 this.is_terminated = true;
377 return std::task::Poll::Ready(None);
378 }
379 std::task::Poll::Ready(Err(e)) => {
380 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
381 e.into(),
382 ))));
383 }
384 }
385
386 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
388
389 std::task::Poll::Ready(Some(match header.ordinal {
390 0x5c43a774b3fd4930 => {
391 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
392 let mut req = fidl::new_empty!(
393 DriverHostLoadDriverRequest,
394 fidl::encoding::DefaultFuchsiaResourceDialect
395 );
396 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostLoadDriverRequest>(&header, _body_bytes, handles, &mut req)?;
397 let control_handle = DriverHostControlHandle { inner: this.inner.clone() };
398 Ok(DriverHostRequest::LoadDriver {
399 payload: req,
400 responder: DriverHostLoadDriverResponder {
401 control_handle: std::mem::ManuallyDrop::new(control_handle),
402 tx_id: header.tx_id,
403 },
404 })
405 }
406 _ if header.tx_id == 0
407 && header
408 .dynamic_flags()
409 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
410 {
411 Ok(DriverHostRequest::_UnknownMethod {
412 ordinal: header.ordinal,
413 control_handle: DriverHostControlHandle { inner: this.inner.clone() },
414 method_type: fidl::MethodType::OneWay,
415 })
416 }
417 _ if header
418 .dynamic_flags()
419 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
420 {
421 this.inner.send_framework_err(
422 fidl::encoding::FrameworkErr::UnknownMethod,
423 header.tx_id,
424 header.ordinal,
425 header.dynamic_flags(),
426 (bytes, handles),
427 )?;
428 Ok(DriverHostRequest::_UnknownMethod {
429 ordinal: header.ordinal,
430 control_handle: DriverHostControlHandle { inner: this.inner.clone() },
431 method_type: fidl::MethodType::TwoWay,
432 })
433 }
434 _ => Err(fidl::Error::UnknownOrdinal {
435 ordinal: header.ordinal,
436 protocol_name:
437 <DriverHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
438 }),
439 }))
440 },
441 )
442 }
443}
444
445#[derive(Debug)]
448pub enum DriverHostRequest {
449 LoadDriver { payload: DriverHostLoadDriverRequest, responder: DriverHostLoadDriverResponder },
451 #[non_exhaustive]
453 _UnknownMethod {
454 ordinal: u64,
456 control_handle: DriverHostControlHandle,
457 method_type: fidl::MethodType,
458 },
459}
460
461impl DriverHostRequest {
462 #[allow(irrefutable_let_patterns)]
463 pub fn into_load_driver(
464 self,
465 ) -> Option<(DriverHostLoadDriverRequest, DriverHostLoadDriverResponder)> {
466 if let DriverHostRequest::LoadDriver { payload, responder } = self {
467 Some((payload, responder))
468 } else {
469 None
470 }
471 }
472
473 pub fn method_name(&self) -> &'static str {
475 match *self {
476 DriverHostRequest::LoadDriver { .. } => "load_driver",
477 DriverHostRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
478 "unknown one-way method"
479 }
480 DriverHostRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
481 "unknown two-way method"
482 }
483 }
484 }
485}
486
487#[derive(Debug, Clone)]
488pub struct DriverHostControlHandle {
489 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
490}
491
492impl DriverHostControlHandle {
493 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
494 self.inner.shutdown_with_epitaph(status.into())
495 }
496}
497
498impl fidl::endpoints::ControlHandle for DriverHostControlHandle {
499 fn shutdown(&self) {
500 self.inner.shutdown()
501 }
502
503 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
504 self.inner.shutdown_with_epitaph(status)
505 }
506
507 fn is_closed(&self) -> bool {
508 self.inner.channel().is_closed()
509 }
510 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
511 self.inner.channel().on_closed()
512 }
513
514 #[cfg(target_os = "fuchsia")]
515 fn signal_peer(
516 &self,
517 clear_mask: zx::Signals,
518 set_mask: zx::Signals,
519 ) -> Result<(), zx_status::Status> {
520 use fidl::Peered;
521 self.inner.channel().signal_peer(clear_mask, set_mask)
522 }
523}
524
525impl DriverHostControlHandle {}
526
527#[must_use = "FIDL methods require a response to be sent"]
528#[derive(Debug)]
529pub struct DriverHostLoadDriverResponder {
530 control_handle: std::mem::ManuallyDrop<DriverHostControlHandle>,
531 tx_id: u32,
532}
533
534impl std::ops::Drop for DriverHostLoadDriverResponder {
538 fn drop(&mut self) {
539 self.control_handle.shutdown();
540 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
542 }
543}
544
545impl fidl::endpoints::Responder for DriverHostLoadDriverResponder {
546 type ControlHandle = DriverHostControlHandle;
547
548 fn control_handle(&self) -> &DriverHostControlHandle {
549 &self.control_handle
550 }
551
552 fn drop_without_shutdown(mut self) {
553 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
555 std::mem::forget(self);
557 }
558}
559
560impl DriverHostLoadDriverResponder {
561 pub fn send(
565 self,
566 mut result: Result<&DriverHostLoadDriverResponse, i32>,
567 ) -> Result<(), fidl::Error> {
568 let _result = self.send_raw(result);
569 if _result.is_err() {
570 self.control_handle.shutdown();
571 }
572 self.drop_without_shutdown();
573 _result
574 }
575
576 pub fn send_no_shutdown_on_err(
578 self,
579 mut result: Result<&DriverHostLoadDriverResponse, i32>,
580 ) -> Result<(), fidl::Error> {
581 let _result = self.send_raw(result);
582 self.drop_without_shutdown();
583 _result
584 }
585
586 fn send_raw(
587 &self,
588 mut result: Result<&DriverHostLoadDriverResponse, i32>,
589 ) -> Result<(), fidl::Error> {
590 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
591 DriverHostLoadDriverResponse,
592 i32,
593 >>(
594 fidl::encoding::FlexibleResult::new(result),
595 self.tx_id,
596 0x5c43a774b3fd4930,
597 fidl::encoding::DynamicFlags::FLEXIBLE,
598 )
599 }
600}
601
602#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
603pub struct DriverHostLauncherMarker;
604
605impl fidl::endpoints::ProtocolMarker for DriverHostLauncherMarker {
606 type Proxy = DriverHostLauncherProxy;
607 type RequestStream = DriverHostLauncherRequestStream;
608 #[cfg(target_os = "fuchsia")]
609 type SynchronousProxy = DriverHostLauncherSynchronousProxy;
610
611 const DEBUG_NAME: &'static str = "fuchsia.driver.loader.DriverHostLauncher";
612}
613impl fidl::endpoints::DiscoverableProtocolMarker for DriverHostLauncherMarker {}
614pub type DriverHostLauncherLaunchResult = Result<(), i32>;
615
616pub trait DriverHostLauncherProxyInterface: Send + Sync {
617 type LaunchResponseFut: std::future::Future<Output = Result<DriverHostLauncherLaunchResult, fidl::Error>>
618 + Send;
619 fn r#launch(&self, payload: DriverHostLauncherLaunchRequest) -> Self::LaunchResponseFut;
620}
621#[derive(Debug)]
622#[cfg(target_os = "fuchsia")]
623pub struct DriverHostLauncherSynchronousProxy {
624 client: fidl::client::sync::Client,
625}
626
627#[cfg(target_os = "fuchsia")]
628impl fidl::endpoints::SynchronousProxy for DriverHostLauncherSynchronousProxy {
629 type Proxy = DriverHostLauncherProxy;
630 type Protocol = DriverHostLauncherMarker;
631
632 fn from_channel(inner: fidl::Channel) -> Self {
633 Self::new(inner)
634 }
635
636 fn into_channel(self) -> fidl::Channel {
637 self.client.into_channel()
638 }
639
640 fn as_channel(&self) -> &fidl::Channel {
641 self.client.as_channel()
642 }
643}
644
645#[cfg(target_os = "fuchsia")]
646impl DriverHostLauncherSynchronousProxy {
647 pub fn new(channel: fidl::Channel) -> Self {
648 Self { client: fidl::client::sync::Client::new(channel) }
649 }
650
651 pub fn into_channel(self) -> fidl::Channel {
652 self.client.into_channel()
653 }
654
655 pub fn wait_for_event(
658 &self,
659 deadline: zx::MonotonicInstant,
660 ) -> Result<DriverHostLauncherEvent, fidl::Error> {
661 DriverHostLauncherEvent::decode(
662 self.client.wait_for_event::<DriverHostLauncherMarker>(deadline)?,
663 )
664 }
665
666 pub fn r#launch(
673 &self,
674 mut payload: DriverHostLauncherLaunchRequest,
675 ___deadline: zx::MonotonicInstant,
676 ) -> Result<DriverHostLauncherLaunchResult, fidl::Error> {
677 let _response = self.client.send_query::<
678 DriverHostLauncherLaunchRequest,
679 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
680 DriverHostLauncherMarker,
681 >(
682 &mut payload,
683 0x3af75d84043eb730,
684 fidl::encoding::DynamicFlags::FLEXIBLE,
685 ___deadline,
686 )?
687 .into_result::<DriverHostLauncherMarker>("launch")?;
688 Ok(_response.map(|x| x))
689 }
690}
691
692#[cfg(target_os = "fuchsia")]
693impl From<DriverHostLauncherSynchronousProxy> for zx::NullableHandle {
694 fn from(value: DriverHostLauncherSynchronousProxy) -> Self {
695 value.into_channel().into()
696 }
697}
698
699#[cfg(target_os = "fuchsia")]
700impl From<fidl::Channel> for DriverHostLauncherSynchronousProxy {
701 fn from(value: fidl::Channel) -> Self {
702 Self::new(value)
703 }
704}
705
706#[cfg(target_os = "fuchsia")]
707impl fidl::endpoints::FromClient for DriverHostLauncherSynchronousProxy {
708 type Protocol = DriverHostLauncherMarker;
709
710 fn from_client(value: fidl::endpoints::ClientEnd<DriverHostLauncherMarker>) -> Self {
711 Self::new(value.into_channel())
712 }
713}
714
715#[derive(Debug, Clone)]
716pub struct DriverHostLauncherProxy {
717 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
718}
719
720impl fidl::endpoints::Proxy for DriverHostLauncherProxy {
721 type Protocol = DriverHostLauncherMarker;
722
723 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
724 Self::new(inner)
725 }
726
727 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
728 self.client.into_channel().map_err(|client| Self { client })
729 }
730
731 fn as_channel(&self) -> &::fidl::AsyncChannel {
732 self.client.as_channel()
733 }
734}
735
736impl DriverHostLauncherProxy {
737 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
739 let protocol_name =
740 <DriverHostLauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
741 Self { client: fidl::client::Client::new(channel, protocol_name) }
742 }
743
744 pub fn take_event_stream(&self) -> DriverHostLauncherEventStream {
750 DriverHostLauncherEventStream { event_receiver: self.client.take_event_receiver() }
751 }
752
753 pub fn r#launch(
760 &self,
761 mut payload: DriverHostLauncherLaunchRequest,
762 ) -> fidl::client::QueryResponseFut<
763 DriverHostLauncherLaunchResult,
764 fidl::encoding::DefaultFuchsiaResourceDialect,
765 > {
766 DriverHostLauncherProxyInterface::r#launch(self, payload)
767 }
768}
769
770impl DriverHostLauncherProxyInterface for DriverHostLauncherProxy {
771 type LaunchResponseFut = fidl::client::QueryResponseFut<
772 DriverHostLauncherLaunchResult,
773 fidl::encoding::DefaultFuchsiaResourceDialect,
774 >;
775 fn r#launch(&self, mut payload: DriverHostLauncherLaunchRequest) -> Self::LaunchResponseFut {
776 fn _decode(
777 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
778 ) -> Result<DriverHostLauncherLaunchResult, fidl::Error> {
779 let _response = fidl::client::decode_transaction_body::<
780 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
781 fidl::encoding::DefaultFuchsiaResourceDialect,
782 0x3af75d84043eb730,
783 >(_buf?)?
784 .into_result::<DriverHostLauncherMarker>("launch")?;
785 Ok(_response.map(|x| x))
786 }
787 self.client.send_query_and_decode::<
788 DriverHostLauncherLaunchRequest,
789 DriverHostLauncherLaunchResult,
790 >(
791 &mut payload,
792 0x3af75d84043eb730,
793 fidl::encoding::DynamicFlags::FLEXIBLE,
794 _decode,
795 )
796 }
797}
798
799pub struct DriverHostLauncherEventStream {
800 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
801}
802
803impl std::marker::Unpin for DriverHostLauncherEventStream {}
804
805impl futures::stream::FusedStream for DriverHostLauncherEventStream {
806 fn is_terminated(&self) -> bool {
807 self.event_receiver.is_terminated()
808 }
809}
810
811impl futures::Stream for DriverHostLauncherEventStream {
812 type Item = Result<DriverHostLauncherEvent, fidl::Error>;
813
814 fn poll_next(
815 mut self: std::pin::Pin<&mut Self>,
816 cx: &mut std::task::Context<'_>,
817 ) -> std::task::Poll<Option<Self::Item>> {
818 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
819 &mut self.event_receiver,
820 cx
821 )?) {
822 Some(buf) => std::task::Poll::Ready(Some(DriverHostLauncherEvent::decode(buf))),
823 None => std::task::Poll::Ready(None),
824 }
825 }
826}
827
828#[derive(Debug)]
829pub enum DriverHostLauncherEvent {
830 #[non_exhaustive]
831 _UnknownEvent {
832 ordinal: u64,
834 },
835}
836
837impl DriverHostLauncherEvent {
838 fn decode(
840 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
841 ) -> Result<DriverHostLauncherEvent, fidl::Error> {
842 let (bytes, _handles) = buf.split_mut();
843 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
844 debug_assert_eq!(tx_header.tx_id, 0);
845 match tx_header.ordinal {
846 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
847 Ok(DriverHostLauncherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
848 }
849 _ => Err(fidl::Error::UnknownOrdinal {
850 ordinal: tx_header.ordinal,
851 protocol_name:
852 <DriverHostLauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
853 }),
854 }
855 }
856}
857
858pub struct DriverHostLauncherRequestStream {
860 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
861 is_terminated: bool,
862}
863
864impl std::marker::Unpin for DriverHostLauncherRequestStream {}
865
866impl futures::stream::FusedStream for DriverHostLauncherRequestStream {
867 fn is_terminated(&self) -> bool {
868 self.is_terminated
869 }
870}
871
872impl fidl::endpoints::RequestStream for DriverHostLauncherRequestStream {
873 type Protocol = DriverHostLauncherMarker;
874 type ControlHandle = DriverHostLauncherControlHandle;
875
876 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
877 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
878 }
879
880 fn control_handle(&self) -> Self::ControlHandle {
881 DriverHostLauncherControlHandle { inner: self.inner.clone() }
882 }
883
884 fn into_inner(
885 self,
886 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
887 {
888 (self.inner, self.is_terminated)
889 }
890
891 fn from_inner(
892 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
893 is_terminated: bool,
894 ) -> Self {
895 Self { inner, is_terminated }
896 }
897}
898
899impl futures::Stream for DriverHostLauncherRequestStream {
900 type Item = Result<DriverHostLauncherRequest, fidl::Error>;
901
902 fn poll_next(
903 mut self: std::pin::Pin<&mut Self>,
904 cx: &mut std::task::Context<'_>,
905 ) -> std::task::Poll<Option<Self::Item>> {
906 let this = &mut *self;
907 if this.inner.check_shutdown(cx) {
908 this.is_terminated = true;
909 return std::task::Poll::Ready(None);
910 }
911 if this.is_terminated {
912 panic!("polled DriverHostLauncherRequestStream after completion");
913 }
914 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
915 |bytes, handles| {
916 match this.inner.channel().read_etc(cx, bytes, handles) {
917 std::task::Poll::Ready(Ok(())) => {}
918 std::task::Poll::Pending => return std::task::Poll::Pending,
919 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
920 this.is_terminated = true;
921 return std::task::Poll::Ready(None);
922 }
923 std::task::Poll::Ready(Err(e)) => {
924 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
925 e.into(),
926 ))));
927 }
928 }
929
930 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
932
933 std::task::Poll::Ready(Some(match header.ordinal {
934 0x3af75d84043eb730 => {
935 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
936 let mut req = fidl::new_empty!(DriverHostLauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
937 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostLauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
938 let control_handle = DriverHostLauncherControlHandle {
939 inner: this.inner.clone(),
940 };
941 Ok(DriverHostLauncherRequest::Launch {payload: req,
942 responder: DriverHostLauncherLaunchResponder {
943 control_handle: std::mem::ManuallyDrop::new(control_handle),
944 tx_id: header.tx_id,
945 },
946 })
947 }
948 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
949 Ok(DriverHostLauncherRequest::_UnknownMethod {
950 ordinal: header.ordinal,
951 control_handle: DriverHostLauncherControlHandle { inner: this.inner.clone() },
952 method_type: fidl::MethodType::OneWay,
953 })
954 }
955 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
956 this.inner.send_framework_err(
957 fidl::encoding::FrameworkErr::UnknownMethod,
958 header.tx_id,
959 header.ordinal,
960 header.dynamic_flags(),
961 (bytes, handles),
962 )?;
963 Ok(DriverHostLauncherRequest::_UnknownMethod {
964 ordinal: header.ordinal,
965 control_handle: DriverHostLauncherControlHandle { inner: this.inner.clone() },
966 method_type: fidl::MethodType::TwoWay,
967 })
968 }
969 _ => Err(fidl::Error::UnknownOrdinal {
970 ordinal: header.ordinal,
971 protocol_name: <DriverHostLauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
972 }),
973 }))
974 },
975 )
976 }
977}
978
979#[derive(Debug)]
982pub enum DriverHostLauncherRequest {
983 Launch {
990 payload: DriverHostLauncherLaunchRequest,
991 responder: DriverHostLauncherLaunchResponder,
992 },
993 #[non_exhaustive]
995 _UnknownMethod {
996 ordinal: u64,
998 control_handle: DriverHostLauncherControlHandle,
999 method_type: fidl::MethodType,
1000 },
1001}
1002
1003impl DriverHostLauncherRequest {
1004 #[allow(irrefutable_let_patterns)]
1005 pub fn into_launch(
1006 self,
1007 ) -> Option<(DriverHostLauncherLaunchRequest, DriverHostLauncherLaunchResponder)> {
1008 if let DriverHostLauncherRequest::Launch { payload, responder } = self {
1009 Some((payload, responder))
1010 } else {
1011 None
1012 }
1013 }
1014
1015 pub fn method_name(&self) -> &'static str {
1017 match *self {
1018 DriverHostLauncherRequest::Launch { .. } => "launch",
1019 DriverHostLauncherRequest::_UnknownMethod {
1020 method_type: fidl::MethodType::OneWay,
1021 ..
1022 } => "unknown one-way method",
1023 DriverHostLauncherRequest::_UnknownMethod {
1024 method_type: fidl::MethodType::TwoWay,
1025 ..
1026 } => "unknown two-way method",
1027 }
1028 }
1029}
1030
1031#[derive(Debug, Clone)]
1032pub struct DriverHostLauncherControlHandle {
1033 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1034}
1035
1036impl DriverHostLauncherControlHandle {
1037 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1038 self.inner.shutdown_with_epitaph(status.into())
1039 }
1040}
1041
1042impl fidl::endpoints::ControlHandle for DriverHostLauncherControlHandle {
1043 fn shutdown(&self) {
1044 self.inner.shutdown()
1045 }
1046
1047 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1048 self.inner.shutdown_with_epitaph(status)
1049 }
1050
1051 fn is_closed(&self) -> bool {
1052 self.inner.channel().is_closed()
1053 }
1054 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1055 self.inner.channel().on_closed()
1056 }
1057
1058 #[cfg(target_os = "fuchsia")]
1059 fn signal_peer(
1060 &self,
1061 clear_mask: zx::Signals,
1062 set_mask: zx::Signals,
1063 ) -> Result<(), zx_status::Status> {
1064 use fidl::Peered;
1065 self.inner.channel().signal_peer(clear_mask, set_mask)
1066 }
1067}
1068
1069impl DriverHostLauncherControlHandle {}
1070
1071#[must_use = "FIDL methods require a response to be sent"]
1072#[derive(Debug)]
1073pub struct DriverHostLauncherLaunchResponder {
1074 control_handle: std::mem::ManuallyDrop<DriverHostLauncherControlHandle>,
1075 tx_id: u32,
1076}
1077
1078impl std::ops::Drop for DriverHostLauncherLaunchResponder {
1082 fn drop(&mut self) {
1083 self.control_handle.shutdown();
1084 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1086 }
1087}
1088
1089impl fidl::endpoints::Responder for DriverHostLauncherLaunchResponder {
1090 type ControlHandle = DriverHostLauncherControlHandle;
1091
1092 fn control_handle(&self) -> &DriverHostLauncherControlHandle {
1093 &self.control_handle
1094 }
1095
1096 fn drop_without_shutdown(mut self) {
1097 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1099 std::mem::forget(self);
1101 }
1102}
1103
1104impl DriverHostLauncherLaunchResponder {
1105 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1109 let _result = self.send_raw(result);
1110 if _result.is_err() {
1111 self.control_handle.shutdown();
1112 }
1113 self.drop_without_shutdown();
1114 _result
1115 }
1116
1117 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1119 let _result = self.send_raw(result);
1120 self.drop_without_shutdown();
1121 _result
1122 }
1123
1124 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1125 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1126 fidl::encoding::EmptyStruct,
1127 i32,
1128 >>(
1129 fidl::encoding::FlexibleResult::new(result),
1130 self.tx_id,
1131 0x3af75d84043eb730,
1132 fidl::encoding::DynamicFlags::FLEXIBLE,
1133 )
1134 }
1135}
1136
1137mod internal {
1138 use super::*;
1139
1140 impl DriverHostLauncherLaunchRequest {
1141 #[inline(always)]
1142 fn max_ordinal_present(&self) -> u64 {
1143 if let Some(_) = self.driver_host {
1144 return 6;
1145 }
1146 if let Some(_) = self.driver_host_libs {
1147 return 5;
1148 }
1149 if let Some(_) = self.vdso {
1150 return 4;
1151 }
1152 if let Some(_) = self.driver_host_binary {
1153 return 3;
1154 }
1155 if let Some(_) = self.root_vmar {
1156 return 2;
1157 }
1158 if let Some(_) = self.process {
1159 return 1;
1160 }
1161 0
1162 }
1163 }
1164
1165 impl fidl::encoding::ResourceTypeMarker for DriverHostLauncherLaunchRequest {
1166 type Borrowed<'a> = &'a mut Self;
1167 fn take_or_borrow<'a>(
1168 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1169 ) -> Self::Borrowed<'a> {
1170 value
1171 }
1172 }
1173
1174 unsafe impl fidl::encoding::TypeMarker for DriverHostLauncherLaunchRequest {
1175 type Owned = Self;
1176
1177 #[inline(always)]
1178 fn inline_align(_context: fidl::encoding::Context) -> usize {
1179 8
1180 }
1181
1182 #[inline(always)]
1183 fn inline_size(_context: fidl::encoding::Context) -> usize {
1184 16
1185 }
1186 }
1187
1188 unsafe impl
1189 fidl::encoding::Encode<
1190 DriverHostLauncherLaunchRequest,
1191 fidl::encoding::DefaultFuchsiaResourceDialect,
1192 > for &mut DriverHostLauncherLaunchRequest
1193 {
1194 unsafe fn encode(
1195 self,
1196 encoder: &mut fidl::encoding::Encoder<
1197 '_,
1198 fidl::encoding::DefaultFuchsiaResourceDialect,
1199 >,
1200 offset: usize,
1201 mut depth: fidl::encoding::Depth,
1202 ) -> fidl::Result<()> {
1203 encoder.debug_check_bounds::<DriverHostLauncherLaunchRequest>(offset);
1204 let max_ordinal: u64 = self.max_ordinal_present();
1206 encoder.write_num(max_ordinal, offset);
1207 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1208 if max_ordinal == 0 {
1210 return Ok(());
1211 }
1212 depth.increment()?;
1213 let envelope_size = 8;
1214 let bytes_len = max_ordinal as usize * envelope_size;
1215 #[allow(unused_variables)]
1216 let offset = encoder.out_of_line_offset(bytes_len);
1217 let mut _prev_end_offset: usize = 0;
1218 if 1 > max_ordinal {
1219 return Ok(());
1220 }
1221
1222 let cur_offset: usize = (1 - 1) * envelope_size;
1225
1226 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1228
1229 fidl::encoding::encode_in_envelope_optional::<
1234 fidl::encoding::HandleType<
1235 fidl::Process,
1236 { fidl::ObjectType::PROCESS.into_raw() },
1237 2147483648,
1238 >,
1239 fidl::encoding::DefaultFuchsiaResourceDialect,
1240 >(
1241 self.process.as_mut().map(
1242 <fidl::encoding::HandleType<
1243 fidl::Process,
1244 { fidl::ObjectType::PROCESS.into_raw() },
1245 2147483648,
1246 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1247 ),
1248 encoder,
1249 offset + cur_offset,
1250 depth,
1251 )?;
1252
1253 _prev_end_offset = cur_offset + envelope_size;
1254 if 2 > max_ordinal {
1255 return Ok(());
1256 }
1257
1258 let cur_offset: usize = (2 - 1) * envelope_size;
1261
1262 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1264
1265 fidl::encoding::encode_in_envelope_optional::<
1270 fidl::encoding::HandleType<
1271 fidl::Vmar,
1272 { fidl::ObjectType::VMAR.into_raw() },
1273 2147483648,
1274 >,
1275 fidl::encoding::DefaultFuchsiaResourceDialect,
1276 >(
1277 self.root_vmar.as_mut().map(
1278 <fidl::encoding::HandleType<
1279 fidl::Vmar,
1280 { fidl::ObjectType::VMAR.into_raw() },
1281 2147483648,
1282 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1283 ),
1284 encoder,
1285 offset + cur_offset,
1286 depth,
1287 )?;
1288
1289 _prev_end_offset = cur_offset + envelope_size;
1290 if 3 > max_ordinal {
1291 return Ok(());
1292 }
1293
1294 let cur_offset: usize = (3 - 1) * envelope_size;
1297
1298 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1300
1301 fidl::encoding::encode_in_envelope_optional::<
1306 fidl::encoding::HandleType<
1307 fidl::Vmo,
1308 { fidl::ObjectType::VMO.into_raw() },
1309 2147483648,
1310 >,
1311 fidl::encoding::DefaultFuchsiaResourceDialect,
1312 >(
1313 self.driver_host_binary.as_mut().map(
1314 <fidl::encoding::HandleType<
1315 fidl::Vmo,
1316 { fidl::ObjectType::VMO.into_raw() },
1317 2147483648,
1318 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1319 ),
1320 encoder,
1321 offset + cur_offset,
1322 depth,
1323 )?;
1324
1325 _prev_end_offset = cur_offset + envelope_size;
1326 if 4 > max_ordinal {
1327 return Ok(());
1328 }
1329
1330 let cur_offset: usize = (4 - 1) * envelope_size;
1333
1334 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1336
1337 fidl::encoding::encode_in_envelope_optional::<
1342 fidl::encoding::HandleType<
1343 fidl::Vmo,
1344 { fidl::ObjectType::VMO.into_raw() },
1345 2147483648,
1346 >,
1347 fidl::encoding::DefaultFuchsiaResourceDialect,
1348 >(
1349 self.vdso.as_mut().map(
1350 <fidl::encoding::HandleType<
1351 fidl::Vmo,
1352 { fidl::ObjectType::VMO.into_raw() },
1353 2147483648,
1354 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1355 ),
1356 encoder,
1357 offset + cur_offset,
1358 depth,
1359 )?;
1360
1361 _prev_end_offset = cur_offset + envelope_size;
1362 if 5 > max_ordinal {
1363 return Ok(());
1364 }
1365
1366 let cur_offset: usize = (5 - 1) * envelope_size;
1369
1370 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1372
1373 fidl::encoding::encode_in_envelope_optional::<
1378 fidl::encoding::Endpoint<
1379 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1380 >,
1381 fidl::encoding::DefaultFuchsiaResourceDialect,
1382 >(
1383 self.driver_host_libs.as_mut().map(
1384 <fidl::encoding::Endpoint<
1385 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1386 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1387 ),
1388 encoder,
1389 offset + cur_offset,
1390 depth,
1391 )?;
1392
1393 _prev_end_offset = cur_offset + envelope_size;
1394 if 6 > max_ordinal {
1395 return Ok(());
1396 }
1397
1398 let cur_offset: usize = (6 - 1) * envelope_size;
1401
1402 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1404
1405 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1410 self.driver_host.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1411 encoder, offset + cur_offset, depth
1412 )?;
1413
1414 _prev_end_offset = cur_offset + envelope_size;
1415
1416 Ok(())
1417 }
1418 }
1419
1420 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1421 for DriverHostLauncherLaunchRequest
1422 {
1423 #[inline(always)]
1424 fn new_empty() -> Self {
1425 Self::default()
1426 }
1427
1428 unsafe fn decode(
1429 &mut self,
1430 decoder: &mut fidl::encoding::Decoder<
1431 '_,
1432 fidl::encoding::DefaultFuchsiaResourceDialect,
1433 >,
1434 offset: usize,
1435 mut depth: fidl::encoding::Depth,
1436 ) -> fidl::Result<()> {
1437 decoder.debug_check_bounds::<Self>(offset);
1438 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1439 None => return Err(fidl::Error::NotNullable),
1440 Some(len) => len,
1441 };
1442 if len == 0 {
1444 return Ok(());
1445 };
1446 depth.increment()?;
1447 let envelope_size = 8;
1448 let bytes_len = len * envelope_size;
1449 let offset = decoder.out_of_line_offset(bytes_len)?;
1450 let mut _next_ordinal_to_read = 0;
1452 let mut next_offset = offset;
1453 let end_offset = offset + bytes_len;
1454 _next_ordinal_to_read += 1;
1455 if next_offset >= end_offset {
1456 return Ok(());
1457 }
1458
1459 while _next_ordinal_to_read < 1 {
1461 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1462 _next_ordinal_to_read += 1;
1463 next_offset += envelope_size;
1464 }
1465
1466 let next_out_of_line = decoder.next_out_of_line();
1467 let handles_before = decoder.remaining_handles();
1468 if let Some((inlined, num_bytes, num_handles)) =
1469 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1470 {
1471 let member_inline_size = <fidl::encoding::HandleType<
1472 fidl::Process,
1473 { fidl::ObjectType::PROCESS.into_raw() },
1474 2147483648,
1475 > as fidl::encoding::TypeMarker>::inline_size(
1476 decoder.context
1477 );
1478 if inlined != (member_inline_size <= 4) {
1479 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1480 }
1481 let inner_offset;
1482 let mut inner_depth = depth.clone();
1483 if inlined {
1484 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1485 inner_offset = next_offset;
1486 } else {
1487 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1488 inner_depth.increment()?;
1489 }
1490 let val_ref =
1491 self.process.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1492 fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1493 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1494 {
1495 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1496 }
1497 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1498 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1499 }
1500 }
1501
1502 next_offset += envelope_size;
1503 _next_ordinal_to_read += 1;
1504 if next_offset >= end_offset {
1505 return Ok(());
1506 }
1507
1508 while _next_ordinal_to_read < 2 {
1510 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1511 _next_ordinal_to_read += 1;
1512 next_offset += envelope_size;
1513 }
1514
1515 let next_out_of_line = decoder.next_out_of_line();
1516 let handles_before = decoder.remaining_handles();
1517 if let Some((inlined, num_bytes, num_handles)) =
1518 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1519 {
1520 let member_inline_size = <fidl::encoding::HandleType<
1521 fidl::Vmar,
1522 { fidl::ObjectType::VMAR.into_raw() },
1523 2147483648,
1524 > as fidl::encoding::TypeMarker>::inline_size(
1525 decoder.context
1526 );
1527 if inlined != (member_inline_size <= 4) {
1528 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1529 }
1530 let inner_offset;
1531 let mut inner_depth = depth.clone();
1532 if inlined {
1533 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1534 inner_offset = next_offset;
1535 } else {
1536 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1537 inner_depth.increment()?;
1538 }
1539 let val_ref =
1540 self.root_vmar.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1541 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1542 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1543 {
1544 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1545 }
1546 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1547 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1548 }
1549 }
1550
1551 next_offset += envelope_size;
1552 _next_ordinal_to_read += 1;
1553 if next_offset >= end_offset {
1554 return Ok(());
1555 }
1556
1557 while _next_ordinal_to_read < 3 {
1559 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1560 _next_ordinal_to_read += 1;
1561 next_offset += envelope_size;
1562 }
1563
1564 let next_out_of_line = decoder.next_out_of_line();
1565 let handles_before = decoder.remaining_handles();
1566 if let Some((inlined, num_bytes, num_handles)) =
1567 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1568 {
1569 let member_inline_size = <fidl::encoding::HandleType<
1570 fidl::Vmo,
1571 { fidl::ObjectType::VMO.into_raw() },
1572 2147483648,
1573 > as fidl::encoding::TypeMarker>::inline_size(
1574 decoder.context
1575 );
1576 if inlined != (member_inline_size <= 4) {
1577 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1578 }
1579 let inner_offset;
1580 let mut inner_depth = depth.clone();
1581 if inlined {
1582 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1583 inner_offset = next_offset;
1584 } else {
1585 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1586 inner_depth.increment()?;
1587 }
1588 let val_ref =
1589 self.driver_host_binary.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1590 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1591 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1592 {
1593 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1594 }
1595 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1596 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1597 }
1598 }
1599
1600 next_offset += envelope_size;
1601 _next_ordinal_to_read += 1;
1602 if next_offset >= end_offset {
1603 return Ok(());
1604 }
1605
1606 while _next_ordinal_to_read < 4 {
1608 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1609 _next_ordinal_to_read += 1;
1610 next_offset += envelope_size;
1611 }
1612
1613 let next_out_of_line = decoder.next_out_of_line();
1614 let handles_before = decoder.remaining_handles();
1615 if let Some((inlined, num_bytes, num_handles)) =
1616 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1617 {
1618 let member_inline_size = <fidl::encoding::HandleType<
1619 fidl::Vmo,
1620 { fidl::ObjectType::VMO.into_raw() },
1621 2147483648,
1622 > as fidl::encoding::TypeMarker>::inline_size(
1623 decoder.context
1624 );
1625 if inlined != (member_inline_size <= 4) {
1626 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1627 }
1628 let inner_offset;
1629 let mut inner_depth = depth.clone();
1630 if inlined {
1631 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1632 inner_offset = next_offset;
1633 } else {
1634 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1635 inner_depth.increment()?;
1636 }
1637 let val_ref =
1638 self.vdso.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1639 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1640 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1641 {
1642 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1643 }
1644 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1645 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1646 }
1647 }
1648
1649 next_offset += envelope_size;
1650 _next_ordinal_to_read += 1;
1651 if next_offset >= end_offset {
1652 return Ok(());
1653 }
1654
1655 while _next_ordinal_to_read < 5 {
1657 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1658 _next_ordinal_to_read += 1;
1659 next_offset += envelope_size;
1660 }
1661
1662 let next_out_of_line = decoder.next_out_of_line();
1663 let handles_before = decoder.remaining_handles();
1664 if let Some((inlined, num_bytes, num_handles)) =
1665 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1666 {
1667 let member_inline_size = <fidl::encoding::Endpoint<
1668 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1669 > as fidl::encoding::TypeMarker>::inline_size(
1670 decoder.context
1671 );
1672 if inlined != (member_inline_size <= 4) {
1673 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1674 }
1675 let inner_offset;
1676 let mut inner_depth = depth.clone();
1677 if inlined {
1678 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1679 inner_offset = next_offset;
1680 } else {
1681 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1682 inner_depth.increment()?;
1683 }
1684 let val_ref = self.driver_host_libs.get_or_insert_with(|| {
1685 fidl::new_empty!(
1686 fidl::encoding::Endpoint<
1687 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1688 >,
1689 fidl::encoding::DefaultFuchsiaResourceDialect
1690 )
1691 });
1692 fidl::decode!(
1693 fidl::encoding::Endpoint<
1694 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1695 >,
1696 fidl::encoding::DefaultFuchsiaResourceDialect,
1697 val_ref,
1698 decoder,
1699 inner_offset,
1700 inner_depth
1701 )?;
1702 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1703 {
1704 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1705 }
1706 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1707 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1708 }
1709 }
1710
1711 next_offset += envelope_size;
1712 _next_ordinal_to_read += 1;
1713 if next_offset >= end_offset {
1714 return Ok(());
1715 }
1716
1717 while _next_ordinal_to_read < 6 {
1719 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1720 _next_ordinal_to_read += 1;
1721 next_offset += envelope_size;
1722 }
1723
1724 let next_out_of_line = decoder.next_out_of_line();
1725 let handles_before = decoder.remaining_handles();
1726 if let Some((inlined, num_bytes, num_handles)) =
1727 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1728 {
1729 let member_inline_size = <fidl::encoding::Endpoint<
1730 fidl::endpoints::ServerEnd<DriverHostMarker>,
1731 > as fidl::encoding::TypeMarker>::inline_size(
1732 decoder.context
1733 );
1734 if inlined != (member_inline_size <= 4) {
1735 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1736 }
1737 let inner_offset;
1738 let mut inner_depth = depth.clone();
1739 if inlined {
1740 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1741 inner_offset = next_offset;
1742 } else {
1743 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1744 inner_depth.increment()?;
1745 }
1746 let val_ref = self.driver_host.get_or_insert_with(|| {
1747 fidl::new_empty!(
1748 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>>,
1749 fidl::encoding::DefaultFuchsiaResourceDialect
1750 )
1751 });
1752 fidl::decode!(
1753 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>>,
1754 fidl::encoding::DefaultFuchsiaResourceDialect,
1755 val_ref,
1756 decoder,
1757 inner_offset,
1758 inner_depth
1759 )?;
1760 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1761 {
1762 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1763 }
1764 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1765 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1766 }
1767 }
1768
1769 next_offset += envelope_size;
1770
1771 while next_offset < end_offset {
1773 _next_ordinal_to_read += 1;
1774 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1775 next_offset += envelope_size;
1776 }
1777
1778 Ok(())
1779 }
1780 }
1781
1782 impl DriverHostLoadDriverRequest {
1783 #[inline(always)]
1784 fn max_ordinal_present(&self) -> u64 {
1785 if let Some(_) = self.additional_root_modules {
1786 return 4;
1787 }
1788 if let Some(_) = self.driver_libs {
1789 return 3;
1790 }
1791 if let Some(_) = self.driver_binary {
1792 return 2;
1793 }
1794 if let Some(_) = self.driver_soname {
1795 return 1;
1796 }
1797 0
1798 }
1799 }
1800
1801 impl fidl::encoding::ResourceTypeMarker for DriverHostLoadDriverRequest {
1802 type Borrowed<'a> = &'a mut Self;
1803 fn take_or_borrow<'a>(
1804 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1805 ) -> Self::Borrowed<'a> {
1806 value
1807 }
1808 }
1809
1810 unsafe impl fidl::encoding::TypeMarker for DriverHostLoadDriverRequest {
1811 type Owned = Self;
1812
1813 #[inline(always)]
1814 fn inline_align(_context: fidl::encoding::Context) -> usize {
1815 8
1816 }
1817
1818 #[inline(always)]
1819 fn inline_size(_context: fidl::encoding::Context) -> usize {
1820 16
1821 }
1822 }
1823
1824 unsafe impl
1825 fidl::encoding::Encode<
1826 DriverHostLoadDriverRequest,
1827 fidl::encoding::DefaultFuchsiaResourceDialect,
1828 > for &mut DriverHostLoadDriverRequest
1829 {
1830 unsafe fn encode(
1831 self,
1832 encoder: &mut fidl::encoding::Encoder<
1833 '_,
1834 fidl::encoding::DefaultFuchsiaResourceDialect,
1835 >,
1836 offset: usize,
1837 mut depth: fidl::encoding::Depth,
1838 ) -> fidl::Result<()> {
1839 encoder.debug_check_bounds::<DriverHostLoadDriverRequest>(offset);
1840 let max_ordinal: u64 = self.max_ordinal_present();
1842 encoder.write_num(max_ordinal, offset);
1843 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1844 if max_ordinal == 0 {
1846 return Ok(());
1847 }
1848 depth.increment()?;
1849 let envelope_size = 8;
1850 let bytes_len = max_ordinal as usize * envelope_size;
1851 #[allow(unused_variables)]
1852 let offset = encoder.out_of_line_offset(bytes_len);
1853 let mut _prev_end_offset: usize = 0;
1854 if 1 > max_ordinal {
1855 return Ok(());
1856 }
1857
1858 let cur_offset: usize = (1 - 1) * envelope_size;
1861
1862 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1864
1865 fidl::encoding::encode_in_envelope_optional::<
1870 fidl::encoding::BoundedString<255>,
1871 fidl::encoding::DefaultFuchsiaResourceDialect,
1872 >(
1873 self.driver_soname.as_ref().map(
1874 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1875 ),
1876 encoder,
1877 offset + cur_offset,
1878 depth,
1879 )?;
1880
1881 _prev_end_offset = cur_offset + envelope_size;
1882 if 2 > max_ordinal {
1883 return Ok(());
1884 }
1885
1886 let cur_offset: usize = (2 - 1) * envelope_size;
1889
1890 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1892
1893 fidl::encoding::encode_in_envelope_optional::<
1898 fidl::encoding::HandleType<
1899 fidl::Vmo,
1900 { fidl::ObjectType::VMO.into_raw() },
1901 2147483648,
1902 >,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 >(
1905 self.driver_binary.as_mut().map(
1906 <fidl::encoding::HandleType<
1907 fidl::Vmo,
1908 { fidl::ObjectType::VMO.into_raw() },
1909 2147483648,
1910 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1911 ),
1912 encoder,
1913 offset + cur_offset,
1914 depth,
1915 )?;
1916
1917 _prev_end_offset = cur_offset + envelope_size;
1918 if 3 > max_ordinal {
1919 return Ok(());
1920 }
1921
1922 let cur_offset: usize = (3 - 1) * envelope_size;
1925
1926 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1928
1929 fidl::encoding::encode_in_envelope_optional::<
1934 fidl::encoding::Endpoint<
1935 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1936 >,
1937 fidl::encoding::DefaultFuchsiaResourceDialect,
1938 >(
1939 self.driver_libs.as_mut().map(
1940 <fidl::encoding::Endpoint<
1941 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1942 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1943 ),
1944 encoder,
1945 offset + cur_offset,
1946 depth,
1947 )?;
1948
1949 _prev_end_offset = cur_offset + envelope_size;
1950 if 4 > max_ordinal {
1951 return Ok(());
1952 }
1953
1954 let cur_offset: usize = (4 - 1) * envelope_size;
1957
1958 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1960
1961 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<RootModule>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1966 self.additional_root_modules.as_mut().map(<fidl::encoding::UnboundedVector<RootModule> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1967 encoder, offset + cur_offset, depth
1968 )?;
1969
1970 _prev_end_offset = cur_offset + envelope_size;
1971
1972 Ok(())
1973 }
1974 }
1975
1976 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1977 for DriverHostLoadDriverRequest
1978 {
1979 #[inline(always)]
1980 fn new_empty() -> Self {
1981 Self::default()
1982 }
1983
1984 unsafe fn decode(
1985 &mut self,
1986 decoder: &mut fidl::encoding::Decoder<
1987 '_,
1988 fidl::encoding::DefaultFuchsiaResourceDialect,
1989 >,
1990 offset: usize,
1991 mut depth: fidl::encoding::Depth,
1992 ) -> fidl::Result<()> {
1993 decoder.debug_check_bounds::<Self>(offset);
1994 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1995 None => return Err(fidl::Error::NotNullable),
1996 Some(len) => len,
1997 };
1998 if len == 0 {
2000 return Ok(());
2001 };
2002 depth.increment()?;
2003 let envelope_size = 8;
2004 let bytes_len = len * envelope_size;
2005 let offset = decoder.out_of_line_offset(bytes_len)?;
2006 let mut _next_ordinal_to_read = 0;
2008 let mut next_offset = offset;
2009 let end_offset = offset + bytes_len;
2010 _next_ordinal_to_read += 1;
2011 if next_offset >= end_offset {
2012 return Ok(());
2013 }
2014
2015 while _next_ordinal_to_read < 1 {
2017 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2018 _next_ordinal_to_read += 1;
2019 next_offset += envelope_size;
2020 }
2021
2022 let next_out_of_line = decoder.next_out_of_line();
2023 let handles_before = decoder.remaining_handles();
2024 if let Some((inlined, num_bytes, num_handles)) =
2025 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2026 {
2027 let member_inline_size =
2028 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2029 decoder.context,
2030 );
2031 if inlined != (member_inline_size <= 4) {
2032 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2033 }
2034 let inner_offset;
2035 let mut inner_depth = depth.clone();
2036 if inlined {
2037 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2038 inner_offset = next_offset;
2039 } else {
2040 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2041 inner_depth.increment()?;
2042 }
2043 let val_ref = self.driver_soname.get_or_insert_with(|| {
2044 fidl::new_empty!(
2045 fidl::encoding::BoundedString<255>,
2046 fidl::encoding::DefaultFuchsiaResourceDialect
2047 )
2048 });
2049 fidl::decode!(
2050 fidl::encoding::BoundedString<255>,
2051 fidl::encoding::DefaultFuchsiaResourceDialect,
2052 val_ref,
2053 decoder,
2054 inner_offset,
2055 inner_depth
2056 )?;
2057 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2058 {
2059 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2060 }
2061 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2062 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2063 }
2064 }
2065
2066 next_offset += envelope_size;
2067 _next_ordinal_to_read += 1;
2068 if next_offset >= end_offset {
2069 return Ok(());
2070 }
2071
2072 while _next_ordinal_to_read < 2 {
2074 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2075 _next_ordinal_to_read += 1;
2076 next_offset += envelope_size;
2077 }
2078
2079 let next_out_of_line = decoder.next_out_of_line();
2080 let handles_before = decoder.remaining_handles();
2081 if let Some((inlined, num_bytes, num_handles)) =
2082 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2083 {
2084 let member_inline_size = <fidl::encoding::HandleType<
2085 fidl::Vmo,
2086 { fidl::ObjectType::VMO.into_raw() },
2087 2147483648,
2088 > as fidl::encoding::TypeMarker>::inline_size(
2089 decoder.context
2090 );
2091 if inlined != (member_inline_size <= 4) {
2092 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2093 }
2094 let inner_offset;
2095 let mut inner_depth = depth.clone();
2096 if inlined {
2097 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2098 inner_offset = next_offset;
2099 } else {
2100 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2101 inner_depth.increment()?;
2102 }
2103 let val_ref =
2104 self.driver_binary.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2105 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2106 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2107 {
2108 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2109 }
2110 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2111 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2112 }
2113 }
2114
2115 next_offset += envelope_size;
2116 _next_ordinal_to_read += 1;
2117 if next_offset >= end_offset {
2118 return Ok(());
2119 }
2120
2121 while _next_ordinal_to_read < 3 {
2123 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2124 _next_ordinal_to_read += 1;
2125 next_offset += envelope_size;
2126 }
2127
2128 let next_out_of_line = decoder.next_out_of_line();
2129 let handles_before = decoder.remaining_handles();
2130 if let Some((inlined, num_bytes, num_handles)) =
2131 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2132 {
2133 let member_inline_size = <fidl::encoding::Endpoint<
2134 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2135 > as fidl::encoding::TypeMarker>::inline_size(
2136 decoder.context
2137 );
2138 if inlined != (member_inline_size <= 4) {
2139 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2140 }
2141 let inner_offset;
2142 let mut inner_depth = depth.clone();
2143 if inlined {
2144 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2145 inner_offset = next_offset;
2146 } else {
2147 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2148 inner_depth.increment()?;
2149 }
2150 let val_ref = self.driver_libs.get_or_insert_with(|| {
2151 fidl::new_empty!(
2152 fidl::encoding::Endpoint<
2153 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2154 >,
2155 fidl::encoding::DefaultFuchsiaResourceDialect
2156 )
2157 });
2158 fidl::decode!(
2159 fidl::encoding::Endpoint<
2160 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2161 >,
2162 fidl::encoding::DefaultFuchsiaResourceDialect,
2163 val_ref,
2164 decoder,
2165 inner_offset,
2166 inner_depth
2167 )?;
2168 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2169 {
2170 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2171 }
2172 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2173 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2174 }
2175 }
2176
2177 next_offset += envelope_size;
2178 _next_ordinal_to_read += 1;
2179 if next_offset >= end_offset {
2180 return Ok(());
2181 }
2182
2183 while _next_ordinal_to_read < 4 {
2185 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2186 _next_ordinal_to_read += 1;
2187 next_offset += envelope_size;
2188 }
2189
2190 let next_out_of_line = decoder.next_out_of_line();
2191 let handles_before = decoder.remaining_handles();
2192 if let Some((inlined, num_bytes, num_handles)) =
2193 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2194 {
2195 let member_inline_size = <fidl::encoding::UnboundedVector<RootModule> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2196 if inlined != (member_inline_size <= 4) {
2197 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2198 }
2199 let inner_offset;
2200 let mut inner_depth = depth.clone();
2201 if inlined {
2202 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2203 inner_offset = next_offset;
2204 } else {
2205 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2206 inner_depth.increment()?;
2207 }
2208 let val_ref = self.additional_root_modules.get_or_insert_with(|| {
2209 fidl::new_empty!(
2210 fidl::encoding::UnboundedVector<RootModule>,
2211 fidl::encoding::DefaultFuchsiaResourceDialect
2212 )
2213 });
2214 fidl::decode!(
2215 fidl::encoding::UnboundedVector<RootModule>,
2216 fidl::encoding::DefaultFuchsiaResourceDialect,
2217 val_ref,
2218 decoder,
2219 inner_offset,
2220 inner_depth
2221 )?;
2222 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2223 {
2224 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2225 }
2226 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2227 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2228 }
2229 }
2230
2231 next_offset += envelope_size;
2232
2233 while next_offset < end_offset {
2235 _next_ordinal_to_read += 1;
2236 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2237 next_offset += envelope_size;
2238 }
2239
2240 Ok(())
2241 }
2242 }
2243
2244 impl RootModule {
2245 #[inline(always)]
2246 fn max_ordinal_present(&self) -> u64 {
2247 if let Some(_) = self.binary {
2248 return 2;
2249 }
2250 if let Some(_) = self.name {
2251 return 1;
2252 }
2253 0
2254 }
2255 }
2256
2257 impl fidl::encoding::ResourceTypeMarker for RootModule {
2258 type Borrowed<'a> = &'a mut Self;
2259 fn take_or_borrow<'a>(
2260 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2261 ) -> Self::Borrowed<'a> {
2262 value
2263 }
2264 }
2265
2266 unsafe impl fidl::encoding::TypeMarker for RootModule {
2267 type Owned = Self;
2268
2269 #[inline(always)]
2270 fn inline_align(_context: fidl::encoding::Context) -> usize {
2271 8
2272 }
2273
2274 #[inline(always)]
2275 fn inline_size(_context: fidl::encoding::Context) -> usize {
2276 16
2277 }
2278 }
2279
2280 unsafe impl fidl::encoding::Encode<RootModule, fidl::encoding::DefaultFuchsiaResourceDialect>
2281 for &mut RootModule
2282 {
2283 unsafe fn encode(
2284 self,
2285 encoder: &mut fidl::encoding::Encoder<
2286 '_,
2287 fidl::encoding::DefaultFuchsiaResourceDialect,
2288 >,
2289 offset: usize,
2290 mut depth: fidl::encoding::Depth,
2291 ) -> fidl::Result<()> {
2292 encoder.debug_check_bounds::<RootModule>(offset);
2293 let max_ordinal: u64 = self.max_ordinal_present();
2295 encoder.write_num(max_ordinal, offset);
2296 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2297 if max_ordinal == 0 {
2299 return Ok(());
2300 }
2301 depth.increment()?;
2302 let envelope_size = 8;
2303 let bytes_len = max_ordinal as usize * envelope_size;
2304 #[allow(unused_variables)]
2305 let offset = encoder.out_of_line_offset(bytes_len);
2306 let mut _prev_end_offset: usize = 0;
2307 if 1 > max_ordinal {
2308 return Ok(());
2309 }
2310
2311 let cur_offset: usize = (1 - 1) * envelope_size;
2314
2315 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2317
2318 fidl::encoding::encode_in_envelope_optional::<
2323 fidl::encoding::BoundedString<255>,
2324 fidl::encoding::DefaultFuchsiaResourceDialect,
2325 >(
2326 self.name.as_ref().map(
2327 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
2328 ),
2329 encoder,
2330 offset + cur_offset,
2331 depth,
2332 )?;
2333
2334 _prev_end_offset = cur_offset + envelope_size;
2335 if 2 > max_ordinal {
2336 return Ok(());
2337 }
2338
2339 let cur_offset: usize = (2 - 1) * envelope_size;
2342
2343 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2345
2346 fidl::encoding::encode_in_envelope_optional::<
2351 fidl::encoding::HandleType<
2352 fidl::Vmo,
2353 { fidl::ObjectType::VMO.into_raw() },
2354 2147483648,
2355 >,
2356 fidl::encoding::DefaultFuchsiaResourceDialect,
2357 >(
2358 self.binary.as_mut().map(
2359 <fidl::encoding::HandleType<
2360 fidl::Vmo,
2361 { fidl::ObjectType::VMO.into_raw() },
2362 2147483648,
2363 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2364 ),
2365 encoder,
2366 offset + cur_offset,
2367 depth,
2368 )?;
2369
2370 _prev_end_offset = cur_offset + envelope_size;
2371
2372 Ok(())
2373 }
2374 }
2375
2376 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RootModule {
2377 #[inline(always)]
2378 fn new_empty() -> Self {
2379 Self::default()
2380 }
2381
2382 unsafe fn decode(
2383 &mut self,
2384 decoder: &mut fidl::encoding::Decoder<
2385 '_,
2386 fidl::encoding::DefaultFuchsiaResourceDialect,
2387 >,
2388 offset: usize,
2389 mut depth: fidl::encoding::Depth,
2390 ) -> fidl::Result<()> {
2391 decoder.debug_check_bounds::<Self>(offset);
2392 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2393 None => return Err(fidl::Error::NotNullable),
2394 Some(len) => len,
2395 };
2396 if len == 0 {
2398 return Ok(());
2399 };
2400 depth.increment()?;
2401 let envelope_size = 8;
2402 let bytes_len = len * envelope_size;
2403 let offset = decoder.out_of_line_offset(bytes_len)?;
2404 let mut _next_ordinal_to_read = 0;
2406 let mut next_offset = offset;
2407 let end_offset = offset + bytes_len;
2408 _next_ordinal_to_read += 1;
2409 if next_offset >= end_offset {
2410 return Ok(());
2411 }
2412
2413 while _next_ordinal_to_read < 1 {
2415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2416 _next_ordinal_to_read += 1;
2417 next_offset += envelope_size;
2418 }
2419
2420 let next_out_of_line = decoder.next_out_of_line();
2421 let handles_before = decoder.remaining_handles();
2422 if let Some((inlined, num_bytes, num_handles)) =
2423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2424 {
2425 let member_inline_size =
2426 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2427 decoder.context,
2428 );
2429 if inlined != (member_inline_size <= 4) {
2430 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2431 }
2432 let inner_offset;
2433 let mut inner_depth = depth.clone();
2434 if inlined {
2435 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2436 inner_offset = next_offset;
2437 } else {
2438 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2439 inner_depth.increment()?;
2440 }
2441 let val_ref = self.name.get_or_insert_with(|| {
2442 fidl::new_empty!(
2443 fidl::encoding::BoundedString<255>,
2444 fidl::encoding::DefaultFuchsiaResourceDialect
2445 )
2446 });
2447 fidl::decode!(
2448 fidl::encoding::BoundedString<255>,
2449 fidl::encoding::DefaultFuchsiaResourceDialect,
2450 val_ref,
2451 decoder,
2452 inner_offset,
2453 inner_depth
2454 )?;
2455 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2456 {
2457 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2458 }
2459 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2460 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2461 }
2462 }
2463
2464 next_offset += envelope_size;
2465 _next_ordinal_to_read += 1;
2466 if next_offset >= end_offset {
2467 return Ok(());
2468 }
2469
2470 while _next_ordinal_to_read < 2 {
2472 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2473 _next_ordinal_to_read += 1;
2474 next_offset += envelope_size;
2475 }
2476
2477 let next_out_of_line = decoder.next_out_of_line();
2478 let handles_before = decoder.remaining_handles();
2479 if let Some((inlined, num_bytes, num_handles)) =
2480 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2481 {
2482 let member_inline_size = <fidl::encoding::HandleType<
2483 fidl::Vmo,
2484 { fidl::ObjectType::VMO.into_raw() },
2485 2147483648,
2486 > as fidl::encoding::TypeMarker>::inline_size(
2487 decoder.context
2488 );
2489 if inlined != (member_inline_size <= 4) {
2490 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2491 }
2492 let inner_offset;
2493 let mut inner_depth = depth.clone();
2494 if inlined {
2495 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2496 inner_offset = next_offset;
2497 } else {
2498 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2499 inner_depth.increment()?;
2500 }
2501 let val_ref =
2502 self.binary.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2503 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2504 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2505 {
2506 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2507 }
2508 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2509 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2510 }
2511 }
2512
2513 next_offset += envelope_size;
2514
2515 while next_offset < end_offset {
2517 _next_ordinal_to_read += 1;
2518 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2519 next_offset += envelope_size;
2520 }
2521
2522 Ok(())
2523 }
2524 }
2525}