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_fuchsia_ui_test_context_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct RealmFactoryCreateRealmRequest {
16 pub realm_server:
17 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>>,
18 pub display_rotation: Option<u32>,
19 pub device_pixel_ratio: Option<f32>,
20 #[doc(hidden)]
21 pub __source_breaking: fidl::marker::SourceBreaking,
22}
23
24impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
25 for RealmFactoryCreateRealmRequest
26{
27}
28
29#[derive(Debug, Default, PartialEq)]
30pub struct ScenicRealmFactoryCreateRealmRequest {
31 pub realm_server:
32 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>>,
33 pub renderer: Option<RendererType>,
34 pub display_rotation: Option<u64>,
35 pub display_composition: Option<bool>,
36 #[doc(hidden)]
37 pub __source_breaking: fidl::marker::SourceBreaking,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41 for ScenicRealmFactoryCreateRealmRequest
42{
43}
44
45#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub struct RealmFactoryMarker;
47
48impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
49 type Proxy = RealmFactoryProxy;
50 type RequestStream = RealmFactoryRequestStream;
51 #[cfg(target_os = "fuchsia")]
52 type SynchronousProxy = RealmFactorySynchronousProxy;
53
54 const DEBUG_NAME: &'static str = "fuchsia.ui.test.context.RealmFactory";
55}
56impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
57pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
58
59pub trait RealmFactoryProxyInterface: Send + Sync {
60 type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
61 + Send;
62 fn r#create_realm(
63 &self,
64 payload: RealmFactoryCreateRealmRequest,
65 ) -> Self::CreateRealmResponseFut;
66}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct RealmFactorySynchronousProxy {
70 client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
75 type Proxy = RealmFactoryProxy;
76 type Protocol = RealmFactoryMarker;
77
78 fn from_channel(inner: fidl::Channel) -> Self {
79 Self::new(inner)
80 }
81
82 fn into_channel(self) -> fidl::Channel {
83 self.client.into_channel()
84 }
85
86 fn as_channel(&self) -> &fidl::Channel {
87 self.client.as_channel()
88 }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl RealmFactorySynchronousProxy {
93 pub fn new(channel: fidl::Channel) -> Self {
94 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96 }
97
98 pub fn into_channel(self) -> fidl::Channel {
99 self.client.into_channel()
100 }
101
102 pub fn wait_for_event(
105 &self,
106 deadline: zx::MonotonicInstant,
107 ) -> Result<RealmFactoryEvent, fidl::Error> {
108 RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
109 }
110
111 pub fn r#create_realm(
112 &self,
113 mut payload: RealmFactoryCreateRealmRequest,
114 ___deadline: zx::MonotonicInstant,
115 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
116 let _response = self
117 .client
118 .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
119 fidl::encoding::EmptyStruct,
120 fidl_fuchsia_testing_harness::OperationError,
121 >>(
122 &mut payload,
123 0x6e1c904f44c7d0fc,
124 fidl::encoding::DynamicFlags::FLEXIBLE,
125 ___deadline,
126 )?
127 .into_result::<RealmFactoryMarker>("create_realm")?;
128 Ok(_response.map(|x| x))
129 }
130}
131
132#[cfg(target_os = "fuchsia")]
133impl From<RealmFactorySynchronousProxy> for zx::Handle {
134 fn from(value: RealmFactorySynchronousProxy) -> Self {
135 value.into_channel().into()
136 }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl From<fidl::Channel> for RealmFactorySynchronousProxy {
141 fn from(value: fidl::Channel) -> Self {
142 Self::new(value)
143 }
144}
145
146#[derive(Debug, Clone)]
147pub struct RealmFactoryProxy {
148 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
149}
150
151impl fidl::endpoints::Proxy for RealmFactoryProxy {
152 type Protocol = RealmFactoryMarker;
153
154 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
155 Self::new(inner)
156 }
157
158 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
159 self.client.into_channel().map_err(|client| Self { client })
160 }
161
162 fn as_channel(&self) -> &::fidl::AsyncChannel {
163 self.client.as_channel()
164 }
165}
166
167impl RealmFactoryProxy {
168 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
170 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
171 Self { client: fidl::client::Client::new(channel, protocol_name) }
172 }
173
174 pub fn take_event_stream(&self) -> RealmFactoryEventStream {
180 RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
181 }
182
183 pub fn r#create_realm(
184 &self,
185 mut payload: RealmFactoryCreateRealmRequest,
186 ) -> fidl::client::QueryResponseFut<
187 RealmFactoryCreateRealmResult,
188 fidl::encoding::DefaultFuchsiaResourceDialect,
189 > {
190 RealmFactoryProxyInterface::r#create_realm(self, payload)
191 }
192}
193
194impl RealmFactoryProxyInterface for RealmFactoryProxy {
195 type CreateRealmResponseFut = fidl::client::QueryResponseFut<
196 RealmFactoryCreateRealmResult,
197 fidl::encoding::DefaultFuchsiaResourceDialect,
198 >;
199 fn r#create_realm(
200 &self,
201 mut payload: RealmFactoryCreateRealmRequest,
202 ) -> Self::CreateRealmResponseFut {
203 fn _decode(
204 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
205 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
206 let _response = fidl::client::decode_transaction_body::<
207 fidl::encoding::FlexibleResultType<
208 fidl::encoding::EmptyStruct,
209 fidl_fuchsia_testing_harness::OperationError,
210 >,
211 fidl::encoding::DefaultFuchsiaResourceDialect,
212 0x6e1c904f44c7d0fc,
213 >(_buf?)?
214 .into_result::<RealmFactoryMarker>("create_realm")?;
215 Ok(_response.map(|x| x))
216 }
217 self.client
218 .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
219 &mut payload,
220 0x6e1c904f44c7d0fc,
221 fidl::encoding::DynamicFlags::FLEXIBLE,
222 _decode,
223 )
224 }
225}
226
227pub struct RealmFactoryEventStream {
228 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
229}
230
231impl std::marker::Unpin for RealmFactoryEventStream {}
232
233impl futures::stream::FusedStream for RealmFactoryEventStream {
234 fn is_terminated(&self) -> bool {
235 self.event_receiver.is_terminated()
236 }
237}
238
239impl futures::Stream for RealmFactoryEventStream {
240 type Item = Result<RealmFactoryEvent, fidl::Error>;
241
242 fn poll_next(
243 mut self: std::pin::Pin<&mut Self>,
244 cx: &mut std::task::Context<'_>,
245 ) -> std::task::Poll<Option<Self::Item>> {
246 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
247 &mut self.event_receiver,
248 cx
249 )?) {
250 Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
251 None => std::task::Poll::Ready(None),
252 }
253 }
254}
255
256#[derive(Debug)]
257pub enum RealmFactoryEvent {
258 #[non_exhaustive]
259 _UnknownEvent {
260 ordinal: u64,
262 },
263}
264
265impl RealmFactoryEvent {
266 fn decode(
268 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
269 ) -> Result<RealmFactoryEvent, fidl::Error> {
270 let (bytes, _handles) = buf.split_mut();
271 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
272 debug_assert_eq!(tx_header.tx_id, 0);
273 match tx_header.ordinal {
274 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
275 Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
276 }
277 _ => Err(fidl::Error::UnknownOrdinal {
278 ordinal: tx_header.ordinal,
279 protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
280 }),
281 }
282 }
283}
284
285pub struct RealmFactoryRequestStream {
287 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
288 is_terminated: bool,
289}
290
291impl std::marker::Unpin for RealmFactoryRequestStream {}
292
293impl futures::stream::FusedStream for RealmFactoryRequestStream {
294 fn is_terminated(&self) -> bool {
295 self.is_terminated
296 }
297}
298
299impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
300 type Protocol = RealmFactoryMarker;
301 type ControlHandle = RealmFactoryControlHandle;
302
303 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
304 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
305 }
306
307 fn control_handle(&self) -> Self::ControlHandle {
308 RealmFactoryControlHandle { inner: self.inner.clone() }
309 }
310
311 fn into_inner(
312 self,
313 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
314 {
315 (self.inner, self.is_terminated)
316 }
317
318 fn from_inner(
319 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
320 is_terminated: bool,
321 ) -> Self {
322 Self { inner, is_terminated }
323 }
324}
325
326impl futures::Stream for RealmFactoryRequestStream {
327 type Item = Result<RealmFactoryRequest, fidl::Error>;
328
329 fn poll_next(
330 mut self: std::pin::Pin<&mut Self>,
331 cx: &mut std::task::Context<'_>,
332 ) -> std::task::Poll<Option<Self::Item>> {
333 let this = &mut *self;
334 if this.inner.check_shutdown(cx) {
335 this.is_terminated = true;
336 return std::task::Poll::Ready(None);
337 }
338 if this.is_terminated {
339 panic!("polled RealmFactoryRequestStream after completion");
340 }
341 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
342 |bytes, handles| {
343 match this.inner.channel().read_etc(cx, bytes, handles) {
344 std::task::Poll::Ready(Ok(())) => {}
345 std::task::Poll::Pending => return std::task::Poll::Pending,
346 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
347 this.is_terminated = true;
348 return std::task::Poll::Ready(None);
349 }
350 std::task::Poll::Ready(Err(e)) => {
351 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
352 e.into(),
353 ))))
354 }
355 }
356
357 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
359
360 std::task::Poll::Ready(Some(match header.ordinal {
361 0x6e1c904f44c7d0fc => {
362 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
363 let mut req = fidl::new_empty!(
364 RealmFactoryCreateRealmRequest,
365 fidl::encoding::DefaultFuchsiaResourceDialect
366 );
367 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
368 let control_handle =
369 RealmFactoryControlHandle { inner: this.inner.clone() };
370 Ok(RealmFactoryRequest::CreateRealm {
371 payload: req,
372 responder: RealmFactoryCreateRealmResponder {
373 control_handle: std::mem::ManuallyDrop::new(control_handle),
374 tx_id: header.tx_id,
375 },
376 })
377 }
378 _ if header.tx_id == 0
379 && header
380 .dynamic_flags()
381 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
382 {
383 Ok(RealmFactoryRequest::_UnknownMethod {
384 ordinal: header.ordinal,
385 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
386 method_type: fidl::MethodType::OneWay,
387 })
388 }
389 _ if header
390 .dynamic_flags()
391 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
392 {
393 this.inner.send_framework_err(
394 fidl::encoding::FrameworkErr::UnknownMethod,
395 header.tx_id,
396 header.ordinal,
397 header.dynamic_flags(),
398 (bytes, handles),
399 )?;
400 Ok(RealmFactoryRequest::_UnknownMethod {
401 ordinal: header.ordinal,
402 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
403 method_type: fidl::MethodType::TwoWay,
404 })
405 }
406 _ => Err(fidl::Error::UnknownOrdinal {
407 ordinal: header.ordinal,
408 protocol_name:
409 <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
410 }),
411 }))
412 },
413 )
414 }
415}
416
417#[derive(Debug)]
421pub enum RealmFactoryRequest {
422 CreateRealm {
423 payload: RealmFactoryCreateRealmRequest,
424 responder: RealmFactoryCreateRealmResponder,
425 },
426 #[non_exhaustive]
428 _UnknownMethod {
429 ordinal: u64,
431 control_handle: RealmFactoryControlHandle,
432 method_type: fidl::MethodType,
433 },
434}
435
436impl RealmFactoryRequest {
437 #[allow(irrefutable_let_patterns)]
438 pub fn into_create_realm(
439 self,
440 ) -> Option<(RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResponder)> {
441 if let RealmFactoryRequest::CreateRealm { payload, responder } = self {
442 Some((payload, responder))
443 } else {
444 None
445 }
446 }
447
448 pub fn method_name(&self) -> &'static str {
450 match *self {
451 RealmFactoryRequest::CreateRealm { .. } => "create_realm",
452 RealmFactoryRequest::_UnknownMethod {
453 method_type: fidl::MethodType::OneWay, ..
454 } => "unknown one-way method",
455 RealmFactoryRequest::_UnknownMethod {
456 method_type: fidl::MethodType::TwoWay, ..
457 } => "unknown two-way method",
458 }
459 }
460}
461
462#[derive(Debug, Clone)]
463pub struct RealmFactoryControlHandle {
464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
465}
466
467impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
468 fn shutdown(&self) {
469 self.inner.shutdown()
470 }
471 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
472 self.inner.shutdown_with_epitaph(status)
473 }
474
475 fn is_closed(&self) -> bool {
476 self.inner.channel().is_closed()
477 }
478 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
479 self.inner.channel().on_closed()
480 }
481
482 #[cfg(target_os = "fuchsia")]
483 fn signal_peer(
484 &self,
485 clear_mask: zx::Signals,
486 set_mask: zx::Signals,
487 ) -> Result<(), zx_status::Status> {
488 use fidl::Peered;
489 self.inner.channel().signal_peer(clear_mask, set_mask)
490 }
491}
492
493impl RealmFactoryControlHandle {}
494
495#[must_use = "FIDL methods require a response to be sent"]
496#[derive(Debug)]
497pub struct RealmFactoryCreateRealmResponder {
498 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
499 tx_id: u32,
500}
501
502impl std::ops::Drop for RealmFactoryCreateRealmResponder {
506 fn drop(&mut self) {
507 self.control_handle.shutdown();
508 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
510 }
511}
512
513impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
514 type ControlHandle = RealmFactoryControlHandle;
515
516 fn control_handle(&self) -> &RealmFactoryControlHandle {
517 &self.control_handle
518 }
519
520 fn drop_without_shutdown(mut self) {
521 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
523 std::mem::forget(self);
525 }
526}
527
528impl RealmFactoryCreateRealmResponder {
529 pub fn send(
533 self,
534 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
535 ) -> Result<(), fidl::Error> {
536 let _result = self.send_raw(result);
537 if _result.is_err() {
538 self.control_handle.shutdown();
539 }
540 self.drop_without_shutdown();
541 _result
542 }
543
544 pub fn send_no_shutdown_on_err(
546 self,
547 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
548 ) -> Result<(), fidl::Error> {
549 let _result = self.send_raw(result);
550 self.drop_without_shutdown();
551 _result
552 }
553
554 fn send_raw(
555 &self,
556 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
557 ) -> Result<(), fidl::Error> {
558 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
559 fidl::encoding::EmptyStruct,
560 fidl_fuchsia_testing_harness::OperationError,
561 >>(
562 fidl::encoding::FlexibleResult::new(result),
563 self.tx_id,
564 0x6e1c904f44c7d0fc,
565 fidl::encoding::DynamicFlags::FLEXIBLE,
566 )
567 }
568}
569
570#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
571pub struct ScenicRealmFactoryMarker;
572
573impl fidl::endpoints::ProtocolMarker for ScenicRealmFactoryMarker {
574 type Proxy = ScenicRealmFactoryProxy;
575 type RequestStream = ScenicRealmFactoryRequestStream;
576 #[cfg(target_os = "fuchsia")]
577 type SynchronousProxy = ScenicRealmFactorySynchronousProxy;
578
579 const DEBUG_NAME: &'static str = "fuchsia.ui.test.context.ScenicRealmFactory";
580}
581impl fidl::endpoints::DiscoverableProtocolMarker for ScenicRealmFactoryMarker {}
582pub type ScenicRealmFactoryCreateRealmResult =
583 Result<(), fidl_fuchsia_testing_harness::OperationError>;
584
585pub trait ScenicRealmFactoryProxyInterface: Send + Sync {
586 type CreateRealmResponseFut: std::future::Future<Output = Result<ScenicRealmFactoryCreateRealmResult, fidl::Error>>
587 + Send;
588 fn r#create_realm(
589 &self,
590 payload: ScenicRealmFactoryCreateRealmRequest,
591 ) -> Self::CreateRealmResponseFut;
592}
593#[derive(Debug)]
594#[cfg(target_os = "fuchsia")]
595pub struct ScenicRealmFactorySynchronousProxy {
596 client: fidl::client::sync::Client,
597}
598
599#[cfg(target_os = "fuchsia")]
600impl fidl::endpoints::SynchronousProxy for ScenicRealmFactorySynchronousProxy {
601 type Proxy = ScenicRealmFactoryProxy;
602 type Protocol = ScenicRealmFactoryMarker;
603
604 fn from_channel(inner: fidl::Channel) -> Self {
605 Self::new(inner)
606 }
607
608 fn into_channel(self) -> fidl::Channel {
609 self.client.into_channel()
610 }
611
612 fn as_channel(&self) -> &fidl::Channel {
613 self.client.as_channel()
614 }
615}
616
617#[cfg(target_os = "fuchsia")]
618impl ScenicRealmFactorySynchronousProxy {
619 pub fn new(channel: fidl::Channel) -> Self {
620 let protocol_name =
621 <ScenicRealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
622 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
623 }
624
625 pub fn into_channel(self) -> fidl::Channel {
626 self.client.into_channel()
627 }
628
629 pub fn wait_for_event(
632 &self,
633 deadline: zx::MonotonicInstant,
634 ) -> Result<ScenicRealmFactoryEvent, fidl::Error> {
635 ScenicRealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
636 }
637
638 pub fn r#create_realm(
639 &self,
640 mut payload: ScenicRealmFactoryCreateRealmRequest,
641 ___deadline: zx::MonotonicInstant,
642 ) -> Result<ScenicRealmFactoryCreateRealmResult, fidl::Error> {
643 let _response = self
644 .client
645 .send_query::<ScenicRealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
646 fidl::encoding::EmptyStruct,
647 fidl_fuchsia_testing_harness::OperationError,
648 >>(
649 &mut payload,
650 0x11f2157d1648e6ba,
651 fidl::encoding::DynamicFlags::FLEXIBLE,
652 ___deadline,
653 )?
654 .into_result::<ScenicRealmFactoryMarker>("create_realm")?;
655 Ok(_response.map(|x| x))
656 }
657}
658
659#[cfg(target_os = "fuchsia")]
660impl From<ScenicRealmFactorySynchronousProxy> for zx::Handle {
661 fn from(value: ScenicRealmFactorySynchronousProxy) -> Self {
662 value.into_channel().into()
663 }
664}
665
666#[cfg(target_os = "fuchsia")]
667impl From<fidl::Channel> for ScenicRealmFactorySynchronousProxy {
668 fn from(value: fidl::Channel) -> Self {
669 Self::new(value)
670 }
671}
672
673#[derive(Debug, Clone)]
674pub struct ScenicRealmFactoryProxy {
675 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
676}
677
678impl fidl::endpoints::Proxy for ScenicRealmFactoryProxy {
679 type Protocol = ScenicRealmFactoryMarker;
680
681 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
682 Self::new(inner)
683 }
684
685 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
686 self.client.into_channel().map_err(|client| Self { client })
687 }
688
689 fn as_channel(&self) -> &::fidl::AsyncChannel {
690 self.client.as_channel()
691 }
692}
693
694impl ScenicRealmFactoryProxy {
695 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
697 let protocol_name =
698 <ScenicRealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
699 Self { client: fidl::client::Client::new(channel, protocol_name) }
700 }
701
702 pub fn take_event_stream(&self) -> ScenicRealmFactoryEventStream {
708 ScenicRealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
709 }
710
711 pub fn r#create_realm(
712 &self,
713 mut payload: ScenicRealmFactoryCreateRealmRequest,
714 ) -> fidl::client::QueryResponseFut<
715 ScenicRealmFactoryCreateRealmResult,
716 fidl::encoding::DefaultFuchsiaResourceDialect,
717 > {
718 ScenicRealmFactoryProxyInterface::r#create_realm(self, payload)
719 }
720}
721
722impl ScenicRealmFactoryProxyInterface for ScenicRealmFactoryProxy {
723 type CreateRealmResponseFut = fidl::client::QueryResponseFut<
724 ScenicRealmFactoryCreateRealmResult,
725 fidl::encoding::DefaultFuchsiaResourceDialect,
726 >;
727 fn r#create_realm(
728 &self,
729 mut payload: ScenicRealmFactoryCreateRealmRequest,
730 ) -> Self::CreateRealmResponseFut {
731 fn _decode(
732 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
733 ) -> Result<ScenicRealmFactoryCreateRealmResult, fidl::Error> {
734 let _response = fidl::client::decode_transaction_body::<
735 fidl::encoding::FlexibleResultType<
736 fidl::encoding::EmptyStruct,
737 fidl_fuchsia_testing_harness::OperationError,
738 >,
739 fidl::encoding::DefaultFuchsiaResourceDialect,
740 0x11f2157d1648e6ba,
741 >(_buf?)?
742 .into_result::<ScenicRealmFactoryMarker>("create_realm")?;
743 Ok(_response.map(|x| x))
744 }
745 self.client.send_query_and_decode::<
746 ScenicRealmFactoryCreateRealmRequest,
747 ScenicRealmFactoryCreateRealmResult,
748 >(
749 &mut payload,
750 0x11f2157d1648e6ba,
751 fidl::encoding::DynamicFlags::FLEXIBLE,
752 _decode,
753 )
754 }
755}
756
757pub struct ScenicRealmFactoryEventStream {
758 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
759}
760
761impl std::marker::Unpin for ScenicRealmFactoryEventStream {}
762
763impl futures::stream::FusedStream for ScenicRealmFactoryEventStream {
764 fn is_terminated(&self) -> bool {
765 self.event_receiver.is_terminated()
766 }
767}
768
769impl futures::Stream for ScenicRealmFactoryEventStream {
770 type Item = Result<ScenicRealmFactoryEvent, fidl::Error>;
771
772 fn poll_next(
773 mut self: std::pin::Pin<&mut Self>,
774 cx: &mut std::task::Context<'_>,
775 ) -> std::task::Poll<Option<Self::Item>> {
776 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
777 &mut self.event_receiver,
778 cx
779 )?) {
780 Some(buf) => std::task::Poll::Ready(Some(ScenicRealmFactoryEvent::decode(buf))),
781 None => std::task::Poll::Ready(None),
782 }
783 }
784}
785
786#[derive(Debug)]
787pub enum ScenicRealmFactoryEvent {
788 #[non_exhaustive]
789 _UnknownEvent {
790 ordinal: u64,
792 },
793}
794
795impl ScenicRealmFactoryEvent {
796 fn decode(
798 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
799 ) -> Result<ScenicRealmFactoryEvent, fidl::Error> {
800 let (bytes, _handles) = buf.split_mut();
801 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
802 debug_assert_eq!(tx_header.tx_id, 0);
803 match tx_header.ordinal {
804 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
805 Ok(ScenicRealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
806 }
807 _ => Err(fidl::Error::UnknownOrdinal {
808 ordinal: tx_header.ordinal,
809 protocol_name:
810 <ScenicRealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
811 }),
812 }
813 }
814}
815
816pub struct ScenicRealmFactoryRequestStream {
818 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
819 is_terminated: bool,
820}
821
822impl std::marker::Unpin for ScenicRealmFactoryRequestStream {}
823
824impl futures::stream::FusedStream for ScenicRealmFactoryRequestStream {
825 fn is_terminated(&self) -> bool {
826 self.is_terminated
827 }
828}
829
830impl fidl::endpoints::RequestStream for ScenicRealmFactoryRequestStream {
831 type Protocol = ScenicRealmFactoryMarker;
832 type ControlHandle = ScenicRealmFactoryControlHandle;
833
834 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
835 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
836 }
837
838 fn control_handle(&self) -> Self::ControlHandle {
839 ScenicRealmFactoryControlHandle { inner: self.inner.clone() }
840 }
841
842 fn into_inner(
843 self,
844 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
845 {
846 (self.inner, self.is_terminated)
847 }
848
849 fn from_inner(
850 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
851 is_terminated: bool,
852 ) -> Self {
853 Self { inner, is_terminated }
854 }
855}
856
857impl futures::Stream for ScenicRealmFactoryRequestStream {
858 type Item = Result<ScenicRealmFactoryRequest, fidl::Error>;
859
860 fn poll_next(
861 mut self: std::pin::Pin<&mut Self>,
862 cx: &mut std::task::Context<'_>,
863 ) -> std::task::Poll<Option<Self::Item>> {
864 let this = &mut *self;
865 if this.inner.check_shutdown(cx) {
866 this.is_terminated = true;
867 return std::task::Poll::Ready(None);
868 }
869 if this.is_terminated {
870 panic!("polled ScenicRealmFactoryRequestStream after completion");
871 }
872 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
873 |bytes, handles| {
874 match this.inner.channel().read_etc(cx, bytes, handles) {
875 std::task::Poll::Ready(Ok(())) => {}
876 std::task::Poll::Pending => return std::task::Poll::Pending,
877 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
878 this.is_terminated = true;
879 return std::task::Poll::Ready(None);
880 }
881 std::task::Poll::Ready(Err(e)) => {
882 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
883 e.into(),
884 ))))
885 }
886 }
887
888 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
890
891 std::task::Poll::Ready(Some(match header.ordinal {
892 0x11f2157d1648e6ba => {
893 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
894 let mut req = fidl::new_empty!(ScenicRealmFactoryCreateRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
895 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScenicRealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
896 let control_handle = ScenicRealmFactoryControlHandle {
897 inner: this.inner.clone(),
898 };
899 Ok(ScenicRealmFactoryRequest::CreateRealm {payload: req,
900 responder: ScenicRealmFactoryCreateRealmResponder {
901 control_handle: std::mem::ManuallyDrop::new(control_handle),
902 tx_id: header.tx_id,
903 },
904 })
905 }
906 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
907 Ok(ScenicRealmFactoryRequest::_UnknownMethod {
908 ordinal: header.ordinal,
909 control_handle: ScenicRealmFactoryControlHandle { inner: this.inner.clone() },
910 method_type: fidl::MethodType::OneWay,
911 })
912 }
913 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
914 this.inner.send_framework_err(
915 fidl::encoding::FrameworkErr::UnknownMethod,
916 header.tx_id,
917 header.ordinal,
918 header.dynamic_flags(),
919 (bytes, handles),
920 )?;
921 Ok(ScenicRealmFactoryRequest::_UnknownMethod {
922 ordinal: header.ordinal,
923 control_handle: ScenicRealmFactoryControlHandle { inner: this.inner.clone() },
924 method_type: fidl::MethodType::TwoWay,
925 })
926 }
927 _ => Err(fidl::Error::UnknownOrdinal {
928 ordinal: header.ordinal,
929 protocol_name: <ScenicRealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
930 }),
931 }))
932 },
933 )
934 }
935}
936
937#[derive(Debug)]
941pub enum ScenicRealmFactoryRequest {
942 CreateRealm {
943 payload: ScenicRealmFactoryCreateRealmRequest,
944 responder: ScenicRealmFactoryCreateRealmResponder,
945 },
946 #[non_exhaustive]
948 _UnknownMethod {
949 ordinal: u64,
951 control_handle: ScenicRealmFactoryControlHandle,
952 method_type: fidl::MethodType,
953 },
954}
955
956impl ScenicRealmFactoryRequest {
957 #[allow(irrefutable_let_patterns)]
958 pub fn into_create_realm(
959 self,
960 ) -> Option<(ScenicRealmFactoryCreateRealmRequest, ScenicRealmFactoryCreateRealmResponder)>
961 {
962 if let ScenicRealmFactoryRequest::CreateRealm { payload, responder } = self {
963 Some((payload, responder))
964 } else {
965 None
966 }
967 }
968
969 pub fn method_name(&self) -> &'static str {
971 match *self {
972 ScenicRealmFactoryRequest::CreateRealm { .. } => "create_realm",
973 ScenicRealmFactoryRequest::_UnknownMethod {
974 method_type: fidl::MethodType::OneWay,
975 ..
976 } => "unknown one-way method",
977 ScenicRealmFactoryRequest::_UnknownMethod {
978 method_type: fidl::MethodType::TwoWay,
979 ..
980 } => "unknown two-way method",
981 }
982 }
983}
984
985#[derive(Debug, Clone)]
986pub struct ScenicRealmFactoryControlHandle {
987 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
988}
989
990impl fidl::endpoints::ControlHandle for ScenicRealmFactoryControlHandle {
991 fn shutdown(&self) {
992 self.inner.shutdown()
993 }
994 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
995 self.inner.shutdown_with_epitaph(status)
996 }
997
998 fn is_closed(&self) -> bool {
999 self.inner.channel().is_closed()
1000 }
1001 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1002 self.inner.channel().on_closed()
1003 }
1004
1005 #[cfg(target_os = "fuchsia")]
1006 fn signal_peer(
1007 &self,
1008 clear_mask: zx::Signals,
1009 set_mask: zx::Signals,
1010 ) -> Result<(), zx_status::Status> {
1011 use fidl::Peered;
1012 self.inner.channel().signal_peer(clear_mask, set_mask)
1013 }
1014}
1015
1016impl ScenicRealmFactoryControlHandle {}
1017
1018#[must_use = "FIDL methods require a response to be sent"]
1019#[derive(Debug)]
1020pub struct ScenicRealmFactoryCreateRealmResponder {
1021 control_handle: std::mem::ManuallyDrop<ScenicRealmFactoryControlHandle>,
1022 tx_id: u32,
1023}
1024
1025impl std::ops::Drop for ScenicRealmFactoryCreateRealmResponder {
1029 fn drop(&mut self) {
1030 self.control_handle.shutdown();
1031 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1033 }
1034}
1035
1036impl fidl::endpoints::Responder for ScenicRealmFactoryCreateRealmResponder {
1037 type ControlHandle = ScenicRealmFactoryControlHandle;
1038
1039 fn control_handle(&self) -> &ScenicRealmFactoryControlHandle {
1040 &self.control_handle
1041 }
1042
1043 fn drop_without_shutdown(mut self) {
1044 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1046 std::mem::forget(self);
1048 }
1049}
1050
1051impl ScenicRealmFactoryCreateRealmResponder {
1052 pub fn send(
1056 self,
1057 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1058 ) -> Result<(), fidl::Error> {
1059 let _result = self.send_raw(result);
1060 if _result.is_err() {
1061 self.control_handle.shutdown();
1062 }
1063 self.drop_without_shutdown();
1064 _result
1065 }
1066
1067 pub fn send_no_shutdown_on_err(
1069 self,
1070 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1071 ) -> Result<(), fidl::Error> {
1072 let _result = self.send_raw(result);
1073 self.drop_without_shutdown();
1074 _result
1075 }
1076
1077 fn send_raw(
1078 &self,
1079 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
1080 ) -> Result<(), fidl::Error> {
1081 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1082 fidl::encoding::EmptyStruct,
1083 fidl_fuchsia_testing_harness::OperationError,
1084 >>(
1085 fidl::encoding::FlexibleResult::new(result),
1086 self.tx_id,
1087 0x11f2157d1648e6ba,
1088 fidl::encoding::DynamicFlags::FLEXIBLE,
1089 )
1090 }
1091}
1092
1093mod internal {
1094 use super::*;
1095
1096 impl RealmFactoryCreateRealmRequest {
1097 #[inline(always)]
1098 fn max_ordinal_present(&self) -> u64 {
1099 if let Some(_) = self.device_pixel_ratio {
1100 return 3;
1101 }
1102 if let Some(_) = self.display_rotation {
1103 return 2;
1104 }
1105 if let Some(_) = self.realm_server {
1106 return 1;
1107 }
1108 0
1109 }
1110 }
1111
1112 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
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 RealmFactoryCreateRealmRequest {
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 16
1132 }
1133 }
1134
1135 unsafe impl
1136 fidl::encoding::Encode<
1137 RealmFactoryCreateRealmRequest,
1138 fidl::encoding::DefaultFuchsiaResourceDialect,
1139 > for &mut RealmFactoryCreateRealmRequest
1140 {
1141 unsafe fn encode(
1142 self,
1143 encoder: &mut fidl::encoding::Encoder<
1144 '_,
1145 fidl::encoding::DefaultFuchsiaResourceDialect,
1146 >,
1147 offset: usize,
1148 mut depth: fidl::encoding::Depth,
1149 ) -> fidl::Result<()> {
1150 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1151 let max_ordinal: u64 = self.max_ordinal_present();
1153 encoder.write_num(max_ordinal, offset);
1154 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1155 if max_ordinal == 0 {
1157 return Ok(());
1158 }
1159 depth.increment()?;
1160 let envelope_size = 8;
1161 let bytes_len = max_ordinal as usize * envelope_size;
1162 #[allow(unused_variables)]
1163 let offset = encoder.out_of_line_offset(bytes_len);
1164 let mut _prev_end_offset: usize = 0;
1165 if 1 > max_ordinal {
1166 return Ok(());
1167 }
1168
1169 let cur_offset: usize = (1 - 1) * envelope_size;
1172
1173 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1175
1176 fidl::encoding::encode_in_envelope_optional::<
1181 fidl::encoding::Endpoint<
1182 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1183 >,
1184 fidl::encoding::DefaultFuchsiaResourceDialect,
1185 >(
1186 self.realm_server.as_mut().map(
1187 <fidl::encoding::Endpoint<
1188 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1189 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1190 ),
1191 encoder,
1192 offset + cur_offset,
1193 depth,
1194 )?;
1195
1196 _prev_end_offset = cur_offset + envelope_size;
1197 if 2 > max_ordinal {
1198 return Ok(());
1199 }
1200
1201 let cur_offset: usize = (2 - 1) * envelope_size;
1204
1205 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1207
1208 fidl::encoding::encode_in_envelope_optional::<
1213 u32,
1214 fidl::encoding::DefaultFuchsiaResourceDialect,
1215 >(
1216 self.display_rotation
1217 .as_ref()
1218 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1219 encoder,
1220 offset + cur_offset,
1221 depth,
1222 )?;
1223
1224 _prev_end_offset = cur_offset + envelope_size;
1225 if 3 > max_ordinal {
1226 return Ok(());
1227 }
1228
1229 let cur_offset: usize = (3 - 1) * envelope_size;
1232
1233 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1235
1236 fidl::encoding::encode_in_envelope_optional::<
1241 f32,
1242 fidl::encoding::DefaultFuchsiaResourceDialect,
1243 >(
1244 self.device_pixel_ratio
1245 .as_ref()
1246 .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
1247 encoder,
1248 offset + cur_offset,
1249 depth,
1250 )?;
1251
1252 _prev_end_offset = cur_offset + envelope_size;
1253
1254 Ok(())
1255 }
1256 }
1257
1258 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1259 for RealmFactoryCreateRealmRequest
1260 {
1261 #[inline(always)]
1262 fn new_empty() -> Self {
1263 Self::default()
1264 }
1265
1266 unsafe fn decode(
1267 &mut self,
1268 decoder: &mut fidl::encoding::Decoder<
1269 '_,
1270 fidl::encoding::DefaultFuchsiaResourceDialect,
1271 >,
1272 offset: usize,
1273 mut depth: fidl::encoding::Depth,
1274 ) -> fidl::Result<()> {
1275 decoder.debug_check_bounds::<Self>(offset);
1276 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1277 None => return Err(fidl::Error::NotNullable),
1278 Some(len) => len,
1279 };
1280 if len == 0 {
1282 return Ok(());
1283 };
1284 depth.increment()?;
1285 let envelope_size = 8;
1286 let bytes_len = len * envelope_size;
1287 let offset = decoder.out_of_line_offset(bytes_len)?;
1288 let mut _next_ordinal_to_read = 0;
1290 let mut next_offset = offset;
1291 let end_offset = offset + bytes_len;
1292 _next_ordinal_to_read += 1;
1293 if next_offset >= end_offset {
1294 return Ok(());
1295 }
1296
1297 while _next_ordinal_to_read < 1 {
1299 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1300 _next_ordinal_to_read += 1;
1301 next_offset += envelope_size;
1302 }
1303
1304 let next_out_of_line = decoder.next_out_of_line();
1305 let handles_before = decoder.remaining_handles();
1306 if let Some((inlined, num_bytes, num_handles)) =
1307 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1308 {
1309 let member_inline_size = <fidl::encoding::Endpoint<
1310 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1311 > as fidl::encoding::TypeMarker>::inline_size(
1312 decoder.context
1313 );
1314 if inlined != (member_inline_size <= 4) {
1315 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1316 }
1317 let inner_offset;
1318 let mut inner_depth = depth.clone();
1319 if inlined {
1320 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1321 inner_offset = next_offset;
1322 } else {
1323 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1324 inner_depth.increment()?;
1325 }
1326 let val_ref = self.realm_server.get_or_insert_with(|| {
1327 fidl::new_empty!(
1328 fidl::encoding::Endpoint<
1329 fidl::endpoints::ServerEnd<
1330 fidl_fuchsia_testing_harness::RealmProxy_Marker,
1331 >,
1332 >,
1333 fidl::encoding::DefaultFuchsiaResourceDialect
1334 )
1335 });
1336 fidl::decode!(
1337 fidl::encoding::Endpoint<
1338 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1339 >,
1340 fidl::encoding::DefaultFuchsiaResourceDialect,
1341 val_ref,
1342 decoder,
1343 inner_offset,
1344 inner_depth
1345 )?;
1346 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1347 {
1348 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1349 }
1350 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1351 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1352 }
1353 }
1354
1355 next_offset += envelope_size;
1356 _next_ordinal_to_read += 1;
1357 if next_offset >= end_offset {
1358 return Ok(());
1359 }
1360
1361 while _next_ordinal_to_read < 2 {
1363 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1364 _next_ordinal_to_read += 1;
1365 next_offset += envelope_size;
1366 }
1367
1368 let next_out_of_line = decoder.next_out_of_line();
1369 let handles_before = decoder.remaining_handles();
1370 if let Some((inlined, num_bytes, num_handles)) =
1371 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1372 {
1373 let member_inline_size =
1374 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1375 if inlined != (member_inline_size <= 4) {
1376 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1377 }
1378 let inner_offset;
1379 let mut inner_depth = depth.clone();
1380 if inlined {
1381 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1382 inner_offset = next_offset;
1383 } else {
1384 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1385 inner_depth.increment()?;
1386 }
1387 let val_ref = self.display_rotation.get_or_insert_with(|| {
1388 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1389 });
1390 fidl::decode!(
1391 u32,
1392 fidl::encoding::DefaultFuchsiaResourceDialect,
1393 val_ref,
1394 decoder,
1395 inner_offset,
1396 inner_depth
1397 )?;
1398 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1399 {
1400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1401 }
1402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1404 }
1405 }
1406
1407 next_offset += envelope_size;
1408 _next_ordinal_to_read += 1;
1409 if next_offset >= end_offset {
1410 return Ok(());
1411 }
1412
1413 while _next_ordinal_to_read < 3 {
1415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1416 _next_ordinal_to_read += 1;
1417 next_offset += envelope_size;
1418 }
1419
1420 let next_out_of_line = decoder.next_out_of_line();
1421 let handles_before = decoder.remaining_handles();
1422 if let Some((inlined, num_bytes, num_handles)) =
1423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1424 {
1425 let member_inline_size =
1426 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1427 if inlined != (member_inline_size <= 4) {
1428 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1429 }
1430 let inner_offset;
1431 let mut inner_depth = depth.clone();
1432 if inlined {
1433 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1434 inner_offset = next_offset;
1435 } else {
1436 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1437 inner_depth.increment()?;
1438 }
1439 let val_ref = self.device_pixel_ratio.get_or_insert_with(|| {
1440 fidl::new_empty!(f32, fidl::encoding::DefaultFuchsiaResourceDialect)
1441 });
1442 fidl::decode!(
1443 f32,
1444 fidl::encoding::DefaultFuchsiaResourceDialect,
1445 val_ref,
1446 decoder,
1447 inner_offset,
1448 inner_depth
1449 )?;
1450 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1451 {
1452 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1453 }
1454 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1455 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1456 }
1457 }
1458
1459 next_offset += envelope_size;
1460
1461 while next_offset < end_offset {
1463 _next_ordinal_to_read += 1;
1464 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1465 next_offset += envelope_size;
1466 }
1467
1468 Ok(())
1469 }
1470 }
1471
1472 impl ScenicRealmFactoryCreateRealmRequest {
1473 #[inline(always)]
1474 fn max_ordinal_present(&self) -> u64 {
1475 if let Some(_) = self.display_composition {
1476 return 4;
1477 }
1478 if let Some(_) = self.display_rotation {
1479 return 3;
1480 }
1481 if let Some(_) = self.renderer {
1482 return 2;
1483 }
1484 if let Some(_) = self.realm_server {
1485 return 1;
1486 }
1487 0
1488 }
1489 }
1490
1491 impl fidl::encoding::ResourceTypeMarker for ScenicRealmFactoryCreateRealmRequest {
1492 type Borrowed<'a> = &'a mut Self;
1493 fn take_or_borrow<'a>(
1494 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1495 ) -> Self::Borrowed<'a> {
1496 value
1497 }
1498 }
1499
1500 unsafe impl fidl::encoding::TypeMarker for ScenicRealmFactoryCreateRealmRequest {
1501 type Owned = Self;
1502
1503 #[inline(always)]
1504 fn inline_align(_context: fidl::encoding::Context) -> usize {
1505 8
1506 }
1507
1508 #[inline(always)]
1509 fn inline_size(_context: fidl::encoding::Context) -> usize {
1510 16
1511 }
1512 }
1513
1514 unsafe impl
1515 fidl::encoding::Encode<
1516 ScenicRealmFactoryCreateRealmRequest,
1517 fidl::encoding::DefaultFuchsiaResourceDialect,
1518 > for &mut ScenicRealmFactoryCreateRealmRequest
1519 {
1520 unsafe fn encode(
1521 self,
1522 encoder: &mut fidl::encoding::Encoder<
1523 '_,
1524 fidl::encoding::DefaultFuchsiaResourceDialect,
1525 >,
1526 offset: usize,
1527 mut depth: fidl::encoding::Depth,
1528 ) -> fidl::Result<()> {
1529 encoder.debug_check_bounds::<ScenicRealmFactoryCreateRealmRequest>(offset);
1530 let max_ordinal: u64 = self.max_ordinal_present();
1532 encoder.write_num(max_ordinal, offset);
1533 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1534 if max_ordinal == 0 {
1536 return Ok(());
1537 }
1538 depth.increment()?;
1539 let envelope_size = 8;
1540 let bytes_len = max_ordinal as usize * envelope_size;
1541 #[allow(unused_variables)]
1542 let offset = encoder.out_of_line_offset(bytes_len);
1543 let mut _prev_end_offset: usize = 0;
1544 if 1 > max_ordinal {
1545 return Ok(());
1546 }
1547
1548 let cur_offset: usize = (1 - 1) * envelope_size;
1551
1552 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1554
1555 fidl::encoding::encode_in_envelope_optional::<
1560 fidl::encoding::Endpoint<
1561 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1562 >,
1563 fidl::encoding::DefaultFuchsiaResourceDialect,
1564 >(
1565 self.realm_server.as_mut().map(
1566 <fidl::encoding::Endpoint<
1567 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1568 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1569 ),
1570 encoder,
1571 offset + cur_offset,
1572 depth,
1573 )?;
1574
1575 _prev_end_offset = cur_offset + envelope_size;
1576 if 2 > max_ordinal {
1577 return Ok(());
1578 }
1579
1580 let cur_offset: usize = (2 - 1) * envelope_size;
1583
1584 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1586
1587 fidl::encoding::encode_in_envelope_optional::<
1592 RendererType,
1593 fidl::encoding::DefaultFuchsiaResourceDialect,
1594 >(
1595 self.renderer
1596 .as_ref()
1597 .map(<RendererType as fidl::encoding::ValueTypeMarker>::borrow),
1598 encoder,
1599 offset + cur_offset,
1600 depth,
1601 )?;
1602
1603 _prev_end_offset = cur_offset + envelope_size;
1604 if 3 > max_ordinal {
1605 return Ok(());
1606 }
1607
1608 let cur_offset: usize = (3 - 1) * envelope_size;
1611
1612 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1614
1615 fidl::encoding::encode_in_envelope_optional::<
1620 u64,
1621 fidl::encoding::DefaultFuchsiaResourceDialect,
1622 >(
1623 self.display_rotation
1624 .as_ref()
1625 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1626 encoder,
1627 offset + cur_offset,
1628 depth,
1629 )?;
1630
1631 _prev_end_offset = cur_offset + envelope_size;
1632 if 4 > max_ordinal {
1633 return Ok(());
1634 }
1635
1636 let cur_offset: usize = (4 - 1) * envelope_size;
1639
1640 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1642
1643 fidl::encoding::encode_in_envelope_optional::<
1648 bool,
1649 fidl::encoding::DefaultFuchsiaResourceDialect,
1650 >(
1651 self.display_composition
1652 .as_ref()
1653 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1654 encoder,
1655 offset + cur_offset,
1656 depth,
1657 )?;
1658
1659 _prev_end_offset = cur_offset + envelope_size;
1660
1661 Ok(())
1662 }
1663 }
1664
1665 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1666 for ScenicRealmFactoryCreateRealmRequest
1667 {
1668 #[inline(always)]
1669 fn new_empty() -> Self {
1670 Self::default()
1671 }
1672
1673 unsafe fn decode(
1674 &mut self,
1675 decoder: &mut fidl::encoding::Decoder<
1676 '_,
1677 fidl::encoding::DefaultFuchsiaResourceDialect,
1678 >,
1679 offset: usize,
1680 mut depth: fidl::encoding::Depth,
1681 ) -> fidl::Result<()> {
1682 decoder.debug_check_bounds::<Self>(offset);
1683 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1684 None => return Err(fidl::Error::NotNullable),
1685 Some(len) => len,
1686 };
1687 if len == 0 {
1689 return Ok(());
1690 };
1691 depth.increment()?;
1692 let envelope_size = 8;
1693 let bytes_len = len * envelope_size;
1694 let offset = decoder.out_of_line_offset(bytes_len)?;
1695 let mut _next_ordinal_to_read = 0;
1697 let mut next_offset = offset;
1698 let end_offset = offset + bytes_len;
1699 _next_ordinal_to_read += 1;
1700 if next_offset >= end_offset {
1701 return Ok(());
1702 }
1703
1704 while _next_ordinal_to_read < 1 {
1706 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1707 _next_ordinal_to_read += 1;
1708 next_offset += envelope_size;
1709 }
1710
1711 let next_out_of_line = decoder.next_out_of_line();
1712 let handles_before = decoder.remaining_handles();
1713 if let Some((inlined, num_bytes, num_handles)) =
1714 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1715 {
1716 let member_inline_size = <fidl::encoding::Endpoint<
1717 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1718 > as fidl::encoding::TypeMarker>::inline_size(
1719 decoder.context
1720 );
1721 if inlined != (member_inline_size <= 4) {
1722 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1723 }
1724 let inner_offset;
1725 let mut inner_depth = depth.clone();
1726 if inlined {
1727 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1728 inner_offset = next_offset;
1729 } else {
1730 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1731 inner_depth.increment()?;
1732 }
1733 let val_ref = self.realm_server.get_or_insert_with(|| {
1734 fidl::new_empty!(
1735 fidl::encoding::Endpoint<
1736 fidl::endpoints::ServerEnd<
1737 fidl_fuchsia_testing_harness::RealmProxy_Marker,
1738 >,
1739 >,
1740 fidl::encoding::DefaultFuchsiaResourceDialect
1741 )
1742 });
1743 fidl::decode!(
1744 fidl::encoding::Endpoint<
1745 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1746 >,
1747 fidl::encoding::DefaultFuchsiaResourceDialect,
1748 val_ref,
1749 decoder,
1750 inner_offset,
1751 inner_depth
1752 )?;
1753 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1754 {
1755 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1756 }
1757 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1758 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1759 }
1760 }
1761
1762 next_offset += envelope_size;
1763 _next_ordinal_to_read += 1;
1764 if next_offset >= end_offset {
1765 return Ok(());
1766 }
1767
1768 while _next_ordinal_to_read < 2 {
1770 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1771 _next_ordinal_to_read += 1;
1772 next_offset += envelope_size;
1773 }
1774
1775 let next_out_of_line = decoder.next_out_of_line();
1776 let handles_before = decoder.remaining_handles();
1777 if let Some((inlined, num_bytes, num_handles)) =
1778 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1779 {
1780 let member_inline_size =
1781 <RendererType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1782 if inlined != (member_inline_size <= 4) {
1783 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1784 }
1785 let inner_offset;
1786 let mut inner_depth = depth.clone();
1787 if inlined {
1788 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1789 inner_offset = next_offset;
1790 } else {
1791 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1792 inner_depth.increment()?;
1793 }
1794 let val_ref = self.renderer.get_or_insert_with(|| {
1795 fidl::new_empty!(RendererType, fidl::encoding::DefaultFuchsiaResourceDialect)
1796 });
1797 fidl::decode!(
1798 RendererType,
1799 fidl::encoding::DefaultFuchsiaResourceDialect,
1800 val_ref,
1801 decoder,
1802 inner_offset,
1803 inner_depth
1804 )?;
1805 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1806 {
1807 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1808 }
1809 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1810 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1811 }
1812 }
1813
1814 next_offset += envelope_size;
1815 _next_ordinal_to_read += 1;
1816 if next_offset >= end_offset {
1817 return Ok(());
1818 }
1819
1820 while _next_ordinal_to_read < 3 {
1822 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1823 _next_ordinal_to_read += 1;
1824 next_offset += envelope_size;
1825 }
1826
1827 let next_out_of_line = decoder.next_out_of_line();
1828 let handles_before = decoder.remaining_handles();
1829 if let Some((inlined, num_bytes, num_handles)) =
1830 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1831 {
1832 let member_inline_size =
1833 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1834 if inlined != (member_inline_size <= 4) {
1835 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1836 }
1837 let inner_offset;
1838 let mut inner_depth = depth.clone();
1839 if inlined {
1840 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1841 inner_offset = next_offset;
1842 } else {
1843 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1844 inner_depth.increment()?;
1845 }
1846 let val_ref = self.display_rotation.get_or_insert_with(|| {
1847 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
1848 });
1849 fidl::decode!(
1850 u64,
1851 fidl::encoding::DefaultFuchsiaResourceDialect,
1852 val_ref,
1853 decoder,
1854 inner_offset,
1855 inner_depth
1856 )?;
1857 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1858 {
1859 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1860 }
1861 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1862 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1863 }
1864 }
1865
1866 next_offset += envelope_size;
1867 _next_ordinal_to_read += 1;
1868 if next_offset >= end_offset {
1869 return Ok(());
1870 }
1871
1872 while _next_ordinal_to_read < 4 {
1874 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1875 _next_ordinal_to_read += 1;
1876 next_offset += envelope_size;
1877 }
1878
1879 let next_out_of_line = decoder.next_out_of_line();
1880 let handles_before = decoder.remaining_handles();
1881 if let Some((inlined, num_bytes, num_handles)) =
1882 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1883 {
1884 let member_inline_size =
1885 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1886 if inlined != (member_inline_size <= 4) {
1887 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1888 }
1889 let inner_offset;
1890 let mut inner_depth = depth.clone();
1891 if inlined {
1892 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1893 inner_offset = next_offset;
1894 } else {
1895 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1896 inner_depth.increment()?;
1897 }
1898 let val_ref = self.display_composition.get_or_insert_with(|| {
1899 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1900 });
1901 fidl::decode!(
1902 bool,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 val_ref,
1905 decoder,
1906 inner_offset,
1907 inner_depth
1908 )?;
1909 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1910 {
1911 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1912 }
1913 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1914 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1915 }
1916 }
1917
1918 next_offset += envelope_size;
1919
1920 while next_offset < end_offset {
1922 _next_ordinal_to_read += 1;
1923 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1924 next_offset += envelope_size;
1925 }
1926
1927 Ok(())
1928 }
1929 }
1930}