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 RealmFactoryCreateRealm3Request {
27 pub options: RealmOptions,
28 pub dictionary: fidl::EventPair,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for RealmFactoryCreateRealm3Request
33{
34}
35
36#[derive(Debug, PartialEq)]
37pub struct RealmFactoryCreateRealmRequest {
38 pub options: RealmOptions,
39 pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for RealmFactoryCreateRealmRequest
44{
45}
46
47#[derive(Debug, Default, PartialEq)]
49pub struct DriverConfig {
50 pub dev_topological: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
53 pub dev_class: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
54 pub driver_test_realm_start_args: Option<fidl_fuchsia_driver_test::RealmArgs>,
57 #[doc(hidden)]
58 pub __source_breaking: fidl::marker::SourceBreaking,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverConfig {}
62
63#[derive(Debug, Default, PartialEq)]
64pub struct DriversOnly {
65 pub driver_config: Option<DriverConfig>,
66 #[doc(hidden)]
67 pub __source_breaking: fidl::marker::SourceBreaking,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriversOnly {}
71
72#[derive(Debug, Default, PartialEq)]
74pub struct RealmOptions {
75 pub devfs_server_end: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
76 pub wlan_config: Option<WlanConfig>,
77 pub topology: Option<Topology>,
82 #[doc(hidden)]
83 pub __source_breaking: fidl::marker::SourceBreaking,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
87
88#[derive(Debug, Default, PartialEq)]
90pub struct WlanConfig {
91 pub use_legacy_privacy: Option<bool>,
94 pub with_regulatory_region: Option<bool>,
97 pub name: Option<String>,
102 pub trace_manager_hermeticity: Option<TraceManagerHermeticity>,
108 #[doc(hidden)]
109 pub __source_breaking: fidl::marker::SourceBreaking,
110}
111
112impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanConfig {}
113
114#[derive(Debug)]
118pub enum Topology {
119 DriversOnly(DriversOnly),
124 #[doc(hidden)]
125 __SourceBreaking { unknown_ordinal: u64 },
126}
127
128#[macro_export]
130macro_rules! TopologyUnknown {
131 () => {
132 _
133 };
134}
135
136impl PartialEq for Topology {
138 fn eq(&self, other: &Self) -> bool {
139 match (self, other) {
140 (Self::DriversOnly(x), Self::DriversOnly(y)) => *x == *y,
141 _ => false,
142 }
143 }
144}
145
146impl Topology {
147 #[inline]
148 pub fn ordinal(&self) -> u64 {
149 match *self {
150 Self::DriversOnly(_) => 1,
151 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
152 }
153 }
154
155 #[inline]
156 pub fn unknown_variant_for_testing() -> Self {
157 Self::__SourceBreaking { unknown_ordinal: 0 }
158 }
159
160 #[inline]
161 pub fn is_unknown(&self) -> bool {
162 match self {
163 Self::__SourceBreaking { .. } => true,
164 _ => false,
165 }
166 }
167}
168
169impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Topology {}
170
171#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
172pub struct RealmFactoryMarker;
173
174impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
175 type Proxy = RealmFactoryProxy;
176 type RequestStream = RealmFactoryRequestStream;
177 #[cfg(target_os = "fuchsia")]
178 type SynchronousProxy = RealmFactorySynchronousProxy;
179
180 const DEBUG_NAME: &'static str = "test.wlan.realm.RealmFactory";
181}
182impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
183pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
184pub type RealmFactoryCreateRealm2Result = Result<(), fidl_fuchsia_testing_harness::OperationError>;
185pub type RealmFactoryCreateRealm3Result = Result<(), fidl_fuchsia_testing_harness::OperationError>;
186
187pub trait RealmFactoryProxyInterface: Send + Sync {
188 type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
189 + Send;
190 fn r#create_realm(
191 &self,
192 options: RealmOptions,
193 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
194 ) -> Self::CreateRealmResponseFut;
195 type CreateRealm2ResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealm2Result, fidl::Error>>
196 + Send;
197 fn r#create_realm2(
198 &self,
199 options: RealmOptions,
200 dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
201 ) -> Self::CreateRealm2ResponseFut;
202 type CreateRealm3ResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealm3Result, fidl::Error>>
203 + Send;
204 fn r#create_realm3(
205 &self,
206 options: RealmOptions,
207 dictionary: fidl::EventPair,
208 ) -> Self::CreateRealm3ResponseFut;
209}
210#[derive(Debug)]
211#[cfg(target_os = "fuchsia")]
212pub struct RealmFactorySynchronousProxy {
213 client: fidl::client::sync::Client,
214}
215
216#[cfg(target_os = "fuchsia")]
217impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
218 type Proxy = RealmFactoryProxy;
219 type Protocol = RealmFactoryMarker;
220
221 fn from_channel(inner: fidl::Channel) -> Self {
222 Self::new(inner)
223 }
224
225 fn into_channel(self) -> fidl::Channel {
226 self.client.into_channel()
227 }
228
229 fn as_channel(&self) -> &fidl::Channel {
230 self.client.as_channel()
231 }
232}
233
234#[cfg(target_os = "fuchsia")]
235impl RealmFactorySynchronousProxy {
236 pub fn new(channel: fidl::Channel) -> Self {
237 Self { client: fidl::client::sync::Client::new(channel) }
238 }
239
240 pub fn into_channel(self) -> fidl::Channel {
241 self.client.into_channel()
242 }
243
244 pub fn wait_for_event(
247 &self,
248 deadline: zx::MonotonicInstant,
249 ) -> Result<RealmFactoryEvent, fidl::Error> {
250 RealmFactoryEvent::decode(self.client.wait_for_event::<RealmFactoryMarker>(deadline)?)
251 }
252
253 pub fn r#create_realm(
255 &self,
256 mut options: RealmOptions,
257 mut realm_server: fidl::endpoints::ServerEnd<
258 fidl_fuchsia_testing_harness::RealmProxy_Marker,
259 >,
260 ___deadline: zx::MonotonicInstant,
261 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
262 let _response = self
263 .client
264 .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
265 fidl::encoding::EmptyStruct,
266 fidl_fuchsia_testing_harness::OperationError,
267 >, RealmFactoryMarker>(
268 (&mut options, realm_server),
269 0x51aac08d328c3ae4,
270 fidl::encoding::DynamicFlags::FLEXIBLE,
271 ___deadline,
272 )?
273 .into_result::<RealmFactoryMarker>("create_realm")?;
274 Ok(_response.map(|x| x))
275 }
276
277 pub fn r#create_realm2(
279 &self,
280 mut options: RealmOptions,
281 mut dictionary: fidl::endpoints::ServerEnd<
282 fidl_fuchsia_component_sandbox::DictionaryMarker,
283 >,
284 ___deadline: zx::MonotonicInstant,
285 ) -> Result<RealmFactoryCreateRealm2Result, fidl::Error> {
286 let _response = self
287 .client
288 .send_query::<RealmFactoryCreateRealm2Request, fidl::encoding::FlexibleResultType<
289 fidl::encoding::EmptyStruct,
290 fidl_fuchsia_testing_harness::OperationError,
291 >, RealmFactoryMarker>(
292 (&mut options, dictionary),
293 0x29dd599835927548,
294 fidl::encoding::DynamicFlags::FLEXIBLE,
295 ___deadline,
296 )?
297 .into_result::<RealmFactoryMarker>("create_realm2")?;
298 Ok(_response.map(|x| x))
299 }
300
301 pub fn r#create_realm3(
303 &self,
304 mut options: RealmOptions,
305 mut dictionary: fidl::EventPair,
306 ___deadline: zx::MonotonicInstant,
307 ) -> Result<RealmFactoryCreateRealm3Result, fidl::Error> {
308 let _response = self
309 .client
310 .send_query::<RealmFactoryCreateRealm3Request, fidl::encoding::FlexibleResultType<
311 fidl::encoding::EmptyStruct,
312 fidl_fuchsia_testing_harness::OperationError,
313 >, RealmFactoryMarker>(
314 (&mut options, dictionary),
315 0x616e6a3aeda970e9,
316 fidl::encoding::DynamicFlags::FLEXIBLE,
317 ___deadline,
318 )?
319 .into_result::<RealmFactoryMarker>("create_realm3")?;
320 Ok(_response.map(|x| x))
321 }
322}
323
324#[cfg(target_os = "fuchsia")]
325impl From<RealmFactorySynchronousProxy> for zx::NullableHandle {
326 fn from(value: RealmFactorySynchronousProxy) -> Self {
327 value.into_channel().into()
328 }
329}
330
331#[cfg(target_os = "fuchsia")]
332impl From<fidl::Channel> for RealmFactorySynchronousProxy {
333 fn from(value: fidl::Channel) -> Self {
334 Self::new(value)
335 }
336}
337
338#[cfg(target_os = "fuchsia")]
339impl fidl::endpoints::FromClient for RealmFactorySynchronousProxy {
340 type Protocol = RealmFactoryMarker;
341
342 fn from_client(value: fidl::endpoints::ClientEnd<RealmFactoryMarker>) -> Self {
343 Self::new(value.into_channel())
344 }
345}
346
347#[derive(Debug, Clone)]
348pub struct RealmFactoryProxy {
349 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
350}
351
352impl fidl::endpoints::Proxy for RealmFactoryProxy {
353 type Protocol = RealmFactoryMarker;
354
355 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
356 Self::new(inner)
357 }
358
359 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
360 self.client.into_channel().map_err(|client| Self { client })
361 }
362
363 fn as_channel(&self) -> &::fidl::AsyncChannel {
364 self.client.as_channel()
365 }
366}
367
368impl RealmFactoryProxy {
369 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
371 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
372 Self { client: fidl::client::Client::new(channel, protocol_name) }
373 }
374
375 pub fn take_event_stream(&self) -> RealmFactoryEventStream {
381 RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
382 }
383
384 pub fn r#create_realm(
386 &self,
387 mut options: RealmOptions,
388 mut realm_server: fidl::endpoints::ServerEnd<
389 fidl_fuchsia_testing_harness::RealmProxy_Marker,
390 >,
391 ) -> fidl::client::QueryResponseFut<
392 RealmFactoryCreateRealmResult,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 > {
395 RealmFactoryProxyInterface::r#create_realm(self, options, realm_server)
396 }
397
398 pub fn r#create_realm2(
400 &self,
401 mut options: RealmOptions,
402 mut dictionary: fidl::endpoints::ServerEnd<
403 fidl_fuchsia_component_sandbox::DictionaryMarker,
404 >,
405 ) -> fidl::client::QueryResponseFut<
406 RealmFactoryCreateRealm2Result,
407 fidl::encoding::DefaultFuchsiaResourceDialect,
408 > {
409 RealmFactoryProxyInterface::r#create_realm2(self, options, dictionary)
410 }
411
412 pub fn r#create_realm3(
414 &self,
415 mut options: RealmOptions,
416 mut dictionary: fidl::EventPair,
417 ) -> fidl::client::QueryResponseFut<
418 RealmFactoryCreateRealm3Result,
419 fidl::encoding::DefaultFuchsiaResourceDialect,
420 > {
421 RealmFactoryProxyInterface::r#create_realm3(self, options, dictionary)
422 }
423}
424
425impl RealmFactoryProxyInterface for RealmFactoryProxy {
426 type CreateRealmResponseFut = fidl::client::QueryResponseFut<
427 RealmFactoryCreateRealmResult,
428 fidl::encoding::DefaultFuchsiaResourceDialect,
429 >;
430 fn r#create_realm(
431 &self,
432 mut options: RealmOptions,
433 mut realm_server: fidl::endpoints::ServerEnd<
434 fidl_fuchsia_testing_harness::RealmProxy_Marker,
435 >,
436 ) -> Self::CreateRealmResponseFut {
437 fn _decode(
438 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
439 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
440 let _response = fidl::client::decode_transaction_body::<
441 fidl::encoding::FlexibleResultType<
442 fidl::encoding::EmptyStruct,
443 fidl_fuchsia_testing_harness::OperationError,
444 >,
445 fidl::encoding::DefaultFuchsiaResourceDialect,
446 0x51aac08d328c3ae4,
447 >(_buf?)?
448 .into_result::<RealmFactoryMarker>("create_realm")?;
449 Ok(_response.map(|x| x))
450 }
451 self.client
452 .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
453 (&mut options, realm_server),
454 0x51aac08d328c3ae4,
455 fidl::encoding::DynamicFlags::FLEXIBLE,
456 _decode,
457 )
458 }
459
460 type CreateRealm2ResponseFut = fidl::client::QueryResponseFut<
461 RealmFactoryCreateRealm2Result,
462 fidl::encoding::DefaultFuchsiaResourceDialect,
463 >;
464 fn r#create_realm2(
465 &self,
466 mut options: RealmOptions,
467 mut dictionary: fidl::endpoints::ServerEnd<
468 fidl_fuchsia_component_sandbox::DictionaryMarker,
469 >,
470 ) -> Self::CreateRealm2ResponseFut {
471 fn _decode(
472 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
473 ) -> Result<RealmFactoryCreateRealm2Result, fidl::Error> {
474 let _response = fidl::client::decode_transaction_body::<
475 fidl::encoding::FlexibleResultType<
476 fidl::encoding::EmptyStruct,
477 fidl_fuchsia_testing_harness::OperationError,
478 >,
479 fidl::encoding::DefaultFuchsiaResourceDialect,
480 0x29dd599835927548,
481 >(_buf?)?
482 .into_result::<RealmFactoryMarker>("create_realm2")?;
483 Ok(_response.map(|x| x))
484 }
485 self.client.send_query_and_decode::<
486 RealmFactoryCreateRealm2Request,
487 RealmFactoryCreateRealm2Result,
488 >(
489 (&mut options, dictionary,),
490 0x29dd599835927548,
491 fidl::encoding::DynamicFlags::FLEXIBLE,
492 _decode,
493 )
494 }
495
496 type CreateRealm3ResponseFut = fidl::client::QueryResponseFut<
497 RealmFactoryCreateRealm3Result,
498 fidl::encoding::DefaultFuchsiaResourceDialect,
499 >;
500 fn r#create_realm3(
501 &self,
502 mut options: RealmOptions,
503 mut dictionary: fidl::EventPair,
504 ) -> Self::CreateRealm3ResponseFut {
505 fn _decode(
506 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
507 ) -> Result<RealmFactoryCreateRealm3Result, fidl::Error> {
508 let _response = fidl::client::decode_transaction_body::<
509 fidl::encoding::FlexibleResultType<
510 fidl::encoding::EmptyStruct,
511 fidl_fuchsia_testing_harness::OperationError,
512 >,
513 fidl::encoding::DefaultFuchsiaResourceDialect,
514 0x616e6a3aeda970e9,
515 >(_buf?)?
516 .into_result::<RealmFactoryMarker>("create_realm3")?;
517 Ok(_response.map(|x| x))
518 }
519 self.client.send_query_and_decode::<
520 RealmFactoryCreateRealm3Request,
521 RealmFactoryCreateRealm3Result,
522 >(
523 (&mut options, dictionary,),
524 0x616e6a3aeda970e9,
525 fidl::encoding::DynamicFlags::FLEXIBLE,
526 _decode,
527 )
528 }
529}
530
531pub struct RealmFactoryEventStream {
532 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
533}
534
535impl std::marker::Unpin for RealmFactoryEventStream {}
536
537impl futures::stream::FusedStream for RealmFactoryEventStream {
538 fn is_terminated(&self) -> bool {
539 self.event_receiver.is_terminated()
540 }
541}
542
543impl futures::Stream for RealmFactoryEventStream {
544 type Item = Result<RealmFactoryEvent, fidl::Error>;
545
546 fn poll_next(
547 mut self: std::pin::Pin<&mut Self>,
548 cx: &mut std::task::Context<'_>,
549 ) -> std::task::Poll<Option<Self::Item>> {
550 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
551 &mut self.event_receiver,
552 cx
553 )?) {
554 Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
555 None => std::task::Poll::Ready(None),
556 }
557 }
558}
559
560#[derive(Debug)]
561pub enum RealmFactoryEvent {
562 #[non_exhaustive]
563 _UnknownEvent {
564 ordinal: u64,
566 },
567}
568
569impl RealmFactoryEvent {
570 fn decode(
572 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
573 ) -> Result<RealmFactoryEvent, fidl::Error> {
574 let (bytes, _handles) = buf.split_mut();
575 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
576 debug_assert_eq!(tx_header.tx_id, 0);
577 match tx_header.ordinal {
578 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
579 Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
580 }
581 _ => Err(fidl::Error::UnknownOrdinal {
582 ordinal: tx_header.ordinal,
583 protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
584 }),
585 }
586 }
587}
588
589pub struct RealmFactoryRequestStream {
591 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592 is_terminated: bool,
593}
594
595impl std::marker::Unpin for RealmFactoryRequestStream {}
596
597impl futures::stream::FusedStream for RealmFactoryRequestStream {
598 fn is_terminated(&self) -> bool {
599 self.is_terminated
600 }
601}
602
603impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
604 type Protocol = RealmFactoryMarker;
605 type ControlHandle = RealmFactoryControlHandle;
606
607 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
608 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
609 }
610
611 fn control_handle(&self) -> Self::ControlHandle {
612 RealmFactoryControlHandle { inner: self.inner.clone() }
613 }
614
615 fn into_inner(
616 self,
617 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
618 {
619 (self.inner, self.is_terminated)
620 }
621
622 fn from_inner(
623 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
624 is_terminated: bool,
625 ) -> Self {
626 Self { inner, is_terminated }
627 }
628}
629
630impl futures::Stream for RealmFactoryRequestStream {
631 type Item = Result<RealmFactoryRequest, fidl::Error>;
632
633 fn poll_next(
634 mut self: std::pin::Pin<&mut Self>,
635 cx: &mut std::task::Context<'_>,
636 ) -> std::task::Poll<Option<Self::Item>> {
637 let this = &mut *self;
638 if this.inner.check_shutdown(cx) {
639 this.is_terminated = true;
640 return std::task::Poll::Ready(None);
641 }
642 if this.is_terminated {
643 panic!("polled RealmFactoryRequestStream after completion");
644 }
645 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
646 |bytes, handles| {
647 match this.inner.channel().read_etc(cx, bytes, handles) {
648 std::task::Poll::Ready(Ok(())) => {}
649 std::task::Poll::Pending => return std::task::Poll::Pending,
650 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
651 this.is_terminated = true;
652 return std::task::Poll::Ready(None);
653 }
654 std::task::Poll::Ready(Err(e)) => {
655 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
656 e.into(),
657 ))));
658 }
659 }
660
661 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
663
664 std::task::Poll::Ready(Some(match header.ordinal {
665 0x51aac08d328c3ae4 => {
666 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
667 let mut req = fidl::new_empty!(
668 RealmFactoryCreateRealmRequest,
669 fidl::encoding::DefaultFuchsiaResourceDialect
670 );
671 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
672 let control_handle =
673 RealmFactoryControlHandle { inner: this.inner.clone() };
674 Ok(RealmFactoryRequest::CreateRealm {
675 options: req.options,
676 realm_server: req.realm_server,
677
678 responder: RealmFactoryCreateRealmResponder {
679 control_handle: std::mem::ManuallyDrop::new(control_handle),
680 tx_id: header.tx_id,
681 },
682 })
683 }
684 0x29dd599835927548 => {
685 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
686 let mut req = fidl::new_empty!(
687 RealmFactoryCreateRealm2Request,
688 fidl::encoding::DefaultFuchsiaResourceDialect
689 );
690 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealm2Request>(&header, _body_bytes, handles, &mut req)?;
691 let control_handle =
692 RealmFactoryControlHandle { inner: this.inner.clone() };
693 Ok(RealmFactoryRequest::CreateRealm2 {
694 options: req.options,
695 dictionary: req.dictionary,
696
697 responder: RealmFactoryCreateRealm2Responder {
698 control_handle: std::mem::ManuallyDrop::new(control_handle),
699 tx_id: header.tx_id,
700 },
701 })
702 }
703 0x616e6a3aeda970e9 => {
704 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
705 let mut req = fidl::new_empty!(
706 RealmFactoryCreateRealm3Request,
707 fidl::encoding::DefaultFuchsiaResourceDialect
708 );
709 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealm3Request>(&header, _body_bytes, handles, &mut req)?;
710 let control_handle =
711 RealmFactoryControlHandle { inner: this.inner.clone() };
712 Ok(RealmFactoryRequest::CreateRealm3 {
713 options: req.options,
714 dictionary: req.dictionary,
715
716 responder: RealmFactoryCreateRealm3Responder {
717 control_handle: std::mem::ManuallyDrop::new(control_handle),
718 tx_id: header.tx_id,
719 },
720 })
721 }
722 _ if header.tx_id == 0
723 && header
724 .dynamic_flags()
725 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
726 {
727 Ok(RealmFactoryRequest::_UnknownMethod {
728 ordinal: header.ordinal,
729 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
730 method_type: fidl::MethodType::OneWay,
731 })
732 }
733 _ if header
734 .dynamic_flags()
735 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
736 {
737 this.inner.send_framework_err(
738 fidl::encoding::FrameworkErr::UnknownMethod,
739 header.tx_id,
740 header.ordinal,
741 header.dynamic_flags(),
742 (bytes, handles),
743 )?;
744 Ok(RealmFactoryRequest::_UnknownMethod {
745 ordinal: header.ordinal,
746 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
747 method_type: fidl::MethodType::TwoWay,
748 })
749 }
750 _ => Err(fidl::Error::UnknownOrdinal {
751 ordinal: header.ordinal,
752 protocol_name:
753 <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
754 }),
755 }))
756 },
757 )
758 }
759}
760
761#[derive(Debug)]
762pub enum RealmFactoryRequest {
763 CreateRealm {
765 options: RealmOptions,
766 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
767 responder: RealmFactoryCreateRealmResponder,
768 },
769 CreateRealm2 {
771 options: RealmOptions,
772 dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
773 responder: RealmFactoryCreateRealm2Responder,
774 },
775 CreateRealm3 {
777 options: RealmOptions,
778 dictionary: fidl::EventPair,
779 responder: RealmFactoryCreateRealm3Responder,
780 },
781 #[non_exhaustive]
783 _UnknownMethod {
784 ordinal: u64,
786 control_handle: RealmFactoryControlHandle,
787 method_type: fidl::MethodType,
788 },
789}
790
791impl RealmFactoryRequest {
792 #[allow(irrefutable_let_patterns)]
793 pub fn into_create_realm(
794 self,
795 ) -> Option<(
796 RealmOptions,
797 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
798 RealmFactoryCreateRealmResponder,
799 )> {
800 if let RealmFactoryRequest::CreateRealm { options, realm_server, responder } = self {
801 Some((options, realm_server, responder))
802 } else {
803 None
804 }
805 }
806
807 #[allow(irrefutable_let_patterns)]
808 pub fn into_create_realm2(
809 self,
810 ) -> Option<(
811 RealmOptions,
812 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
813 RealmFactoryCreateRealm2Responder,
814 )> {
815 if let RealmFactoryRequest::CreateRealm2 { options, dictionary, responder } = self {
816 Some((options, dictionary, responder))
817 } else {
818 None
819 }
820 }
821
822 #[allow(irrefutable_let_patterns)]
823 pub fn into_create_realm3(
824 self,
825 ) -> Option<(RealmOptions, fidl::EventPair, RealmFactoryCreateRealm3Responder)> {
826 if let RealmFactoryRequest::CreateRealm3 { options, dictionary, responder } = self {
827 Some((options, dictionary, responder))
828 } else {
829 None
830 }
831 }
832
833 pub fn method_name(&self) -> &'static str {
835 match *self {
836 RealmFactoryRequest::CreateRealm { .. } => "create_realm",
837 RealmFactoryRequest::CreateRealm2 { .. } => "create_realm2",
838 RealmFactoryRequest::CreateRealm3 { .. } => "create_realm3",
839 RealmFactoryRequest::_UnknownMethod {
840 method_type: fidl::MethodType::OneWay, ..
841 } => "unknown one-way method",
842 RealmFactoryRequest::_UnknownMethod {
843 method_type: fidl::MethodType::TwoWay, ..
844 } => "unknown two-way method",
845 }
846 }
847}
848
849#[derive(Debug, Clone)]
850pub struct RealmFactoryControlHandle {
851 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
852}
853
854impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
855 fn shutdown(&self) {
856 self.inner.shutdown()
857 }
858
859 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
860 self.inner.shutdown_with_epitaph(status)
861 }
862
863 fn is_closed(&self) -> bool {
864 self.inner.channel().is_closed()
865 }
866 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
867 self.inner.channel().on_closed()
868 }
869
870 #[cfg(target_os = "fuchsia")]
871 fn signal_peer(
872 &self,
873 clear_mask: zx::Signals,
874 set_mask: zx::Signals,
875 ) -> Result<(), zx_status::Status> {
876 use fidl::Peered;
877 self.inner.channel().signal_peer(clear_mask, set_mask)
878 }
879}
880
881impl RealmFactoryControlHandle {}
882
883#[must_use = "FIDL methods require a response to be sent"]
884#[derive(Debug)]
885pub struct RealmFactoryCreateRealmResponder {
886 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
887 tx_id: u32,
888}
889
890impl std::ops::Drop for RealmFactoryCreateRealmResponder {
894 fn drop(&mut self) {
895 self.control_handle.shutdown();
896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
898 }
899}
900
901impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
902 type ControlHandle = RealmFactoryControlHandle;
903
904 fn control_handle(&self) -> &RealmFactoryControlHandle {
905 &self.control_handle
906 }
907
908 fn drop_without_shutdown(mut self) {
909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
911 std::mem::forget(self);
913 }
914}
915
916impl RealmFactoryCreateRealmResponder {
917 pub fn send(
921 self,
922 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
923 ) -> Result<(), fidl::Error> {
924 let _result = self.send_raw(result);
925 if _result.is_err() {
926 self.control_handle.shutdown();
927 }
928 self.drop_without_shutdown();
929 _result
930 }
931
932 pub fn send_no_shutdown_on_err(
934 self,
935 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
936 ) -> Result<(), fidl::Error> {
937 let _result = self.send_raw(result);
938 self.drop_without_shutdown();
939 _result
940 }
941
942 fn send_raw(
943 &self,
944 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
945 ) -> Result<(), fidl::Error> {
946 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
947 fidl::encoding::EmptyStruct,
948 fidl_fuchsia_testing_harness::OperationError,
949 >>(
950 fidl::encoding::FlexibleResult::new(result),
951 self.tx_id,
952 0x51aac08d328c3ae4,
953 fidl::encoding::DynamicFlags::FLEXIBLE,
954 )
955 }
956}
957
958#[must_use = "FIDL methods require a response to be sent"]
959#[derive(Debug)]
960pub struct RealmFactoryCreateRealm2Responder {
961 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
962 tx_id: u32,
963}
964
965impl std::ops::Drop for RealmFactoryCreateRealm2Responder {
969 fn drop(&mut self) {
970 self.control_handle.shutdown();
971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973 }
974}
975
976impl fidl::endpoints::Responder for RealmFactoryCreateRealm2Responder {
977 type ControlHandle = RealmFactoryControlHandle;
978
979 fn control_handle(&self) -> &RealmFactoryControlHandle {
980 &self.control_handle
981 }
982
983 fn drop_without_shutdown(mut self) {
984 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
986 std::mem::forget(self);
988 }
989}
990
991impl RealmFactoryCreateRealm2Responder {
992 pub fn send(
996 self,
997 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
998 ) -> Result<(), fidl::Error> {
999 let _result = self.send_raw(result);
1000 if _result.is_err() {
1001 self.control_handle.shutdown();
1002 }
1003 self.drop_without_shutdown();
1004 _result
1005 }
1006
1007 pub fn send_no_shutdown_on_err(
1009 self,
1010 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1011 ) -> Result<(), fidl::Error> {
1012 let _result = self.send_raw(result);
1013 self.drop_without_shutdown();
1014 _result
1015 }
1016
1017 fn send_raw(
1018 &self,
1019 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1020 ) -> Result<(), fidl::Error> {
1021 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1022 fidl::encoding::EmptyStruct,
1023 fidl_fuchsia_testing_harness::OperationError,
1024 >>(
1025 fidl::encoding::FlexibleResult::new(result),
1026 self.tx_id,
1027 0x29dd599835927548,
1028 fidl::encoding::DynamicFlags::FLEXIBLE,
1029 )
1030 }
1031}
1032
1033#[must_use = "FIDL methods require a response to be sent"]
1034#[derive(Debug)]
1035pub struct RealmFactoryCreateRealm3Responder {
1036 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
1037 tx_id: u32,
1038}
1039
1040impl std::ops::Drop for RealmFactoryCreateRealm3Responder {
1044 fn drop(&mut self) {
1045 self.control_handle.shutdown();
1046 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1048 }
1049}
1050
1051impl fidl::endpoints::Responder for RealmFactoryCreateRealm3Responder {
1052 type ControlHandle = RealmFactoryControlHandle;
1053
1054 fn control_handle(&self) -> &RealmFactoryControlHandle {
1055 &self.control_handle
1056 }
1057
1058 fn drop_without_shutdown(mut self) {
1059 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1061 std::mem::forget(self);
1063 }
1064}
1065
1066impl RealmFactoryCreateRealm3Responder {
1067 pub fn send(
1071 self,
1072 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1073 ) -> Result<(), fidl::Error> {
1074 let _result = self.send_raw(result);
1075 if _result.is_err() {
1076 self.control_handle.shutdown();
1077 }
1078 self.drop_without_shutdown();
1079 _result
1080 }
1081
1082 pub fn send_no_shutdown_on_err(
1084 self,
1085 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1086 ) -> Result<(), fidl::Error> {
1087 let _result = self.send_raw(result);
1088 self.drop_without_shutdown();
1089 _result
1090 }
1091
1092 fn send_raw(
1093 &self,
1094 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1095 ) -> Result<(), fidl::Error> {
1096 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1097 fidl::encoding::EmptyStruct,
1098 fidl_fuchsia_testing_harness::OperationError,
1099 >>(
1100 fidl::encoding::FlexibleResult::new(result),
1101 self.tx_id,
1102 0x616e6a3aeda970e9,
1103 fidl::encoding::DynamicFlags::FLEXIBLE,
1104 )
1105 }
1106}
1107
1108mod internal {
1109 use super::*;
1110
1111 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealm2Request {
1112 type Borrowed<'a> = &'a mut Self;
1113 fn take_or_borrow<'a>(
1114 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1115 ) -> Self::Borrowed<'a> {
1116 value
1117 }
1118 }
1119
1120 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealm2Request {
1121 type Owned = Self;
1122
1123 #[inline(always)]
1124 fn inline_align(_context: fidl::encoding::Context) -> usize {
1125 8
1126 }
1127
1128 #[inline(always)]
1129 fn inline_size(_context: fidl::encoding::Context) -> usize {
1130 24
1131 }
1132 }
1133
1134 unsafe impl
1135 fidl::encoding::Encode<
1136 RealmFactoryCreateRealm2Request,
1137 fidl::encoding::DefaultFuchsiaResourceDialect,
1138 > for &mut RealmFactoryCreateRealm2Request
1139 {
1140 #[inline]
1141 unsafe fn encode(
1142 self,
1143 encoder: &mut fidl::encoding::Encoder<
1144 '_,
1145 fidl::encoding::DefaultFuchsiaResourceDialect,
1146 >,
1147 offset: usize,
1148 _depth: fidl::encoding::Depth,
1149 ) -> fidl::Result<()> {
1150 encoder.debug_check_bounds::<RealmFactoryCreateRealm2Request>(offset);
1151 fidl::encoding::Encode::<
1153 RealmFactoryCreateRealm2Request,
1154 fidl::encoding::DefaultFuchsiaResourceDialect,
1155 >::encode(
1156 (
1157 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1158 &mut self.options,
1159 ),
1160 <fidl::encoding::Endpoint<
1161 fidl::endpoints::ServerEnd<
1162 fidl_fuchsia_component_sandbox::DictionaryMarker,
1163 >,
1164 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1165 &mut self.dictionary
1166 ),
1167 ),
1168 encoder,
1169 offset,
1170 _depth,
1171 )
1172 }
1173 }
1174 unsafe impl<
1175 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1176 T1: fidl::encoding::Encode<
1177 fidl::encoding::Endpoint<
1178 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
1179 >,
1180 fidl::encoding::DefaultFuchsiaResourceDialect,
1181 >,
1182 >
1183 fidl::encoding::Encode<
1184 RealmFactoryCreateRealm2Request,
1185 fidl::encoding::DefaultFuchsiaResourceDialect,
1186 > for (T0, T1)
1187 {
1188 #[inline]
1189 unsafe fn encode(
1190 self,
1191 encoder: &mut fidl::encoding::Encoder<
1192 '_,
1193 fidl::encoding::DefaultFuchsiaResourceDialect,
1194 >,
1195 offset: usize,
1196 depth: fidl::encoding::Depth,
1197 ) -> fidl::Result<()> {
1198 encoder.debug_check_bounds::<RealmFactoryCreateRealm2Request>(offset);
1199 unsafe {
1202 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1203 (ptr as *mut u64).write_unaligned(0);
1204 }
1205 self.0.encode(encoder, offset + 0, depth)?;
1207 self.1.encode(encoder, offset + 16, depth)?;
1208 Ok(())
1209 }
1210 }
1211
1212 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1213 for RealmFactoryCreateRealm2Request
1214 {
1215 #[inline(always)]
1216 fn new_empty() -> Self {
1217 Self {
1218 options: fidl::new_empty!(
1219 RealmOptions,
1220 fidl::encoding::DefaultFuchsiaResourceDialect
1221 ),
1222 dictionary: fidl::new_empty!(
1223 fidl::encoding::Endpoint<
1224 fidl::endpoints::ServerEnd<
1225 fidl_fuchsia_component_sandbox::DictionaryMarker,
1226 >,
1227 >,
1228 fidl::encoding::DefaultFuchsiaResourceDialect
1229 ),
1230 }
1231 }
1232
1233 #[inline]
1234 unsafe fn decode(
1235 &mut self,
1236 decoder: &mut fidl::encoding::Decoder<
1237 '_,
1238 fidl::encoding::DefaultFuchsiaResourceDialect,
1239 >,
1240 offset: usize,
1241 _depth: fidl::encoding::Depth,
1242 ) -> fidl::Result<()> {
1243 decoder.debug_check_bounds::<Self>(offset);
1244 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1246 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1247 let mask = 0xffffffff00000000u64;
1248 let maskedval = padval & mask;
1249 if maskedval != 0 {
1250 return Err(fidl::Error::NonZeroPadding {
1251 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1252 });
1253 }
1254 fidl::decode!(
1255 RealmOptions,
1256 fidl::encoding::DefaultFuchsiaResourceDialect,
1257 &mut self.options,
1258 decoder,
1259 offset + 0,
1260 _depth
1261 )?;
1262 fidl::decode!(
1263 fidl::encoding::Endpoint<
1264 fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
1265 >,
1266 fidl::encoding::DefaultFuchsiaResourceDialect,
1267 &mut self.dictionary,
1268 decoder,
1269 offset + 16,
1270 _depth
1271 )?;
1272 Ok(())
1273 }
1274 }
1275
1276 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealm3Request {
1277 type Borrowed<'a> = &'a mut Self;
1278 fn take_or_borrow<'a>(
1279 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1280 ) -> Self::Borrowed<'a> {
1281 value
1282 }
1283 }
1284
1285 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealm3Request {
1286 type Owned = Self;
1287
1288 #[inline(always)]
1289 fn inline_align(_context: fidl::encoding::Context) -> usize {
1290 8
1291 }
1292
1293 #[inline(always)]
1294 fn inline_size(_context: fidl::encoding::Context) -> usize {
1295 24
1296 }
1297 }
1298
1299 unsafe impl
1300 fidl::encoding::Encode<
1301 RealmFactoryCreateRealm3Request,
1302 fidl::encoding::DefaultFuchsiaResourceDialect,
1303 > for &mut RealmFactoryCreateRealm3Request
1304 {
1305 #[inline]
1306 unsafe fn encode(
1307 self,
1308 encoder: &mut fidl::encoding::Encoder<
1309 '_,
1310 fidl::encoding::DefaultFuchsiaResourceDialect,
1311 >,
1312 offset: usize,
1313 _depth: fidl::encoding::Depth,
1314 ) -> fidl::Result<()> {
1315 encoder.debug_check_bounds::<RealmFactoryCreateRealm3Request>(offset);
1316 fidl::encoding::Encode::<
1318 RealmFactoryCreateRealm3Request,
1319 fidl::encoding::DefaultFuchsiaResourceDialect,
1320 >::encode(
1321 (
1322 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1323 &mut self.options,
1324 ),
1325 <fidl::encoding::HandleType<
1326 fidl::EventPair,
1327 { fidl::ObjectType::EVENTPAIR.into_raw() },
1328 2147483648,
1329 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1330 &mut self.dictionary
1331 ),
1332 ),
1333 encoder,
1334 offset,
1335 _depth,
1336 )
1337 }
1338 }
1339 unsafe impl<
1340 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1341 T1: fidl::encoding::Encode<
1342 fidl::encoding::HandleType<
1343 fidl::EventPair,
1344 { fidl::ObjectType::EVENTPAIR.into_raw() },
1345 2147483648,
1346 >,
1347 fidl::encoding::DefaultFuchsiaResourceDialect,
1348 >,
1349 >
1350 fidl::encoding::Encode<
1351 RealmFactoryCreateRealm3Request,
1352 fidl::encoding::DefaultFuchsiaResourceDialect,
1353 > for (T0, T1)
1354 {
1355 #[inline]
1356 unsafe fn encode(
1357 self,
1358 encoder: &mut fidl::encoding::Encoder<
1359 '_,
1360 fidl::encoding::DefaultFuchsiaResourceDialect,
1361 >,
1362 offset: usize,
1363 depth: fidl::encoding::Depth,
1364 ) -> fidl::Result<()> {
1365 encoder.debug_check_bounds::<RealmFactoryCreateRealm3Request>(offset);
1366 unsafe {
1369 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1370 (ptr as *mut u64).write_unaligned(0);
1371 }
1372 self.0.encode(encoder, offset + 0, depth)?;
1374 self.1.encode(encoder, offset + 16, depth)?;
1375 Ok(())
1376 }
1377 }
1378
1379 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1380 for RealmFactoryCreateRealm3Request
1381 {
1382 #[inline(always)]
1383 fn new_empty() -> Self {
1384 Self {
1385 options: fidl::new_empty!(
1386 RealmOptions,
1387 fidl::encoding::DefaultFuchsiaResourceDialect
1388 ),
1389 dictionary: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1390 }
1391 }
1392
1393 #[inline]
1394 unsafe fn decode(
1395 &mut self,
1396 decoder: &mut fidl::encoding::Decoder<
1397 '_,
1398 fidl::encoding::DefaultFuchsiaResourceDialect,
1399 >,
1400 offset: usize,
1401 _depth: fidl::encoding::Depth,
1402 ) -> fidl::Result<()> {
1403 decoder.debug_check_bounds::<Self>(offset);
1404 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1406 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1407 let mask = 0xffffffff00000000u64;
1408 let maskedval = padval & mask;
1409 if maskedval != 0 {
1410 return Err(fidl::Error::NonZeroPadding {
1411 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1412 });
1413 }
1414 fidl::decode!(
1415 RealmOptions,
1416 fidl::encoding::DefaultFuchsiaResourceDialect,
1417 &mut self.options,
1418 decoder,
1419 offset + 0,
1420 _depth
1421 )?;
1422 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.dictionary, decoder, offset + 16, _depth)?;
1423 Ok(())
1424 }
1425 }
1426
1427 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1428 type Borrowed<'a> = &'a mut Self;
1429 fn take_or_borrow<'a>(
1430 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1431 ) -> Self::Borrowed<'a> {
1432 value
1433 }
1434 }
1435
1436 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1437 type Owned = Self;
1438
1439 #[inline(always)]
1440 fn inline_align(_context: fidl::encoding::Context) -> usize {
1441 8
1442 }
1443
1444 #[inline(always)]
1445 fn inline_size(_context: fidl::encoding::Context) -> usize {
1446 24
1447 }
1448 }
1449
1450 unsafe impl
1451 fidl::encoding::Encode<
1452 RealmFactoryCreateRealmRequest,
1453 fidl::encoding::DefaultFuchsiaResourceDialect,
1454 > for &mut RealmFactoryCreateRealmRequest
1455 {
1456 #[inline]
1457 unsafe fn encode(
1458 self,
1459 encoder: &mut fidl::encoding::Encoder<
1460 '_,
1461 fidl::encoding::DefaultFuchsiaResourceDialect,
1462 >,
1463 offset: usize,
1464 _depth: fidl::encoding::Depth,
1465 ) -> fidl::Result<()> {
1466 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1467 fidl::encoding::Encode::<
1469 RealmFactoryCreateRealmRequest,
1470 fidl::encoding::DefaultFuchsiaResourceDialect,
1471 >::encode(
1472 (
1473 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1474 &mut self.options,
1475 ),
1476 <fidl::encoding::Endpoint<
1477 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1478 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1479 &mut self.realm_server,
1480 ),
1481 ),
1482 encoder,
1483 offset,
1484 _depth,
1485 )
1486 }
1487 }
1488 unsafe impl<
1489 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1490 T1: fidl::encoding::Encode<
1491 fidl::encoding::Endpoint<
1492 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1493 >,
1494 fidl::encoding::DefaultFuchsiaResourceDialect,
1495 >,
1496 >
1497 fidl::encoding::Encode<
1498 RealmFactoryCreateRealmRequest,
1499 fidl::encoding::DefaultFuchsiaResourceDialect,
1500 > for (T0, T1)
1501 {
1502 #[inline]
1503 unsafe fn encode(
1504 self,
1505 encoder: &mut fidl::encoding::Encoder<
1506 '_,
1507 fidl::encoding::DefaultFuchsiaResourceDialect,
1508 >,
1509 offset: usize,
1510 depth: fidl::encoding::Depth,
1511 ) -> fidl::Result<()> {
1512 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1513 unsafe {
1516 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1517 (ptr as *mut u64).write_unaligned(0);
1518 }
1519 self.0.encode(encoder, offset + 0, depth)?;
1521 self.1.encode(encoder, offset + 16, depth)?;
1522 Ok(())
1523 }
1524 }
1525
1526 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1527 for RealmFactoryCreateRealmRequest
1528 {
1529 #[inline(always)]
1530 fn new_empty() -> Self {
1531 Self {
1532 options: fidl::new_empty!(
1533 RealmOptions,
1534 fidl::encoding::DefaultFuchsiaResourceDialect
1535 ),
1536 realm_server: fidl::new_empty!(
1537 fidl::encoding::Endpoint<
1538 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1539 >,
1540 fidl::encoding::DefaultFuchsiaResourceDialect
1541 ),
1542 }
1543 }
1544
1545 #[inline]
1546 unsafe fn decode(
1547 &mut self,
1548 decoder: &mut fidl::encoding::Decoder<
1549 '_,
1550 fidl::encoding::DefaultFuchsiaResourceDialect,
1551 >,
1552 offset: usize,
1553 _depth: fidl::encoding::Depth,
1554 ) -> fidl::Result<()> {
1555 decoder.debug_check_bounds::<Self>(offset);
1556 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1558 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1559 let mask = 0xffffffff00000000u64;
1560 let maskedval = padval & mask;
1561 if maskedval != 0 {
1562 return Err(fidl::Error::NonZeroPadding {
1563 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1564 });
1565 }
1566 fidl::decode!(
1567 RealmOptions,
1568 fidl::encoding::DefaultFuchsiaResourceDialect,
1569 &mut self.options,
1570 decoder,
1571 offset + 0,
1572 _depth
1573 )?;
1574 fidl::decode!(
1575 fidl::encoding::Endpoint<
1576 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1577 >,
1578 fidl::encoding::DefaultFuchsiaResourceDialect,
1579 &mut self.realm_server,
1580 decoder,
1581 offset + 16,
1582 _depth
1583 )?;
1584 Ok(())
1585 }
1586 }
1587
1588 impl DriverConfig {
1589 #[inline(always)]
1590 fn max_ordinal_present(&self) -> u64 {
1591 if let Some(_) = self.driver_test_realm_start_args {
1592 return 3;
1593 }
1594 if let Some(_) = self.dev_class {
1595 return 2;
1596 }
1597 if let Some(_) = self.dev_topological {
1598 return 1;
1599 }
1600 0
1601 }
1602 }
1603
1604 impl fidl::encoding::ResourceTypeMarker for DriverConfig {
1605 type Borrowed<'a> = &'a mut Self;
1606 fn take_or_borrow<'a>(
1607 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1608 ) -> Self::Borrowed<'a> {
1609 value
1610 }
1611 }
1612
1613 unsafe impl fidl::encoding::TypeMarker for DriverConfig {
1614 type Owned = Self;
1615
1616 #[inline(always)]
1617 fn inline_align(_context: fidl::encoding::Context) -> usize {
1618 8
1619 }
1620
1621 #[inline(always)]
1622 fn inline_size(_context: fidl::encoding::Context) -> usize {
1623 16
1624 }
1625 }
1626
1627 unsafe impl fidl::encoding::Encode<DriverConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1628 for &mut DriverConfig
1629 {
1630 unsafe fn encode(
1631 self,
1632 encoder: &mut fidl::encoding::Encoder<
1633 '_,
1634 fidl::encoding::DefaultFuchsiaResourceDialect,
1635 >,
1636 offset: usize,
1637 mut depth: fidl::encoding::Depth,
1638 ) -> fidl::Result<()> {
1639 encoder.debug_check_bounds::<DriverConfig>(offset);
1640 let max_ordinal: u64 = self.max_ordinal_present();
1642 encoder.write_num(max_ordinal, offset);
1643 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1644 if max_ordinal == 0 {
1646 return Ok(());
1647 }
1648 depth.increment()?;
1649 let envelope_size = 8;
1650 let bytes_len = max_ordinal as usize * envelope_size;
1651 #[allow(unused_variables)]
1652 let offset = encoder.out_of_line_offset(bytes_len);
1653 let mut _prev_end_offset: usize = 0;
1654 if 1 > max_ordinal {
1655 return Ok(());
1656 }
1657
1658 let cur_offset: usize = (1 - 1) * envelope_size;
1661
1662 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1664
1665 fidl::encoding::encode_in_envelope_optional::<
1670 fidl::encoding::Endpoint<
1671 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1672 >,
1673 fidl::encoding::DefaultFuchsiaResourceDialect,
1674 >(
1675 self.dev_topological.as_mut().map(
1676 <fidl::encoding::Endpoint<
1677 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1678 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1679 ),
1680 encoder,
1681 offset + cur_offset,
1682 depth,
1683 )?;
1684
1685 _prev_end_offset = cur_offset + envelope_size;
1686 if 2 > max_ordinal {
1687 return Ok(());
1688 }
1689
1690 let cur_offset: usize = (2 - 1) * envelope_size;
1693
1694 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1696
1697 fidl::encoding::encode_in_envelope_optional::<
1702 fidl::encoding::Endpoint<
1703 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1704 >,
1705 fidl::encoding::DefaultFuchsiaResourceDialect,
1706 >(
1707 self.dev_class.as_mut().map(
1708 <fidl::encoding::Endpoint<
1709 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1710 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1711 ),
1712 encoder,
1713 offset + cur_offset,
1714 depth,
1715 )?;
1716
1717 _prev_end_offset = cur_offset + envelope_size;
1718 if 3 > max_ordinal {
1719 return Ok(());
1720 }
1721
1722 let cur_offset: usize = (3 - 1) * envelope_size;
1725
1726 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1728
1729 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_driver_test::RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>(
1734 self.driver_test_realm_start_args.as_mut().map(<fidl_fuchsia_driver_test::RealmArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1735 encoder, offset + cur_offset, depth
1736 )?;
1737
1738 _prev_end_offset = cur_offset + envelope_size;
1739
1740 Ok(())
1741 }
1742 }
1743
1744 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriverConfig {
1745 #[inline(always)]
1746 fn new_empty() -> Self {
1747 Self::default()
1748 }
1749
1750 unsafe fn decode(
1751 &mut self,
1752 decoder: &mut fidl::encoding::Decoder<
1753 '_,
1754 fidl::encoding::DefaultFuchsiaResourceDialect,
1755 >,
1756 offset: usize,
1757 mut depth: fidl::encoding::Depth,
1758 ) -> fidl::Result<()> {
1759 decoder.debug_check_bounds::<Self>(offset);
1760 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1761 None => return Err(fidl::Error::NotNullable),
1762 Some(len) => len,
1763 };
1764 if len == 0 {
1766 return Ok(());
1767 };
1768 depth.increment()?;
1769 let envelope_size = 8;
1770 let bytes_len = len * envelope_size;
1771 let offset = decoder.out_of_line_offset(bytes_len)?;
1772 let mut _next_ordinal_to_read = 0;
1774 let mut next_offset = offset;
1775 let end_offset = offset + bytes_len;
1776 _next_ordinal_to_read += 1;
1777 if next_offset >= end_offset {
1778 return Ok(());
1779 }
1780
1781 while _next_ordinal_to_read < 1 {
1783 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1784 _next_ordinal_to_read += 1;
1785 next_offset += envelope_size;
1786 }
1787
1788 let next_out_of_line = decoder.next_out_of_line();
1789 let handles_before = decoder.remaining_handles();
1790 if let Some((inlined, num_bytes, num_handles)) =
1791 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1792 {
1793 let member_inline_size = <fidl::encoding::Endpoint<
1794 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1795 > as fidl::encoding::TypeMarker>::inline_size(
1796 decoder.context
1797 );
1798 if inlined != (member_inline_size <= 4) {
1799 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1800 }
1801 let inner_offset;
1802 let mut inner_depth = depth.clone();
1803 if inlined {
1804 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1805 inner_offset = next_offset;
1806 } else {
1807 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1808 inner_depth.increment()?;
1809 }
1810 let val_ref = self.dev_topological.get_or_insert_with(|| {
1811 fidl::new_empty!(
1812 fidl::encoding::Endpoint<
1813 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1814 >,
1815 fidl::encoding::DefaultFuchsiaResourceDialect
1816 )
1817 });
1818 fidl::decode!(
1819 fidl::encoding::Endpoint<
1820 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1821 >,
1822 fidl::encoding::DefaultFuchsiaResourceDialect,
1823 val_ref,
1824 decoder,
1825 inner_offset,
1826 inner_depth
1827 )?;
1828 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1829 {
1830 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1831 }
1832 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1833 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1834 }
1835 }
1836
1837 next_offset += envelope_size;
1838 _next_ordinal_to_read += 1;
1839 if next_offset >= end_offset {
1840 return Ok(());
1841 }
1842
1843 while _next_ordinal_to_read < 2 {
1845 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1846 _next_ordinal_to_read += 1;
1847 next_offset += envelope_size;
1848 }
1849
1850 let next_out_of_line = decoder.next_out_of_line();
1851 let handles_before = decoder.remaining_handles();
1852 if let Some((inlined, num_bytes, num_handles)) =
1853 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1854 {
1855 let member_inline_size = <fidl::encoding::Endpoint<
1856 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1857 > as fidl::encoding::TypeMarker>::inline_size(
1858 decoder.context
1859 );
1860 if inlined != (member_inline_size <= 4) {
1861 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1862 }
1863 let inner_offset;
1864 let mut inner_depth = depth.clone();
1865 if inlined {
1866 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1867 inner_offset = next_offset;
1868 } else {
1869 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1870 inner_depth.increment()?;
1871 }
1872 let val_ref = self.dev_class.get_or_insert_with(|| {
1873 fidl::new_empty!(
1874 fidl::encoding::Endpoint<
1875 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1876 >,
1877 fidl::encoding::DefaultFuchsiaResourceDialect
1878 )
1879 });
1880 fidl::decode!(
1881 fidl::encoding::Endpoint<
1882 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1883 >,
1884 fidl::encoding::DefaultFuchsiaResourceDialect,
1885 val_ref,
1886 decoder,
1887 inner_offset,
1888 inner_depth
1889 )?;
1890 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1891 {
1892 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1893 }
1894 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1895 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1896 }
1897 }
1898
1899 next_offset += envelope_size;
1900 _next_ordinal_to_read += 1;
1901 if next_offset >= end_offset {
1902 return Ok(());
1903 }
1904
1905 while _next_ordinal_to_read < 3 {
1907 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1908 _next_ordinal_to_read += 1;
1909 next_offset += envelope_size;
1910 }
1911
1912 let next_out_of_line = decoder.next_out_of_line();
1913 let handles_before = decoder.remaining_handles();
1914 if let Some((inlined, num_bytes, num_handles)) =
1915 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1916 {
1917 let member_inline_size = <fidl_fuchsia_driver_test::RealmArgs as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1918 if inlined != (member_inline_size <= 4) {
1919 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1920 }
1921 let inner_offset;
1922 let mut inner_depth = depth.clone();
1923 if inlined {
1924 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1925 inner_offset = next_offset;
1926 } else {
1927 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1928 inner_depth.increment()?;
1929 }
1930 let val_ref = self.driver_test_realm_start_args.get_or_insert_with(|| {
1931 fidl::new_empty!(
1932 fidl_fuchsia_driver_test::RealmArgs,
1933 fidl::encoding::DefaultFuchsiaResourceDialect
1934 )
1935 });
1936 fidl::decode!(
1937 fidl_fuchsia_driver_test::RealmArgs,
1938 fidl::encoding::DefaultFuchsiaResourceDialect,
1939 val_ref,
1940 decoder,
1941 inner_offset,
1942 inner_depth
1943 )?;
1944 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1945 {
1946 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1947 }
1948 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1949 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1950 }
1951 }
1952
1953 next_offset += envelope_size;
1954
1955 while next_offset < end_offset {
1957 _next_ordinal_to_read += 1;
1958 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1959 next_offset += envelope_size;
1960 }
1961
1962 Ok(())
1963 }
1964 }
1965
1966 impl DriversOnly {
1967 #[inline(always)]
1968 fn max_ordinal_present(&self) -> u64 {
1969 if let Some(_) = self.driver_config {
1970 return 1;
1971 }
1972 0
1973 }
1974 }
1975
1976 impl fidl::encoding::ResourceTypeMarker for DriversOnly {
1977 type Borrowed<'a> = &'a mut Self;
1978 fn take_or_borrow<'a>(
1979 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1980 ) -> Self::Borrowed<'a> {
1981 value
1982 }
1983 }
1984
1985 unsafe impl fidl::encoding::TypeMarker for DriversOnly {
1986 type Owned = Self;
1987
1988 #[inline(always)]
1989 fn inline_align(_context: fidl::encoding::Context) -> usize {
1990 8
1991 }
1992
1993 #[inline(always)]
1994 fn inline_size(_context: fidl::encoding::Context) -> usize {
1995 16
1996 }
1997 }
1998
1999 unsafe impl fidl::encoding::Encode<DriversOnly, fidl::encoding::DefaultFuchsiaResourceDialect>
2000 for &mut DriversOnly
2001 {
2002 unsafe fn encode(
2003 self,
2004 encoder: &mut fidl::encoding::Encoder<
2005 '_,
2006 fidl::encoding::DefaultFuchsiaResourceDialect,
2007 >,
2008 offset: usize,
2009 mut depth: fidl::encoding::Depth,
2010 ) -> fidl::Result<()> {
2011 encoder.debug_check_bounds::<DriversOnly>(offset);
2012 let max_ordinal: u64 = self.max_ordinal_present();
2014 encoder.write_num(max_ordinal, offset);
2015 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2016 if max_ordinal == 0 {
2018 return Ok(());
2019 }
2020 depth.increment()?;
2021 let envelope_size = 8;
2022 let bytes_len = max_ordinal as usize * envelope_size;
2023 #[allow(unused_variables)]
2024 let offset = encoder.out_of_line_offset(bytes_len);
2025 let mut _prev_end_offset: usize = 0;
2026 if 1 > max_ordinal {
2027 return Ok(());
2028 }
2029
2030 let cur_offset: usize = (1 - 1) * envelope_size;
2033
2034 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2036
2037 fidl::encoding::encode_in_envelope_optional::<
2042 DriverConfig,
2043 fidl::encoding::DefaultFuchsiaResourceDialect,
2044 >(
2045 self.driver_config
2046 .as_mut()
2047 .map(<DriverConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2048 encoder,
2049 offset + cur_offset,
2050 depth,
2051 )?;
2052
2053 _prev_end_offset = cur_offset + envelope_size;
2054
2055 Ok(())
2056 }
2057 }
2058
2059 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriversOnly {
2060 #[inline(always)]
2061 fn new_empty() -> Self {
2062 Self::default()
2063 }
2064
2065 unsafe fn decode(
2066 &mut self,
2067 decoder: &mut fidl::encoding::Decoder<
2068 '_,
2069 fidl::encoding::DefaultFuchsiaResourceDialect,
2070 >,
2071 offset: usize,
2072 mut depth: fidl::encoding::Depth,
2073 ) -> fidl::Result<()> {
2074 decoder.debug_check_bounds::<Self>(offset);
2075 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2076 None => return Err(fidl::Error::NotNullable),
2077 Some(len) => len,
2078 };
2079 if len == 0 {
2081 return Ok(());
2082 };
2083 depth.increment()?;
2084 let envelope_size = 8;
2085 let bytes_len = len * envelope_size;
2086 let offset = decoder.out_of_line_offset(bytes_len)?;
2087 let mut _next_ordinal_to_read = 0;
2089 let mut next_offset = offset;
2090 let end_offset = offset + bytes_len;
2091 _next_ordinal_to_read += 1;
2092 if next_offset >= end_offset {
2093 return Ok(());
2094 }
2095
2096 while _next_ordinal_to_read < 1 {
2098 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2099 _next_ordinal_to_read += 1;
2100 next_offset += envelope_size;
2101 }
2102
2103 let next_out_of_line = decoder.next_out_of_line();
2104 let handles_before = decoder.remaining_handles();
2105 if let Some((inlined, num_bytes, num_handles)) =
2106 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2107 {
2108 let member_inline_size =
2109 <DriverConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2110 if inlined != (member_inline_size <= 4) {
2111 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2112 }
2113 let inner_offset;
2114 let mut inner_depth = depth.clone();
2115 if inlined {
2116 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2117 inner_offset = next_offset;
2118 } else {
2119 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2120 inner_depth.increment()?;
2121 }
2122 let val_ref = self.driver_config.get_or_insert_with(|| {
2123 fidl::new_empty!(DriverConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
2124 });
2125 fidl::decode!(
2126 DriverConfig,
2127 fidl::encoding::DefaultFuchsiaResourceDialect,
2128 val_ref,
2129 decoder,
2130 inner_offset,
2131 inner_depth
2132 )?;
2133 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2134 {
2135 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2136 }
2137 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2138 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2139 }
2140 }
2141
2142 next_offset += envelope_size;
2143
2144 while next_offset < end_offset {
2146 _next_ordinal_to_read += 1;
2147 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2148 next_offset += envelope_size;
2149 }
2150
2151 Ok(())
2152 }
2153 }
2154
2155 impl RealmOptions {
2156 #[inline(always)]
2157 fn max_ordinal_present(&self) -> u64 {
2158 if let Some(_) = self.topology {
2159 return 3;
2160 }
2161 if let Some(_) = self.wlan_config {
2162 return 2;
2163 }
2164 if let Some(_) = self.devfs_server_end {
2165 return 1;
2166 }
2167 0
2168 }
2169 }
2170
2171 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
2172 type Borrowed<'a> = &'a mut Self;
2173 fn take_or_borrow<'a>(
2174 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2175 ) -> Self::Borrowed<'a> {
2176 value
2177 }
2178 }
2179
2180 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
2181 type Owned = Self;
2182
2183 #[inline(always)]
2184 fn inline_align(_context: fidl::encoding::Context) -> usize {
2185 8
2186 }
2187
2188 #[inline(always)]
2189 fn inline_size(_context: fidl::encoding::Context) -> usize {
2190 16
2191 }
2192 }
2193
2194 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
2195 for &mut RealmOptions
2196 {
2197 unsafe fn encode(
2198 self,
2199 encoder: &mut fidl::encoding::Encoder<
2200 '_,
2201 fidl::encoding::DefaultFuchsiaResourceDialect,
2202 >,
2203 offset: usize,
2204 mut depth: fidl::encoding::Depth,
2205 ) -> fidl::Result<()> {
2206 encoder.debug_check_bounds::<RealmOptions>(offset);
2207 let max_ordinal: u64 = self.max_ordinal_present();
2209 encoder.write_num(max_ordinal, offset);
2210 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2211 if max_ordinal == 0 {
2213 return Ok(());
2214 }
2215 depth.increment()?;
2216 let envelope_size = 8;
2217 let bytes_len = max_ordinal as usize * envelope_size;
2218 #[allow(unused_variables)]
2219 let offset = encoder.out_of_line_offset(bytes_len);
2220 let mut _prev_end_offset: usize = 0;
2221 if 1 > max_ordinal {
2222 return Ok(());
2223 }
2224
2225 let cur_offset: usize = (1 - 1) * envelope_size;
2228
2229 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2231
2232 fidl::encoding::encode_in_envelope_optional::<
2237 fidl::encoding::Endpoint<
2238 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2239 >,
2240 fidl::encoding::DefaultFuchsiaResourceDialect,
2241 >(
2242 self.devfs_server_end.as_mut().map(
2243 <fidl::encoding::Endpoint<
2244 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2245 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2246 ),
2247 encoder,
2248 offset + cur_offset,
2249 depth,
2250 )?;
2251
2252 _prev_end_offset = cur_offset + envelope_size;
2253 if 2 > max_ordinal {
2254 return Ok(());
2255 }
2256
2257 let cur_offset: usize = (2 - 1) * envelope_size;
2260
2261 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2263
2264 fidl::encoding::encode_in_envelope_optional::<
2269 WlanConfig,
2270 fidl::encoding::DefaultFuchsiaResourceDialect,
2271 >(
2272 self.wlan_config
2273 .as_mut()
2274 .map(<WlanConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2275 encoder,
2276 offset + cur_offset,
2277 depth,
2278 )?;
2279
2280 _prev_end_offset = cur_offset + envelope_size;
2281 if 3 > max_ordinal {
2282 return Ok(());
2283 }
2284
2285 let cur_offset: usize = (3 - 1) * envelope_size;
2288
2289 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2291
2292 fidl::encoding::encode_in_envelope_optional::<
2297 Topology,
2298 fidl::encoding::DefaultFuchsiaResourceDialect,
2299 >(
2300 self.topology
2301 .as_mut()
2302 .map(<Topology as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2303 encoder,
2304 offset + cur_offset,
2305 depth,
2306 )?;
2307
2308 _prev_end_offset = cur_offset + envelope_size;
2309
2310 Ok(())
2311 }
2312 }
2313
2314 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
2315 #[inline(always)]
2316 fn new_empty() -> Self {
2317 Self::default()
2318 }
2319
2320 unsafe fn decode(
2321 &mut self,
2322 decoder: &mut fidl::encoding::Decoder<
2323 '_,
2324 fidl::encoding::DefaultFuchsiaResourceDialect,
2325 >,
2326 offset: usize,
2327 mut depth: fidl::encoding::Depth,
2328 ) -> fidl::Result<()> {
2329 decoder.debug_check_bounds::<Self>(offset);
2330 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2331 None => return Err(fidl::Error::NotNullable),
2332 Some(len) => len,
2333 };
2334 if len == 0 {
2336 return Ok(());
2337 };
2338 depth.increment()?;
2339 let envelope_size = 8;
2340 let bytes_len = len * envelope_size;
2341 let offset = decoder.out_of_line_offset(bytes_len)?;
2342 let mut _next_ordinal_to_read = 0;
2344 let mut next_offset = offset;
2345 let end_offset = offset + bytes_len;
2346 _next_ordinal_to_read += 1;
2347 if next_offset >= end_offset {
2348 return Ok(());
2349 }
2350
2351 while _next_ordinal_to_read < 1 {
2353 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2354 _next_ordinal_to_read += 1;
2355 next_offset += envelope_size;
2356 }
2357
2358 let next_out_of_line = decoder.next_out_of_line();
2359 let handles_before = decoder.remaining_handles();
2360 if let Some((inlined, num_bytes, num_handles)) =
2361 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2362 {
2363 let member_inline_size = <fidl::encoding::Endpoint<
2364 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2365 > as fidl::encoding::TypeMarker>::inline_size(
2366 decoder.context
2367 );
2368 if inlined != (member_inline_size <= 4) {
2369 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2370 }
2371 let inner_offset;
2372 let mut inner_depth = depth.clone();
2373 if inlined {
2374 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2375 inner_offset = next_offset;
2376 } else {
2377 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2378 inner_depth.increment()?;
2379 }
2380 let val_ref = self.devfs_server_end.get_or_insert_with(|| {
2381 fidl::new_empty!(
2382 fidl::encoding::Endpoint<
2383 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2384 >,
2385 fidl::encoding::DefaultFuchsiaResourceDialect
2386 )
2387 });
2388 fidl::decode!(
2389 fidl::encoding::Endpoint<
2390 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2391 >,
2392 fidl::encoding::DefaultFuchsiaResourceDialect,
2393 val_ref,
2394 decoder,
2395 inner_offset,
2396 inner_depth
2397 )?;
2398 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2399 {
2400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2401 }
2402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2404 }
2405 }
2406
2407 next_offset += envelope_size;
2408 _next_ordinal_to_read += 1;
2409 if next_offset >= end_offset {
2410 return Ok(());
2411 }
2412
2413 while _next_ordinal_to_read < 2 {
2415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2416 _next_ordinal_to_read += 1;
2417 next_offset += envelope_size;
2418 }
2419
2420 let next_out_of_line = decoder.next_out_of_line();
2421 let handles_before = decoder.remaining_handles();
2422 if let Some((inlined, num_bytes, num_handles)) =
2423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2424 {
2425 let member_inline_size =
2426 <WlanConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2427 if inlined != (member_inline_size <= 4) {
2428 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2429 }
2430 let inner_offset;
2431 let mut inner_depth = depth.clone();
2432 if inlined {
2433 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2434 inner_offset = next_offset;
2435 } else {
2436 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2437 inner_depth.increment()?;
2438 }
2439 let val_ref = self.wlan_config.get_or_insert_with(|| {
2440 fidl::new_empty!(WlanConfig, fidl::encoding::DefaultFuchsiaResourceDialect)
2441 });
2442 fidl::decode!(
2443 WlanConfig,
2444 fidl::encoding::DefaultFuchsiaResourceDialect,
2445 val_ref,
2446 decoder,
2447 inner_offset,
2448 inner_depth
2449 )?;
2450 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2451 {
2452 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2453 }
2454 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2455 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2456 }
2457 }
2458
2459 next_offset += envelope_size;
2460 _next_ordinal_to_read += 1;
2461 if next_offset >= end_offset {
2462 return Ok(());
2463 }
2464
2465 while _next_ordinal_to_read < 3 {
2467 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2468 _next_ordinal_to_read += 1;
2469 next_offset += envelope_size;
2470 }
2471
2472 let next_out_of_line = decoder.next_out_of_line();
2473 let handles_before = decoder.remaining_handles();
2474 if let Some((inlined, num_bytes, num_handles)) =
2475 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2476 {
2477 let member_inline_size =
2478 <Topology as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2479 if inlined != (member_inline_size <= 4) {
2480 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2481 }
2482 let inner_offset;
2483 let mut inner_depth = depth.clone();
2484 if inlined {
2485 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2486 inner_offset = next_offset;
2487 } else {
2488 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2489 inner_depth.increment()?;
2490 }
2491 let val_ref = self.topology.get_or_insert_with(|| {
2492 fidl::new_empty!(Topology, fidl::encoding::DefaultFuchsiaResourceDialect)
2493 });
2494 fidl::decode!(
2495 Topology,
2496 fidl::encoding::DefaultFuchsiaResourceDialect,
2497 val_ref,
2498 decoder,
2499 inner_offset,
2500 inner_depth
2501 )?;
2502 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2503 {
2504 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2505 }
2506 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2507 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2508 }
2509 }
2510
2511 next_offset += envelope_size;
2512
2513 while next_offset < end_offset {
2515 _next_ordinal_to_read += 1;
2516 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2517 next_offset += envelope_size;
2518 }
2519
2520 Ok(())
2521 }
2522 }
2523
2524 impl WlanConfig {
2525 #[inline(always)]
2526 fn max_ordinal_present(&self) -> u64 {
2527 if let Some(_) = self.trace_manager_hermeticity {
2528 return 4;
2529 }
2530 if let Some(_) = self.name {
2531 return 3;
2532 }
2533 if let Some(_) = self.with_regulatory_region {
2534 return 2;
2535 }
2536 if let Some(_) = self.use_legacy_privacy {
2537 return 1;
2538 }
2539 0
2540 }
2541 }
2542
2543 impl fidl::encoding::ResourceTypeMarker for WlanConfig {
2544 type Borrowed<'a> = &'a mut Self;
2545 fn take_or_borrow<'a>(
2546 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2547 ) -> Self::Borrowed<'a> {
2548 value
2549 }
2550 }
2551
2552 unsafe impl fidl::encoding::TypeMarker for WlanConfig {
2553 type Owned = Self;
2554
2555 #[inline(always)]
2556 fn inline_align(_context: fidl::encoding::Context) -> usize {
2557 8
2558 }
2559
2560 #[inline(always)]
2561 fn inline_size(_context: fidl::encoding::Context) -> usize {
2562 16
2563 }
2564 }
2565
2566 unsafe impl fidl::encoding::Encode<WlanConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
2567 for &mut WlanConfig
2568 {
2569 unsafe fn encode(
2570 self,
2571 encoder: &mut fidl::encoding::Encoder<
2572 '_,
2573 fidl::encoding::DefaultFuchsiaResourceDialect,
2574 >,
2575 offset: usize,
2576 mut depth: fidl::encoding::Depth,
2577 ) -> fidl::Result<()> {
2578 encoder.debug_check_bounds::<WlanConfig>(offset);
2579 let max_ordinal: u64 = self.max_ordinal_present();
2581 encoder.write_num(max_ordinal, offset);
2582 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2583 if max_ordinal == 0 {
2585 return Ok(());
2586 }
2587 depth.increment()?;
2588 let envelope_size = 8;
2589 let bytes_len = max_ordinal as usize * envelope_size;
2590 #[allow(unused_variables)]
2591 let offset = encoder.out_of_line_offset(bytes_len);
2592 let mut _prev_end_offset: usize = 0;
2593 if 1 > max_ordinal {
2594 return Ok(());
2595 }
2596
2597 let cur_offset: usize = (1 - 1) * envelope_size;
2600
2601 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2603
2604 fidl::encoding::encode_in_envelope_optional::<
2609 bool,
2610 fidl::encoding::DefaultFuchsiaResourceDialect,
2611 >(
2612 self.use_legacy_privacy
2613 .as_ref()
2614 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2615 encoder,
2616 offset + cur_offset,
2617 depth,
2618 )?;
2619
2620 _prev_end_offset = cur_offset + envelope_size;
2621 if 2 > max_ordinal {
2622 return Ok(());
2623 }
2624
2625 let cur_offset: usize = (2 - 1) * envelope_size;
2628
2629 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2631
2632 fidl::encoding::encode_in_envelope_optional::<
2637 bool,
2638 fidl::encoding::DefaultFuchsiaResourceDialect,
2639 >(
2640 self.with_regulatory_region
2641 .as_ref()
2642 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2643 encoder,
2644 offset + cur_offset,
2645 depth,
2646 )?;
2647
2648 _prev_end_offset = cur_offset + envelope_size;
2649 if 3 > max_ordinal {
2650 return Ok(());
2651 }
2652
2653 let cur_offset: usize = (3 - 1) * envelope_size;
2656
2657 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2659
2660 fidl::encoding::encode_in_envelope_optional::<
2665 fidl::encoding::UnboundedString,
2666 fidl::encoding::DefaultFuchsiaResourceDialect,
2667 >(
2668 self.name.as_ref().map(
2669 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2670 ),
2671 encoder,
2672 offset + cur_offset,
2673 depth,
2674 )?;
2675
2676 _prev_end_offset = cur_offset + envelope_size;
2677 if 4 > max_ordinal {
2678 return Ok(());
2679 }
2680
2681 let cur_offset: usize = (4 - 1) * envelope_size;
2684
2685 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2687
2688 fidl::encoding::encode_in_envelope_optional::<
2693 TraceManagerHermeticity,
2694 fidl::encoding::DefaultFuchsiaResourceDialect,
2695 >(
2696 self.trace_manager_hermeticity
2697 .as_ref()
2698 .map(<TraceManagerHermeticity as fidl::encoding::ValueTypeMarker>::borrow),
2699 encoder,
2700 offset + cur_offset,
2701 depth,
2702 )?;
2703
2704 _prev_end_offset = cur_offset + envelope_size;
2705
2706 Ok(())
2707 }
2708 }
2709
2710 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WlanConfig {
2711 #[inline(always)]
2712 fn new_empty() -> Self {
2713 Self::default()
2714 }
2715
2716 unsafe fn decode(
2717 &mut self,
2718 decoder: &mut fidl::encoding::Decoder<
2719 '_,
2720 fidl::encoding::DefaultFuchsiaResourceDialect,
2721 >,
2722 offset: usize,
2723 mut depth: fidl::encoding::Depth,
2724 ) -> fidl::Result<()> {
2725 decoder.debug_check_bounds::<Self>(offset);
2726 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2727 None => return Err(fidl::Error::NotNullable),
2728 Some(len) => len,
2729 };
2730 if len == 0 {
2732 return Ok(());
2733 };
2734 depth.increment()?;
2735 let envelope_size = 8;
2736 let bytes_len = len * envelope_size;
2737 let offset = decoder.out_of_line_offset(bytes_len)?;
2738 let mut _next_ordinal_to_read = 0;
2740 let mut next_offset = offset;
2741 let end_offset = offset + bytes_len;
2742 _next_ordinal_to_read += 1;
2743 if next_offset >= end_offset {
2744 return Ok(());
2745 }
2746
2747 while _next_ordinal_to_read < 1 {
2749 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2750 _next_ordinal_to_read += 1;
2751 next_offset += envelope_size;
2752 }
2753
2754 let next_out_of_line = decoder.next_out_of_line();
2755 let handles_before = decoder.remaining_handles();
2756 if let Some((inlined, num_bytes, num_handles)) =
2757 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2758 {
2759 let member_inline_size =
2760 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2761 if inlined != (member_inline_size <= 4) {
2762 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2763 }
2764 let inner_offset;
2765 let mut inner_depth = depth.clone();
2766 if inlined {
2767 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2768 inner_offset = next_offset;
2769 } else {
2770 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2771 inner_depth.increment()?;
2772 }
2773 let val_ref = self.use_legacy_privacy.get_or_insert_with(|| {
2774 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2775 });
2776 fidl::decode!(
2777 bool,
2778 fidl::encoding::DefaultFuchsiaResourceDialect,
2779 val_ref,
2780 decoder,
2781 inner_offset,
2782 inner_depth
2783 )?;
2784 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2785 {
2786 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2787 }
2788 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2789 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2790 }
2791 }
2792
2793 next_offset += envelope_size;
2794 _next_ordinal_to_read += 1;
2795 if next_offset >= end_offset {
2796 return Ok(());
2797 }
2798
2799 while _next_ordinal_to_read < 2 {
2801 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2802 _next_ordinal_to_read += 1;
2803 next_offset += envelope_size;
2804 }
2805
2806 let next_out_of_line = decoder.next_out_of_line();
2807 let handles_before = decoder.remaining_handles();
2808 if let Some((inlined, num_bytes, num_handles)) =
2809 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2810 {
2811 let member_inline_size =
2812 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2813 if inlined != (member_inline_size <= 4) {
2814 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2815 }
2816 let inner_offset;
2817 let mut inner_depth = depth.clone();
2818 if inlined {
2819 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2820 inner_offset = next_offset;
2821 } else {
2822 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2823 inner_depth.increment()?;
2824 }
2825 let val_ref = self.with_regulatory_region.get_or_insert_with(|| {
2826 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2827 });
2828 fidl::decode!(
2829 bool,
2830 fidl::encoding::DefaultFuchsiaResourceDialect,
2831 val_ref,
2832 decoder,
2833 inner_offset,
2834 inner_depth
2835 )?;
2836 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2837 {
2838 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2839 }
2840 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2841 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2842 }
2843 }
2844
2845 next_offset += envelope_size;
2846 _next_ordinal_to_read += 1;
2847 if next_offset >= end_offset {
2848 return Ok(());
2849 }
2850
2851 while _next_ordinal_to_read < 3 {
2853 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2854 _next_ordinal_to_read += 1;
2855 next_offset += envelope_size;
2856 }
2857
2858 let next_out_of_line = decoder.next_out_of_line();
2859 let handles_before = decoder.remaining_handles();
2860 if let Some((inlined, num_bytes, num_handles)) =
2861 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2862 {
2863 let member_inline_size =
2864 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2865 decoder.context,
2866 );
2867 if inlined != (member_inline_size <= 4) {
2868 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2869 }
2870 let inner_offset;
2871 let mut inner_depth = depth.clone();
2872 if inlined {
2873 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2874 inner_offset = next_offset;
2875 } else {
2876 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2877 inner_depth.increment()?;
2878 }
2879 let val_ref = self.name.get_or_insert_with(|| {
2880 fidl::new_empty!(
2881 fidl::encoding::UnboundedString,
2882 fidl::encoding::DefaultFuchsiaResourceDialect
2883 )
2884 });
2885 fidl::decode!(
2886 fidl::encoding::UnboundedString,
2887 fidl::encoding::DefaultFuchsiaResourceDialect,
2888 val_ref,
2889 decoder,
2890 inner_offset,
2891 inner_depth
2892 )?;
2893 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2894 {
2895 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2896 }
2897 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2898 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2899 }
2900 }
2901
2902 next_offset += envelope_size;
2903 _next_ordinal_to_read += 1;
2904 if next_offset >= end_offset {
2905 return Ok(());
2906 }
2907
2908 while _next_ordinal_to_read < 4 {
2910 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2911 _next_ordinal_to_read += 1;
2912 next_offset += envelope_size;
2913 }
2914
2915 let next_out_of_line = decoder.next_out_of_line();
2916 let handles_before = decoder.remaining_handles();
2917 if let Some((inlined, num_bytes, num_handles)) =
2918 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2919 {
2920 let member_inline_size =
2921 <TraceManagerHermeticity as fidl::encoding::TypeMarker>::inline_size(
2922 decoder.context,
2923 );
2924 if inlined != (member_inline_size <= 4) {
2925 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2926 }
2927 let inner_offset;
2928 let mut inner_depth = depth.clone();
2929 if inlined {
2930 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2931 inner_offset = next_offset;
2932 } else {
2933 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2934 inner_depth.increment()?;
2935 }
2936 let val_ref = self.trace_manager_hermeticity.get_or_insert_with(|| {
2937 fidl::new_empty!(
2938 TraceManagerHermeticity,
2939 fidl::encoding::DefaultFuchsiaResourceDialect
2940 )
2941 });
2942 fidl::decode!(
2943 TraceManagerHermeticity,
2944 fidl::encoding::DefaultFuchsiaResourceDialect,
2945 val_ref,
2946 decoder,
2947 inner_offset,
2948 inner_depth
2949 )?;
2950 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2951 {
2952 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2953 }
2954 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2955 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2956 }
2957 }
2958
2959 next_offset += envelope_size;
2960
2961 while next_offset < end_offset {
2963 _next_ordinal_to_read += 1;
2964 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2965 next_offset += envelope_size;
2966 }
2967
2968 Ok(())
2969 }
2970 }
2971
2972 impl fidl::encoding::ResourceTypeMarker for Topology {
2973 type Borrowed<'a> = &'a mut Self;
2974 fn take_or_borrow<'a>(
2975 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2976 ) -> Self::Borrowed<'a> {
2977 value
2978 }
2979 }
2980
2981 unsafe impl fidl::encoding::TypeMarker for Topology {
2982 type Owned = Self;
2983
2984 #[inline(always)]
2985 fn inline_align(_context: fidl::encoding::Context) -> usize {
2986 8
2987 }
2988
2989 #[inline(always)]
2990 fn inline_size(_context: fidl::encoding::Context) -> usize {
2991 16
2992 }
2993 }
2994
2995 unsafe impl fidl::encoding::Encode<Topology, fidl::encoding::DefaultFuchsiaResourceDialect>
2996 for &mut Topology
2997 {
2998 #[inline]
2999 unsafe fn encode(
3000 self,
3001 encoder: &mut fidl::encoding::Encoder<
3002 '_,
3003 fidl::encoding::DefaultFuchsiaResourceDialect,
3004 >,
3005 offset: usize,
3006 _depth: fidl::encoding::Depth,
3007 ) -> fidl::Result<()> {
3008 encoder.debug_check_bounds::<Topology>(offset);
3009 encoder.write_num::<u64>(self.ordinal(), offset);
3010 match self {
3011 Topology::DriversOnly(ref mut val) => fidl::encoding::encode_in_envelope::<
3012 DriversOnly,
3013 fidl::encoding::DefaultFuchsiaResourceDialect,
3014 >(
3015 <DriversOnly as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3016 encoder,
3017 offset + 8,
3018 _depth,
3019 ),
3020 Topology::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3021 }
3022 }
3023 }
3024
3025 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Topology {
3026 #[inline(always)]
3027 fn new_empty() -> Self {
3028 Self::__SourceBreaking { unknown_ordinal: 0 }
3029 }
3030
3031 #[inline]
3032 unsafe fn decode(
3033 &mut self,
3034 decoder: &mut fidl::encoding::Decoder<
3035 '_,
3036 fidl::encoding::DefaultFuchsiaResourceDialect,
3037 >,
3038 offset: usize,
3039 mut depth: fidl::encoding::Depth,
3040 ) -> fidl::Result<()> {
3041 decoder.debug_check_bounds::<Self>(offset);
3042 #[allow(unused_variables)]
3043 let next_out_of_line = decoder.next_out_of_line();
3044 let handles_before = decoder.remaining_handles();
3045 let (ordinal, inlined, num_bytes, num_handles) =
3046 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3047
3048 let member_inline_size = match ordinal {
3049 1 => <DriversOnly as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3050 0 => return Err(fidl::Error::UnknownUnionTag),
3051 _ => num_bytes as usize,
3052 };
3053
3054 if inlined != (member_inline_size <= 4) {
3055 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3056 }
3057 let _inner_offset;
3058 if inlined {
3059 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3060 _inner_offset = offset + 8;
3061 } else {
3062 depth.increment()?;
3063 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3064 }
3065 match ordinal {
3066 1 => {
3067 #[allow(irrefutable_let_patterns)]
3068 if let Topology::DriversOnly(_) = self {
3069 } else {
3071 *self = Topology::DriversOnly(fidl::new_empty!(
3073 DriversOnly,
3074 fidl::encoding::DefaultFuchsiaResourceDialect
3075 ));
3076 }
3077 #[allow(irrefutable_let_patterns)]
3078 if let Topology::DriversOnly(ref mut val) = self {
3079 fidl::decode!(
3080 DriversOnly,
3081 fidl::encoding::DefaultFuchsiaResourceDialect,
3082 val,
3083 decoder,
3084 _inner_offset,
3085 depth
3086 )?;
3087 } else {
3088 unreachable!()
3089 }
3090 }
3091 #[allow(deprecated)]
3092 ordinal => {
3093 for _ in 0..num_handles {
3094 decoder.drop_next_handle()?;
3095 }
3096 *self = Topology::__SourceBreaking { unknown_ordinal: ordinal };
3097 }
3098 }
3099 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3100 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3101 }
3102 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3103 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3104 }
3105 Ok(())
3106 }
3107 }
3108}