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_test_wlan_realm__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RealmFactoryCreateRealm2Request {
16 pub options: RealmOptions,
17 pub dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for RealmFactoryCreateRealm2Request
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct RealmFactoryCreateRealmRequest {
27 pub options: RealmOptions,
28 pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for RealmFactoryCreateRealmRequest
33{
34}
35
36#[derive(Debug, Default, PartialEq)]
38pub struct DriverConfig {
39 pub dev_topological: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
42 pub dev_class: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
43 pub driver_test_realm_start_args: Option<fidl_fuchsia_driver_test::RealmArgs>,
46 #[doc(hidden)]
47 pub __source_breaking: fidl::marker::SourceBreaking,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverConfig {}
51
52#[derive(Debug, Default, PartialEq)]
53pub struct DriversOnly {
54 pub driver_config: Option<DriverConfig>,
55 #[doc(hidden)]
56 pub __source_breaking: fidl::marker::SourceBreaking,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriversOnly {}
60
61#[derive(Debug, Default, PartialEq)]
63pub struct RealmOptions {
64 pub devfs_server_end: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
65 pub wlan_config: Option<WlanConfig>,
66 pub topology: Option<Topology>,
71 #[doc(hidden)]
72 pub __source_breaking: fidl::marker::SourceBreaking,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
76
77#[derive(Debug, Default, PartialEq)]
79pub struct WlanConfig {
80 pub use_legacy_privacy: Option<bool>,
83 pub with_regulatory_region: Option<bool>,
86 pub name: Option<String>,
91 pub trace_manager_hermeticity: Option<TraceManagerHermeticity>,
97 #[doc(hidden)]
98 pub __source_breaking: fidl::marker::SourceBreaking,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanConfig {}
102
103#[derive(Debug)]
107pub enum Topology {
108 DriversOnly(DriversOnly),
113 #[doc(hidden)]
114 __SourceBreaking { unknown_ordinal: u64 },
115}
116
117#[macro_export]
119macro_rules! TopologyUnknown {
120 () => {
121 _
122 };
123}
124
125impl PartialEq for Topology {
127 fn eq(&self, other: &Self) -> bool {
128 match (self, other) {
129 (Self::DriversOnly(x), Self::DriversOnly(y)) => *x == *y,
130 _ => false,
131 }
132 }
133}
134
135impl Topology {
136 #[inline]
137 pub fn ordinal(&self) -> u64 {
138 match *self {
139 Self::DriversOnly(_) => 1,
140 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
141 }
142 }
143
144 #[inline]
145 pub fn unknown_variant_for_testing() -> Self {
146 Self::__SourceBreaking { unknown_ordinal: 0 }
147 }
148
149 #[inline]
150 pub fn is_unknown(&self) -> bool {
151 match self {
152 Self::__SourceBreaking { .. } => true,
153 _ => false,
154 }
155 }
156}
157
158impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Topology {}
159
160#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
161pub struct RealmFactoryMarker;
162
163impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
164 type Proxy = RealmFactoryProxy;
165 type RequestStream = RealmFactoryRequestStream;
166 #[cfg(target_os = "fuchsia")]
167 type SynchronousProxy = RealmFactorySynchronousProxy;
168
169 const DEBUG_NAME: &'static str = "test.wlan.realm.RealmFactory";
170}
171impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
172pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
173pub type RealmFactoryCreateRealm2Result = Result<(), fidl_fuchsia_testing_harness::OperationError>;
174
175pub trait RealmFactoryProxyInterface: Send + Sync {
176 type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
177 + Send;
178 fn r#create_realm(
179 &self,
180 options: RealmOptions,
181 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
182 ) -> Self::CreateRealmResponseFut;
183 type CreateRealm2ResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealm2Result, fidl::Error>>
184 + Send;
185 fn r#create_realm2(
186 &self,
187 options: RealmOptions,
188 dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
189 ) -> Self::CreateRealm2ResponseFut;
190}
191#[derive(Debug)]
192#[cfg(target_os = "fuchsia")]
193pub struct RealmFactorySynchronousProxy {
194 client: fidl::client::sync::Client,
195}
196
197#[cfg(target_os = "fuchsia")]
198impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
199 type Proxy = RealmFactoryProxy;
200 type Protocol = RealmFactoryMarker;
201
202 fn from_channel(inner: fidl::Channel) -> Self {
203 Self::new(inner)
204 }
205
206 fn into_channel(self) -> fidl::Channel {
207 self.client.into_channel()
208 }
209
210 fn as_channel(&self) -> &fidl::Channel {
211 self.client.as_channel()
212 }
213}
214
215#[cfg(target_os = "fuchsia")]
216impl RealmFactorySynchronousProxy {
217 pub fn new(channel: fidl::Channel) -> Self {
218 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
219 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
220 }
221
222 pub fn into_channel(self) -> fidl::Channel {
223 self.client.into_channel()
224 }
225
226 pub fn wait_for_event(
229 &self,
230 deadline: zx::MonotonicInstant,
231 ) -> Result<RealmFactoryEvent, fidl::Error> {
232 RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
233 }
234
235 pub fn r#create_realm(
237 &self,
238 mut options: RealmOptions,
239 mut realm_server: fidl::endpoints::ServerEnd<
240 fidl_fuchsia_testing_harness::RealmProxy_Marker,
241 >,
242 ___deadline: zx::MonotonicInstant,
243 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
244 let _response = self
245 .client
246 .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
247 fidl::encoding::EmptyStruct,
248 fidl_fuchsia_testing_harness::OperationError,
249 >>(
250 (&mut options, realm_server),
251 0x51aac08d328c3ae4,
252 fidl::encoding::DynamicFlags::FLEXIBLE,
253 ___deadline,
254 )?
255 .into_result::<RealmFactoryMarker>("create_realm")?;
256 Ok(_response.map(|x| x))
257 }
258
259 pub fn r#create_realm2(
261 &self,
262 mut options: RealmOptions,
263 mut dictionary: fidl::endpoints::ServerEnd<
264 fidl_fuchsia_component_sandbox::DictionaryMarker,
265 >,
266 ___deadline: zx::MonotonicInstant,
267 ) -> Result<RealmFactoryCreateRealm2Result, fidl::Error> {
268 let _response = self
269 .client
270 .send_query::<RealmFactoryCreateRealm2Request, fidl::encoding::FlexibleResultType<
271 fidl::encoding::EmptyStruct,
272 fidl_fuchsia_testing_harness::OperationError,
273 >>(
274 (&mut options, dictionary),
275 0x29dd599835927548,
276 fidl::encoding::DynamicFlags::FLEXIBLE,
277 ___deadline,
278 )?
279 .into_result::<RealmFactoryMarker>("create_realm2")?;
280 Ok(_response.map(|x| x))
281 }
282}
283
284#[cfg(target_os = "fuchsia")]
285impl From<RealmFactorySynchronousProxy> for zx::Handle {
286 fn from(value: RealmFactorySynchronousProxy) -> Self {
287 value.into_channel().into()
288 }
289}
290
291#[cfg(target_os = "fuchsia")]
292impl From<fidl::Channel> for RealmFactorySynchronousProxy {
293 fn from(value: fidl::Channel) -> Self {
294 Self::new(value)
295 }
296}
297
298#[cfg(target_os = "fuchsia")]
299impl fidl::endpoints::FromClient for RealmFactorySynchronousProxy {
300 type Protocol = RealmFactoryMarker;
301
302 fn from_client(value: fidl::endpoints::ClientEnd<RealmFactoryMarker>) -> Self {
303 Self::new(value.into_channel())
304 }
305}
306
307#[derive(Debug, Clone)]
308pub struct RealmFactoryProxy {
309 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
310}
311
312impl fidl::endpoints::Proxy for RealmFactoryProxy {
313 type Protocol = RealmFactoryMarker;
314
315 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
316 Self::new(inner)
317 }
318
319 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
320 self.client.into_channel().map_err(|client| Self { client })
321 }
322
323 fn as_channel(&self) -> &::fidl::AsyncChannel {
324 self.client.as_channel()
325 }
326}
327
328impl RealmFactoryProxy {
329 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
331 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
332 Self { client: fidl::client::Client::new(channel, protocol_name) }
333 }
334
335 pub fn take_event_stream(&self) -> RealmFactoryEventStream {
341 RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
342 }
343
344 pub fn r#create_realm(
346 &self,
347 mut options: RealmOptions,
348 mut realm_server: fidl::endpoints::ServerEnd<
349 fidl_fuchsia_testing_harness::RealmProxy_Marker,
350 >,
351 ) -> fidl::client::QueryResponseFut<
352 RealmFactoryCreateRealmResult,
353 fidl::encoding::DefaultFuchsiaResourceDialect,
354 > {
355 RealmFactoryProxyInterface::r#create_realm(self, options, realm_server)
356 }
357
358 pub fn r#create_realm2(
360 &self,
361 mut options: RealmOptions,
362 mut dictionary: fidl::endpoints::ServerEnd<
363 fidl_fuchsia_component_sandbox::DictionaryMarker,
364 >,
365 ) -> fidl::client::QueryResponseFut<
366 RealmFactoryCreateRealm2Result,
367 fidl::encoding::DefaultFuchsiaResourceDialect,
368 > {
369 RealmFactoryProxyInterface::r#create_realm2(self, options, dictionary)
370 }
371}
372
373impl RealmFactoryProxyInterface for RealmFactoryProxy {
374 type CreateRealmResponseFut = fidl::client::QueryResponseFut<
375 RealmFactoryCreateRealmResult,
376 fidl::encoding::DefaultFuchsiaResourceDialect,
377 >;
378 fn r#create_realm(
379 &self,
380 mut options: RealmOptions,
381 mut realm_server: fidl::endpoints::ServerEnd<
382 fidl_fuchsia_testing_harness::RealmProxy_Marker,
383 >,
384 ) -> Self::CreateRealmResponseFut {
385 fn _decode(
386 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
387 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
388 let _response = fidl::client::decode_transaction_body::<
389 fidl::encoding::FlexibleResultType<
390 fidl::encoding::EmptyStruct,
391 fidl_fuchsia_testing_harness::OperationError,
392 >,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 0x51aac08d328c3ae4,
395 >(_buf?)?
396 .into_result::<RealmFactoryMarker>("create_realm")?;
397 Ok(_response.map(|x| x))
398 }
399 self.client
400 .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
401 (&mut options, realm_server),
402 0x51aac08d328c3ae4,
403 fidl::encoding::DynamicFlags::FLEXIBLE,
404 _decode,
405 )
406 }
407
408 type CreateRealm2ResponseFut = fidl::client::QueryResponseFut<
409 RealmFactoryCreateRealm2Result,
410 fidl::encoding::DefaultFuchsiaResourceDialect,
411 >;
412 fn r#create_realm2(
413 &self,
414 mut options: RealmOptions,
415 mut dictionary: fidl::endpoints::ServerEnd<
416 fidl_fuchsia_component_sandbox::DictionaryMarker,
417 >,
418 ) -> Self::CreateRealm2ResponseFut {
419 fn _decode(
420 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
421 ) -> Result<RealmFactoryCreateRealm2Result, fidl::Error> {
422 let _response = fidl::client::decode_transaction_body::<
423 fidl::encoding::FlexibleResultType<
424 fidl::encoding::EmptyStruct,
425 fidl_fuchsia_testing_harness::OperationError,
426 >,
427 fidl::encoding::DefaultFuchsiaResourceDialect,
428 0x29dd599835927548,
429 >(_buf?)?
430 .into_result::<RealmFactoryMarker>("create_realm2")?;
431 Ok(_response.map(|x| x))
432 }
433 self.client.send_query_and_decode::<
434 RealmFactoryCreateRealm2Request,
435 RealmFactoryCreateRealm2Result,
436 >(
437 (&mut options, dictionary,),
438 0x29dd599835927548,
439 fidl::encoding::DynamicFlags::FLEXIBLE,
440 _decode,
441 )
442 }
443}
444
445pub struct RealmFactoryEventStream {
446 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
447}
448
449impl std::marker::Unpin for RealmFactoryEventStream {}
450
451impl futures::stream::FusedStream for RealmFactoryEventStream {
452 fn is_terminated(&self) -> bool {
453 self.event_receiver.is_terminated()
454 }
455}
456
457impl futures::Stream for RealmFactoryEventStream {
458 type Item = Result<RealmFactoryEvent, fidl::Error>;
459
460 fn poll_next(
461 mut self: std::pin::Pin<&mut Self>,
462 cx: &mut std::task::Context<'_>,
463 ) -> std::task::Poll<Option<Self::Item>> {
464 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
465 &mut self.event_receiver,
466 cx
467 )?) {
468 Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
469 None => std::task::Poll::Ready(None),
470 }
471 }
472}
473
474#[derive(Debug)]
475pub enum RealmFactoryEvent {
476 #[non_exhaustive]
477 _UnknownEvent {
478 ordinal: u64,
480 },
481}
482
483impl RealmFactoryEvent {
484 fn decode(
486 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
487 ) -> Result<RealmFactoryEvent, fidl::Error> {
488 let (bytes, _handles) = buf.split_mut();
489 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
490 debug_assert_eq!(tx_header.tx_id, 0);
491 match tx_header.ordinal {
492 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
493 Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
494 }
495 _ => Err(fidl::Error::UnknownOrdinal {
496 ordinal: tx_header.ordinal,
497 protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
498 }),
499 }
500 }
501}
502
503pub struct RealmFactoryRequestStream {
505 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
506 is_terminated: bool,
507}
508
509impl std::marker::Unpin for RealmFactoryRequestStream {}
510
511impl futures::stream::FusedStream for RealmFactoryRequestStream {
512 fn is_terminated(&self) -> bool {
513 self.is_terminated
514 }
515}
516
517impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
518 type Protocol = RealmFactoryMarker;
519 type ControlHandle = RealmFactoryControlHandle;
520
521 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
522 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
523 }
524
525 fn control_handle(&self) -> Self::ControlHandle {
526 RealmFactoryControlHandle { inner: self.inner.clone() }
527 }
528
529 fn into_inner(
530 self,
531 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
532 {
533 (self.inner, self.is_terminated)
534 }
535
536 fn from_inner(
537 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
538 is_terminated: bool,
539 ) -> Self {
540 Self { inner, is_terminated }
541 }
542}
543
544impl futures::Stream for RealmFactoryRequestStream {
545 type Item = Result<RealmFactoryRequest, fidl::Error>;
546
547 fn poll_next(
548 mut self: std::pin::Pin<&mut Self>,
549 cx: &mut std::task::Context<'_>,
550 ) -> std::task::Poll<Option<Self::Item>> {
551 let this = &mut *self;
552 if this.inner.check_shutdown(cx) {
553 this.is_terminated = true;
554 return std::task::Poll::Ready(None);
555 }
556 if this.is_terminated {
557 panic!("polled RealmFactoryRequestStream after completion");
558 }
559 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
560 |bytes, handles| {
561 match this.inner.channel().read_etc(cx, bytes, handles) {
562 std::task::Poll::Ready(Ok(())) => {}
563 std::task::Poll::Pending => return std::task::Poll::Pending,
564 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
565 this.is_terminated = true;
566 return std::task::Poll::Ready(None);
567 }
568 std::task::Poll::Ready(Err(e)) => {
569 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
570 e.into(),
571 ))));
572 }
573 }
574
575 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
577
578 std::task::Poll::Ready(Some(match header.ordinal {
579 0x51aac08d328c3ae4 => {
580 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
581 let mut req = fidl::new_empty!(
582 RealmFactoryCreateRealmRequest,
583 fidl::encoding::DefaultFuchsiaResourceDialect
584 );
585 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
586 let control_handle =
587 RealmFactoryControlHandle { inner: this.inner.clone() };
588 Ok(RealmFactoryRequest::CreateRealm {
589 options: req.options,
590 realm_server: req.realm_server,
591
592 responder: RealmFactoryCreateRealmResponder {
593 control_handle: std::mem::ManuallyDrop::new(control_handle),
594 tx_id: header.tx_id,
595 },
596 })
597 }
598 0x29dd599835927548 => {
599 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
600 let mut req = fidl::new_empty!(
601 RealmFactoryCreateRealm2Request,
602 fidl::encoding::DefaultFuchsiaResourceDialect
603 );
604 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealm2Request>(&header, _body_bytes, handles, &mut req)?;
605 let control_handle =
606 RealmFactoryControlHandle { inner: this.inner.clone() };
607 Ok(RealmFactoryRequest::CreateRealm2 {
608 options: req.options,
609 dictionary: req.dictionary,
610
611 responder: RealmFactoryCreateRealm2Responder {
612 control_handle: std::mem::ManuallyDrop::new(control_handle),
613 tx_id: header.tx_id,
614 },
615 })
616 }
617 _ if header.tx_id == 0
618 && header
619 .dynamic_flags()
620 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
621 {
622 Ok(RealmFactoryRequest::_UnknownMethod {
623 ordinal: header.ordinal,
624 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
625 method_type: fidl::MethodType::OneWay,
626 })
627 }
628 _ if header
629 .dynamic_flags()
630 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
631 {
632 this.inner.send_framework_err(
633 fidl::encoding::FrameworkErr::UnknownMethod,
634 header.tx_id,
635 header.ordinal,
636 header.dynamic_flags(),
637 (bytes, handles),
638 )?;
639 Ok(RealmFactoryRequest::_UnknownMethod {
640 ordinal: header.ordinal,
641 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
642 method_type: fidl::MethodType::TwoWay,
643 })
644 }
645 _ => Err(fidl::Error::UnknownOrdinal {
646 ordinal: header.ordinal,
647 protocol_name:
648 <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
649 }),
650 }))
651 },
652 )
653 }
654}
655
656#[derive(Debug)]
657pub enum RealmFactoryRequest {
658 CreateRealm {
660 options: RealmOptions,
661 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
662 responder: RealmFactoryCreateRealmResponder,
663 },
664 CreateRealm2 {
666 options: RealmOptions,
667 dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
668 responder: RealmFactoryCreateRealm2Responder,
669 },
670 #[non_exhaustive]
672 _UnknownMethod {
673 ordinal: u64,
675 control_handle: RealmFactoryControlHandle,
676 method_type: fidl::MethodType,
677 },
678}
679
680impl RealmFactoryRequest {
681 #[allow(irrefutable_let_patterns)]
682 pub fn into_create_realm(
683 self,
684 ) -> Option<(
685 RealmOptions,
686 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
687 RealmFactoryCreateRealmResponder,
688 )> {
689 if let RealmFactoryRequest::CreateRealm { options, realm_server, responder } = self {
690 Some((options, realm_server, responder))
691 } else {
692 None
693 }
694 }
695
696 #[allow(irrefutable_let_patterns)]
697 pub fn into_create_realm2(
698 self,
699 ) -> Option<(
700 RealmOptions,
701 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
702 RealmFactoryCreateRealm2Responder,
703 )> {
704 if let RealmFactoryRequest::CreateRealm2 { options, dictionary, responder } = self {
705 Some((options, dictionary, responder))
706 } else {
707 None
708 }
709 }
710
711 pub fn method_name(&self) -> &'static str {
713 match *self {
714 RealmFactoryRequest::CreateRealm { .. } => "create_realm",
715 RealmFactoryRequest::CreateRealm2 { .. } => "create_realm2",
716 RealmFactoryRequest::_UnknownMethod {
717 method_type: fidl::MethodType::OneWay, ..
718 } => "unknown one-way method",
719 RealmFactoryRequest::_UnknownMethod {
720 method_type: fidl::MethodType::TwoWay, ..
721 } => "unknown two-way method",
722 }
723 }
724}
725
726#[derive(Debug, Clone)]
727pub struct RealmFactoryControlHandle {
728 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
729}
730
731impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
732 fn shutdown(&self) {
733 self.inner.shutdown()
734 }
735 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
736 self.inner.shutdown_with_epitaph(status)
737 }
738
739 fn is_closed(&self) -> bool {
740 self.inner.channel().is_closed()
741 }
742 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
743 self.inner.channel().on_closed()
744 }
745
746 #[cfg(target_os = "fuchsia")]
747 fn signal_peer(
748 &self,
749 clear_mask: zx::Signals,
750 set_mask: zx::Signals,
751 ) -> Result<(), zx_status::Status> {
752 use fidl::Peered;
753 self.inner.channel().signal_peer(clear_mask, set_mask)
754 }
755}
756
757impl RealmFactoryControlHandle {}
758
759#[must_use = "FIDL methods require a response to be sent"]
760#[derive(Debug)]
761pub struct RealmFactoryCreateRealmResponder {
762 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
763 tx_id: u32,
764}
765
766impl std::ops::Drop for RealmFactoryCreateRealmResponder {
770 fn drop(&mut self) {
771 self.control_handle.shutdown();
772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
774 }
775}
776
777impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
778 type ControlHandle = RealmFactoryControlHandle;
779
780 fn control_handle(&self) -> &RealmFactoryControlHandle {
781 &self.control_handle
782 }
783
784 fn drop_without_shutdown(mut self) {
785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
787 std::mem::forget(self);
789 }
790}
791
792impl RealmFactoryCreateRealmResponder {
793 pub fn send(
797 self,
798 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
799 ) -> Result<(), fidl::Error> {
800 let _result = self.send_raw(result);
801 if _result.is_err() {
802 self.control_handle.shutdown();
803 }
804 self.drop_without_shutdown();
805 _result
806 }
807
808 pub fn send_no_shutdown_on_err(
810 self,
811 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
812 ) -> Result<(), fidl::Error> {
813 let _result = self.send_raw(result);
814 self.drop_without_shutdown();
815 _result
816 }
817
818 fn send_raw(
819 &self,
820 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
821 ) -> Result<(), fidl::Error> {
822 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
823 fidl::encoding::EmptyStruct,
824 fidl_fuchsia_testing_harness::OperationError,
825 >>(
826 fidl::encoding::FlexibleResult::new(result),
827 self.tx_id,
828 0x51aac08d328c3ae4,
829 fidl::encoding::DynamicFlags::FLEXIBLE,
830 )
831 }
832}
833
834#[must_use = "FIDL methods require a response to be sent"]
835#[derive(Debug)]
836pub struct RealmFactoryCreateRealm2Responder {
837 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
838 tx_id: u32,
839}
840
841impl std::ops::Drop for RealmFactoryCreateRealm2Responder {
845 fn drop(&mut self) {
846 self.control_handle.shutdown();
847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
849 }
850}
851
852impl fidl::endpoints::Responder for RealmFactoryCreateRealm2Responder {
853 type ControlHandle = RealmFactoryControlHandle;
854
855 fn control_handle(&self) -> &RealmFactoryControlHandle {
856 &self.control_handle
857 }
858
859 fn drop_without_shutdown(mut self) {
860 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
862 std::mem::forget(self);
864 }
865}
866
867impl RealmFactoryCreateRealm2Responder {
868 pub fn send(
872 self,
873 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
874 ) -> Result<(), fidl::Error> {
875 let _result = self.send_raw(result);
876 if _result.is_err() {
877 self.control_handle.shutdown();
878 }
879 self.drop_without_shutdown();
880 _result
881 }
882
883 pub fn send_no_shutdown_on_err(
885 self,
886 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
887 ) -> Result<(), fidl::Error> {
888 let _result = self.send_raw(result);
889 self.drop_without_shutdown();
890 _result
891 }
892
893 fn send_raw(
894 &self,
895 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
896 ) -> Result<(), fidl::Error> {
897 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
898 fidl::encoding::EmptyStruct,
899 fidl_fuchsia_testing_harness::OperationError,
900 >>(
901 fidl::encoding::FlexibleResult::new(result),
902 self.tx_id,
903 0x29dd599835927548,
904 fidl::encoding::DynamicFlags::FLEXIBLE,
905 )
906 }
907}
908
909mod internal {
910 use super::*;
911
912 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealm2Request {
913 type Borrowed<'a> = &'a mut Self;
914 fn take_or_borrow<'a>(
915 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
916 ) -> Self::Borrowed<'a> {
917 value
918 }
919 }
920
921 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealm2Request {
922 type Owned = Self;
923
924 #[inline(always)]
925 fn inline_align(_context: fidl::encoding::Context) -> usize {
926 8
927 }
928
929 #[inline(always)]
930 fn inline_size(_context: fidl::encoding::Context) -> usize {
931 24
932 }
933 }
934
935 unsafe impl
936 fidl::encoding::Encode<
937 RealmFactoryCreateRealm2Request,
938 fidl::encoding::DefaultFuchsiaResourceDialect,
939 > for &mut RealmFactoryCreateRealm2Request
940 {
941 #[inline]
942 unsafe fn encode(
943 self,
944 encoder: &mut fidl::encoding::Encoder<
945 '_,
946 fidl::encoding::DefaultFuchsiaResourceDialect,
947 >,
948 offset: usize,
949 _depth: fidl::encoding::Depth,
950 ) -> fidl::Result<()> {
951 encoder.debug_check_bounds::<RealmFactoryCreateRealm2Request>(offset);
952 fidl::encoding::Encode::<
954 RealmFactoryCreateRealm2Request,
955 fidl::encoding::DefaultFuchsiaResourceDialect,
956 >::encode(
957 (
958 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
959 &mut self.options,
960 ),
961 <fidl::encoding::Endpoint<
962 fidl::endpoints::ServerEnd<
963 fidl_fuchsia_component_sandbox::DictionaryMarker,
964 >,
965 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
966 &mut self.dictionary
967 ),
968 ),
969 encoder,
970 offset,
971 _depth,
972 )
973 }
974 }
975 unsafe impl<
976 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
977 T1: fidl::encoding::Encode<
978 fidl::encoding::Endpoint<
979 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
980 >,
981 fidl::encoding::DefaultFuchsiaResourceDialect,
982 >,
983 >
984 fidl::encoding::Encode<
985 RealmFactoryCreateRealm2Request,
986 fidl::encoding::DefaultFuchsiaResourceDialect,
987 > for (T0, T1)
988 {
989 #[inline]
990 unsafe fn encode(
991 self,
992 encoder: &mut fidl::encoding::Encoder<
993 '_,
994 fidl::encoding::DefaultFuchsiaResourceDialect,
995 >,
996 offset: usize,
997 depth: fidl::encoding::Depth,
998 ) -> fidl::Result<()> {
999 encoder.debug_check_bounds::<RealmFactoryCreateRealm2Request>(offset);
1000 unsafe {
1003 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1004 (ptr as *mut u64).write_unaligned(0);
1005 }
1006 self.0.encode(encoder, offset + 0, depth)?;
1008 self.1.encode(encoder, offset + 16, depth)?;
1009 Ok(())
1010 }
1011 }
1012
1013 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1014 for RealmFactoryCreateRealm2Request
1015 {
1016 #[inline(always)]
1017 fn new_empty() -> Self {
1018 Self {
1019 options: fidl::new_empty!(
1020 RealmOptions,
1021 fidl::encoding::DefaultFuchsiaResourceDialect
1022 ),
1023 dictionary: fidl::new_empty!(
1024 fidl::encoding::Endpoint<
1025 fidl::endpoints::ServerEnd<
1026 fidl_fuchsia_component_sandbox::DictionaryMarker,
1027 >,
1028 >,
1029 fidl::encoding::DefaultFuchsiaResourceDialect
1030 ),
1031 }
1032 }
1033
1034 #[inline]
1035 unsafe fn decode(
1036 &mut self,
1037 decoder: &mut fidl::encoding::Decoder<
1038 '_,
1039 fidl::encoding::DefaultFuchsiaResourceDialect,
1040 >,
1041 offset: usize,
1042 _depth: fidl::encoding::Depth,
1043 ) -> fidl::Result<()> {
1044 decoder.debug_check_bounds::<Self>(offset);
1045 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1047 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1048 let mask = 0xffffffff00000000u64;
1049 let maskedval = padval & mask;
1050 if maskedval != 0 {
1051 return Err(fidl::Error::NonZeroPadding {
1052 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1053 });
1054 }
1055 fidl::decode!(
1056 RealmOptions,
1057 fidl::encoding::DefaultFuchsiaResourceDialect,
1058 &mut self.options,
1059 decoder,
1060 offset + 0,
1061 _depth
1062 )?;
1063 fidl::decode!(
1064 fidl::encoding::Endpoint<
1065 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
1066 >,
1067 fidl::encoding::DefaultFuchsiaResourceDialect,
1068 &mut self.dictionary,
1069 decoder,
1070 offset + 16,
1071 _depth
1072 )?;
1073 Ok(())
1074 }
1075 }
1076
1077 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1078 type Borrowed<'a> = &'a mut Self;
1079 fn take_or_borrow<'a>(
1080 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1081 ) -> Self::Borrowed<'a> {
1082 value
1083 }
1084 }
1085
1086 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1087 type Owned = Self;
1088
1089 #[inline(always)]
1090 fn inline_align(_context: fidl::encoding::Context) -> usize {
1091 8
1092 }
1093
1094 #[inline(always)]
1095 fn inline_size(_context: fidl::encoding::Context) -> usize {
1096 24
1097 }
1098 }
1099
1100 unsafe impl
1101 fidl::encoding::Encode<
1102 RealmFactoryCreateRealmRequest,
1103 fidl::encoding::DefaultFuchsiaResourceDialect,
1104 > for &mut RealmFactoryCreateRealmRequest
1105 {
1106 #[inline]
1107 unsafe fn encode(
1108 self,
1109 encoder: &mut fidl::encoding::Encoder<
1110 '_,
1111 fidl::encoding::DefaultFuchsiaResourceDialect,
1112 >,
1113 offset: usize,
1114 _depth: fidl::encoding::Depth,
1115 ) -> fidl::Result<()> {
1116 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1117 fidl::encoding::Encode::<
1119 RealmFactoryCreateRealmRequest,
1120 fidl::encoding::DefaultFuchsiaResourceDialect,
1121 >::encode(
1122 (
1123 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1124 &mut self.options,
1125 ),
1126 <fidl::encoding::Endpoint<
1127 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1128 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1129 &mut self.realm_server,
1130 ),
1131 ),
1132 encoder,
1133 offset,
1134 _depth,
1135 )
1136 }
1137 }
1138 unsafe impl<
1139 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1140 T1: fidl::encoding::Encode<
1141 fidl::encoding::Endpoint<
1142 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1143 >,
1144 fidl::encoding::DefaultFuchsiaResourceDialect,
1145 >,
1146 >
1147 fidl::encoding::Encode<
1148 RealmFactoryCreateRealmRequest,
1149 fidl::encoding::DefaultFuchsiaResourceDialect,
1150 > for (T0, T1)
1151 {
1152 #[inline]
1153 unsafe fn encode(
1154 self,
1155 encoder: &mut fidl::encoding::Encoder<
1156 '_,
1157 fidl::encoding::DefaultFuchsiaResourceDialect,
1158 >,
1159 offset: usize,
1160 depth: fidl::encoding::Depth,
1161 ) -> fidl::Result<()> {
1162 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1163 unsafe {
1166 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1167 (ptr as *mut u64).write_unaligned(0);
1168 }
1169 self.0.encode(encoder, offset + 0, depth)?;
1171 self.1.encode(encoder, offset + 16, depth)?;
1172 Ok(())
1173 }
1174 }
1175
1176 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1177 for RealmFactoryCreateRealmRequest
1178 {
1179 #[inline(always)]
1180 fn new_empty() -> Self {
1181 Self {
1182 options: fidl::new_empty!(
1183 RealmOptions,
1184 fidl::encoding::DefaultFuchsiaResourceDialect
1185 ),
1186 realm_server: fidl::new_empty!(
1187 fidl::encoding::Endpoint<
1188 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1189 >,
1190 fidl::encoding::DefaultFuchsiaResourceDialect
1191 ),
1192 }
1193 }
1194
1195 #[inline]
1196 unsafe fn decode(
1197 &mut self,
1198 decoder: &mut fidl::encoding::Decoder<
1199 '_,
1200 fidl::encoding::DefaultFuchsiaResourceDialect,
1201 >,
1202 offset: usize,
1203 _depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 decoder.debug_check_bounds::<Self>(offset);
1206 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1208 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1209 let mask = 0xffffffff00000000u64;
1210 let maskedval = padval & mask;
1211 if maskedval != 0 {
1212 return Err(fidl::Error::NonZeroPadding {
1213 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1214 });
1215 }
1216 fidl::decode!(
1217 RealmOptions,
1218 fidl::encoding::DefaultFuchsiaResourceDialect,
1219 &mut self.options,
1220 decoder,
1221 offset + 0,
1222 _depth
1223 )?;
1224 fidl::decode!(
1225 fidl::encoding::Endpoint<
1226 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1227 >,
1228 fidl::encoding::DefaultFuchsiaResourceDialect,
1229 &mut self.realm_server,
1230 decoder,
1231 offset + 16,
1232 _depth
1233 )?;
1234 Ok(())
1235 }
1236 }
1237
1238 impl DriverConfig {
1239 #[inline(always)]
1240 fn max_ordinal_present(&self) -> u64 {
1241 if let Some(_) = self.driver_test_realm_start_args {
1242 return 3;
1243 }
1244 if let Some(_) = self.dev_class {
1245 return 2;
1246 }
1247 if let Some(_) = self.dev_topological {
1248 return 1;
1249 }
1250 0
1251 }
1252 }
1253
1254 impl fidl::encoding::ResourceTypeMarker for DriverConfig {
1255 type Borrowed<'a> = &'a mut Self;
1256 fn take_or_borrow<'a>(
1257 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1258 ) -> Self::Borrowed<'a> {
1259 value
1260 }
1261 }
1262
1263 unsafe impl fidl::encoding::TypeMarker for DriverConfig {
1264 type Owned = Self;
1265
1266 #[inline(always)]
1267 fn inline_align(_context: fidl::encoding::Context) -> usize {
1268 8
1269 }
1270
1271 #[inline(always)]
1272 fn inline_size(_context: fidl::encoding::Context) -> usize {
1273 16
1274 }
1275 }
1276
1277 unsafe impl fidl::encoding::Encode<DriverConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1278 for &mut DriverConfig
1279 {
1280 unsafe fn encode(
1281 self,
1282 encoder: &mut fidl::encoding::Encoder<
1283 '_,
1284 fidl::encoding::DefaultFuchsiaResourceDialect,
1285 >,
1286 offset: usize,
1287 mut depth: fidl::encoding::Depth,
1288 ) -> fidl::Result<()> {
1289 encoder.debug_check_bounds::<DriverConfig>(offset);
1290 let max_ordinal: u64 = self.max_ordinal_present();
1292 encoder.write_num(max_ordinal, offset);
1293 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1294 if max_ordinal == 0 {
1296 return Ok(());
1297 }
1298 depth.increment()?;
1299 let envelope_size = 8;
1300 let bytes_len = max_ordinal as usize * envelope_size;
1301 #[allow(unused_variables)]
1302 let offset = encoder.out_of_line_offset(bytes_len);
1303 let mut _prev_end_offset: usize = 0;
1304 if 1 > max_ordinal {
1305 return Ok(());
1306 }
1307
1308 let cur_offset: usize = (1 - 1) * envelope_size;
1311
1312 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1314
1315 fidl::encoding::encode_in_envelope_optional::<
1320 fidl::encoding::Endpoint<
1321 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1322 >,
1323 fidl::encoding::DefaultFuchsiaResourceDialect,
1324 >(
1325 self.dev_topological.as_mut().map(
1326 <fidl::encoding::Endpoint<
1327 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1328 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1329 ),
1330 encoder,
1331 offset + cur_offset,
1332 depth,
1333 )?;
1334
1335 _prev_end_offset = cur_offset + envelope_size;
1336 if 2 > max_ordinal {
1337 return Ok(());
1338 }
1339
1340 let cur_offset: usize = (2 - 1) * envelope_size;
1343
1344 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1346
1347 fidl::encoding::encode_in_envelope_optional::<
1352 fidl::encoding::Endpoint<
1353 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1354 >,
1355 fidl::encoding::DefaultFuchsiaResourceDialect,
1356 >(
1357 self.dev_class.as_mut().map(
1358 <fidl::encoding::Endpoint<
1359 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1360 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1361 ),
1362 encoder,
1363 offset + cur_offset,
1364 depth,
1365 )?;
1366
1367 _prev_end_offset = cur_offset + envelope_size;
1368 if 3 > max_ordinal {
1369 return Ok(());
1370 }
1371
1372 let cur_offset: usize = (3 - 1) * envelope_size;
1375
1376 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1378
1379 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_driver_test::RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>(
1384 self.driver_test_realm_start_args.as_mut().map(<fidl_fuchsia_driver_test::RealmArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1385 encoder, offset + cur_offset, depth
1386 )?;
1387
1388 _prev_end_offset = cur_offset + envelope_size;
1389
1390 Ok(())
1391 }
1392 }
1393
1394 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriverConfig {
1395 #[inline(always)]
1396 fn new_empty() -> Self {
1397 Self::default()
1398 }
1399
1400 unsafe fn decode(
1401 &mut self,
1402 decoder: &mut fidl::encoding::Decoder<
1403 '_,
1404 fidl::encoding::DefaultFuchsiaResourceDialect,
1405 >,
1406 offset: usize,
1407 mut depth: fidl::encoding::Depth,
1408 ) -> fidl::Result<()> {
1409 decoder.debug_check_bounds::<Self>(offset);
1410 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1411 None => return Err(fidl::Error::NotNullable),
1412 Some(len) => len,
1413 };
1414 if len == 0 {
1416 return Ok(());
1417 };
1418 depth.increment()?;
1419 let envelope_size = 8;
1420 let bytes_len = len * envelope_size;
1421 let offset = decoder.out_of_line_offset(bytes_len)?;
1422 let mut _next_ordinal_to_read = 0;
1424 let mut next_offset = offset;
1425 let end_offset = offset + bytes_len;
1426 _next_ordinal_to_read += 1;
1427 if next_offset >= end_offset {
1428 return Ok(());
1429 }
1430
1431 while _next_ordinal_to_read < 1 {
1433 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1434 _next_ordinal_to_read += 1;
1435 next_offset += envelope_size;
1436 }
1437
1438 let next_out_of_line = decoder.next_out_of_line();
1439 let handles_before = decoder.remaining_handles();
1440 if let Some((inlined, num_bytes, num_handles)) =
1441 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1442 {
1443 let member_inline_size = <fidl::encoding::Endpoint<
1444 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1445 > as fidl::encoding::TypeMarker>::inline_size(
1446 decoder.context
1447 );
1448 if inlined != (member_inline_size <= 4) {
1449 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1450 }
1451 let inner_offset;
1452 let mut inner_depth = depth.clone();
1453 if inlined {
1454 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1455 inner_offset = next_offset;
1456 } else {
1457 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1458 inner_depth.increment()?;
1459 }
1460 let val_ref = self.dev_topological.get_or_insert_with(|| {
1461 fidl::new_empty!(
1462 fidl::encoding::Endpoint<
1463 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1464 >,
1465 fidl::encoding::DefaultFuchsiaResourceDialect
1466 )
1467 });
1468 fidl::decode!(
1469 fidl::encoding::Endpoint<
1470 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1471 >,
1472 fidl::encoding::DefaultFuchsiaResourceDialect,
1473 val_ref,
1474 decoder,
1475 inner_offset,
1476 inner_depth
1477 )?;
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::Endpoint<
1506 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1507 > as fidl::encoding::TypeMarker>::inline_size(
1508 decoder.context
1509 );
1510 if inlined != (member_inline_size <= 4) {
1511 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1512 }
1513 let inner_offset;
1514 let mut inner_depth = depth.clone();
1515 if inlined {
1516 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1517 inner_offset = next_offset;
1518 } else {
1519 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1520 inner_depth.increment()?;
1521 }
1522 let val_ref = self.dev_class.get_or_insert_with(|| {
1523 fidl::new_empty!(
1524 fidl::encoding::Endpoint<
1525 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1526 >,
1527 fidl::encoding::DefaultFuchsiaResourceDialect
1528 )
1529 });
1530 fidl::decode!(
1531 fidl::encoding::Endpoint<
1532 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1533 >,
1534 fidl::encoding::DefaultFuchsiaResourceDialect,
1535 val_ref,
1536 decoder,
1537 inner_offset,
1538 inner_depth
1539 )?;
1540 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1541 {
1542 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1543 }
1544 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1545 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1546 }
1547 }
1548
1549 next_offset += envelope_size;
1550 _next_ordinal_to_read += 1;
1551 if next_offset >= end_offset {
1552 return Ok(());
1553 }
1554
1555 while _next_ordinal_to_read < 3 {
1557 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1558 _next_ordinal_to_read += 1;
1559 next_offset += envelope_size;
1560 }
1561
1562 let next_out_of_line = decoder.next_out_of_line();
1563 let handles_before = decoder.remaining_handles();
1564 if let Some((inlined, num_bytes, num_handles)) =
1565 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1566 {
1567 let member_inline_size = <fidl_fuchsia_driver_test::RealmArgs as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1568 if inlined != (member_inline_size <= 4) {
1569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1570 }
1571 let inner_offset;
1572 let mut inner_depth = depth.clone();
1573 if inlined {
1574 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1575 inner_offset = next_offset;
1576 } else {
1577 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1578 inner_depth.increment()?;
1579 }
1580 let val_ref = self.driver_test_realm_start_args.get_or_insert_with(|| {
1581 fidl::new_empty!(
1582 fidl_fuchsia_driver_test::RealmArgs,
1583 fidl::encoding::DefaultFuchsiaResourceDialect
1584 )
1585 });
1586 fidl::decode!(
1587 fidl_fuchsia_driver_test::RealmArgs,
1588 fidl::encoding::DefaultFuchsiaResourceDialect,
1589 val_ref,
1590 decoder,
1591 inner_offset,
1592 inner_depth
1593 )?;
1594 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1595 {
1596 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1597 }
1598 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1599 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1600 }
1601 }
1602
1603 next_offset += envelope_size;
1604
1605 while next_offset < end_offset {
1607 _next_ordinal_to_read += 1;
1608 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1609 next_offset += envelope_size;
1610 }
1611
1612 Ok(())
1613 }
1614 }
1615
1616 impl DriversOnly {
1617 #[inline(always)]
1618 fn max_ordinal_present(&self) -> u64 {
1619 if let Some(_) = self.driver_config {
1620 return 1;
1621 }
1622 0
1623 }
1624 }
1625
1626 impl fidl::encoding::ResourceTypeMarker for DriversOnly {
1627 type Borrowed<'a> = &'a mut Self;
1628 fn take_or_borrow<'a>(
1629 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1630 ) -> Self::Borrowed<'a> {
1631 value
1632 }
1633 }
1634
1635 unsafe impl fidl::encoding::TypeMarker for DriversOnly {
1636 type Owned = Self;
1637
1638 #[inline(always)]
1639 fn inline_align(_context: fidl::encoding::Context) -> usize {
1640 8
1641 }
1642
1643 #[inline(always)]
1644 fn inline_size(_context: fidl::encoding::Context) -> usize {
1645 16
1646 }
1647 }
1648
1649 unsafe impl fidl::encoding::Encode<DriversOnly, fidl::encoding::DefaultFuchsiaResourceDialect>
1650 for &mut DriversOnly
1651 {
1652 unsafe fn encode(
1653 self,
1654 encoder: &mut fidl::encoding::Encoder<
1655 '_,
1656 fidl::encoding::DefaultFuchsiaResourceDialect,
1657 >,
1658 offset: usize,
1659 mut depth: fidl::encoding::Depth,
1660 ) -> fidl::Result<()> {
1661 encoder.debug_check_bounds::<DriversOnly>(offset);
1662 let max_ordinal: u64 = self.max_ordinal_present();
1664 encoder.write_num(max_ordinal, offset);
1665 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1666 if max_ordinal == 0 {
1668 return Ok(());
1669 }
1670 depth.increment()?;
1671 let envelope_size = 8;
1672 let bytes_len = max_ordinal as usize * envelope_size;
1673 #[allow(unused_variables)]
1674 let offset = encoder.out_of_line_offset(bytes_len);
1675 let mut _prev_end_offset: usize = 0;
1676 if 1 > max_ordinal {
1677 return Ok(());
1678 }
1679
1680 let cur_offset: usize = (1 - 1) * envelope_size;
1683
1684 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1686
1687 fidl::encoding::encode_in_envelope_optional::<
1692 DriverConfig,
1693 fidl::encoding::DefaultFuchsiaResourceDialect,
1694 >(
1695 self.driver_config
1696 .as_mut()
1697 .map(<DriverConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1698 encoder,
1699 offset + cur_offset,
1700 depth,
1701 )?;
1702
1703 _prev_end_offset = cur_offset + envelope_size;
1704
1705 Ok(())
1706 }
1707 }
1708
1709 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriversOnly {
1710 #[inline(always)]
1711 fn new_empty() -> Self {
1712 Self::default()
1713 }
1714
1715 unsafe fn decode(
1716 &mut self,
1717 decoder: &mut fidl::encoding::Decoder<
1718 '_,
1719 fidl::encoding::DefaultFuchsiaResourceDialect,
1720 >,
1721 offset: usize,
1722 mut depth: fidl::encoding::Depth,
1723 ) -> fidl::Result<()> {
1724 decoder.debug_check_bounds::<Self>(offset);
1725 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1726 None => return Err(fidl::Error::NotNullable),
1727 Some(len) => len,
1728 };
1729 if len == 0 {
1731 return Ok(());
1732 };
1733 depth.increment()?;
1734 let envelope_size = 8;
1735 let bytes_len = len * envelope_size;
1736 let offset = decoder.out_of_line_offset(bytes_len)?;
1737 let mut _next_ordinal_to_read = 0;
1739 let mut next_offset = offset;
1740 let end_offset = offset + bytes_len;
1741 _next_ordinal_to_read += 1;
1742 if next_offset >= end_offset {
1743 return Ok(());
1744 }
1745
1746 while _next_ordinal_to_read < 1 {
1748 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1749 _next_ordinal_to_read += 1;
1750 next_offset += envelope_size;
1751 }
1752
1753 let next_out_of_line = decoder.next_out_of_line();
1754 let handles_before = decoder.remaining_handles();
1755 if let Some((inlined, num_bytes, num_handles)) =
1756 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1757 {
1758 let member_inline_size =
1759 <DriverConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1760 if inlined != (member_inline_size <= 4) {
1761 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1762 }
1763 let inner_offset;
1764 let mut inner_depth = depth.clone();
1765 if inlined {
1766 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1767 inner_offset = next_offset;
1768 } else {
1769 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1770 inner_depth.increment()?;
1771 }
1772 let val_ref = self.driver_config.get_or_insert_with(|| {
1773 fidl::new_empty!(DriverConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
1774 });
1775 fidl::decode!(
1776 DriverConfig,
1777 fidl::encoding::DefaultFuchsiaResourceDialect,
1778 val_ref,
1779 decoder,
1780 inner_offset,
1781 inner_depth
1782 )?;
1783 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1784 {
1785 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1786 }
1787 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1788 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1789 }
1790 }
1791
1792 next_offset += envelope_size;
1793
1794 while next_offset < end_offset {
1796 _next_ordinal_to_read += 1;
1797 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1798 next_offset += envelope_size;
1799 }
1800
1801 Ok(())
1802 }
1803 }
1804
1805 impl RealmOptions {
1806 #[inline(always)]
1807 fn max_ordinal_present(&self) -> u64 {
1808 if let Some(_) = self.topology {
1809 return 3;
1810 }
1811 if let Some(_) = self.wlan_config {
1812 return 2;
1813 }
1814 if let Some(_) = self.devfs_server_end {
1815 return 1;
1816 }
1817 0
1818 }
1819 }
1820
1821 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1822 type Borrowed<'a> = &'a mut Self;
1823 fn take_or_borrow<'a>(
1824 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1825 ) -> Self::Borrowed<'a> {
1826 value
1827 }
1828 }
1829
1830 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1831 type Owned = Self;
1832
1833 #[inline(always)]
1834 fn inline_align(_context: fidl::encoding::Context) -> usize {
1835 8
1836 }
1837
1838 #[inline(always)]
1839 fn inline_size(_context: fidl::encoding::Context) -> usize {
1840 16
1841 }
1842 }
1843
1844 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1845 for &mut RealmOptions
1846 {
1847 unsafe fn encode(
1848 self,
1849 encoder: &mut fidl::encoding::Encoder<
1850 '_,
1851 fidl::encoding::DefaultFuchsiaResourceDialect,
1852 >,
1853 offset: usize,
1854 mut depth: fidl::encoding::Depth,
1855 ) -> fidl::Result<()> {
1856 encoder.debug_check_bounds::<RealmOptions>(offset);
1857 let max_ordinal: u64 = self.max_ordinal_present();
1859 encoder.write_num(max_ordinal, offset);
1860 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1861 if max_ordinal == 0 {
1863 return Ok(());
1864 }
1865 depth.increment()?;
1866 let envelope_size = 8;
1867 let bytes_len = max_ordinal as usize * envelope_size;
1868 #[allow(unused_variables)]
1869 let offset = encoder.out_of_line_offset(bytes_len);
1870 let mut _prev_end_offset: usize = 0;
1871 if 1 > max_ordinal {
1872 return Ok(());
1873 }
1874
1875 let cur_offset: usize = (1 - 1) * envelope_size;
1878
1879 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1881
1882 fidl::encoding::encode_in_envelope_optional::<
1887 fidl::encoding::Endpoint<
1888 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1889 >,
1890 fidl::encoding::DefaultFuchsiaResourceDialect,
1891 >(
1892 self.devfs_server_end.as_mut().map(
1893 <fidl::encoding::Endpoint<
1894 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
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 2 > max_ordinal {
1904 return Ok(());
1905 }
1906
1907 let cur_offset: usize = (2 - 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 WlanConfig,
1920 fidl::encoding::DefaultFuchsiaResourceDialect,
1921 >(
1922 self.wlan_config
1923 .as_mut()
1924 .map(<WlanConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1925 encoder,
1926 offset + cur_offset,
1927 depth,
1928 )?;
1929
1930 _prev_end_offset = cur_offset + envelope_size;
1931 if 3 > max_ordinal {
1932 return Ok(());
1933 }
1934
1935 let cur_offset: usize = (3 - 1) * envelope_size;
1938
1939 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1941
1942 fidl::encoding::encode_in_envelope_optional::<
1947 Topology,
1948 fidl::encoding::DefaultFuchsiaResourceDialect,
1949 >(
1950 self.topology
1951 .as_mut()
1952 .map(<Topology as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1953 encoder,
1954 offset + cur_offset,
1955 depth,
1956 )?;
1957
1958 _prev_end_offset = cur_offset + envelope_size;
1959
1960 Ok(())
1961 }
1962 }
1963
1964 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
1965 #[inline(always)]
1966 fn new_empty() -> Self {
1967 Self::default()
1968 }
1969
1970 unsafe fn decode(
1971 &mut self,
1972 decoder: &mut fidl::encoding::Decoder<
1973 '_,
1974 fidl::encoding::DefaultFuchsiaResourceDialect,
1975 >,
1976 offset: usize,
1977 mut depth: fidl::encoding::Depth,
1978 ) -> fidl::Result<()> {
1979 decoder.debug_check_bounds::<Self>(offset);
1980 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1981 None => return Err(fidl::Error::NotNullable),
1982 Some(len) => len,
1983 };
1984 if len == 0 {
1986 return Ok(());
1987 };
1988 depth.increment()?;
1989 let envelope_size = 8;
1990 let bytes_len = len * envelope_size;
1991 let offset = decoder.out_of_line_offset(bytes_len)?;
1992 let mut _next_ordinal_to_read = 0;
1994 let mut next_offset = offset;
1995 let end_offset = offset + bytes_len;
1996 _next_ordinal_to_read += 1;
1997 if next_offset >= end_offset {
1998 return Ok(());
1999 }
2000
2001 while _next_ordinal_to_read < 1 {
2003 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2004 _next_ordinal_to_read += 1;
2005 next_offset += envelope_size;
2006 }
2007
2008 let next_out_of_line = decoder.next_out_of_line();
2009 let handles_before = decoder.remaining_handles();
2010 if let Some((inlined, num_bytes, num_handles)) =
2011 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2012 {
2013 let member_inline_size = <fidl::encoding::Endpoint<
2014 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2015 > 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.devfs_server_end.get_or_insert_with(|| {
2031 fidl::new_empty!(
2032 fidl::encoding::Endpoint<
2033 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2034 >,
2035 fidl::encoding::DefaultFuchsiaResourceDialect
2036 )
2037 });
2038 fidl::decode!(
2039 fidl::encoding::Endpoint<
2040 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2041 >,
2042 fidl::encoding::DefaultFuchsiaResourceDialect,
2043 val_ref,
2044 decoder,
2045 inner_offset,
2046 inner_depth
2047 )?;
2048 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2049 {
2050 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2051 }
2052 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2053 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2054 }
2055 }
2056
2057 next_offset += envelope_size;
2058 _next_ordinal_to_read += 1;
2059 if next_offset >= end_offset {
2060 return Ok(());
2061 }
2062
2063 while _next_ordinal_to_read < 2 {
2065 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2066 _next_ordinal_to_read += 1;
2067 next_offset += envelope_size;
2068 }
2069
2070 let next_out_of_line = decoder.next_out_of_line();
2071 let handles_before = decoder.remaining_handles();
2072 if let Some((inlined, num_bytes, num_handles)) =
2073 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2074 {
2075 let member_inline_size =
2076 <WlanConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2077 if inlined != (member_inline_size <= 4) {
2078 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2079 }
2080 let inner_offset;
2081 let mut inner_depth = depth.clone();
2082 if inlined {
2083 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2084 inner_offset = next_offset;
2085 } else {
2086 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2087 inner_depth.increment()?;
2088 }
2089 let val_ref = self.wlan_config.get_or_insert_with(|| {
2090 fidl::new_empty!(WlanConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
2091 });
2092 fidl::decode!(
2093 WlanConfig,
2094 fidl::encoding::DefaultFuchsiaResourceDialect,
2095 val_ref,
2096 decoder,
2097 inner_offset,
2098 inner_depth
2099 )?;
2100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2101 {
2102 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2103 }
2104 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2105 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2106 }
2107 }
2108
2109 next_offset += envelope_size;
2110 _next_ordinal_to_read += 1;
2111 if next_offset >= end_offset {
2112 return Ok(());
2113 }
2114
2115 while _next_ordinal_to_read < 3 {
2117 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2118 _next_ordinal_to_read += 1;
2119 next_offset += envelope_size;
2120 }
2121
2122 let next_out_of_line = decoder.next_out_of_line();
2123 let handles_before = decoder.remaining_handles();
2124 if let Some((inlined, num_bytes, num_handles)) =
2125 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2126 {
2127 let member_inline_size =
2128 <Topology as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2129 if inlined != (member_inline_size <= 4) {
2130 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2131 }
2132 let inner_offset;
2133 let mut inner_depth = depth.clone();
2134 if inlined {
2135 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2136 inner_offset = next_offset;
2137 } else {
2138 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2139 inner_depth.increment()?;
2140 }
2141 let val_ref = self.topology.get_or_insert_with(|| {
2142 fidl::new_empty!(Topology, fidl::encoding::DefaultFuchsiaResourceDialect)
2143 });
2144 fidl::decode!(
2145 Topology,
2146 fidl::encoding::DefaultFuchsiaResourceDialect,
2147 val_ref,
2148 decoder,
2149 inner_offset,
2150 inner_depth
2151 )?;
2152 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2153 {
2154 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2155 }
2156 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2157 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2158 }
2159 }
2160
2161 next_offset += envelope_size;
2162
2163 while next_offset < end_offset {
2165 _next_ordinal_to_read += 1;
2166 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2167 next_offset += envelope_size;
2168 }
2169
2170 Ok(())
2171 }
2172 }
2173
2174 impl WlanConfig {
2175 #[inline(always)]
2176 fn max_ordinal_present(&self) -> u64 {
2177 if let Some(_) = self.trace_manager_hermeticity {
2178 return 4;
2179 }
2180 if let Some(_) = self.name {
2181 return 3;
2182 }
2183 if let Some(_) = self.with_regulatory_region {
2184 return 2;
2185 }
2186 if let Some(_) = self.use_legacy_privacy {
2187 return 1;
2188 }
2189 0
2190 }
2191 }
2192
2193 impl fidl::encoding::ResourceTypeMarker for WlanConfig {
2194 type Borrowed<'a> = &'a mut Self;
2195 fn take_or_borrow<'a>(
2196 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2197 ) -> Self::Borrowed<'a> {
2198 value
2199 }
2200 }
2201
2202 unsafe impl fidl::encoding::TypeMarker for WlanConfig {
2203 type Owned = Self;
2204
2205 #[inline(always)]
2206 fn inline_align(_context: fidl::encoding::Context) -> usize {
2207 8
2208 }
2209
2210 #[inline(always)]
2211 fn inline_size(_context: fidl::encoding::Context) -> usize {
2212 16
2213 }
2214 }
2215
2216 unsafe impl fidl::encoding::Encode<WlanConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
2217 for &mut WlanConfig
2218 {
2219 unsafe fn encode(
2220 self,
2221 encoder: &mut fidl::encoding::Encoder<
2222 '_,
2223 fidl::encoding::DefaultFuchsiaResourceDialect,
2224 >,
2225 offset: usize,
2226 mut depth: fidl::encoding::Depth,
2227 ) -> fidl::Result<()> {
2228 encoder.debug_check_bounds::<WlanConfig>(offset);
2229 let max_ordinal: u64 = self.max_ordinal_present();
2231 encoder.write_num(max_ordinal, offset);
2232 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2233 if max_ordinal == 0 {
2235 return Ok(());
2236 }
2237 depth.increment()?;
2238 let envelope_size = 8;
2239 let bytes_len = max_ordinal as usize * envelope_size;
2240 #[allow(unused_variables)]
2241 let offset = encoder.out_of_line_offset(bytes_len);
2242 let mut _prev_end_offset: usize = 0;
2243 if 1 > max_ordinal {
2244 return Ok(());
2245 }
2246
2247 let cur_offset: usize = (1 - 1) * envelope_size;
2250
2251 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2253
2254 fidl::encoding::encode_in_envelope_optional::<
2259 bool,
2260 fidl::encoding::DefaultFuchsiaResourceDialect,
2261 >(
2262 self.use_legacy_privacy
2263 .as_ref()
2264 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2265 encoder,
2266 offset + cur_offset,
2267 depth,
2268 )?;
2269
2270 _prev_end_offset = cur_offset + envelope_size;
2271 if 2 > max_ordinal {
2272 return Ok(());
2273 }
2274
2275 let cur_offset: usize = (2 - 1) * envelope_size;
2278
2279 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2281
2282 fidl::encoding::encode_in_envelope_optional::<
2287 bool,
2288 fidl::encoding::DefaultFuchsiaResourceDialect,
2289 >(
2290 self.with_regulatory_region
2291 .as_ref()
2292 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2293 encoder,
2294 offset + cur_offset,
2295 depth,
2296 )?;
2297
2298 _prev_end_offset = cur_offset + envelope_size;
2299 if 3 > max_ordinal {
2300 return Ok(());
2301 }
2302
2303 let cur_offset: usize = (3 - 1) * envelope_size;
2306
2307 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2309
2310 fidl::encoding::encode_in_envelope_optional::<
2315 fidl::encoding::UnboundedString,
2316 fidl::encoding::DefaultFuchsiaResourceDialect,
2317 >(
2318 self.name.as_ref().map(
2319 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2320 ),
2321 encoder,
2322 offset + cur_offset,
2323 depth,
2324 )?;
2325
2326 _prev_end_offset = cur_offset + envelope_size;
2327 if 4 > max_ordinal {
2328 return Ok(());
2329 }
2330
2331 let cur_offset: usize = (4 - 1) * envelope_size;
2334
2335 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2337
2338 fidl::encoding::encode_in_envelope_optional::<
2343 TraceManagerHermeticity,
2344 fidl::encoding::DefaultFuchsiaResourceDialect,
2345 >(
2346 self.trace_manager_hermeticity
2347 .as_ref()
2348 .map(<TraceManagerHermeticity as fidl::encoding::ValueTypeMarker>::borrow),
2349 encoder,
2350 offset + cur_offset,
2351 depth,
2352 )?;
2353
2354 _prev_end_offset = cur_offset + envelope_size;
2355
2356 Ok(())
2357 }
2358 }
2359
2360 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WlanConfig {
2361 #[inline(always)]
2362 fn new_empty() -> Self {
2363 Self::default()
2364 }
2365
2366 unsafe fn decode(
2367 &mut self,
2368 decoder: &mut fidl::encoding::Decoder<
2369 '_,
2370 fidl::encoding::DefaultFuchsiaResourceDialect,
2371 >,
2372 offset: usize,
2373 mut depth: fidl::encoding::Depth,
2374 ) -> fidl::Result<()> {
2375 decoder.debug_check_bounds::<Self>(offset);
2376 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2377 None => return Err(fidl::Error::NotNullable),
2378 Some(len) => len,
2379 };
2380 if len == 0 {
2382 return Ok(());
2383 };
2384 depth.increment()?;
2385 let envelope_size = 8;
2386 let bytes_len = len * envelope_size;
2387 let offset = decoder.out_of_line_offset(bytes_len)?;
2388 let mut _next_ordinal_to_read = 0;
2390 let mut next_offset = offset;
2391 let end_offset = offset + bytes_len;
2392 _next_ordinal_to_read += 1;
2393 if next_offset >= end_offset {
2394 return Ok(());
2395 }
2396
2397 while _next_ordinal_to_read < 1 {
2399 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2400 _next_ordinal_to_read += 1;
2401 next_offset += envelope_size;
2402 }
2403
2404 let next_out_of_line = decoder.next_out_of_line();
2405 let handles_before = decoder.remaining_handles();
2406 if let Some((inlined, num_bytes, num_handles)) =
2407 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2408 {
2409 let member_inline_size =
2410 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2411 if inlined != (member_inline_size <= 4) {
2412 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2413 }
2414 let inner_offset;
2415 let mut inner_depth = depth.clone();
2416 if inlined {
2417 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2418 inner_offset = next_offset;
2419 } else {
2420 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2421 inner_depth.increment()?;
2422 }
2423 let val_ref = self.use_legacy_privacy.get_or_insert_with(|| {
2424 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2425 });
2426 fidl::decode!(
2427 bool,
2428 fidl::encoding::DefaultFuchsiaResourceDialect,
2429 val_ref,
2430 decoder,
2431 inner_offset,
2432 inner_depth
2433 )?;
2434 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2435 {
2436 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2437 }
2438 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2439 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2440 }
2441 }
2442
2443 next_offset += envelope_size;
2444 _next_ordinal_to_read += 1;
2445 if next_offset >= end_offset {
2446 return Ok(());
2447 }
2448
2449 while _next_ordinal_to_read < 2 {
2451 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2452 _next_ordinal_to_read += 1;
2453 next_offset += envelope_size;
2454 }
2455
2456 let next_out_of_line = decoder.next_out_of_line();
2457 let handles_before = decoder.remaining_handles();
2458 if let Some((inlined, num_bytes, num_handles)) =
2459 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2460 {
2461 let member_inline_size =
2462 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2463 if inlined != (member_inline_size <= 4) {
2464 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2465 }
2466 let inner_offset;
2467 let mut inner_depth = depth.clone();
2468 if inlined {
2469 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2470 inner_offset = next_offset;
2471 } else {
2472 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2473 inner_depth.increment()?;
2474 }
2475 let val_ref = self.with_regulatory_region.get_or_insert_with(|| {
2476 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2477 });
2478 fidl::decode!(
2479 bool,
2480 fidl::encoding::DefaultFuchsiaResourceDialect,
2481 val_ref,
2482 decoder,
2483 inner_offset,
2484 inner_depth
2485 )?;
2486 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2487 {
2488 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2489 }
2490 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2491 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2492 }
2493 }
2494
2495 next_offset += envelope_size;
2496 _next_ordinal_to_read += 1;
2497 if next_offset >= end_offset {
2498 return Ok(());
2499 }
2500
2501 while _next_ordinal_to_read < 3 {
2503 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2504 _next_ordinal_to_read += 1;
2505 next_offset += envelope_size;
2506 }
2507
2508 let next_out_of_line = decoder.next_out_of_line();
2509 let handles_before = decoder.remaining_handles();
2510 if let Some((inlined, num_bytes, num_handles)) =
2511 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2512 {
2513 let member_inline_size =
2514 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2515 decoder.context,
2516 );
2517 if inlined != (member_inline_size <= 4) {
2518 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2519 }
2520 let inner_offset;
2521 let mut inner_depth = depth.clone();
2522 if inlined {
2523 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2524 inner_offset = next_offset;
2525 } else {
2526 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2527 inner_depth.increment()?;
2528 }
2529 let val_ref = self.name.get_or_insert_with(|| {
2530 fidl::new_empty!(
2531 fidl::encoding::UnboundedString,
2532 fidl::encoding::DefaultFuchsiaResourceDialect
2533 )
2534 });
2535 fidl::decode!(
2536 fidl::encoding::UnboundedString,
2537 fidl::encoding::DefaultFuchsiaResourceDialect,
2538 val_ref,
2539 decoder,
2540 inner_offset,
2541 inner_depth
2542 )?;
2543 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2544 {
2545 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2546 }
2547 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2548 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2549 }
2550 }
2551
2552 next_offset += envelope_size;
2553 _next_ordinal_to_read += 1;
2554 if next_offset >= end_offset {
2555 return Ok(());
2556 }
2557
2558 while _next_ordinal_to_read < 4 {
2560 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2561 _next_ordinal_to_read += 1;
2562 next_offset += envelope_size;
2563 }
2564
2565 let next_out_of_line = decoder.next_out_of_line();
2566 let handles_before = decoder.remaining_handles();
2567 if let Some((inlined, num_bytes, num_handles)) =
2568 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2569 {
2570 let member_inline_size =
2571 <TraceManagerHermeticity as fidl::encoding::TypeMarker>::inline_size(
2572 decoder.context,
2573 );
2574 if inlined != (member_inline_size <= 4) {
2575 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2576 }
2577 let inner_offset;
2578 let mut inner_depth = depth.clone();
2579 if inlined {
2580 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2581 inner_offset = next_offset;
2582 } else {
2583 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2584 inner_depth.increment()?;
2585 }
2586 let val_ref = self.trace_manager_hermeticity.get_or_insert_with(|| {
2587 fidl::new_empty!(
2588 TraceManagerHermeticity,
2589 fidl::encoding::DefaultFuchsiaResourceDialect
2590 )
2591 });
2592 fidl::decode!(
2593 TraceManagerHermeticity,
2594 fidl::encoding::DefaultFuchsiaResourceDialect,
2595 val_ref,
2596 decoder,
2597 inner_offset,
2598 inner_depth
2599 )?;
2600 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2601 {
2602 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2603 }
2604 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2605 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2606 }
2607 }
2608
2609 next_offset += envelope_size;
2610
2611 while next_offset < end_offset {
2613 _next_ordinal_to_read += 1;
2614 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2615 next_offset += envelope_size;
2616 }
2617
2618 Ok(())
2619 }
2620 }
2621
2622 impl fidl::encoding::ResourceTypeMarker for Topology {
2623 type Borrowed<'a> = &'a mut Self;
2624 fn take_or_borrow<'a>(
2625 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2626 ) -> Self::Borrowed<'a> {
2627 value
2628 }
2629 }
2630
2631 unsafe impl fidl::encoding::TypeMarker for Topology {
2632 type Owned = Self;
2633
2634 #[inline(always)]
2635 fn inline_align(_context: fidl::encoding::Context) -> usize {
2636 8
2637 }
2638
2639 #[inline(always)]
2640 fn inline_size(_context: fidl::encoding::Context) -> usize {
2641 16
2642 }
2643 }
2644
2645 unsafe impl fidl::encoding::Encode<Topology, fidl::encoding::DefaultFuchsiaResourceDialect>
2646 for &mut Topology
2647 {
2648 #[inline]
2649 unsafe fn encode(
2650 self,
2651 encoder: &mut fidl::encoding::Encoder<
2652 '_,
2653 fidl::encoding::DefaultFuchsiaResourceDialect,
2654 >,
2655 offset: usize,
2656 _depth: fidl::encoding::Depth,
2657 ) -> fidl::Result<()> {
2658 encoder.debug_check_bounds::<Topology>(offset);
2659 encoder.write_num::<u64>(self.ordinal(), offset);
2660 match self {
2661 Topology::DriversOnly(ref mut val) => fidl::encoding::encode_in_envelope::<
2662 DriversOnly,
2663 fidl::encoding::DefaultFuchsiaResourceDialect,
2664 >(
2665 <DriversOnly as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2666 encoder,
2667 offset + 8,
2668 _depth,
2669 ),
2670 Topology::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2671 }
2672 }
2673 }
2674
2675 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Topology {
2676 #[inline(always)]
2677 fn new_empty() -> Self {
2678 Self::__SourceBreaking { unknown_ordinal: 0 }
2679 }
2680
2681 #[inline]
2682 unsafe fn decode(
2683 &mut self,
2684 decoder: &mut fidl::encoding::Decoder<
2685 '_,
2686 fidl::encoding::DefaultFuchsiaResourceDialect,
2687 >,
2688 offset: usize,
2689 mut depth: fidl::encoding::Depth,
2690 ) -> fidl::Result<()> {
2691 decoder.debug_check_bounds::<Self>(offset);
2692 #[allow(unused_variables)]
2693 let next_out_of_line = decoder.next_out_of_line();
2694 let handles_before = decoder.remaining_handles();
2695 let (ordinal, inlined, num_bytes, num_handles) =
2696 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2697
2698 let member_inline_size = match ordinal {
2699 1 => <DriversOnly as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2700 0 => return Err(fidl::Error::UnknownUnionTag),
2701 _ => num_bytes as usize,
2702 };
2703
2704 if inlined != (member_inline_size <= 4) {
2705 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2706 }
2707 let _inner_offset;
2708 if inlined {
2709 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2710 _inner_offset = offset + 8;
2711 } else {
2712 depth.increment()?;
2713 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2714 }
2715 match ordinal {
2716 1 => {
2717 #[allow(irrefutable_let_patterns)]
2718 if let Topology::DriversOnly(_) = self {
2719 } else {
2721 *self = Topology::DriversOnly(fidl::new_empty!(
2723 DriversOnly,
2724 fidl::encoding::DefaultFuchsiaResourceDialect
2725 ));
2726 }
2727 #[allow(irrefutable_let_patterns)]
2728 if let Topology::DriversOnly(ref mut val) = self {
2729 fidl::decode!(
2730 DriversOnly,
2731 fidl::encoding::DefaultFuchsiaResourceDialect,
2732 val,
2733 decoder,
2734 _inner_offset,
2735 depth
2736 )?;
2737 } else {
2738 unreachable!()
2739 }
2740 }
2741 #[allow(deprecated)]
2742 ordinal => {
2743 for _ in 0..num_handles {
2744 decoder.drop_next_handle()?;
2745 }
2746 *self = Topology::__SourceBreaking { unknown_ordinal: ordinal };
2747 }
2748 }
2749 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2750 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2751 }
2752 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2753 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2754 }
2755 Ok(())
2756 }
2757 }
2758}