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::NullableHandle {
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
766 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
767 self.inner.shutdown_with_epitaph(status)
768 }
769
770 fn is_closed(&self) -> bool {
771 self.inner.channel().is_closed()
772 }
773 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
774 self.inner.channel().on_closed()
775 }
776
777 #[cfg(target_os = "fuchsia")]
778 fn signal_peer(
779 &self,
780 clear_mask: zx::Signals,
781 set_mask: zx::Signals,
782 ) -> Result<(), zx_status::Status> {
783 use fidl::Peered;
784 self.inner.channel().signal_peer(clear_mask, set_mask)
785 }
786}
787
788impl PuppetControlHandle {}
789
790#[must_use = "FIDL methods require a response to be sent"]
791#[derive(Debug)]
792pub struct PuppetEmbedRemoteViewResponder {
793 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
794 tx_id: u32,
795}
796
797impl std::ops::Drop for PuppetEmbedRemoteViewResponder {
801 fn drop(&mut self) {
802 self.control_handle.shutdown();
803 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
805 }
806}
807
808impl fidl::endpoints::Responder for PuppetEmbedRemoteViewResponder {
809 type ControlHandle = PuppetControlHandle;
810
811 fn control_handle(&self) -> &PuppetControlHandle {
812 &self.control_handle
813 }
814
815 fn drop_without_shutdown(mut self) {
816 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
818 std::mem::forget(self);
820 }
821}
822
823impl PuppetEmbedRemoteViewResponder {
824 pub fn send(self, mut payload: PuppetEmbedRemoteViewResponse) -> Result<(), fidl::Error> {
828 let _result = self.send_raw(payload);
829 if _result.is_err() {
830 self.control_handle.shutdown();
831 }
832 self.drop_without_shutdown();
833 _result
834 }
835
836 pub fn send_no_shutdown_on_err(
838 self,
839 mut payload: PuppetEmbedRemoteViewResponse,
840 ) -> Result<(), fidl::Error> {
841 let _result = self.send_raw(payload);
842 self.drop_without_shutdown();
843 _result
844 }
845
846 fn send_raw(&self, mut payload: PuppetEmbedRemoteViewResponse) -> Result<(), fidl::Error> {
847 self.control_handle.inner.send::<PuppetEmbedRemoteViewResponse>(
848 &mut payload,
849 self.tx_id,
850 0x5bb2325a988aa137,
851 fidl::encoding::DynamicFlags::empty(),
852 )
853 }
854}
855
856#[must_use = "FIDL methods require a response to be sent"]
857#[derive(Debug)]
858pub struct PuppetSetEmbeddedViewPropertiesResponder {
859 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
860 tx_id: u32,
861}
862
863impl std::ops::Drop for PuppetSetEmbeddedViewPropertiesResponder {
867 fn drop(&mut self) {
868 self.control_handle.shutdown();
869 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
871 }
872}
873
874impl fidl::endpoints::Responder for PuppetSetEmbeddedViewPropertiesResponder {
875 type ControlHandle = PuppetControlHandle;
876
877 fn control_handle(&self) -> &PuppetControlHandle {
878 &self.control_handle
879 }
880
881 fn drop_without_shutdown(mut self) {
882 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
884 std::mem::forget(self);
886 }
887}
888
889impl PuppetSetEmbeddedViewPropertiesResponder {
890 pub fn send(
894 self,
895 mut payload: &PuppetSetEmbeddedViewPropertiesResponse,
896 ) -> Result<(), fidl::Error> {
897 let _result = self.send_raw(payload);
898 if _result.is_err() {
899 self.control_handle.shutdown();
900 }
901 self.drop_without_shutdown();
902 _result
903 }
904
905 pub fn send_no_shutdown_on_err(
907 self,
908 mut payload: &PuppetSetEmbeddedViewPropertiesResponse,
909 ) -> Result<(), fidl::Error> {
910 let _result = self.send_raw(payload);
911 self.drop_without_shutdown();
912 _result
913 }
914
915 fn send_raw(
916 &self,
917 mut payload: &PuppetSetEmbeddedViewPropertiesResponse,
918 ) -> Result<(), fidl::Error> {
919 self.control_handle.inner.send::<PuppetSetEmbeddedViewPropertiesResponse>(
920 payload,
921 self.tx_id,
922 0x409a7f3de135c709,
923 fidl::encoding::DynamicFlags::empty(),
924 )
925 }
926}
927
928#[must_use = "FIDL methods require a response to be sent"]
929#[derive(Debug)]
930pub struct PuppetDrawImageResponder {
931 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
932 tx_id: u32,
933}
934
935impl std::ops::Drop for PuppetDrawImageResponder {
939 fn drop(&mut self) {
940 self.control_handle.shutdown();
941 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
943 }
944}
945
946impl fidl::endpoints::Responder for PuppetDrawImageResponder {
947 type ControlHandle = PuppetControlHandle;
948
949 fn control_handle(&self) -> &PuppetControlHandle {
950 &self.control_handle
951 }
952
953 fn drop_without_shutdown(mut self) {
954 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
956 std::mem::forget(self);
958 }
959}
960
961impl PuppetDrawImageResponder {
962 pub fn send(self, mut payload: &PuppetDrawImageResponse) -> Result<(), fidl::Error> {
966 let _result = self.send_raw(payload);
967 if _result.is_err() {
968 self.control_handle.shutdown();
969 }
970 self.drop_without_shutdown();
971 _result
972 }
973
974 pub fn send_no_shutdown_on_err(
976 self,
977 mut payload: &PuppetDrawImageResponse,
978 ) -> Result<(), fidl::Error> {
979 let _result = self.send_raw(payload);
980 self.drop_without_shutdown();
981 _result
982 }
983
984 fn send_raw(&self, mut payload: &PuppetDrawImageResponse) -> Result<(), fidl::Error> {
985 self.control_handle.inner.send::<PuppetDrawImageResponse>(
986 payload,
987 self.tx_id,
988 0x6d736daa48b835cc,
989 fidl::encoding::DynamicFlags::empty(),
990 )
991 }
992}
993
994#[must_use = "FIDL methods require a response to be sent"]
995#[derive(Debug)]
996pub struct PuppetSetImagePropertiesResponder {
997 control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
998 tx_id: u32,
999}
1000
1001impl std::ops::Drop for PuppetSetImagePropertiesResponder {
1005 fn drop(&mut self) {
1006 self.control_handle.shutdown();
1007 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1009 }
1010}
1011
1012impl fidl::endpoints::Responder for PuppetSetImagePropertiesResponder {
1013 type ControlHandle = PuppetControlHandle;
1014
1015 fn control_handle(&self) -> &PuppetControlHandle {
1016 &self.control_handle
1017 }
1018
1019 fn drop_without_shutdown(mut self) {
1020 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1022 std::mem::forget(self);
1024 }
1025}
1026
1027impl PuppetSetImagePropertiesResponder {
1028 pub fn send(self, mut payload: &PuppetSetImagePropertiesResponse) -> Result<(), fidl::Error> {
1032 let _result = self.send_raw(payload);
1033 if _result.is_err() {
1034 self.control_handle.shutdown();
1035 }
1036 self.drop_without_shutdown();
1037 _result
1038 }
1039
1040 pub fn send_no_shutdown_on_err(
1042 self,
1043 mut payload: &PuppetSetImagePropertiesResponse,
1044 ) -> Result<(), fidl::Error> {
1045 let _result = self.send_raw(payload);
1046 self.drop_without_shutdown();
1047 _result
1048 }
1049
1050 fn send_raw(&self, mut payload: &PuppetSetImagePropertiesResponse) -> Result<(), fidl::Error> {
1051 self.control_handle.inner.send::<PuppetSetImagePropertiesResponse>(
1052 payload,
1053 self.tx_id,
1054 0x2683795408d033ff,
1055 fidl::encoding::DynamicFlags::empty(),
1056 )
1057 }
1058}
1059
1060#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1061pub struct PuppetFactoryMarker;
1062
1063impl fidl::endpoints::ProtocolMarker for PuppetFactoryMarker {
1064 type Proxy = PuppetFactoryProxy;
1065 type RequestStream = PuppetFactoryRequestStream;
1066 #[cfg(target_os = "fuchsia")]
1067 type SynchronousProxy = PuppetFactorySynchronousProxy;
1068
1069 const DEBUG_NAME: &'static str = "fuchsia.ui.test.conformance.PuppetFactory";
1070}
1071impl fidl::endpoints::DiscoverableProtocolMarker for PuppetFactoryMarker {}
1072
1073pub trait PuppetFactoryProxyInterface: Send + Sync {
1074 type CreateResponseFut: std::future::Future<Output = Result<PuppetFactoryCreateResponse, fidl::Error>>
1075 + Send;
1076 fn r#create(&self, payload: PuppetCreationArgs) -> Self::CreateResponseFut;
1077}
1078#[derive(Debug)]
1079#[cfg(target_os = "fuchsia")]
1080pub struct PuppetFactorySynchronousProxy {
1081 client: fidl::client::sync::Client,
1082}
1083
1084#[cfg(target_os = "fuchsia")]
1085impl fidl::endpoints::SynchronousProxy for PuppetFactorySynchronousProxy {
1086 type Proxy = PuppetFactoryProxy;
1087 type Protocol = PuppetFactoryMarker;
1088
1089 fn from_channel(inner: fidl::Channel) -> Self {
1090 Self::new(inner)
1091 }
1092
1093 fn into_channel(self) -> fidl::Channel {
1094 self.client.into_channel()
1095 }
1096
1097 fn as_channel(&self) -> &fidl::Channel {
1098 self.client.as_channel()
1099 }
1100}
1101
1102#[cfg(target_os = "fuchsia")]
1103impl PuppetFactorySynchronousProxy {
1104 pub fn new(channel: fidl::Channel) -> Self {
1105 let protocol_name = <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1106 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1107 }
1108
1109 pub fn into_channel(self) -> fidl::Channel {
1110 self.client.into_channel()
1111 }
1112
1113 pub fn wait_for_event(
1116 &self,
1117 deadline: zx::MonotonicInstant,
1118 ) -> Result<PuppetFactoryEvent, fidl::Error> {
1119 PuppetFactoryEvent::decode(self.client.wait_for_event(deadline)?)
1120 }
1121
1122 pub fn r#create(
1125 &self,
1126 mut payload: PuppetCreationArgs,
1127 ___deadline: zx::MonotonicInstant,
1128 ) -> Result<PuppetFactoryCreateResponse, fidl::Error> {
1129 let _response = self.client.send_query::<PuppetCreationArgs, PuppetFactoryCreateResponse>(
1130 &mut payload,
1131 0x4f90811dc284b595,
1132 fidl::encoding::DynamicFlags::empty(),
1133 ___deadline,
1134 )?;
1135 Ok(_response)
1136 }
1137}
1138
1139#[cfg(target_os = "fuchsia")]
1140impl From<PuppetFactorySynchronousProxy> for zx::NullableHandle {
1141 fn from(value: PuppetFactorySynchronousProxy) -> Self {
1142 value.into_channel().into()
1143 }
1144}
1145
1146#[cfg(target_os = "fuchsia")]
1147impl From<fidl::Channel> for PuppetFactorySynchronousProxy {
1148 fn from(value: fidl::Channel) -> Self {
1149 Self::new(value)
1150 }
1151}
1152
1153#[cfg(target_os = "fuchsia")]
1154impl fidl::endpoints::FromClient for PuppetFactorySynchronousProxy {
1155 type Protocol = PuppetFactoryMarker;
1156
1157 fn from_client(value: fidl::endpoints::ClientEnd<PuppetFactoryMarker>) -> Self {
1158 Self::new(value.into_channel())
1159 }
1160}
1161
1162#[derive(Debug, Clone)]
1163pub struct PuppetFactoryProxy {
1164 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1165}
1166
1167impl fidl::endpoints::Proxy for PuppetFactoryProxy {
1168 type Protocol = PuppetFactoryMarker;
1169
1170 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1171 Self::new(inner)
1172 }
1173
1174 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1175 self.client.into_channel().map_err(|client| Self { client })
1176 }
1177
1178 fn as_channel(&self) -> &::fidl::AsyncChannel {
1179 self.client.as_channel()
1180 }
1181}
1182
1183impl PuppetFactoryProxy {
1184 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1186 let protocol_name = <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1187 Self { client: fidl::client::Client::new(channel, protocol_name) }
1188 }
1189
1190 pub fn take_event_stream(&self) -> PuppetFactoryEventStream {
1196 PuppetFactoryEventStream { event_receiver: self.client.take_event_receiver() }
1197 }
1198
1199 pub fn r#create(
1202 &self,
1203 mut payload: PuppetCreationArgs,
1204 ) -> fidl::client::QueryResponseFut<
1205 PuppetFactoryCreateResponse,
1206 fidl::encoding::DefaultFuchsiaResourceDialect,
1207 > {
1208 PuppetFactoryProxyInterface::r#create(self, payload)
1209 }
1210}
1211
1212impl PuppetFactoryProxyInterface for PuppetFactoryProxy {
1213 type CreateResponseFut = fidl::client::QueryResponseFut<
1214 PuppetFactoryCreateResponse,
1215 fidl::encoding::DefaultFuchsiaResourceDialect,
1216 >;
1217 fn r#create(&self, mut payload: PuppetCreationArgs) -> Self::CreateResponseFut {
1218 fn _decode(
1219 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1220 ) -> Result<PuppetFactoryCreateResponse, fidl::Error> {
1221 let _response = fidl::client::decode_transaction_body::<
1222 PuppetFactoryCreateResponse,
1223 fidl::encoding::DefaultFuchsiaResourceDialect,
1224 0x4f90811dc284b595,
1225 >(_buf?)?;
1226 Ok(_response)
1227 }
1228 self.client.send_query_and_decode::<PuppetCreationArgs, PuppetFactoryCreateResponse>(
1229 &mut payload,
1230 0x4f90811dc284b595,
1231 fidl::encoding::DynamicFlags::empty(),
1232 _decode,
1233 )
1234 }
1235}
1236
1237pub struct PuppetFactoryEventStream {
1238 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1239}
1240
1241impl std::marker::Unpin for PuppetFactoryEventStream {}
1242
1243impl futures::stream::FusedStream for PuppetFactoryEventStream {
1244 fn is_terminated(&self) -> bool {
1245 self.event_receiver.is_terminated()
1246 }
1247}
1248
1249impl futures::Stream for PuppetFactoryEventStream {
1250 type Item = Result<PuppetFactoryEvent, fidl::Error>;
1251
1252 fn poll_next(
1253 mut self: std::pin::Pin<&mut Self>,
1254 cx: &mut std::task::Context<'_>,
1255 ) -> std::task::Poll<Option<Self::Item>> {
1256 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1257 &mut self.event_receiver,
1258 cx
1259 )?) {
1260 Some(buf) => std::task::Poll::Ready(Some(PuppetFactoryEvent::decode(buf))),
1261 None => std::task::Poll::Ready(None),
1262 }
1263 }
1264}
1265
1266#[derive(Debug)]
1267pub enum PuppetFactoryEvent {}
1268
1269impl PuppetFactoryEvent {
1270 fn decode(
1272 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1273 ) -> Result<PuppetFactoryEvent, fidl::Error> {
1274 let (bytes, _handles) = buf.split_mut();
1275 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1276 debug_assert_eq!(tx_header.tx_id, 0);
1277 match tx_header.ordinal {
1278 _ => Err(fidl::Error::UnknownOrdinal {
1279 ordinal: tx_header.ordinal,
1280 protocol_name: <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1281 }),
1282 }
1283 }
1284}
1285
1286pub struct PuppetFactoryRequestStream {
1288 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1289 is_terminated: bool,
1290}
1291
1292impl std::marker::Unpin for PuppetFactoryRequestStream {}
1293
1294impl futures::stream::FusedStream for PuppetFactoryRequestStream {
1295 fn is_terminated(&self) -> bool {
1296 self.is_terminated
1297 }
1298}
1299
1300impl fidl::endpoints::RequestStream for PuppetFactoryRequestStream {
1301 type Protocol = PuppetFactoryMarker;
1302 type ControlHandle = PuppetFactoryControlHandle;
1303
1304 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1305 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1306 }
1307
1308 fn control_handle(&self) -> Self::ControlHandle {
1309 PuppetFactoryControlHandle { inner: self.inner.clone() }
1310 }
1311
1312 fn into_inner(
1313 self,
1314 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1315 {
1316 (self.inner, self.is_terminated)
1317 }
1318
1319 fn from_inner(
1320 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1321 is_terminated: bool,
1322 ) -> Self {
1323 Self { inner, is_terminated }
1324 }
1325}
1326
1327impl futures::Stream for PuppetFactoryRequestStream {
1328 type Item = Result<PuppetFactoryRequest, fidl::Error>;
1329
1330 fn poll_next(
1331 mut self: std::pin::Pin<&mut Self>,
1332 cx: &mut std::task::Context<'_>,
1333 ) -> std::task::Poll<Option<Self::Item>> {
1334 let this = &mut *self;
1335 if this.inner.check_shutdown(cx) {
1336 this.is_terminated = true;
1337 return std::task::Poll::Ready(None);
1338 }
1339 if this.is_terminated {
1340 panic!("polled PuppetFactoryRequestStream after completion");
1341 }
1342 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1343 |bytes, handles| {
1344 match this.inner.channel().read_etc(cx, bytes, handles) {
1345 std::task::Poll::Ready(Ok(())) => {}
1346 std::task::Poll::Pending => return std::task::Poll::Pending,
1347 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1348 this.is_terminated = true;
1349 return std::task::Poll::Ready(None);
1350 }
1351 std::task::Poll::Ready(Err(e)) => {
1352 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1353 e.into(),
1354 ))));
1355 }
1356 }
1357
1358 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1360
1361 std::task::Poll::Ready(Some(match header.ordinal {
1362 0x4f90811dc284b595 => {
1363 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1364 let mut req = fidl::new_empty!(
1365 PuppetCreationArgs,
1366 fidl::encoding::DefaultFuchsiaResourceDialect
1367 );
1368 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetCreationArgs>(&header, _body_bytes, handles, &mut req)?;
1369 let control_handle =
1370 PuppetFactoryControlHandle { inner: this.inner.clone() };
1371 Ok(PuppetFactoryRequest::Create {
1372 payload: req,
1373 responder: PuppetFactoryCreateResponder {
1374 control_handle: std::mem::ManuallyDrop::new(control_handle),
1375 tx_id: header.tx_id,
1376 },
1377 })
1378 }
1379 _ => Err(fidl::Error::UnknownOrdinal {
1380 ordinal: header.ordinal,
1381 protocol_name:
1382 <PuppetFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1383 }),
1384 }))
1385 },
1386 )
1387 }
1388}
1389
1390#[derive(Debug)]
1393pub enum PuppetFactoryRequest {
1394 Create { payload: PuppetCreationArgs, responder: PuppetFactoryCreateResponder },
1397}
1398
1399impl PuppetFactoryRequest {
1400 #[allow(irrefutable_let_patterns)]
1401 pub fn into_create(self) -> Option<(PuppetCreationArgs, PuppetFactoryCreateResponder)> {
1402 if let PuppetFactoryRequest::Create { payload, responder } = self {
1403 Some((payload, responder))
1404 } else {
1405 None
1406 }
1407 }
1408
1409 pub fn method_name(&self) -> &'static str {
1411 match *self {
1412 PuppetFactoryRequest::Create { .. } => "create",
1413 }
1414 }
1415}
1416
1417#[derive(Debug, Clone)]
1418pub struct PuppetFactoryControlHandle {
1419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1420}
1421
1422impl fidl::endpoints::ControlHandle for PuppetFactoryControlHandle {
1423 fn shutdown(&self) {
1424 self.inner.shutdown()
1425 }
1426
1427 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1428 self.inner.shutdown_with_epitaph(status)
1429 }
1430
1431 fn is_closed(&self) -> bool {
1432 self.inner.channel().is_closed()
1433 }
1434 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1435 self.inner.channel().on_closed()
1436 }
1437
1438 #[cfg(target_os = "fuchsia")]
1439 fn signal_peer(
1440 &self,
1441 clear_mask: zx::Signals,
1442 set_mask: zx::Signals,
1443 ) -> Result<(), zx_status::Status> {
1444 use fidl::Peered;
1445 self.inner.channel().signal_peer(clear_mask, set_mask)
1446 }
1447}
1448
1449impl PuppetFactoryControlHandle {}
1450
1451#[must_use = "FIDL methods require a response to be sent"]
1452#[derive(Debug)]
1453pub struct PuppetFactoryCreateResponder {
1454 control_handle: std::mem::ManuallyDrop<PuppetFactoryControlHandle>,
1455 tx_id: u32,
1456}
1457
1458impl std::ops::Drop for PuppetFactoryCreateResponder {
1462 fn drop(&mut self) {
1463 self.control_handle.shutdown();
1464 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1466 }
1467}
1468
1469impl fidl::endpoints::Responder for PuppetFactoryCreateResponder {
1470 type ControlHandle = PuppetFactoryControlHandle;
1471
1472 fn control_handle(&self) -> &PuppetFactoryControlHandle {
1473 &self.control_handle
1474 }
1475
1476 fn drop_without_shutdown(mut self) {
1477 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1479 std::mem::forget(self);
1481 }
1482}
1483
1484impl PuppetFactoryCreateResponder {
1485 pub fn send(self, mut payload: PuppetFactoryCreateResponse) -> Result<(), fidl::Error> {
1489 let _result = self.send_raw(payload);
1490 if _result.is_err() {
1491 self.control_handle.shutdown();
1492 }
1493 self.drop_without_shutdown();
1494 _result
1495 }
1496
1497 pub fn send_no_shutdown_on_err(
1499 self,
1500 mut payload: PuppetFactoryCreateResponse,
1501 ) -> Result<(), fidl::Error> {
1502 let _result = self.send_raw(payload);
1503 self.drop_without_shutdown();
1504 _result
1505 }
1506
1507 fn send_raw(&self, mut payload: PuppetFactoryCreateResponse) -> Result<(), fidl::Error> {
1508 self.control_handle.inner.send::<PuppetFactoryCreateResponse>(
1509 &mut payload,
1510 self.tx_id,
1511 0x4f90811dc284b595,
1512 fidl::encoding::DynamicFlags::empty(),
1513 )
1514 }
1515}
1516
1517mod internal {
1518 use super::*;
1519
1520 impl PuppetCreationArgs {
1521 #[inline(always)]
1522 fn max_ordinal_present(&self) -> u64 {
1523 if let Some(_) = self.focuser {
1524 return 9;
1525 }
1526 if let Some(_) = self.device_pixel_ratio {
1527 return 8;
1528 }
1529 if let Some(_) = self.keyboard_client {
1530 return 7;
1531 }
1532 if let Some(_) = self.flatland_client {
1533 return 6;
1534 }
1535 if let Some(_) = self.keyboard_listener {
1536 return 5;
1537 }
1538 if let Some(_) = self.mouse_listener {
1539 return 4;
1540 }
1541 if let Some(_) = self.touch_listener {
1542 return 3;
1543 }
1544 if let Some(_) = self.view_token {
1545 return 2;
1546 }
1547 if let Some(_) = self.server_end {
1548 return 1;
1549 }
1550 0
1551 }
1552 }
1553
1554 impl fidl::encoding::ResourceTypeMarker for PuppetCreationArgs {
1555 type Borrowed<'a> = &'a mut Self;
1556 fn take_or_borrow<'a>(
1557 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1558 ) -> Self::Borrowed<'a> {
1559 value
1560 }
1561 }
1562
1563 unsafe impl fidl::encoding::TypeMarker for PuppetCreationArgs {
1564 type Owned = Self;
1565
1566 #[inline(always)]
1567 fn inline_align(_context: fidl::encoding::Context) -> usize {
1568 8
1569 }
1570
1571 #[inline(always)]
1572 fn inline_size(_context: fidl::encoding::Context) -> usize {
1573 16
1574 }
1575 }
1576
1577 unsafe impl
1578 fidl::encoding::Encode<PuppetCreationArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
1579 for &mut PuppetCreationArgs
1580 {
1581 unsafe fn encode(
1582 self,
1583 encoder: &mut fidl::encoding::Encoder<
1584 '_,
1585 fidl::encoding::DefaultFuchsiaResourceDialect,
1586 >,
1587 offset: usize,
1588 mut depth: fidl::encoding::Depth,
1589 ) -> fidl::Result<()> {
1590 encoder.debug_check_bounds::<PuppetCreationArgs>(offset);
1591 let max_ordinal: u64 = self.max_ordinal_present();
1593 encoder.write_num(max_ordinal, offset);
1594 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1595 if max_ordinal == 0 {
1597 return Ok(());
1598 }
1599 depth.increment()?;
1600 let envelope_size = 8;
1601 let bytes_len = max_ordinal as usize * envelope_size;
1602 #[allow(unused_variables)]
1603 let offset = encoder.out_of_line_offset(bytes_len);
1604 let mut _prev_end_offset: usize = 0;
1605 if 1 > max_ordinal {
1606 return Ok(());
1607 }
1608
1609 let cur_offset: usize = (1 - 1) * envelope_size;
1612
1613 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1615
1616 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1621 self.server_end.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1622 encoder, offset + cur_offset, depth
1623 )?;
1624
1625 _prev_end_offset = cur_offset + envelope_size;
1626 if 2 > max_ordinal {
1627 return Ok(());
1628 }
1629
1630 let cur_offset: usize = (2 - 1) * envelope_size;
1633
1634 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1636
1637 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
1642 self.view_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1643 encoder, offset + cur_offset, depth
1644 )?;
1645
1646 _prev_end_offset = cur_offset + envelope_size;
1647 if 3 > max_ordinal {
1648 return Ok(());
1649 }
1650
1651 let cur_offset: usize = (3 - 1) * envelope_size;
1654
1655 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1657
1658 fidl::encoding::encode_in_envelope_optional::<
1663 fidl::encoding::Endpoint<
1664 fidl::endpoints::ClientEnd<
1665 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
1666 >,
1667 >,
1668 fidl::encoding::DefaultFuchsiaResourceDialect,
1669 >(
1670 self.touch_listener.as_mut().map(
1671 <fidl::encoding::Endpoint<
1672 fidl::endpoints::ClientEnd<
1673 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
1674 >,
1675 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1676 ),
1677 encoder,
1678 offset + cur_offset,
1679 depth,
1680 )?;
1681
1682 _prev_end_offset = cur_offset + envelope_size;
1683 if 4 > max_ordinal {
1684 return Ok(());
1685 }
1686
1687 let cur_offset: usize = (4 - 1) * envelope_size;
1690
1691 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1693
1694 fidl::encoding::encode_in_envelope_optional::<
1699 fidl::encoding::Endpoint<
1700 fidl::endpoints::ClientEnd<
1701 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
1702 >,
1703 >,
1704 fidl::encoding::DefaultFuchsiaResourceDialect,
1705 >(
1706 self.mouse_listener.as_mut().map(
1707 <fidl::encoding::Endpoint<
1708 fidl::endpoints::ClientEnd<
1709 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
1710 >,
1711 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1712 ),
1713 encoder,
1714 offset + cur_offset,
1715 depth,
1716 )?;
1717
1718 _prev_end_offset = cur_offset + envelope_size;
1719 if 5 > max_ordinal {
1720 return Ok(());
1721 }
1722
1723 let cur_offset: usize = (5 - 1) * envelope_size;
1726
1727 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1729
1730 fidl::encoding::encode_in_envelope_optional::<
1735 fidl::encoding::Endpoint<
1736 fidl::endpoints::ClientEnd<
1737 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
1738 >,
1739 >,
1740 fidl::encoding::DefaultFuchsiaResourceDialect,
1741 >(
1742 self.keyboard_listener.as_mut().map(
1743 <fidl::encoding::Endpoint<
1744 fidl::endpoints::ClientEnd<
1745 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
1746 >,
1747 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1748 ),
1749 encoder,
1750 offset + cur_offset,
1751 depth,
1752 )?;
1753
1754 _prev_end_offset = cur_offset + envelope_size;
1755 if 6 > max_ordinal {
1756 return Ok(());
1757 }
1758
1759 let cur_offset: usize = (6 - 1) * envelope_size;
1762
1763 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1765
1766 fidl::encoding::encode_in_envelope_optional::<
1771 fidl::encoding::Endpoint<
1772 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
1773 >,
1774 fidl::encoding::DefaultFuchsiaResourceDialect,
1775 >(
1776 self.flatland_client.as_mut().map(
1777 <fidl::encoding::Endpoint<
1778 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
1779 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1780 ),
1781 encoder,
1782 offset + cur_offset,
1783 depth,
1784 )?;
1785
1786 _prev_end_offset = cur_offset + envelope_size;
1787 if 7 > max_ordinal {
1788 return Ok(());
1789 }
1790
1791 let cur_offset: usize = (7 - 1) * envelope_size;
1794
1795 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1797
1798 fidl::encoding::encode_in_envelope_optional::<
1803 fidl::encoding::Endpoint<
1804 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
1805 >,
1806 fidl::encoding::DefaultFuchsiaResourceDialect,
1807 >(
1808 self.keyboard_client.as_mut().map(
1809 <fidl::encoding::Endpoint<
1810 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
1811 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1812 ),
1813 encoder,
1814 offset + cur_offset,
1815 depth,
1816 )?;
1817
1818 _prev_end_offset = cur_offset + envelope_size;
1819 if 8 > max_ordinal {
1820 return Ok(());
1821 }
1822
1823 let cur_offset: usize = (8 - 1) * envelope_size;
1826
1827 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1829
1830 fidl::encoding::encode_in_envelope_optional::<
1835 f32,
1836 fidl::encoding::DefaultFuchsiaResourceDialect,
1837 >(
1838 self.device_pixel_ratio
1839 .as_ref()
1840 .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
1841 encoder,
1842 offset + cur_offset,
1843 depth,
1844 )?;
1845
1846 _prev_end_offset = cur_offset + envelope_size;
1847 if 9 > max_ordinal {
1848 return Ok(());
1849 }
1850
1851 let cur_offset: usize = (9 - 1) * envelope_size;
1854
1855 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1857
1858 fidl::encoding::encode_in_envelope_optional::<
1863 fidl::encoding::Endpoint<
1864 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
1865 >,
1866 fidl::encoding::DefaultFuchsiaResourceDialect,
1867 >(
1868 self.focuser.as_mut().map(
1869 <fidl::encoding::Endpoint<
1870 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
1871 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1872 ),
1873 encoder,
1874 offset + cur_offset,
1875 depth,
1876 )?;
1877
1878 _prev_end_offset = cur_offset + envelope_size;
1879
1880 Ok(())
1881 }
1882 }
1883
1884 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1885 for PuppetCreationArgs
1886 {
1887 #[inline(always)]
1888 fn new_empty() -> Self {
1889 Self::default()
1890 }
1891
1892 unsafe fn decode(
1893 &mut self,
1894 decoder: &mut fidl::encoding::Decoder<
1895 '_,
1896 fidl::encoding::DefaultFuchsiaResourceDialect,
1897 >,
1898 offset: usize,
1899 mut depth: fidl::encoding::Depth,
1900 ) -> fidl::Result<()> {
1901 decoder.debug_check_bounds::<Self>(offset);
1902 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1903 None => return Err(fidl::Error::NotNullable),
1904 Some(len) => len,
1905 };
1906 if len == 0 {
1908 return Ok(());
1909 };
1910 depth.increment()?;
1911 let envelope_size = 8;
1912 let bytes_len = len * envelope_size;
1913 let offset = decoder.out_of_line_offset(bytes_len)?;
1914 let mut _next_ordinal_to_read = 0;
1916 let mut next_offset = offset;
1917 let end_offset = offset + bytes_len;
1918 _next_ordinal_to_read += 1;
1919 if next_offset >= end_offset {
1920 return Ok(());
1921 }
1922
1923 while _next_ordinal_to_read < 1 {
1925 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1926 _next_ordinal_to_read += 1;
1927 next_offset += envelope_size;
1928 }
1929
1930 let next_out_of_line = decoder.next_out_of_line();
1931 let handles_before = decoder.remaining_handles();
1932 if let Some((inlined, num_bytes, num_handles)) =
1933 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1934 {
1935 let member_inline_size = <fidl::encoding::Endpoint<
1936 fidl::endpoints::ServerEnd<PuppetMarker>,
1937 > as fidl::encoding::TypeMarker>::inline_size(
1938 decoder.context
1939 );
1940 if inlined != (member_inline_size <= 4) {
1941 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1942 }
1943 let inner_offset;
1944 let mut inner_depth = depth.clone();
1945 if inlined {
1946 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1947 inner_offset = next_offset;
1948 } else {
1949 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1950 inner_depth.increment()?;
1951 }
1952 let val_ref = self.server_end.get_or_insert_with(|| {
1953 fidl::new_empty!(
1954 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>>,
1955 fidl::encoding::DefaultFuchsiaResourceDialect
1956 )
1957 });
1958 fidl::decode!(
1959 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PuppetMarker>>,
1960 fidl::encoding::DefaultFuchsiaResourceDialect,
1961 val_ref,
1962 decoder,
1963 inner_offset,
1964 inner_depth
1965 )?;
1966 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1967 {
1968 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1969 }
1970 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1971 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1972 }
1973 }
1974
1975 next_offset += envelope_size;
1976 _next_ordinal_to_read += 1;
1977 if next_offset >= end_offset {
1978 return Ok(());
1979 }
1980
1981 while _next_ordinal_to_read < 2 {
1983 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1984 _next_ordinal_to_read += 1;
1985 next_offset += envelope_size;
1986 }
1987
1988 let next_out_of_line = decoder.next_out_of_line();
1989 let handles_before = decoder.remaining_handles();
1990 if let Some((inlined, num_bytes, num_handles)) =
1991 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1992 {
1993 let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1994 if inlined != (member_inline_size <= 4) {
1995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1996 }
1997 let inner_offset;
1998 let mut inner_depth = depth.clone();
1999 if inlined {
2000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2001 inner_offset = next_offset;
2002 } else {
2003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2004 inner_depth.increment()?;
2005 }
2006 let val_ref = self.view_token.get_or_insert_with(|| {
2007 fidl::new_empty!(
2008 fidl_fuchsia_ui_views::ViewCreationToken,
2009 fidl::encoding::DefaultFuchsiaResourceDialect
2010 )
2011 });
2012 fidl::decode!(
2013 fidl_fuchsia_ui_views::ViewCreationToken,
2014 fidl::encoding::DefaultFuchsiaResourceDialect,
2015 val_ref,
2016 decoder,
2017 inner_offset,
2018 inner_depth
2019 )?;
2020 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2021 {
2022 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2023 }
2024 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2025 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2026 }
2027 }
2028
2029 next_offset += envelope_size;
2030 _next_ordinal_to_read += 1;
2031 if next_offset >= end_offset {
2032 return Ok(());
2033 }
2034
2035 while _next_ordinal_to_read < 3 {
2037 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2038 _next_ordinal_to_read += 1;
2039 next_offset += envelope_size;
2040 }
2041
2042 let next_out_of_line = decoder.next_out_of_line();
2043 let handles_before = decoder.remaining_handles();
2044 if let Some((inlined, num_bytes, num_handles)) =
2045 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2046 {
2047 let member_inline_size = <fidl::encoding::Endpoint<
2048 fidl::endpoints::ClientEnd<
2049 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
2050 >,
2051 > as fidl::encoding::TypeMarker>::inline_size(
2052 decoder.context
2053 );
2054 if inlined != (member_inline_size <= 4) {
2055 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2056 }
2057 let inner_offset;
2058 let mut inner_depth = depth.clone();
2059 if inlined {
2060 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2061 inner_offset = next_offset;
2062 } else {
2063 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2064 inner_depth.increment()?;
2065 }
2066 let val_ref = self.touch_listener.get_or_insert_with(|| {
2067 fidl::new_empty!(
2068 fidl::encoding::Endpoint<
2069 fidl::endpoints::ClientEnd<
2070 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
2071 >,
2072 >,
2073 fidl::encoding::DefaultFuchsiaResourceDialect
2074 )
2075 });
2076 fidl::decode!(
2077 fidl::encoding::Endpoint<
2078 fidl::endpoints::ClientEnd<
2079 fidl_fuchsia_ui_test_input::TouchInputListenerMarker,
2080 >,
2081 >,
2082 fidl::encoding::DefaultFuchsiaResourceDialect,
2083 val_ref,
2084 decoder,
2085 inner_offset,
2086 inner_depth
2087 )?;
2088 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2089 {
2090 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2091 }
2092 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2093 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2094 }
2095 }
2096
2097 next_offset += envelope_size;
2098 _next_ordinal_to_read += 1;
2099 if next_offset >= end_offset {
2100 return Ok(());
2101 }
2102
2103 while _next_ordinal_to_read < 4 {
2105 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2106 _next_ordinal_to_read += 1;
2107 next_offset += envelope_size;
2108 }
2109
2110 let next_out_of_line = decoder.next_out_of_line();
2111 let handles_before = decoder.remaining_handles();
2112 if let Some((inlined, num_bytes, num_handles)) =
2113 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2114 {
2115 let member_inline_size = <fidl::encoding::Endpoint<
2116 fidl::endpoints::ClientEnd<
2117 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
2118 >,
2119 > as fidl::encoding::TypeMarker>::inline_size(
2120 decoder.context
2121 );
2122 if inlined != (member_inline_size <= 4) {
2123 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2124 }
2125 let inner_offset;
2126 let mut inner_depth = depth.clone();
2127 if inlined {
2128 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2129 inner_offset = next_offset;
2130 } else {
2131 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2132 inner_depth.increment()?;
2133 }
2134 let val_ref = self.mouse_listener.get_or_insert_with(|| {
2135 fidl::new_empty!(
2136 fidl::encoding::Endpoint<
2137 fidl::endpoints::ClientEnd<
2138 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
2139 >,
2140 >,
2141 fidl::encoding::DefaultFuchsiaResourceDialect
2142 )
2143 });
2144 fidl::decode!(
2145 fidl::encoding::Endpoint<
2146 fidl::endpoints::ClientEnd<
2147 fidl_fuchsia_ui_test_input::MouseInputListenerMarker,
2148 >,
2149 >,
2150 fidl::encoding::DefaultFuchsiaResourceDialect,
2151 val_ref,
2152 decoder,
2153 inner_offset,
2154 inner_depth
2155 )?;
2156 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2157 {
2158 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2159 }
2160 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2161 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2162 }
2163 }
2164
2165 next_offset += envelope_size;
2166 _next_ordinal_to_read += 1;
2167 if next_offset >= end_offset {
2168 return Ok(());
2169 }
2170
2171 while _next_ordinal_to_read < 5 {
2173 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2174 _next_ordinal_to_read += 1;
2175 next_offset += envelope_size;
2176 }
2177
2178 let next_out_of_line = decoder.next_out_of_line();
2179 let handles_before = decoder.remaining_handles();
2180 if let Some((inlined, num_bytes, num_handles)) =
2181 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2182 {
2183 let member_inline_size = <fidl::encoding::Endpoint<
2184 fidl::endpoints::ClientEnd<
2185 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
2186 >,
2187 > as fidl::encoding::TypeMarker>::inline_size(
2188 decoder.context
2189 );
2190 if inlined != (member_inline_size <= 4) {
2191 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2192 }
2193 let inner_offset;
2194 let mut inner_depth = depth.clone();
2195 if inlined {
2196 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2197 inner_offset = next_offset;
2198 } else {
2199 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2200 inner_depth.increment()?;
2201 }
2202 let val_ref = self.keyboard_listener.get_or_insert_with(|| {
2203 fidl::new_empty!(
2204 fidl::encoding::Endpoint<
2205 fidl::endpoints::ClientEnd<
2206 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
2207 >,
2208 >,
2209 fidl::encoding::DefaultFuchsiaResourceDialect
2210 )
2211 });
2212 fidl::decode!(
2213 fidl::encoding::Endpoint<
2214 fidl::endpoints::ClientEnd<
2215 fidl_fuchsia_ui_test_input::KeyboardInputListenerMarker,
2216 >,
2217 >,
2218 fidl::encoding::DefaultFuchsiaResourceDialect,
2219 val_ref,
2220 decoder,
2221 inner_offset,
2222 inner_depth
2223 )?;
2224 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2225 {
2226 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2227 }
2228 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2229 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2230 }
2231 }
2232
2233 next_offset += envelope_size;
2234 _next_ordinal_to_read += 1;
2235 if next_offset >= end_offset {
2236 return Ok(());
2237 }
2238
2239 while _next_ordinal_to_read < 6 {
2241 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2242 _next_ordinal_to_read += 1;
2243 next_offset += envelope_size;
2244 }
2245
2246 let next_out_of_line = decoder.next_out_of_line();
2247 let handles_before = decoder.remaining_handles();
2248 if let Some((inlined, num_bytes, num_handles)) =
2249 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2250 {
2251 let member_inline_size = <fidl::encoding::Endpoint<
2252 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
2253 > as fidl::encoding::TypeMarker>::inline_size(
2254 decoder.context
2255 );
2256 if inlined != (member_inline_size <= 4) {
2257 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2258 }
2259 let inner_offset;
2260 let mut inner_depth = depth.clone();
2261 if inlined {
2262 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2263 inner_offset = next_offset;
2264 } else {
2265 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2266 inner_depth.increment()?;
2267 }
2268 let val_ref = self.flatland_client.get_or_insert_with(|| {
2269 fidl::new_empty!(
2270 fidl::encoding::Endpoint<
2271 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
2272 >,
2273 fidl::encoding::DefaultFuchsiaResourceDialect
2274 )
2275 });
2276 fidl::decode!(
2277 fidl::encoding::Endpoint<
2278 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::FlatlandMarker>,
2279 >,
2280 fidl::encoding::DefaultFuchsiaResourceDialect,
2281 val_ref,
2282 decoder,
2283 inner_offset,
2284 inner_depth
2285 )?;
2286 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2287 {
2288 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2289 }
2290 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2291 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2292 }
2293 }
2294
2295 next_offset += envelope_size;
2296 _next_ordinal_to_read += 1;
2297 if next_offset >= end_offset {
2298 return Ok(());
2299 }
2300
2301 while _next_ordinal_to_read < 7 {
2303 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2304 _next_ordinal_to_read += 1;
2305 next_offset += envelope_size;
2306 }
2307
2308 let next_out_of_line = decoder.next_out_of_line();
2309 let handles_before = decoder.remaining_handles();
2310 if let Some((inlined, num_bytes, num_handles)) =
2311 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2312 {
2313 let member_inline_size = <fidl::encoding::Endpoint<
2314 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
2315 > as fidl::encoding::TypeMarker>::inline_size(
2316 decoder.context
2317 );
2318 if inlined != (member_inline_size <= 4) {
2319 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2320 }
2321 let inner_offset;
2322 let mut inner_depth = depth.clone();
2323 if inlined {
2324 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2325 inner_offset = next_offset;
2326 } else {
2327 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2328 inner_depth.increment()?;
2329 }
2330 let val_ref = self.keyboard_client.get_or_insert_with(|| {
2331 fidl::new_empty!(
2332 fidl::encoding::Endpoint<
2333 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
2334 >,
2335 fidl::encoding::DefaultFuchsiaResourceDialect
2336 )
2337 });
2338 fidl::decode!(
2339 fidl::encoding::Endpoint<
2340 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardMarker>,
2341 >,
2342 fidl::encoding::DefaultFuchsiaResourceDialect,
2343 val_ref,
2344 decoder,
2345 inner_offset,
2346 inner_depth
2347 )?;
2348 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2349 {
2350 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2351 }
2352 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2353 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2354 }
2355 }
2356
2357 next_offset += envelope_size;
2358 _next_ordinal_to_read += 1;
2359 if next_offset >= end_offset {
2360 return Ok(());
2361 }
2362
2363 while _next_ordinal_to_read < 8 {
2365 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2366 _next_ordinal_to_read += 1;
2367 next_offset += envelope_size;
2368 }
2369
2370 let next_out_of_line = decoder.next_out_of_line();
2371 let handles_before = decoder.remaining_handles();
2372 if let Some((inlined, num_bytes, num_handles)) =
2373 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2374 {
2375 let member_inline_size =
2376 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2377 if inlined != (member_inline_size <= 4) {
2378 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2379 }
2380 let inner_offset;
2381 let mut inner_depth = depth.clone();
2382 if inlined {
2383 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2384 inner_offset = next_offset;
2385 } else {
2386 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2387 inner_depth.increment()?;
2388 }
2389 let val_ref = self.device_pixel_ratio.get_or_insert_with(|| {
2390 fidl::new_empty!(f32, fidl::encoding::DefaultFuchsiaResourceDialect)
2391 });
2392 fidl::decode!(
2393 f32,
2394 fidl::encoding::DefaultFuchsiaResourceDialect,
2395 val_ref,
2396 decoder,
2397 inner_offset,
2398 inner_depth
2399 )?;
2400 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2401 {
2402 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2403 }
2404 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2405 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2406 }
2407 }
2408
2409 next_offset += envelope_size;
2410 _next_ordinal_to_read += 1;
2411 if next_offset >= end_offset {
2412 return Ok(());
2413 }
2414
2415 while _next_ordinal_to_read < 9 {
2417 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2418 _next_ordinal_to_read += 1;
2419 next_offset += envelope_size;
2420 }
2421
2422 let next_out_of_line = decoder.next_out_of_line();
2423 let handles_before = decoder.remaining_handles();
2424 if let Some((inlined, num_bytes, num_handles)) =
2425 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2426 {
2427 let member_inline_size = <fidl::encoding::Endpoint<
2428 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
2429 > as fidl::encoding::TypeMarker>::inline_size(
2430 decoder.context
2431 );
2432 if inlined != (member_inline_size <= 4) {
2433 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2434 }
2435 let inner_offset;
2436 let mut inner_depth = depth.clone();
2437 if inlined {
2438 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2439 inner_offset = next_offset;
2440 } else {
2441 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2442 inner_depth.increment()?;
2443 }
2444 let val_ref = self.focuser.get_or_insert_with(|| {
2445 fidl::new_empty!(
2446 fidl::encoding::Endpoint<
2447 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
2448 >,
2449 fidl::encoding::DefaultFuchsiaResourceDialect
2450 )
2451 });
2452 fidl::decode!(
2453 fidl::encoding::Endpoint<
2454 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
2455 >,
2456 fidl::encoding::DefaultFuchsiaResourceDialect,
2457 val_ref,
2458 decoder,
2459 inner_offset,
2460 inner_depth
2461 )?;
2462 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2463 {
2464 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2465 }
2466 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2467 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2468 }
2469 }
2470
2471 next_offset += envelope_size;
2472
2473 while next_offset < end_offset {
2475 _next_ordinal_to_read += 1;
2476 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2477 next_offset += envelope_size;
2478 }
2479
2480 Ok(())
2481 }
2482 }
2483
2484 impl PuppetEmbedRemoteViewResponse {
2485 #[inline(always)]
2486 fn max_ordinal_present(&self) -> u64 {
2487 if let Some(_) = self.view_creation_token {
2488 return 2;
2489 }
2490 if let Some(_) = self.result {
2491 return 1;
2492 }
2493 0
2494 }
2495 }
2496
2497 impl fidl::encoding::ResourceTypeMarker for PuppetEmbedRemoteViewResponse {
2498 type Borrowed<'a> = &'a mut Self;
2499 fn take_or_borrow<'a>(
2500 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2501 ) -> Self::Borrowed<'a> {
2502 value
2503 }
2504 }
2505
2506 unsafe impl fidl::encoding::TypeMarker for PuppetEmbedRemoteViewResponse {
2507 type Owned = Self;
2508
2509 #[inline(always)]
2510 fn inline_align(_context: fidl::encoding::Context) -> usize {
2511 8
2512 }
2513
2514 #[inline(always)]
2515 fn inline_size(_context: fidl::encoding::Context) -> usize {
2516 16
2517 }
2518 }
2519
2520 unsafe impl
2521 fidl::encoding::Encode<
2522 PuppetEmbedRemoteViewResponse,
2523 fidl::encoding::DefaultFuchsiaResourceDialect,
2524 > for &mut PuppetEmbedRemoteViewResponse
2525 {
2526 unsafe fn encode(
2527 self,
2528 encoder: &mut fidl::encoding::Encoder<
2529 '_,
2530 fidl::encoding::DefaultFuchsiaResourceDialect,
2531 >,
2532 offset: usize,
2533 mut depth: fidl::encoding::Depth,
2534 ) -> fidl::Result<()> {
2535 encoder.debug_check_bounds::<PuppetEmbedRemoteViewResponse>(offset);
2536 let max_ordinal: u64 = self.max_ordinal_present();
2538 encoder.write_num(max_ordinal, offset);
2539 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2540 if max_ordinal == 0 {
2542 return Ok(());
2543 }
2544 depth.increment()?;
2545 let envelope_size = 8;
2546 let bytes_len = max_ordinal as usize * envelope_size;
2547 #[allow(unused_variables)]
2548 let offset = encoder.out_of_line_offset(bytes_len);
2549 let mut _prev_end_offset: usize = 0;
2550 if 1 > max_ordinal {
2551 return Ok(());
2552 }
2553
2554 let cur_offset: usize = (1 - 1) * envelope_size;
2557
2558 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2560
2561 fidl::encoding::encode_in_envelope_optional::<
2566 Result_,
2567 fidl::encoding::DefaultFuchsiaResourceDialect,
2568 >(
2569 self.result.as_ref().map(<Result_ as fidl::encoding::ValueTypeMarker>::borrow),
2570 encoder,
2571 offset + cur_offset,
2572 depth,
2573 )?;
2574
2575 _prev_end_offset = cur_offset + envelope_size;
2576 if 2 > max_ordinal {
2577 return Ok(());
2578 }
2579
2580 let cur_offset: usize = (2 - 1) * envelope_size;
2583
2584 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2586
2587 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
2592 self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2593 encoder, offset + cur_offset, depth
2594 )?;
2595
2596 _prev_end_offset = cur_offset + envelope_size;
2597
2598 Ok(())
2599 }
2600 }
2601
2602 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2603 for PuppetEmbedRemoteViewResponse
2604 {
2605 #[inline(always)]
2606 fn new_empty() -> Self {
2607 Self::default()
2608 }
2609
2610 unsafe fn decode(
2611 &mut self,
2612 decoder: &mut fidl::encoding::Decoder<
2613 '_,
2614 fidl::encoding::DefaultFuchsiaResourceDialect,
2615 >,
2616 offset: usize,
2617 mut depth: fidl::encoding::Depth,
2618 ) -> fidl::Result<()> {
2619 decoder.debug_check_bounds::<Self>(offset);
2620 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2621 None => return Err(fidl::Error::NotNullable),
2622 Some(len) => len,
2623 };
2624 if len == 0 {
2626 return Ok(());
2627 };
2628 depth.increment()?;
2629 let envelope_size = 8;
2630 let bytes_len = len * envelope_size;
2631 let offset = decoder.out_of_line_offset(bytes_len)?;
2632 let mut _next_ordinal_to_read = 0;
2634 let mut next_offset = offset;
2635 let end_offset = offset + bytes_len;
2636 _next_ordinal_to_read += 1;
2637 if next_offset >= end_offset {
2638 return Ok(());
2639 }
2640
2641 while _next_ordinal_to_read < 1 {
2643 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2644 _next_ordinal_to_read += 1;
2645 next_offset += envelope_size;
2646 }
2647
2648 let next_out_of_line = decoder.next_out_of_line();
2649 let handles_before = decoder.remaining_handles();
2650 if let Some((inlined, num_bytes, num_handles)) =
2651 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2652 {
2653 let member_inline_size =
2654 <Result_ as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2655 if inlined != (member_inline_size <= 4) {
2656 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2657 }
2658 let inner_offset;
2659 let mut inner_depth = depth.clone();
2660 if inlined {
2661 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2662 inner_offset = next_offset;
2663 } else {
2664 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2665 inner_depth.increment()?;
2666 }
2667 let val_ref = self.result.get_or_insert_with(|| {
2668 fidl::new_empty!(Result_, fidl::encoding::DefaultFuchsiaResourceDialect)
2669 });
2670 fidl::decode!(
2671 Result_,
2672 fidl::encoding::DefaultFuchsiaResourceDialect,
2673 val_ref,
2674 decoder,
2675 inner_offset,
2676 inner_depth
2677 )?;
2678 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2679 {
2680 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2681 }
2682 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2683 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2684 }
2685 }
2686
2687 next_offset += envelope_size;
2688 _next_ordinal_to_read += 1;
2689 if next_offset >= end_offset {
2690 return Ok(());
2691 }
2692
2693 while _next_ordinal_to_read < 2 {
2695 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2696 _next_ordinal_to_read += 1;
2697 next_offset += envelope_size;
2698 }
2699
2700 let next_out_of_line = decoder.next_out_of_line();
2701 let handles_before = decoder.remaining_handles();
2702 if let Some((inlined, num_bytes, num_handles)) =
2703 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2704 {
2705 let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2706 if inlined != (member_inline_size <= 4) {
2707 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2708 }
2709 let inner_offset;
2710 let mut inner_depth = depth.clone();
2711 if inlined {
2712 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2713 inner_offset = next_offset;
2714 } else {
2715 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2716 inner_depth.increment()?;
2717 }
2718 let val_ref = self.view_creation_token.get_or_insert_with(|| {
2719 fidl::new_empty!(
2720 fidl_fuchsia_ui_views::ViewCreationToken,
2721 fidl::encoding::DefaultFuchsiaResourceDialect
2722 )
2723 });
2724 fidl::decode!(
2725 fidl_fuchsia_ui_views::ViewCreationToken,
2726 fidl::encoding::DefaultFuchsiaResourceDialect,
2727 val_ref,
2728 decoder,
2729 inner_offset,
2730 inner_depth
2731 )?;
2732 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2733 {
2734 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2735 }
2736 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2737 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2738 }
2739 }
2740
2741 next_offset += envelope_size;
2742
2743 while next_offset < end_offset {
2745 _next_ordinal_to_read += 1;
2746 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2747 next_offset += envelope_size;
2748 }
2749
2750 Ok(())
2751 }
2752 }
2753
2754 impl PuppetFactoryCreateResponse {
2755 #[inline(always)]
2756 fn max_ordinal_present(&self) -> u64 {
2757 if let Some(_) = self.view_ref {
2758 return 2;
2759 }
2760 if let Some(_) = self.result {
2761 return 1;
2762 }
2763 0
2764 }
2765 }
2766
2767 impl fidl::encoding::ResourceTypeMarker for PuppetFactoryCreateResponse {
2768 type Borrowed<'a> = &'a mut Self;
2769 fn take_or_borrow<'a>(
2770 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2771 ) -> Self::Borrowed<'a> {
2772 value
2773 }
2774 }
2775
2776 unsafe impl fidl::encoding::TypeMarker for PuppetFactoryCreateResponse {
2777 type Owned = Self;
2778
2779 #[inline(always)]
2780 fn inline_align(_context: fidl::encoding::Context) -> usize {
2781 8
2782 }
2783
2784 #[inline(always)]
2785 fn inline_size(_context: fidl::encoding::Context) -> usize {
2786 16
2787 }
2788 }
2789
2790 unsafe impl
2791 fidl::encoding::Encode<
2792 PuppetFactoryCreateResponse,
2793 fidl::encoding::DefaultFuchsiaResourceDialect,
2794 > for &mut PuppetFactoryCreateResponse
2795 {
2796 unsafe fn encode(
2797 self,
2798 encoder: &mut fidl::encoding::Encoder<
2799 '_,
2800 fidl::encoding::DefaultFuchsiaResourceDialect,
2801 >,
2802 offset: usize,
2803 mut depth: fidl::encoding::Depth,
2804 ) -> fidl::Result<()> {
2805 encoder.debug_check_bounds::<PuppetFactoryCreateResponse>(offset);
2806 let max_ordinal: u64 = self.max_ordinal_present();
2808 encoder.write_num(max_ordinal, offset);
2809 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2810 if max_ordinal == 0 {
2812 return Ok(());
2813 }
2814 depth.increment()?;
2815 let envelope_size = 8;
2816 let bytes_len = max_ordinal as usize * envelope_size;
2817 #[allow(unused_variables)]
2818 let offset = encoder.out_of_line_offset(bytes_len);
2819 let mut _prev_end_offset: usize = 0;
2820 if 1 > max_ordinal {
2821 return Ok(());
2822 }
2823
2824 let cur_offset: usize = (1 - 1) * envelope_size;
2827
2828 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2830
2831 fidl::encoding::encode_in_envelope_optional::<
2836 Result_,
2837 fidl::encoding::DefaultFuchsiaResourceDialect,
2838 >(
2839 self.result.as_ref().map(<Result_ as fidl::encoding::ValueTypeMarker>::borrow),
2840 encoder,
2841 offset + cur_offset,
2842 depth,
2843 )?;
2844
2845 _prev_end_offset = cur_offset + envelope_size;
2846 if 2 > max_ordinal {
2847 return Ok(());
2848 }
2849
2850 let cur_offset: usize = (2 - 1) * envelope_size;
2853
2854 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2856
2857 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
2862 self.view_ref.as_mut().map(<fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2863 encoder, offset + cur_offset, depth
2864 )?;
2865
2866 _prev_end_offset = cur_offset + envelope_size;
2867
2868 Ok(())
2869 }
2870 }
2871
2872 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2873 for PuppetFactoryCreateResponse
2874 {
2875 #[inline(always)]
2876 fn new_empty() -> Self {
2877 Self::default()
2878 }
2879
2880 unsafe fn decode(
2881 &mut self,
2882 decoder: &mut fidl::encoding::Decoder<
2883 '_,
2884 fidl::encoding::DefaultFuchsiaResourceDialect,
2885 >,
2886 offset: usize,
2887 mut depth: fidl::encoding::Depth,
2888 ) -> fidl::Result<()> {
2889 decoder.debug_check_bounds::<Self>(offset);
2890 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2891 None => return Err(fidl::Error::NotNullable),
2892 Some(len) => len,
2893 };
2894 if len == 0 {
2896 return Ok(());
2897 };
2898 depth.increment()?;
2899 let envelope_size = 8;
2900 let bytes_len = len * envelope_size;
2901 let offset = decoder.out_of_line_offset(bytes_len)?;
2902 let mut _next_ordinal_to_read = 0;
2904 let mut next_offset = offset;
2905 let end_offset = offset + bytes_len;
2906 _next_ordinal_to_read += 1;
2907 if next_offset >= end_offset {
2908 return Ok(());
2909 }
2910
2911 while _next_ordinal_to_read < 1 {
2913 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2914 _next_ordinal_to_read += 1;
2915 next_offset += envelope_size;
2916 }
2917
2918 let next_out_of_line = decoder.next_out_of_line();
2919 let handles_before = decoder.remaining_handles();
2920 if let Some((inlined, num_bytes, num_handles)) =
2921 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2922 {
2923 let member_inline_size =
2924 <Result_ as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2925 if inlined != (member_inline_size <= 4) {
2926 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2927 }
2928 let inner_offset;
2929 let mut inner_depth = depth.clone();
2930 if inlined {
2931 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2932 inner_offset = next_offset;
2933 } else {
2934 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2935 inner_depth.increment()?;
2936 }
2937 let val_ref = self.result.get_or_insert_with(|| {
2938 fidl::new_empty!(Result_, fidl::encoding::DefaultFuchsiaResourceDialect)
2939 });
2940 fidl::decode!(
2941 Result_,
2942 fidl::encoding::DefaultFuchsiaResourceDialect,
2943 val_ref,
2944 decoder,
2945 inner_offset,
2946 inner_depth
2947 )?;
2948 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2949 {
2950 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2951 }
2952 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2953 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2954 }
2955 }
2956
2957 next_offset += envelope_size;
2958 _next_ordinal_to_read += 1;
2959 if next_offset >= end_offset {
2960 return Ok(());
2961 }
2962
2963 while _next_ordinal_to_read < 2 {
2965 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2966 _next_ordinal_to_read += 1;
2967 next_offset += envelope_size;
2968 }
2969
2970 let next_out_of_line = decoder.next_out_of_line();
2971 let handles_before = decoder.remaining_handles();
2972 if let Some((inlined, num_bytes, num_handles)) =
2973 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2974 {
2975 let member_inline_size =
2976 <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::TypeMarker>::inline_size(
2977 decoder.context,
2978 );
2979 if inlined != (member_inline_size <= 4) {
2980 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2981 }
2982 let inner_offset;
2983 let mut inner_depth = depth.clone();
2984 if inlined {
2985 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2986 inner_offset = next_offset;
2987 } else {
2988 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2989 inner_depth.increment()?;
2990 }
2991 let val_ref = self.view_ref.get_or_insert_with(|| {
2992 fidl::new_empty!(
2993 fidl_fuchsia_ui_views::ViewRef,
2994 fidl::encoding::DefaultFuchsiaResourceDialect
2995 )
2996 });
2997 fidl::decode!(
2998 fidl_fuchsia_ui_views::ViewRef,
2999 fidl::encoding::DefaultFuchsiaResourceDialect,
3000 val_ref,
3001 decoder,
3002 inner_offset,
3003 inner_depth
3004 )?;
3005 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3006 {
3007 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3008 }
3009 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3010 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3011 }
3012 }
3013
3014 next_offset += envelope_size;
3015
3016 while next_offset < end_offset {
3018 _next_ordinal_to_read += 1;
3019 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3020 next_offset += envelope_size;
3021 }
3022
3023 Ok(())
3024 }
3025 }
3026}