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::NullableHandle {
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
736 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
737 self.inner.shutdown_with_epitaph(status)
738 }
739
740 fn is_closed(&self) -> bool {
741 self.inner.channel().is_closed()
742 }
743 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
744 self.inner.channel().on_closed()
745 }
746
747 #[cfg(target_os = "fuchsia")]
748 fn signal_peer(
749 &self,
750 clear_mask: zx::Signals,
751 set_mask: zx::Signals,
752 ) -> Result<(), zx_status::Status> {
753 use fidl::Peered;
754 self.inner.channel().signal_peer(clear_mask, set_mask)
755 }
756}
757
758impl RealmFactoryControlHandle {}
759
760#[must_use = "FIDL methods require a response to be sent"]
761#[derive(Debug)]
762pub struct RealmFactoryCreateRealmResponder {
763 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
764 tx_id: u32,
765}
766
767impl std::ops::Drop for RealmFactoryCreateRealmResponder {
771 fn drop(&mut self) {
772 self.control_handle.shutdown();
773 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
775 }
776}
777
778impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
779 type ControlHandle = RealmFactoryControlHandle;
780
781 fn control_handle(&self) -> &RealmFactoryControlHandle {
782 &self.control_handle
783 }
784
785 fn drop_without_shutdown(mut self) {
786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
788 std::mem::forget(self);
790 }
791}
792
793impl RealmFactoryCreateRealmResponder {
794 pub fn send(
798 self,
799 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
800 ) -> Result<(), fidl::Error> {
801 let _result = self.send_raw(result);
802 if _result.is_err() {
803 self.control_handle.shutdown();
804 }
805 self.drop_without_shutdown();
806 _result
807 }
808
809 pub fn send_no_shutdown_on_err(
811 self,
812 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
813 ) -> Result<(), fidl::Error> {
814 let _result = self.send_raw(result);
815 self.drop_without_shutdown();
816 _result
817 }
818
819 fn send_raw(
820 &self,
821 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
822 ) -> Result<(), fidl::Error> {
823 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
824 fidl::encoding::EmptyStruct,
825 fidl_fuchsia_testing_harness::OperationError,
826 >>(
827 fidl::encoding::FlexibleResult::new(result),
828 self.tx_id,
829 0x51aac08d328c3ae4,
830 fidl::encoding::DynamicFlags::FLEXIBLE,
831 )
832 }
833}
834
835#[must_use = "FIDL methods require a response to be sent"]
836#[derive(Debug)]
837pub struct RealmFactoryCreateRealm2Responder {
838 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
839 tx_id: u32,
840}
841
842impl std::ops::Drop for RealmFactoryCreateRealm2Responder {
846 fn drop(&mut self) {
847 self.control_handle.shutdown();
848 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
850 }
851}
852
853impl fidl::endpoints::Responder for RealmFactoryCreateRealm2Responder {
854 type ControlHandle = RealmFactoryControlHandle;
855
856 fn control_handle(&self) -> &RealmFactoryControlHandle {
857 &self.control_handle
858 }
859
860 fn drop_without_shutdown(mut self) {
861 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
863 std::mem::forget(self);
865 }
866}
867
868impl RealmFactoryCreateRealm2Responder {
869 pub fn send(
873 self,
874 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
875 ) -> Result<(), fidl::Error> {
876 let _result = self.send_raw(result);
877 if _result.is_err() {
878 self.control_handle.shutdown();
879 }
880 self.drop_without_shutdown();
881 _result
882 }
883
884 pub fn send_no_shutdown_on_err(
886 self,
887 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
888 ) -> Result<(), fidl::Error> {
889 let _result = self.send_raw(result);
890 self.drop_without_shutdown();
891 _result
892 }
893
894 fn send_raw(
895 &self,
896 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
897 ) -> Result<(), fidl::Error> {
898 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
899 fidl::encoding::EmptyStruct,
900 fidl_fuchsia_testing_harness::OperationError,
901 >>(
902 fidl::encoding::FlexibleResult::new(result),
903 self.tx_id,
904 0x29dd599835927548,
905 fidl::encoding::DynamicFlags::FLEXIBLE,
906 )
907 }
908}
909
910mod internal {
911 use super::*;
912
913 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealm2Request {
914 type Borrowed<'a> = &'a mut Self;
915 fn take_or_borrow<'a>(
916 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
917 ) -> Self::Borrowed<'a> {
918 value
919 }
920 }
921
922 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealm2Request {
923 type Owned = Self;
924
925 #[inline(always)]
926 fn inline_align(_context: fidl::encoding::Context) -> usize {
927 8
928 }
929
930 #[inline(always)]
931 fn inline_size(_context: fidl::encoding::Context) -> usize {
932 24
933 }
934 }
935
936 unsafe impl
937 fidl::encoding::Encode<
938 RealmFactoryCreateRealm2Request,
939 fidl::encoding::DefaultFuchsiaResourceDialect,
940 > for &mut RealmFactoryCreateRealm2Request
941 {
942 #[inline]
943 unsafe fn encode(
944 self,
945 encoder: &mut fidl::encoding::Encoder<
946 '_,
947 fidl::encoding::DefaultFuchsiaResourceDialect,
948 >,
949 offset: usize,
950 _depth: fidl::encoding::Depth,
951 ) -> fidl::Result<()> {
952 encoder.debug_check_bounds::<RealmFactoryCreateRealm2Request>(offset);
953 fidl::encoding::Encode::<
955 RealmFactoryCreateRealm2Request,
956 fidl::encoding::DefaultFuchsiaResourceDialect,
957 >::encode(
958 (
959 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
960 &mut self.options,
961 ),
962 <fidl::encoding::Endpoint<
963 fidl::endpoints::ServerEnd<
964 fidl_fuchsia_component_sandbox::DictionaryMarker,
965 >,
966 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
967 &mut self.dictionary
968 ),
969 ),
970 encoder,
971 offset,
972 _depth,
973 )
974 }
975 }
976 unsafe impl<
977 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
978 T1: fidl::encoding::Encode<
979 fidl::encoding::Endpoint<
980 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
981 >,
982 fidl::encoding::DefaultFuchsiaResourceDialect,
983 >,
984 >
985 fidl::encoding::Encode<
986 RealmFactoryCreateRealm2Request,
987 fidl::encoding::DefaultFuchsiaResourceDialect,
988 > for (T0, T1)
989 {
990 #[inline]
991 unsafe fn encode(
992 self,
993 encoder: &mut fidl::encoding::Encoder<
994 '_,
995 fidl::encoding::DefaultFuchsiaResourceDialect,
996 >,
997 offset: usize,
998 depth: fidl::encoding::Depth,
999 ) -> fidl::Result<()> {
1000 encoder.debug_check_bounds::<RealmFactoryCreateRealm2Request>(offset);
1001 unsafe {
1004 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1005 (ptr as *mut u64).write_unaligned(0);
1006 }
1007 self.0.encode(encoder, offset + 0, depth)?;
1009 self.1.encode(encoder, offset + 16, depth)?;
1010 Ok(())
1011 }
1012 }
1013
1014 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1015 for RealmFactoryCreateRealm2Request
1016 {
1017 #[inline(always)]
1018 fn new_empty() -> Self {
1019 Self {
1020 options: fidl::new_empty!(
1021 RealmOptions,
1022 fidl::encoding::DefaultFuchsiaResourceDialect
1023 ),
1024 dictionary: fidl::new_empty!(
1025 fidl::encoding::Endpoint<
1026 fidl::endpoints::ServerEnd<
1027 fidl_fuchsia_component_sandbox::DictionaryMarker,
1028 >,
1029 >,
1030 fidl::encoding::DefaultFuchsiaResourceDialect
1031 ),
1032 }
1033 }
1034
1035 #[inline]
1036 unsafe fn decode(
1037 &mut self,
1038 decoder: &mut fidl::encoding::Decoder<
1039 '_,
1040 fidl::encoding::DefaultFuchsiaResourceDialect,
1041 >,
1042 offset: usize,
1043 _depth: fidl::encoding::Depth,
1044 ) -> fidl::Result<()> {
1045 decoder.debug_check_bounds::<Self>(offset);
1046 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1048 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1049 let mask = 0xffffffff00000000u64;
1050 let maskedval = padval & mask;
1051 if maskedval != 0 {
1052 return Err(fidl::Error::NonZeroPadding {
1053 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1054 });
1055 }
1056 fidl::decode!(
1057 RealmOptions,
1058 fidl::encoding::DefaultFuchsiaResourceDialect,
1059 &mut self.options,
1060 decoder,
1061 offset + 0,
1062 _depth
1063 )?;
1064 fidl::decode!(
1065 fidl::encoding::Endpoint<
1066 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
1067 >,
1068 fidl::encoding::DefaultFuchsiaResourceDialect,
1069 &mut self.dictionary,
1070 decoder,
1071 offset + 16,
1072 _depth
1073 )?;
1074 Ok(())
1075 }
1076 }
1077
1078 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1079 type Borrowed<'a> = &'a mut Self;
1080 fn take_or_borrow<'a>(
1081 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1082 ) -> Self::Borrowed<'a> {
1083 value
1084 }
1085 }
1086
1087 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1088 type Owned = Self;
1089
1090 #[inline(always)]
1091 fn inline_align(_context: fidl::encoding::Context) -> usize {
1092 8
1093 }
1094
1095 #[inline(always)]
1096 fn inline_size(_context: fidl::encoding::Context) -> usize {
1097 24
1098 }
1099 }
1100
1101 unsafe impl
1102 fidl::encoding::Encode<
1103 RealmFactoryCreateRealmRequest,
1104 fidl::encoding::DefaultFuchsiaResourceDialect,
1105 > for &mut RealmFactoryCreateRealmRequest
1106 {
1107 #[inline]
1108 unsafe fn encode(
1109 self,
1110 encoder: &mut fidl::encoding::Encoder<
1111 '_,
1112 fidl::encoding::DefaultFuchsiaResourceDialect,
1113 >,
1114 offset: usize,
1115 _depth: fidl::encoding::Depth,
1116 ) -> fidl::Result<()> {
1117 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1118 fidl::encoding::Encode::<
1120 RealmFactoryCreateRealmRequest,
1121 fidl::encoding::DefaultFuchsiaResourceDialect,
1122 >::encode(
1123 (
1124 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1125 &mut self.options,
1126 ),
1127 <fidl::encoding::Endpoint<
1128 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1129 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1130 &mut self.realm_server,
1131 ),
1132 ),
1133 encoder,
1134 offset,
1135 _depth,
1136 )
1137 }
1138 }
1139 unsafe impl<
1140 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1141 T1: fidl::encoding::Encode<
1142 fidl::encoding::Endpoint<
1143 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1144 >,
1145 fidl::encoding::DefaultFuchsiaResourceDialect,
1146 >,
1147 >
1148 fidl::encoding::Encode<
1149 RealmFactoryCreateRealmRequest,
1150 fidl::encoding::DefaultFuchsiaResourceDialect,
1151 > for (T0, T1)
1152 {
1153 #[inline]
1154 unsafe fn encode(
1155 self,
1156 encoder: &mut fidl::encoding::Encoder<
1157 '_,
1158 fidl::encoding::DefaultFuchsiaResourceDialect,
1159 >,
1160 offset: usize,
1161 depth: fidl::encoding::Depth,
1162 ) -> fidl::Result<()> {
1163 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1164 unsafe {
1167 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1168 (ptr as *mut u64).write_unaligned(0);
1169 }
1170 self.0.encode(encoder, offset + 0, depth)?;
1172 self.1.encode(encoder, offset + 16, depth)?;
1173 Ok(())
1174 }
1175 }
1176
1177 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1178 for RealmFactoryCreateRealmRequest
1179 {
1180 #[inline(always)]
1181 fn new_empty() -> Self {
1182 Self {
1183 options: fidl::new_empty!(
1184 RealmOptions,
1185 fidl::encoding::DefaultFuchsiaResourceDialect
1186 ),
1187 realm_server: fidl::new_empty!(
1188 fidl::encoding::Endpoint<
1189 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1190 >,
1191 fidl::encoding::DefaultFuchsiaResourceDialect
1192 ),
1193 }
1194 }
1195
1196 #[inline]
1197 unsafe fn decode(
1198 &mut self,
1199 decoder: &mut fidl::encoding::Decoder<
1200 '_,
1201 fidl::encoding::DefaultFuchsiaResourceDialect,
1202 >,
1203 offset: usize,
1204 _depth: fidl::encoding::Depth,
1205 ) -> fidl::Result<()> {
1206 decoder.debug_check_bounds::<Self>(offset);
1207 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1209 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1210 let mask = 0xffffffff00000000u64;
1211 let maskedval = padval & mask;
1212 if maskedval != 0 {
1213 return Err(fidl::Error::NonZeroPadding {
1214 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1215 });
1216 }
1217 fidl::decode!(
1218 RealmOptions,
1219 fidl::encoding::DefaultFuchsiaResourceDialect,
1220 &mut self.options,
1221 decoder,
1222 offset + 0,
1223 _depth
1224 )?;
1225 fidl::decode!(
1226 fidl::encoding::Endpoint<
1227 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1228 >,
1229 fidl::encoding::DefaultFuchsiaResourceDialect,
1230 &mut self.realm_server,
1231 decoder,
1232 offset + 16,
1233 _depth
1234 )?;
1235 Ok(())
1236 }
1237 }
1238
1239 impl DriverConfig {
1240 #[inline(always)]
1241 fn max_ordinal_present(&self) -> u64 {
1242 if let Some(_) = self.driver_test_realm_start_args {
1243 return 3;
1244 }
1245 if let Some(_) = self.dev_class {
1246 return 2;
1247 }
1248 if let Some(_) = self.dev_topological {
1249 return 1;
1250 }
1251 0
1252 }
1253 }
1254
1255 impl fidl::encoding::ResourceTypeMarker for DriverConfig {
1256 type Borrowed<'a> = &'a mut Self;
1257 fn take_or_borrow<'a>(
1258 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1259 ) -> Self::Borrowed<'a> {
1260 value
1261 }
1262 }
1263
1264 unsafe impl fidl::encoding::TypeMarker for DriverConfig {
1265 type Owned = Self;
1266
1267 #[inline(always)]
1268 fn inline_align(_context: fidl::encoding::Context) -> usize {
1269 8
1270 }
1271
1272 #[inline(always)]
1273 fn inline_size(_context: fidl::encoding::Context) -> usize {
1274 16
1275 }
1276 }
1277
1278 unsafe impl fidl::encoding::Encode<DriverConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1279 for &mut DriverConfig
1280 {
1281 unsafe fn encode(
1282 self,
1283 encoder: &mut fidl::encoding::Encoder<
1284 '_,
1285 fidl::encoding::DefaultFuchsiaResourceDialect,
1286 >,
1287 offset: usize,
1288 mut depth: fidl::encoding::Depth,
1289 ) -> fidl::Result<()> {
1290 encoder.debug_check_bounds::<DriverConfig>(offset);
1291 let max_ordinal: u64 = self.max_ordinal_present();
1293 encoder.write_num(max_ordinal, offset);
1294 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1295 if max_ordinal == 0 {
1297 return Ok(());
1298 }
1299 depth.increment()?;
1300 let envelope_size = 8;
1301 let bytes_len = max_ordinal as usize * envelope_size;
1302 #[allow(unused_variables)]
1303 let offset = encoder.out_of_line_offset(bytes_len);
1304 let mut _prev_end_offset: usize = 0;
1305 if 1 > max_ordinal {
1306 return Ok(());
1307 }
1308
1309 let cur_offset: usize = (1 - 1) * envelope_size;
1312
1313 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1315
1316 fidl::encoding::encode_in_envelope_optional::<
1321 fidl::encoding::Endpoint<
1322 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1323 >,
1324 fidl::encoding::DefaultFuchsiaResourceDialect,
1325 >(
1326 self.dev_topological.as_mut().map(
1327 <fidl::encoding::Endpoint<
1328 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1329 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1330 ),
1331 encoder,
1332 offset + cur_offset,
1333 depth,
1334 )?;
1335
1336 _prev_end_offset = cur_offset + envelope_size;
1337 if 2 > max_ordinal {
1338 return Ok(());
1339 }
1340
1341 let cur_offset: usize = (2 - 1) * envelope_size;
1344
1345 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1347
1348 fidl::encoding::encode_in_envelope_optional::<
1353 fidl::encoding::Endpoint<
1354 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1355 >,
1356 fidl::encoding::DefaultFuchsiaResourceDialect,
1357 >(
1358 self.dev_class.as_mut().map(
1359 <fidl::encoding::Endpoint<
1360 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1361 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1362 ),
1363 encoder,
1364 offset + cur_offset,
1365 depth,
1366 )?;
1367
1368 _prev_end_offset = cur_offset + envelope_size;
1369 if 3 > max_ordinal {
1370 return Ok(());
1371 }
1372
1373 let cur_offset: usize = (3 - 1) * envelope_size;
1376
1377 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1379
1380 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_driver_test::RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>(
1385 self.driver_test_realm_start_args.as_mut().map(<fidl_fuchsia_driver_test::RealmArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1386 encoder, offset + cur_offset, depth
1387 )?;
1388
1389 _prev_end_offset = cur_offset + envelope_size;
1390
1391 Ok(())
1392 }
1393 }
1394
1395 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriverConfig {
1396 #[inline(always)]
1397 fn new_empty() -> Self {
1398 Self::default()
1399 }
1400
1401 unsafe fn decode(
1402 &mut self,
1403 decoder: &mut fidl::encoding::Decoder<
1404 '_,
1405 fidl::encoding::DefaultFuchsiaResourceDialect,
1406 >,
1407 offset: usize,
1408 mut depth: fidl::encoding::Depth,
1409 ) -> fidl::Result<()> {
1410 decoder.debug_check_bounds::<Self>(offset);
1411 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1412 None => return Err(fidl::Error::NotNullable),
1413 Some(len) => len,
1414 };
1415 if len == 0 {
1417 return Ok(());
1418 };
1419 depth.increment()?;
1420 let envelope_size = 8;
1421 let bytes_len = len * envelope_size;
1422 let offset = decoder.out_of_line_offset(bytes_len)?;
1423 let mut _next_ordinal_to_read = 0;
1425 let mut next_offset = offset;
1426 let end_offset = offset + bytes_len;
1427 _next_ordinal_to_read += 1;
1428 if next_offset >= end_offset {
1429 return Ok(());
1430 }
1431
1432 while _next_ordinal_to_read < 1 {
1434 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1435 _next_ordinal_to_read += 1;
1436 next_offset += envelope_size;
1437 }
1438
1439 let next_out_of_line = decoder.next_out_of_line();
1440 let handles_before = decoder.remaining_handles();
1441 if let Some((inlined, num_bytes, num_handles)) =
1442 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1443 {
1444 let member_inline_size = <fidl::encoding::Endpoint<
1445 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1446 > as fidl::encoding::TypeMarker>::inline_size(
1447 decoder.context
1448 );
1449 if inlined != (member_inline_size <= 4) {
1450 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1451 }
1452 let inner_offset;
1453 let mut inner_depth = depth.clone();
1454 if inlined {
1455 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1456 inner_offset = next_offset;
1457 } else {
1458 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1459 inner_depth.increment()?;
1460 }
1461 let val_ref = self.dev_topological.get_or_insert_with(|| {
1462 fidl::new_empty!(
1463 fidl::encoding::Endpoint<
1464 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1465 >,
1466 fidl::encoding::DefaultFuchsiaResourceDialect
1467 )
1468 });
1469 fidl::decode!(
1470 fidl::encoding::Endpoint<
1471 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1472 >,
1473 fidl::encoding::DefaultFuchsiaResourceDialect,
1474 val_ref,
1475 decoder,
1476 inner_offset,
1477 inner_depth
1478 )?;
1479 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1480 {
1481 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1482 }
1483 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1484 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1485 }
1486 }
1487
1488 next_offset += envelope_size;
1489 _next_ordinal_to_read += 1;
1490 if next_offset >= end_offset {
1491 return Ok(());
1492 }
1493
1494 while _next_ordinal_to_read < 2 {
1496 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1497 _next_ordinal_to_read += 1;
1498 next_offset += envelope_size;
1499 }
1500
1501 let next_out_of_line = decoder.next_out_of_line();
1502 let handles_before = decoder.remaining_handles();
1503 if let Some((inlined, num_bytes, num_handles)) =
1504 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1505 {
1506 let member_inline_size = <fidl::encoding::Endpoint<
1507 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1508 > as fidl::encoding::TypeMarker>::inline_size(
1509 decoder.context
1510 );
1511 if inlined != (member_inline_size <= 4) {
1512 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1513 }
1514 let inner_offset;
1515 let mut inner_depth = depth.clone();
1516 if inlined {
1517 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1518 inner_offset = next_offset;
1519 } else {
1520 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1521 inner_depth.increment()?;
1522 }
1523 let val_ref = self.dev_class.get_or_insert_with(|| {
1524 fidl::new_empty!(
1525 fidl::encoding::Endpoint<
1526 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1527 >,
1528 fidl::encoding::DefaultFuchsiaResourceDialect
1529 )
1530 });
1531 fidl::decode!(
1532 fidl::encoding::Endpoint<
1533 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1534 >,
1535 fidl::encoding::DefaultFuchsiaResourceDialect,
1536 val_ref,
1537 decoder,
1538 inner_offset,
1539 inner_depth
1540 )?;
1541 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1542 {
1543 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1544 }
1545 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1546 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1547 }
1548 }
1549
1550 next_offset += envelope_size;
1551 _next_ordinal_to_read += 1;
1552 if next_offset >= end_offset {
1553 return Ok(());
1554 }
1555
1556 while _next_ordinal_to_read < 3 {
1558 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1559 _next_ordinal_to_read += 1;
1560 next_offset += envelope_size;
1561 }
1562
1563 let next_out_of_line = decoder.next_out_of_line();
1564 let handles_before = decoder.remaining_handles();
1565 if let Some((inlined, num_bytes, num_handles)) =
1566 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1567 {
1568 let member_inline_size = <fidl_fuchsia_driver_test::RealmArgs as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1569 if inlined != (member_inline_size <= 4) {
1570 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1571 }
1572 let inner_offset;
1573 let mut inner_depth = depth.clone();
1574 if inlined {
1575 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1576 inner_offset = next_offset;
1577 } else {
1578 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1579 inner_depth.increment()?;
1580 }
1581 let val_ref = self.driver_test_realm_start_args.get_or_insert_with(|| {
1582 fidl::new_empty!(
1583 fidl_fuchsia_driver_test::RealmArgs,
1584 fidl::encoding::DefaultFuchsiaResourceDialect
1585 )
1586 });
1587 fidl::decode!(
1588 fidl_fuchsia_driver_test::RealmArgs,
1589 fidl::encoding::DefaultFuchsiaResourceDialect,
1590 val_ref,
1591 decoder,
1592 inner_offset,
1593 inner_depth
1594 )?;
1595 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1596 {
1597 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1598 }
1599 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1600 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1601 }
1602 }
1603
1604 next_offset += envelope_size;
1605
1606 while next_offset < end_offset {
1608 _next_ordinal_to_read += 1;
1609 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1610 next_offset += envelope_size;
1611 }
1612
1613 Ok(())
1614 }
1615 }
1616
1617 impl DriversOnly {
1618 #[inline(always)]
1619 fn max_ordinal_present(&self) -> u64 {
1620 if let Some(_) = self.driver_config {
1621 return 1;
1622 }
1623 0
1624 }
1625 }
1626
1627 impl fidl::encoding::ResourceTypeMarker for DriversOnly {
1628 type Borrowed<'a> = &'a mut Self;
1629 fn take_or_borrow<'a>(
1630 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1631 ) -> Self::Borrowed<'a> {
1632 value
1633 }
1634 }
1635
1636 unsafe impl fidl::encoding::TypeMarker for DriversOnly {
1637 type Owned = Self;
1638
1639 #[inline(always)]
1640 fn inline_align(_context: fidl::encoding::Context) -> usize {
1641 8
1642 }
1643
1644 #[inline(always)]
1645 fn inline_size(_context: fidl::encoding::Context) -> usize {
1646 16
1647 }
1648 }
1649
1650 unsafe impl fidl::encoding::Encode<DriversOnly, fidl::encoding::DefaultFuchsiaResourceDialect>
1651 for &mut DriversOnly
1652 {
1653 unsafe fn encode(
1654 self,
1655 encoder: &mut fidl::encoding::Encoder<
1656 '_,
1657 fidl::encoding::DefaultFuchsiaResourceDialect,
1658 >,
1659 offset: usize,
1660 mut depth: fidl::encoding::Depth,
1661 ) -> fidl::Result<()> {
1662 encoder.debug_check_bounds::<DriversOnly>(offset);
1663 let max_ordinal: u64 = self.max_ordinal_present();
1665 encoder.write_num(max_ordinal, offset);
1666 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1667 if max_ordinal == 0 {
1669 return Ok(());
1670 }
1671 depth.increment()?;
1672 let envelope_size = 8;
1673 let bytes_len = max_ordinal as usize * envelope_size;
1674 #[allow(unused_variables)]
1675 let offset = encoder.out_of_line_offset(bytes_len);
1676 let mut _prev_end_offset: usize = 0;
1677 if 1 > max_ordinal {
1678 return Ok(());
1679 }
1680
1681 let cur_offset: usize = (1 - 1) * envelope_size;
1684
1685 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1687
1688 fidl::encoding::encode_in_envelope_optional::<
1693 DriverConfig,
1694 fidl::encoding::DefaultFuchsiaResourceDialect,
1695 >(
1696 self.driver_config
1697 .as_mut()
1698 .map(<DriverConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1699 encoder,
1700 offset + cur_offset,
1701 depth,
1702 )?;
1703
1704 _prev_end_offset = cur_offset + envelope_size;
1705
1706 Ok(())
1707 }
1708 }
1709
1710 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriversOnly {
1711 #[inline(always)]
1712 fn new_empty() -> Self {
1713 Self::default()
1714 }
1715
1716 unsafe fn decode(
1717 &mut self,
1718 decoder: &mut fidl::encoding::Decoder<
1719 '_,
1720 fidl::encoding::DefaultFuchsiaResourceDialect,
1721 >,
1722 offset: usize,
1723 mut depth: fidl::encoding::Depth,
1724 ) -> fidl::Result<()> {
1725 decoder.debug_check_bounds::<Self>(offset);
1726 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1727 None => return Err(fidl::Error::NotNullable),
1728 Some(len) => len,
1729 };
1730 if len == 0 {
1732 return Ok(());
1733 };
1734 depth.increment()?;
1735 let envelope_size = 8;
1736 let bytes_len = len * envelope_size;
1737 let offset = decoder.out_of_line_offset(bytes_len)?;
1738 let mut _next_ordinal_to_read = 0;
1740 let mut next_offset = offset;
1741 let end_offset = offset + bytes_len;
1742 _next_ordinal_to_read += 1;
1743 if next_offset >= end_offset {
1744 return Ok(());
1745 }
1746
1747 while _next_ordinal_to_read < 1 {
1749 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1750 _next_ordinal_to_read += 1;
1751 next_offset += envelope_size;
1752 }
1753
1754 let next_out_of_line = decoder.next_out_of_line();
1755 let handles_before = decoder.remaining_handles();
1756 if let Some((inlined, num_bytes, num_handles)) =
1757 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1758 {
1759 let member_inline_size =
1760 <DriverConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1761 if inlined != (member_inline_size <= 4) {
1762 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1763 }
1764 let inner_offset;
1765 let mut inner_depth = depth.clone();
1766 if inlined {
1767 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1768 inner_offset = next_offset;
1769 } else {
1770 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1771 inner_depth.increment()?;
1772 }
1773 let val_ref = self.driver_config.get_or_insert_with(|| {
1774 fidl::new_empty!(DriverConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
1775 });
1776 fidl::decode!(
1777 DriverConfig,
1778 fidl::encoding::DefaultFuchsiaResourceDialect,
1779 val_ref,
1780 decoder,
1781 inner_offset,
1782 inner_depth
1783 )?;
1784 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1785 {
1786 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1787 }
1788 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1789 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1790 }
1791 }
1792
1793 next_offset += envelope_size;
1794
1795 while next_offset < end_offset {
1797 _next_ordinal_to_read += 1;
1798 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1799 next_offset += envelope_size;
1800 }
1801
1802 Ok(())
1803 }
1804 }
1805
1806 impl RealmOptions {
1807 #[inline(always)]
1808 fn max_ordinal_present(&self) -> u64 {
1809 if let Some(_) = self.topology {
1810 return 3;
1811 }
1812 if let Some(_) = self.wlan_config {
1813 return 2;
1814 }
1815 if let Some(_) = self.devfs_server_end {
1816 return 1;
1817 }
1818 0
1819 }
1820 }
1821
1822 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1823 type Borrowed<'a> = &'a mut Self;
1824 fn take_or_borrow<'a>(
1825 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1826 ) -> Self::Borrowed<'a> {
1827 value
1828 }
1829 }
1830
1831 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1832 type Owned = Self;
1833
1834 #[inline(always)]
1835 fn inline_align(_context: fidl::encoding::Context) -> usize {
1836 8
1837 }
1838
1839 #[inline(always)]
1840 fn inline_size(_context: fidl::encoding::Context) -> usize {
1841 16
1842 }
1843 }
1844
1845 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1846 for &mut RealmOptions
1847 {
1848 unsafe fn encode(
1849 self,
1850 encoder: &mut fidl::encoding::Encoder<
1851 '_,
1852 fidl::encoding::DefaultFuchsiaResourceDialect,
1853 >,
1854 offset: usize,
1855 mut depth: fidl::encoding::Depth,
1856 ) -> fidl::Result<()> {
1857 encoder.debug_check_bounds::<RealmOptions>(offset);
1858 let max_ordinal: u64 = self.max_ordinal_present();
1860 encoder.write_num(max_ordinal, offset);
1861 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1862 if max_ordinal == 0 {
1864 return Ok(());
1865 }
1866 depth.increment()?;
1867 let envelope_size = 8;
1868 let bytes_len = max_ordinal as usize * envelope_size;
1869 #[allow(unused_variables)]
1870 let offset = encoder.out_of_line_offset(bytes_len);
1871 let mut _prev_end_offset: usize = 0;
1872 if 1 > max_ordinal {
1873 return Ok(());
1874 }
1875
1876 let cur_offset: usize = (1 - 1) * envelope_size;
1879
1880 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1882
1883 fidl::encoding::encode_in_envelope_optional::<
1888 fidl::encoding::Endpoint<
1889 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1890 >,
1891 fidl::encoding::DefaultFuchsiaResourceDialect,
1892 >(
1893 self.devfs_server_end.as_mut().map(
1894 <fidl::encoding::Endpoint<
1895 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1896 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1897 ),
1898 encoder,
1899 offset + cur_offset,
1900 depth,
1901 )?;
1902
1903 _prev_end_offset = cur_offset + envelope_size;
1904 if 2 > max_ordinal {
1905 return Ok(());
1906 }
1907
1908 let cur_offset: usize = (2 - 1) * envelope_size;
1911
1912 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1914
1915 fidl::encoding::encode_in_envelope_optional::<
1920 WlanConfig,
1921 fidl::encoding::DefaultFuchsiaResourceDialect,
1922 >(
1923 self.wlan_config
1924 .as_mut()
1925 .map(<WlanConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1926 encoder,
1927 offset + cur_offset,
1928 depth,
1929 )?;
1930
1931 _prev_end_offset = cur_offset + envelope_size;
1932 if 3 > max_ordinal {
1933 return Ok(());
1934 }
1935
1936 let cur_offset: usize = (3 - 1) * envelope_size;
1939
1940 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1942
1943 fidl::encoding::encode_in_envelope_optional::<
1948 Topology,
1949 fidl::encoding::DefaultFuchsiaResourceDialect,
1950 >(
1951 self.topology
1952 .as_mut()
1953 .map(<Topology as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1954 encoder,
1955 offset + cur_offset,
1956 depth,
1957 )?;
1958
1959 _prev_end_offset = cur_offset + envelope_size;
1960
1961 Ok(())
1962 }
1963 }
1964
1965 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
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 = <fidl::encoding::Endpoint<
2015 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2016 > as fidl::encoding::TypeMarker>::inline_size(
2017 decoder.context
2018 );
2019 if inlined != (member_inline_size <= 4) {
2020 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2021 }
2022 let inner_offset;
2023 let mut inner_depth = depth.clone();
2024 if inlined {
2025 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2026 inner_offset = next_offset;
2027 } else {
2028 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2029 inner_depth.increment()?;
2030 }
2031 let val_ref = self.devfs_server_end.get_or_insert_with(|| {
2032 fidl::new_empty!(
2033 fidl::encoding::Endpoint<
2034 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2035 >,
2036 fidl::encoding::DefaultFuchsiaResourceDialect
2037 )
2038 });
2039 fidl::decode!(
2040 fidl::encoding::Endpoint<
2041 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2042 >,
2043 fidl::encoding::DefaultFuchsiaResourceDialect,
2044 val_ref,
2045 decoder,
2046 inner_offset,
2047 inner_depth
2048 )?;
2049 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2050 {
2051 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2052 }
2053 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2054 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2055 }
2056 }
2057
2058 next_offset += envelope_size;
2059 _next_ordinal_to_read += 1;
2060 if next_offset >= end_offset {
2061 return Ok(());
2062 }
2063
2064 while _next_ordinal_to_read < 2 {
2066 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2067 _next_ordinal_to_read += 1;
2068 next_offset += envelope_size;
2069 }
2070
2071 let next_out_of_line = decoder.next_out_of_line();
2072 let handles_before = decoder.remaining_handles();
2073 if let Some((inlined, num_bytes, num_handles)) =
2074 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2075 {
2076 let member_inline_size =
2077 <WlanConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
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 = self.wlan_config.get_or_insert_with(|| {
2091 fidl::new_empty!(WlanConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
2092 });
2093 fidl::decode!(
2094 WlanConfig,
2095 fidl::encoding::DefaultFuchsiaResourceDialect,
2096 val_ref,
2097 decoder,
2098 inner_offset,
2099 inner_depth
2100 )?;
2101 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2102 {
2103 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2104 }
2105 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2106 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2107 }
2108 }
2109
2110 next_offset += envelope_size;
2111 _next_ordinal_to_read += 1;
2112 if next_offset >= end_offset {
2113 return Ok(());
2114 }
2115
2116 while _next_ordinal_to_read < 3 {
2118 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2119 _next_ordinal_to_read += 1;
2120 next_offset += envelope_size;
2121 }
2122
2123 let next_out_of_line = decoder.next_out_of_line();
2124 let handles_before = decoder.remaining_handles();
2125 if let Some((inlined, num_bytes, num_handles)) =
2126 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2127 {
2128 let member_inline_size =
2129 <Topology as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2130 if inlined != (member_inline_size <= 4) {
2131 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2132 }
2133 let inner_offset;
2134 let mut inner_depth = depth.clone();
2135 if inlined {
2136 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2137 inner_offset = next_offset;
2138 } else {
2139 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2140 inner_depth.increment()?;
2141 }
2142 let val_ref = self.topology.get_or_insert_with(|| {
2143 fidl::new_empty!(Topology, fidl::encoding::DefaultFuchsiaResourceDialect)
2144 });
2145 fidl::decode!(
2146 Topology,
2147 fidl::encoding::DefaultFuchsiaResourceDialect,
2148 val_ref,
2149 decoder,
2150 inner_offset,
2151 inner_depth
2152 )?;
2153 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2154 {
2155 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2156 }
2157 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2158 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2159 }
2160 }
2161
2162 next_offset += envelope_size;
2163
2164 while next_offset < end_offset {
2166 _next_ordinal_to_read += 1;
2167 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2168 next_offset += envelope_size;
2169 }
2170
2171 Ok(())
2172 }
2173 }
2174
2175 impl WlanConfig {
2176 #[inline(always)]
2177 fn max_ordinal_present(&self) -> u64 {
2178 if let Some(_) = self.trace_manager_hermeticity {
2179 return 4;
2180 }
2181 if let Some(_) = self.name {
2182 return 3;
2183 }
2184 if let Some(_) = self.with_regulatory_region {
2185 return 2;
2186 }
2187 if let Some(_) = self.use_legacy_privacy {
2188 return 1;
2189 }
2190 0
2191 }
2192 }
2193
2194 impl fidl::encoding::ResourceTypeMarker for WlanConfig {
2195 type Borrowed<'a> = &'a mut Self;
2196 fn take_or_borrow<'a>(
2197 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2198 ) -> Self::Borrowed<'a> {
2199 value
2200 }
2201 }
2202
2203 unsafe impl fidl::encoding::TypeMarker for WlanConfig {
2204 type Owned = Self;
2205
2206 #[inline(always)]
2207 fn inline_align(_context: fidl::encoding::Context) -> usize {
2208 8
2209 }
2210
2211 #[inline(always)]
2212 fn inline_size(_context: fidl::encoding::Context) -> usize {
2213 16
2214 }
2215 }
2216
2217 unsafe impl fidl::encoding::Encode<WlanConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
2218 for &mut WlanConfig
2219 {
2220 unsafe fn encode(
2221 self,
2222 encoder: &mut fidl::encoding::Encoder<
2223 '_,
2224 fidl::encoding::DefaultFuchsiaResourceDialect,
2225 >,
2226 offset: usize,
2227 mut depth: fidl::encoding::Depth,
2228 ) -> fidl::Result<()> {
2229 encoder.debug_check_bounds::<WlanConfig>(offset);
2230 let max_ordinal: u64 = self.max_ordinal_present();
2232 encoder.write_num(max_ordinal, offset);
2233 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2234 if max_ordinal == 0 {
2236 return Ok(());
2237 }
2238 depth.increment()?;
2239 let envelope_size = 8;
2240 let bytes_len = max_ordinal as usize * envelope_size;
2241 #[allow(unused_variables)]
2242 let offset = encoder.out_of_line_offset(bytes_len);
2243 let mut _prev_end_offset: usize = 0;
2244 if 1 > max_ordinal {
2245 return Ok(());
2246 }
2247
2248 let cur_offset: usize = (1 - 1) * envelope_size;
2251
2252 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2254
2255 fidl::encoding::encode_in_envelope_optional::<
2260 bool,
2261 fidl::encoding::DefaultFuchsiaResourceDialect,
2262 >(
2263 self.use_legacy_privacy
2264 .as_ref()
2265 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2266 encoder,
2267 offset + cur_offset,
2268 depth,
2269 )?;
2270
2271 _prev_end_offset = cur_offset + envelope_size;
2272 if 2 > max_ordinal {
2273 return Ok(());
2274 }
2275
2276 let cur_offset: usize = (2 - 1) * envelope_size;
2279
2280 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2282
2283 fidl::encoding::encode_in_envelope_optional::<
2288 bool,
2289 fidl::encoding::DefaultFuchsiaResourceDialect,
2290 >(
2291 self.with_regulatory_region
2292 .as_ref()
2293 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2294 encoder,
2295 offset + cur_offset,
2296 depth,
2297 )?;
2298
2299 _prev_end_offset = cur_offset + envelope_size;
2300 if 3 > max_ordinal {
2301 return Ok(());
2302 }
2303
2304 let cur_offset: usize = (3 - 1) * envelope_size;
2307
2308 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2310
2311 fidl::encoding::encode_in_envelope_optional::<
2316 fidl::encoding::UnboundedString,
2317 fidl::encoding::DefaultFuchsiaResourceDialect,
2318 >(
2319 self.name.as_ref().map(
2320 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2321 ),
2322 encoder,
2323 offset + cur_offset,
2324 depth,
2325 )?;
2326
2327 _prev_end_offset = cur_offset + envelope_size;
2328 if 4 > max_ordinal {
2329 return Ok(());
2330 }
2331
2332 let cur_offset: usize = (4 - 1) * envelope_size;
2335
2336 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2338
2339 fidl::encoding::encode_in_envelope_optional::<
2344 TraceManagerHermeticity,
2345 fidl::encoding::DefaultFuchsiaResourceDialect,
2346 >(
2347 self.trace_manager_hermeticity
2348 .as_ref()
2349 .map(<TraceManagerHermeticity as fidl::encoding::ValueTypeMarker>::borrow),
2350 encoder,
2351 offset + cur_offset,
2352 depth,
2353 )?;
2354
2355 _prev_end_offset = cur_offset + envelope_size;
2356
2357 Ok(())
2358 }
2359 }
2360
2361 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WlanConfig {
2362 #[inline(always)]
2363 fn new_empty() -> Self {
2364 Self::default()
2365 }
2366
2367 unsafe fn decode(
2368 &mut self,
2369 decoder: &mut fidl::encoding::Decoder<
2370 '_,
2371 fidl::encoding::DefaultFuchsiaResourceDialect,
2372 >,
2373 offset: usize,
2374 mut depth: fidl::encoding::Depth,
2375 ) -> fidl::Result<()> {
2376 decoder.debug_check_bounds::<Self>(offset);
2377 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2378 None => return Err(fidl::Error::NotNullable),
2379 Some(len) => len,
2380 };
2381 if len == 0 {
2383 return Ok(());
2384 };
2385 depth.increment()?;
2386 let envelope_size = 8;
2387 let bytes_len = len * envelope_size;
2388 let offset = decoder.out_of_line_offset(bytes_len)?;
2389 let mut _next_ordinal_to_read = 0;
2391 let mut next_offset = offset;
2392 let end_offset = offset + bytes_len;
2393 _next_ordinal_to_read += 1;
2394 if next_offset >= end_offset {
2395 return Ok(());
2396 }
2397
2398 while _next_ordinal_to_read < 1 {
2400 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2401 _next_ordinal_to_read += 1;
2402 next_offset += envelope_size;
2403 }
2404
2405 let next_out_of_line = decoder.next_out_of_line();
2406 let handles_before = decoder.remaining_handles();
2407 if let Some((inlined, num_bytes, num_handles)) =
2408 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2409 {
2410 let member_inline_size =
2411 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2412 if inlined != (member_inline_size <= 4) {
2413 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2414 }
2415 let inner_offset;
2416 let mut inner_depth = depth.clone();
2417 if inlined {
2418 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2419 inner_offset = next_offset;
2420 } else {
2421 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2422 inner_depth.increment()?;
2423 }
2424 let val_ref = self.use_legacy_privacy.get_or_insert_with(|| {
2425 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2426 });
2427 fidl::decode!(
2428 bool,
2429 fidl::encoding::DefaultFuchsiaResourceDialect,
2430 val_ref,
2431 decoder,
2432 inner_offset,
2433 inner_depth
2434 )?;
2435 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2436 {
2437 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2438 }
2439 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2440 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2441 }
2442 }
2443
2444 next_offset += envelope_size;
2445 _next_ordinal_to_read += 1;
2446 if next_offset >= end_offset {
2447 return Ok(());
2448 }
2449
2450 while _next_ordinal_to_read < 2 {
2452 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2453 _next_ordinal_to_read += 1;
2454 next_offset += envelope_size;
2455 }
2456
2457 let next_out_of_line = decoder.next_out_of_line();
2458 let handles_before = decoder.remaining_handles();
2459 if let Some((inlined, num_bytes, num_handles)) =
2460 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2461 {
2462 let member_inline_size =
2463 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2464 if inlined != (member_inline_size <= 4) {
2465 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2466 }
2467 let inner_offset;
2468 let mut inner_depth = depth.clone();
2469 if inlined {
2470 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2471 inner_offset = next_offset;
2472 } else {
2473 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2474 inner_depth.increment()?;
2475 }
2476 let val_ref = self.with_regulatory_region.get_or_insert_with(|| {
2477 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2478 });
2479 fidl::decode!(
2480 bool,
2481 fidl::encoding::DefaultFuchsiaResourceDialect,
2482 val_ref,
2483 decoder,
2484 inner_offset,
2485 inner_depth
2486 )?;
2487 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2488 {
2489 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2490 }
2491 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2492 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2493 }
2494 }
2495
2496 next_offset += envelope_size;
2497 _next_ordinal_to_read += 1;
2498 if next_offset >= end_offset {
2499 return Ok(());
2500 }
2501
2502 while _next_ordinal_to_read < 3 {
2504 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2505 _next_ordinal_to_read += 1;
2506 next_offset += envelope_size;
2507 }
2508
2509 let next_out_of_line = decoder.next_out_of_line();
2510 let handles_before = decoder.remaining_handles();
2511 if let Some((inlined, num_bytes, num_handles)) =
2512 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2513 {
2514 let member_inline_size =
2515 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2516 decoder.context,
2517 );
2518 if inlined != (member_inline_size <= 4) {
2519 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2520 }
2521 let inner_offset;
2522 let mut inner_depth = depth.clone();
2523 if inlined {
2524 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2525 inner_offset = next_offset;
2526 } else {
2527 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2528 inner_depth.increment()?;
2529 }
2530 let val_ref = self.name.get_or_insert_with(|| {
2531 fidl::new_empty!(
2532 fidl::encoding::UnboundedString,
2533 fidl::encoding::DefaultFuchsiaResourceDialect
2534 )
2535 });
2536 fidl::decode!(
2537 fidl::encoding::UnboundedString,
2538 fidl::encoding::DefaultFuchsiaResourceDialect,
2539 val_ref,
2540 decoder,
2541 inner_offset,
2542 inner_depth
2543 )?;
2544 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2545 {
2546 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2547 }
2548 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2549 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2550 }
2551 }
2552
2553 next_offset += envelope_size;
2554 _next_ordinal_to_read += 1;
2555 if next_offset >= end_offset {
2556 return Ok(());
2557 }
2558
2559 while _next_ordinal_to_read < 4 {
2561 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2562 _next_ordinal_to_read += 1;
2563 next_offset += envelope_size;
2564 }
2565
2566 let next_out_of_line = decoder.next_out_of_line();
2567 let handles_before = decoder.remaining_handles();
2568 if let Some((inlined, num_bytes, num_handles)) =
2569 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2570 {
2571 let member_inline_size =
2572 <TraceManagerHermeticity as fidl::encoding::TypeMarker>::inline_size(
2573 decoder.context,
2574 );
2575 if inlined != (member_inline_size <= 4) {
2576 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2577 }
2578 let inner_offset;
2579 let mut inner_depth = depth.clone();
2580 if inlined {
2581 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2582 inner_offset = next_offset;
2583 } else {
2584 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2585 inner_depth.increment()?;
2586 }
2587 let val_ref = self.trace_manager_hermeticity.get_or_insert_with(|| {
2588 fidl::new_empty!(
2589 TraceManagerHermeticity,
2590 fidl::encoding::DefaultFuchsiaResourceDialect
2591 )
2592 });
2593 fidl::decode!(
2594 TraceManagerHermeticity,
2595 fidl::encoding::DefaultFuchsiaResourceDialect,
2596 val_ref,
2597 decoder,
2598 inner_offset,
2599 inner_depth
2600 )?;
2601 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2602 {
2603 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2604 }
2605 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2606 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2607 }
2608 }
2609
2610 next_offset += envelope_size;
2611
2612 while next_offset < end_offset {
2614 _next_ordinal_to_read += 1;
2615 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2616 next_offset += envelope_size;
2617 }
2618
2619 Ok(())
2620 }
2621 }
2622
2623 impl fidl::encoding::ResourceTypeMarker for Topology {
2624 type Borrowed<'a> = &'a mut Self;
2625 fn take_or_borrow<'a>(
2626 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2627 ) -> Self::Borrowed<'a> {
2628 value
2629 }
2630 }
2631
2632 unsafe impl fidl::encoding::TypeMarker for Topology {
2633 type Owned = Self;
2634
2635 #[inline(always)]
2636 fn inline_align(_context: fidl::encoding::Context) -> usize {
2637 8
2638 }
2639
2640 #[inline(always)]
2641 fn inline_size(_context: fidl::encoding::Context) -> usize {
2642 16
2643 }
2644 }
2645
2646 unsafe impl fidl::encoding::Encode<Topology, fidl::encoding::DefaultFuchsiaResourceDialect>
2647 for &mut Topology
2648 {
2649 #[inline]
2650 unsafe fn encode(
2651 self,
2652 encoder: &mut fidl::encoding::Encoder<
2653 '_,
2654 fidl::encoding::DefaultFuchsiaResourceDialect,
2655 >,
2656 offset: usize,
2657 _depth: fidl::encoding::Depth,
2658 ) -> fidl::Result<()> {
2659 encoder.debug_check_bounds::<Topology>(offset);
2660 encoder.write_num::<u64>(self.ordinal(), offset);
2661 match self {
2662 Topology::DriversOnly(ref mut val) => fidl::encoding::encode_in_envelope::<
2663 DriversOnly,
2664 fidl::encoding::DefaultFuchsiaResourceDialect,
2665 >(
2666 <DriversOnly as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2667 encoder,
2668 offset + 8,
2669 _depth,
2670 ),
2671 Topology::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2672 }
2673 }
2674 }
2675
2676 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Topology {
2677 #[inline(always)]
2678 fn new_empty() -> Self {
2679 Self::__SourceBreaking { unknown_ordinal: 0 }
2680 }
2681
2682 #[inline]
2683 unsafe fn decode(
2684 &mut self,
2685 decoder: &mut fidl::encoding::Decoder<
2686 '_,
2687 fidl::encoding::DefaultFuchsiaResourceDialect,
2688 >,
2689 offset: usize,
2690 mut depth: fidl::encoding::Depth,
2691 ) -> fidl::Result<()> {
2692 decoder.debug_check_bounds::<Self>(offset);
2693 #[allow(unused_variables)]
2694 let next_out_of_line = decoder.next_out_of_line();
2695 let handles_before = decoder.remaining_handles();
2696 let (ordinal, inlined, num_bytes, num_handles) =
2697 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2698
2699 let member_inline_size = match ordinal {
2700 1 => <DriversOnly as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2701 0 => return Err(fidl::Error::UnknownUnionTag),
2702 _ => num_bytes as usize,
2703 };
2704
2705 if inlined != (member_inline_size <= 4) {
2706 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2707 }
2708 let _inner_offset;
2709 if inlined {
2710 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2711 _inner_offset = offset + 8;
2712 } else {
2713 depth.increment()?;
2714 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2715 }
2716 match ordinal {
2717 1 => {
2718 #[allow(irrefutable_let_patterns)]
2719 if let Topology::DriversOnly(_) = self {
2720 } else {
2722 *self = Topology::DriversOnly(fidl::new_empty!(
2724 DriversOnly,
2725 fidl::encoding::DefaultFuchsiaResourceDialect
2726 ));
2727 }
2728 #[allow(irrefutable_let_patterns)]
2729 if let Topology::DriversOnly(ref mut val) = self {
2730 fidl::decode!(
2731 DriversOnly,
2732 fidl::encoding::DefaultFuchsiaResourceDialect,
2733 val,
2734 decoder,
2735 _inner_offset,
2736 depth
2737 )?;
2738 } else {
2739 unreachable!()
2740 }
2741 }
2742 #[allow(deprecated)]
2743 ordinal => {
2744 for _ in 0..num_handles {
2745 decoder.drop_next_handle()?;
2746 }
2747 *self = Topology::__SourceBreaking { unknown_ordinal: ordinal };
2748 }
2749 }
2750 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2751 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2752 }
2753 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2754 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2755 }
2756 Ok(())
2757 }
2758 }
2759}