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