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_conformance_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
16pub struct PuppetCreationArgs {
17 pub server_end: Option<fidl::endpoints::ServerEnd<PuppetMarker>>,
18 pub view_token: Option<fidl_fuchsia_ui_views::ViewCreationToken>,
19 pub touch_listener:
20 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_test_input::TouchInputListenerMarker>>,
21 pub mouse_listener:
22 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_test_input::MouseInputListenerMarker>>,
23 pub keyboard_listener:
24 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker>>,
25 pub flatland_client:
26 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>>,
27 pub keyboard_client: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>>,
28 pub device_pixel_ratio: Option<f32>,
29 pub focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
30 #[doc(hidden)]
31 pub __source_breaking: fidl::marker::SourceBreaking,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PuppetCreationArgs {}
35
36#[derive(Debug, Default, PartialEq)]
37pub struct PuppetEmbedRemoteViewResponse {
38 pub result: Option<Result_>,
39 pub view_creation_token: Option<fidl_fuchsia_ui_views::ViewCreationToken>,
40 #[doc(hidden)]
41 pub __source_breaking: fidl::marker::SourceBreaking,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45 for PuppetEmbedRemoteViewResponse
46{
47}
48
49#[derive(Debug, Default, PartialEq)]
50pub struct PuppetFactoryCreateResponse {
51 pub result: Option<Result_>,
52 pub view_ref: Option<fidl_fuchsia_ui_views::ViewRef>,
54 #[doc(hidden)]
55 pub __source_breaking: fidl::marker::SourceBreaking,
56}
57
58impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
59 for PuppetFactoryCreateResponse
60{
61}
62
63#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
64pub struct PuppetMarker;
65
66impl fidl::endpoints::ProtocolMarker for PuppetMarker {
67 type Proxy = PuppetProxy;
68 type RequestStream = PuppetRequestStream;
69 #[cfg(target_os = "fuchsia")]
70 type SynchronousProxy = PuppetSynchronousProxy;
71
72 const DEBUG_NAME: &'static str = "(anonymous) Puppet";
73}
74
75pub trait PuppetProxyInterface: Send + Sync {
76 type EmbedRemoteViewResponseFut: std::future::Future<Output = Result<PuppetEmbedRemoteViewResponse, fidl::Error>>
77 + Send;
78 fn r#embed_remote_view(
79 &self,
80 payload: &PuppetEmbedRemoteViewRequest,
81 ) -> Self::EmbedRemoteViewResponseFut;
82 type SetEmbeddedViewPropertiesResponseFut: std::future::Future<Output = Result<PuppetSetEmbeddedViewPropertiesResponse, fidl::Error>>
83 + Send;
84 fn r#set_embedded_view_properties(
85 &self,
86 payload: &PuppetSetEmbeddedViewPropertiesRequest,
87 ) -> Self::SetEmbeddedViewPropertiesResponseFut;
88 type DrawImageResponseFut: std::future::Future<Output = Result<PuppetDrawImageResponse, fidl::Error>>
89 + Send;
90 fn r#draw_image(&self, payload: &PuppetDrawImageRequest) -> Self::DrawImageResponseFut;
91 type SetImagePropertiesResponseFut: std::future::Future<Output = Result<PuppetSetImagePropertiesResponse, fidl::Error>>
92 + Send;
93 fn r#set_image_properties(
94 &self,
95 payload: &PuppetSetImagePropertiesRequest,
96 ) -> Self::SetImagePropertiesResponseFut;
97}
98#[derive(Debug)]
99#[cfg(target_os = "fuchsia")]
100pub struct PuppetSynchronousProxy {
101 client: fidl::client::sync::Client,
102}
103
104#[cfg(target_os = "fuchsia")]
105impl fidl::endpoints::SynchronousProxy for PuppetSynchronousProxy {
106 type Proxy = PuppetProxy;
107 type Protocol = PuppetMarker;
108
109 fn from_channel(inner: fidl::Channel) -> Self {
110 Self::new(inner)
111 }
112
113 fn into_channel(self) -> fidl::Channel {
114 self.client.into_channel()
115 }
116
117 fn as_channel(&self) -> &fidl::Channel {
118 self.client.as_channel()
119 }
120}
121
122#[cfg(target_os = "fuchsia")]
123impl PuppetSynchronousProxy {
124 pub fn new(channel: fidl::Channel) -> Self {
125 let protocol_name = <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
126 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
127 }
128
129 pub fn into_channel(self) -> fidl::Channel {
130 self.client.into_channel()
131 }
132
133 pub fn wait_for_event(
136 &self,
137 deadline: zx::MonotonicInstant,
138 ) -> Result<PuppetEvent, fidl::Error> {
139 PuppetEvent::decode(self.client.wait_for_event(deadline)?)
140 }
141
142 pub fn r#embed_remote_view(
149 &self,
150 mut payload: &PuppetEmbedRemoteViewRequest,
151 ___deadline: zx::MonotonicInstant,
152 ) -> Result<PuppetEmbedRemoteViewResponse, fidl::Error> {
153 let _response =
154 self.client.send_query::<PuppetEmbedRemoteViewRequest, PuppetEmbedRemoteViewResponse>(
155 payload,
156 0x5bb2325a988aa137,
157 fidl::encoding::DynamicFlags::empty(),
158 ___deadline,
159 )?;
160 Ok(_response)
161 }
162
163 pub fn r#set_embedded_view_properties(
165 &self,
166 mut payload: &PuppetSetEmbeddedViewPropertiesRequest,
167 ___deadline: zx::MonotonicInstant,
168 ) -> Result<PuppetSetEmbeddedViewPropertiesResponse, fidl::Error> {
169 let _response = self.client.send_query::<
170 PuppetSetEmbeddedViewPropertiesRequest,
171 PuppetSetEmbeddedViewPropertiesResponse,
172 >(
173 payload,
174 0x409a7f3de135c709,
175 fidl::encoding::DynamicFlags::empty(),
176 ___deadline,
177 )?;
178 Ok(_response)
179 }
180
181 pub fn r#draw_image(
183 &self,
184 mut payload: &PuppetDrawImageRequest,
185 ___deadline: zx::MonotonicInstant,
186 ) -> Result<PuppetDrawImageResponse, fidl::Error> {
187 let _response = self.client.send_query::<PuppetDrawImageRequest, PuppetDrawImageResponse>(
188 payload,
189 0x6d736daa48b835cc,
190 fidl::encoding::DynamicFlags::empty(),
191 ___deadline,
192 )?;
193 Ok(_response)
194 }
195
196 pub fn r#set_image_properties(
198 &self,
199 mut payload: &PuppetSetImagePropertiesRequest,
200 ___deadline: zx::MonotonicInstant,
201 ) -> Result<PuppetSetImagePropertiesResponse, fidl::Error> {
202 let _response = self
203 .client
204 .send_query::<PuppetSetImagePropertiesRequest, PuppetSetImagePropertiesResponse>(
205 payload,
206 0x2683795408d033ff,
207 fidl::encoding::DynamicFlags::empty(),
208 ___deadline,
209 )?;
210 Ok(_response)
211 }
212}
213
214#[cfg(target_os = "fuchsia")]
215impl From<PuppetSynchronousProxy> for zx::Handle {
216 fn from(value: PuppetSynchronousProxy) -> Self {
217 value.into_channel().into()
218 }
219}
220
221#[cfg(target_os = "fuchsia")]
222impl From<fidl::Channel> for PuppetSynchronousProxy {
223 fn from(value: fidl::Channel) -> Self {
224 Self::new(value)
225 }
226}
227
228#[derive(Debug, Clone)]
229pub struct PuppetProxy {
230 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
231}
232
233impl fidl::endpoints::Proxy for PuppetProxy {
234 type Protocol = PuppetMarker;
235
236 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
237 Self::new(inner)
238 }
239
240 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
241 self.client.into_channel().map_err(|client| Self { client })
242 }
243
244 fn as_channel(&self) -> &::fidl::AsyncChannel {
245 self.client.as_channel()
246 }
247}
248
249impl PuppetProxy {
250 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
252 let protocol_name = <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
253 Self { client: fidl::client::Client::new(channel, protocol_name) }
254 }
255
256 pub fn take_event_stream(&self) -> PuppetEventStream {
262 PuppetEventStream { event_receiver: self.client.take_event_receiver() }
263 }
264
265 pub fn r#embed_remote_view(
272 &self,
273 mut payload: &PuppetEmbedRemoteViewRequest,
274 ) -> fidl::client::QueryResponseFut<
275 PuppetEmbedRemoteViewResponse,
276 fidl::encoding::DefaultFuchsiaResourceDialect,
277 > {
278 PuppetProxyInterface::r#embed_remote_view(self, payload)
279 }
280
281 pub fn r#set_embedded_view_properties(
283 &self,
284 mut payload: &PuppetSetEmbeddedViewPropertiesRequest,
285 ) -> fidl::client::QueryResponseFut<
286 PuppetSetEmbeddedViewPropertiesResponse,
287 fidl::encoding::DefaultFuchsiaResourceDialect,
288 > {
289 PuppetProxyInterface::r#set_embedded_view_properties(self, payload)
290 }
291
292 pub fn r#draw_image(
294 &self,
295 mut payload: &PuppetDrawImageRequest,
296 ) -> fidl::client::QueryResponseFut<
297 PuppetDrawImageResponse,
298 fidl::encoding::DefaultFuchsiaResourceDialect,
299 > {
300 PuppetProxyInterface::r#draw_image(self, payload)
301 }
302
303 pub fn r#set_image_properties(
305 &self,
306 mut payload: &PuppetSetImagePropertiesRequest,
307 ) -> fidl::client::QueryResponseFut<
308 PuppetSetImagePropertiesResponse,
309 fidl::encoding::DefaultFuchsiaResourceDialect,
310 > {
311 PuppetProxyInterface::r#set_image_properties(self, payload)
312 }
313}
314
315impl PuppetProxyInterface for PuppetProxy {
316 type EmbedRemoteViewResponseFut = fidl::client::QueryResponseFut<
317 PuppetEmbedRemoteViewResponse,
318 fidl::encoding::DefaultFuchsiaResourceDialect,
319 >;
320 fn r#embed_remote_view(
321 &self,
322 mut payload: &PuppetEmbedRemoteViewRequest,
323 ) -> Self::EmbedRemoteViewResponseFut {
324 fn _decode(
325 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
326 ) -> Result<PuppetEmbedRemoteViewResponse, fidl::Error> {
327 let _response = fidl::client::decode_transaction_body::<
328 PuppetEmbedRemoteViewResponse,
329 fidl::encoding::DefaultFuchsiaResourceDialect,
330 0x5bb2325a988aa137,
331 >(_buf?)?;
332 Ok(_response)
333 }
334 self.client
335 .send_query_and_decode::<PuppetEmbedRemoteViewRequest, PuppetEmbedRemoteViewResponse>(
336 payload,
337 0x5bb2325a988aa137,
338 fidl::encoding::DynamicFlags::empty(),
339 _decode,
340 )
341 }
342
343 type SetEmbeddedViewPropertiesResponseFut = fidl::client::QueryResponseFut<
344 PuppetSetEmbeddedViewPropertiesResponse,
345 fidl::encoding::DefaultFuchsiaResourceDialect,
346 >;
347 fn r#set_embedded_view_properties(
348 &self,
349 mut payload: &PuppetSetEmbeddedViewPropertiesRequest,
350 ) -> Self::SetEmbeddedViewPropertiesResponseFut {
351 fn _decode(
352 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
353 ) -> Result<PuppetSetEmbeddedViewPropertiesResponse, fidl::Error> {
354 let _response = fidl::client::decode_transaction_body::<
355 PuppetSetEmbeddedViewPropertiesResponse,
356 fidl::encoding::DefaultFuchsiaResourceDialect,
357 0x409a7f3de135c709,
358 >(_buf?)?;
359 Ok(_response)
360 }
361 self.client.send_query_and_decode::<
362 PuppetSetEmbeddedViewPropertiesRequest,
363 PuppetSetEmbeddedViewPropertiesResponse,
364 >(
365 payload,
366 0x409a7f3de135c709,
367 fidl::encoding::DynamicFlags::empty(),
368 _decode,
369 )
370 }
371
372 type DrawImageResponseFut = fidl::client::QueryResponseFut<
373 PuppetDrawImageResponse,
374 fidl::encoding::DefaultFuchsiaResourceDialect,
375 >;
376 fn r#draw_image(&self, mut payload: &PuppetDrawImageRequest) -> Self::DrawImageResponseFut {
377 fn _decode(
378 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
379 ) -> Result<PuppetDrawImageResponse, fidl::Error> {
380 let _response = fidl::client::decode_transaction_body::<
381 PuppetDrawImageResponse,
382 fidl::encoding::DefaultFuchsiaResourceDialect,
383 0x6d736daa48b835cc,
384 >(_buf?)?;
385 Ok(_response)
386 }
387 self.client.send_query_and_decode::<PuppetDrawImageRequest, PuppetDrawImageResponse>(
388 payload,
389 0x6d736daa48b835cc,
390 fidl::encoding::DynamicFlags::empty(),
391 _decode,
392 )
393 }
394
395 type SetImagePropertiesResponseFut = fidl::client::QueryResponseFut<
396 PuppetSetImagePropertiesResponse,
397 fidl::encoding::DefaultFuchsiaResourceDialect,
398 >;
399 fn r#set_image_properties(
400 &self,
401 mut payload: &PuppetSetImagePropertiesRequest,
402 ) -> Self::SetImagePropertiesResponseFut {
403 fn _decode(
404 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
405 ) -> Result<PuppetSetImagePropertiesResponse, fidl::Error> {
406 let _response = fidl::client::decode_transaction_body::<
407 PuppetSetImagePropertiesResponse,
408 fidl::encoding::DefaultFuchsiaResourceDialect,
409 0x2683795408d033ff,
410 >(_buf?)?;
411 Ok(_response)
412 }
413 self.client.send_query_and_decode::<
414 PuppetSetImagePropertiesRequest,
415 PuppetSetImagePropertiesResponse,
416 >(
417 payload,
418 0x2683795408d033ff,
419 fidl::encoding::DynamicFlags::empty(),
420 _decode,
421 )
422 }
423}
424
425pub struct PuppetEventStream {
426 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
427}
428
429impl std::marker::Unpin for PuppetEventStream {}
430
431impl futures::stream::FusedStream for PuppetEventStream {
432 fn is_terminated(&self) -> bool {
433 self.event_receiver.is_terminated()
434 }
435}
436
437impl futures::Stream for PuppetEventStream {
438 type Item = Result<PuppetEvent, fidl::Error>;
439
440 fn poll_next(
441 mut self: std::pin::Pin<&mut Self>,
442 cx: &mut std::task::Context<'_>,
443 ) -> std::task::Poll<Option<Self::Item>> {
444 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
445 &mut self.event_receiver,
446 cx
447 )?) {
448 Some(buf) => std::task::Poll::Ready(Some(PuppetEvent::decode(buf))),
449 None => std::task::Poll::Ready(None),
450 }
451 }
452}
453
454#[derive(Debug)]
455pub enum PuppetEvent {}
456
457impl PuppetEvent {
458 fn decode(
460 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
461 ) -> Result<PuppetEvent, fidl::Error> {
462 let (bytes, _handles) = buf.split_mut();
463 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
464 debug_assert_eq!(tx_header.tx_id, 0);
465 match tx_header.ordinal {
466 _ => Err(fidl::Error::UnknownOrdinal {
467 ordinal: tx_header.ordinal,
468 protocol_name: <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
469 }),
470 }
471 }
472}
473
474pub struct PuppetRequestStream {
476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
477 is_terminated: bool,
478}
479
480impl std::marker::Unpin for PuppetRequestStream {}
481
482impl futures::stream::FusedStream for PuppetRequestStream {
483 fn is_terminated(&self) -> bool {
484 self.is_terminated
485 }
486}
487
488impl fidl::endpoints::RequestStream for PuppetRequestStream {
489 type Protocol = PuppetMarker;
490 type ControlHandle = PuppetControlHandle;
491
492 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
493 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
494 }
495
496 fn control_handle(&self) -> Self::ControlHandle {
497 PuppetControlHandle { inner: self.inner.clone() }
498 }
499
500 fn into_inner(
501 self,
502 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
503 {
504 (self.inner, self.is_terminated)
505 }
506
507 fn from_inner(
508 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
509 is_terminated: bool,
510 ) -> Self {
511 Self { inner, is_terminated }
512 }
513}
514
515impl futures::Stream for PuppetRequestStream {
516 type Item = Result<PuppetRequest, fidl::Error>;
517
518 fn poll_next(
519 mut self: std::pin::Pin<&mut Self>,
520 cx: &mut std::task::Context<'_>,
521 ) -> std::task::Poll<Option<Self::Item>> {
522 let this = &mut *self;
523 if this.inner.check_shutdown(cx) {
524 this.is_terminated = true;
525 return std::task::Poll::Ready(None);
526 }
527 if this.is_terminated {
528 panic!("polled PuppetRequestStream after completion");
529 }
530 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
531 |bytes, handles| {
532 match this.inner.channel().read_etc(cx, bytes, handles) {
533 std::task::Poll::Ready(Ok(())) => {}
534 std::task::Poll::Pending => return std::task::Poll::Pending,
535 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
536 this.is_terminated = true;
537 return std::task::Poll::Ready(None);
538 }
539 std::task::Poll::Ready(Err(e)) => {
540 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
541 e.into(),
542 ))))
543 }
544 }
545
546 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
548
549 std::task::Poll::Ready(Some(match header.ordinal {
550 0x5bb2325a988aa137 => {
551 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
552 let mut req = fidl::new_empty!(
553 PuppetEmbedRemoteViewRequest,
554 fidl::encoding::DefaultFuchsiaResourceDialect
555 );
556 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetEmbedRemoteViewRequest>(&header, _body_bytes, handles, &mut req)?;
557 let control_handle = PuppetControlHandle { inner: this.inner.clone() };
558 Ok(PuppetRequest::EmbedRemoteView {
559 payload: req,
560 responder: PuppetEmbedRemoteViewResponder {
561 control_handle: std::mem::ManuallyDrop::new(control_handle),
562 tx_id: header.tx_id,
563 },
564 })
565 }
566 0x409a7f3de135c709 => {
567 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
568 let mut req = fidl::new_empty!(
569 PuppetSetEmbeddedViewPropertiesRequest,
570 fidl::encoding::DefaultFuchsiaResourceDialect
571 );
572 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetSetEmbeddedViewPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
573 let control_handle = PuppetControlHandle { inner: this.inner.clone() };
574 Ok(PuppetRequest::SetEmbeddedViewProperties {
575 payload: req,
576 responder: PuppetSetEmbeddedViewPropertiesResponder {
577 control_handle: std::mem::ManuallyDrop::new(control_handle),
578 tx_id: header.tx_id,
579 },
580 })
581 }
582 0x6d736daa48b835cc => {
583 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
584 let mut req = fidl::new_empty!(
585 PuppetDrawImageRequest,
586 fidl::encoding::DefaultFuchsiaResourceDialect
587 );
588 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetDrawImageRequest>(&header, _body_bytes, handles, &mut req)?;
589 let control_handle = PuppetControlHandle { inner: this.inner.clone() };
590 Ok(PuppetRequest::DrawImage {
591 payload: req,
592 responder: PuppetDrawImageResponder {
593 control_handle: std::mem::ManuallyDrop::new(control_handle),
594 tx_id: header.tx_id,
595 },
596 })
597 }
598 0x2683795408d033ff => {
599 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
600 let mut req = fidl::new_empty!(
601 PuppetSetImagePropertiesRequest,
602 fidl::encoding::DefaultFuchsiaResourceDialect
603 );
604 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetSetImagePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
605 let control_handle = PuppetControlHandle { inner: this.inner.clone() };
606 Ok(PuppetRequest::SetImageProperties {
607 payload: req,
608 responder: PuppetSetImagePropertiesResponder {
609 control_handle: std::mem::ManuallyDrop::new(control_handle),
610 tx_id: header.tx_id,
611 },
612 })
613 }
614 _ => Err(fidl::Error::UnknownOrdinal {
615 ordinal: header.ordinal,
616 protocol_name:
617 <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
618 }),
619 }))
620 },
621 )
622 }
623}
624
625#[derive(Debug)]
667pub enum PuppetRequest {
668 EmbedRemoteView {
675 payload: PuppetEmbedRemoteViewRequest,
676 responder: PuppetEmbedRemoteViewResponder,
677 },
678 SetEmbeddedViewProperties {
680 payload: PuppetSetEmbeddedViewPropertiesRequest,
681 responder: PuppetSetEmbeddedViewPropertiesResponder,
682 },
683 DrawImage { payload: PuppetDrawImageRequest, responder: PuppetDrawImageResponder },
685 SetImageProperties {
687 payload: PuppetSetImagePropertiesRequest,
688 responder: PuppetSetImagePropertiesResponder,
689 },
690}
691
692impl PuppetRequest {
693 #[allow(irrefutable_let_patterns)]
694 pub fn into_embed_remote_view(
695 self,
696 ) -> Option<(PuppetEmbedRemoteViewRequest, PuppetEmbedRemoteViewResponder)> {
697 if let PuppetRequest::EmbedRemoteView { payload, responder } = self {
698 Some((payload, responder))
699 } else {
700 None
701 }
702 }
703
704 #[allow(irrefutable_let_patterns)]
705 pub fn into_set_embedded_view_properties(
706 self,
707 ) -> Option<(PuppetSetEmbeddedViewPropertiesRequest, PuppetSetEmbeddedViewPropertiesResponder)>
708 {
709 if let PuppetRequest::SetEmbeddedViewProperties { payload, responder } = self {
710 Some((payload, responder))
711 } else {
712 None
713 }
714 }
715
716 #[allow(irrefutable_let_patterns)]
717 pub fn into_draw_image(self) -> Option<(PuppetDrawImageRequest, PuppetDrawImageResponder)> {
718 if let PuppetRequest::DrawImage { payload, responder } = self {
719 Some((payload, responder))
720 } else {
721 None
722 }
723 }
724
725 #[allow(irrefutable_let_patterns)]
726 pub fn into_set_image_properties(
727 self,
728 ) -> Option<(PuppetSetImagePropertiesRequest, PuppetSetImagePropertiesResponder)> {
729 if let PuppetRequest::SetImageProperties { payload, responder } = self {
730 Some((payload, responder))
731 } else {
732 None
733 }
734 }
735
736 pub fn method_name(&self) -> &'static str {
738 match *self {
739 PuppetRequest::EmbedRemoteView { .. } => "embed_remote_view",
740 PuppetRequest::SetEmbeddedViewProperties { .. } => "set_embedded_view_properties",
741 PuppetRequest::DrawImage { .. } => "draw_image",
742 PuppetRequest::SetImageProperties { .. } => "set_image_properties",
743 }
744 }
745}
746
747#[derive(Debug, Clone)]
748pub struct PuppetControlHandle {
749 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
750}
751
752impl fidl::endpoints::ControlHandle for PuppetControlHandle {
753 fn shutdown(&self) {
754 self.inner.shutdown()
755 }
756 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
757 self.inner.shutdown_with_epitaph(status)
758 }
759
760 fn is_closed(&self) -> bool {
761 self.inner.channel().is_closed()
762 }
763 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
764 self.inner.channel().on_closed()
765 }
766
767 #[cfg(target_os = "fuchsia")]
768 fn signal_peer(
769 &self,
770 clear_mask: zx::Signals,
771 set_mask: zx::Signals,
772 ) -> Result<(), zx_status::Status> {
773 use fidl::Peered;
774 self.inner.channel().signal_peer(clear_mask, set_mask)
775 }
776}
777
778impl PuppetControlHandle {}
779
780#[must_use = "FIDL methods require a response to be sent"]
781#[derive(Debug)]
782pub struct PuppetEmbedRemoteViewResponder {
783 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
784 tx_id: u32,
785}
786
787impl std::ops::Drop for PuppetEmbedRemoteViewResponder {
791 fn drop(&mut self) {
792 self.control_handle.shutdown();
793 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
795 }
796}
797
798impl fidl::endpoints::Responder for PuppetEmbedRemoteViewResponder {
799 type ControlHandle = PuppetControlHandle;
800
801 fn control_handle(&self) -> &PuppetControlHandle {
802 &self.control_handle
803 }
804
805 fn drop_without_shutdown(mut self) {
806 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
808 std::mem::forget(self);
810 }
811}
812
813impl PuppetEmbedRemoteViewResponder {
814 pub fn send(self, mut payload: PuppetEmbedRemoteViewResponse) -> Result<(), fidl::Error> {
818 let _result = self.send_raw(payload);
819 if _result.is_err() {
820 self.control_handle.shutdown();
821 }
822 self.drop_without_shutdown();
823 _result
824 }
825
826 pub fn send_no_shutdown_on_err(
828 self,
829 mut payload: PuppetEmbedRemoteViewResponse,
830 ) -> Result<(), fidl::Error> {
831 let _result = self.send_raw(payload);
832 self.drop_without_shutdown();
833 _result
834 }
835
836 fn send_raw(&self, mut payload: PuppetEmbedRemoteViewResponse) -> Result<(), fidl::Error> {
837 self.control_handle.inner.send::<PuppetEmbedRemoteViewResponse>(
838 &mut payload,
839 self.tx_id,
840 0x5bb2325a988aa137,
841 fidl::encoding::DynamicFlags::empty(),
842 )
843 }
844}
845
846#[must_use = "FIDL methods require a response to be sent"]
847#[derive(Debug)]
848pub struct PuppetSetEmbeddedViewPropertiesResponder {
849 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
850 tx_id: u32,
851}
852
853impl std::ops::Drop for PuppetSetEmbeddedViewPropertiesResponder {
857 fn drop(&mut self) {
858 self.control_handle.shutdown();
859 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
861 }
862}
863
864impl fidl::endpoints::Responder for PuppetSetEmbeddedViewPropertiesResponder {
865 type ControlHandle = PuppetControlHandle;
866
867 fn control_handle(&self) -> &PuppetControlHandle {
868 &self.control_handle
869 }
870
871 fn drop_without_shutdown(mut self) {
872 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
874 std::mem::forget(self);
876 }
877}
878
879impl PuppetSetEmbeddedViewPropertiesResponder {
880 pub fn send(
884 self,
885 mut payload: &PuppetSetEmbeddedViewPropertiesResponse,
886 ) -> Result<(), fidl::Error> {
887 let _result = self.send_raw(payload);
888 if _result.is_err() {
889 self.control_handle.shutdown();
890 }
891 self.drop_without_shutdown();
892 _result
893 }
894
895 pub fn send_no_shutdown_on_err(
897 self,
898 mut payload: &PuppetSetEmbeddedViewPropertiesResponse,
899 ) -> Result<(), fidl::Error> {
900 let _result = self.send_raw(payload);
901 self.drop_without_shutdown();
902 _result
903 }
904
905 fn send_raw(
906 &self,
907 mut payload: &PuppetSetEmbeddedViewPropertiesResponse,
908 ) -> Result<(), fidl::Error> {
909 self.control_handle.inner.send::<PuppetSetEmbeddedViewPropertiesResponse>(
910 payload,
911 self.tx_id,
912 0x409a7f3de135c709,
913 fidl::encoding::DynamicFlags::empty(),
914 )
915 }
916}
917
918#[must_use = "FIDL methods require a response to be sent"]
919#[derive(Debug)]
920pub struct PuppetDrawImageResponder {
921 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
922 tx_id: u32,
923}
924
925impl std::ops::Drop for PuppetDrawImageResponder {
929 fn drop(&mut self) {
930 self.control_handle.shutdown();
931 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
933 }
934}
935
936impl fidl::endpoints::Responder for PuppetDrawImageResponder {
937 type ControlHandle = PuppetControlHandle;
938
939 fn control_handle(&self) -> &PuppetControlHandle {
940 &self.control_handle
941 }
942
943 fn drop_without_shutdown(mut self) {
944 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
946 std::mem::forget(self);
948 }
949}
950
951impl PuppetDrawImageResponder {
952 pub fn send(self, mut payload: &PuppetDrawImageResponse) -> Result<(), fidl::Error> {
956 let _result = self.send_raw(payload);
957 if _result.is_err() {
958 self.control_handle.shutdown();
959 }
960 self.drop_without_shutdown();
961 _result
962 }
963
964 pub fn send_no_shutdown_on_err(
966 self,
967 mut payload: &PuppetDrawImageResponse,
968 ) -> Result<(), fidl::Error> {
969 let _result = self.send_raw(payload);
970 self.drop_without_shutdown();
971 _result
972 }
973
974 fn send_raw(&self, mut payload: &PuppetDrawImageResponse) -> Result<(), fidl::Error> {
975 self.control_handle.inner.send::<PuppetDrawImageResponse>(
976 payload,
977 self.tx_id,
978 0x6d736daa48b835cc,
979 fidl::encoding::DynamicFlags::empty(),
980 )
981 }
982}
983
984#[must_use = "FIDL methods require a response to be sent"]
985#[derive(Debug)]
986pub struct PuppetSetImagePropertiesResponder {
987 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
988 tx_id: u32,
989}
990
991impl std::ops::Drop for PuppetSetImagePropertiesResponder {
995 fn drop(&mut self) {
996 self.control_handle.shutdown();
997 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999 }
1000}
1001
1002impl fidl::endpoints::Responder for PuppetSetImagePropertiesResponder {
1003 type ControlHandle = PuppetControlHandle;
1004
1005 fn control_handle(&self) -> &PuppetControlHandle {
1006 &self.control_handle
1007 }
1008
1009 fn drop_without_shutdown(mut self) {
1010 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012 std::mem::forget(self);
1014 }
1015}
1016
1017impl PuppetSetImagePropertiesResponder {
1018 pub fn send(self, mut payload: &PuppetSetImagePropertiesResponse) -> Result<(), fidl::Error> {
1022 let _result = self.send_raw(payload);
1023 if _result.is_err() {
1024 self.control_handle.shutdown();
1025 }
1026 self.drop_without_shutdown();
1027 _result
1028 }
1029
1030 pub fn send_no_shutdown_on_err(
1032 self,
1033 mut payload: &PuppetSetImagePropertiesResponse,
1034 ) -> Result<(), fidl::Error> {
1035 let _result = self.send_raw(payload);
1036 self.drop_without_shutdown();
1037 _result
1038 }
1039
1040 fn send_raw(&self, mut payload: &PuppetSetImagePropertiesResponse) -> Result<(), fidl::Error> {
1041 self.control_handle.inner.send::<PuppetSetImagePropertiesResponse>(
1042 payload,
1043 self.tx_id,
1044 0x2683795408d033ff,
1045 fidl::encoding::DynamicFlags::empty(),
1046 )
1047 }
1048}
1049
1050#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1051pub struct PuppetFactoryMarker;
1052
1053impl fidl::endpoints::ProtocolMarker for PuppetFactoryMarker {
1054 type Proxy = PuppetFactoryProxy;
1055 type RequestStream = PuppetFactoryRequestStream;
1056 #[cfg(target_os = "fuchsia")]
1057 type SynchronousProxy = PuppetFactorySynchronousProxy;
1058
1059 const DEBUG_NAME: &'static str = "fuchsia.ui.test.conformance.PuppetFactory";
1060}
1061impl fidl::endpoints::DiscoverableProtocolMarker for PuppetFactoryMarker {}
1062
1063pub trait PuppetFactoryProxyInterface: Send + Sync {
1064 type CreateResponseFut: std::future::Future<Output = Result<PuppetFactoryCreateResponse, fidl::Error>>
1065 + Send;
1066 fn r#create(&self, payload: PuppetCreationArgs) -> Self::CreateResponseFut;
1067}
1068#[derive(Debug)]
1069#[cfg(target_os = "fuchsia")]
1070pub struct PuppetFactorySynchronousProxy {
1071 client: fidl::client::sync::Client,
1072}
1073
1074#[cfg(target_os = "fuchsia")]
1075impl fidl::endpoints::SynchronousProxy for PuppetFactorySynchronousProxy {
1076 type Proxy = PuppetFactoryProxy;
1077 type Protocol = PuppetFactoryMarker;
1078
1079 fn from_channel(inner: fidl::Channel) -> Self {
1080 Self::new(inner)
1081 }
1082
1083 fn into_channel(self) -> fidl::Channel {
1084 self.client.into_channel()
1085 }
1086
1087 fn as_channel(&self) -> &fidl::Channel {
1088 self.client.as_channel()
1089 }
1090}
1091
1092#[cfg(target_os = "fuchsia")]
1093impl PuppetFactorySynchronousProxy {
1094 pub fn new(channel: fidl::Channel) -> Self {
1095 let protocol_name = <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1096 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1097 }
1098
1099 pub fn into_channel(self) -> fidl::Channel {
1100 self.client.into_channel()
1101 }
1102
1103 pub fn wait_for_event(
1106 &self,
1107 deadline: zx::MonotonicInstant,
1108 ) -> Result<PuppetFactoryEvent, fidl::Error> {
1109 PuppetFactoryEvent::decode(self.client.wait_for_event(deadline)?)
1110 }
1111
1112 pub fn r#create(
1115 &self,
1116 mut payload: PuppetCreationArgs,
1117 ___deadline: zx::MonotonicInstant,
1118 ) -> Result<PuppetFactoryCreateResponse, fidl::Error> {
1119 let _response = self.client.send_query::<PuppetCreationArgs, PuppetFactoryCreateResponse>(
1120 &mut payload,
1121 0x4f90811dc284b595,
1122 fidl::encoding::DynamicFlags::empty(),
1123 ___deadline,
1124 )?;
1125 Ok(_response)
1126 }
1127}
1128
1129#[cfg(target_os = "fuchsia")]
1130impl From<PuppetFactorySynchronousProxy> for zx::Handle {
1131 fn from(value: PuppetFactorySynchronousProxy) -> Self {
1132 value.into_channel().into()
1133 }
1134}
1135
1136#[cfg(target_os = "fuchsia")]
1137impl From<fidl::Channel> for PuppetFactorySynchronousProxy {
1138 fn from(value: fidl::Channel) -> Self {
1139 Self::new(value)
1140 }
1141}
1142
1143#[derive(Debug, Clone)]
1144pub struct PuppetFactoryProxy {
1145 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1146}
1147
1148impl fidl::endpoints::Proxy for PuppetFactoryProxy {
1149 type Protocol = PuppetFactoryMarker;
1150
1151 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1152 Self::new(inner)
1153 }
1154
1155 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1156 self.client.into_channel().map_err(|client| Self { client })
1157 }
1158
1159 fn as_channel(&self) -> &::fidl::AsyncChannel {
1160 self.client.as_channel()
1161 }
1162}
1163
1164impl PuppetFactoryProxy {
1165 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1167 let protocol_name = <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1168 Self { client: fidl::client::Client::new(channel, protocol_name) }
1169 }
1170
1171 pub fn take_event_stream(&self) -> PuppetFactoryEventStream {
1177 PuppetFactoryEventStream { event_receiver: self.client.take_event_receiver() }
1178 }
1179
1180 pub fn r#create(
1183 &self,
1184 mut payload: PuppetCreationArgs,
1185 ) -> fidl::client::QueryResponseFut<
1186 PuppetFactoryCreateResponse,
1187 fidl::encoding::DefaultFuchsiaResourceDialect,
1188 > {
1189 PuppetFactoryProxyInterface::r#create(self, payload)
1190 }
1191}
1192
1193impl PuppetFactoryProxyInterface for PuppetFactoryProxy {
1194 type CreateResponseFut = fidl::client::QueryResponseFut<
1195 PuppetFactoryCreateResponse,
1196 fidl::encoding::DefaultFuchsiaResourceDialect,
1197 >;
1198 fn r#create(&self, mut payload: PuppetCreationArgs) -> Self::CreateResponseFut {
1199 fn _decode(
1200 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1201 ) -> Result<PuppetFactoryCreateResponse, fidl::Error> {
1202 let _response = fidl::client::decode_transaction_body::<
1203 PuppetFactoryCreateResponse,
1204 fidl::encoding::DefaultFuchsiaResourceDialect,
1205 0x4f90811dc284b595,
1206 >(_buf?)?;
1207 Ok(_response)
1208 }
1209 self.client.send_query_and_decode::<PuppetCreationArgs, PuppetFactoryCreateResponse>(
1210 &mut payload,
1211 0x4f90811dc284b595,
1212 fidl::encoding::DynamicFlags::empty(),
1213 _decode,
1214 )
1215 }
1216}
1217
1218pub struct PuppetFactoryEventStream {
1219 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1220}
1221
1222impl std::marker::Unpin for PuppetFactoryEventStream {}
1223
1224impl futures::stream::FusedStream for PuppetFactoryEventStream {
1225 fn is_terminated(&self) -> bool {
1226 self.event_receiver.is_terminated()
1227 }
1228}
1229
1230impl futures::Stream for PuppetFactoryEventStream {
1231 type Item = Result<PuppetFactoryEvent, fidl::Error>;
1232
1233 fn poll_next(
1234 mut self: std::pin::Pin<&mut Self>,
1235 cx: &mut std::task::Context<'_>,
1236 ) -> std::task::Poll<Option<Self::Item>> {
1237 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1238 &mut self.event_receiver,
1239 cx
1240 )?) {
1241 Some(buf) => std::task::Poll::Ready(Some(PuppetFactoryEvent::decode(buf))),
1242 None => std::task::Poll::Ready(None),
1243 }
1244 }
1245}
1246
1247#[derive(Debug)]
1248pub enum PuppetFactoryEvent {}
1249
1250impl PuppetFactoryEvent {
1251 fn decode(
1253 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1254 ) -> Result<PuppetFactoryEvent, fidl::Error> {
1255 let (bytes, _handles) = buf.split_mut();
1256 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1257 debug_assert_eq!(tx_header.tx_id, 0);
1258 match tx_header.ordinal {
1259 _ => Err(fidl::Error::UnknownOrdinal {
1260 ordinal: tx_header.ordinal,
1261 protocol_name: <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1262 }),
1263 }
1264 }
1265}
1266
1267pub struct PuppetFactoryRequestStream {
1269 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1270 is_terminated: bool,
1271}
1272
1273impl std::marker::Unpin for PuppetFactoryRequestStream {}
1274
1275impl futures::stream::FusedStream for PuppetFactoryRequestStream {
1276 fn is_terminated(&self) -> bool {
1277 self.is_terminated
1278 }
1279}
1280
1281impl fidl::endpoints::RequestStream for PuppetFactoryRequestStream {
1282 type Protocol = PuppetFactoryMarker;
1283 type ControlHandle = PuppetFactoryControlHandle;
1284
1285 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1286 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1287 }
1288
1289 fn control_handle(&self) -> Self::ControlHandle {
1290 PuppetFactoryControlHandle { inner: self.inner.clone() }
1291 }
1292
1293 fn into_inner(
1294 self,
1295 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1296 {
1297 (self.inner, self.is_terminated)
1298 }
1299
1300 fn from_inner(
1301 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1302 is_terminated: bool,
1303 ) -> Self {
1304 Self { inner, is_terminated }
1305 }
1306}
1307
1308impl futures::Stream for PuppetFactoryRequestStream {
1309 type Item = Result<PuppetFactoryRequest, fidl::Error>;
1310
1311 fn poll_next(
1312 mut self: std::pin::Pin<&mut Self>,
1313 cx: &mut std::task::Context<'_>,
1314 ) -> std::task::Poll<Option<Self::Item>> {
1315 let this = &mut *self;
1316 if this.inner.check_shutdown(cx) {
1317 this.is_terminated = true;
1318 return std::task::Poll::Ready(None);
1319 }
1320 if this.is_terminated {
1321 panic!("polled PuppetFactoryRequestStream after completion");
1322 }
1323 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1324 |bytes, handles| {
1325 match this.inner.channel().read_etc(cx, bytes, handles) {
1326 std::task::Poll::Ready(Ok(())) => {}
1327 std::task::Poll::Pending => return std::task::Poll::Pending,
1328 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1329 this.is_terminated = true;
1330 return std::task::Poll::Ready(None);
1331 }
1332 std::task::Poll::Ready(Err(e)) => {
1333 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1334 e.into(),
1335 ))))
1336 }
1337 }
1338
1339 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1341
1342 std::task::Poll::Ready(Some(match header.ordinal {
1343 0x4f90811dc284b595 => {
1344 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1345 let mut req = fidl::new_empty!(
1346 PuppetCreationArgs,
1347 fidl::encoding::DefaultFuchsiaResourceDialect
1348 );
1349 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetCreationArgs>(&header, _body_bytes, handles, &mut req)?;
1350 let control_handle =
1351 PuppetFactoryControlHandle { inner: this.inner.clone() };
1352 Ok(PuppetFactoryRequest::Create {
1353 payload: req,
1354 responder: PuppetFactoryCreateResponder {
1355 control_handle: std::mem::ManuallyDrop::new(control_handle),
1356 tx_id: header.tx_id,
1357 },
1358 })
1359 }
1360 _ => Err(fidl::Error::UnknownOrdinal {
1361 ordinal: header.ordinal,
1362 protocol_name:
1363 <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1364 }),
1365 }))
1366 },
1367 )
1368 }
1369}
1370
1371#[derive(Debug)]
1374pub enum PuppetFactoryRequest {
1375 Create { payload: PuppetCreationArgs, responder: PuppetFactoryCreateResponder },
1378}
1379
1380impl PuppetFactoryRequest {
1381 #[allow(irrefutable_let_patterns)]
1382 pub fn into_create(self) -> Option<(PuppetCreationArgs, PuppetFactoryCreateResponder)> {
1383 if let PuppetFactoryRequest::Create { payload, responder } = self {
1384 Some((payload, responder))
1385 } else {
1386 None
1387 }
1388 }
1389
1390 pub fn method_name(&self) -> &'static str {
1392 match *self {
1393 PuppetFactoryRequest::Create { .. } => "create",
1394 }
1395 }
1396}
1397
1398#[derive(Debug, Clone)]
1399pub struct PuppetFactoryControlHandle {
1400 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1401}
1402
1403impl fidl::endpoints::ControlHandle for PuppetFactoryControlHandle {
1404 fn shutdown(&self) {
1405 self.inner.shutdown()
1406 }
1407 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1408 self.inner.shutdown_with_epitaph(status)
1409 }
1410
1411 fn is_closed(&self) -> bool {
1412 self.inner.channel().is_closed()
1413 }
1414 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1415 self.inner.channel().on_closed()
1416 }
1417
1418 #[cfg(target_os = "fuchsia")]
1419 fn signal_peer(
1420 &self,
1421 clear_mask: zx::Signals,
1422 set_mask: zx::Signals,
1423 ) -> Result<(), zx_status::Status> {
1424 use fidl::Peered;
1425 self.inner.channel().signal_peer(clear_mask, set_mask)
1426 }
1427}
1428
1429impl PuppetFactoryControlHandle {}
1430
1431#[must_use = "FIDL methods require a response to be sent"]
1432#[derive(Debug)]
1433pub struct PuppetFactoryCreateResponder {
1434 control_handle: std::mem::ManuallyDrop<PuppetFactoryControlHandle>,
1435 tx_id: u32,
1436}
1437
1438impl std::ops::Drop for PuppetFactoryCreateResponder {
1442 fn drop(&mut self) {
1443 self.control_handle.shutdown();
1444 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1446 }
1447}
1448
1449impl fidl::endpoints::Responder for PuppetFactoryCreateResponder {
1450 type ControlHandle = PuppetFactoryControlHandle;
1451
1452 fn control_handle(&self) -> &PuppetFactoryControlHandle {
1453 &self.control_handle
1454 }
1455
1456 fn drop_without_shutdown(mut self) {
1457 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1459 std::mem::forget(self);
1461 }
1462}
1463
1464impl PuppetFactoryCreateResponder {
1465 pub fn send(self, mut payload: PuppetFactoryCreateResponse) -> Result<(), fidl::Error> {
1469 let _result = self.send_raw(payload);
1470 if _result.is_err() {
1471 self.control_handle.shutdown();
1472 }
1473 self.drop_without_shutdown();
1474 _result
1475 }
1476
1477 pub fn send_no_shutdown_on_err(
1479 self,
1480 mut payload: PuppetFactoryCreateResponse,
1481 ) -> Result<(), fidl::Error> {
1482 let _result = self.send_raw(payload);
1483 self.drop_without_shutdown();
1484 _result
1485 }
1486
1487 fn send_raw(&self, mut payload: PuppetFactoryCreateResponse) -> Result<(), fidl::Error> {
1488 self.control_handle.inner.send::<PuppetFactoryCreateResponse>(
1489 &mut payload,
1490 self.tx_id,
1491 0x4f90811dc284b595,
1492 fidl::encoding::DynamicFlags::empty(),
1493 )
1494 }
1495}
1496
1497mod internal {
1498 use super::*;
1499
1500 impl PuppetCreationArgs {
1501 #[inline(always)]
1502 fn max_ordinal_present(&self) -> u64 {
1503 if let Some(_) = self.focuser {
1504 return 9;
1505 }
1506 if let Some(_) = self.device_pixel_ratio {
1507 return 8;
1508 }
1509 if let Some(_) = self.keyboard_client {
1510 return 7;
1511 }
1512 if let Some(_) = self.flatland_client {
1513 return 6;
1514 }
1515 if let Some(_) = self.keyboard_listener {
1516 return 5;
1517 }
1518 if let Some(_) = self.mouse_listener {
1519 return 4;
1520 }
1521 if let Some(_) = self.touch_listener {
1522 return 3;
1523 }
1524 if let Some(_) = self.view_token {
1525 return 2;
1526 }
1527 if let Some(_) = self.server_end {
1528 return 1;
1529 }
1530 0
1531 }
1532 }
1533
1534 impl fidl::encoding::ResourceTypeMarker for PuppetCreationArgs {
1535 type Borrowed<'a> = &'a mut Self;
1536 fn take_or_borrow<'a>(
1537 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1538 ) -> Self::Borrowed<'a> {
1539 value
1540 }
1541 }
1542
1543 unsafe impl fidl::encoding::TypeMarker for PuppetCreationArgs {
1544 type Owned = Self;
1545
1546 #[inline(always)]
1547 fn inline_align(_context: fidl::encoding::Context) -> usize {
1548 8
1549 }
1550
1551 #[inline(always)]
1552 fn inline_size(_context: fidl::encoding::Context) -> usize {
1553 16
1554 }
1555 }
1556
1557 unsafe impl
1558 fidl::encoding::Encode<PuppetCreationArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
1559 for &mut PuppetCreationArgs
1560 {
1561 unsafe fn encode(
1562 self,
1563 encoder: &mut fidl::encoding::Encoder<
1564 '_,
1565 fidl::encoding::DefaultFuchsiaResourceDialect,
1566 >,
1567 offset: usize,
1568 mut depth: fidl::encoding::Depth,
1569 ) -> fidl::Result<()> {
1570 encoder.debug_check_bounds::<PuppetCreationArgs>(offset);
1571 let max_ordinal: u64 = self.max_ordinal_present();
1573 encoder.write_num(max_ordinal, offset);
1574 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1575 if max_ordinal == 0 {
1577 return Ok(());
1578 }
1579 depth.increment()?;
1580 let envelope_size = 8;
1581 let bytes_len = max_ordinal as usize * envelope_size;
1582 #[allow(unused_variables)]
1583 let offset = encoder.out_of_line_offset(bytes_len);
1584 let mut _prev_end_offset: usize = 0;
1585 if 1 > max_ordinal {
1586 return Ok(());
1587 }
1588
1589 let cur_offset: usize = (1 - 1) * envelope_size;
1592
1593 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1595
1596 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1601 self.server_end.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1602 encoder, offset + cur_offset, depth
1603 )?;
1604
1605 _prev_end_offset = cur_offset + envelope_size;
1606 if 2 > max_ordinal {
1607 return Ok(());
1608 }
1609
1610 let cur_offset: usize = (2 - 1) * envelope_size;
1613
1614 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1616
1617 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
1622 self.view_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1623 encoder, offset + cur_offset, depth
1624 )?;
1625
1626 _prev_end_offset = cur_offset + envelope_size;
1627 if 3 > max_ordinal {
1628 return Ok(());
1629 }
1630
1631 let cur_offset: usize = (3 - 1) * envelope_size;
1634
1635 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1637
1638 fidl::encoding::encode_in_envelope_optional::<
1643 fidl::encoding::Endpoint<
1644 fidl::endpoints::ClientEnd<
1645 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
1646 >,
1647 >,
1648 fidl::encoding::DefaultFuchsiaResourceDialect,
1649 >(
1650 self.touch_listener.as_mut().map(
1651 <fidl::encoding::Endpoint<
1652 fidl::endpoints::ClientEnd<
1653 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
1654 >,
1655 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1656 ),
1657 encoder,
1658 offset + cur_offset,
1659 depth,
1660 )?;
1661
1662 _prev_end_offset = cur_offset + envelope_size;
1663 if 4 > max_ordinal {
1664 return Ok(());
1665 }
1666
1667 let cur_offset: usize = (4 - 1) * envelope_size;
1670
1671 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1673
1674 fidl::encoding::encode_in_envelope_optional::<
1679 fidl::encoding::Endpoint<
1680 fidl::endpoints::ClientEnd<
1681 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
1682 >,
1683 >,
1684 fidl::encoding::DefaultFuchsiaResourceDialect,
1685 >(
1686 self.mouse_listener.as_mut().map(
1687 <fidl::encoding::Endpoint<
1688 fidl::endpoints::ClientEnd<
1689 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
1690 >,
1691 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1692 ),
1693 encoder,
1694 offset + cur_offset,
1695 depth,
1696 )?;
1697
1698 _prev_end_offset = cur_offset + envelope_size;
1699 if 5 > max_ordinal {
1700 return Ok(());
1701 }
1702
1703 let cur_offset: usize = (5 - 1) * envelope_size;
1706
1707 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1709
1710 fidl::encoding::encode_in_envelope_optional::<
1715 fidl::encoding::Endpoint<
1716 fidl::endpoints::ClientEnd<
1717 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
1718 >,
1719 >,
1720 fidl::encoding::DefaultFuchsiaResourceDialect,
1721 >(
1722 self.keyboard_listener.as_mut().map(
1723 <fidl::encoding::Endpoint<
1724 fidl::endpoints::ClientEnd<
1725 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
1726 >,
1727 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1728 ),
1729 encoder,
1730 offset + cur_offset,
1731 depth,
1732 )?;
1733
1734 _prev_end_offset = cur_offset + envelope_size;
1735 if 6 > max_ordinal {
1736 return Ok(());
1737 }
1738
1739 let cur_offset: usize = (6 - 1) * envelope_size;
1742
1743 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1745
1746 fidl::encoding::encode_in_envelope_optional::<
1751 fidl::encoding::Endpoint<
1752 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
1753 >,
1754 fidl::encoding::DefaultFuchsiaResourceDialect,
1755 >(
1756 self.flatland_client.as_mut().map(
1757 <fidl::encoding::Endpoint<
1758 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
1759 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1760 ),
1761 encoder,
1762 offset + cur_offset,
1763 depth,
1764 )?;
1765
1766 _prev_end_offset = cur_offset + envelope_size;
1767 if 7 > max_ordinal {
1768 return Ok(());
1769 }
1770
1771 let cur_offset: usize = (7 - 1) * envelope_size;
1774
1775 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1777
1778 fidl::encoding::encode_in_envelope_optional::<
1783 fidl::encoding::Endpoint<
1784 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
1785 >,
1786 fidl::encoding::DefaultFuchsiaResourceDialect,
1787 >(
1788 self.keyboard_client.as_mut().map(
1789 <fidl::encoding::Endpoint<
1790 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
1791 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1792 ),
1793 encoder,
1794 offset + cur_offset,
1795 depth,
1796 )?;
1797
1798 _prev_end_offset = cur_offset + envelope_size;
1799 if 8 > max_ordinal {
1800 return Ok(());
1801 }
1802
1803 let cur_offset: usize = (8 - 1) * envelope_size;
1806
1807 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1809
1810 fidl::encoding::encode_in_envelope_optional::<
1815 f32,
1816 fidl::encoding::DefaultFuchsiaResourceDialect,
1817 >(
1818 self.device_pixel_ratio
1819 .as_ref()
1820 .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
1821 encoder,
1822 offset + cur_offset,
1823 depth,
1824 )?;
1825
1826 _prev_end_offset = cur_offset + envelope_size;
1827 if 9 > max_ordinal {
1828 return Ok(());
1829 }
1830
1831 let cur_offset: usize = (9 - 1) * envelope_size;
1834
1835 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1837
1838 fidl::encoding::encode_in_envelope_optional::<
1843 fidl::encoding::Endpoint<
1844 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
1845 >,
1846 fidl::encoding::DefaultFuchsiaResourceDialect,
1847 >(
1848 self.focuser.as_mut().map(
1849 <fidl::encoding::Endpoint<
1850 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
1851 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1852 ),
1853 encoder,
1854 offset + cur_offset,
1855 depth,
1856 )?;
1857
1858 _prev_end_offset = cur_offset + envelope_size;
1859
1860 Ok(())
1861 }
1862 }
1863
1864 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1865 for PuppetCreationArgs
1866 {
1867 #[inline(always)]
1868 fn new_empty() -> Self {
1869 Self::default()
1870 }
1871
1872 unsafe fn decode(
1873 &mut self,
1874 decoder: &mut fidl::encoding::Decoder<
1875 '_,
1876 fidl::encoding::DefaultFuchsiaResourceDialect,
1877 >,
1878 offset: usize,
1879 mut depth: fidl::encoding::Depth,
1880 ) -> fidl::Result<()> {
1881 decoder.debug_check_bounds::<Self>(offset);
1882 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1883 None => return Err(fidl::Error::NotNullable),
1884 Some(len) => len,
1885 };
1886 if len == 0 {
1888 return Ok(());
1889 };
1890 depth.increment()?;
1891 let envelope_size = 8;
1892 let bytes_len = len * envelope_size;
1893 let offset = decoder.out_of_line_offset(bytes_len)?;
1894 let mut _next_ordinal_to_read = 0;
1896 let mut next_offset = offset;
1897 let end_offset = offset + bytes_len;
1898 _next_ordinal_to_read += 1;
1899 if next_offset >= end_offset {
1900 return Ok(());
1901 }
1902
1903 while _next_ordinal_to_read < 1 {
1905 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1906 _next_ordinal_to_read += 1;
1907 next_offset += envelope_size;
1908 }
1909
1910 let next_out_of_line = decoder.next_out_of_line();
1911 let handles_before = decoder.remaining_handles();
1912 if let Some((inlined, num_bytes, num_handles)) =
1913 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1914 {
1915 let member_inline_size = <fidl::encoding::Endpoint<
1916 fidl::endpoints::ServerEnd<PuppetMarker>,
1917 > as fidl::encoding::TypeMarker>::inline_size(
1918 decoder.context
1919 );
1920 if inlined != (member_inline_size <= 4) {
1921 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1922 }
1923 let inner_offset;
1924 let mut inner_depth = depth.clone();
1925 if inlined {
1926 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1927 inner_offset = next_offset;
1928 } else {
1929 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1930 inner_depth.increment()?;
1931 }
1932 let val_ref = self.server_end.get_or_insert_with(|| {
1933 fidl::new_empty!(
1934 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>>,
1935 fidl::encoding::DefaultFuchsiaResourceDialect
1936 )
1937 });
1938 fidl::decode!(
1939 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>>,
1940 fidl::encoding::DefaultFuchsiaResourceDialect,
1941 val_ref,
1942 decoder,
1943 inner_offset,
1944 inner_depth
1945 )?;
1946 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1947 {
1948 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1949 }
1950 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1951 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1952 }
1953 }
1954
1955 next_offset += envelope_size;
1956 _next_ordinal_to_read += 1;
1957 if next_offset >= end_offset {
1958 return Ok(());
1959 }
1960
1961 while _next_ordinal_to_read < 2 {
1963 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1964 _next_ordinal_to_read += 1;
1965 next_offset += envelope_size;
1966 }
1967
1968 let next_out_of_line = decoder.next_out_of_line();
1969 let handles_before = decoder.remaining_handles();
1970 if let Some((inlined, num_bytes, num_handles)) =
1971 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1972 {
1973 let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1974 if inlined != (member_inline_size <= 4) {
1975 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1976 }
1977 let inner_offset;
1978 let mut inner_depth = depth.clone();
1979 if inlined {
1980 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1981 inner_offset = next_offset;
1982 } else {
1983 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1984 inner_depth.increment()?;
1985 }
1986 let val_ref = self.view_token.get_or_insert_with(|| {
1987 fidl::new_empty!(
1988 fidl_fuchsia_ui_views::ViewCreationToken,
1989 fidl::encoding::DefaultFuchsiaResourceDialect
1990 )
1991 });
1992 fidl::decode!(
1993 fidl_fuchsia_ui_views::ViewCreationToken,
1994 fidl::encoding::DefaultFuchsiaResourceDialect,
1995 val_ref,
1996 decoder,
1997 inner_offset,
1998 inner_depth
1999 )?;
2000 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2001 {
2002 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2003 }
2004 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2005 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2006 }
2007 }
2008
2009 next_offset += envelope_size;
2010 _next_ordinal_to_read += 1;
2011 if next_offset >= end_offset {
2012 return Ok(());
2013 }
2014
2015 while _next_ordinal_to_read < 3 {
2017 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2018 _next_ordinal_to_read += 1;
2019 next_offset += envelope_size;
2020 }
2021
2022 let next_out_of_line = decoder.next_out_of_line();
2023 let handles_before = decoder.remaining_handles();
2024 if let Some((inlined, num_bytes, num_handles)) =
2025 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2026 {
2027 let member_inline_size = <fidl::encoding::Endpoint<
2028 fidl::endpoints::ClientEnd<
2029 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
2030 >,
2031 > as fidl::encoding::TypeMarker>::inline_size(
2032 decoder.context
2033 );
2034 if inlined != (member_inline_size <= 4) {
2035 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2036 }
2037 let inner_offset;
2038 let mut inner_depth = depth.clone();
2039 if inlined {
2040 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2041 inner_offset = next_offset;
2042 } else {
2043 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2044 inner_depth.increment()?;
2045 }
2046 let val_ref = self.touch_listener.get_or_insert_with(|| {
2047 fidl::new_empty!(
2048 fidl::encoding::Endpoint<
2049 fidl::endpoints::ClientEnd<
2050 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
2051 >,
2052 >,
2053 fidl::encoding::DefaultFuchsiaResourceDialect
2054 )
2055 });
2056 fidl::decode!(
2057 fidl::encoding::Endpoint<
2058 fidl::endpoints::ClientEnd<
2059 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
2060 >,
2061 >,
2062 fidl::encoding::DefaultFuchsiaResourceDialect,
2063 val_ref,
2064 decoder,
2065 inner_offset,
2066 inner_depth
2067 )?;
2068 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2069 {
2070 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2071 }
2072 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2073 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2074 }
2075 }
2076
2077 next_offset += envelope_size;
2078 _next_ordinal_to_read += 1;
2079 if next_offset >= end_offset {
2080 return Ok(());
2081 }
2082
2083 while _next_ordinal_to_read < 4 {
2085 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2086 _next_ordinal_to_read += 1;
2087 next_offset += envelope_size;
2088 }
2089
2090 let next_out_of_line = decoder.next_out_of_line();
2091 let handles_before = decoder.remaining_handles();
2092 if let Some((inlined, num_bytes, num_handles)) =
2093 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2094 {
2095 let member_inline_size = <fidl::encoding::Endpoint<
2096 fidl::endpoints::ClientEnd<
2097 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
2098 >,
2099 > as fidl::encoding::TypeMarker>::inline_size(
2100 decoder.context
2101 );
2102 if inlined != (member_inline_size <= 4) {
2103 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2104 }
2105 let inner_offset;
2106 let mut inner_depth = depth.clone();
2107 if inlined {
2108 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2109 inner_offset = next_offset;
2110 } else {
2111 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2112 inner_depth.increment()?;
2113 }
2114 let val_ref = self.mouse_listener.get_or_insert_with(|| {
2115 fidl::new_empty!(
2116 fidl::encoding::Endpoint<
2117 fidl::endpoints::ClientEnd<
2118 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
2119 >,
2120 >,
2121 fidl::encoding::DefaultFuchsiaResourceDialect
2122 )
2123 });
2124 fidl::decode!(
2125 fidl::encoding::Endpoint<
2126 fidl::endpoints::ClientEnd<
2127 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
2128 >,
2129 >,
2130 fidl::encoding::DefaultFuchsiaResourceDialect,
2131 val_ref,
2132 decoder,
2133 inner_offset,
2134 inner_depth
2135 )?;
2136 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2137 {
2138 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2139 }
2140 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2141 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2142 }
2143 }
2144
2145 next_offset += envelope_size;
2146 _next_ordinal_to_read += 1;
2147 if next_offset >= end_offset {
2148 return Ok(());
2149 }
2150
2151 while _next_ordinal_to_read < 5 {
2153 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2154 _next_ordinal_to_read += 1;
2155 next_offset += envelope_size;
2156 }
2157
2158 let next_out_of_line = decoder.next_out_of_line();
2159 let handles_before = decoder.remaining_handles();
2160 if let Some((inlined, num_bytes, num_handles)) =
2161 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2162 {
2163 let member_inline_size = <fidl::encoding::Endpoint<
2164 fidl::endpoints::ClientEnd<
2165 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
2166 >,
2167 > as fidl::encoding::TypeMarker>::inline_size(
2168 decoder.context
2169 );
2170 if inlined != (member_inline_size <= 4) {
2171 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2172 }
2173 let inner_offset;
2174 let mut inner_depth = depth.clone();
2175 if inlined {
2176 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2177 inner_offset = next_offset;
2178 } else {
2179 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2180 inner_depth.increment()?;
2181 }
2182 let val_ref = self.keyboard_listener.get_or_insert_with(|| {
2183 fidl::new_empty!(
2184 fidl::encoding::Endpoint<
2185 fidl::endpoints::ClientEnd<
2186 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
2187 >,
2188 >,
2189 fidl::encoding::DefaultFuchsiaResourceDialect
2190 )
2191 });
2192 fidl::decode!(
2193 fidl::encoding::Endpoint<
2194 fidl::endpoints::ClientEnd<
2195 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
2196 >,
2197 >,
2198 fidl::encoding::DefaultFuchsiaResourceDialect,
2199 val_ref,
2200 decoder,
2201 inner_offset,
2202 inner_depth
2203 )?;
2204 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2205 {
2206 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2207 }
2208 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2209 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2210 }
2211 }
2212
2213 next_offset += envelope_size;
2214 _next_ordinal_to_read += 1;
2215 if next_offset >= end_offset {
2216 return Ok(());
2217 }
2218
2219 while _next_ordinal_to_read < 6 {
2221 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2222 _next_ordinal_to_read += 1;
2223 next_offset += envelope_size;
2224 }
2225
2226 let next_out_of_line = decoder.next_out_of_line();
2227 let handles_before = decoder.remaining_handles();
2228 if let Some((inlined, num_bytes, num_handles)) =
2229 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2230 {
2231 let member_inline_size = <fidl::encoding::Endpoint<
2232 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
2233 > as fidl::encoding::TypeMarker>::inline_size(
2234 decoder.context
2235 );
2236 if inlined != (member_inline_size <= 4) {
2237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2238 }
2239 let inner_offset;
2240 let mut inner_depth = depth.clone();
2241 if inlined {
2242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2243 inner_offset = next_offset;
2244 } else {
2245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2246 inner_depth.increment()?;
2247 }
2248 let val_ref = self.flatland_client.get_or_insert_with(|| {
2249 fidl::new_empty!(
2250 fidl::encoding::Endpoint<
2251 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
2252 >,
2253 fidl::encoding::DefaultFuchsiaResourceDialect
2254 )
2255 });
2256 fidl::decode!(
2257 fidl::encoding::Endpoint<
2258 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
2259 >,
2260 fidl::encoding::DefaultFuchsiaResourceDialect,
2261 val_ref,
2262 decoder,
2263 inner_offset,
2264 inner_depth
2265 )?;
2266 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2267 {
2268 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2269 }
2270 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2271 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2272 }
2273 }
2274
2275 next_offset += envelope_size;
2276 _next_ordinal_to_read += 1;
2277 if next_offset >= end_offset {
2278 return Ok(());
2279 }
2280
2281 while _next_ordinal_to_read < 7 {
2283 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2284 _next_ordinal_to_read += 1;
2285 next_offset += envelope_size;
2286 }
2287
2288 let next_out_of_line = decoder.next_out_of_line();
2289 let handles_before = decoder.remaining_handles();
2290 if let Some((inlined, num_bytes, num_handles)) =
2291 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2292 {
2293 let member_inline_size = <fidl::encoding::Endpoint<
2294 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
2295 > as fidl::encoding::TypeMarker>::inline_size(
2296 decoder.context
2297 );
2298 if inlined != (member_inline_size <= 4) {
2299 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2300 }
2301 let inner_offset;
2302 let mut inner_depth = depth.clone();
2303 if inlined {
2304 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2305 inner_offset = next_offset;
2306 } else {
2307 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2308 inner_depth.increment()?;
2309 }
2310 let val_ref = self.keyboard_client.get_or_insert_with(|| {
2311 fidl::new_empty!(
2312 fidl::encoding::Endpoint<
2313 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
2314 >,
2315 fidl::encoding::DefaultFuchsiaResourceDialect
2316 )
2317 });
2318 fidl::decode!(
2319 fidl::encoding::Endpoint<
2320 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
2321 >,
2322 fidl::encoding::DefaultFuchsiaResourceDialect,
2323 val_ref,
2324 decoder,
2325 inner_offset,
2326 inner_depth
2327 )?;
2328 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2329 {
2330 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2331 }
2332 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2333 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2334 }
2335 }
2336
2337 next_offset += envelope_size;
2338 _next_ordinal_to_read += 1;
2339 if next_offset >= end_offset {
2340 return Ok(());
2341 }
2342
2343 while _next_ordinal_to_read < 8 {
2345 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2346 _next_ordinal_to_read += 1;
2347 next_offset += envelope_size;
2348 }
2349
2350 let next_out_of_line = decoder.next_out_of_line();
2351 let handles_before = decoder.remaining_handles();
2352 if let Some((inlined, num_bytes, num_handles)) =
2353 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2354 {
2355 let member_inline_size =
2356 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2357 if inlined != (member_inline_size <= 4) {
2358 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2359 }
2360 let inner_offset;
2361 let mut inner_depth = depth.clone();
2362 if inlined {
2363 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2364 inner_offset = next_offset;
2365 } else {
2366 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2367 inner_depth.increment()?;
2368 }
2369 let val_ref = self.device_pixel_ratio.get_or_insert_with(|| {
2370 fidl::new_empty!(f32, fidl::encoding::DefaultFuchsiaResourceDialect)
2371 });
2372 fidl::decode!(
2373 f32,
2374 fidl::encoding::DefaultFuchsiaResourceDialect,
2375 val_ref,
2376 decoder,
2377 inner_offset,
2378 inner_depth
2379 )?;
2380 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2381 {
2382 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2383 }
2384 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2385 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2386 }
2387 }
2388
2389 next_offset += envelope_size;
2390 _next_ordinal_to_read += 1;
2391 if next_offset >= end_offset {
2392 return Ok(());
2393 }
2394
2395 while _next_ordinal_to_read < 9 {
2397 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2398 _next_ordinal_to_read += 1;
2399 next_offset += envelope_size;
2400 }
2401
2402 let next_out_of_line = decoder.next_out_of_line();
2403 let handles_before = decoder.remaining_handles();
2404 if let Some((inlined, num_bytes, num_handles)) =
2405 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2406 {
2407 let member_inline_size = <fidl::encoding::Endpoint<
2408 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
2409 > as fidl::encoding::TypeMarker>::inline_size(
2410 decoder.context
2411 );
2412 if inlined != (member_inline_size <= 4) {
2413 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2414 }
2415 let inner_offset;
2416 let mut inner_depth = depth.clone();
2417 if inlined {
2418 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2419 inner_offset = next_offset;
2420 } else {
2421 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2422 inner_depth.increment()?;
2423 }
2424 let val_ref = self.focuser.get_or_insert_with(|| {
2425 fidl::new_empty!(
2426 fidl::encoding::Endpoint<
2427 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
2428 >,
2429 fidl::encoding::DefaultFuchsiaResourceDialect
2430 )
2431 });
2432 fidl::decode!(
2433 fidl::encoding::Endpoint<
2434 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
2435 >,
2436 fidl::encoding::DefaultFuchsiaResourceDialect,
2437 val_ref,
2438 decoder,
2439 inner_offset,
2440 inner_depth
2441 )?;
2442 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2443 {
2444 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2445 }
2446 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2447 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2448 }
2449 }
2450
2451 next_offset += envelope_size;
2452
2453 while next_offset < end_offset {
2455 _next_ordinal_to_read += 1;
2456 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2457 next_offset += envelope_size;
2458 }
2459
2460 Ok(())
2461 }
2462 }
2463
2464 impl PuppetEmbedRemoteViewResponse {
2465 #[inline(always)]
2466 fn max_ordinal_present(&self) -> u64 {
2467 if let Some(_) = self.view_creation_token {
2468 return 2;
2469 }
2470 if let Some(_) = self.result {
2471 return 1;
2472 }
2473 0
2474 }
2475 }
2476
2477 impl fidl::encoding::ResourceTypeMarker for PuppetEmbedRemoteViewResponse {
2478 type Borrowed<'a> = &'a mut Self;
2479 fn take_or_borrow<'a>(
2480 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2481 ) -> Self::Borrowed<'a> {
2482 value
2483 }
2484 }
2485
2486 unsafe impl fidl::encoding::TypeMarker for PuppetEmbedRemoteViewResponse {
2487 type Owned = Self;
2488
2489 #[inline(always)]
2490 fn inline_align(_context: fidl::encoding::Context) -> usize {
2491 8
2492 }
2493
2494 #[inline(always)]
2495 fn inline_size(_context: fidl::encoding::Context) -> usize {
2496 16
2497 }
2498 }
2499
2500 unsafe impl
2501 fidl::encoding::Encode<
2502 PuppetEmbedRemoteViewResponse,
2503 fidl::encoding::DefaultFuchsiaResourceDialect,
2504 > for &mut PuppetEmbedRemoteViewResponse
2505 {
2506 unsafe fn encode(
2507 self,
2508 encoder: &mut fidl::encoding::Encoder<
2509 '_,
2510 fidl::encoding::DefaultFuchsiaResourceDialect,
2511 >,
2512 offset: usize,
2513 mut depth: fidl::encoding::Depth,
2514 ) -> fidl::Result<()> {
2515 encoder.debug_check_bounds::<PuppetEmbedRemoteViewResponse>(offset);
2516 let max_ordinal: u64 = self.max_ordinal_present();
2518 encoder.write_num(max_ordinal, offset);
2519 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2520 if max_ordinal == 0 {
2522 return Ok(());
2523 }
2524 depth.increment()?;
2525 let envelope_size = 8;
2526 let bytes_len = max_ordinal as usize * envelope_size;
2527 #[allow(unused_variables)]
2528 let offset = encoder.out_of_line_offset(bytes_len);
2529 let mut _prev_end_offset: usize = 0;
2530 if 1 > max_ordinal {
2531 return Ok(());
2532 }
2533
2534 let cur_offset: usize = (1 - 1) * envelope_size;
2537
2538 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2540
2541 fidl::encoding::encode_in_envelope_optional::<
2546 Result_,
2547 fidl::encoding::DefaultFuchsiaResourceDialect,
2548 >(
2549 self.result.as_ref().map(<Result_ as fidl::encoding::ValueTypeMarker>::borrow),
2550 encoder,
2551 offset + cur_offset,
2552 depth,
2553 )?;
2554
2555 _prev_end_offset = cur_offset + envelope_size;
2556 if 2 > max_ordinal {
2557 return Ok(());
2558 }
2559
2560 let cur_offset: usize = (2 - 1) * envelope_size;
2563
2564 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2566
2567 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
2572 self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2573 encoder, offset + cur_offset, depth
2574 )?;
2575
2576 _prev_end_offset = cur_offset + envelope_size;
2577
2578 Ok(())
2579 }
2580 }
2581
2582 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2583 for PuppetEmbedRemoteViewResponse
2584 {
2585 #[inline(always)]
2586 fn new_empty() -> Self {
2587 Self::default()
2588 }
2589
2590 unsafe fn decode(
2591 &mut self,
2592 decoder: &mut fidl::encoding::Decoder<
2593 '_,
2594 fidl::encoding::DefaultFuchsiaResourceDialect,
2595 >,
2596 offset: usize,
2597 mut depth: fidl::encoding::Depth,
2598 ) -> fidl::Result<()> {
2599 decoder.debug_check_bounds::<Self>(offset);
2600 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2601 None => return Err(fidl::Error::NotNullable),
2602 Some(len) => len,
2603 };
2604 if len == 0 {
2606 return Ok(());
2607 };
2608 depth.increment()?;
2609 let envelope_size = 8;
2610 let bytes_len = len * envelope_size;
2611 let offset = decoder.out_of_line_offset(bytes_len)?;
2612 let mut _next_ordinal_to_read = 0;
2614 let mut next_offset = offset;
2615 let end_offset = offset + bytes_len;
2616 _next_ordinal_to_read += 1;
2617 if next_offset >= end_offset {
2618 return Ok(());
2619 }
2620
2621 while _next_ordinal_to_read < 1 {
2623 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2624 _next_ordinal_to_read += 1;
2625 next_offset += envelope_size;
2626 }
2627
2628 let next_out_of_line = decoder.next_out_of_line();
2629 let handles_before = decoder.remaining_handles();
2630 if let Some((inlined, num_bytes, num_handles)) =
2631 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2632 {
2633 let member_inline_size =
2634 <Result_ as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2635 if inlined != (member_inline_size <= 4) {
2636 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2637 }
2638 let inner_offset;
2639 let mut inner_depth = depth.clone();
2640 if inlined {
2641 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2642 inner_offset = next_offset;
2643 } else {
2644 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2645 inner_depth.increment()?;
2646 }
2647 let val_ref = self.result.get_or_insert_with(|| {
2648 fidl::new_empty!(Result_, fidl::encoding::DefaultFuchsiaResourceDialect)
2649 });
2650 fidl::decode!(
2651 Result_,
2652 fidl::encoding::DefaultFuchsiaResourceDialect,
2653 val_ref,
2654 decoder,
2655 inner_offset,
2656 inner_depth
2657 )?;
2658 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2659 {
2660 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2661 }
2662 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2663 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2664 }
2665 }
2666
2667 next_offset += envelope_size;
2668 _next_ordinal_to_read += 1;
2669 if next_offset >= end_offset {
2670 return Ok(());
2671 }
2672
2673 while _next_ordinal_to_read < 2 {
2675 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2676 _next_ordinal_to_read += 1;
2677 next_offset += envelope_size;
2678 }
2679
2680 let next_out_of_line = decoder.next_out_of_line();
2681 let handles_before = decoder.remaining_handles();
2682 if let Some((inlined, num_bytes, num_handles)) =
2683 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2684 {
2685 let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2686 if inlined != (member_inline_size <= 4) {
2687 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2688 }
2689 let inner_offset;
2690 let mut inner_depth = depth.clone();
2691 if inlined {
2692 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2693 inner_offset = next_offset;
2694 } else {
2695 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2696 inner_depth.increment()?;
2697 }
2698 let val_ref = self.view_creation_token.get_or_insert_with(|| {
2699 fidl::new_empty!(
2700 fidl_fuchsia_ui_views::ViewCreationToken,
2701 fidl::encoding::DefaultFuchsiaResourceDialect
2702 )
2703 });
2704 fidl::decode!(
2705 fidl_fuchsia_ui_views::ViewCreationToken,
2706 fidl::encoding::DefaultFuchsiaResourceDialect,
2707 val_ref,
2708 decoder,
2709 inner_offset,
2710 inner_depth
2711 )?;
2712 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2713 {
2714 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2715 }
2716 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2717 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2718 }
2719 }
2720
2721 next_offset += envelope_size;
2722
2723 while next_offset < end_offset {
2725 _next_ordinal_to_read += 1;
2726 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2727 next_offset += envelope_size;
2728 }
2729
2730 Ok(())
2731 }
2732 }
2733
2734 impl PuppetFactoryCreateResponse {
2735 #[inline(always)]
2736 fn max_ordinal_present(&self) -> u64 {
2737 if let Some(_) = self.view_ref {
2738 return 2;
2739 }
2740 if let Some(_) = self.result {
2741 return 1;
2742 }
2743 0
2744 }
2745 }
2746
2747 impl fidl::encoding::ResourceTypeMarker for PuppetFactoryCreateResponse {
2748 type Borrowed<'a> = &'a mut Self;
2749 fn take_or_borrow<'a>(
2750 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2751 ) -> Self::Borrowed<'a> {
2752 value
2753 }
2754 }
2755
2756 unsafe impl fidl::encoding::TypeMarker for PuppetFactoryCreateResponse {
2757 type Owned = Self;
2758
2759 #[inline(always)]
2760 fn inline_align(_context: fidl::encoding::Context) -> usize {
2761 8
2762 }
2763
2764 #[inline(always)]
2765 fn inline_size(_context: fidl::encoding::Context) -> usize {
2766 16
2767 }
2768 }
2769
2770 unsafe impl
2771 fidl::encoding::Encode<
2772 PuppetFactoryCreateResponse,
2773 fidl::encoding::DefaultFuchsiaResourceDialect,
2774 > for &mut PuppetFactoryCreateResponse
2775 {
2776 unsafe fn encode(
2777 self,
2778 encoder: &mut fidl::encoding::Encoder<
2779 '_,
2780 fidl::encoding::DefaultFuchsiaResourceDialect,
2781 >,
2782 offset: usize,
2783 mut depth: fidl::encoding::Depth,
2784 ) -> fidl::Result<()> {
2785 encoder.debug_check_bounds::<PuppetFactoryCreateResponse>(offset);
2786 let max_ordinal: u64 = self.max_ordinal_present();
2788 encoder.write_num(max_ordinal, offset);
2789 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2790 if max_ordinal == 0 {
2792 return Ok(());
2793 }
2794 depth.increment()?;
2795 let envelope_size = 8;
2796 let bytes_len = max_ordinal as usize * envelope_size;
2797 #[allow(unused_variables)]
2798 let offset = encoder.out_of_line_offset(bytes_len);
2799 let mut _prev_end_offset: usize = 0;
2800 if 1 > max_ordinal {
2801 return Ok(());
2802 }
2803
2804 let cur_offset: usize = (1 - 1) * envelope_size;
2807
2808 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2810
2811 fidl::encoding::encode_in_envelope_optional::<
2816 Result_,
2817 fidl::encoding::DefaultFuchsiaResourceDialect,
2818 >(
2819 self.result.as_ref().map(<Result_ as fidl::encoding::ValueTypeMarker>::borrow),
2820 encoder,
2821 offset + cur_offset,
2822 depth,
2823 )?;
2824
2825 _prev_end_offset = cur_offset + envelope_size;
2826 if 2 > max_ordinal {
2827 return Ok(());
2828 }
2829
2830 let cur_offset: usize = (2 - 1) * envelope_size;
2833
2834 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2836
2837 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
2842 self.view_ref.as_mut().map(<fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2843 encoder, offset + cur_offset, depth
2844 )?;
2845
2846 _prev_end_offset = cur_offset + envelope_size;
2847
2848 Ok(())
2849 }
2850 }
2851
2852 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2853 for PuppetFactoryCreateResponse
2854 {
2855 #[inline(always)]
2856 fn new_empty() -> Self {
2857 Self::default()
2858 }
2859
2860 unsafe fn decode(
2861 &mut self,
2862 decoder: &mut fidl::encoding::Decoder<
2863 '_,
2864 fidl::encoding::DefaultFuchsiaResourceDialect,
2865 >,
2866 offset: usize,
2867 mut depth: fidl::encoding::Depth,
2868 ) -> fidl::Result<()> {
2869 decoder.debug_check_bounds::<Self>(offset);
2870 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2871 None => return Err(fidl::Error::NotNullable),
2872 Some(len) => len,
2873 };
2874 if len == 0 {
2876 return Ok(());
2877 };
2878 depth.increment()?;
2879 let envelope_size = 8;
2880 let bytes_len = len * envelope_size;
2881 let offset = decoder.out_of_line_offset(bytes_len)?;
2882 let mut _next_ordinal_to_read = 0;
2884 let mut next_offset = offset;
2885 let end_offset = offset + bytes_len;
2886 _next_ordinal_to_read += 1;
2887 if next_offset >= end_offset {
2888 return Ok(());
2889 }
2890
2891 while _next_ordinal_to_read < 1 {
2893 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2894 _next_ordinal_to_read += 1;
2895 next_offset += envelope_size;
2896 }
2897
2898 let next_out_of_line = decoder.next_out_of_line();
2899 let handles_before = decoder.remaining_handles();
2900 if let Some((inlined, num_bytes, num_handles)) =
2901 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2902 {
2903 let member_inline_size =
2904 <Result_ as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2905 if inlined != (member_inline_size <= 4) {
2906 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2907 }
2908 let inner_offset;
2909 let mut inner_depth = depth.clone();
2910 if inlined {
2911 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2912 inner_offset = next_offset;
2913 } else {
2914 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2915 inner_depth.increment()?;
2916 }
2917 let val_ref = self.result.get_or_insert_with(|| {
2918 fidl::new_empty!(Result_, fidl::encoding::DefaultFuchsiaResourceDialect)
2919 });
2920 fidl::decode!(
2921 Result_,
2922 fidl::encoding::DefaultFuchsiaResourceDialect,
2923 val_ref,
2924 decoder,
2925 inner_offset,
2926 inner_depth
2927 )?;
2928 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2929 {
2930 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2931 }
2932 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2933 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2934 }
2935 }
2936
2937 next_offset += envelope_size;
2938 _next_ordinal_to_read += 1;
2939 if next_offset >= end_offset {
2940 return Ok(());
2941 }
2942
2943 while _next_ordinal_to_read < 2 {
2945 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2946 _next_ordinal_to_read += 1;
2947 next_offset += envelope_size;
2948 }
2949
2950 let next_out_of_line = decoder.next_out_of_line();
2951 let handles_before = decoder.remaining_handles();
2952 if let Some((inlined, num_bytes, num_handles)) =
2953 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2954 {
2955 let member_inline_size =
2956 <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::TypeMarker>::inline_size(
2957 decoder.context,
2958 );
2959 if inlined != (member_inline_size <= 4) {
2960 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2961 }
2962 let inner_offset;
2963 let mut inner_depth = depth.clone();
2964 if inlined {
2965 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2966 inner_offset = next_offset;
2967 } else {
2968 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2969 inner_depth.increment()?;
2970 }
2971 let val_ref = self.view_ref.get_or_insert_with(|| {
2972 fidl::new_empty!(
2973 fidl_fuchsia_ui_views::ViewRef,
2974 fidl::encoding::DefaultFuchsiaResourceDialect
2975 )
2976 });
2977 fidl::decode!(
2978 fidl_fuchsia_ui_views::ViewRef,
2979 fidl::encoding::DefaultFuchsiaResourceDialect,
2980 val_ref,
2981 decoder,
2982 inner_offset,
2983 inner_depth
2984 )?;
2985 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2986 {
2987 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2988 }
2989 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2990 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2991 }
2992 }
2993
2994 next_offset += envelope_size;
2995
2996 while next_offset < end_offset {
2998 _next_ordinal_to_read += 1;
2999 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3000 next_offset += envelope_size;
3001 }
3002
3003 Ok(())
3004 }
3005 }
3006}