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