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 fidl::endpoints::ControlHandle for DriverHostControlHandle {
493 fn shutdown(&self) {
494 self.inner.shutdown()
495 }
496
497 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
498 self.inner.shutdown_with_epitaph(status)
499 }
500
501 fn is_closed(&self) -> bool {
502 self.inner.channel().is_closed()
503 }
504 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
505 self.inner.channel().on_closed()
506 }
507
508 #[cfg(target_os = "fuchsia")]
509 fn signal_peer(
510 &self,
511 clear_mask: zx::Signals,
512 set_mask: zx::Signals,
513 ) -> Result<(), zx_status::Status> {
514 use fidl::Peered;
515 self.inner.channel().signal_peer(clear_mask, set_mask)
516 }
517}
518
519impl DriverHostControlHandle {}
520
521#[must_use = "FIDL methods require a response to be sent"]
522#[derive(Debug)]
523pub struct DriverHostLoadDriverResponder {
524 control_handle: std::mem::ManuallyDrop<DriverHostControlHandle>,
525 tx_id: u32,
526}
527
528impl std::ops::Drop for DriverHostLoadDriverResponder {
532 fn drop(&mut self) {
533 self.control_handle.shutdown();
534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
536 }
537}
538
539impl fidl::endpoints::Responder for DriverHostLoadDriverResponder {
540 type ControlHandle = DriverHostControlHandle;
541
542 fn control_handle(&self) -> &DriverHostControlHandle {
543 &self.control_handle
544 }
545
546 fn drop_without_shutdown(mut self) {
547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
549 std::mem::forget(self);
551 }
552}
553
554impl DriverHostLoadDriverResponder {
555 pub fn send(
559 self,
560 mut result: Result<&DriverHostLoadDriverResponse, i32>,
561 ) -> Result<(), fidl::Error> {
562 let _result = self.send_raw(result);
563 if _result.is_err() {
564 self.control_handle.shutdown();
565 }
566 self.drop_without_shutdown();
567 _result
568 }
569
570 pub fn send_no_shutdown_on_err(
572 self,
573 mut result: Result<&DriverHostLoadDriverResponse, i32>,
574 ) -> Result<(), fidl::Error> {
575 let _result = self.send_raw(result);
576 self.drop_without_shutdown();
577 _result
578 }
579
580 fn send_raw(
581 &self,
582 mut result: Result<&DriverHostLoadDriverResponse, i32>,
583 ) -> Result<(), fidl::Error> {
584 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
585 DriverHostLoadDriverResponse,
586 i32,
587 >>(
588 fidl::encoding::FlexibleResult::new(result),
589 self.tx_id,
590 0x5c43a774b3fd4930,
591 fidl::encoding::DynamicFlags::FLEXIBLE,
592 )
593 }
594}
595
596#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
597pub struct DriverHostLauncherMarker;
598
599impl fidl::endpoints::ProtocolMarker for DriverHostLauncherMarker {
600 type Proxy = DriverHostLauncherProxy;
601 type RequestStream = DriverHostLauncherRequestStream;
602 #[cfg(target_os = "fuchsia")]
603 type SynchronousProxy = DriverHostLauncherSynchronousProxy;
604
605 const DEBUG_NAME: &'static str = "fuchsia.driver.loader.DriverHostLauncher";
606}
607impl fidl::endpoints::DiscoverableProtocolMarker for DriverHostLauncherMarker {}
608pub type DriverHostLauncherLaunchResult = Result<(), i32>;
609
610pub trait DriverHostLauncherProxyInterface: Send + Sync {
611 type LaunchResponseFut: std::future::Future<Output = Result<DriverHostLauncherLaunchResult, fidl::Error>>
612 + Send;
613 fn r#launch(&self, payload: DriverHostLauncherLaunchRequest) -> Self::LaunchResponseFut;
614}
615#[derive(Debug)]
616#[cfg(target_os = "fuchsia")]
617pub struct DriverHostLauncherSynchronousProxy {
618 client: fidl::client::sync::Client,
619}
620
621#[cfg(target_os = "fuchsia")]
622impl fidl::endpoints::SynchronousProxy for DriverHostLauncherSynchronousProxy {
623 type Proxy = DriverHostLauncherProxy;
624 type Protocol = DriverHostLauncherMarker;
625
626 fn from_channel(inner: fidl::Channel) -> Self {
627 Self::new(inner)
628 }
629
630 fn into_channel(self) -> fidl::Channel {
631 self.client.into_channel()
632 }
633
634 fn as_channel(&self) -> &fidl::Channel {
635 self.client.as_channel()
636 }
637}
638
639#[cfg(target_os = "fuchsia")]
640impl DriverHostLauncherSynchronousProxy {
641 pub fn new(channel: fidl::Channel) -> Self {
642 Self { client: fidl::client::sync::Client::new(channel) }
643 }
644
645 pub fn into_channel(self) -> fidl::Channel {
646 self.client.into_channel()
647 }
648
649 pub fn wait_for_event(
652 &self,
653 deadline: zx::MonotonicInstant,
654 ) -> Result<DriverHostLauncherEvent, fidl::Error> {
655 DriverHostLauncherEvent::decode(
656 self.client.wait_for_event::<DriverHostLauncherMarker>(deadline)?,
657 )
658 }
659
660 pub fn r#launch(
667 &self,
668 mut payload: DriverHostLauncherLaunchRequest,
669 ___deadline: zx::MonotonicInstant,
670 ) -> Result<DriverHostLauncherLaunchResult, fidl::Error> {
671 let _response = self.client.send_query::<
672 DriverHostLauncherLaunchRequest,
673 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
674 DriverHostLauncherMarker,
675 >(
676 &mut payload,
677 0x3af75d84043eb730,
678 fidl::encoding::DynamicFlags::FLEXIBLE,
679 ___deadline,
680 )?
681 .into_result::<DriverHostLauncherMarker>("launch")?;
682 Ok(_response.map(|x| x))
683 }
684}
685
686#[cfg(target_os = "fuchsia")]
687impl From<DriverHostLauncherSynchronousProxy> for zx::NullableHandle {
688 fn from(value: DriverHostLauncherSynchronousProxy) -> Self {
689 value.into_channel().into()
690 }
691}
692
693#[cfg(target_os = "fuchsia")]
694impl From<fidl::Channel> for DriverHostLauncherSynchronousProxy {
695 fn from(value: fidl::Channel) -> Self {
696 Self::new(value)
697 }
698}
699
700#[cfg(target_os = "fuchsia")]
701impl fidl::endpoints::FromClient for DriverHostLauncherSynchronousProxy {
702 type Protocol = DriverHostLauncherMarker;
703
704 fn from_client(value: fidl::endpoints::ClientEnd<DriverHostLauncherMarker>) -> Self {
705 Self::new(value.into_channel())
706 }
707}
708
709#[derive(Debug, Clone)]
710pub struct DriverHostLauncherProxy {
711 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
712}
713
714impl fidl::endpoints::Proxy for DriverHostLauncherProxy {
715 type Protocol = DriverHostLauncherMarker;
716
717 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
718 Self::new(inner)
719 }
720
721 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
722 self.client.into_channel().map_err(|client| Self { client })
723 }
724
725 fn as_channel(&self) -> &::fidl::AsyncChannel {
726 self.client.as_channel()
727 }
728}
729
730impl DriverHostLauncherProxy {
731 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
733 let protocol_name =
734 <DriverHostLauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
735 Self { client: fidl::client::Client::new(channel, protocol_name) }
736 }
737
738 pub fn take_event_stream(&self) -> DriverHostLauncherEventStream {
744 DriverHostLauncherEventStream { event_receiver: self.client.take_event_receiver() }
745 }
746
747 pub fn r#launch(
754 &self,
755 mut payload: DriverHostLauncherLaunchRequest,
756 ) -> fidl::client::QueryResponseFut<
757 DriverHostLauncherLaunchResult,
758 fidl::encoding::DefaultFuchsiaResourceDialect,
759 > {
760 DriverHostLauncherProxyInterface::r#launch(self, payload)
761 }
762}
763
764impl DriverHostLauncherProxyInterface for DriverHostLauncherProxy {
765 type LaunchResponseFut = fidl::client::QueryResponseFut<
766 DriverHostLauncherLaunchResult,
767 fidl::encoding::DefaultFuchsiaResourceDialect,
768 >;
769 fn r#launch(&self, mut payload: DriverHostLauncherLaunchRequest) -> Self::LaunchResponseFut {
770 fn _decode(
771 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
772 ) -> Result<DriverHostLauncherLaunchResult, fidl::Error> {
773 let _response = fidl::client::decode_transaction_body::<
774 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
775 fidl::encoding::DefaultFuchsiaResourceDialect,
776 0x3af75d84043eb730,
777 >(_buf?)?
778 .into_result::<DriverHostLauncherMarker>("launch")?;
779 Ok(_response.map(|x| x))
780 }
781 self.client.send_query_and_decode::<
782 DriverHostLauncherLaunchRequest,
783 DriverHostLauncherLaunchResult,
784 >(
785 &mut payload,
786 0x3af75d84043eb730,
787 fidl::encoding::DynamicFlags::FLEXIBLE,
788 _decode,
789 )
790 }
791}
792
793pub struct DriverHostLauncherEventStream {
794 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
795}
796
797impl std::marker::Unpin for DriverHostLauncherEventStream {}
798
799impl futures::stream::FusedStream for DriverHostLauncherEventStream {
800 fn is_terminated(&self) -> bool {
801 self.event_receiver.is_terminated()
802 }
803}
804
805impl futures::Stream for DriverHostLauncherEventStream {
806 type Item = Result<DriverHostLauncherEvent, fidl::Error>;
807
808 fn poll_next(
809 mut self: std::pin::Pin<&mut Self>,
810 cx: &mut std::task::Context<'_>,
811 ) -> std::task::Poll<Option<Self::Item>> {
812 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
813 &mut self.event_receiver,
814 cx
815 )?) {
816 Some(buf) => std::task::Poll::Ready(Some(DriverHostLauncherEvent::decode(buf))),
817 None => std::task::Poll::Ready(None),
818 }
819 }
820}
821
822#[derive(Debug)]
823pub enum DriverHostLauncherEvent {
824 #[non_exhaustive]
825 _UnknownEvent {
826 ordinal: u64,
828 },
829}
830
831impl DriverHostLauncherEvent {
832 fn decode(
834 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
835 ) -> Result<DriverHostLauncherEvent, fidl::Error> {
836 let (bytes, _handles) = buf.split_mut();
837 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
838 debug_assert_eq!(tx_header.tx_id, 0);
839 match tx_header.ordinal {
840 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
841 Ok(DriverHostLauncherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
842 }
843 _ => Err(fidl::Error::UnknownOrdinal {
844 ordinal: tx_header.ordinal,
845 protocol_name:
846 <DriverHostLauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
847 }),
848 }
849 }
850}
851
852pub struct DriverHostLauncherRequestStream {
854 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
855 is_terminated: bool,
856}
857
858impl std::marker::Unpin for DriverHostLauncherRequestStream {}
859
860impl futures::stream::FusedStream for DriverHostLauncherRequestStream {
861 fn is_terminated(&self) -> bool {
862 self.is_terminated
863 }
864}
865
866impl fidl::endpoints::RequestStream for DriverHostLauncherRequestStream {
867 type Protocol = DriverHostLauncherMarker;
868 type ControlHandle = DriverHostLauncherControlHandle;
869
870 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
871 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
872 }
873
874 fn control_handle(&self) -> Self::ControlHandle {
875 DriverHostLauncherControlHandle { inner: self.inner.clone() }
876 }
877
878 fn into_inner(
879 self,
880 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
881 {
882 (self.inner, self.is_terminated)
883 }
884
885 fn from_inner(
886 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
887 is_terminated: bool,
888 ) -> Self {
889 Self { inner, is_terminated }
890 }
891}
892
893impl futures::Stream for DriverHostLauncherRequestStream {
894 type Item = Result<DriverHostLauncherRequest, fidl::Error>;
895
896 fn poll_next(
897 mut self: std::pin::Pin<&mut Self>,
898 cx: &mut std::task::Context<'_>,
899 ) -> std::task::Poll<Option<Self::Item>> {
900 let this = &mut *self;
901 if this.inner.check_shutdown(cx) {
902 this.is_terminated = true;
903 return std::task::Poll::Ready(None);
904 }
905 if this.is_terminated {
906 panic!("polled DriverHostLauncherRequestStream after completion");
907 }
908 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
909 |bytes, handles| {
910 match this.inner.channel().read_etc(cx, bytes, handles) {
911 std::task::Poll::Ready(Ok(())) => {}
912 std::task::Poll::Pending => return std::task::Poll::Pending,
913 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
914 this.is_terminated = true;
915 return std::task::Poll::Ready(None);
916 }
917 std::task::Poll::Ready(Err(e)) => {
918 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
919 e.into(),
920 ))));
921 }
922 }
923
924 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
926
927 std::task::Poll::Ready(Some(match header.ordinal {
928 0x3af75d84043eb730 => {
929 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
930 let mut req = fidl::new_empty!(DriverHostLauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
931 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverHostLauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
932 let control_handle = DriverHostLauncherControlHandle {
933 inner: this.inner.clone(),
934 };
935 Ok(DriverHostLauncherRequest::Launch {payload: req,
936 responder: DriverHostLauncherLaunchResponder {
937 control_handle: std::mem::ManuallyDrop::new(control_handle),
938 tx_id: header.tx_id,
939 },
940 })
941 }
942 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
943 Ok(DriverHostLauncherRequest::_UnknownMethod {
944 ordinal: header.ordinal,
945 control_handle: DriverHostLauncherControlHandle { inner: this.inner.clone() },
946 method_type: fidl::MethodType::OneWay,
947 })
948 }
949 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
950 this.inner.send_framework_err(
951 fidl::encoding::FrameworkErr::UnknownMethod,
952 header.tx_id,
953 header.ordinal,
954 header.dynamic_flags(),
955 (bytes, handles),
956 )?;
957 Ok(DriverHostLauncherRequest::_UnknownMethod {
958 ordinal: header.ordinal,
959 control_handle: DriverHostLauncherControlHandle { inner: this.inner.clone() },
960 method_type: fidl::MethodType::TwoWay,
961 })
962 }
963 _ => Err(fidl::Error::UnknownOrdinal {
964 ordinal: header.ordinal,
965 protocol_name: <DriverHostLauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
966 }),
967 }))
968 },
969 )
970 }
971}
972
973#[derive(Debug)]
976pub enum DriverHostLauncherRequest {
977 Launch {
984 payload: DriverHostLauncherLaunchRequest,
985 responder: DriverHostLauncherLaunchResponder,
986 },
987 #[non_exhaustive]
989 _UnknownMethod {
990 ordinal: u64,
992 control_handle: DriverHostLauncherControlHandle,
993 method_type: fidl::MethodType,
994 },
995}
996
997impl DriverHostLauncherRequest {
998 #[allow(irrefutable_let_patterns)]
999 pub fn into_launch(
1000 self,
1001 ) -> Option<(DriverHostLauncherLaunchRequest, DriverHostLauncherLaunchResponder)> {
1002 if let DriverHostLauncherRequest::Launch { payload, responder } = self {
1003 Some((payload, responder))
1004 } else {
1005 None
1006 }
1007 }
1008
1009 pub fn method_name(&self) -> &'static str {
1011 match *self {
1012 DriverHostLauncherRequest::Launch { .. } => "launch",
1013 DriverHostLauncherRequest::_UnknownMethod {
1014 method_type: fidl::MethodType::OneWay,
1015 ..
1016 } => "unknown one-way method",
1017 DriverHostLauncherRequest::_UnknownMethod {
1018 method_type: fidl::MethodType::TwoWay,
1019 ..
1020 } => "unknown two-way method",
1021 }
1022 }
1023}
1024
1025#[derive(Debug, Clone)]
1026pub struct DriverHostLauncherControlHandle {
1027 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1028}
1029
1030impl fidl::endpoints::ControlHandle for DriverHostLauncherControlHandle {
1031 fn shutdown(&self) {
1032 self.inner.shutdown()
1033 }
1034
1035 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1036 self.inner.shutdown_with_epitaph(status)
1037 }
1038
1039 fn is_closed(&self) -> bool {
1040 self.inner.channel().is_closed()
1041 }
1042 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1043 self.inner.channel().on_closed()
1044 }
1045
1046 #[cfg(target_os = "fuchsia")]
1047 fn signal_peer(
1048 &self,
1049 clear_mask: zx::Signals,
1050 set_mask: zx::Signals,
1051 ) -> Result<(), zx_status::Status> {
1052 use fidl::Peered;
1053 self.inner.channel().signal_peer(clear_mask, set_mask)
1054 }
1055}
1056
1057impl DriverHostLauncherControlHandle {}
1058
1059#[must_use = "FIDL methods require a response to be sent"]
1060#[derive(Debug)]
1061pub struct DriverHostLauncherLaunchResponder {
1062 control_handle: std::mem::ManuallyDrop<DriverHostLauncherControlHandle>,
1063 tx_id: u32,
1064}
1065
1066impl std::ops::Drop for DriverHostLauncherLaunchResponder {
1070 fn drop(&mut self) {
1071 self.control_handle.shutdown();
1072 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1074 }
1075}
1076
1077impl fidl::endpoints::Responder for DriverHostLauncherLaunchResponder {
1078 type ControlHandle = DriverHostLauncherControlHandle;
1079
1080 fn control_handle(&self) -> &DriverHostLauncherControlHandle {
1081 &self.control_handle
1082 }
1083
1084 fn drop_without_shutdown(mut self) {
1085 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1087 std::mem::forget(self);
1089 }
1090}
1091
1092impl DriverHostLauncherLaunchResponder {
1093 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1097 let _result = self.send_raw(result);
1098 if _result.is_err() {
1099 self.control_handle.shutdown();
1100 }
1101 self.drop_without_shutdown();
1102 _result
1103 }
1104
1105 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1107 let _result = self.send_raw(result);
1108 self.drop_without_shutdown();
1109 _result
1110 }
1111
1112 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1113 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1114 fidl::encoding::EmptyStruct,
1115 i32,
1116 >>(
1117 fidl::encoding::FlexibleResult::new(result),
1118 self.tx_id,
1119 0x3af75d84043eb730,
1120 fidl::encoding::DynamicFlags::FLEXIBLE,
1121 )
1122 }
1123}
1124
1125mod internal {
1126 use super::*;
1127
1128 impl DriverHostLauncherLaunchRequest {
1129 #[inline(always)]
1130 fn max_ordinal_present(&self) -> u64 {
1131 if let Some(_) = self.driver_host {
1132 return 6;
1133 }
1134 if let Some(_) = self.driver_host_libs {
1135 return 5;
1136 }
1137 if let Some(_) = self.vdso {
1138 return 4;
1139 }
1140 if let Some(_) = self.driver_host_binary {
1141 return 3;
1142 }
1143 if let Some(_) = self.root_vmar {
1144 return 2;
1145 }
1146 if let Some(_) = self.process {
1147 return 1;
1148 }
1149 0
1150 }
1151 }
1152
1153 impl fidl::encoding::ResourceTypeMarker for DriverHostLauncherLaunchRequest {
1154 type Borrowed<'a> = &'a mut Self;
1155 fn take_or_borrow<'a>(
1156 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1157 ) -> Self::Borrowed<'a> {
1158 value
1159 }
1160 }
1161
1162 unsafe impl fidl::encoding::TypeMarker for DriverHostLauncherLaunchRequest {
1163 type Owned = Self;
1164
1165 #[inline(always)]
1166 fn inline_align(_context: fidl::encoding::Context) -> usize {
1167 8
1168 }
1169
1170 #[inline(always)]
1171 fn inline_size(_context: fidl::encoding::Context) -> usize {
1172 16
1173 }
1174 }
1175
1176 unsafe impl
1177 fidl::encoding::Encode<
1178 DriverHostLauncherLaunchRequest,
1179 fidl::encoding::DefaultFuchsiaResourceDialect,
1180 > for &mut DriverHostLauncherLaunchRequest
1181 {
1182 unsafe fn encode(
1183 self,
1184 encoder: &mut fidl::encoding::Encoder<
1185 '_,
1186 fidl::encoding::DefaultFuchsiaResourceDialect,
1187 >,
1188 offset: usize,
1189 mut depth: fidl::encoding::Depth,
1190 ) -> fidl::Result<()> {
1191 encoder.debug_check_bounds::<DriverHostLauncherLaunchRequest>(offset);
1192 let max_ordinal: u64 = self.max_ordinal_present();
1194 encoder.write_num(max_ordinal, offset);
1195 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1196 if max_ordinal == 0 {
1198 return Ok(());
1199 }
1200 depth.increment()?;
1201 let envelope_size = 8;
1202 let bytes_len = max_ordinal as usize * envelope_size;
1203 #[allow(unused_variables)]
1204 let offset = encoder.out_of_line_offset(bytes_len);
1205 let mut _prev_end_offset: usize = 0;
1206 if 1 > max_ordinal {
1207 return Ok(());
1208 }
1209
1210 let cur_offset: usize = (1 - 1) * envelope_size;
1213
1214 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1216
1217 fidl::encoding::encode_in_envelope_optional::<
1222 fidl::encoding::HandleType<
1223 fidl::Process,
1224 { fidl::ObjectType::PROCESS.into_raw() },
1225 2147483648,
1226 >,
1227 fidl::encoding::DefaultFuchsiaResourceDialect,
1228 >(
1229 self.process.as_mut().map(
1230 <fidl::encoding::HandleType<
1231 fidl::Process,
1232 { fidl::ObjectType::PROCESS.into_raw() },
1233 2147483648,
1234 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1235 ),
1236 encoder,
1237 offset + cur_offset,
1238 depth,
1239 )?;
1240
1241 _prev_end_offset = cur_offset + envelope_size;
1242 if 2 > max_ordinal {
1243 return Ok(());
1244 }
1245
1246 let cur_offset: usize = (2 - 1) * envelope_size;
1249
1250 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1252
1253 fidl::encoding::encode_in_envelope_optional::<
1258 fidl::encoding::HandleType<
1259 fidl::Vmar,
1260 { fidl::ObjectType::VMAR.into_raw() },
1261 2147483648,
1262 >,
1263 fidl::encoding::DefaultFuchsiaResourceDialect,
1264 >(
1265 self.root_vmar.as_mut().map(
1266 <fidl::encoding::HandleType<
1267 fidl::Vmar,
1268 { fidl::ObjectType::VMAR.into_raw() },
1269 2147483648,
1270 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1271 ),
1272 encoder,
1273 offset + cur_offset,
1274 depth,
1275 )?;
1276
1277 _prev_end_offset = cur_offset + envelope_size;
1278 if 3 > max_ordinal {
1279 return Ok(());
1280 }
1281
1282 let cur_offset: usize = (3 - 1) * envelope_size;
1285
1286 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1288
1289 fidl::encoding::encode_in_envelope_optional::<
1294 fidl::encoding::HandleType<
1295 fidl::Vmo,
1296 { fidl::ObjectType::VMO.into_raw() },
1297 2147483648,
1298 >,
1299 fidl::encoding::DefaultFuchsiaResourceDialect,
1300 >(
1301 self.driver_host_binary.as_mut().map(
1302 <fidl::encoding::HandleType<
1303 fidl::Vmo,
1304 { fidl::ObjectType::VMO.into_raw() },
1305 2147483648,
1306 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1307 ),
1308 encoder,
1309 offset + cur_offset,
1310 depth,
1311 )?;
1312
1313 _prev_end_offset = cur_offset + envelope_size;
1314 if 4 > max_ordinal {
1315 return Ok(());
1316 }
1317
1318 let cur_offset: usize = (4 - 1) * envelope_size;
1321
1322 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1324
1325 fidl::encoding::encode_in_envelope_optional::<
1330 fidl::encoding::HandleType<
1331 fidl::Vmo,
1332 { fidl::ObjectType::VMO.into_raw() },
1333 2147483648,
1334 >,
1335 fidl::encoding::DefaultFuchsiaResourceDialect,
1336 >(
1337 self.vdso.as_mut().map(
1338 <fidl::encoding::HandleType<
1339 fidl::Vmo,
1340 { fidl::ObjectType::VMO.into_raw() },
1341 2147483648,
1342 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1343 ),
1344 encoder,
1345 offset + cur_offset,
1346 depth,
1347 )?;
1348
1349 _prev_end_offset = cur_offset + envelope_size;
1350 if 5 > max_ordinal {
1351 return Ok(());
1352 }
1353
1354 let cur_offset: usize = (5 - 1) * envelope_size;
1357
1358 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1360
1361 fidl::encoding::encode_in_envelope_optional::<
1366 fidl::encoding::Endpoint<
1367 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1368 >,
1369 fidl::encoding::DefaultFuchsiaResourceDialect,
1370 >(
1371 self.driver_host_libs.as_mut().map(
1372 <fidl::encoding::Endpoint<
1373 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1374 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1375 ),
1376 encoder,
1377 offset + cur_offset,
1378 depth,
1379 )?;
1380
1381 _prev_end_offset = cur_offset + envelope_size;
1382 if 6 > max_ordinal {
1383 return Ok(());
1384 }
1385
1386 let cur_offset: usize = (6 - 1) * envelope_size;
1389
1390 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1392
1393 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1398 self.driver_host.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1399 encoder, offset + cur_offset, depth
1400 )?;
1401
1402 _prev_end_offset = cur_offset + envelope_size;
1403
1404 Ok(())
1405 }
1406 }
1407
1408 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1409 for DriverHostLauncherLaunchRequest
1410 {
1411 #[inline(always)]
1412 fn new_empty() -> Self {
1413 Self::default()
1414 }
1415
1416 unsafe fn decode(
1417 &mut self,
1418 decoder: &mut fidl::encoding::Decoder<
1419 '_,
1420 fidl::encoding::DefaultFuchsiaResourceDialect,
1421 >,
1422 offset: usize,
1423 mut depth: fidl::encoding::Depth,
1424 ) -> fidl::Result<()> {
1425 decoder.debug_check_bounds::<Self>(offset);
1426 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1427 None => return Err(fidl::Error::NotNullable),
1428 Some(len) => len,
1429 };
1430 if len == 0 {
1432 return Ok(());
1433 };
1434 depth.increment()?;
1435 let envelope_size = 8;
1436 let bytes_len = len * envelope_size;
1437 let offset = decoder.out_of_line_offset(bytes_len)?;
1438 let mut _next_ordinal_to_read = 0;
1440 let mut next_offset = offset;
1441 let end_offset = offset + bytes_len;
1442 _next_ordinal_to_read += 1;
1443 if next_offset >= end_offset {
1444 return Ok(());
1445 }
1446
1447 while _next_ordinal_to_read < 1 {
1449 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1450 _next_ordinal_to_read += 1;
1451 next_offset += envelope_size;
1452 }
1453
1454 let next_out_of_line = decoder.next_out_of_line();
1455 let handles_before = decoder.remaining_handles();
1456 if let Some((inlined, num_bytes, num_handles)) =
1457 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1458 {
1459 let member_inline_size = <fidl::encoding::HandleType<
1460 fidl::Process,
1461 { fidl::ObjectType::PROCESS.into_raw() },
1462 2147483648,
1463 > as fidl::encoding::TypeMarker>::inline_size(
1464 decoder.context
1465 );
1466 if inlined != (member_inline_size <= 4) {
1467 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1468 }
1469 let inner_offset;
1470 let mut inner_depth = depth.clone();
1471 if inlined {
1472 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1473 inner_offset = next_offset;
1474 } else {
1475 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1476 inner_depth.increment()?;
1477 }
1478 let val_ref =
1479 self.process.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1480 fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1481 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1482 {
1483 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1484 }
1485 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1486 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1487 }
1488 }
1489
1490 next_offset += envelope_size;
1491 _next_ordinal_to_read += 1;
1492 if next_offset >= end_offset {
1493 return Ok(());
1494 }
1495
1496 while _next_ordinal_to_read < 2 {
1498 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1499 _next_ordinal_to_read += 1;
1500 next_offset += envelope_size;
1501 }
1502
1503 let next_out_of_line = decoder.next_out_of_line();
1504 let handles_before = decoder.remaining_handles();
1505 if let Some((inlined, num_bytes, num_handles)) =
1506 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1507 {
1508 let member_inline_size = <fidl::encoding::HandleType<
1509 fidl::Vmar,
1510 { fidl::ObjectType::VMAR.into_raw() },
1511 2147483648,
1512 > as fidl::encoding::TypeMarker>::inline_size(
1513 decoder.context
1514 );
1515 if inlined != (member_inline_size <= 4) {
1516 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1517 }
1518 let inner_offset;
1519 let mut inner_depth = depth.clone();
1520 if inlined {
1521 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1522 inner_offset = next_offset;
1523 } else {
1524 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1525 inner_depth.increment()?;
1526 }
1527 let val_ref =
1528 self.root_vmar.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1529 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1530 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1531 {
1532 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1533 }
1534 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1535 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1536 }
1537 }
1538
1539 next_offset += envelope_size;
1540 _next_ordinal_to_read += 1;
1541 if next_offset >= end_offset {
1542 return Ok(());
1543 }
1544
1545 while _next_ordinal_to_read < 3 {
1547 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1548 _next_ordinal_to_read += 1;
1549 next_offset += envelope_size;
1550 }
1551
1552 let next_out_of_line = decoder.next_out_of_line();
1553 let handles_before = decoder.remaining_handles();
1554 if let Some((inlined, num_bytes, num_handles)) =
1555 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1556 {
1557 let member_inline_size = <fidl::encoding::HandleType<
1558 fidl::Vmo,
1559 { fidl::ObjectType::VMO.into_raw() },
1560 2147483648,
1561 > as fidl::encoding::TypeMarker>::inline_size(
1562 decoder.context
1563 );
1564 if inlined != (member_inline_size <= 4) {
1565 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1566 }
1567 let inner_offset;
1568 let mut inner_depth = depth.clone();
1569 if inlined {
1570 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1571 inner_offset = next_offset;
1572 } else {
1573 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1574 inner_depth.increment()?;
1575 }
1576 let val_ref =
1577 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));
1578 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1579 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1580 {
1581 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1582 }
1583 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1584 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1585 }
1586 }
1587
1588 next_offset += envelope_size;
1589 _next_ordinal_to_read += 1;
1590 if next_offset >= end_offset {
1591 return Ok(());
1592 }
1593
1594 while _next_ordinal_to_read < 4 {
1596 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1597 _next_ordinal_to_read += 1;
1598 next_offset += envelope_size;
1599 }
1600
1601 let next_out_of_line = decoder.next_out_of_line();
1602 let handles_before = decoder.remaining_handles();
1603 if let Some((inlined, num_bytes, num_handles)) =
1604 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1605 {
1606 let member_inline_size = <fidl::encoding::HandleType<
1607 fidl::Vmo,
1608 { fidl::ObjectType::VMO.into_raw() },
1609 2147483648,
1610 > as fidl::encoding::TypeMarker>::inline_size(
1611 decoder.context
1612 );
1613 if inlined != (member_inline_size <= 4) {
1614 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1615 }
1616 let inner_offset;
1617 let mut inner_depth = depth.clone();
1618 if inlined {
1619 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1620 inner_offset = next_offset;
1621 } else {
1622 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1623 inner_depth.increment()?;
1624 }
1625 let val_ref =
1626 self.vdso.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1627 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1628 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1629 {
1630 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1631 }
1632 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1633 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1634 }
1635 }
1636
1637 next_offset += envelope_size;
1638 _next_ordinal_to_read += 1;
1639 if next_offset >= end_offset {
1640 return Ok(());
1641 }
1642
1643 while _next_ordinal_to_read < 5 {
1645 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1646 _next_ordinal_to_read += 1;
1647 next_offset += envelope_size;
1648 }
1649
1650 let next_out_of_line = decoder.next_out_of_line();
1651 let handles_before = decoder.remaining_handles();
1652 if let Some((inlined, num_bytes, num_handles)) =
1653 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1654 {
1655 let member_inline_size = <fidl::encoding::Endpoint<
1656 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1657 > as fidl::encoding::TypeMarker>::inline_size(
1658 decoder.context
1659 );
1660 if inlined != (member_inline_size <= 4) {
1661 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1662 }
1663 let inner_offset;
1664 let mut inner_depth = depth.clone();
1665 if inlined {
1666 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1667 inner_offset = next_offset;
1668 } else {
1669 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1670 inner_depth.increment()?;
1671 }
1672 let val_ref = self.driver_host_libs.get_or_insert_with(|| {
1673 fidl::new_empty!(
1674 fidl::encoding::Endpoint<
1675 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1676 >,
1677 fidl::encoding::DefaultFuchsiaResourceDialect
1678 )
1679 });
1680 fidl::decode!(
1681 fidl::encoding::Endpoint<
1682 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1683 >,
1684 fidl::encoding::DefaultFuchsiaResourceDialect,
1685 val_ref,
1686 decoder,
1687 inner_offset,
1688 inner_depth
1689 )?;
1690 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1691 {
1692 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1693 }
1694 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1695 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1696 }
1697 }
1698
1699 next_offset += envelope_size;
1700 _next_ordinal_to_read += 1;
1701 if next_offset >= end_offset {
1702 return Ok(());
1703 }
1704
1705 while _next_ordinal_to_read < 6 {
1707 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1708 _next_ordinal_to_read += 1;
1709 next_offset += envelope_size;
1710 }
1711
1712 let next_out_of_line = decoder.next_out_of_line();
1713 let handles_before = decoder.remaining_handles();
1714 if let Some((inlined, num_bytes, num_handles)) =
1715 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1716 {
1717 let member_inline_size = <fidl::encoding::Endpoint<
1718 fidl::endpoints::ServerEnd<DriverHostMarker>,
1719 > as fidl::encoding::TypeMarker>::inline_size(
1720 decoder.context
1721 );
1722 if inlined != (member_inline_size <= 4) {
1723 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1724 }
1725 let inner_offset;
1726 let mut inner_depth = depth.clone();
1727 if inlined {
1728 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1729 inner_offset = next_offset;
1730 } else {
1731 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1732 inner_depth.increment()?;
1733 }
1734 let val_ref = self.driver_host.get_or_insert_with(|| {
1735 fidl::new_empty!(
1736 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>>,
1737 fidl::encoding::DefaultFuchsiaResourceDialect
1738 )
1739 });
1740 fidl::decode!(
1741 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DriverHostMarker>>,
1742 fidl::encoding::DefaultFuchsiaResourceDialect,
1743 val_ref,
1744 decoder,
1745 inner_offset,
1746 inner_depth
1747 )?;
1748 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1749 {
1750 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1751 }
1752 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1753 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1754 }
1755 }
1756
1757 next_offset += envelope_size;
1758
1759 while next_offset < end_offset {
1761 _next_ordinal_to_read += 1;
1762 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1763 next_offset += envelope_size;
1764 }
1765
1766 Ok(())
1767 }
1768 }
1769
1770 impl DriverHostLoadDriverRequest {
1771 #[inline(always)]
1772 fn max_ordinal_present(&self) -> u64 {
1773 if let Some(_) = self.additional_root_modules {
1774 return 4;
1775 }
1776 if let Some(_) = self.driver_libs {
1777 return 3;
1778 }
1779 if let Some(_) = self.driver_binary {
1780 return 2;
1781 }
1782 if let Some(_) = self.driver_soname {
1783 return 1;
1784 }
1785 0
1786 }
1787 }
1788
1789 impl fidl::encoding::ResourceTypeMarker for DriverHostLoadDriverRequest {
1790 type Borrowed<'a> = &'a mut Self;
1791 fn take_or_borrow<'a>(
1792 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1793 ) -> Self::Borrowed<'a> {
1794 value
1795 }
1796 }
1797
1798 unsafe impl fidl::encoding::TypeMarker for DriverHostLoadDriverRequest {
1799 type Owned = Self;
1800
1801 #[inline(always)]
1802 fn inline_align(_context: fidl::encoding::Context) -> usize {
1803 8
1804 }
1805
1806 #[inline(always)]
1807 fn inline_size(_context: fidl::encoding::Context) -> usize {
1808 16
1809 }
1810 }
1811
1812 unsafe impl
1813 fidl::encoding::Encode<
1814 DriverHostLoadDriverRequest,
1815 fidl::encoding::DefaultFuchsiaResourceDialect,
1816 > for &mut DriverHostLoadDriverRequest
1817 {
1818 unsafe fn encode(
1819 self,
1820 encoder: &mut fidl::encoding::Encoder<
1821 '_,
1822 fidl::encoding::DefaultFuchsiaResourceDialect,
1823 >,
1824 offset: usize,
1825 mut depth: fidl::encoding::Depth,
1826 ) -> fidl::Result<()> {
1827 encoder.debug_check_bounds::<DriverHostLoadDriverRequest>(offset);
1828 let max_ordinal: u64 = self.max_ordinal_present();
1830 encoder.write_num(max_ordinal, offset);
1831 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1832 if max_ordinal == 0 {
1834 return Ok(());
1835 }
1836 depth.increment()?;
1837 let envelope_size = 8;
1838 let bytes_len = max_ordinal as usize * envelope_size;
1839 #[allow(unused_variables)]
1840 let offset = encoder.out_of_line_offset(bytes_len);
1841 let mut _prev_end_offset: usize = 0;
1842 if 1 > max_ordinal {
1843 return Ok(());
1844 }
1845
1846 let cur_offset: usize = (1 - 1) * envelope_size;
1849
1850 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1852
1853 fidl::encoding::encode_in_envelope_optional::<
1858 fidl::encoding::BoundedString<255>,
1859 fidl::encoding::DefaultFuchsiaResourceDialect,
1860 >(
1861 self.driver_soname.as_ref().map(
1862 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1863 ),
1864 encoder,
1865 offset + cur_offset,
1866 depth,
1867 )?;
1868
1869 _prev_end_offset = cur_offset + envelope_size;
1870 if 2 > max_ordinal {
1871 return Ok(());
1872 }
1873
1874 let cur_offset: usize = (2 - 1) * envelope_size;
1877
1878 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1880
1881 fidl::encoding::encode_in_envelope_optional::<
1886 fidl::encoding::HandleType<
1887 fidl::Vmo,
1888 { fidl::ObjectType::VMO.into_raw() },
1889 2147483648,
1890 >,
1891 fidl::encoding::DefaultFuchsiaResourceDialect,
1892 >(
1893 self.driver_binary.as_mut().map(
1894 <fidl::encoding::HandleType<
1895 fidl::Vmo,
1896 { fidl::ObjectType::VMO.into_raw() },
1897 2147483648,
1898 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1899 ),
1900 encoder,
1901 offset + cur_offset,
1902 depth,
1903 )?;
1904
1905 _prev_end_offset = cur_offset + envelope_size;
1906 if 3 > max_ordinal {
1907 return Ok(());
1908 }
1909
1910 let cur_offset: usize = (3 - 1) * envelope_size;
1913
1914 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1916
1917 fidl::encoding::encode_in_envelope_optional::<
1922 fidl::encoding::Endpoint<
1923 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1924 >,
1925 fidl::encoding::DefaultFuchsiaResourceDialect,
1926 >(
1927 self.driver_libs.as_mut().map(
1928 <fidl::encoding::Endpoint<
1929 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
1930 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1931 ),
1932 encoder,
1933 offset + cur_offset,
1934 depth,
1935 )?;
1936
1937 _prev_end_offset = cur_offset + envelope_size;
1938 if 4 > max_ordinal {
1939 return Ok(());
1940 }
1941
1942 let cur_offset: usize = (4 - 1) * envelope_size;
1945
1946 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1948
1949 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<RootModule>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1954 self.additional_root_modules.as_mut().map(<fidl::encoding::UnboundedVector<RootModule> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1955 encoder, offset + cur_offset, depth
1956 )?;
1957
1958 _prev_end_offset = cur_offset + envelope_size;
1959
1960 Ok(())
1961 }
1962 }
1963
1964 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1965 for DriverHostLoadDriverRequest
1966 {
1967 #[inline(always)]
1968 fn new_empty() -> Self {
1969 Self::default()
1970 }
1971
1972 unsafe fn decode(
1973 &mut self,
1974 decoder: &mut fidl::encoding::Decoder<
1975 '_,
1976 fidl::encoding::DefaultFuchsiaResourceDialect,
1977 >,
1978 offset: usize,
1979 mut depth: fidl::encoding::Depth,
1980 ) -> fidl::Result<()> {
1981 decoder.debug_check_bounds::<Self>(offset);
1982 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1983 None => return Err(fidl::Error::NotNullable),
1984 Some(len) => len,
1985 };
1986 if len == 0 {
1988 return Ok(());
1989 };
1990 depth.increment()?;
1991 let envelope_size = 8;
1992 let bytes_len = len * envelope_size;
1993 let offset = decoder.out_of_line_offset(bytes_len)?;
1994 let mut _next_ordinal_to_read = 0;
1996 let mut next_offset = offset;
1997 let end_offset = offset + bytes_len;
1998 _next_ordinal_to_read += 1;
1999 if next_offset >= end_offset {
2000 return Ok(());
2001 }
2002
2003 while _next_ordinal_to_read < 1 {
2005 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2006 _next_ordinal_to_read += 1;
2007 next_offset += envelope_size;
2008 }
2009
2010 let next_out_of_line = decoder.next_out_of_line();
2011 let handles_before = decoder.remaining_handles();
2012 if let Some((inlined, num_bytes, num_handles)) =
2013 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2014 {
2015 let member_inline_size =
2016 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2017 decoder.context,
2018 );
2019 if inlined != (member_inline_size <= 4) {
2020 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2021 }
2022 let inner_offset;
2023 let mut inner_depth = depth.clone();
2024 if inlined {
2025 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2026 inner_offset = next_offset;
2027 } else {
2028 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2029 inner_depth.increment()?;
2030 }
2031 let val_ref = self.driver_soname.get_or_insert_with(|| {
2032 fidl::new_empty!(
2033 fidl::encoding::BoundedString<255>,
2034 fidl::encoding::DefaultFuchsiaResourceDialect
2035 )
2036 });
2037 fidl::decode!(
2038 fidl::encoding::BoundedString<255>,
2039 fidl::encoding::DefaultFuchsiaResourceDialect,
2040 val_ref,
2041 decoder,
2042 inner_offset,
2043 inner_depth
2044 )?;
2045 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2046 {
2047 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2048 }
2049 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2050 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2051 }
2052 }
2053
2054 next_offset += envelope_size;
2055 _next_ordinal_to_read += 1;
2056 if next_offset >= end_offset {
2057 return Ok(());
2058 }
2059
2060 while _next_ordinal_to_read < 2 {
2062 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2063 _next_ordinal_to_read += 1;
2064 next_offset += envelope_size;
2065 }
2066
2067 let next_out_of_line = decoder.next_out_of_line();
2068 let handles_before = decoder.remaining_handles();
2069 if let Some((inlined, num_bytes, num_handles)) =
2070 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2071 {
2072 let member_inline_size = <fidl::encoding::HandleType<
2073 fidl::Vmo,
2074 { fidl::ObjectType::VMO.into_raw() },
2075 2147483648,
2076 > as fidl::encoding::TypeMarker>::inline_size(
2077 decoder.context
2078 );
2079 if inlined != (member_inline_size <= 4) {
2080 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2081 }
2082 let inner_offset;
2083 let mut inner_depth = depth.clone();
2084 if inlined {
2085 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2086 inner_offset = next_offset;
2087 } else {
2088 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2089 inner_depth.increment()?;
2090 }
2091 let val_ref =
2092 self.driver_binary.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2093 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2094 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2095 {
2096 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2097 }
2098 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2099 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2100 }
2101 }
2102
2103 next_offset += envelope_size;
2104 _next_ordinal_to_read += 1;
2105 if next_offset >= end_offset {
2106 return Ok(());
2107 }
2108
2109 while _next_ordinal_to_read < 3 {
2111 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2112 _next_ordinal_to_read += 1;
2113 next_offset += envelope_size;
2114 }
2115
2116 let next_out_of_line = decoder.next_out_of_line();
2117 let handles_before = decoder.remaining_handles();
2118 if let Some((inlined, num_bytes, num_handles)) =
2119 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2120 {
2121 let member_inline_size = <fidl::encoding::Endpoint<
2122 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2123 > as fidl::encoding::TypeMarker>::inline_size(
2124 decoder.context
2125 );
2126 if inlined != (member_inline_size <= 4) {
2127 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2128 }
2129 let inner_offset;
2130 let mut inner_depth = depth.clone();
2131 if inlined {
2132 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2133 inner_offset = next_offset;
2134 } else {
2135 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2136 inner_depth.increment()?;
2137 }
2138 let val_ref = self.driver_libs.get_or_insert_with(|| {
2139 fidl::new_empty!(
2140 fidl::encoding::Endpoint<
2141 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2142 >,
2143 fidl::encoding::DefaultFuchsiaResourceDialect
2144 )
2145 });
2146 fidl::decode!(
2147 fidl::encoding::Endpoint<
2148 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2149 >,
2150 fidl::encoding::DefaultFuchsiaResourceDialect,
2151 val_ref,
2152 decoder,
2153 inner_offset,
2154 inner_depth
2155 )?;
2156 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2157 {
2158 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2159 }
2160 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2161 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2162 }
2163 }
2164
2165 next_offset += envelope_size;
2166 _next_ordinal_to_read += 1;
2167 if next_offset >= end_offset {
2168 return Ok(());
2169 }
2170
2171 while _next_ordinal_to_read < 4 {
2173 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2174 _next_ordinal_to_read += 1;
2175 next_offset += envelope_size;
2176 }
2177
2178 let next_out_of_line = decoder.next_out_of_line();
2179 let handles_before = decoder.remaining_handles();
2180 if let Some((inlined, num_bytes, num_handles)) =
2181 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2182 {
2183 let member_inline_size = <fidl::encoding::UnboundedVector<RootModule> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2184 if inlined != (member_inline_size <= 4) {
2185 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2186 }
2187 let inner_offset;
2188 let mut inner_depth = depth.clone();
2189 if inlined {
2190 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2191 inner_offset = next_offset;
2192 } else {
2193 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2194 inner_depth.increment()?;
2195 }
2196 let val_ref = self.additional_root_modules.get_or_insert_with(|| {
2197 fidl::new_empty!(
2198 fidl::encoding::UnboundedVector<RootModule>,
2199 fidl::encoding::DefaultFuchsiaResourceDialect
2200 )
2201 });
2202 fidl::decode!(
2203 fidl::encoding::UnboundedVector<RootModule>,
2204 fidl::encoding::DefaultFuchsiaResourceDialect,
2205 val_ref,
2206 decoder,
2207 inner_offset,
2208 inner_depth
2209 )?;
2210 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2211 {
2212 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2213 }
2214 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2215 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2216 }
2217 }
2218
2219 next_offset += envelope_size;
2220
2221 while next_offset < end_offset {
2223 _next_ordinal_to_read += 1;
2224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2225 next_offset += envelope_size;
2226 }
2227
2228 Ok(())
2229 }
2230 }
2231
2232 impl RootModule {
2233 #[inline(always)]
2234 fn max_ordinal_present(&self) -> u64 {
2235 if let Some(_) = self.binary {
2236 return 2;
2237 }
2238 if let Some(_) = self.name {
2239 return 1;
2240 }
2241 0
2242 }
2243 }
2244
2245 impl fidl::encoding::ResourceTypeMarker for RootModule {
2246 type Borrowed<'a> = &'a mut Self;
2247 fn take_or_borrow<'a>(
2248 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2249 ) -> Self::Borrowed<'a> {
2250 value
2251 }
2252 }
2253
2254 unsafe impl fidl::encoding::TypeMarker for RootModule {
2255 type Owned = Self;
2256
2257 #[inline(always)]
2258 fn inline_align(_context: fidl::encoding::Context) -> usize {
2259 8
2260 }
2261
2262 #[inline(always)]
2263 fn inline_size(_context: fidl::encoding::Context) -> usize {
2264 16
2265 }
2266 }
2267
2268 unsafe impl fidl::encoding::Encode<RootModule, fidl::encoding::DefaultFuchsiaResourceDialect>
2269 for &mut RootModule
2270 {
2271 unsafe fn encode(
2272 self,
2273 encoder: &mut fidl::encoding::Encoder<
2274 '_,
2275 fidl::encoding::DefaultFuchsiaResourceDialect,
2276 >,
2277 offset: usize,
2278 mut depth: fidl::encoding::Depth,
2279 ) -> fidl::Result<()> {
2280 encoder.debug_check_bounds::<RootModule>(offset);
2281 let max_ordinal: u64 = self.max_ordinal_present();
2283 encoder.write_num(max_ordinal, offset);
2284 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2285 if max_ordinal == 0 {
2287 return Ok(());
2288 }
2289 depth.increment()?;
2290 let envelope_size = 8;
2291 let bytes_len = max_ordinal as usize * envelope_size;
2292 #[allow(unused_variables)]
2293 let offset = encoder.out_of_line_offset(bytes_len);
2294 let mut _prev_end_offset: usize = 0;
2295 if 1 > max_ordinal {
2296 return Ok(());
2297 }
2298
2299 let cur_offset: usize = (1 - 1) * envelope_size;
2302
2303 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2305
2306 fidl::encoding::encode_in_envelope_optional::<
2311 fidl::encoding::BoundedString<255>,
2312 fidl::encoding::DefaultFuchsiaResourceDialect,
2313 >(
2314 self.name.as_ref().map(
2315 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
2316 ),
2317 encoder,
2318 offset + cur_offset,
2319 depth,
2320 )?;
2321
2322 _prev_end_offset = cur_offset + envelope_size;
2323 if 2 > max_ordinal {
2324 return Ok(());
2325 }
2326
2327 let cur_offset: usize = (2 - 1) * envelope_size;
2330
2331 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2333
2334 fidl::encoding::encode_in_envelope_optional::<
2339 fidl::encoding::HandleType<
2340 fidl::Vmo,
2341 { fidl::ObjectType::VMO.into_raw() },
2342 2147483648,
2343 >,
2344 fidl::encoding::DefaultFuchsiaResourceDialect,
2345 >(
2346 self.binary.as_mut().map(
2347 <fidl::encoding::HandleType<
2348 fidl::Vmo,
2349 { fidl::ObjectType::VMO.into_raw() },
2350 2147483648,
2351 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2352 ),
2353 encoder,
2354 offset + cur_offset,
2355 depth,
2356 )?;
2357
2358 _prev_end_offset = cur_offset + envelope_size;
2359
2360 Ok(())
2361 }
2362 }
2363
2364 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RootModule {
2365 #[inline(always)]
2366 fn new_empty() -> Self {
2367 Self::default()
2368 }
2369
2370 unsafe fn decode(
2371 &mut self,
2372 decoder: &mut fidl::encoding::Decoder<
2373 '_,
2374 fidl::encoding::DefaultFuchsiaResourceDialect,
2375 >,
2376 offset: usize,
2377 mut depth: fidl::encoding::Depth,
2378 ) -> fidl::Result<()> {
2379 decoder.debug_check_bounds::<Self>(offset);
2380 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2381 None => return Err(fidl::Error::NotNullable),
2382 Some(len) => len,
2383 };
2384 if len == 0 {
2386 return Ok(());
2387 };
2388 depth.increment()?;
2389 let envelope_size = 8;
2390 let bytes_len = len * envelope_size;
2391 let offset = decoder.out_of_line_offset(bytes_len)?;
2392 let mut _next_ordinal_to_read = 0;
2394 let mut next_offset = offset;
2395 let end_offset = offset + bytes_len;
2396 _next_ordinal_to_read += 1;
2397 if next_offset >= end_offset {
2398 return Ok(());
2399 }
2400
2401 while _next_ordinal_to_read < 1 {
2403 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2404 _next_ordinal_to_read += 1;
2405 next_offset += envelope_size;
2406 }
2407
2408 let next_out_of_line = decoder.next_out_of_line();
2409 let handles_before = decoder.remaining_handles();
2410 if let Some((inlined, num_bytes, num_handles)) =
2411 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2412 {
2413 let member_inline_size =
2414 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2415 decoder.context,
2416 );
2417 if inlined != (member_inline_size <= 4) {
2418 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2419 }
2420 let inner_offset;
2421 let mut inner_depth = depth.clone();
2422 if inlined {
2423 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2424 inner_offset = next_offset;
2425 } else {
2426 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2427 inner_depth.increment()?;
2428 }
2429 let val_ref = self.name.get_or_insert_with(|| {
2430 fidl::new_empty!(
2431 fidl::encoding::BoundedString<255>,
2432 fidl::encoding::DefaultFuchsiaResourceDialect
2433 )
2434 });
2435 fidl::decode!(
2436 fidl::encoding::BoundedString<255>,
2437 fidl::encoding::DefaultFuchsiaResourceDialect,
2438 val_ref,
2439 decoder,
2440 inner_offset,
2441 inner_depth
2442 )?;
2443 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2444 {
2445 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2446 }
2447 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2448 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2449 }
2450 }
2451
2452 next_offset += envelope_size;
2453 _next_ordinal_to_read += 1;
2454 if next_offset >= end_offset {
2455 return Ok(());
2456 }
2457
2458 while _next_ordinal_to_read < 2 {
2460 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2461 _next_ordinal_to_read += 1;
2462 next_offset += envelope_size;
2463 }
2464
2465 let next_out_of_line = decoder.next_out_of_line();
2466 let handles_before = decoder.remaining_handles();
2467 if let Some((inlined, num_bytes, num_handles)) =
2468 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2469 {
2470 let member_inline_size = <fidl::encoding::HandleType<
2471 fidl::Vmo,
2472 { fidl::ObjectType::VMO.into_raw() },
2473 2147483648,
2474 > as fidl::encoding::TypeMarker>::inline_size(
2475 decoder.context
2476 );
2477 if inlined != (member_inline_size <= 4) {
2478 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2479 }
2480 let inner_offset;
2481 let mut inner_depth = depth.clone();
2482 if inlined {
2483 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2484 inner_offset = next_offset;
2485 } else {
2486 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2487 inner_depth.increment()?;
2488 }
2489 let val_ref =
2490 self.binary.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2491 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2492 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2493 {
2494 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2495 }
2496 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2497 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2498 }
2499 }
2500
2501 next_offset += envelope_size;
2502
2503 while next_offset < end_offset {
2505 _next_ordinal_to_read += 1;
2506 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2507 next_offset += envelope_size;
2508 }
2509
2510 Ok(())
2511 }
2512 }
2513}