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