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