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