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