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_rolemanager_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RealmFactoryCreateRealmRequest {
16 pub options: RealmOptions,
17 pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for RealmFactoryCreateRealmRequest
22{
23}
24
25#[derive(Debug, Default, PartialEq)]
27pub struct RealmOptions {
28 #[doc(hidden)]
29 pub __source_breaking: fidl::marker::SourceBreaking,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct RealmFactoryMarker;
36
37impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
38 type Proxy = RealmFactoryProxy;
39 type RequestStream = RealmFactoryRequestStream;
40 #[cfg(target_os = "fuchsia")]
41 type SynchronousProxy = RealmFactorySynchronousProxy;
42
43 const DEBUG_NAME: &'static str = "test.rolemanager.RealmFactory";
44}
45impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
46pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
47
48pub trait RealmFactoryProxyInterface: Send + Sync {
49 type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
50 + Send;
51 fn r#create_realm(
52 &self,
53 options: RealmOptions,
54 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
55 ) -> Self::CreateRealmResponseFut;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct RealmFactorySynchronousProxy {
60 client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
65 type Proxy = RealmFactoryProxy;
66 type Protocol = RealmFactoryMarker;
67
68 fn from_channel(inner: fidl::Channel) -> Self {
69 Self::new(inner)
70 }
71
72 fn into_channel(self) -> fidl::Channel {
73 self.client.into_channel()
74 }
75
76 fn as_channel(&self) -> &fidl::Channel {
77 self.client.as_channel()
78 }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl RealmFactorySynchronousProxy {
83 pub fn new(channel: fidl::Channel) -> Self {
84 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
85 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
86 }
87
88 pub fn into_channel(self) -> fidl::Channel {
89 self.client.into_channel()
90 }
91
92 pub fn wait_for_event(
95 &self,
96 deadline: zx::MonotonicInstant,
97 ) -> Result<RealmFactoryEvent, fidl::Error> {
98 RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
99 }
100
101 pub fn r#create_realm(
103 &self,
104 mut options: RealmOptions,
105 mut realm_server: fidl::endpoints::ServerEnd<
106 fidl_fuchsia_testing_harness::RealmProxy_Marker,
107 >,
108 ___deadline: zx::MonotonicInstant,
109 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
110 let _response = self
111 .client
112 .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
113 fidl::encoding::EmptyStruct,
114 fidl_fuchsia_testing_harness::OperationError,
115 >>(
116 (&mut options, realm_server),
117 0x53ebab85149ca793,
118 fidl::encoding::DynamicFlags::FLEXIBLE,
119 ___deadline,
120 )?
121 .into_result::<RealmFactoryMarker>("create_realm")?;
122 Ok(_response.map(|x| x))
123 }
124}
125
126#[derive(Debug, Clone)]
127pub struct RealmFactoryProxy {
128 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
129}
130
131impl fidl::endpoints::Proxy for RealmFactoryProxy {
132 type Protocol = RealmFactoryMarker;
133
134 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
135 Self::new(inner)
136 }
137
138 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
139 self.client.into_channel().map_err(|client| Self { client })
140 }
141
142 fn as_channel(&self) -> &::fidl::AsyncChannel {
143 self.client.as_channel()
144 }
145}
146
147impl RealmFactoryProxy {
148 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
150 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
151 Self { client: fidl::client::Client::new(channel, protocol_name) }
152 }
153
154 pub fn take_event_stream(&self) -> RealmFactoryEventStream {
160 RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
161 }
162
163 pub fn r#create_realm(
165 &self,
166 mut options: RealmOptions,
167 mut realm_server: fidl::endpoints::ServerEnd<
168 fidl_fuchsia_testing_harness::RealmProxy_Marker,
169 >,
170 ) -> fidl::client::QueryResponseFut<
171 RealmFactoryCreateRealmResult,
172 fidl::encoding::DefaultFuchsiaResourceDialect,
173 > {
174 RealmFactoryProxyInterface::r#create_realm(self, options, realm_server)
175 }
176}
177
178impl RealmFactoryProxyInterface for RealmFactoryProxy {
179 type CreateRealmResponseFut = fidl::client::QueryResponseFut<
180 RealmFactoryCreateRealmResult,
181 fidl::encoding::DefaultFuchsiaResourceDialect,
182 >;
183 fn r#create_realm(
184 &self,
185 mut options: RealmOptions,
186 mut realm_server: fidl::endpoints::ServerEnd<
187 fidl_fuchsia_testing_harness::RealmProxy_Marker,
188 >,
189 ) -> Self::CreateRealmResponseFut {
190 fn _decode(
191 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
192 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
193 let _response = fidl::client::decode_transaction_body::<
194 fidl::encoding::FlexibleResultType<
195 fidl::encoding::EmptyStruct,
196 fidl_fuchsia_testing_harness::OperationError,
197 >,
198 fidl::encoding::DefaultFuchsiaResourceDialect,
199 0x53ebab85149ca793,
200 >(_buf?)?
201 .into_result::<RealmFactoryMarker>("create_realm")?;
202 Ok(_response.map(|x| x))
203 }
204 self.client
205 .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
206 (&mut options, realm_server),
207 0x53ebab85149ca793,
208 fidl::encoding::DynamicFlags::FLEXIBLE,
209 _decode,
210 )
211 }
212}
213
214pub struct RealmFactoryEventStream {
215 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
216}
217
218impl std::marker::Unpin for RealmFactoryEventStream {}
219
220impl futures::stream::FusedStream for RealmFactoryEventStream {
221 fn is_terminated(&self) -> bool {
222 self.event_receiver.is_terminated()
223 }
224}
225
226impl futures::Stream for RealmFactoryEventStream {
227 type Item = Result<RealmFactoryEvent, fidl::Error>;
228
229 fn poll_next(
230 mut self: std::pin::Pin<&mut Self>,
231 cx: &mut std::task::Context<'_>,
232 ) -> std::task::Poll<Option<Self::Item>> {
233 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
234 &mut self.event_receiver,
235 cx
236 )?) {
237 Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
238 None => std::task::Poll::Ready(None),
239 }
240 }
241}
242
243#[derive(Debug)]
244pub enum RealmFactoryEvent {
245 #[non_exhaustive]
246 _UnknownEvent {
247 ordinal: u64,
249 },
250}
251
252impl RealmFactoryEvent {
253 fn decode(
255 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
256 ) -> Result<RealmFactoryEvent, fidl::Error> {
257 let (bytes, _handles) = buf.split_mut();
258 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
259 debug_assert_eq!(tx_header.tx_id, 0);
260 match tx_header.ordinal {
261 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
262 Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
263 }
264 _ => Err(fidl::Error::UnknownOrdinal {
265 ordinal: tx_header.ordinal,
266 protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
267 }),
268 }
269 }
270}
271
272pub struct RealmFactoryRequestStream {
274 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
275 is_terminated: bool,
276}
277
278impl std::marker::Unpin for RealmFactoryRequestStream {}
279
280impl futures::stream::FusedStream for RealmFactoryRequestStream {
281 fn is_terminated(&self) -> bool {
282 self.is_terminated
283 }
284}
285
286impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
287 type Protocol = RealmFactoryMarker;
288 type ControlHandle = RealmFactoryControlHandle;
289
290 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
291 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
292 }
293
294 fn control_handle(&self) -> Self::ControlHandle {
295 RealmFactoryControlHandle { inner: self.inner.clone() }
296 }
297
298 fn into_inner(
299 self,
300 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
301 {
302 (self.inner, self.is_terminated)
303 }
304
305 fn from_inner(
306 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
307 is_terminated: bool,
308 ) -> Self {
309 Self { inner, is_terminated }
310 }
311}
312
313impl futures::Stream for RealmFactoryRequestStream {
314 type Item = Result<RealmFactoryRequest, fidl::Error>;
315
316 fn poll_next(
317 mut self: std::pin::Pin<&mut Self>,
318 cx: &mut std::task::Context<'_>,
319 ) -> std::task::Poll<Option<Self::Item>> {
320 let this = &mut *self;
321 if this.inner.check_shutdown(cx) {
322 this.is_terminated = true;
323 return std::task::Poll::Ready(None);
324 }
325 if this.is_terminated {
326 panic!("polled RealmFactoryRequestStream after completion");
327 }
328 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
329 |bytes, handles| {
330 match this.inner.channel().read_etc(cx, bytes, handles) {
331 std::task::Poll::Ready(Ok(())) => {}
332 std::task::Poll::Pending => return std::task::Poll::Pending,
333 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
334 this.is_terminated = true;
335 return std::task::Poll::Ready(None);
336 }
337 std::task::Poll::Ready(Err(e)) => {
338 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
339 e.into(),
340 ))))
341 }
342 }
343
344 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
346
347 std::task::Poll::Ready(Some(match header.ordinal {
348 0x53ebab85149ca793 => {
349 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
350 let mut req = fidl::new_empty!(
351 RealmFactoryCreateRealmRequest,
352 fidl::encoding::DefaultFuchsiaResourceDialect
353 );
354 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
355 let control_handle =
356 RealmFactoryControlHandle { inner: this.inner.clone() };
357 Ok(RealmFactoryRequest::CreateRealm {
358 options: req.options,
359 realm_server: req.realm_server,
360
361 responder: RealmFactoryCreateRealmResponder {
362 control_handle: std::mem::ManuallyDrop::new(control_handle),
363 tx_id: header.tx_id,
364 },
365 })
366 }
367 _ if header.tx_id == 0
368 && header
369 .dynamic_flags()
370 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
371 {
372 Ok(RealmFactoryRequest::_UnknownMethod {
373 ordinal: header.ordinal,
374 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
375 method_type: fidl::MethodType::OneWay,
376 })
377 }
378 _ if header
379 .dynamic_flags()
380 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
381 {
382 this.inner.send_framework_err(
383 fidl::encoding::FrameworkErr::UnknownMethod,
384 header.tx_id,
385 header.ordinal,
386 header.dynamic_flags(),
387 (bytes, handles),
388 )?;
389 Ok(RealmFactoryRequest::_UnknownMethod {
390 ordinal: header.ordinal,
391 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
392 method_type: fidl::MethodType::TwoWay,
393 })
394 }
395 _ => Err(fidl::Error::UnknownOrdinal {
396 ordinal: header.ordinal,
397 protocol_name:
398 <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
399 }),
400 }))
401 },
402 )
403 }
404}
405
406#[derive(Debug)]
407pub enum RealmFactoryRequest {
408 CreateRealm {
410 options: RealmOptions,
411 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
412 responder: RealmFactoryCreateRealmResponder,
413 },
414 #[non_exhaustive]
416 _UnknownMethod {
417 ordinal: u64,
419 control_handle: RealmFactoryControlHandle,
420 method_type: fidl::MethodType,
421 },
422}
423
424impl RealmFactoryRequest {
425 #[allow(irrefutable_let_patterns)]
426 pub fn into_create_realm(
427 self,
428 ) -> Option<(
429 RealmOptions,
430 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
431 RealmFactoryCreateRealmResponder,
432 )> {
433 if let RealmFactoryRequest::CreateRealm { options, realm_server, responder } = self {
434 Some((options, realm_server, responder))
435 } else {
436 None
437 }
438 }
439
440 pub fn method_name(&self) -> &'static str {
442 match *self {
443 RealmFactoryRequest::CreateRealm { .. } => "create_realm",
444 RealmFactoryRequest::_UnknownMethod {
445 method_type: fidl::MethodType::OneWay, ..
446 } => "unknown one-way method",
447 RealmFactoryRequest::_UnknownMethod {
448 method_type: fidl::MethodType::TwoWay, ..
449 } => "unknown two-way method",
450 }
451 }
452}
453
454#[derive(Debug, Clone)]
455pub struct RealmFactoryControlHandle {
456 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
457}
458
459impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
460 fn shutdown(&self) {
461 self.inner.shutdown()
462 }
463 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
464 self.inner.shutdown_with_epitaph(status)
465 }
466
467 fn is_closed(&self) -> bool {
468 self.inner.channel().is_closed()
469 }
470 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
471 self.inner.channel().on_closed()
472 }
473
474 #[cfg(target_os = "fuchsia")]
475 fn signal_peer(
476 &self,
477 clear_mask: zx::Signals,
478 set_mask: zx::Signals,
479 ) -> Result<(), zx_status::Status> {
480 use fidl::Peered;
481 self.inner.channel().signal_peer(clear_mask, set_mask)
482 }
483}
484
485impl RealmFactoryControlHandle {}
486
487#[must_use = "FIDL methods require a response to be sent"]
488#[derive(Debug)]
489pub struct RealmFactoryCreateRealmResponder {
490 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
491 tx_id: u32,
492}
493
494impl std::ops::Drop for RealmFactoryCreateRealmResponder {
498 fn drop(&mut self) {
499 self.control_handle.shutdown();
500 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
502 }
503}
504
505impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
506 type ControlHandle = RealmFactoryControlHandle;
507
508 fn control_handle(&self) -> &RealmFactoryControlHandle {
509 &self.control_handle
510 }
511
512 fn drop_without_shutdown(mut self) {
513 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
515 std::mem::forget(self);
517 }
518}
519
520impl RealmFactoryCreateRealmResponder {
521 pub fn send(
525 self,
526 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
527 ) -> Result<(), fidl::Error> {
528 let _result = self.send_raw(result);
529 if _result.is_err() {
530 self.control_handle.shutdown();
531 }
532 self.drop_without_shutdown();
533 _result
534 }
535
536 pub fn send_no_shutdown_on_err(
538 self,
539 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
540 ) -> Result<(), fidl::Error> {
541 let _result = self.send_raw(result);
542 self.drop_without_shutdown();
543 _result
544 }
545
546 fn send_raw(
547 &self,
548 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
549 ) -> Result<(), fidl::Error> {
550 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
551 fidl::encoding::EmptyStruct,
552 fidl_fuchsia_testing_harness::OperationError,
553 >>(
554 fidl::encoding::FlexibleResult::new(result),
555 self.tx_id,
556 0x53ebab85149ca793,
557 fidl::encoding::DynamicFlags::FLEXIBLE,
558 )
559 }
560}
561
562mod internal {
563 use super::*;
564
565 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
566 type Borrowed<'a> = &'a mut Self;
567 fn take_or_borrow<'a>(
568 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
569 ) -> Self::Borrowed<'a> {
570 value
571 }
572 }
573
574 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
575 type Owned = Self;
576
577 #[inline(always)]
578 fn inline_align(_context: fidl::encoding::Context) -> usize {
579 8
580 }
581
582 #[inline(always)]
583 fn inline_size(_context: fidl::encoding::Context) -> usize {
584 24
585 }
586 }
587
588 unsafe impl
589 fidl::encoding::Encode<
590 RealmFactoryCreateRealmRequest,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 > for &mut RealmFactoryCreateRealmRequest
593 {
594 #[inline]
595 unsafe fn encode(
596 self,
597 encoder: &mut fidl::encoding::Encoder<
598 '_,
599 fidl::encoding::DefaultFuchsiaResourceDialect,
600 >,
601 offset: usize,
602 _depth: fidl::encoding::Depth,
603 ) -> fidl::Result<()> {
604 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
605 fidl::encoding::Encode::<
607 RealmFactoryCreateRealmRequest,
608 fidl::encoding::DefaultFuchsiaResourceDialect,
609 >::encode(
610 (
611 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
612 &mut self.options,
613 ),
614 <fidl::encoding::Endpoint<
615 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
616 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
617 &mut self.realm_server,
618 ),
619 ),
620 encoder,
621 offset,
622 _depth,
623 )
624 }
625 }
626 unsafe impl<
627 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
628 T1: fidl::encoding::Encode<
629 fidl::encoding::Endpoint<
630 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
631 >,
632 fidl::encoding::DefaultFuchsiaResourceDialect,
633 >,
634 >
635 fidl::encoding::Encode<
636 RealmFactoryCreateRealmRequest,
637 fidl::encoding::DefaultFuchsiaResourceDialect,
638 > for (T0, T1)
639 {
640 #[inline]
641 unsafe fn encode(
642 self,
643 encoder: &mut fidl::encoding::Encoder<
644 '_,
645 fidl::encoding::DefaultFuchsiaResourceDialect,
646 >,
647 offset: usize,
648 depth: fidl::encoding::Depth,
649 ) -> fidl::Result<()> {
650 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
651 unsafe {
654 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
655 (ptr as *mut u64).write_unaligned(0);
656 }
657 self.0.encode(encoder, offset + 0, depth)?;
659 self.1.encode(encoder, offset + 16, depth)?;
660 Ok(())
661 }
662 }
663
664 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
665 for RealmFactoryCreateRealmRequest
666 {
667 #[inline(always)]
668 fn new_empty() -> Self {
669 Self {
670 options: fidl::new_empty!(
671 RealmOptions,
672 fidl::encoding::DefaultFuchsiaResourceDialect
673 ),
674 realm_server: fidl::new_empty!(
675 fidl::encoding::Endpoint<
676 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
677 >,
678 fidl::encoding::DefaultFuchsiaResourceDialect
679 ),
680 }
681 }
682
683 #[inline]
684 unsafe fn decode(
685 &mut self,
686 decoder: &mut fidl::encoding::Decoder<
687 '_,
688 fidl::encoding::DefaultFuchsiaResourceDialect,
689 >,
690 offset: usize,
691 _depth: fidl::encoding::Depth,
692 ) -> fidl::Result<()> {
693 decoder.debug_check_bounds::<Self>(offset);
694 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
696 let padval = unsafe { (ptr as *const u64).read_unaligned() };
697 let mask = 0xffffffff00000000u64;
698 let maskedval = padval & mask;
699 if maskedval != 0 {
700 return Err(fidl::Error::NonZeroPadding {
701 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
702 });
703 }
704 fidl::decode!(
705 RealmOptions,
706 fidl::encoding::DefaultFuchsiaResourceDialect,
707 &mut self.options,
708 decoder,
709 offset + 0,
710 _depth
711 )?;
712 fidl::decode!(
713 fidl::encoding::Endpoint<
714 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
715 >,
716 fidl::encoding::DefaultFuchsiaResourceDialect,
717 &mut self.realm_server,
718 decoder,
719 offset + 16,
720 _depth
721 )?;
722 Ok(())
723 }
724 }
725
726 impl RealmOptions {
727 #[inline(always)]
728 fn max_ordinal_present(&self) -> u64 {
729 0
730 }
731 }
732
733 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
734 type Borrowed<'a> = &'a mut Self;
735 fn take_or_borrow<'a>(
736 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
737 ) -> Self::Borrowed<'a> {
738 value
739 }
740 }
741
742 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
743 type Owned = Self;
744
745 #[inline(always)]
746 fn inline_align(_context: fidl::encoding::Context) -> usize {
747 8
748 }
749
750 #[inline(always)]
751 fn inline_size(_context: fidl::encoding::Context) -> usize {
752 16
753 }
754 }
755
756 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
757 for &mut RealmOptions
758 {
759 unsafe fn encode(
760 self,
761 encoder: &mut fidl::encoding::Encoder<
762 '_,
763 fidl::encoding::DefaultFuchsiaResourceDialect,
764 >,
765 offset: usize,
766 mut depth: fidl::encoding::Depth,
767 ) -> fidl::Result<()> {
768 encoder.debug_check_bounds::<RealmOptions>(offset);
769 let max_ordinal: u64 = self.max_ordinal_present();
771 encoder.write_num(max_ordinal, offset);
772 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
773 if max_ordinal == 0 {
775 return Ok(());
776 }
777 depth.increment()?;
778 let envelope_size = 8;
779 let bytes_len = max_ordinal as usize * envelope_size;
780 #[allow(unused_variables)]
781 let offset = encoder.out_of_line_offset(bytes_len);
782 let mut _prev_end_offset: usize = 0;
783
784 Ok(())
785 }
786 }
787
788 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
789 #[inline(always)]
790 fn new_empty() -> Self {
791 Self::default()
792 }
793
794 unsafe fn decode(
795 &mut self,
796 decoder: &mut fidl::encoding::Decoder<
797 '_,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 >,
800 offset: usize,
801 mut depth: fidl::encoding::Depth,
802 ) -> fidl::Result<()> {
803 decoder.debug_check_bounds::<Self>(offset);
804 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
805 None => return Err(fidl::Error::NotNullable),
806 Some(len) => len,
807 };
808 if len == 0 {
810 return Ok(());
811 };
812 depth.increment()?;
813 let envelope_size = 8;
814 let bytes_len = len * envelope_size;
815 let offset = decoder.out_of_line_offset(bytes_len)?;
816 let mut _next_ordinal_to_read = 0;
818 let mut next_offset = offset;
819 let end_offset = offset + bytes_len;
820
821 while next_offset < end_offset {
823 _next_ordinal_to_read += 1;
824 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
825 next_offset += envelope_size;
826 }
827
828 Ok(())
829 }
830 }
831}