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