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_scenic_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ScenicCreateSession2Request {
16 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
17 pub listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
18 pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22 for ScenicCreateSession2Request
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct ScenicCreateSessionRequest {
28 pub session: fidl::endpoints::ServerEnd<SessionMarker>,
29 pub listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for ScenicCreateSessionRequest
34{
35}
36
37#[derive(Debug, PartialEq)]
38pub struct ScenicCreateSessionTRequest {
39 pub endpoints: SessionEndpoints,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for ScenicCreateSessionTRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct ScenicGetDisplayOwnershipEventResponse {
49 pub ownership_event: fidl::Event,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53 for ScenicGetDisplayOwnershipEventResponse
54{
55}
56
57#[derive(Debug, PartialEq)]
58pub struct ScenicTakeScreenshotResponse {
59 pub img_data: ScreenshotData,
60 pub success: bool,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64 for ScenicTakeScreenshotResponse
65{
66}
67
68#[derive(Debug, PartialEq)]
72pub struct ScreenshotData {
73 pub info: fidl_fuchsia_images::ImageInfo,
74 pub data: fidl_fuchsia_mem::Buffer,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenshotData {}
78
79#[derive(Debug, PartialEq)]
80pub struct SessionEnqueueRequest {
81 pub cmds: Vec<Command>,
82}
83
84impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionEnqueueRequest {}
85
86#[derive(Debug, PartialEq)]
87pub struct SessionListenerOnScenicEventRequest {
88 pub events: Vec<Event>,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
92 for SessionListenerOnScenicEventRequest
93{
94}
95
96#[derive(Debug, PartialEq)]
97pub struct SessionPresent2Request {
98 pub args: Present2Args,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionPresent2Request {}
102
103#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104pub struct SessionPresentRequest {
105 pub presentation_time: u64,
106 pub acquire_fences: Vec<fidl::Event>,
107 pub release_fences: Vec<fidl::Event>,
108}
109
110impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionPresentRequest {}
111
112#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
113pub struct SessionRegisterBufferCollectionRequest {
114 pub buffer_id: u32,
115 pub token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
116}
117
118impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
119 for SessionRegisterBufferCollectionRequest
120{
121}
122
123#[derive(Debug, Default, PartialEq)]
125pub struct Present2Args {
126 pub requested_presentation_time: Option<i64>,
146 pub acquire_fences: Option<Vec<fidl::Event>>,
149 pub release_fences: Option<Vec<fidl::Event>>,
155 pub requested_prediction_span: Option<i64>,
159 #[doc(hidden)]
160 pub __source_breaking: fidl::marker::SourceBreaking,
161}
162
163impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Present2Args {}
164
165#[derive(Debug, Default, PartialEq)]
167pub struct SessionEndpoints {
168 pub session: Option<fidl::endpoints::ServerEnd<SessionMarker>>,
171 pub session_listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
174 pub view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
177 pub view_ref_focused:
180 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>>,
181 pub touch_source:
184 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>>,
185 pub mouse_source:
188 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
189 #[doc(hidden)]
190 pub __source_breaking: fidl::marker::SourceBreaking,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionEndpoints {}
194
195#[derive(Debug, PartialEq)]
196pub enum Command {
197 Gfx(fidl_fuchsia_ui_gfx::Command),
198 Views(fidl_fuchsia_ui_views::Command),
199 Input(fidl_fuchsia_ui_input::Command),
200}
201
202impl Command {
203 #[inline]
204 pub fn ordinal(&self) -> u64 {
205 match *self {
206 Self::Gfx(_) => 1,
207 Self::Views(_) => 3,
208 Self::Input(_) => 4,
209 }
210 }
211
212 #[deprecated = "Strict unions should not use `is_unknown`"]
213 #[inline]
214 pub fn is_unknown(&self) -> bool {
215 false
216 }
217}
218
219impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Command {}
220
221#[derive(Debug, PartialEq)]
222pub enum Event {
223 Gfx(fidl_fuchsia_ui_gfx::Event),
224 Input(fidl_fuchsia_ui_input::InputEvent),
225 Unhandled(Command),
226}
227
228impl Event {
229 #[inline]
230 pub fn ordinal(&self) -> u64 {
231 match *self {
232 Self::Gfx(_) => 1,
233 Self::Input(_) => 2,
234 Self::Unhandled(_) => 3,
235 }
236 }
237
238 #[deprecated = "Strict unions should not use `is_unknown`"]
239 #[inline]
240 pub fn is_unknown(&self) -> bool {
241 false
242 }
243}
244
245impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Event {}
246
247#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
248pub struct ScenicMarker;
249
250impl fidl::endpoints::ProtocolMarker for ScenicMarker {
251 type Proxy = ScenicProxy;
252 type RequestStream = ScenicRequestStream;
253 #[cfg(target_os = "fuchsia")]
254 type SynchronousProxy = ScenicSynchronousProxy;
255
256 const DEBUG_NAME: &'static str = "fuchsia.ui.scenic.Scenic";
257}
258impl fidl::endpoints::DiscoverableProtocolMarker for ScenicMarker {}
259
260pub trait ScenicProxyInterface: Send + Sync {
261 fn r#create_session(
262 &self,
263 session: fidl::endpoints::ServerEnd<SessionMarker>,
264 listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
265 ) -> Result<(), fidl::Error>;
266 fn r#create_session2(
267 &self,
268 session: fidl::endpoints::ServerEnd<SessionMarker>,
269 listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
270 view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
271 ) -> Result<(), fidl::Error>;
272 type CreateSessionTResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
273 fn r#create_session_t(&self, endpoints: SessionEndpoints) -> Self::CreateSessionTResponseFut;
274 type GetDisplayInfoResponseFut: std::future::Future<Output = Result<fidl_fuchsia_ui_gfx::DisplayInfo, fidl::Error>>
275 + Send;
276 fn r#get_display_info(&self) -> Self::GetDisplayInfoResponseFut;
277 type GetDisplayOwnershipEventResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
278 + Send;
279 fn r#get_display_ownership_event(&self) -> Self::GetDisplayOwnershipEventResponseFut;
280 type TakeScreenshotResponseFut: std::future::Future<Output = Result<(ScreenshotData, bool), fidl::Error>>
281 + Send;
282 fn r#take_screenshot(&self) -> Self::TakeScreenshotResponseFut;
283 type UsesFlatlandResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
284 fn r#uses_flatland(&self) -> Self::UsesFlatlandResponseFut;
285}
286#[derive(Debug)]
287#[cfg(target_os = "fuchsia")]
288pub struct ScenicSynchronousProxy {
289 client: fidl::client::sync::Client,
290}
291
292#[cfg(target_os = "fuchsia")]
293impl fidl::endpoints::SynchronousProxy for ScenicSynchronousProxy {
294 type Proxy = ScenicProxy;
295 type Protocol = ScenicMarker;
296
297 fn from_channel(inner: fidl::Channel) -> Self {
298 Self::new(inner)
299 }
300
301 fn into_channel(self) -> fidl::Channel {
302 self.client.into_channel()
303 }
304
305 fn as_channel(&self) -> &fidl::Channel {
306 self.client.as_channel()
307 }
308}
309
310#[cfg(target_os = "fuchsia")]
311impl ScenicSynchronousProxy {
312 pub fn new(channel: fidl::Channel) -> Self {
313 let protocol_name = <ScenicMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
314 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
315 }
316
317 pub fn into_channel(self) -> fidl::Channel {
318 self.client.into_channel()
319 }
320
321 pub fn wait_for_event(
324 &self,
325 deadline: zx::MonotonicInstant,
326 ) -> Result<ScenicEvent, fidl::Error> {
327 ScenicEvent::decode(self.client.wait_for_event(deadline)?)
328 }
329
330 pub fn r#create_session(
332 &self,
333 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
334 mut listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
335 ) -> Result<(), fidl::Error> {
336 self.client.send::<ScenicCreateSessionRequest>(
337 (session, listener),
338 0x2af781f341771a50,
339 fidl::encoding::DynamicFlags::empty(),
340 )
341 }
342
343 pub fn r#create_session2(
350 &self,
351 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
352 mut listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
353 mut view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
354 ) -> Result<(), fidl::Error> {
355 self.client.send::<ScenicCreateSession2Request>(
356 (session, listener, view_focuser),
357 0x11fa60f776121fa5,
358 fidl::encoding::DynamicFlags::empty(),
359 )
360 }
361
362 pub fn r#create_session_t(
373 &self,
374 mut endpoints: SessionEndpoints,
375 ___deadline: zx::MonotonicInstant,
376 ) -> Result<(), fidl::Error> {
377 let _response =
378 self.client.send_query::<ScenicCreateSessionTRequest, fidl::encoding::EmptyPayload>(
379 (&mut endpoints,),
380 0x369061a897552d4f,
381 fidl::encoding::DynamicFlags::empty(),
382 ___deadline,
383 )?;
384 Ok(_response)
385 }
386
387 pub fn r#get_display_info(
389 &self,
390 ___deadline: zx::MonotonicInstant,
391 ) -> Result<fidl_fuchsia_ui_gfx::DisplayInfo, fidl::Error> {
392 let _response =
393 self.client.send_query::<fidl::encoding::EmptyPayload, ScenicGetDisplayInfoResponse>(
394 (),
395 0x3e4cdecbf7cc1797,
396 fidl::encoding::DynamicFlags::empty(),
397 ___deadline,
398 )?;
399 Ok(_response.info)
400 }
401
402 pub fn r#get_display_ownership_event(
405 &self,
406 ___deadline: zx::MonotonicInstant,
407 ) -> Result<fidl::Event, fidl::Error> {
408 let _response = self
409 .client
410 .send_query::<fidl::encoding::EmptyPayload, ScenicGetDisplayOwnershipEventResponse>(
411 (),
412 0x54c114c7322b24d6,
413 fidl::encoding::DynamicFlags::empty(),
414 ___deadline,
415 )?;
416 Ok(_response.ownership_event)
417 }
418
419 pub fn r#take_screenshot(
422 &self,
423 ___deadline: zx::MonotonicInstant,
424 ) -> Result<(ScreenshotData, bool), fidl::Error> {
425 let _response =
426 self.client.send_query::<fidl::encoding::EmptyPayload, ScenicTakeScreenshotResponse>(
427 (),
428 0x53f5e06463987df2,
429 fidl::encoding::DynamicFlags::empty(),
430 ___deadline,
431 )?;
432 Ok((_response.img_data, _response.success))
433 }
434
435 pub fn r#uses_flatland(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
438 let _response =
439 self.client.send_query::<fidl::encoding::EmptyPayload, ScenicUsesFlatlandResponse>(
440 (),
441 0x5f2e5e19463ae706,
442 fidl::encoding::DynamicFlags::empty(),
443 ___deadline,
444 )?;
445 Ok(_response.flatland_enabled)
446 }
447}
448
449#[cfg(target_os = "fuchsia")]
450impl From<ScenicSynchronousProxy> for zx::Handle {
451 fn from(value: ScenicSynchronousProxy) -> Self {
452 value.into_channel().into()
453 }
454}
455
456#[cfg(target_os = "fuchsia")]
457impl From<fidl::Channel> for ScenicSynchronousProxy {
458 fn from(value: fidl::Channel) -> Self {
459 Self::new(value)
460 }
461}
462
463#[derive(Debug, Clone)]
464pub struct ScenicProxy {
465 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
466}
467
468impl fidl::endpoints::Proxy for ScenicProxy {
469 type Protocol = ScenicMarker;
470
471 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
472 Self::new(inner)
473 }
474
475 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
476 self.client.into_channel().map_err(|client| Self { client })
477 }
478
479 fn as_channel(&self) -> &::fidl::AsyncChannel {
480 self.client.as_channel()
481 }
482}
483
484impl ScenicProxy {
485 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
487 let protocol_name = <ScenicMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
488 Self { client: fidl::client::Client::new(channel, protocol_name) }
489 }
490
491 pub fn take_event_stream(&self) -> ScenicEventStream {
497 ScenicEventStream { event_receiver: self.client.take_event_receiver() }
498 }
499
500 pub fn r#create_session(
502 &self,
503 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
504 mut listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
505 ) -> Result<(), fidl::Error> {
506 ScenicProxyInterface::r#create_session(self, session, listener)
507 }
508
509 pub fn r#create_session2(
516 &self,
517 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
518 mut listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
519 mut view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
520 ) -> Result<(), fidl::Error> {
521 ScenicProxyInterface::r#create_session2(self, session, listener, view_focuser)
522 }
523
524 pub fn r#create_session_t(
535 &self,
536 mut endpoints: SessionEndpoints,
537 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
538 ScenicProxyInterface::r#create_session_t(self, endpoints)
539 }
540
541 pub fn r#get_display_info(
543 &self,
544 ) -> fidl::client::QueryResponseFut<
545 fidl_fuchsia_ui_gfx::DisplayInfo,
546 fidl::encoding::DefaultFuchsiaResourceDialect,
547 > {
548 ScenicProxyInterface::r#get_display_info(self)
549 }
550
551 pub fn r#get_display_ownership_event(
554 &self,
555 ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
556 {
557 ScenicProxyInterface::r#get_display_ownership_event(self)
558 }
559
560 pub fn r#take_screenshot(
563 &self,
564 ) -> fidl::client::QueryResponseFut<
565 (ScreenshotData, bool),
566 fidl::encoding::DefaultFuchsiaResourceDialect,
567 > {
568 ScenicProxyInterface::r#take_screenshot(self)
569 }
570
571 pub fn r#uses_flatland(
574 &self,
575 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
576 ScenicProxyInterface::r#uses_flatland(self)
577 }
578}
579
580impl ScenicProxyInterface for ScenicProxy {
581 fn r#create_session(
582 &self,
583 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
584 mut listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
585 ) -> Result<(), fidl::Error> {
586 self.client.send::<ScenicCreateSessionRequest>(
587 (session, listener),
588 0x2af781f341771a50,
589 fidl::encoding::DynamicFlags::empty(),
590 )
591 }
592
593 fn r#create_session2(
594 &self,
595 mut session: fidl::endpoints::ServerEnd<SessionMarker>,
596 mut listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
597 mut view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
598 ) -> Result<(), fidl::Error> {
599 self.client.send::<ScenicCreateSession2Request>(
600 (session, listener, view_focuser),
601 0x11fa60f776121fa5,
602 fidl::encoding::DynamicFlags::empty(),
603 )
604 }
605
606 type CreateSessionTResponseFut =
607 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
608 fn r#create_session_t(
609 &self,
610 mut endpoints: SessionEndpoints,
611 ) -> Self::CreateSessionTResponseFut {
612 fn _decode(
613 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
614 ) -> Result<(), fidl::Error> {
615 let _response = fidl::client::decode_transaction_body::<
616 fidl::encoding::EmptyPayload,
617 fidl::encoding::DefaultFuchsiaResourceDialect,
618 0x369061a897552d4f,
619 >(_buf?)?;
620 Ok(_response)
621 }
622 self.client.send_query_and_decode::<ScenicCreateSessionTRequest, ()>(
623 (&mut endpoints,),
624 0x369061a897552d4f,
625 fidl::encoding::DynamicFlags::empty(),
626 _decode,
627 )
628 }
629
630 type GetDisplayInfoResponseFut = fidl::client::QueryResponseFut<
631 fidl_fuchsia_ui_gfx::DisplayInfo,
632 fidl::encoding::DefaultFuchsiaResourceDialect,
633 >;
634 fn r#get_display_info(&self) -> Self::GetDisplayInfoResponseFut {
635 fn _decode(
636 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
637 ) -> Result<fidl_fuchsia_ui_gfx::DisplayInfo, fidl::Error> {
638 let _response = fidl::client::decode_transaction_body::<
639 ScenicGetDisplayInfoResponse,
640 fidl::encoding::DefaultFuchsiaResourceDialect,
641 0x3e4cdecbf7cc1797,
642 >(_buf?)?;
643 Ok(_response.info)
644 }
645 self.client.send_query_and_decode::<
646 fidl::encoding::EmptyPayload,
647 fidl_fuchsia_ui_gfx::DisplayInfo,
648 >(
649 (),
650 0x3e4cdecbf7cc1797,
651 fidl::encoding::DynamicFlags::empty(),
652 _decode,
653 )
654 }
655
656 type GetDisplayOwnershipEventResponseFut =
657 fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
658 fn r#get_display_ownership_event(&self) -> Self::GetDisplayOwnershipEventResponseFut {
659 fn _decode(
660 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
661 ) -> Result<fidl::Event, fidl::Error> {
662 let _response = fidl::client::decode_transaction_body::<
663 ScenicGetDisplayOwnershipEventResponse,
664 fidl::encoding::DefaultFuchsiaResourceDialect,
665 0x54c114c7322b24d6,
666 >(_buf?)?;
667 Ok(_response.ownership_event)
668 }
669 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Event>(
670 (),
671 0x54c114c7322b24d6,
672 fidl::encoding::DynamicFlags::empty(),
673 _decode,
674 )
675 }
676
677 type TakeScreenshotResponseFut = fidl::client::QueryResponseFut<
678 (ScreenshotData, bool),
679 fidl::encoding::DefaultFuchsiaResourceDialect,
680 >;
681 fn r#take_screenshot(&self) -> Self::TakeScreenshotResponseFut {
682 fn _decode(
683 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
684 ) -> Result<(ScreenshotData, bool), fidl::Error> {
685 let _response = fidl::client::decode_transaction_body::<
686 ScenicTakeScreenshotResponse,
687 fidl::encoding::DefaultFuchsiaResourceDialect,
688 0x53f5e06463987df2,
689 >(_buf?)?;
690 Ok((_response.img_data, _response.success))
691 }
692 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (ScreenshotData, bool)>(
693 (),
694 0x53f5e06463987df2,
695 fidl::encoding::DynamicFlags::empty(),
696 _decode,
697 )
698 }
699
700 type UsesFlatlandResponseFut =
701 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
702 fn r#uses_flatland(&self) -> Self::UsesFlatlandResponseFut {
703 fn _decode(
704 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
705 ) -> Result<bool, fidl::Error> {
706 let _response = fidl::client::decode_transaction_body::<
707 ScenicUsesFlatlandResponse,
708 fidl::encoding::DefaultFuchsiaResourceDialect,
709 0x5f2e5e19463ae706,
710 >(_buf?)?;
711 Ok(_response.flatland_enabled)
712 }
713 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
714 (),
715 0x5f2e5e19463ae706,
716 fidl::encoding::DynamicFlags::empty(),
717 _decode,
718 )
719 }
720}
721
722pub struct ScenicEventStream {
723 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
724}
725
726impl std::marker::Unpin for ScenicEventStream {}
727
728impl futures::stream::FusedStream for ScenicEventStream {
729 fn is_terminated(&self) -> bool {
730 self.event_receiver.is_terminated()
731 }
732}
733
734impl futures::Stream for ScenicEventStream {
735 type Item = Result<ScenicEvent, fidl::Error>;
736
737 fn poll_next(
738 mut self: std::pin::Pin<&mut Self>,
739 cx: &mut std::task::Context<'_>,
740 ) -> std::task::Poll<Option<Self::Item>> {
741 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
742 &mut self.event_receiver,
743 cx
744 )?) {
745 Some(buf) => std::task::Poll::Ready(Some(ScenicEvent::decode(buf))),
746 None => std::task::Poll::Ready(None),
747 }
748 }
749}
750
751#[derive(Debug)]
752pub enum ScenicEvent {}
753
754impl ScenicEvent {
755 fn decode(
757 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
758 ) -> Result<ScenicEvent, fidl::Error> {
759 let (bytes, _handles) = buf.split_mut();
760 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
761 debug_assert_eq!(tx_header.tx_id, 0);
762 match tx_header.ordinal {
763 _ => Err(fidl::Error::UnknownOrdinal {
764 ordinal: tx_header.ordinal,
765 protocol_name: <ScenicMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
766 }),
767 }
768 }
769}
770
771pub struct ScenicRequestStream {
773 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
774 is_terminated: bool,
775}
776
777impl std::marker::Unpin for ScenicRequestStream {}
778
779impl futures::stream::FusedStream for ScenicRequestStream {
780 fn is_terminated(&self) -> bool {
781 self.is_terminated
782 }
783}
784
785impl fidl::endpoints::RequestStream for ScenicRequestStream {
786 type Protocol = ScenicMarker;
787 type ControlHandle = ScenicControlHandle;
788
789 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
790 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
791 }
792
793 fn control_handle(&self) -> Self::ControlHandle {
794 ScenicControlHandle { inner: self.inner.clone() }
795 }
796
797 fn into_inner(
798 self,
799 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
800 {
801 (self.inner, self.is_terminated)
802 }
803
804 fn from_inner(
805 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
806 is_terminated: bool,
807 ) -> Self {
808 Self { inner, is_terminated }
809 }
810}
811
812impl futures::Stream for ScenicRequestStream {
813 type Item = Result<ScenicRequest, fidl::Error>;
814
815 fn poll_next(
816 mut self: std::pin::Pin<&mut Self>,
817 cx: &mut std::task::Context<'_>,
818 ) -> std::task::Poll<Option<Self::Item>> {
819 let this = &mut *self;
820 if this.inner.check_shutdown(cx) {
821 this.is_terminated = true;
822 return std::task::Poll::Ready(None);
823 }
824 if this.is_terminated {
825 panic!("polled ScenicRequestStream after completion");
826 }
827 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
828 |bytes, handles| {
829 match this.inner.channel().read_etc(cx, bytes, handles) {
830 std::task::Poll::Ready(Ok(())) => {}
831 std::task::Poll::Pending => return std::task::Poll::Pending,
832 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
833 this.is_terminated = true;
834 return std::task::Poll::Ready(None);
835 }
836 std::task::Poll::Ready(Err(e)) => {
837 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
838 e.into(),
839 ))))
840 }
841 }
842
843 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
845
846 std::task::Poll::Ready(Some(match header.ordinal {
847 0x2af781f341771a50 => {
848 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
849 let mut req = fidl::new_empty!(
850 ScenicCreateSessionRequest,
851 fidl::encoding::DefaultFuchsiaResourceDialect
852 );
853 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScenicCreateSessionRequest>(&header, _body_bytes, handles, &mut req)?;
854 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
855 Ok(ScenicRequest::CreateSession {
856 session: req.session,
857 listener: req.listener,
858
859 control_handle,
860 })
861 }
862 0x11fa60f776121fa5 => {
863 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
864 let mut req = fidl::new_empty!(
865 ScenicCreateSession2Request,
866 fidl::encoding::DefaultFuchsiaResourceDialect
867 );
868 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScenicCreateSession2Request>(&header, _body_bytes, handles, &mut req)?;
869 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
870 Ok(ScenicRequest::CreateSession2 {
871 session: req.session,
872 listener: req.listener,
873 view_focuser: req.view_focuser,
874
875 control_handle,
876 })
877 }
878 0x369061a897552d4f => {
879 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
880 let mut req = fidl::new_empty!(
881 ScenicCreateSessionTRequest,
882 fidl::encoding::DefaultFuchsiaResourceDialect
883 );
884 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScenicCreateSessionTRequest>(&header, _body_bytes, handles, &mut req)?;
885 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
886 Ok(ScenicRequest::CreateSessionT {
887 endpoints: req.endpoints,
888
889 responder: ScenicCreateSessionTResponder {
890 control_handle: std::mem::ManuallyDrop::new(control_handle),
891 tx_id: header.tx_id,
892 },
893 })
894 }
895 0x3e4cdecbf7cc1797 => {
896 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
897 let mut req = fidl::new_empty!(
898 fidl::encoding::EmptyPayload,
899 fidl::encoding::DefaultFuchsiaResourceDialect
900 );
901 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
902 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
903 Ok(ScenicRequest::GetDisplayInfo {
904 responder: ScenicGetDisplayInfoResponder {
905 control_handle: std::mem::ManuallyDrop::new(control_handle),
906 tx_id: header.tx_id,
907 },
908 })
909 }
910 0x54c114c7322b24d6 => {
911 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
912 let mut req = fidl::new_empty!(
913 fidl::encoding::EmptyPayload,
914 fidl::encoding::DefaultFuchsiaResourceDialect
915 );
916 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
917 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
918 Ok(ScenicRequest::GetDisplayOwnershipEvent {
919 responder: ScenicGetDisplayOwnershipEventResponder {
920 control_handle: std::mem::ManuallyDrop::new(control_handle),
921 tx_id: header.tx_id,
922 },
923 })
924 }
925 0x53f5e06463987df2 => {
926 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
927 let mut req = fidl::new_empty!(
928 fidl::encoding::EmptyPayload,
929 fidl::encoding::DefaultFuchsiaResourceDialect
930 );
931 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
932 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
933 Ok(ScenicRequest::TakeScreenshot {
934 responder: ScenicTakeScreenshotResponder {
935 control_handle: std::mem::ManuallyDrop::new(control_handle),
936 tx_id: header.tx_id,
937 },
938 })
939 }
940 0x5f2e5e19463ae706 => {
941 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
942 let mut req = fidl::new_empty!(
943 fidl::encoding::EmptyPayload,
944 fidl::encoding::DefaultFuchsiaResourceDialect
945 );
946 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
947 let control_handle = ScenicControlHandle { inner: this.inner.clone() };
948 Ok(ScenicRequest::UsesFlatland {
949 responder: ScenicUsesFlatlandResponder {
950 control_handle: std::mem::ManuallyDrop::new(control_handle),
951 tx_id: header.tx_id,
952 },
953 })
954 }
955 _ => Err(fidl::Error::UnknownOrdinal {
956 ordinal: header.ordinal,
957 protocol_name:
958 <ScenicMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
959 }),
960 }))
961 },
962 )
963 }
964}
965
966#[derive(Debug)]
967pub enum ScenicRequest {
968 CreateSession {
970 session: fidl::endpoints::ServerEnd<SessionMarker>,
971 listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
972 control_handle: ScenicControlHandle,
973 },
974 CreateSession2 {
981 session: fidl::endpoints::ServerEnd<SessionMarker>,
982 listener: Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
983 view_focuser: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
984 control_handle: ScenicControlHandle,
985 },
986 CreateSessionT { endpoints: SessionEndpoints, responder: ScenicCreateSessionTResponder },
997 GetDisplayInfo { responder: ScenicGetDisplayInfoResponder },
999 GetDisplayOwnershipEvent { responder: ScenicGetDisplayOwnershipEventResponder },
1002 TakeScreenshot { responder: ScenicTakeScreenshotResponder },
1005 UsesFlatland { responder: ScenicUsesFlatlandResponder },
1008}
1009
1010impl ScenicRequest {
1011 #[allow(irrefutable_let_patterns)]
1012 pub fn into_create_session(
1013 self,
1014 ) -> Option<(
1015 fidl::endpoints::ServerEnd<SessionMarker>,
1016 Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
1017 ScenicControlHandle,
1018 )> {
1019 if let ScenicRequest::CreateSession { session, listener, control_handle } = self {
1020 Some((session, listener, control_handle))
1021 } else {
1022 None
1023 }
1024 }
1025
1026 #[allow(irrefutable_let_patterns)]
1027 pub fn into_create_session2(
1028 self,
1029 ) -> Option<(
1030 fidl::endpoints::ServerEnd<SessionMarker>,
1031 Option<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
1032 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>,
1033 ScenicControlHandle,
1034 )> {
1035 if let ScenicRequest::CreateSession2 { session, listener, view_focuser, control_handle } =
1036 self
1037 {
1038 Some((session, listener, view_focuser, control_handle))
1039 } else {
1040 None
1041 }
1042 }
1043
1044 #[allow(irrefutable_let_patterns)]
1045 pub fn into_create_session_t(
1046 self,
1047 ) -> Option<(SessionEndpoints, ScenicCreateSessionTResponder)> {
1048 if let ScenicRequest::CreateSessionT { endpoints, responder } = self {
1049 Some((endpoints, responder))
1050 } else {
1051 None
1052 }
1053 }
1054
1055 #[allow(irrefutable_let_patterns)]
1056 pub fn into_get_display_info(self) -> Option<(ScenicGetDisplayInfoResponder)> {
1057 if let ScenicRequest::GetDisplayInfo { responder } = self {
1058 Some((responder))
1059 } else {
1060 None
1061 }
1062 }
1063
1064 #[allow(irrefutable_let_patterns)]
1065 pub fn into_get_display_ownership_event(
1066 self,
1067 ) -> Option<(ScenicGetDisplayOwnershipEventResponder)> {
1068 if let ScenicRequest::GetDisplayOwnershipEvent { responder } = self {
1069 Some((responder))
1070 } else {
1071 None
1072 }
1073 }
1074
1075 #[allow(irrefutable_let_patterns)]
1076 pub fn into_take_screenshot(self) -> Option<(ScenicTakeScreenshotResponder)> {
1077 if let ScenicRequest::TakeScreenshot { responder } = self {
1078 Some((responder))
1079 } else {
1080 None
1081 }
1082 }
1083
1084 #[allow(irrefutable_let_patterns)]
1085 pub fn into_uses_flatland(self) -> Option<(ScenicUsesFlatlandResponder)> {
1086 if let ScenicRequest::UsesFlatland { responder } = self {
1087 Some((responder))
1088 } else {
1089 None
1090 }
1091 }
1092
1093 pub fn method_name(&self) -> &'static str {
1095 match *self {
1096 ScenicRequest::CreateSession { .. } => "create_session",
1097 ScenicRequest::CreateSession2 { .. } => "create_session2",
1098 ScenicRequest::CreateSessionT { .. } => "create_session_t",
1099 ScenicRequest::GetDisplayInfo { .. } => "get_display_info",
1100 ScenicRequest::GetDisplayOwnershipEvent { .. } => "get_display_ownership_event",
1101 ScenicRequest::TakeScreenshot { .. } => "take_screenshot",
1102 ScenicRequest::UsesFlatland { .. } => "uses_flatland",
1103 }
1104 }
1105}
1106
1107#[derive(Debug, Clone)]
1108pub struct ScenicControlHandle {
1109 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1110}
1111
1112impl fidl::endpoints::ControlHandle for ScenicControlHandle {
1113 fn shutdown(&self) {
1114 self.inner.shutdown()
1115 }
1116 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1117 self.inner.shutdown_with_epitaph(status)
1118 }
1119
1120 fn is_closed(&self) -> bool {
1121 self.inner.channel().is_closed()
1122 }
1123 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1124 self.inner.channel().on_closed()
1125 }
1126
1127 #[cfg(target_os = "fuchsia")]
1128 fn signal_peer(
1129 &self,
1130 clear_mask: zx::Signals,
1131 set_mask: zx::Signals,
1132 ) -> Result<(), zx_status::Status> {
1133 use fidl::Peered;
1134 self.inner.channel().signal_peer(clear_mask, set_mask)
1135 }
1136}
1137
1138impl ScenicControlHandle {}
1139
1140#[must_use = "FIDL methods require a response to be sent"]
1141#[derive(Debug)]
1142pub struct ScenicCreateSessionTResponder {
1143 control_handle: std::mem::ManuallyDrop<ScenicControlHandle>,
1144 tx_id: u32,
1145}
1146
1147impl std::ops::Drop for ScenicCreateSessionTResponder {
1151 fn drop(&mut self) {
1152 self.control_handle.shutdown();
1153 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1155 }
1156}
1157
1158impl fidl::endpoints::Responder for ScenicCreateSessionTResponder {
1159 type ControlHandle = ScenicControlHandle;
1160
1161 fn control_handle(&self) -> &ScenicControlHandle {
1162 &self.control_handle
1163 }
1164
1165 fn drop_without_shutdown(mut self) {
1166 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1168 std::mem::forget(self);
1170 }
1171}
1172
1173impl ScenicCreateSessionTResponder {
1174 pub fn send(self) -> Result<(), fidl::Error> {
1178 let _result = self.send_raw();
1179 if _result.is_err() {
1180 self.control_handle.shutdown();
1181 }
1182 self.drop_without_shutdown();
1183 _result
1184 }
1185
1186 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1188 let _result = self.send_raw();
1189 self.drop_without_shutdown();
1190 _result
1191 }
1192
1193 fn send_raw(&self) -> Result<(), fidl::Error> {
1194 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1195 (),
1196 self.tx_id,
1197 0x369061a897552d4f,
1198 fidl::encoding::DynamicFlags::empty(),
1199 )
1200 }
1201}
1202
1203#[must_use = "FIDL methods require a response to be sent"]
1204#[derive(Debug)]
1205pub struct ScenicGetDisplayInfoResponder {
1206 control_handle: std::mem::ManuallyDrop<ScenicControlHandle>,
1207 tx_id: u32,
1208}
1209
1210impl std::ops::Drop for ScenicGetDisplayInfoResponder {
1214 fn drop(&mut self) {
1215 self.control_handle.shutdown();
1216 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1218 }
1219}
1220
1221impl fidl::endpoints::Responder for ScenicGetDisplayInfoResponder {
1222 type ControlHandle = ScenicControlHandle;
1223
1224 fn control_handle(&self) -> &ScenicControlHandle {
1225 &self.control_handle
1226 }
1227
1228 fn drop_without_shutdown(mut self) {
1229 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1231 std::mem::forget(self);
1233 }
1234}
1235
1236impl ScenicGetDisplayInfoResponder {
1237 pub fn send(self, mut info: &fidl_fuchsia_ui_gfx::DisplayInfo) -> Result<(), fidl::Error> {
1241 let _result = self.send_raw(info);
1242 if _result.is_err() {
1243 self.control_handle.shutdown();
1244 }
1245 self.drop_without_shutdown();
1246 _result
1247 }
1248
1249 pub fn send_no_shutdown_on_err(
1251 self,
1252 mut info: &fidl_fuchsia_ui_gfx::DisplayInfo,
1253 ) -> Result<(), fidl::Error> {
1254 let _result = self.send_raw(info);
1255 self.drop_without_shutdown();
1256 _result
1257 }
1258
1259 fn send_raw(&self, mut info: &fidl_fuchsia_ui_gfx::DisplayInfo) -> Result<(), fidl::Error> {
1260 self.control_handle.inner.send::<ScenicGetDisplayInfoResponse>(
1261 (info,),
1262 self.tx_id,
1263 0x3e4cdecbf7cc1797,
1264 fidl::encoding::DynamicFlags::empty(),
1265 )
1266 }
1267}
1268
1269#[must_use = "FIDL methods require a response to be sent"]
1270#[derive(Debug)]
1271pub struct ScenicGetDisplayOwnershipEventResponder {
1272 control_handle: std::mem::ManuallyDrop<ScenicControlHandle>,
1273 tx_id: u32,
1274}
1275
1276impl std::ops::Drop for ScenicGetDisplayOwnershipEventResponder {
1280 fn drop(&mut self) {
1281 self.control_handle.shutdown();
1282 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284 }
1285}
1286
1287impl fidl::endpoints::Responder for ScenicGetDisplayOwnershipEventResponder {
1288 type ControlHandle = ScenicControlHandle;
1289
1290 fn control_handle(&self) -> &ScenicControlHandle {
1291 &self.control_handle
1292 }
1293
1294 fn drop_without_shutdown(mut self) {
1295 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1297 std::mem::forget(self);
1299 }
1300}
1301
1302impl ScenicGetDisplayOwnershipEventResponder {
1303 pub fn send(self, mut ownership_event: fidl::Event) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(ownership_event);
1308 if _result.is_err() {
1309 self.control_handle.shutdown();
1310 }
1311 self.drop_without_shutdown();
1312 _result
1313 }
1314
1315 pub fn send_no_shutdown_on_err(
1317 self,
1318 mut ownership_event: fidl::Event,
1319 ) -> Result<(), fidl::Error> {
1320 let _result = self.send_raw(ownership_event);
1321 self.drop_without_shutdown();
1322 _result
1323 }
1324
1325 fn send_raw(&self, mut ownership_event: fidl::Event) -> Result<(), fidl::Error> {
1326 self.control_handle.inner.send::<ScenicGetDisplayOwnershipEventResponse>(
1327 (ownership_event,),
1328 self.tx_id,
1329 0x54c114c7322b24d6,
1330 fidl::encoding::DynamicFlags::empty(),
1331 )
1332 }
1333}
1334
1335#[must_use = "FIDL methods require a response to be sent"]
1336#[derive(Debug)]
1337pub struct ScenicTakeScreenshotResponder {
1338 control_handle: std::mem::ManuallyDrop<ScenicControlHandle>,
1339 tx_id: u32,
1340}
1341
1342impl std::ops::Drop for ScenicTakeScreenshotResponder {
1346 fn drop(&mut self) {
1347 self.control_handle.shutdown();
1348 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1350 }
1351}
1352
1353impl fidl::endpoints::Responder for ScenicTakeScreenshotResponder {
1354 type ControlHandle = ScenicControlHandle;
1355
1356 fn control_handle(&self) -> &ScenicControlHandle {
1357 &self.control_handle
1358 }
1359
1360 fn drop_without_shutdown(mut self) {
1361 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1363 std::mem::forget(self);
1365 }
1366}
1367
1368impl ScenicTakeScreenshotResponder {
1369 pub fn send(self, mut img_data: ScreenshotData, mut success: bool) -> Result<(), fidl::Error> {
1373 let _result = self.send_raw(img_data, success);
1374 if _result.is_err() {
1375 self.control_handle.shutdown();
1376 }
1377 self.drop_without_shutdown();
1378 _result
1379 }
1380
1381 pub fn send_no_shutdown_on_err(
1383 self,
1384 mut img_data: ScreenshotData,
1385 mut success: bool,
1386 ) -> Result<(), fidl::Error> {
1387 let _result = self.send_raw(img_data, success);
1388 self.drop_without_shutdown();
1389 _result
1390 }
1391
1392 fn send_raw(&self, mut img_data: ScreenshotData, mut success: bool) -> Result<(), fidl::Error> {
1393 self.control_handle.inner.send::<ScenicTakeScreenshotResponse>(
1394 (&mut img_data, success),
1395 self.tx_id,
1396 0x53f5e06463987df2,
1397 fidl::encoding::DynamicFlags::empty(),
1398 )
1399 }
1400}
1401
1402#[must_use = "FIDL methods require a response to be sent"]
1403#[derive(Debug)]
1404pub struct ScenicUsesFlatlandResponder {
1405 control_handle: std::mem::ManuallyDrop<ScenicControlHandle>,
1406 tx_id: u32,
1407}
1408
1409impl std::ops::Drop for ScenicUsesFlatlandResponder {
1413 fn drop(&mut self) {
1414 self.control_handle.shutdown();
1415 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1417 }
1418}
1419
1420impl fidl::endpoints::Responder for ScenicUsesFlatlandResponder {
1421 type ControlHandle = ScenicControlHandle;
1422
1423 fn control_handle(&self) -> &ScenicControlHandle {
1424 &self.control_handle
1425 }
1426
1427 fn drop_without_shutdown(mut self) {
1428 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1430 std::mem::forget(self);
1432 }
1433}
1434
1435impl ScenicUsesFlatlandResponder {
1436 pub fn send(self, mut flatland_enabled: bool) -> Result<(), fidl::Error> {
1440 let _result = self.send_raw(flatland_enabled);
1441 if _result.is_err() {
1442 self.control_handle.shutdown();
1443 }
1444 self.drop_without_shutdown();
1445 _result
1446 }
1447
1448 pub fn send_no_shutdown_on_err(self, mut flatland_enabled: bool) -> Result<(), fidl::Error> {
1450 let _result = self.send_raw(flatland_enabled);
1451 self.drop_without_shutdown();
1452 _result
1453 }
1454
1455 fn send_raw(&self, mut flatland_enabled: bool) -> Result<(), fidl::Error> {
1456 self.control_handle.inner.send::<ScenicUsesFlatlandResponse>(
1457 (flatland_enabled,),
1458 self.tx_id,
1459 0x5f2e5e19463ae706,
1460 fidl::encoding::DynamicFlags::empty(),
1461 )
1462 }
1463}
1464
1465#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1466pub struct SessionMarker;
1467
1468impl fidl::endpoints::ProtocolMarker for SessionMarker {
1469 type Proxy = SessionProxy;
1470 type RequestStream = SessionRequestStream;
1471 #[cfg(target_os = "fuchsia")]
1472 type SynchronousProxy = SessionSynchronousProxy;
1473
1474 const DEBUG_NAME: &'static str = "(anonymous) Session";
1475}
1476
1477pub trait SessionProxyInterface: Send + Sync {
1478 fn r#enqueue(&self, cmds: Vec<Command>) -> Result<(), fidl::Error>;
1479 type PresentResponseFut: std::future::Future<Output = Result<fidl_fuchsia_images::PresentationInfo, fidl::Error>>
1480 + Send;
1481 fn r#present(
1482 &self,
1483 presentation_time: u64,
1484 acquire_fences: Vec<fidl::Event>,
1485 release_fences: Vec<fidl::Event>,
1486 ) -> Self::PresentResponseFut;
1487 type Present2ResponseFut: std::future::Future<
1488 Output = Result<fidl_fuchsia_scenic_scheduling::FuturePresentationTimes, fidl::Error>,
1489 > + Send;
1490 fn r#present2(&self, args: Present2Args) -> Self::Present2ResponseFut;
1491 type RequestPresentationTimesResponseFut: std::future::Future<
1492 Output = Result<fidl_fuchsia_scenic_scheduling::FuturePresentationTimes, fidl::Error>,
1493 > + Send;
1494 fn r#request_presentation_times(
1495 &self,
1496 requested_prediction_span: i64,
1497 ) -> Self::RequestPresentationTimesResponseFut;
1498 fn r#register_buffer_collection(
1499 &self,
1500 buffer_id: u32,
1501 token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
1502 ) -> Result<(), fidl::Error>;
1503 fn r#deregister_buffer_collection(&self, buffer_id: u32) -> Result<(), fidl::Error>;
1504 fn r#set_debug_name(&self, debug_name: &str) -> Result<(), fidl::Error>;
1505}
1506#[derive(Debug)]
1507#[cfg(target_os = "fuchsia")]
1508pub struct SessionSynchronousProxy {
1509 client: fidl::client::sync::Client,
1510}
1511
1512#[cfg(target_os = "fuchsia")]
1513impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
1514 type Proxy = SessionProxy;
1515 type Protocol = SessionMarker;
1516
1517 fn from_channel(inner: fidl::Channel) -> Self {
1518 Self::new(inner)
1519 }
1520
1521 fn into_channel(self) -> fidl::Channel {
1522 self.client.into_channel()
1523 }
1524
1525 fn as_channel(&self) -> &fidl::Channel {
1526 self.client.as_channel()
1527 }
1528}
1529
1530#[cfg(target_os = "fuchsia")]
1531impl SessionSynchronousProxy {
1532 pub fn new(channel: fidl::Channel) -> Self {
1533 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1534 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1535 }
1536
1537 pub fn into_channel(self) -> fidl::Channel {
1538 self.client.into_channel()
1539 }
1540
1541 pub fn wait_for_event(
1544 &self,
1545 deadline: zx::MonotonicInstant,
1546 ) -> Result<SessionEvent, fidl::Error> {
1547 SessionEvent::decode(self.client.wait_for_event(deadline)?)
1548 }
1549
1550 pub fn r#enqueue(&self, mut cmds: Vec<Command>) -> Result<(), fidl::Error> {
1551 self.client.send::<SessionEnqueueRequest>(
1552 (cmds.as_mut(),),
1553 0x61e1e8b2cb6b0852,
1554 fidl::encoding::DynamicFlags::empty(),
1555 )
1556 }
1557
1558 pub fn r#present(
1656 &self,
1657 mut presentation_time: u64,
1658 mut acquire_fences: Vec<fidl::Event>,
1659 mut release_fences: Vec<fidl::Event>,
1660 ___deadline: zx::MonotonicInstant,
1661 ) -> Result<fidl_fuchsia_images::PresentationInfo, fidl::Error> {
1662 let _response = self.client.send_query::<SessionPresentRequest, SessionPresentResponse>(
1663 (presentation_time, acquire_fences.as_mut(), release_fences.as_mut()),
1664 0x36967062cdd2c37e,
1665 fidl::encoding::DynamicFlags::empty(),
1666 ___deadline,
1667 )?;
1668 Ok(_response.presentation_info)
1669 }
1670
1671 pub fn r#present2(
1693 &self,
1694 mut args: Present2Args,
1695 ___deadline: zx::MonotonicInstant,
1696 ) -> Result<fidl_fuchsia_scenic_scheduling::FuturePresentationTimes, fidl::Error> {
1697 let _response = self.client.send_query::<SessionPresent2Request, SessionPresent2Response>(
1698 (&mut args,),
1699 0x5d307d6198d76a65,
1700 fidl::encoding::DynamicFlags::empty(),
1701 ___deadline,
1702 )?;
1703 Ok(_response.request_presentation_times_info)
1704 }
1705
1706 pub fn r#request_presentation_times(
1717 &self,
1718 mut requested_prediction_span: i64,
1719 ___deadline: zx::MonotonicInstant,
1720 ) -> Result<fidl_fuchsia_scenic_scheduling::FuturePresentationTimes, fidl::Error> {
1721 let _response = self.client.send_query::<
1722 SessionRequestPresentationTimesRequest,
1723 SessionRequestPresentationTimesResponse,
1724 >(
1725 (requested_prediction_span,),
1726 0x14a087997bf83904,
1727 fidl::encoding::DynamicFlags::empty(),
1728 ___deadline,
1729 )?;
1730 Ok(_response.request_presentation_times_info)
1731 }
1732
1733 pub fn r#register_buffer_collection(
1740 &self,
1741 mut buffer_id: u32,
1742 mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
1743 ) -> Result<(), fidl::Error> {
1744 self.client.send::<SessionRegisterBufferCollectionRequest>(
1745 (buffer_id, token),
1746 0x141b0d5768c5ecf8,
1747 fidl::encoding::DynamicFlags::empty(),
1748 )
1749 }
1750
1751 pub fn r#deregister_buffer_collection(&self, mut buffer_id: u32) -> Result<(), fidl::Error> {
1756 self.client.send::<SessionDeregisterBufferCollectionRequest>(
1757 (buffer_id,),
1758 0x34e6c5c26b6cdb1e,
1759 fidl::encoding::DynamicFlags::empty(),
1760 )
1761 }
1762
1763 pub fn r#set_debug_name(&self, mut debug_name: &str) -> Result<(), fidl::Error> {
1766 self.client.send::<SessionSetDebugNameRequest>(
1767 (debug_name,),
1768 0xdb157bf88f57b91,
1769 fidl::encoding::DynamicFlags::empty(),
1770 )
1771 }
1772}
1773
1774#[cfg(target_os = "fuchsia")]
1775impl From<SessionSynchronousProxy> for zx::Handle {
1776 fn from(value: SessionSynchronousProxy) -> Self {
1777 value.into_channel().into()
1778 }
1779}
1780
1781#[cfg(target_os = "fuchsia")]
1782impl From<fidl::Channel> for SessionSynchronousProxy {
1783 fn from(value: fidl::Channel) -> Self {
1784 Self::new(value)
1785 }
1786}
1787
1788#[derive(Debug, Clone)]
1789pub struct SessionProxy {
1790 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1791}
1792
1793impl fidl::endpoints::Proxy for SessionProxy {
1794 type Protocol = SessionMarker;
1795
1796 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1797 Self::new(inner)
1798 }
1799
1800 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1801 self.client.into_channel().map_err(|client| Self { client })
1802 }
1803
1804 fn as_channel(&self) -> &::fidl::AsyncChannel {
1805 self.client.as_channel()
1806 }
1807}
1808
1809impl SessionProxy {
1810 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1812 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1813 Self { client: fidl::client::Client::new(channel, protocol_name) }
1814 }
1815
1816 pub fn take_event_stream(&self) -> SessionEventStream {
1822 SessionEventStream { event_receiver: self.client.take_event_receiver() }
1823 }
1824
1825 pub fn r#enqueue(&self, mut cmds: Vec<Command>) -> Result<(), fidl::Error> {
1826 SessionProxyInterface::r#enqueue(self, cmds)
1827 }
1828
1829 pub fn r#present(
1927 &self,
1928 mut presentation_time: u64,
1929 mut acquire_fences: Vec<fidl::Event>,
1930 mut release_fences: Vec<fidl::Event>,
1931 ) -> fidl::client::QueryResponseFut<
1932 fidl_fuchsia_images::PresentationInfo,
1933 fidl::encoding::DefaultFuchsiaResourceDialect,
1934 > {
1935 SessionProxyInterface::r#present(self, presentation_time, acquire_fences, release_fences)
1936 }
1937
1938 pub fn r#present2(
1960 &self,
1961 mut args: Present2Args,
1962 ) -> fidl::client::QueryResponseFut<
1963 fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
1964 fidl::encoding::DefaultFuchsiaResourceDialect,
1965 > {
1966 SessionProxyInterface::r#present2(self, args)
1967 }
1968
1969 pub fn r#request_presentation_times(
1980 &self,
1981 mut requested_prediction_span: i64,
1982 ) -> fidl::client::QueryResponseFut<
1983 fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
1984 fidl::encoding::DefaultFuchsiaResourceDialect,
1985 > {
1986 SessionProxyInterface::r#request_presentation_times(self, requested_prediction_span)
1987 }
1988
1989 pub fn r#register_buffer_collection(
1996 &self,
1997 mut buffer_id: u32,
1998 mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
1999 ) -> Result<(), fidl::Error> {
2000 SessionProxyInterface::r#register_buffer_collection(self, buffer_id, token)
2001 }
2002
2003 pub fn r#deregister_buffer_collection(&self, mut buffer_id: u32) -> Result<(), fidl::Error> {
2008 SessionProxyInterface::r#deregister_buffer_collection(self, buffer_id)
2009 }
2010
2011 pub fn r#set_debug_name(&self, mut debug_name: &str) -> Result<(), fidl::Error> {
2014 SessionProxyInterface::r#set_debug_name(self, debug_name)
2015 }
2016}
2017
2018impl SessionProxyInterface for SessionProxy {
2019 fn r#enqueue(&self, mut cmds: Vec<Command>) -> Result<(), fidl::Error> {
2020 self.client.send::<SessionEnqueueRequest>(
2021 (cmds.as_mut(),),
2022 0x61e1e8b2cb6b0852,
2023 fidl::encoding::DynamicFlags::empty(),
2024 )
2025 }
2026
2027 type PresentResponseFut = fidl::client::QueryResponseFut<
2028 fidl_fuchsia_images::PresentationInfo,
2029 fidl::encoding::DefaultFuchsiaResourceDialect,
2030 >;
2031 fn r#present(
2032 &self,
2033 mut presentation_time: u64,
2034 mut acquire_fences: Vec<fidl::Event>,
2035 mut release_fences: Vec<fidl::Event>,
2036 ) -> Self::PresentResponseFut {
2037 fn _decode(
2038 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2039 ) -> Result<fidl_fuchsia_images::PresentationInfo, fidl::Error> {
2040 let _response = fidl::client::decode_transaction_body::<
2041 SessionPresentResponse,
2042 fidl::encoding::DefaultFuchsiaResourceDialect,
2043 0x36967062cdd2c37e,
2044 >(_buf?)?;
2045 Ok(_response.presentation_info)
2046 }
2047 self.client
2048 .send_query_and_decode::<SessionPresentRequest, fidl_fuchsia_images::PresentationInfo>(
2049 (presentation_time, acquire_fences.as_mut(), release_fences.as_mut()),
2050 0x36967062cdd2c37e,
2051 fidl::encoding::DynamicFlags::empty(),
2052 _decode,
2053 )
2054 }
2055
2056 type Present2ResponseFut = fidl::client::QueryResponseFut<
2057 fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2058 fidl::encoding::DefaultFuchsiaResourceDialect,
2059 >;
2060 fn r#present2(&self, mut args: Present2Args) -> Self::Present2ResponseFut {
2061 fn _decode(
2062 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2063 ) -> Result<fidl_fuchsia_scenic_scheduling::FuturePresentationTimes, fidl::Error> {
2064 let _response = fidl::client::decode_transaction_body::<
2065 SessionPresent2Response,
2066 fidl::encoding::DefaultFuchsiaResourceDialect,
2067 0x5d307d6198d76a65,
2068 >(_buf?)?;
2069 Ok(_response.request_presentation_times_info)
2070 }
2071 self.client.send_query_and_decode::<
2072 SessionPresent2Request,
2073 fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2074 >(
2075 (&mut args,),
2076 0x5d307d6198d76a65,
2077 fidl::encoding::DynamicFlags::empty(),
2078 _decode,
2079 )
2080 }
2081
2082 type RequestPresentationTimesResponseFut = fidl::client::QueryResponseFut<
2083 fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2084 fidl::encoding::DefaultFuchsiaResourceDialect,
2085 >;
2086 fn r#request_presentation_times(
2087 &self,
2088 mut requested_prediction_span: i64,
2089 ) -> Self::RequestPresentationTimesResponseFut {
2090 fn _decode(
2091 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2092 ) -> Result<fidl_fuchsia_scenic_scheduling::FuturePresentationTimes, fidl::Error> {
2093 let _response = fidl::client::decode_transaction_body::<
2094 SessionRequestPresentationTimesResponse,
2095 fidl::encoding::DefaultFuchsiaResourceDialect,
2096 0x14a087997bf83904,
2097 >(_buf?)?;
2098 Ok(_response.request_presentation_times_info)
2099 }
2100 self.client.send_query_and_decode::<
2101 SessionRequestPresentationTimesRequest,
2102 fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2103 >(
2104 (requested_prediction_span,),
2105 0x14a087997bf83904,
2106 fidl::encoding::DynamicFlags::empty(),
2107 _decode,
2108 )
2109 }
2110
2111 fn r#register_buffer_collection(
2112 &self,
2113 mut buffer_id: u32,
2114 mut token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2115 ) -> Result<(), fidl::Error> {
2116 self.client.send::<SessionRegisterBufferCollectionRequest>(
2117 (buffer_id, token),
2118 0x141b0d5768c5ecf8,
2119 fidl::encoding::DynamicFlags::empty(),
2120 )
2121 }
2122
2123 fn r#deregister_buffer_collection(&self, mut buffer_id: u32) -> Result<(), fidl::Error> {
2124 self.client.send::<SessionDeregisterBufferCollectionRequest>(
2125 (buffer_id,),
2126 0x34e6c5c26b6cdb1e,
2127 fidl::encoding::DynamicFlags::empty(),
2128 )
2129 }
2130
2131 fn r#set_debug_name(&self, mut debug_name: &str) -> Result<(), fidl::Error> {
2132 self.client.send::<SessionSetDebugNameRequest>(
2133 (debug_name,),
2134 0xdb157bf88f57b91,
2135 fidl::encoding::DynamicFlags::empty(),
2136 )
2137 }
2138}
2139
2140pub struct SessionEventStream {
2141 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2142}
2143
2144impl std::marker::Unpin for SessionEventStream {}
2145
2146impl futures::stream::FusedStream for SessionEventStream {
2147 fn is_terminated(&self) -> bool {
2148 self.event_receiver.is_terminated()
2149 }
2150}
2151
2152impl futures::Stream for SessionEventStream {
2153 type Item = Result<SessionEvent, fidl::Error>;
2154
2155 fn poll_next(
2156 mut self: std::pin::Pin<&mut Self>,
2157 cx: &mut std::task::Context<'_>,
2158 ) -> std::task::Poll<Option<Self::Item>> {
2159 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2160 &mut self.event_receiver,
2161 cx
2162 )?) {
2163 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
2164 None => std::task::Poll::Ready(None),
2165 }
2166 }
2167}
2168
2169#[derive(Debug)]
2170pub enum SessionEvent {
2171 OnFramePresented { frame_presented_info: fidl_fuchsia_scenic_scheduling::FramePresentedInfo },
2172}
2173
2174impl SessionEvent {
2175 #[allow(irrefutable_let_patterns)]
2176 pub fn into_on_frame_presented(
2177 self,
2178 ) -> Option<fidl_fuchsia_scenic_scheduling::FramePresentedInfo> {
2179 if let SessionEvent::OnFramePresented { frame_presented_info } = self {
2180 Some((frame_presented_info))
2181 } else {
2182 None
2183 }
2184 }
2185
2186 fn decode(
2188 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2189 ) -> Result<SessionEvent, fidl::Error> {
2190 let (bytes, _handles) = buf.split_mut();
2191 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2192 debug_assert_eq!(tx_header.tx_id, 0);
2193 match tx_header.ordinal {
2194 0x26e3bdd1559be16b => {
2195 let mut out = fidl::new_empty!(
2196 SessionOnFramePresentedRequest,
2197 fidl::encoding::DefaultFuchsiaResourceDialect
2198 );
2199 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOnFramePresentedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2200 Ok((SessionEvent::OnFramePresented {
2201 frame_presented_info: out.frame_presented_info,
2202 }))
2203 }
2204 _ => Err(fidl::Error::UnknownOrdinal {
2205 ordinal: tx_header.ordinal,
2206 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2207 }),
2208 }
2209 }
2210}
2211
2212pub struct SessionRequestStream {
2214 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2215 is_terminated: bool,
2216}
2217
2218impl std::marker::Unpin for SessionRequestStream {}
2219
2220impl futures::stream::FusedStream for SessionRequestStream {
2221 fn is_terminated(&self) -> bool {
2222 self.is_terminated
2223 }
2224}
2225
2226impl fidl::endpoints::RequestStream for SessionRequestStream {
2227 type Protocol = SessionMarker;
2228 type ControlHandle = SessionControlHandle;
2229
2230 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2231 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2232 }
2233
2234 fn control_handle(&self) -> Self::ControlHandle {
2235 SessionControlHandle { inner: self.inner.clone() }
2236 }
2237
2238 fn into_inner(
2239 self,
2240 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2241 {
2242 (self.inner, self.is_terminated)
2243 }
2244
2245 fn from_inner(
2246 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2247 is_terminated: bool,
2248 ) -> Self {
2249 Self { inner, is_terminated }
2250 }
2251}
2252
2253impl futures::Stream for SessionRequestStream {
2254 type Item = Result<SessionRequest, fidl::Error>;
2255
2256 fn poll_next(
2257 mut self: std::pin::Pin<&mut Self>,
2258 cx: &mut std::task::Context<'_>,
2259 ) -> std::task::Poll<Option<Self::Item>> {
2260 let this = &mut *self;
2261 if this.inner.check_shutdown(cx) {
2262 this.is_terminated = true;
2263 return std::task::Poll::Ready(None);
2264 }
2265 if this.is_terminated {
2266 panic!("polled SessionRequestStream after completion");
2267 }
2268 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2269 |bytes, handles| {
2270 match this.inner.channel().read_etc(cx, bytes, handles) {
2271 std::task::Poll::Ready(Ok(())) => {}
2272 std::task::Poll::Pending => return std::task::Poll::Pending,
2273 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2274 this.is_terminated = true;
2275 return std::task::Poll::Ready(None);
2276 }
2277 std::task::Poll::Ready(Err(e)) => {
2278 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2279 e.into(),
2280 ))))
2281 }
2282 }
2283
2284 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2286
2287 std::task::Poll::Ready(Some(match header.ordinal {
2288 0x61e1e8b2cb6b0852 => {
2289 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2290 let mut req = fidl::new_empty!(
2291 SessionEnqueueRequest,
2292 fidl::encoding::DefaultFuchsiaResourceDialect
2293 );
2294 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionEnqueueRequest>(&header, _body_bytes, handles, &mut req)?;
2295 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2296 Ok(SessionRequest::Enqueue { cmds: req.cmds, control_handle })
2297 }
2298 0x36967062cdd2c37e => {
2299 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2300 let mut req = fidl::new_empty!(
2301 SessionPresentRequest,
2302 fidl::encoding::DefaultFuchsiaResourceDialect
2303 );
2304 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionPresentRequest>(&header, _body_bytes, handles, &mut req)?;
2305 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2306 Ok(SessionRequest::Present {
2307 presentation_time: req.presentation_time,
2308 acquire_fences: req.acquire_fences,
2309 release_fences: req.release_fences,
2310
2311 responder: SessionPresentResponder {
2312 control_handle: std::mem::ManuallyDrop::new(control_handle),
2313 tx_id: header.tx_id,
2314 },
2315 })
2316 }
2317 0x5d307d6198d76a65 => {
2318 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2319 let mut req = fidl::new_empty!(
2320 SessionPresent2Request,
2321 fidl::encoding::DefaultFuchsiaResourceDialect
2322 );
2323 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionPresent2Request>(&header, _body_bytes, handles, &mut req)?;
2324 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2325 Ok(SessionRequest::Present2 {
2326 args: req.args,
2327
2328 responder: SessionPresent2Responder {
2329 control_handle: std::mem::ManuallyDrop::new(control_handle),
2330 tx_id: header.tx_id,
2331 },
2332 })
2333 }
2334 0x14a087997bf83904 => {
2335 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2336 let mut req = fidl::new_empty!(
2337 SessionRequestPresentationTimesRequest,
2338 fidl::encoding::DefaultFuchsiaResourceDialect
2339 );
2340 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionRequestPresentationTimesRequest>(&header, _body_bytes, handles, &mut req)?;
2341 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2342 Ok(SessionRequest::RequestPresentationTimes {
2343 requested_prediction_span: req.requested_prediction_span,
2344
2345 responder: SessionRequestPresentationTimesResponder {
2346 control_handle: std::mem::ManuallyDrop::new(control_handle),
2347 tx_id: header.tx_id,
2348 },
2349 })
2350 }
2351 0x141b0d5768c5ecf8 => {
2352 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2353 let mut req = fidl::new_empty!(
2354 SessionRegisterBufferCollectionRequest,
2355 fidl::encoding::DefaultFuchsiaResourceDialect
2356 );
2357 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionRegisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
2358 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2359 Ok(SessionRequest::RegisterBufferCollection {
2360 buffer_id: req.buffer_id,
2361 token: req.token,
2362
2363 control_handle,
2364 })
2365 }
2366 0x34e6c5c26b6cdb1e => {
2367 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2368 let mut req = fidl::new_empty!(
2369 SessionDeregisterBufferCollectionRequest,
2370 fidl::encoding::DefaultFuchsiaResourceDialect
2371 );
2372 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionDeregisterBufferCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
2373 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2374 Ok(SessionRequest::DeregisterBufferCollection {
2375 buffer_id: req.buffer_id,
2376
2377 control_handle,
2378 })
2379 }
2380 0xdb157bf88f57b91 => {
2381 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2382 let mut req = fidl::new_empty!(
2383 SessionSetDebugNameRequest,
2384 fidl::encoding::DefaultFuchsiaResourceDialect
2385 );
2386 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionSetDebugNameRequest>(&header, _body_bytes, handles, &mut req)?;
2387 let control_handle = SessionControlHandle { inner: this.inner.clone() };
2388 Ok(SessionRequest::SetDebugName {
2389 debug_name: req.debug_name,
2390
2391 control_handle,
2392 })
2393 }
2394 _ => Err(fidl::Error::UnknownOrdinal {
2395 ordinal: header.ordinal,
2396 protocol_name:
2397 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2398 }),
2399 }))
2400 },
2401 )
2402 }
2403}
2404
2405#[derive(Debug)]
2408pub enum SessionRequest {
2409 Enqueue {
2410 cmds: Vec<Command>,
2411 control_handle: SessionControlHandle,
2412 },
2413 Present {
2511 presentation_time: u64,
2512 acquire_fences: Vec<fidl::Event>,
2513 release_fences: Vec<fidl::Event>,
2514 responder: SessionPresentResponder,
2515 },
2516 Present2 {
2538 args: Present2Args,
2539 responder: SessionPresent2Responder,
2540 },
2541 RequestPresentationTimes {
2552 requested_prediction_span: i64,
2553 responder: SessionRequestPresentationTimesResponder,
2554 },
2555 RegisterBufferCollection {
2562 buffer_id: u32,
2563 token: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2564 control_handle: SessionControlHandle,
2565 },
2566 DeregisterBufferCollection {
2571 buffer_id: u32,
2572 control_handle: SessionControlHandle,
2573 },
2574 SetDebugName {
2577 debug_name: String,
2578 control_handle: SessionControlHandle,
2579 },
2580}
2581
2582impl SessionRequest {
2583 #[allow(irrefutable_let_patterns)]
2584 pub fn into_enqueue(self) -> Option<(Vec<Command>, SessionControlHandle)> {
2585 if let SessionRequest::Enqueue { cmds, control_handle } = self {
2586 Some((cmds, control_handle))
2587 } else {
2588 None
2589 }
2590 }
2591
2592 #[allow(irrefutable_let_patterns)]
2593 pub fn into_present(
2594 self,
2595 ) -> Option<(u64, Vec<fidl::Event>, Vec<fidl::Event>, SessionPresentResponder)> {
2596 if let SessionRequest::Present {
2597 presentation_time,
2598 acquire_fences,
2599 release_fences,
2600 responder,
2601 } = self
2602 {
2603 Some((presentation_time, acquire_fences, release_fences, responder))
2604 } else {
2605 None
2606 }
2607 }
2608
2609 #[allow(irrefutable_let_patterns)]
2610 pub fn into_present2(self) -> Option<(Present2Args, SessionPresent2Responder)> {
2611 if let SessionRequest::Present2 { args, responder } = self {
2612 Some((args, responder))
2613 } else {
2614 None
2615 }
2616 }
2617
2618 #[allow(irrefutable_let_patterns)]
2619 pub fn into_request_presentation_times(
2620 self,
2621 ) -> Option<(i64, SessionRequestPresentationTimesResponder)> {
2622 if let SessionRequest::RequestPresentationTimes { requested_prediction_span, responder } =
2623 self
2624 {
2625 Some((requested_prediction_span, responder))
2626 } else {
2627 None
2628 }
2629 }
2630
2631 #[allow(irrefutable_let_patterns)]
2632 pub fn into_register_buffer_collection(
2633 self,
2634 ) -> Option<(
2635 u32,
2636 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
2637 SessionControlHandle,
2638 )> {
2639 if let SessionRequest::RegisterBufferCollection { buffer_id, token, control_handle } = self
2640 {
2641 Some((buffer_id, token, control_handle))
2642 } else {
2643 None
2644 }
2645 }
2646
2647 #[allow(irrefutable_let_patterns)]
2648 pub fn into_deregister_buffer_collection(self) -> Option<(u32, SessionControlHandle)> {
2649 if let SessionRequest::DeregisterBufferCollection { buffer_id, control_handle } = self {
2650 Some((buffer_id, control_handle))
2651 } else {
2652 None
2653 }
2654 }
2655
2656 #[allow(irrefutable_let_patterns)]
2657 pub fn into_set_debug_name(self) -> Option<(String, SessionControlHandle)> {
2658 if let SessionRequest::SetDebugName { debug_name, control_handle } = self {
2659 Some((debug_name, control_handle))
2660 } else {
2661 None
2662 }
2663 }
2664
2665 pub fn method_name(&self) -> &'static str {
2667 match *self {
2668 SessionRequest::Enqueue { .. } => "enqueue",
2669 SessionRequest::Present { .. } => "present",
2670 SessionRequest::Present2 { .. } => "present2",
2671 SessionRequest::RequestPresentationTimes { .. } => "request_presentation_times",
2672 SessionRequest::RegisterBufferCollection { .. } => "register_buffer_collection",
2673 SessionRequest::DeregisterBufferCollection { .. } => "deregister_buffer_collection",
2674 SessionRequest::SetDebugName { .. } => "set_debug_name",
2675 }
2676 }
2677}
2678
2679#[derive(Debug, Clone)]
2680pub struct SessionControlHandle {
2681 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2682}
2683
2684impl fidl::endpoints::ControlHandle for SessionControlHandle {
2685 fn shutdown(&self) {
2686 self.inner.shutdown()
2687 }
2688 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2689 self.inner.shutdown_with_epitaph(status)
2690 }
2691
2692 fn is_closed(&self) -> bool {
2693 self.inner.channel().is_closed()
2694 }
2695 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2696 self.inner.channel().on_closed()
2697 }
2698
2699 #[cfg(target_os = "fuchsia")]
2700 fn signal_peer(
2701 &self,
2702 clear_mask: zx::Signals,
2703 set_mask: zx::Signals,
2704 ) -> Result<(), zx_status::Status> {
2705 use fidl::Peered;
2706 self.inner.channel().signal_peer(clear_mask, set_mask)
2707 }
2708}
2709
2710impl SessionControlHandle {
2711 pub fn send_on_frame_presented(
2712 &self,
2713 mut frame_presented_info: &fidl_fuchsia_scenic_scheduling::FramePresentedInfo,
2714 ) -> Result<(), fidl::Error> {
2715 self.inner.send::<SessionOnFramePresentedRequest>(
2716 (frame_presented_info,),
2717 0,
2718 0x26e3bdd1559be16b,
2719 fidl::encoding::DynamicFlags::empty(),
2720 )
2721 }
2722}
2723
2724#[must_use = "FIDL methods require a response to be sent"]
2725#[derive(Debug)]
2726pub struct SessionPresentResponder {
2727 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2728 tx_id: u32,
2729}
2730
2731impl std::ops::Drop for SessionPresentResponder {
2735 fn drop(&mut self) {
2736 self.control_handle.shutdown();
2737 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2739 }
2740}
2741
2742impl fidl::endpoints::Responder for SessionPresentResponder {
2743 type ControlHandle = SessionControlHandle;
2744
2745 fn control_handle(&self) -> &SessionControlHandle {
2746 &self.control_handle
2747 }
2748
2749 fn drop_without_shutdown(mut self) {
2750 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2752 std::mem::forget(self);
2754 }
2755}
2756
2757impl SessionPresentResponder {
2758 pub fn send(
2762 self,
2763 mut presentation_info: &fidl_fuchsia_images::PresentationInfo,
2764 ) -> Result<(), fidl::Error> {
2765 let _result = self.send_raw(presentation_info);
2766 if _result.is_err() {
2767 self.control_handle.shutdown();
2768 }
2769 self.drop_without_shutdown();
2770 _result
2771 }
2772
2773 pub fn send_no_shutdown_on_err(
2775 self,
2776 mut presentation_info: &fidl_fuchsia_images::PresentationInfo,
2777 ) -> Result<(), fidl::Error> {
2778 let _result = self.send_raw(presentation_info);
2779 self.drop_without_shutdown();
2780 _result
2781 }
2782
2783 fn send_raw(
2784 &self,
2785 mut presentation_info: &fidl_fuchsia_images::PresentationInfo,
2786 ) -> Result<(), fidl::Error> {
2787 self.control_handle.inner.send::<SessionPresentResponse>(
2788 (presentation_info,),
2789 self.tx_id,
2790 0x36967062cdd2c37e,
2791 fidl::encoding::DynamicFlags::empty(),
2792 )
2793 }
2794}
2795
2796#[must_use = "FIDL methods require a response to be sent"]
2797#[derive(Debug)]
2798pub struct SessionPresent2Responder {
2799 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2800 tx_id: u32,
2801}
2802
2803impl std::ops::Drop for SessionPresent2Responder {
2807 fn drop(&mut self) {
2808 self.control_handle.shutdown();
2809 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2811 }
2812}
2813
2814impl fidl::endpoints::Responder for SessionPresent2Responder {
2815 type ControlHandle = SessionControlHandle;
2816
2817 fn control_handle(&self) -> &SessionControlHandle {
2818 &self.control_handle
2819 }
2820
2821 fn drop_without_shutdown(mut self) {
2822 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2824 std::mem::forget(self);
2826 }
2827}
2828
2829impl SessionPresent2Responder {
2830 pub fn send(
2834 self,
2835 mut request_presentation_times_info: &fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2836 ) -> Result<(), fidl::Error> {
2837 let _result = self.send_raw(request_presentation_times_info);
2838 if _result.is_err() {
2839 self.control_handle.shutdown();
2840 }
2841 self.drop_without_shutdown();
2842 _result
2843 }
2844
2845 pub fn send_no_shutdown_on_err(
2847 self,
2848 mut request_presentation_times_info: &fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2849 ) -> Result<(), fidl::Error> {
2850 let _result = self.send_raw(request_presentation_times_info);
2851 self.drop_without_shutdown();
2852 _result
2853 }
2854
2855 fn send_raw(
2856 &self,
2857 mut request_presentation_times_info: &fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2858 ) -> Result<(), fidl::Error> {
2859 self.control_handle.inner.send::<SessionPresent2Response>(
2860 (request_presentation_times_info,),
2861 self.tx_id,
2862 0x5d307d6198d76a65,
2863 fidl::encoding::DynamicFlags::empty(),
2864 )
2865 }
2866}
2867
2868#[must_use = "FIDL methods require a response to be sent"]
2869#[derive(Debug)]
2870pub struct SessionRequestPresentationTimesResponder {
2871 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2872 tx_id: u32,
2873}
2874
2875impl std::ops::Drop for SessionRequestPresentationTimesResponder {
2879 fn drop(&mut self) {
2880 self.control_handle.shutdown();
2881 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2883 }
2884}
2885
2886impl fidl::endpoints::Responder for SessionRequestPresentationTimesResponder {
2887 type ControlHandle = SessionControlHandle;
2888
2889 fn control_handle(&self) -> &SessionControlHandle {
2890 &self.control_handle
2891 }
2892
2893 fn drop_without_shutdown(mut self) {
2894 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2896 std::mem::forget(self);
2898 }
2899}
2900
2901impl SessionRequestPresentationTimesResponder {
2902 pub fn send(
2906 self,
2907 mut request_presentation_times_info: &fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2908 ) -> Result<(), fidl::Error> {
2909 let _result = self.send_raw(request_presentation_times_info);
2910 if _result.is_err() {
2911 self.control_handle.shutdown();
2912 }
2913 self.drop_without_shutdown();
2914 _result
2915 }
2916
2917 pub fn send_no_shutdown_on_err(
2919 self,
2920 mut request_presentation_times_info: &fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2921 ) -> Result<(), fidl::Error> {
2922 let _result = self.send_raw(request_presentation_times_info);
2923 self.drop_without_shutdown();
2924 _result
2925 }
2926
2927 fn send_raw(
2928 &self,
2929 mut request_presentation_times_info: &fidl_fuchsia_scenic_scheduling::FuturePresentationTimes,
2930 ) -> Result<(), fidl::Error> {
2931 self.control_handle.inner.send::<SessionRequestPresentationTimesResponse>(
2932 (request_presentation_times_info,),
2933 self.tx_id,
2934 0x14a087997bf83904,
2935 fidl::encoding::DynamicFlags::empty(),
2936 )
2937 }
2938}
2939
2940#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2941pub struct SessionListenerMarker;
2942
2943impl fidl::endpoints::ProtocolMarker for SessionListenerMarker {
2944 type Proxy = SessionListenerProxy;
2945 type RequestStream = SessionListenerRequestStream;
2946 #[cfg(target_os = "fuchsia")]
2947 type SynchronousProxy = SessionListenerSynchronousProxy;
2948
2949 const DEBUG_NAME: &'static str = "(anonymous) SessionListener";
2950}
2951
2952pub trait SessionListenerProxyInterface: Send + Sync {
2953 fn r#on_scenic_error(&self, error: &str) -> Result<(), fidl::Error>;
2954 fn r#on_scenic_event(&self, events: Vec<Event>) -> Result<(), fidl::Error>;
2955}
2956#[derive(Debug)]
2957#[cfg(target_os = "fuchsia")]
2958pub struct SessionListenerSynchronousProxy {
2959 client: fidl::client::sync::Client,
2960}
2961
2962#[cfg(target_os = "fuchsia")]
2963impl fidl::endpoints::SynchronousProxy for SessionListenerSynchronousProxy {
2964 type Proxy = SessionListenerProxy;
2965 type Protocol = SessionListenerMarker;
2966
2967 fn from_channel(inner: fidl::Channel) -> Self {
2968 Self::new(inner)
2969 }
2970
2971 fn into_channel(self) -> fidl::Channel {
2972 self.client.into_channel()
2973 }
2974
2975 fn as_channel(&self) -> &fidl::Channel {
2976 self.client.as_channel()
2977 }
2978}
2979
2980#[cfg(target_os = "fuchsia")]
2981impl SessionListenerSynchronousProxy {
2982 pub fn new(channel: fidl::Channel) -> Self {
2983 let protocol_name = <SessionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2984 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2985 }
2986
2987 pub fn into_channel(self) -> fidl::Channel {
2988 self.client.into_channel()
2989 }
2990
2991 pub fn wait_for_event(
2994 &self,
2995 deadline: zx::MonotonicInstant,
2996 ) -> Result<SessionListenerEvent, fidl::Error> {
2997 SessionListenerEvent::decode(self.client.wait_for_event(deadline)?)
2998 }
2999
3000 pub fn r#on_scenic_error(&self, mut error: &str) -> Result<(), fidl::Error> {
3002 self.client.send::<SessionListenerOnScenicErrorRequest>(
3003 (error,),
3004 0x68095b89cb6c45f7,
3005 fidl::encoding::DynamicFlags::empty(),
3006 )
3007 }
3008
3009 pub fn r#on_scenic_event(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3012 self.client.send::<SessionListenerOnScenicEventRequest>(
3013 (events.as_mut(),),
3014 0x5f66bec36e87b3ea,
3015 fidl::encoding::DynamicFlags::empty(),
3016 )
3017 }
3018}
3019
3020#[cfg(target_os = "fuchsia")]
3021impl From<SessionListenerSynchronousProxy> for zx::Handle {
3022 fn from(value: SessionListenerSynchronousProxy) -> Self {
3023 value.into_channel().into()
3024 }
3025}
3026
3027#[cfg(target_os = "fuchsia")]
3028impl From<fidl::Channel> for SessionListenerSynchronousProxy {
3029 fn from(value: fidl::Channel) -> Self {
3030 Self::new(value)
3031 }
3032}
3033
3034#[derive(Debug, Clone)]
3035pub struct SessionListenerProxy {
3036 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3037}
3038
3039impl fidl::endpoints::Proxy for SessionListenerProxy {
3040 type Protocol = SessionListenerMarker;
3041
3042 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3043 Self::new(inner)
3044 }
3045
3046 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3047 self.client.into_channel().map_err(|client| Self { client })
3048 }
3049
3050 fn as_channel(&self) -> &::fidl::AsyncChannel {
3051 self.client.as_channel()
3052 }
3053}
3054
3055impl SessionListenerProxy {
3056 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3058 let protocol_name = <SessionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3059 Self { client: fidl::client::Client::new(channel, protocol_name) }
3060 }
3061
3062 pub fn take_event_stream(&self) -> SessionListenerEventStream {
3068 SessionListenerEventStream { event_receiver: self.client.take_event_receiver() }
3069 }
3070
3071 pub fn r#on_scenic_error(&self, mut error: &str) -> Result<(), fidl::Error> {
3073 SessionListenerProxyInterface::r#on_scenic_error(self, error)
3074 }
3075
3076 pub fn r#on_scenic_event(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3079 SessionListenerProxyInterface::r#on_scenic_event(self, events)
3080 }
3081}
3082
3083impl SessionListenerProxyInterface for SessionListenerProxy {
3084 fn r#on_scenic_error(&self, mut error: &str) -> Result<(), fidl::Error> {
3085 self.client.send::<SessionListenerOnScenicErrorRequest>(
3086 (error,),
3087 0x68095b89cb6c45f7,
3088 fidl::encoding::DynamicFlags::empty(),
3089 )
3090 }
3091
3092 fn r#on_scenic_event(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3093 self.client.send::<SessionListenerOnScenicEventRequest>(
3094 (events.as_mut(),),
3095 0x5f66bec36e87b3ea,
3096 fidl::encoding::DynamicFlags::empty(),
3097 )
3098 }
3099}
3100
3101pub struct SessionListenerEventStream {
3102 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3103}
3104
3105impl std::marker::Unpin for SessionListenerEventStream {}
3106
3107impl futures::stream::FusedStream for SessionListenerEventStream {
3108 fn is_terminated(&self) -> bool {
3109 self.event_receiver.is_terminated()
3110 }
3111}
3112
3113impl futures::Stream for SessionListenerEventStream {
3114 type Item = Result<SessionListenerEvent, fidl::Error>;
3115
3116 fn poll_next(
3117 mut self: std::pin::Pin<&mut Self>,
3118 cx: &mut std::task::Context<'_>,
3119 ) -> std::task::Poll<Option<Self::Item>> {
3120 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3121 &mut self.event_receiver,
3122 cx
3123 )?) {
3124 Some(buf) => std::task::Poll::Ready(Some(SessionListenerEvent::decode(buf))),
3125 None => std::task::Poll::Ready(None),
3126 }
3127 }
3128}
3129
3130#[derive(Debug)]
3131pub enum SessionListenerEvent {}
3132
3133impl SessionListenerEvent {
3134 fn decode(
3136 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3137 ) -> Result<SessionListenerEvent, fidl::Error> {
3138 let (bytes, _handles) = buf.split_mut();
3139 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3140 debug_assert_eq!(tx_header.tx_id, 0);
3141 match tx_header.ordinal {
3142 _ => Err(fidl::Error::UnknownOrdinal {
3143 ordinal: tx_header.ordinal,
3144 protocol_name:
3145 <SessionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3146 }),
3147 }
3148 }
3149}
3150
3151pub struct SessionListenerRequestStream {
3153 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3154 is_terminated: bool,
3155}
3156
3157impl std::marker::Unpin for SessionListenerRequestStream {}
3158
3159impl futures::stream::FusedStream for SessionListenerRequestStream {
3160 fn is_terminated(&self) -> bool {
3161 self.is_terminated
3162 }
3163}
3164
3165impl fidl::endpoints::RequestStream for SessionListenerRequestStream {
3166 type Protocol = SessionListenerMarker;
3167 type ControlHandle = SessionListenerControlHandle;
3168
3169 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3170 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3171 }
3172
3173 fn control_handle(&self) -> Self::ControlHandle {
3174 SessionListenerControlHandle { inner: self.inner.clone() }
3175 }
3176
3177 fn into_inner(
3178 self,
3179 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3180 {
3181 (self.inner, self.is_terminated)
3182 }
3183
3184 fn from_inner(
3185 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3186 is_terminated: bool,
3187 ) -> Self {
3188 Self { inner, is_terminated }
3189 }
3190}
3191
3192impl futures::Stream for SessionListenerRequestStream {
3193 type Item = Result<SessionListenerRequest, fidl::Error>;
3194
3195 fn poll_next(
3196 mut self: std::pin::Pin<&mut Self>,
3197 cx: &mut std::task::Context<'_>,
3198 ) -> std::task::Poll<Option<Self::Item>> {
3199 let this = &mut *self;
3200 if this.inner.check_shutdown(cx) {
3201 this.is_terminated = true;
3202 return std::task::Poll::Ready(None);
3203 }
3204 if this.is_terminated {
3205 panic!("polled SessionListenerRequestStream after completion");
3206 }
3207 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3208 |bytes, handles| {
3209 match this.inner.channel().read_etc(cx, bytes, handles) {
3210 std::task::Poll::Ready(Ok(())) => {}
3211 std::task::Poll::Pending => return std::task::Poll::Pending,
3212 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3213 this.is_terminated = true;
3214 return std::task::Poll::Ready(None);
3215 }
3216 std::task::Poll::Ready(Err(e)) => {
3217 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3218 e.into(),
3219 ))))
3220 }
3221 }
3222
3223 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3225
3226 std::task::Poll::Ready(Some(match header.ordinal {
3227 0x68095b89cb6c45f7 => {
3228 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3229 let mut req = fidl::new_empty!(
3230 SessionListenerOnScenicErrorRequest,
3231 fidl::encoding::DefaultFuchsiaResourceDialect
3232 );
3233 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionListenerOnScenicErrorRequest>(&header, _body_bytes, handles, &mut req)?;
3234 let control_handle =
3235 SessionListenerControlHandle { inner: this.inner.clone() };
3236 Ok(SessionListenerRequest::OnScenicError {
3237 error: req.error,
3238
3239 control_handle,
3240 })
3241 }
3242 0x5f66bec36e87b3ea => {
3243 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3244 let mut req = fidl::new_empty!(
3245 SessionListenerOnScenicEventRequest,
3246 fidl::encoding::DefaultFuchsiaResourceDialect
3247 );
3248 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionListenerOnScenicEventRequest>(&header, _body_bytes, handles, &mut req)?;
3249 let control_handle =
3250 SessionListenerControlHandle { inner: this.inner.clone() };
3251 Ok(SessionListenerRequest::OnScenicEvent {
3252 events: req.events,
3253
3254 control_handle,
3255 })
3256 }
3257 _ => Err(fidl::Error::UnknownOrdinal {
3258 ordinal: header.ordinal,
3259 protocol_name:
3260 <SessionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3261 }),
3262 }))
3263 },
3264 )
3265 }
3266}
3267
3268#[derive(Debug)]
3270pub enum SessionListenerRequest {
3271 OnScenicError { error: String, control_handle: SessionListenerControlHandle },
3273 OnScenicEvent { events: Vec<Event>, control_handle: SessionListenerControlHandle },
3276}
3277
3278impl SessionListenerRequest {
3279 #[allow(irrefutable_let_patterns)]
3280 pub fn into_on_scenic_error(self) -> Option<(String, SessionListenerControlHandle)> {
3281 if let SessionListenerRequest::OnScenicError { error, control_handle } = self {
3282 Some((error, control_handle))
3283 } else {
3284 None
3285 }
3286 }
3287
3288 #[allow(irrefutable_let_patterns)]
3289 pub fn into_on_scenic_event(self) -> Option<(Vec<Event>, SessionListenerControlHandle)> {
3290 if let SessionListenerRequest::OnScenicEvent { events, control_handle } = self {
3291 Some((events, control_handle))
3292 } else {
3293 None
3294 }
3295 }
3296
3297 pub fn method_name(&self) -> &'static str {
3299 match *self {
3300 SessionListenerRequest::OnScenicError { .. } => "on_scenic_error",
3301 SessionListenerRequest::OnScenicEvent { .. } => "on_scenic_event",
3302 }
3303 }
3304}
3305
3306#[derive(Debug, Clone)]
3307pub struct SessionListenerControlHandle {
3308 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3309}
3310
3311impl fidl::endpoints::ControlHandle for SessionListenerControlHandle {
3312 fn shutdown(&self) {
3313 self.inner.shutdown()
3314 }
3315 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3316 self.inner.shutdown_with_epitaph(status)
3317 }
3318
3319 fn is_closed(&self) -> bool {
3320 self.inner.channel().is_closed()
3321 }
3322 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3323 self.inner.channel().on_closed()
3324 }
3325
3326 #[cfg(target_os = "fuchsia")]
3327 fn signal_peer(
3328 &self,
3329 clear_mask: zx::Signals,
3330 set_mask: zx::Signals,
3331 ) -> Result<(), zx_status::Status> {
3332 use fidl::Peered;
3333 self.inner.channel().signal_peer(clear_mask, set_mask)
3334 }
3335}
3336
3337impl SessionListenerControlHandle {}
3338
3339mod internal {
3340 use super::*;
3341
3342 impl fidl::encoding::ResourceTypeMarker for ScenicCreateSession2Request {
3343 type Borrowed<'a> = &'a mut Self;
3344 fn take_or_borrow<'a>(
3345 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3346 ) -> Self::Borrowed<'a> {
3347 value
3348 }
3349 }
3350
3351 unsafe impl fidl::encoding::TypeMarker for ScenicCreateSession2Request {
3352 type Owned = Self;
3353
3354 #[inline(always)]
3355 fn inline_align(_context: fidl::encoding::Context) -> usize {
3356 4
3357 }
3358
3359 #[inline(always)]
3360 fn inline_size(_context: fidl::encoding::Context) -> usize {
3361 12
3362 }
3363 }
3364
3365 unsafe impl
3366 fidl::encoding::Encode<
3367 ScenicCreateSession2Request,
3368 fidl::encoding::DefaultFuchsiaResourceDialect,
3369 > for &mut ScenicCreateSession2Request
3370 {
3371 #[inline]
3372 unsafe fn encode(
3373 self,
3374 encoder: &mut fidl::encoding::Encoder<
3375 '_,
3376 fidl::encoding::DefaultFuchsiaResourceDialect,
3377 >,
3378 offset: usize,
3379 _depth: fidl::encoding::Depth,
3380 ) -> fidl::Result<()> {
3381 encoder.debug_check_bounds::<ScenicCreateSession2Request>(offset);
3382 fidl::encoding::Encode::<ScenicCreateSession2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3384 (
3385 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
3386 <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
3387 <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_focuser),
3388 ),
3389 encoder, offset, _depth
3390 )
3391 }
3392 }
3393 unsafe impl<
3394 T0: fidl::encoding::Encode<
3395 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3396 fidl::encoding::DefaultFuchsiaResourceDialect,
3397 >,
3398 T1: fidl::encoding::Encode<
3399 fidl::encoding::Optional<
3400 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
3401 >,
3402 fidl::encoding::DefaultFuchsiaResourceDialect,
3403 >,
3404 T2: fidl::encoding::Encode<
3405 fidl::encoding::Optional<
3406 fidl::encoding::Endpoint<
3407 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
3408 >,
3409 >,
3410 fidl::encoding::DefaultFuchsiaResourceDialect,
3411 >,
3412 >
3413 fidl::encoding::Encode<
3414 ScenicCreateSession2Request,
3415 fidl::encoding::DefaultFuchsiaResourceDialect,
3416 > for (T0, T1, T2)
3417 {
3418 #[inline]
3419 unsafe fn encode(
3420 self,
3421 encoder: &mut fidl::encoding::Encoder<
3422 '_,
3423 fidl::encoding::DefaultFuchsiaResourceDialect,
3424 >,
3425 offset: usize,
3426 depth: fidl::encoding::Depth,
3427 ) -> fidl::Result<()> {
3428 encoder.debug_check_bounds::<ScenicCreateSession2Request>(offset);
3429 self.0.encode(encoder, offset + 0, depth)?;
3433 self.1.encode(encoder, offset + 4, depth)?;
3434 self.2.encode(encoder, offset + 8, depth)?;
3435 Ok(())
3436 }
3437 }
3438
3439 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3440 for ScenicCreateSession2Request
3441 {
3442 #[inline(always)]
3443 fn new_empty() -> Self {
3444 Self {
3445 session: fidl::new_empty!(
3446 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3447 fidl::encoding::DefaultFuchsiaResourceDialect
3448 ),
3449 listener: fidl::new_empty!(
3450 fidl::encoding::Optional<
3451 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
3452 >,
3453 fidl::encoding::DefaultFuchsiaResourceDialect
3454 ),
3455 view_focuser: fidl::new_empty!(
3456 fidl::encoding::Optional<
3457 fidl::encoding::Endpoint<
3458 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
3459 >,
3460 >,
3461 fidl::encoding::DefaultFuchsiaResourceDialect
3462 ),
3463 }
3464 }
3465
3466 #[inline]
3467 unsafe fn decode(
3468 &mut self,
3469 decoder: &mut fidl::encoding::Decoder<
3470 '_,
3471 fidl::encoding::DefaultFuchsiaResourceDialect,
3472 >,
3473 offset: usize,
3474 _depth: fidl::encoding::Depth,
3475 ) -> fidl::Result<()> {
3476 decoder.debug_check_bounds::<Self>(offset);
3477 fidl::decode!(
3479 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3480 fidl::encoding::DefaultFuchsiaResourceDialect,
3481 &mut self.session,
3482 decoder,
3483 offset + 0,
3484 _depth
3485 )?;
3486 fidl::decode!(
3487 fidl::encoding::Optional<
3488 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
3489 >,
3490 fidl::encoding::DefaultFuchsiaResourceDialect,
3491 &mut self.listener,
3492 decoder,
3493 offset + 4,
3494 _depth
3495 )?;
3496 fidl::decode!(
3497 fidl::encoding::Optional<
3498 fidl::encoding::Endpoint<
3499 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
3500 >,
3501 >,
3502 fidl::encoding::DefaultFuchsiaResourceDialect,
3503 &mut self.view_focuser,
3504 decoder,
3505 offset + 8,
3506 _depth
3507 )?;
3508 Ok(())
3509 }
3510 }
3511
3512 impl fidl::encoding::ResourceTypeMarker for ScenicCreateSessionRequest {
3513 type Borrowed<'a> = &'a mut Self;
3514 fn take_or_borrow<'a>(
3515 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3516 ) -> Self::Borrowed<'a> {
3517 value
3518 }
3519 }
3520
3521 unsafe impl fidl::encoding::TypeMarker for ScenicCreateSessionRequest {
3522 type Owned = Self;
3523
3524 #[inline(always)]
3525 fn inline_align(_context: fidl::encoding::Context) -> usize {
3526 4
3527 }
3528
3529 #[inline(always)]
3530 fn inline_size(_context: fidl::encoding::Context) -> usize {
3531 8
3532 }
3533 }
3534
3535 unsafe impl
3536 fidl::encoding::Encode<
3537 ScenicCreateSessionRequest,
3538 fidl::encoding::DefaultFuchsiaResourceDialect,
3539 > for &mut ScenicCreateSessionRequest
3540 {
3541 #[inline]
3542 unsafe fn encode(
3543 self,
3544 encoder: &mut fidl::encoding::Encoder<
3545 '_,
3546 fidl::encoding::DefaultFuchsiaResourceDialect,
3547 >,
3548 offset: usize,
3549 _depth: fidl::encoding::Depth,
3550 ) -> fidl::Result<()> {
3551 encoder.debug_check_bounds::<ScenicCreateSessionRequest>(offset);
3552 fidl::encoding::Encode::<ScenicCreateSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3554 (
3555 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
3556 <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
3557 ),
3558 encoder, offset, _depth
3559 )
3560 }
3561 }
3562 unsafe impl<
3563 T0: fidl::encoding::Encode<
3564 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3565 fidl::encoding::DefaultFuchsiaResourceDialect,
3566 >,
3567 T1: fidl::encoding::Encode<
3568 fidl::encoding::Optional<
3569 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
3570 >,
3571 fidl::encoding::DefaultFuchsiaResourceDialect,
3572 >,
3573 >
3574 fidl::encoding::Encode<
3575 ScenicCreateSessionRequest,
3576 fidl::encoding::DefaultFuchsiaResourceDialect,
3577 > for (T0, T1)
3578 {
3579 #[inline]
3580 unsafe fn encode(
3581 self,
3582 encoder: &mut fidl::encoding::Encoder<
3583 '_,
3584 fidl::encoding::DefaultFuchsiaResourceDialect,
3585 >,
3586 offset: usize,
3587 depth: fidl::encoding::Depth,
3588 ) -> fidl::Result<()> {
3589 encoder.debug_check_bounds::<ScenicCreateSessionRequest>(offset);
3590 self.0.encode(encoder, offset + 0, depth)?;
3594 self.1.encode(encoder, offset + 4, depth)?;
3595 Ok(())
3596 }
3597 }
3598
3599 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3600 for ScenicCreateSessionRequest
3601 {
3602 #[inline(always)]
3603 fn new_empty() -> Self {
3604 Self {
3605 session: fidl::new_empty!(
3606 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3607 fidl::encoding::DefaultFuchsiaResourceDialect
3608 ),
3609 listener: fidl::new_empty!(
3610 fidl::encoding::Optional<
3611 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
3612 >,
3613 fidl::encoding::DefaultFuchsiaResourceDialect
3614 ),
3615 }
3616 }
3617
3618 #[inline]
3619 unsafe fn decode(
3620 &mut self,
3621 decoder: &mut fidl::encoding::Decoder<
3622 '_,
3623 fidl::encoding::DefaultFuchsiaResourceDialect,
3624 >,
3625 offset: usize,
3626 _depth: fidl::encoding::Depth,
3627 ) -> fidl::Result<()> {
3628 decoder.debug_check_bounds::<Self>(offset);
3629 fidl::decode!(
3631 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3632 fidl::encoding::DefaultFuchsiaResourceDialect,
3633 &mut self.session,
3634 decoder,
3635 offset + 0,
3636 _depth
3637 )?;
3638 fidl::decode!(
3639 fidl::encoding::Optional<
3640 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
3641 >,
3642 fidl::encoding::DefaultFuchsiaResourceDialect,
3643 &mut self.listener,
3644 decoder,
3645 offset + 4,
3646 _depth
3647 )?;
3648 Ok(())
3649 }
3650 }
3651
3652 impl fidl::encoding::ResourceTypeMarker for ScenicCreateSessionTRequest {
3653 type Borrowed<'a> = &'a mut Self;
3654 fn take_or_borrow<'a>(
3655 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3656 ) -> Self::Borrowed<'a> {
3657 value
3658 }
3659 }
3660
3661 unsafe impl fidl::encoding::TypeMarker for ScenicCreateSessionTRequest {
3662 type Owned = Self;
3663
3664 #[inline(always)]
3665 fn inline_align(_context: fidl::encoding::Context) -> usize {
3666 8
3667 }
3668
3669 #[inline(always)]
3670 fn inline_size(_context: fidl::encoding::Context) -> usize {
3671 16
3672 }
3673 }
3674
3675 unsafe impl
3676 fidl::encoding::Encode<
3677 ScenicCreateSessionTRequest,
3678 fidl::encoding::DefaultFuchsiaResourceDialect,
3679 > for &mut ScenicCreateSessionTRequest
3680 {
3681 #[inline]
3682 unsafe fn encode(
3683 self,
3684 encoder: &mut fidl::encoding::Encoder<
3685 '_,
3686 fidl::encoding::DefaultFuchsiaResourceDialect,
3687 >,
3688 offset: usize,
3689 _depth: fidl::encoding::Depth,
3690 ) -> fidl::Result<()> {
3691 encoder.debug_check_bounds::<ScenicCreateSessionTRequest>(offset);
3692 fidl::encoding::Encode::<
3694 ScenicCreateSessionTRequest,
3695 fidl::encoding::DefaultFuchsiaResourceDialect,
3696 >::encode(
3697 (<SessionEndpoints as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3698 &mut self.endpoints,
3699 ),),
3700 encoder,
3701 offset,
3702 _depth,
3703 )
3704 }
3705 }
3706 unsafe impl<
3707 T0: fidl::encoding::Encode<SessionEndpoints, fidl::encoding::DefaultFuchsiaResourceDialect>,
3708 >
3709 fidl::encoding::Encode<
3710 ScenicCreateSessionTRequest,
3711 fidl::encoding::DefaultFuchsiaResourceDialect,
3712 > for (T0,)
3713 {
3714 #[inline]
3715 unsafe fn encode(
3716 self,
3717 encoder: &mut fidl::encoding::Encoder<
3718 '_,
3719 fidl::encoding::DefaultFuchsiaResourceDialect,
3720 >,
3721 offset: usize,
3722 depth: fidl::encoding::Depth,
3723 ) -> fidl::Result<()> {
3724 encoder.debug_check_bounds::<ScenicCreateSessionTRequest>(offset);
3725 self.0.encode(encoder, offset + 0, depth)?;
3729 Ok(())
3730 }
3731 }
3732
3733 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3734 for ScenicCreateSessionTRequest
3735 {
3736 #[inline(always)]
3737 fn new_empty() -> Self {
3738 Self {
3739 endpoints: fidl::new_empty!(
3740 SessionEndpoints,
3741 fidl::encoding::DefaultFuchsiaResourceDialect
3742 ),
3743 }
3744 }
3745
3746 #[inline]
3747 unsafe fn decode(
3748 &mut self,
3749 decoder: &mut fidl::encoding::Decoder<
3750 '_,
3751 fidl::encoding::DefaultFuchsiaResourceDialect,
3752 >,
3753 offset: usize,
3754 _depth: fidl::encoding::Depth,
3755 ) -> fidl::Result<()> {
3756 decoder.debug_check_bounds::<Self>(offset);
3757 fidl::decode!(
3759 SessionEndpoints,
3760 fidl::encoding::DefaultFuchsiaResourceDialect,
3761 &mut self.endpoints,
3762 decoder,
3763 offset + 0,
3764 _depth
3765 )?;
3766 Ok(())
3767 }
3768 }
3769
3770 impl fidl::encoding::ResourceTypeMarker for ScenicGetDisplayOwnershipEventResponse {
3771 type Borrowed<'a> = &'a mut Self;
3772 fn take_or_borrow<'a>(
3773 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3774 ) -> Self::Borrowed<'a> {
3775 value
3776 }
3777 }
3778
3779 unsafe impl fidl::encoding::TypeMarker for ScenicGetDisplayOwnershipEventResponse {
3780 type Owned = Self;
3781
3782 #[inline(always)]
3783 fn inline_align(_context: fidl::encoding::Context) -> usize {
3784 4
3785 }
3786
3787 #[inline(always)]
3788 fn inline_size(_context: fidl::encoding::Context) -> usize {
3789 4
3790 }
3791 }
3792
3793 unsafe impl
3794 fidl::encoding::Encode<
3795 ScenicGetDisplayOwnershipEventResponse,
3796 fidl::encoding::DefaultFuchsiaResourceDialect,
3797 > for &mut ScenicGetDisplayOwnershipEventResponse
3798 {
3799 #[inline]
3800 unsafe fn encode(
3801 self,
3802 encoder: &mut fidl::encoding::Encoder<
3803 '_,
3804 fidl::encoding::DefaultFuchsiaResourceDialect,
3805 >,
3806 offset: usize,
3807 _depth: fidl::encoding::Depth,
3808 ) -> fidl::Result<()> {
3809 encoder.debug_check_bounds::<ScenicGetDisplayOwnershipEventResponse>(offset);
3810 fidl::encoding::Encode::<
3812 ScenicGetDisplayOwnershipEventResponse,
3813 fidl::encoding::DefaultFuchsiaResourceDialect,
3814 >::encode(
3815 (<fidl::encoding::HandleType<
3816 fidl::Event,
3817 { fidl::ObjectType::EVENT.into_raw() },
3818 2147483648,
3819 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3820 &mut self.ownership_event,
3821 ),),
3822 encoder,
3823 offset,
3824 _depth,
3825 )
3826 }
3827 }
3828 unsafe impl<
3829 T0: fidl::encoding::Encode<
3830 fidl::encoding::HandleType<
3831 fidl::Event,
3832 { fidl::ObjectType::EVENT.into_raw() },
3833 2147483648,
3834 >,
3835 fidl::encoding::DefaultFuchsiaResourceDialect,
3836 >,
3837 >
3838 fidl::encoding::Encode<
3839 ScenicGetDisplayOwnershipEventResponse,
3840 fidl::encoding::DefaultFuchsiaResourceDialect,
3841 > for (T0,)
3842 {
3843 #[inline]
3844 unsafe fn encode(
3845 self,
3846 encoder: &mut fidl::encoding::Encoder<
3847 '_,
3848 fidl::encoding::DefaultFuchsiaResourceDialect,
3849 >,
3850 offset: usize,
3851 depth: fidl::encoding::Depth,
3852 ) -> fidl::Result<()> {
3853 encoder.debug_check_bounds::<ScenicGetDisplayOwnershipEventResponse>(offset);
3854 self.0.encode(encoder, offset + 0, depth)?;
3858 Ok(())
3859 }
3860 }
3861
3862 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3863 for ScenicGetDisplayOwnershipEventResponse
3864 {
3865 #[inline(always)]
3866 fn new_empty() -> Self {
3867 Self {
3868 ownership_event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3869 }
3870 }
3871
3872 #[inline]
3873 unsafe fn decode(
3874 &mut self,
3875 decoder: &mut fidl::encoding::Decoder<
3876 '_,
3877 fidl::encoding::DefaultFuchsiaResourceDialect,
3878 >,
3879 offset: usize,
3880 _depth: fidl::encoding::Depth,
3881 ) -> fidl::Result<()> {
3882 decoder.debug_check_bounds::<Self>(offset);
3883 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ownership_event, decoder, offset + 0, _depth)?;
3885 Ok(())
3886 }
3887 }
3888
3889 impl fidl::encoding::ResourceTypeMarker for ScenicTakeScreenshotResponse {
3890 type Borrowed<'a> = &'a mut Self;
3891 fn take_or_borrow<'a>(
3892 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3893 ) -> Self::Borrowed<'a> {
3894 value
3895 }
3896 }
3897
3898 unsafe impl fidl::encoding::TypeMarker for ScenicTakeScreenshotResponse {
3899 type Owned = Self;
3900
3901 #[inline(always)]
3902 fn inline_align(_context: fidl::encoding::Context) -> usize {
3903 8
3904 }
3905
3906 #[inline(always)]
3907 fn inline_size(_context: fidl::encoding::Context) -> usize {
3908 56
3909 }
3910 }
3911
3912 unsafe impl
3913 fidl::encoding::Encode<
3914 ScenicTakeScreenshotResponse,
3915 fidl::encoding::DefaultFuchsiaResourceDialect,
3916 > for &mut ScenicTakeScreenshotResponse
3917 {
3918 #[inline]
3919 unsafe fn encode(
3920 self,
3921 encoder: &mut fidl::encoding::Encoder<
3922 '_,
3923 fidl::encoding::DefaultFuchsiaResourceDialect,
3924 >,
3925 offset: usize,
3926 _depth: fidl::encoding::Depth,
3927 ) -> fidl::Result<()> {
3928 encoder.debug_check_bounds::<ScenicTakeScreenshotResponse>(offset);
3929 fidl::encoding::Encode::<
3931 ScenicTakeScreenshotResponse,
3932 fidl::encoding::DefaultFuchsiaResourceDialect,
3933 >::encode(
3934 (
3935 <ScreenshotData as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3936 &mut self.img_data,
3937 ),
3938 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),
3939 ),
3940 encoder,
3941 offset,
3942 _depth,
3943 )
3944 }
3945 }
3946 unsafe impl<
3947 T0: fidl::encoding::Encode<ScreenshotData, fidl::encoding::DefaultFuchsiaResourceDialect>,
3948 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
3949 >
3950 fidl::encoding::Encode<
3951 ScenicTakeScreenshotResponse,
3952 fidl::encoding::DefaultFuchsiaResourceDialect,
3953 > for (T0, T1)
3954 {
3955 #[inline]
3956 unsafe fn encode(
3957 self,
3958 encoder: &mut fidl::encoding::Encoder<
3959 '_,
3960 fidl::encoding::DefaultFuchsiaResourceDialect,
3961 >,
3962 offset: usize,
3963 depth: fidl::encoding::Depth,
3964 ) -> fidl::Result<()> {
3965 encoder.debug_check_bounds::<ScenicTakeScreenshotResponse>(offset);
3966 unsafe {
3969 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
3970 (ptr as *mut u64).write_unaligned(0);
3971 }
3972 self.0.encode(encoder, offset + 0, depth)?;
3974 self.1.encode(encoder, offset + 48, depth)?;
3975 Ok(())
3976 }
3977 }
3978
3979 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3980 for ScenicTakeScreenshotResponse
3981 {
3982 #[inline(always)]
3983 fn new_empty() -> Self {
3984 Self {
3985 img_data: fidl::new_empty!(
3986 ScreenshotData,
3987 fidl::encoding::DefaultFuchsiaResourceDialect
3988 ),
3989 success: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
3990 }
3991 }
3992
3993 #[inline]
3994 unsafe fn decode(
3995 &mut self,
3996 decoder: &mut fidl::encoding::Decoder<
3997 '_,
3998 fidl::encoding::DefaultFuchsiaResourceDialect,
3999 >,
4000 offset: usize,
4001 _depth: fidl::encoding::Depth,
4002 ) -> fidl::Result<()> {
4003 decoder.debug_check_bounds::<Self>(offset);
4004 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
4006 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4007 let mask = 0xffffffffffffff00u64;
4008 let maskedval = padval & mask;
4009 if maskedval != 0 {
4010 return Err(fidl::Error::NonZeroPadding {
4011 padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
4012 });
4013 }
4014 fidl::decode!(
4015 ScreenshotData,
4016 fidl::encoding::DefaultFuchsiaResourceDialect,
4017 &mut self.img_data,
4018 decoder,
4019 offset + 0,
4020 _depth
4021 )?;
4022 fidl::decode!(
4023 bool,
4024 fidl::encoding::DefaultFuchsiaResourceDialect,
4025 &mut self.success,
4026 decoder,
4027 offset + 48,
4028 _depth
4029 )?;
4030 Ok(())
4031 }
4032 }
4033
4034 impl fidl::encoding::ResourceTypeMarker for ScreenshotData {
4035 type Borrowed<'a> = &'a mut Self;
4036 fn take_or_borrow<'a>(
4037 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4038 ) -> Self::Borrowed<'a> {
4039 value
4040 }
4041 }
4042
4043 unsafe impl fidl::encoding::TypeMarker for ScreenshotData {
4044 type Owned = Self;
4045
4046 #[inline(always)]
4047 fn inline_align(_context: fidl::encoding::Context) -> usize {
4048 8
4049 }
4050
4051 #[inline(always)]
4052 fn inline_size(_context: fidl::encoding::Context) -> usize {
4053 48
4054 }
4055 }
4056
4057 unsafe impl
4058 fidl::encoding::Encode<ScreenshotData, fidl::encoding::DefaultFuchsiaResourceDialect>
4059 for &mut ScreenshotData
4060 {
4061 #[inline]
4062 unsafe fn encode(
4063 self,
4064 encoder: &mut fidl::encoding::Encoder<
4065 '_,
4066 fidl::encoding::DefaultFuchsiaResourceDialect,
4067 >,
4068 offset: usize,
4069 _depth: fidl::encoding::Depth,
4070 ) -> fidl::Result<()> {
4071 encoder.debug_check_bounds::<ScreenshotData>(offset);
4072 fidl::encoding::Encode::<ScreenshotData, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4074 (
4075 <fidl_fuchsia_images::ImageInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
4076 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
4077 ),
4078 encoder, offset, _depth
4079 )
4080 }
4081 }
4082 unsafe impl<
4083 T0: fidl::encoding::Encode<
4084 fidl_fuchsia_images::ImageInfo,
4085 fidl::encoding::DefaultFuchsiaResourceDialect,
4086 >,
4087 T1: fidl::encoding::Encode<
4088 fidl_fuchsia_mem::Buffer,
4089 fidl::encoding::DefaultFuchsiaResourceDialect,
4090 >,
4091 > fidl::encoding::Encode<ScreenshotData, fidl::encoding::DefaultFuchsiaResourceDialect>
4092 for (T0, T1)
4093 {
4094 #[inline]
4095 unsafe fn encode(
4096 self,
4097 encoder: &mut fidl::encoding::Encoder<
4098 '_,
4099 fidl::encoding::DefaultFuchsiaResourceDialect,
4100 >,
4101 offset: usize,
4102 depth: fidl::encoding::Depth,
4103 ) -> fidl::Result<()> {
4104 encoder.debug_check_bounds::<ScreenshotData>(offset);
4105 self.0.encode(encoder, offset + 0, depth)?;
4109 self.1.encode(encoder, offset + 32, depth)?;
4110 Ok(())
4111 }
4112 }
4113
4114 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4115 for ScreenshotData
4116 {
4117 #[inline(always)]
4118 fn new_empty() -> Self {
4119 Self {
4120 info: fidl::new_empty!(
4121 fidl_fuchsia_images::ImageInfo,
4122 fidl::encoding::DefaultFuchsiaResourceDialect
4123 ),
4124 data: fidl::new_empty!(
4125 fidl_fuchsia_mem::Buffer,
4126 fidl::encoding::DefaultFuchsiaResourceDialect
4127 ),
4128 }
4129 }
4130
4131 #[inline]
4132 unsafe fn decode(
4133 &mut self,
4134 decoder: &mut fidl::encoding::Decoder<
4135 '_,
4136 fidl::encoding::DefaultFuchsiaResourceDialect,
4137 >,
4138 offset: usize,
4139 _depth: fidl::encoding::Depth,
4140 ) -> fidl::Result<()> {
4141 decoder.debug_check_bounds::<Self>(offset);
4142 fidl::decode!(
4144 fidl_fuchsia_images::ImageInfo,
4145 fidl::encoding::DefaultFuchsiaResourceDialect,
4146 &mut self.info,
4147 decoder,
4148 offset + 0,
4149 _depth
4150 )?;
4151 fidl::decode!(
4152 fidl_fuchsia_mem::Buffer,
4153 fidl::encoding::DefaultFuchsiaResourceDialect,
4154 &mut self.data,
4155 decoder,
4156 offset + 32,
4157 _depth
4158 )?;
4159 Ok(())
4160 }
4161 }
4162
4163 impl fidl::encoding::ResourceTypeMarker for SessionEnqueueRequest {
4164 type Borrowed<'a> = &'a mut Self;
4165 fn take_or_borrow<'a>(
4166 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4167 ) -> Self::Borrowed<'a> {
4168 value
4169 }
4170 }
4171
4172 unsafe impl fidl::encoding::TypeMarker for SessionEnqueueRequest {
4173 type Owned = Self;
4174
4175 #[inline(always)]
4176 fn inline_align(_context: fidl::encoding::Context) -> usize {
4177 8
4178 }
4179
4180 #[inline(always)]
4181 fn inline_size(_context: fidl::encoding::Context) -> usize {
4182 16
4183 }
4184 }
4185
4186 unsafe impl
4187 fidl::encoding::Encode<SessionEnqueueRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4188 for &mut SessionEnqueueRequest
4189 {
4190 #[inline]
4191 unsafe fn encode(
4192 self,
4193 encoder: &mut fidl::encoding::Encoder<
4194 '_,
4195 fidl::encoding::DefaultFuchsiaResourceDialect,
4196 >,
4197 offset: usize,
4198 _depth: fidl::encoding::Depth,
4199 ) -> fidl::Result<()> {
4200 encoder.debug_check_bounds::<SessionEnqueueRequest>(offset);
4201 fidl::encoding::Encode::<SessionEnqueueRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4203 (
4204 <fidl::encoding::UnboundedVector<Command> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cmds),
4205 ),
4206 encoder, offset, _depth
4207 )
4208 }
4209 }
4210 unsafe impl<
4211 T0: fidl::encoding::Encode<
4212 fidl::encoding::UnboundedVector<Command>,
4213 fidl::encoding::DefaultFuchsiaResourceDialect,
4214 >,
4215 >
4216 fidl::encoding::Encode<SessionEnqueueRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4217 for (T0,)
4218 {
4219 #[inline]
4220 unsafe fn encode(
4221 self,
4222 encoder: &mut fidl::encoding::Encoder<
4223 '_,
4224 fidl::encoding::DefaultFuchsiaResourceDialect,
4225 >,
4226 offset: usize,
4227 depth: fidl::encoding::Depth,
4228 ) -> fidl::Result<()> {
4229 encoder.debug_check_bounds::<SessionEnqueueRequest>(offset);
4230 self.0.encode(encoder, offset + 0, depth)?;
4234 Ok(())
4235 }
4236 }
4237
4238 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4239 for SessionEnqueueRequest
4240 {
4241 #[inline(always)]
4242 fn new_empty() -> Self {
4243 Self {
4244 cmds: fidl::new_empty!(
4245 fidl::encoding::UnboundedVector<Command>,
4246 fidl::encoding::DefaultFuchsiaResourceDialect
4247 ),
4248 }
4249 }
4250
4251 #[inline]
4252 unsafe fn decode(
4253 &mut self,
4254 decoder: &mut fidl::encoding::Decoder<
4255 '_,
4256 fidl::encoding::DefaultFuchsiaResourceDialect,
4257 >,
4258 offset: usize,
4259 _depth: fidl::encoding::Depth,
4260 ) -> fidl::Result<()> {
4261 decoder.debug_check_bounds::<Self>(offset);
4262 fidl::decode!(
4264 fidl::encoding::UnboundedVector<Command>,
4265 fidl::encoding::DefaultFuchsiaResourceDialect,
4266 &mut self.cmds,
4267 decoder,
4268 offset + 0,
4269 _depth
4270 )?;
4271 Ok(())
4272 }
4273 }
4274
4275 impl fidl::encoding::ResourceTypeMarker for SessionListenerOnScenicEventRequest {
4276 type Borrowed<'a> = &'a mut Self;
4277 fn take_or_borrow<'a>(
4278 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4279 ) -> Self::Borrowed<'a> {
4280 value
4281 }
4282 }
4283
4284 unsafe impl fidl::encoding::TypeMarker for SessionListenerOnScenicEventRequest {
4285 type Owned = Self;
4286
4287 #[inline(always)]
4288 fn inline_align(_context: fidl::encoding::Context) -> usize {
4289 8
4290 }
4291
4292 #[inline(always)]
4293 fn inline_size(_context: fidl::encoding::Context) -> usize {
4294 16
4295 }
4296 }
4297
4298 unsafe impl
4299 fidl::encoding::Encode<
4300 SessionListenerOnScenicEventRequest,
4301 fidl::encoding::DefaultFuchsiaResourceDialect,
4302 > for &mut SessionListenerOnScenicEventRequest
4303 {
4304 #[inline]
4305 unsafe fn encode(
4306 self,
4307 encoder: &mut fidl::encoding::Encoder<
4308 '_,
4309 fidl::encoding::DefaultFuchsiaResourceDialect,
4310 >,
4311 offset: usize,
4312 _depth: fidl::encoding::Depth,
4313 ) -> fidl::Result<()> {
4314 encoder.debug_check_bounds::<SessionListenerOnScenicEventRequest>(offset);
4315 fidl::encoding::Encode::<SessionListenerOnScenicEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4317 (
4318 <fidl::encoding::UnboundedVector<Event> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
4319 ),
4320 encoder, offset, _depth
4321 )
4322 }
4323 }
4324 unsafe impl<
4325 T0: fidl::encoding::Encode<
4326 fidl::encoding::UnboundedVector<Event>,
4327 fidl::encoding::DefaultFuchsiaResourceDialect,
4328 >,
4329 >
4330 fidl::encoding::Encode<
4331 SessionListenerOnScenicEventRequest,
4332 fidl::encoding::DefaultFuchsiaResourceDialect,
4333 > for (T0,)
4334 {
4335 #[inline]
4336 unsafe fn encode(
4337 self,
4338 encoder: &mut fidl::encoding::Encoder<
4339 '_,
4340 fidl::encoding::DefaultFuchsiaResourceDialect,
4341 >,
4342 offset: usize,
4343 depth: fidl::encoding::Depth,
4344 ) -> fidl::Result<()> {
4345 encoder.debug_check_bounds::<SessionListenerOnScenicEventRequest>(offset);
4346 self.0.encode(encoder, offset + 0, depth)?;
4350 Ok(())
4351 }
4352 }
4353
4354 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4355 for SessionListenerOnScenicEventRequest
4356 {
4357 #[inline(always)]
4358 fn new_empty() -> Self {
4359 Self {
4360 events: fidl::new_empty!(
4361 fidl::encoding::UnboundedVector<Event>,
4362 fidl::encoding::DefaultFuchsiaResourceDialect
4363 ),
4364 }
4365 }
4366
4367 #[inline]
4368 unsafe fn decode(
4369 &mut self,
4370 decoder: &mut fidl::encoding::Decoder<
4371 '_,
4372 fidl::encoding::DefaultFuchsiaResourceDialect,
4373 >,
4374 offset: usize,
4375 _depth: fidl::encoding::Depth,
4376 ) -> fidl::Result<()> {
4377 decoder.debug_check_bounds::<Self>(offset);
4378 fidl::decode!(
4380 fidl::encoding::UnboundedVector<Event>,
4381 fidl::encoding::DefaultFuchsiaResourceDialect,
4382 &mut self.events,
4383 decoder,
4384 offset + 0,
4385 _depth
4386 )?;
4387 Ok(())
4388 }
4389 }
4390
4391 impl fidl::encoding::ResourceTypeMarker for SessionPresent2Request {
4392 type Borrowed<'a> = &'a mut Self;
4393 fn take_or_borrow<'a>(
4394 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4395 ) -> Self::Borrowed<'a> {
4396 value
4397 }
4398 }
4399
4400 unsafe impl fidl::encoding::TypeMarker for SessionPresent2Request {
4401 type Owned = Self;
4402
4403 #[inline(always)]
4404 fn inline_align(_context: fidl::encoding::Context) -> usize {
4405 8
4406 }
4407
4408 #[inline(always)]
4409 fn inline_size(_context: fidl::encoding::Context) -> usize {
4410 16
4411 }
4412 }
4413
4414 unsafe impl
4415 fidl::encoding::Encode<
4416 SessionPresent2Request,
4417 fidl::encoding::DefaultFuchsiaResourceDialect,
4418 > for &mut SessionPresent2Request
4419 {
4420 #[inline]
4421 unsafe fn encode(
4422 self,
4423 encoder: &mut fidl::encoding::Encoder<
4424 '_,
4425 fidl::encoding::DefaultFuchsiaResourceDialect,
4426 >,
4427 offset: usize,
4428 _depth: fidl::encoding::Depth,
4429 ) -> fidl::Result<()> {
4430 encoder.debug_check_bounds::<SessionPresent2Request>(offset);
4431 fidl::encoding::Encode::<
4433 SessionPresent2Request,
4434 fidl::encoding::DefaultFuchsiaResourceDialect,
4435 >::encode(
4436 (<Present2Args as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4437 &mut self.args,
4438 ),),
4439 encoder,
4440 offset,
4441 _depth,
4442 )
4443 }
4444 }
4445 unsafe impl<
4446 T0: fidl::encoding::Encode<Present2Args, fidl::encoding::DefaultFuchsiaResourceDialect>,
4447 >
4448 fidl::encoding::Encode<
4449 SessionPresent2Request,
4450 fidl::encoding::DefaultFuchsiaResourceDialect,
4451 > for (T0,)
4452 {
4453 #[inline]
4454 unsafe fn encode(
4455 self,
4456 encoder: &mut fidl::encoding::Encoder<
4457 '_,
4458 fidl::encoding::DefaultFuchsiaResourceDialect,
4459 >,
4460 offset: usize,
4461 depth: fidl::encoding::Depth,
4462 ) -> fidl::Result<()> {
4463 encoder.debug_check_bounds::<SessionPresent2Request>(offset);
4464 self.0.encode(encoder, offset + 0, depth)?;
4468 Ok(())
4469 }
4470 }
4471
4472 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4473 for SessionPresent2Request
4474 {
4475 #[inline(always)]
4476 fn new_empty() -> Self {
4477 Self {
4478 args: fidl::new_empty!(Present2Args, fidl::encoding::DefaultFuchsiaResourceDialect),
4479 }
4480 }
4481
4482 #[inline]
4483 unsafe fn decode(
4484 &mut self,
4485 decoder: &mut fidl::encoding::Decoder<
4486 '_,
4487 fidl::encoding::DefaultFuchsiaResourceDialect,
4488 >,
4489 offset: usize,
4490 _depth: fidl::encoding::Depth,
4491 ) -> fidl::Result<()> {
4492 decoder.debug_check_bounds::<Self>(offset);
4493 fidl::decode!(
4495 Present2Args,
4496 fidl::encoding::DefaultFuchsiaResourceDialect,
4497 &mut self.args,
4498 decoder,
4499 offset + 0,
4500 _depth
4501 )?;
4502 Ok(())
4503 }
4504 }
4505
4506 impl fidl::encoding::ResourceTypeMarker for SessionPresentRequest {
4507 type Borrowed<'a> = &'a mut Self;
4508 fn take_or_borrow<'a>(
4509 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4510 ) -> Self::Borrowed<'a> {
4511 value
4512 }
4513 }
4514
4515 unsafe impl fidl::encoding::TypeMarker for SessionPresentRequest {
4516 type Owned = Self;
4517
4518 #[inline(always)]
4519 fn inline_align(_context: fidl::encoding::Context) -> usize {
4520 8
4521 }
4522
4523 #[inline(always)]
4524 fn inline_size(_context: fidl::encoding::Context) -> usize {
4525 40
4526 }
4527 }
4528
4529 unsafe impl
4530 fidl::encoding::Encode<SessionPresentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4531 for &mut SessionPresentRequest
4532 {
4533 #[inline]
4534 unsafe fn encode(
4535 self,
4536 encoder: &mut fidl::encoding::Encoder<
4537 '_,
4538 fidl::encoding::DefaultFuchsiaResourceDialect,
4539 >,
4540 offset: usize,
4541 _depth: fidl::encoding::Depth,
4542 ) -> fidl::Result<()> {
4543 encoder.debug_check_bounds::<SessionPresentRequest>(offset);
4544 fidl::encoding::Encode::<
4546 SessionPresentRequest,
4547 fidl::encoding::DefaultFuchsiaResourceDialect,
4548 >::encode(
4549 (
4550 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.presentation_time),
4551 <fidl::encoding::UnboundedVector<
4552 fidl::encoding::HandleType<
4553 fidl::Event,
4554 { fidl::ObjectType::EVENT.into_raw() },
4555 2147483648,
4556 >,
4557 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4558 &mut self.acquire_fences,
4559 ),
4560 <fidl::encoding::UnboundedVector<
4561 fidl::encoding::HandleType<
4562 fidl::Event,
4563 { fidl::ObjectType::EVENT.into_raw() },
4564 2147483648,
4565 >,
4566 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4567 &mut self.release_fences,
4568 ),
4569 ),
4570 encoder,
4571 offset,
4572 _depth,
4573 )
4574 }
4575 }
4576 unsafe impl<
4577 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4578 T1: fidl::encoding::Encode<
4579 fidl::encoding::UnboundedVector<
4580 fidl::encoding::HandleType<
4581 fidl::Event,
4582 { fidl::ObjectType::EVENT.into_raw() },
4583 2147483648,
4584 >,
4585 >,
4586 fidl::encoding::DefaultFuchsiaResourceDialect,
4587 >,
4588 T2: fidl::encoding::Encode<
4589 fidl::encoding::UnboundedVector<
4590 fidl::encoding::HandleType<
4591 fidl::Event,
4592 { fidl::ObjectType::EVENT.into_raw() },
4593 2147483648,
4594 >,
4595 >,
4596 fidl::encoding::DefaultFuchsiaResourceDialect,
4597 >,
4598 >
4599 fidl::encoding::Encode<SessionPresentRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4600 for (T0, T1, T2)
4601 {
4602 #[inline]
4603 unsafe fn encode(
4604 self,
4605 encoder: &mut fidl::encoding::Encoder<
4606 '_,
4607 fidl::encoding::DefaultFuchsiaResourceDialect,
4608 >,
4609 offset: usize,
4610 depth: fidl::encoding::Depth,
4611 ) -> fidl::Result<()> {
4612 encoder.debug_check_bounds::<SessionPresentRequest>(offset);
4613 self.0.encode(encoder, offset + 0, depth)?;
4617 self.1.encode(encoder, offset + 8, depth)?;
4618 self.2.encode(encoder, offset + 24, depth)?;
4619 Ok(())
4620 }
4621 }
4622
4623 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4624 for SessionPresentRequest
4625 {
4626 #[inline(always)]
4627 fn new_empty() -> Self {
4628 Self {
4629 presentation_time: fidl::new_empty!(
4630 u64,
4631 fidl::encoding::DefaultFuchsiaResourceDialect
4632 ),
4633 acquire_fences: fidl::new_empty!(
4634 fidl::encoding::UnboundedVector<
4635 fidl::encoding::HandleType<
4636 fidl::Event,
4637 { fidl::ObjectType::EVENT.into_raw() },
4638 2147483648,
4639 >,
4640 >,
4641 fidl::encoding::DefaultFuchsiaResourceDialect
4642 ),
4643 release_fences: fidl::new_empty!(
4644 fidl::encoding::UnboundedVector<
4645 fidl::encoding::HandleType<
4646 fidl::Event,
4647 { fidl::ObjectType::EVENT.into_raw() },
4648 2147483648,
4649 >,
4650 >,
4651 fidl::encoding::DefaultFuchsiaResourceDialect
4652 ),
4653 }
4654 }
4655
4656 #[inline]
4657 unsafe fn decode(
4658 &mut self,
4659 decoder: &mut fidl::encoding::Decoder<
4660 '_,
4661 fidl::encoding::DefaultFuchsiaResourceDialect,
4662 >,
4663 offset: usize,
4664 _depth: fidl::encoding::Depth,
4665 ) -> fidl::Result<()> {
4666 decoder.debug_check_bounds::<Self>(offset);
4667 fidl::decode!(
4669 u64,
4670 fidl::encoding::DefaultFuchsiaResourceDialect,
4671 &mut self.presentation_time,
4672 decoder,
4673 offset + 0,
4674 _depth
4675 )?;
4676 fidl::decode!(
4677 fidl::encoding::UnboundedVector<
4678 fidl::encoding::HandleType<
4679 fidl::Event,
4680 { fidl::ObjectType::EVENT.into_raw() },
4681 2147483648,
4682 >,
4683 >,
4684 fidl::encoding::DefaultFuchsiaResourceDialect,
4685 &mut self.acquire_fences,
4686 decoder,
4687 offset + 8,
4688 _depth
4689 )?;
4690 fidl::decode!(
4691 fidl::encoding::UnboundedVector<
4692 fidl::encoding::HandleType<
4693 fidl::Event,
4694 { fidl::ObjectType::EVENT.into_raw() },
4695 2147483648,
4696 >,
4697 >,
4698 fidl::encoding::DefaultFuchsiaResourceDialect,
4699 &mut self.release_fences,
4700 decoder,
4701 offset + 24,
4702 _depth
4703 )?;
4704 Ok(())
4705 }
4706 }
4707
4708 impl fidl::encoding::ResourceTypeMarker for SessionRegisterBufferCollectionRequest {
4709 type Borrowed<'a> = &'a mut Self;
4710 fn take_or_borrow<'a>(
4711 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4712 ) -> Self::Borrowed<'a> {
4713 value
4714 }
4715 }
4716
4717 unsafe impl fidl::encoding::TypeMarker for SessionRegisterBufferCollectionRequest {
4718 type Owned = Self;
4719
4720 #[inline(always)]
4721 fn inline_align(_context: fidl::encoding::Context) -> usize {
4722 4
4723 }
4724
4725 #[inline(always)]
4726 fn inline_size(_context: fidl::encoding::Context) -> usize {
4727 8
4728 }
4729 }
4730
4731 unsafe impl
4732 fidl::encoding::Encode<
4733 SessionRegisterBufferCollectionRequest,
4734 fidl::encoding::DefaultFuchsiaResourceDialect,
4735 > for &mut SessionRegisterBufferCollectionRequest
4736 {
4737 #[inline]
4738 unsafe fn encode(
4739 self,
4740 encoder: &mut fidl::encoding::Encoder<
4741 '_,
4742 fidl::encoding::DefaultFuchsiaResourceDialect,
4743 >,
4744 offset: usize,
4745 _depth: fidl::encoding::Depth,
4746 ) -> fidl::Result<()> {
4747 encoder.debug_check_bounds::<SessionRegisterBufferCollectionRequest>(offset);
4748 fidl::encoding::Encode::<
4750 SessionRegisterBufferCollectionRequest,
4751 fidl::encoding::DefaultFuchsiaResourceDialect,
4752 >::encode(
4753 (
4754 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_id),
4755 <fidl::encoding::Endpoint<
4756 fidl::endpoints::ClientEnd<
4757 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
4758 >,
4759 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4760 &mut self.token
4761 ),
4762 ),
4763 encoder,
4764 offset,
4765 _depth,
4766 )
4767 }
4768 }
4769 unsafe impl<
4770 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4771 T1: fidl::encoding::Encode<
4772 fidl::encoding::Endpoint<
4773 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
4774 >,
4775 fidl::encoding::DefaultFuchsiaResourceDialect,
4776 >,
4777 >
4778 fidl::encoding::Encode<
4779 SessionRegisterBufferCollectionRequest,
4780 fidl::encoding::DefaultFuchsiaResourceDialect,
4781 > for (T0, T1)
4782 {
4783 #[inline]
4784 unsafe fn encode(
4785 self,
4786 encoder: &mut fidl::encoding::Encoder<
4787 '_,
4788 fidl::encoding::DefaultFuchsiaResourceDialect,
4789 >,
4790 offset: usize,
4791 depth: fidl::encoding::Depth,
4792 ) -> fidl::Result<()> {
4793 encoder.debug_check_bounds::<SessionRegisterBufferCollectionRequest>(offset);
4794 self.0.encode(encoder, offset + 0, depth)?;
4798 self.1.encode(encoder, offset + 4, depth)?;
4799 Ok(())
4800 }
4801 }
4802
4803 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4804 for SessionRegisterBufferCollectionRequest
4805 {
4806 #[inline(always)]
4807 fn new_empty() -> Self {
4808 Self {
4809 buffer_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4810 token: fidl::new_empty!(
4811 fidl::encoding::Endpoint<
4812 fidl::endpoints::ClientEnd<
4813 fidl_fuchsia_sysmem::BufferCollectionTokenMarker,
4814 >,
4815 >,
4816 fidl::encoding::DefaultFuchsiaResourceDialect
4817 ),
4818 }
4819 }
4820
4821 #[inline]
4822 unsafe fn decode(
4823 &mut self,
4824 decoder: &mut fidl::encoding::Decoder<
4825 '_,
4826 fidl::encoding::DefaultFuchsiaResourceDialect,
4827 >,
4828 offset: usize,
4829 _depth: fidl::encoding::Depth,
4830 ) -> fidl::Result<()> {
4831 decoder.debug_check_bounds::<Self>(offset);
4832 fidl::decode!(
4834 u32,
4835 fidl::encoding::DefaultFuchsiaResourceDialect,
4836 &mut self.buffer_id,
4837 decoder,
4838 offset + 0,
4839 _depth
4840 )?;
4841 fidl::decode!(
4842 fidl::encoding::Endpoint<
4843 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem::BufferCollectionTokenMarker>,
4844 >,
4845 fidl::encoding::DefaultFuchsiaResourceDialect,
4846 &mut self.token,
4847 decoder,
4848 offset + 4,
4849 _depth
4850 )?;
4851 Ok(())
4852 }
4853 }
4854
4855 impl Present2Args {
4856 #[inline(always)]
4857 fn max_ordinal_present(&self) -> u64 {
4858 if let Some(_) = self.requested_prediction_span {
4859 return 4;
4860 }
4861 if let Some(_) = self.release_fences {
4862 return 3;
4863 }
4864 if let Some(_) = self.acquire_fences {
4865 return 2;
4866 }
4867 if let Some(_) = self.requested_presentation_time {
4868 return 1;
4869 }
4870 0
4871 }
4872 }
4873
4874 impl fidl::encoding::ResourceTypeMarker for Present2Args {
4875 type Borrowed<'a> = &'a mut Self;
4876 fn take_or_borrow<'a>(
4877 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4878 ) -> Self::Borrowed<'a> {
4879 value
4880 }
4881 }
4882
4883 unsafe impl fidl::encoding::TypeMarker for Present2Args {
4884 type Owned = Self;
4885
4886 #[inline(always)]
4887 fn inline_align(_context: fidl::encoding::Context) -> usize {
4888 8
4889 }
4890
4891 #[inline(always)]
4892 fn inline_size(_context: fidl::encoding::Context) -> usize {
4893 16
4894 }
4895 }
4896
4897 unsafe impl fidl::encoding::Encode<Present2Args, fidl::encoding::DefaultFuchsiaResourceDialect>
4898 for &mut Present2Args
4899 {
4900 unsafe fn encode(
4901 self,
4902 encoder: &mut fidl::encoding::Encoder<
4903 '_,
4904 fidl::encoding::DefaultFuchsiaResourceDialect,
4905 >,
4906 offset: usize,
4907 mut depth: fidl::encoding::Depth,
4908 ) -> fidl::Result<()> {
4909 encoder.debug_check_bounds::<Present2Args>(offset);
4910 let max_ordinal: u64 = self.max_ordinal_present();
4912 encoder.write_num(max_ordinal, offset);
4913 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4914 if max_ordinal == 0 {
4916 return Ok(());
4917 }
4918 depth.increment()?;
4919 let envelope_size = 8;
4920 let bytes_len = max_ordinal as usize * envelope_size;
4921 #[allow(unused_variables)]
4922 let offset = encoder.out_of_line_offset(bytes_len);
4923 let mut _prev_end_offset: usize = 0;
4924 if 1 > max_ordinal {
4925 return Ok(());
4926 }
4927
4928 let cur_offset: usize = (1 - 1) * envelope_size;
4931
4932 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4934
4935 fidl::encoding::encode_in_envelope_optional::<
4940 i64,
4941 fidl::encoding::DefaultFuchsiaResourceDialect,
4942 >(
4943 self.requested_presentation_time
4944 .as_ref()
4945 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4946 encoder,
4947 offset + cur_offset,
4948 depth,
4949 )?;
4950
4951 _prev_end_offset = cur_offset + envelope_size;
4952 if 2 > max_ordinal {
4953 return Ok(());
4954 }
4955
4956 let cur_offset: usize = (2 - 1) * envelope_size;
4959
4960 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4962
4963 fidl::encoding::encode_in_envelope_optional::<
4968 fidl::encoding::UnboundedVector<
4969 fidl::encoding::HandleType<
4970 fidl::Event,
4971 { fidl::ObjectType::EVENT.into_raw() },
4972 2147483648,
4973 >,
4974 >,
4975 fidl::encoding::DefaultFuchsiaResourceDialect,
4976 >(
4977 self.acquire_fences.as_mut().map(
4978 <fidl::encoding::UnboundedVector<
4979 fidl::encoding::HandleType<
4980 fidl::Event,
4981 { fidl::ObjectType::EVENT.into_raw() },
4982 2147483648,
4983 >,
4984 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4985 ),
4986 encoder,
4987 offset + cur_offset,
4988 depth,
4989 )?;
4990
4991 _prev_end_offset = cur_offset + envelope_size;
4992 if 3 > max_ordinal {
4993 return Ok(());
4994 }
4995
4996 let cur_offset: usize = (3 - 1) * envelope_size;
4999
5000 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5002
5003 fidl::encoding::encode_in_envelope_optional::<
5008 fidl::encoding::UnboundedVector<
5009 fidl::encoding::HandleType<
5010 fidl::Event,
5011 { fidl::ObjectType::EVENT.into_raw() },
5012 2147483648,
5013 >,
5014 >,
5015 fidl::encoding::DefaultFuchsiaResourceDialect,
5016 >(
5017 self.release_fences.as_mut().map(
5018 <fidl::encoding::UnboundedVector<
5019 fidl::encoding::HandleType<
5020 fidl::Event,
5021 { fidl::ObjectType::EVENT.into_raw() },
5022 2147483648,
5023 >,
5024 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5025 ),
5026 encoder,
5027 offset + cur_offset,
5028 depth,
5029 )?;
5030
5031 _prev_end_offset = cur_offset + envelope_size;
5032 if 4 > max_ordinal {
5033 return Ok(());
5034 }
5035
5036 let cur_offset: usize = (4 - 1) * envelope_size;
5039
5040 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5042
5043 fidl::encoding::encode_in_envelope_optional::<
5048 i64,
5049 fidl::encoding::DefaultFuchsiaResourceDialect,
5050 >(
5051 self.requested_prediction_span
5052 .as_ref()
5053 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5054 encoder,
5055 offset + cur_offset,
5056 depth,
5057 )?;
5058
5059 _prev_end_offset = cur_offset + envelope_size;
5060
5061 Ok(())
5062 }
5063 }
5064
5065 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Present2Args {
5066 #[inline(always)]
5067 fn new_empty() -> Self {
5068 Self::default()
5069 }
5070
5071 unsafe fn decode(
5072 &mut self,
5073 decoder: &mut fidl::encoding::Decoder<
5074 '_,
5075 fidl::encoding::DefaultFuchsiaResourceDialect,
5076 >,
5077 offset: usize,
5078 mut depth: fidl::encoding::Depth,
5079 ) -> fidl::Result<()> {
5080 decoder.debug_check_bounds::<Self>(offset);
5081 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5082 None => return Err(fidl::Error::NotNullable),
5083 Some(len) => len,
5084 };
5085 if len == 0 {
5087 return Ok(());
5088 };
5089 depth.increment()?;
5090 let envelope_size = 8;
5091 let bytes_len = len * envelope_size;
5092 let offset = decoder.out_of_line_offset(bytes_len)?;
5093 let mut _next_ordinal_to_read = 0;
5095 let mut next_offset = offset;
5096 let end_offset = offset + bytes_len;
5097 _next_ordinal_to_read += 1;
5098 if next_offset >= end_offset {
5099 return Ok(());
5100 }
5101
5102 while _next_ordinal_to_read < 1 {
5104 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5105 _next_ordinal_to_read += 1;
5106 next_offset += envelope_size;
5107 }
5108
5109 let next_out_of_line = decoder.next_out_of_line();
5110 let handles_before = decoder.remaining_handles();
5111 if let Some((inlined, num_bytes, num_handles)) =
5112 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5113 {
5114 let member_inline_size =
5115 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5116 if inlined != (member_inline_size <= 4) {
5117 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5118 }
5119 let inner_offset;
5120 let mut inner_depth = depth.clone();
5121 if inlined {
5122 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5123 inner_offset = next_offset;
5124 } else {
5125 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5126 inner_depth.increment()?;
5127 }
5128 let val_ref = self.requested_presentation_time.get_or_insert_with(|| {
5129 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
5130 });
5131 fidl::decode!(
5132 i64,
5133 fidl::encoding::DefaultFuchsiaResourceDialect,
5134 val_ref,
5135 decoder,
5136 inner_offset,
5137 inner_depth
5138 )?;
5139 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5140 {
5141 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5142 }
5143 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5144 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5145 }
5146 }
5147
5148 next_offset += envelope_size;
5149 _next_ordinal_to_read += 1;
5150 if next_offset >= end_offset {
5151 return Ok(());
5152 }
5153
5154 while _next_ordinal_to_read < 2 {
5156 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5157 _next_ordinal_to_read += 1;
5158 next_offset += envelope_size;
5159 }
5160
5161 let next_out_of_line = decoder.next_out_of_line();
5162 let handles_before = decoder.remaining_handles();
5163 if let Some((inlined, num_bytes, num_handles)) =
5164 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5165 {
5166 let member_inline_size = <fidl::encoding::UnboundedVector<
5167 fidl::encoding::HandleType<
5168 fidl::Event,
5169 { fidl::ObjectType::EVENT.into_raw() },
5170 2147483648,
5171 >,
5172 > as fidl::encoding::TypeMarker>::inline_size(
5173 decoder.context
5174 );
5175 if inlined != (member_inline_size <= 4) {
5176 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5177 }
5178 let inner_offset;
5179 let mut inner_depth = depth.clone();
5180 if inlined {
5181 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5182 inner_offset = next_offset;
5183 } else {
5184 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5185 inner_depth.increment()?;
5186 }
5187 let val_ref = self.acquire_fences.get_or_insert_with(|| {
5188 fidl::new_empty!(
5189 fidl::encoding::UnboundedVector<
5190 fidl::encoding::HandleType<
5191 fidl::Event,
5192 { fidl::ObjectType::EVENT.into_raw() },
5193 2147483648,
5194 >,
5195 >,
5196 fidl::encoding::DefaultFuchsiaResourceDialect
5197 )
5198 });
5199 fidl::decode!(
5200 fidl::encoding::UnboundedVector<
5201 fidl::encoding::HandleType<
5202 fidl::Event,
5203 { fidl::ObjectType::EVENT.into_raw() },
5204 2147483648,
5205 >,
5206 >,
5207 fidl::encoding::DefaultFuchsiaResourceDialect,
5208 val_ref,
5209 decoder,
5210 inner_offset,
5211 inner_depth
5212 )?;
5213 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5214 {
5215 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5216 }
5217 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5218 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5219 }
5220 }
5221
5222 next_offset += envelope_size;
5223 _next_ordinal_to_read += 1;
5224 if next_offset >= end_offset {
5225 return Ok(());
5226 }
5227
5228 while _next_ordinal_to_read < 3 {
5230 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5231 _next_ordinal_to_read += 1;
5232 next_offset += envelope_size;
5233 }
5234
5235 let next_out_of_line = decoder.next_out_of_line();
5236 let handles_before = decoder.remaining_handles();
5237 if let Some((inlined, num_bytes, num_handles)) =
5238 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5239 {
5240 let member_inline_size = <fidl::encoding::UnboundedVector<
5241 fidl::encoding::HandleType<
5242 fidl::Event,
5243 { fidl::ObjectType::EVENT.into_raw() },
5244 2147483648,
5245 >,
5246 > as fidl::encoding::TypeMarker>::inline_size(
5247 decoder.context
5248 );
5249 if inlined != (member_inline_size <= 4) {
5250 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5251 }
5252 let inner_offset;
5253 let mut inner_depth = depth.clone();
5254 if inlined {
5255 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5256 inner_offset = next_offset;
5257 } else {
5258 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5259 inner_depth.increment()?;
5260 }
5261 let val_ref = self.release_fences.get_or_insert_with(|| {
5262 fidl::new_empty!(
5263 fidl::encoding::UnboundedVector<
5264 fidl::encoding::HandleType<
5265 fidl::Event,
5266 { fidl::ObjectType::EVENT.into_raw() },
5267 2147483648,
5268 >,
5269 >,
5270 fidl::encoding::DefaultFuchsiaResourceDialect
5271 )
5272 });
5273 fidl::decode!(
5274 fidl::encoding::UnboundedVector<
5275 fidl::encoding::HandleType<
5276 fidl::Event,
5277 { fidl::ObjectType::EVENT.into_raw() },
5278 2147483648,
5279 >,
5280 >,
5281 fidl::encoding::DefaultFuchsiaResourceDialect,
5282 val_ref,
5283 decoder,
5284 inner_offset,
5285 inner_depth
5286 )?;
5287 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5288 {
5289 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5290 }
5291 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5292 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5293 }
5294 }
5295
5296 next_offset += envelope_size;
5297 _next_ordinal_to_read += 1;
5298 if next_offset >= end_offset {
5299 return Ok(());
5300 }
5301
5302 while _next_ordinal_to_read < 4 {
5304 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5305 _next_ordinal_to_read += 1;
5306 next_offset += envelope_size;
5307 }
5308
5309 let next_out_of_line = decoder.next_out_of_line();
5310 let handles_before = decoder.remaining_handles();
5311 if let Some((inlined, num_bytes, num_handles)) =
5312 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5313 {
5314 let member_inline_size =
5315 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5316 if inlined != (member_inline_size <= 4) {
5317 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5318 }
5319 let inner_offset;
5320 let mut inner_depth = depth.clone();
5321 if inlined {
5322 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5323 inner_offset = next_offset;
5324 } else {
5325 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5326 inner_depth.increment()?;
5327 }
5328 let val_ref = self.requested_prediction_span.get_or_insert_with(|| {
5329 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
5330 });
5331 fidl::decode!(
5332 i64,
5333 fidl::encoding::DefaultFuchsiaResourceDialect,
5334 val_ref,
5335 decoder,
5336 inner_offset,
5337 inner_depth
5338 )?;
5339 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5340 {
5341 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5342 }
5343 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5344 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5345 }
5346 }
5347
5348 next_offset += envelope_size;
5349
5350 while next_offset < end_offset {
5352 _next_ordinal_to_read += 1;
5353 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5354 next_offset += envelope_size;
5355 }
5356
5357 Ok(())
5358 }
5359 }
5360
5361 impl SessionEndpoints {
5362 #[inline(always)]
5363 fn max_ordinal_present(&self) -> u64 {
5364 if let Some(_) = self.mouse_source {
5365 return 6;
5366 }
5367 if let Some(_) = self.touch_source {
5368 return 5;
5369 }
5370 if let Some(_) = self.view_ref_focused {
5371 return 4;
5372 }
5373 if let Some(_) = self.view_focuser {
5374 return 3;
5375 }
5376 if let Some(_) = self.session_listener {
5377 return 2;
5378 }
5379 if let Some(_) = self.session {
5380 return 1;
5381 }
5382 0
5383 }
5384 }
5385
5386 impl fidl::encoding::ResourceTypeMarker for SessionEndpoints {
5387 type Borrowed<'a> = &'a mut Self;
5388 fn take_or_borrow<'a>(
5389 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5390 ) -> Self::Borrowed<'a> {
5391 value
5392 }
5393 }
5394
5395 unsafe impl fidl::encoding::TypeMarker for SessionEndpoints {
5396 type Owned = Self;
5397
5398 #[inline(always)]
5399 fn inline_align(_context: fidl::encoding::Context) -> usize {
5400 8
5401 }
5402
5403 #[inline(always)]
5404 fn inline_size(_context: fidl::encoding::Context) -> usize {
5405 16
5406 }
5407 }
5408
5409 unsafe impl
5410 fidl::encoding::Encode<SessionEndpoints, fidl::encoding::DefaultFuchsiaResourceDialect>
5411 for &mut SessionEndpoints
5412 {
5413 unsafe fn encode(
5414 self,
5415 encoder: &mut fidl::encoding::Encoder<
5416 '_,
5417 fidl::encoding::DefaultFuchsiaResourceDialect,
5418 >,
5419 offset: usize,
5420 mut depth: fidl::encoding::Depth,
5421 ) -> fidl::Result<()> {
5422 encoder.debug_check_bounds::<SessionEndpoints>(offset);
5423 let max_ordinal: u64 = self.max_ordinal_present();
5425 encoder.write_num(max_ordinal, offset);
5426 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5427 if max_ordinal == 0 {
5429 return Ok(());
5430 }
5431 depth.increment()?;
5432 let envelope_size = 8;
5433 let bytes_len = max_ordinal as usize * envelope_size;
5434 #[allow(unused_variables)]
5435 let offset = encoder.out_of_line_offset(bytes_len);
5436 let mut _prev_end_offset: usize = 0;
5437 if 1 > max_ordinal {
5438 return Ok(());
5439 }
5440
5441 let cur_offset: usize = (1 - 1) * envelope_size;
5444
5445 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5447
5448 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5453 self.session.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5454 encoder, offset + cur_offset, depth
5455 )?;
5456
5457 _prev_end_offset = cur_offset + envelope_size;
5458 if 2 > max_ordinal {
5459 return Ok(());
5460 }
5461
5462 let cur_offset: usize = (2 - 1) * envelope_size;
5465
5466 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5468
5469 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5474 self.session_listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5475 encoder, offset + cur_offset, depth
5476 )?;
5477
5478 _prev_end_offset = cur_offset + envelope_size;
5479 if 3 > max_ordinal {
5480 return Ok(());
5481 }
5482
5483 let cur_offset: usize = (3 - 1) * envelope_size;
5486
5487 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5489
5490 fidl::encoding::encode_in_envelope_optional::<
5495 fidl::encoding::Endpoint<
5496 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
5497 >,
5498 fidl::encoding::DefaultFuchsiaResourceDialect,
5499 >(
5500 self.view_focuser.as_mut().map(
5501 <fidl::encoding::Endpoint<
5502 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
5503 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5504 ),
5505 encoder,
5506 offset + cur_offset,
5507 depth,
5508 )?;
5509
5510 _prev_end_offset = cur_offset + envelope_size;
5511 if 4 > max_ordinal {
5512 return Ok(());
5513 }
5514
5515 let cur_offset: usize = (4 - 1) * envelope_size;
5518
5519 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5521
5522 fidl::encoding::encode_in_envelope_optional::<
5527 fidl::encoding::Endpoint<
5528 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
5529 >,
5530 fidl::encoding::DefaultFuchsiaResourceDialect,
5531 >(
5532 self.view_ref_focused.as_mut().map(
5533 <fidl::encoding::Endpoint<
5534 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
5535 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5536 ),
5537 encoder,
5538 offset + cur_offset,
5539 depth,
5540 )?;
5541
5542 _prev_end_offset = cur_offset + envelope_size;
5543 if 5 > max_ordinal {
5544 return Ok(());
5545 }
5546
5547 let cur_offset: usize = (5 - 1) * envelope_size;
5550
5551 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5553
5554 fidl::encoding::encode_in_envelope_optional::<
5559 fidl::encoding::Endpoint<
5560 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
5561 >,
5562 fidl::encoding::DefaultFuchsiaResourceDialect,
5563 >(
5564 self.touch_source.as_mut().map(
5565 <fidl::encoding::Endpoint<
5566 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
5567 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5568 ),
5569 encoder,
5570 offset + cur_offset,
5571 depth,
5572 )?;
5573
5574 _prev_end_offset = cur_offset + envelope_size;
5575 if 6 > max_ordinal {
5576 return Ok(());
5577 }
5578
5579 let cur_offset: usize = (6 - 1) * envelope_size;
5582
5583 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5585
5586 fidl::encoding::encode_in_envelope_optional::<
5591 fidl::encoding::Endpoint<
5592 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
5593 >,
5594 fidl::encoding::DefaultFuchsiaResourceDialect,
5595 >(
5596 self.mouse_source.as_mut().map(
5597 <fidl::encoding::Endpoint<
5598 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
5599 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5600 ),
5601 encoder,
5602 offset + cur_offset,
5603 depth,
5604 )?;
5605
5606 _prev_end_offset = cur_offset + envelope_size;
5607
5608 Ok(())
5609 }
5610 }
5611
5612 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5613 for SessionEndpoints
5614 {
5615 #[inline(always)]
5616 fn new_empty() -> Self {
5617 Self::default()
5618 }
5619
5620 unsafe fn decode(
5621 &mut self,
5622 decoder: &mut fidl::encoding::Decoder<
5623 '_,
5624 fidl::encoding::DefaultFuchsiaResourceDialect,
5625 >,
5626 offset: usize,
5627 mut depth: fidl::encoding::Depth,
5628 ) -> fidl::Result<()> {
5629 decoder.debug_check_bounds::<Self>(offset);
5630 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5631 None => return Err(fidl::Error::NotNullable),
5632 Some(len) => len,
5633 };
5634 if len == 0 {
5636 return Ok(());
5637 };
5638 depth.increment()?;
5639 let envelope_size = 8;
5640 let bytes_len = len * envelope_size;
5641 let offset = decoder.out_of_line_offset(bytes_len)?;
5642 let mut _next_ordinal_to_read = 0;
5644 let mut next_offset = offset;
5645 let end_offset = offset + bytes_len;
5646 _next_ordinal_to_read += 1;
5647 if next_offset >= end_offset {
5648 return Ok(());
5649 }
5650
5651 while _next_ordinal_to_read < 1 {
5653 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5654 _next_ordinal_to_read += 1;
5655 next_offset += envelope_size;
5656 }
5657
5658 let next_out_of_line = decoder.next_out_of_line();
5659 let handles_before = decoder.remaining_handles();
5660 if let Some((inlined, num_bytes, num_handles)) =
5661 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5662 {
5663 let member_inline_size = <fidl::encoding::Endpoint<
5664 fidl::endpoints::ServerEnd<SessionMarker>,
5665 > as fidl::encoding::TypeMarker>::inline_size(
5666 decoder.context
5667 );
5668 if inlined != (member_inline_size <= 4) {
5669 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5670 }
5671 let inner_offset;
5672 let mut inner_depth = depth.clone();
5673 if inlined {
5674 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5675 inner_offset = next_offset;
5676 } else {
5677 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5678 inner_depth.increment()?;
5679 }
5680 let val_ref = self.session.get_or_insert_with(|| {
5681 fidl::new_empty!(
5682 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
5683 fidl::encoding::DefaultFuchsiaResourceDialect
5684 )
5685 });
5686 fidl::decode!(
5687 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
5688 fidl::encoding::DefaultFuchsiaResourceDialect,
5689 val_ref,
5690 decoder,
5691 inner_offset,
5692 inner_depth
5693 )?;
5694 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5695 {
5696 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5697 }
5698 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5699 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5700 }
5701 }
5702
5703 next_offset += envelope_size;
5704 _next_ordinal_to_read += 1;
5705 if next_offset >= end_offset {
5706 return Ok(());
5707 }
5708
5709 while _next_ordinal_to_read < 2 {
5711 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5712 _next_ordinal_to_read += 1;
5713 next_offset += envelope_size;
5714 }
5715
5716 let next_out_of_line = decoder.next_out_of_line();
5717 let handles_before = decoder.remaining_handles();
5718 if let Some((inlined, num_bytes, num_handles)) =
5719 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5720 {
5721 let member_inline_size = <fidl::encoding::Endpoint<
5722 fidl::endpoints::ClientEnd<SessionListenerMarker>,
5723 > as fidl::encoding::TypeMarker>::inline_size(
5724 decoder.context
5725 );
5726 if inlined != (member_inline_size <= 4) {
5727 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5728 }
5729 let inner_offset;
5730 let mut inner_depth = depth.clone();
5731 if inlined {
5732 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5733 inner_offset = next_offset;
5734 } else {
5735 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5736 inner_depth.increment()?;
5737 }
5738 let val_ref = self.session_listener.get_or_insert_with(|| {
5739 fidl::new_empty!(
5740 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
5741 fidl::encoding::DefaultFuchsiaResourceDialect
5742 )
5743 });
5744 fidl::decode!(
5745 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionListenerMarker>>,
5746 fidl::encoding::DefaultFuchsiaResourceDialect,
5747 val_ref,
5748 decoder,
5749 inner_offset,
5750 inner_depth
5751 )?;
5752 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5753 {
5754 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5755 }
5756 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5757 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5758 }
5759 }
5760
5761 next_offset += envelope_size;
5762 _next_ordinal_to_read += 1;
5763 if next_offset >= end_offset {
5764 return Ok(());
5765 }
5766
5767 while _next_ordinal_to_read < 3 {
5769 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5770 _next_ordinal_to_read += 1;
5771 next_offset += envelope_size;
5772 }
5773
5774 let next_out_of_line = decoder.next_out_of_line();
5775 let handles_before = decoder.remaining_handles();
5776 if let Some((inlined, num_bytes, num_handles)) =
5777 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5778 {
5779 let member_inline_size = <fidl::encoding::Endpoint<
5780 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
5781 > as fidl::encoding::TypeMarker>::inline_size(
5782 decoder.context
5783 );
5784 if inlined != (member_inline_size <= 4) {
5785 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5786 }
5787 let inner_offset;
5788 let mut inner_depth = depth.clone();
5789 if inlined {
5790 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5791 inner_offset = next_offset;
5792 } else {
5793 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5794 inner_depth.increment()?;
5795 }
5796 let val_ref = self.view_focuser.get_or_insert_with(|| {
5797 fidl::new_empty!(
5798 fidl::encoding::Endpoint<
5799 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
5800 >,
5801 fidl::encoding::DefaultFuchsiaResourceDialect
5802 )
5803 });
5804 fidl::decode!(
5805 fidl::encoding::Endpoint<
5806 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::FocuserMarker>,
5807 >,
5808 fidl::encoding::DefaultFuchsiaResourceDialect,
5809 val_ref,
5810 decoder,
5811 inner_offset,
5812 inner_depth
5813 )?;
5814 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5815 {
5816 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5817 }
5818 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5819 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5820 }
5821 }
5822
5823 next_offset += envelope_size;
5824 _next_ordinal_to_read += 1;
5825 if next_offset >= end_offset {
5826 return Ok(());
5827 }
5828
5829 while _next_ordinal_to_read < 4 {
5831 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5832 _next_ordinal_to_read += 1;
5833 next_offset += envelope_size;
5834 }
5835
5836 let next_out_of_line = decoder.next_out_of_line();
5837 let handles_before = decoder.remaining_handles();
5838 if let Some((inlined, num_bytes, num_handles)) =
5839 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5840 {
5841 let member_inline_size = <fidl::encoding::Endpoint<
5842 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
5843 > as fidl::encoding::TypeMarker>::inline_size(
5844 decoder.context
5845 );
5846 if inlined != (member_inline_size <= 4) {
5847 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5848 }
5849 let inner_offset;
5850 let mut inner_depth = depth.clone();
5851 if inlined {
5852 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5853 inner_offset = next_offset;
5854 } else {
5855 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5856 inner_depth.increment()?;
5857 }
5858 let val_ref = self.view_ref_focused.get_or_insert_with(|| {
5859 fidl::new_empty!(
5860 fidl::encoding::Endpoint<
5861 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
5862 >,
5863 fidl::encoding::DefaultFuchsiaResourceDialect
5864 )
5865 });
5866 fidl::decode!(
5867 fidl::encoding::Endpoint<
5868 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_views::ViewRefFocusedMarker>,
5869 >,
5870 fidl::encoding::DefaultFuchsiaResourceDialect,
5871 val_ref,
5872 decoder,
5873 inner_offset,
5874 inner_depth
5875 )?;
5876 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5877 {
5878 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5879 }
5880 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5881 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5882 }
5883 }
5884
5885 next_offset += envelope_size;
5886 _next_ordinal_to_read += 1;
5887 if next_offset >= end_offset {
5888 return Ok(());
5889 }
5890
5891 while _next_ordinal_to_read < 5 {
5893 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5894 _next_ordinal_to_read += 1;
5895 next_offset += envelope_size;
5896 }
5897
5898 let next_out_of_line = decoder.next_out_of_line();
5899 let handles_before = decoder.remaining_handles();
5900 if let Some((inlined, num_bytes, num_handles)) =
5901 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5902 {
5903 let member_inline_size = <fidl::encoding::Endpoint<
5904 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
5905 > as fidl::encoding::TypeMarker>::inline_size(
5906 decoder.context
5907 );
5908 if inlined != (member_inline_size <= 4) {
5909 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5910 }
5911 let inner_offset;
5912 let mut inner_depth = depth.clone();
5913 if inlined {
5914 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5915 inner_offset = next_offset;
5916 } else {
5917 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5918 inner_depth.increment()?;
5919 }
5920 let val_ref = self.touch_source.get_or_insert_with(|| {
5921 fidl::new_empty!(
5922 fidl::encoding::Endpoint<
5923 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
5924 >,
5925 fidl::encoding::DefaultFuchsiaResourceDialect
5926 )
5927 });
5928 fidl::decode!(
5929 fidl::encoding::Endpoint<
5930 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
5931 >,
5932 fidl::encoding::DefaultFuchsiaResourceDialect,
5933 val_ref,
5934 decoder,
5935 inner_offset,
5936 inner_depth
5937 )?;
5938 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5939 {
5940 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5941 }
5942 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5943 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5944 }
5945 }
5946
5947 next_offset += envelope_size;
5948 _next_ordinal_to_read += 1;
5949 if next_offset >= end_offset {
5950 return Ok(());
5951 }
5952
5953 while _next_ordinal_to_read < 6 {
5955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5956 _next_ordinal_to_read += 1;
5957 next_offset += envelope_size;
5958 }
5959
5960 let next_out_of_line = decoder.next_out_of_line();
5961 let handles_before = decoder.remaining_handles();
5962 if let Some((inlined, num_bytes, num_handles)) =
5963 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5964 {
5965 let member_inline_size = <fidl::encoding::Endpoint<
5966 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
5967 > as fidl::encoding::TypeMarker>::inline_size(
5968 decoder.context
5969 );
5970 if inlined != (member_inline_size <= 4) {
5971 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5972 }
5973 let inner_offset;
5974 let mut inner_depth = depth.clone();
5975 if inlined {
5976 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5977 inner_offset = next_offset;
5978 } else {
5979 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5980 inner_depth.increment()?;
5981 }
5982 let val_ref = self.mouse_source.get_or_insert_with(|| {
5983 fidl::new_empty!(
5984 fidl::encoding::Endpoint<
5985 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
5986 >,
5987 fidl::encoding::DefaultFuchsiaResourceDialect
5988 )
5989 });
5990 fidl::decode!(
5991 fidl::encoding::Endpoint<
5992 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
5993 >,
5994 fidl::encoding::DefaultFuchsiaResourceDialect,
5995 val_ref,
5996 decoder,
5997 inner_offset,
5998 inner_depth
5999 )?;
6000 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6001 {
6002 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6003 }
6004 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6005 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6006 }
6007 }
6008
6009 next_offset += envelope_size;
6010
6011 while next_offset < end_offset {
6013 _next_ordinal_to_read += 1;
6014 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6015 next_offset += envelope_size;
6016 }
6017
6018 Ok(())
6019 }
6020 }
6021
6022 impl fidl::encoding::ResourceTypeMarker for Command {
6023 type Borrowed<'a> = &'a mut Self;
6024 fn take_or_borrow<'a>(
6025 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6026 ) -> Self::Borrowed<'a> {
6027 value
6028 }
6029 }
6030
6031 unsafe impl fidl::encoding::TypeMarker for Command {
6032 type Owned = Self;
6033
6034 #[inline(always)]
6035 fn inline_align(_context: fidl::encoding::Context) -> usize {
6036 8
6037 }
6038
6039 #[inline(always)]
6040 fn inline_size(_context: fidl::encoding::Context) -> usize {
6041 16
6042 }
6043 }
6044
6045 unsafe impl fidl::encoding::Encode<Command, fidl::encoding::DefaultFuchsiaResourceDialect>
6046 for &mut Command
6047 {
6048 #[inline]
6049 unsafe fn encode(
6050 self,
6051 encoder: &mut fidl::encoding::Encoder<
6052 '_,
6053 fidl::encoding::DefaultFuchsiaResourceDialect,
6054 >,
6055 offset: usize,
6056 _depth: fidl::encoding::Depth,
6057 ) -> fidl::Result<()> {
6058 encoder.debug_check_bounds::<Command>(offset);
6059 encoder.write_num::<u64>(self.ordinal(), offset);
6060 match self {
6061 Command::Gfx(ref mut val) => {
6062 fidl::encoding::encode_in_envelope::<fidl_fuchsia_ui_gfx::Command, fidl::encoding::DefaultFuchsiaResourceDialect>(
6063 <fidl_fuchsia_ui_gfx::Command as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
6064 encoder, offset + 8, _depth
6065 )
6066 }
6067 Command::Views(ref val) => {
6068 fidl::encoding::encode_in_envelope::<fidl_fuchsia_ui_views::Command, fidl::encoding::DefaultFuchsiaResourceDialect>(
6069 <fidl_fuchsia_ui_views::Command as fidl::encoding::ValueTypeMarker>::borrow(val),
6070 encoder, offset + 8, _depth
6071 )
6072 }
6073 Command::Input(ref val) => {
6074 fidl::encoding::encode_in_envelope::<fidl_fuchsia_ui_input::Command, fidl::encoding::DefaultFuchsiaResourceDialect>(
6075 <fidl_fuchsia_ui_input::Command as fidl::encoding::ValueTypeMarker>::borrow(val),
6076 encoder, offset + 8, _depth
6077 )
6078 }
6079 }
6080 }
6081 }
6082
6083 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Command {
6084 #[inline(always)]
6085 fn new_empty() -> Self {
6086 Self::Gfx(fidl::new_empty!(
6087 fidl_fuchsia_ui_gfx::Command,
6088 fidl::encoding::DefaultFuchsiaResourceDialect
6089 ))
6090 }
6091
6092 #[inline]
6093 unsafe fn decode(
6094 &mut self,
6095 decoder: &mut fidl::encoding::Decoder<
6096 '_,
6097 fidl::encoding::DefaultFuchsiaResourceDialect,
6098 >,
6099 offset: usize,
6100 mut depth: fidl::encoding::Depth,
6101 ) -> fidl::Result<()> {
6102 decoder.debug_check_bounds::<Self>(offset);
6103 #[allow(unused_variables)]
6104 let next_out_of_line = decoder.next_out_of_line();
6105 let handles_before = decoder.remaining_handles();
6106 let (ordinal, inlined, num_bytes, num_handles) =
6107 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6108
6109 let member_inline_size = match ordinal {
6110 1 => <fidl_fuchsia_ui_gfx::Command as fidl::encoding::TypeMarker>::inline_size(
6111 decoder.context,
6112 ),
6113 3 => <fidl_fuchsia_ui_views::Command as fidl::encoding::TypeMarker>::inline_size(
6114 decoder.context,
6115 ),
6116 4 => <fidl_fuchsia_ui_input::Command as fidl::encoding::TypeMarker>::inline_size(
6117 decoder.context,
6118 ),
6119 _ => return Err(fidl::Error::UnknownUnionTag),
6120 };
6121
6122 if inlined != (member_inline_size <= 4) {
6123 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6124 }
6125 let _inner_offset;
6126 if inlined {
6127 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6128 _inner_offset = offset + 8;
6129 } else {
6130 depth.increment()?;
6131 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6132 }
6133 match ordinal {
6134 1 => {
6135 #[allow(irrefutable_let_patterns)]
6136 if let Command::Gfx(_) = self {
6137 } else {
6139 *self = Command::Gfx(fidl::new_empty!(
6141 fidl_fuchsia_ui_gfx::Command,
6142 fidl::encoding::DefaultFuchsiaResourceDialect
6143 ));
6144 }
6145 #[allow(irrefutable_let_patterns)]
6146 if let Command::Gfx(ref mut val) = self {
6147 fidl::decode!(
6148 fidl_fuchsia_ui_gfx::Command,
6149 fidl::encoding::DefaultFuchsiaResourceDialect,
6150 val,
6151 decoder,
6152 _inner_offset,
6153 depth
6154 )?;
6155 } else {
6156 unreachable!()
6157 }
6158 }
6159 3 => {
6160 #[allow(irrefutable_let_patterns)]
6161 if let Command::Views(_) = self {
6162 } else {
6164 *self = Command::Views(fidl::new_empty!(
6166 fidl_fuchsia_ui_views::Command,
6167 fidl::encoding::DefaultFuchsiaResourceDialect
6168 ));
6169 }
6170 #[allow(irrefutable_let_patterns)]
6171 if let Command::Views(ref mut val) = self {
6172 fidl::decode!(
6173 fidl_fuchsia_ui_views::Command,
6174 fidl::encoding::DefaultFuchsiaResourceDialect,
6175 val,
6176 decoder,
6177 _inner_offset,
6178 depth
6179 )?;
6180 } else {
6181 unreachable!()
6182 }
6183 }
6184 4 => {
6185 #[allow(irrefutable_let_patterns)]
6186 if let Command::Input(_) = self {
6187 } else {
6189 *self = Command::Input(fidl::new_empty!(
6191 fidl_fuchsia_ui_input::Command,
6192 fidl::encoding::DefaultFuchsiaResourceDialect
6193 ));
6194 }
6195 #[allow(irrefutable_let_patterns)]
6196 if let Command::Input(ref mut val) = self {
6197 fidl::decode!(
6198 fidl_fuchsia_ui_input::Command,
6199 fidl::encoding::DefaultFuchsiaResourceDialect,
6200 val,
6201 decoder,
6202 _inner_offset,
6203 depth
6204 )?;
6205 } else {
6206 unreachable!()
6207 }
6208 }
6209 ordinal => panic!("unexpected ordinal {:?}", ordinal),
6210 }
6211 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6212 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6213 }
6214 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6215 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6216 }
6217 Ok(())
6218 }
6219 }
6220
6221 impl fidl::encoding::ResourceTypeMarker for Event {
6222 type Borrowed<'a> = &'a mut Self;
6223 fn take_or_borrow<'a>(
6224 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6225 ) -> Self::Borrowed<'a> {
6226 value
6227 }
6228 }
6229
6230 unsafe impl fidl::encoding::TypeMarker for Event {
6231 type Owned = Self;
6232
6233 #[inline(always)]
6234 fn inline_align(_context: fidl::encoding::Context) -> usize {
6235 8
6236 }
6237
6238 #[inline(always)]
6239 fn inline_size(_context: fidl::encoding::Context) -> usize {
6240 16
6241 }
6242 }
6243
6244 unsafe impl fidl::encoding::Encode<Event, fidl::encoding::DefaultFuchsiaResourceDialect>
6245 for &mut Event
6246 {
6247 #[inline]
6248 unsafe fn encode(
6249 self,
6250 encoder: &mut fidl::encoding::Encoder<
6251 '_,
6252 fidl::encoding::DefaultFuchsiaResourceDialect,
6253 >,
6254 offset: usize,
6255 _depth: fidl::encoding::Depth,
6256 ) -> fidl::Result<()> {
6257 encoder.debug_check_bounds::<Event>(offset);
6258 encoder.write_num::<u64>(self.ordinal(), offset);
6259 match self {
6260 Event::Gfx(ref val) => fidl::encoding::encode_in_envelope::<
6261 fidl_fuchsia_ui_gfx::Event,
6262 fidl::encoding::DefaultFuchsiaResourceDialect,
6263 >(
6264 <fidl_fuchsia_ui_gfx::Event as fidl::encoding::ValueTypeMarker>::borrow(val),
6265 encoder,
6266 offset + 8,
6267 _depth,
6268 ),
6269 Event::Input(ref val) => fidl::encoding::encode_in_envelope::<
6270 fidl_fuchsia_ui_input::InputEvent,
6271 fidl::encoding::DefaultFuchsiaResourceDialect,
6272 >(
6273 <fidl_fuchsia_ui_input::InputEvent as fidl::encoding::ValueTypeMarker>::borrow(
6274 val,
6275 ),
6276 encoder,
6277 offset + 8,
6278 _depth,
6279 ),
6280 Event::Unhandled(ref mut val) => fidl::encoding::encode_in_envelope::<
6281 Command,
6282 fidl::encoding::DefaultFuchsiaResourceDialect,
6283 >(
6284 <Command as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
6285 encoder,
6286 offset + 8,
6287 _depth,
6288 ),
6289 }
6290 }
6291 }
6292
6293 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Event {
6294 #[inline(always)]
6295 fn new_empty() -> Self {
6296 Self::Gfx(fidl::new_empty!(
6297 fidl_fuchsia_ui_gfx::Event,
6298 fidl::encoding::DefaultFuchsiaResourceDialect
6299 ))
6300 }
6301
6302 #[inline]
6303 unsafe fn decode(
6304 &mut self,
6305 decoder: &mut fidl::encoding::Decoder<
6306 '_,
6307 fidl::encoding::DefaultFuchsiaResourceDialect,
6308 >,
6309 offset: usize,
6310 mut depth: fidl::encoding::Depth,
6311 ) -> fidl::Result<()> {
6312 decoder.debug_check_bounds::<Self>(offset);
6313 #[allow(unused_variables)]
6314 let next_out_of_line = decoder.next_out_of_line();
6315 let handles_before = decoder.remaining_handles();
6316 let (ordinal, inlined, num_bytes, num_handles) =
6317 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6318
6319 let member_inline_size = match ordinal {
6320 1 => <fidl_fuchsia_ui_gfx::Event as fidl::encoding::TypeMarker>::inline_size(
6321 decoder.context,
6322 ),
6323 2 => {
6324 <fidl_fuchsia_ui_input::InputEvent as fidl::encoding::TypeMarker>::inline_size(
6325 decoder.context,
6326 )
6327 }
6328 3 => <Command as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6329 _ => return Err(fidl::Error::UnknownUnionTag),
6330 };
6331
6332 if inlined != (member_inline_size <= 4) {
6333 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6334 }
6335 let _inner_offset;
6336 if inlined {
6337 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6338 _inner_offset = offset + 8;
6339 } else {
6340 depth.increment()?;
6341 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6342 }
6343 match ordinal {
6344 1 => {
6345 #[allow(irrefutable_let_patterns)]
6346 if let Event::Gfx(_) = self {
6347 } else {
6349 *self = Event::Gfx(fidl::new_empty!(
6351 fidl_fuchsia_ui_gfx::Event,
6352 fidl::encoding::DefaultFuchsiaResourceDialect
6353 ));
6354 }
6355 #[allow(irrefutable_let_patterns)]
6356 if let Event::Gfx(ref mut val) = self {
6357 fidl::decode!(
6358 fidl_fuchsia_ui_gfx::Event,
6359 fidl::encoding::DefaultFuchsiaResourceDialect,
6360 val,
6361 decoder,
6362 _inner_offset,
6363 depth
6364 )?;
6365 } else {
6366 unreachable!()
6367 }
6368 }
6369 2 => {
6370 #[allow(irrefutable_let_patterns)]
6371 if let Event::Input(_) = self {
6372 } else {
6374 *self = Event::Input(fidl::new_empty!(
6376 fidl_fuchsia_ui_input::InputEvent,
6377 fidl::encoding::DefaultFuchsiaResourceDialect
6378 ));
6379 }
6380 #[allow(irrefutable_let_patterns)]
6381 if let Event::Input(ref mut val) = self {
6382 fidl::decode!(
6383 fidl_fuchsia_ui_input::InputEvent,
6384 fidl::encoding::DefaultFuchsiaResourceDialect,
6385 val,
6386 decoder,
6387 _inner_offset,
6388 depth
6389 )?;
6390 } else {
6391 unreachable!()
6392 }
6393 }
6394 3 => {
6395 #[allow(irrefutable_let_patterns)]
6396 if let Event::Unhandled(_) = self {
6397 } else {
6399 *self = Event::Unhandled(fidl::new_empty!(
6401 Command,
6402 fidl::encoding::DefaultFuchsiaResourceDialect
6403 ));
6404 }
6405 #[allow(irrefutable_let_patterns)]
6406 if let Event::Unhandled(ref mut val) = self {
6407 fidl::decode!(
6408 Command,
6409 fidl::encoding::DefaultFuchsiaResourceDialect,
6410 val,
6411 decoder,
6412 _inner_offset,
6413 depth
6414 )?;
6415 } else {
6416 unreachable!()
6417 }
6418 }
6419 ordinal => panic!("unexpected ordinal {:?}", ordinal),
6420 }
6421 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6422 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6423 }
6424 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6425 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6426 }
6427 Ok(())
6428 }
6429 }
6430}