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