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