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_composition_internal_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DisplayOwnershipGetEventResponse {
16 pub ownership_event: fidl::Event,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for DisplayOwnershipGetEventResponse
21{
22}
23
24#[derive(Debug, Default, PartialEq)]
28pub struct FrameInfo {
29 pub buffer_index: Option<u32>,
32 pub capture_timestamp: Option<i64>,
34 pub buffer_release_token: Option<fidl::EventPair>,
43 #[doc(hidden)]
44 pub __source_breaking: fidl::marker::SourceBreaking,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {}
48
49#[derive(Debug, Default, PartialEq)]
52pub struct ScreenCaptureConfig {
53 pub import_token: Option<fidl_fuchsia_ui_composition::BufferCollectionImportToken>,
57 pub image_size: Option<fidl_fuchsia_math::SizeU>,
62 pub image_rotation: Option<ScreenCaptureRotation>,
66 #[doc(hidden)]
67 pub __source_breaking: fidl::marker::SourceBreaking,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ScreenCaptureConfig {}
71
72#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
73pub struct DisplayOwnershipMarker;
74
75impl fidl::endpoints::ProtocolMarker for DisplayOwnershipMarker {
76 type Proxy = DisplayOwnershipProxy;
77 type RequestStream = DisplayOwnershipRequestStream;
78 #[cfg(target_os = "fuchsia")]
79 type SynchronousProxy = DisplayOwnershipSynchronousProxy;
80
81 const DEBUG_NAME: &'static str = "fuchsia.ui.composition.internal.DisplayOwnership";
82}
83impl fidl::endpoints::DiscoverableProtocolMarker for DisplayOwnershipMarker {}
84
85pub trait DisplayOwnershipProxyInterface: Send + Sync {
86 type GetEventResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>> + Send;
87 fn r#get_event(&self) -> Self::GetEventResponseFut;
88}
89#[derive(Debug)]
90#[cfg(target_os = "fuchsia")]
91pub struct DisplayOwnershipSynchronousProxy {
92 client: fidl::client::sync::Client,
93}
94
95#[cfg(target_os = "fuchsia")]
96impl fidl::endpoints::SynchronousProxy for DisplayOwnershipSynchronousProxy {
97 type Proxy = DisplayOwnershipProxy;
98 type Protocol = DisplayOwnershipMarker;
99
100 fn from_channel(inner: fidl::Channel) -> Self {
101 Self::new(inner)
102 }
103
104 fn into_channel(self) -> fidl::Channel {
105 self.client.into_channel()
106 }
107
108 fn as_channel(&self) -> &fidl::Channel {
109 self.client.as_channel()
110 }
111}
112
113#[cfg(target_os = "fuchsia")]
114impl DisplayOwnershipSynchronousProxy {
115 pub fn new(channel: fidl::Channel) -> Self {
116 let protocol_name = <DisplayOwnershipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
117 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
118 }
119
120 pub fn into_channel(self) -> fidl::Channel {
121 self.client.into_channel()
122 }
123
124 pub fn wait_for_event(
127 &self,
128 deadline: zx::MonotonicInstant,
129 ) -> Result<DisplayOwnershipEvent, fidl::Error> {
130 DisplayOwnershipEvent::decode(self.client.wait_for_event(deadline)?)
131 }
132
133 pub fn r#get_event(
136 &self,
137 ___deadline: zx::MonotonicInstant,
138 ) -> Result<fidl::Event, fidl::Error> {
139 let _response = self
140 .client
141 .send_query::<fidl::encoding::EmptyPayload, DisplayOwnershipGetEventResponse>(
142 (),
143 0x2dc713e7b367312f,
144 fidl::encoding::DynamicFlags::empty(),
145 ___deadline,
146 )?;
147 Ok(_response.ownership_event)
148 }
149}
150
151#[cfg(target_os = "fuchsia")]
152impl From<DisplayOwnershipSynchronousProxy> for zx::Handle {
153 fn from(value: DisplayOwnershipSynchronousProxy) -> Self {
154 value.into_channel().into()
155 }
156}
157
158#[cfg(target_os = "fuchsia")]
159impl From<fidl::Channel> for DisplayOwnershipSynchronousProxy {
160 fn from(value: fidl::Channel) -> Self {
161 Self::new(value)
162 }
163}
164
165#[derive(Debug, Clone)]
166pub struct DisplayOwnershipProxy {
167 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
168}
169
170impl fidl::endpoints::Proxy for DisplayOwnershipProxy {
171 type Protocol = DisplayOwnershipMarker;
172
173 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
174 Self::new(inner)
175 }
176
177 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
178 self.client.into_channel().map_err(|client| Self { client })
179 }
180
181 fn as_channel(&self) -> &::fidl::AsyncChannel {
182 self.client.as_channel()
183 }
184}
185
186impl DisplayOwnershipProxy {
187 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
189 let protocol_name = <DisplayOwnershipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
190 Self { client: fidl::client::Client::new(channel, protocol_name) }
191 }
192
193 pub fn take_event_stream(&self) -> DisplayOwnershipEventStream {
199 DisplayOwnershipEventStream { event_receiver: self.client.take_event_receiver() }
200 }
201
202 pub fn r#get_event(
205 &self,
206 ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
207 {
208 DisplayOwnershipProxyInterface::r#get_event(self)
209 }
210}
211
212impl DisplayOwnershipProxyInterface for DisplayOwnershipProxy {
213 type GetEventResponseFut =
214 fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
215 fn r#get_event(&self) -> Self::GetEventResponseFut {
216 fn _decode(
217 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
218 ) -> Result<fidl::Event, fidl::Error> {
219 let _response = fidl::client::decode_transaction_body::<
220 DisplayOwnershipGetEventResponse,
221 fidl::encoding::DefaultFuchsiaResourceDialect,
222 0x2dc713e7b367312f,
223 >(_buf?)?;
224 Ok(_response.ownership_event)
225 }
226 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Event>(
227 (),
228 0x2dc713e7b367312f,
229 fidl::encoding::DynamicFlags::empty(),
230 _decode,
231 )
232 }
233}
234
235pub struct DisplayOwnershipEventStream {
236 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
237}
238
239impl std::marker::Unpin for DisplayOwnershipEventStream {}
240
241impl futures::stream::FusedStream for DisplayOwnershipEventStream {
242 fn is_terminated(&self) -> bool {
243 self.event_receiver.is_terminated()
244 }
245}
246
247impl futures::Stream for DisplayOwnershipEventStream {
248 type Item = Result<DisplayOwnershipEvent, fidl::Error>;
249
250 fn poll_next(
251 mut self: std::pin::Pin<&mut Self>,
252 cx: &mut std::task::Context<'_>,
253 ) -> std::task::Poll<Option<Self::Item>> {
254 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
255 &mut self.event_receiver,
256 cx
257 )?) {
258 Some(buf) => std::task::Poll::Ready(Some(DisplayOwnershipEvent::decode(buf))),
259 None => std::task::Poll::Ready(None),
260 }
261 }
262}
263
264#[derive(Debug)]
265pub enum DisplayOwnershipEvent {}
266
267impl DisplayOwnershipEvent {
268 fn decode(
270 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
271 ) -> Result<DisplayOwnershipEvent, fidl::Error> {
272 let (bytes, _handles) = buf.split_mut();
273 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
274 debug_assert_eq!(tx_header.tx_id, 0);
275 match tx_header.ordinal {
276 _ => Err(fidl::Error::UnknownOrdinal {
277 ordinal: tx_header.ordinal,
278 protocol_name:
279 <DisplayOwnershipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
280 }),
281 }
282 }
283}
284
285pub struct DisplayOwnershipRequestStream {
287 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
288 is_terminated: bool,
289}
290
291impl std::marker::Unpin for DisplayOwnershipRequestStream {}
292
293impl futures::stream::FusedStream for DisplayOwnershipRequestStream {
294 fn is_terminated(&self) -> bool {
295 self.is_terminated
296 }
297}
298
299impl fidl::endpoints::RequestStream for DisplayOwnershipRequestStream {
300 type Protocol = DisplayOwnershipMarker;
301 type ControlHandle = DisplayOwnershipControlHandle;
302
303 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
304 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
305 }
306
307 fn control_handle(&self) -> Self::ControlHandle {
308 DisplayOwnershipControlHandle { inner: self.inner.clone() }
309 }
310
311 fn into_inner(
312 self,
313 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
314 {
315 (self.inner, self.is_terminated)
316 }
317
318 fn from_inner(
319 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
320 is_terminated: bool,
321 ) -> Self {
322 Self { inner, is_terminated }
323 }
324}
325
326impl futures::Stream for DisplayOwnershipRequestStream {
327 type Item = Result<DisplayOwnershipRequest, fidl::Error>;
328
329 fn poll_next(
330 mut self: std::pin::Pin<&mut Self>,
331 cx: &mut std::task::Context<'_>,
332 ) -> std::task::Poll<Option<Self::Item>> {
333 let this = &mut *self;
334 if this.inner.check_shutdown(cx) {
335 this.is_terminated = true;
336 return std::task::Poll::Ready(None);
337 }
338 if this.is_terminated {
339 panic!("polled DisplayOwnershipRequestStream after completion");
340 }
341 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
342 |bytes, handles| {
343 match this.inner.channel().read_etc(cx, bytes, handles) {
344 std::task::Poll::Ready(Ok(())) => {}
345 std::task::Poll::Pending => return std::task::Poll::Pending,
346 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
347 this.is_terminated = true;
348 return std::task::Poll::Ready(None);
349 }
350 std::task::Poll::Ready(Err(e)) => {
351 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
352 e.into(),
353 ))))
354 }
355 }
356
357 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
359
360 std::task::Poll::Ready(Some(match header.ordinal {
361 0x2dc713e7b367312f => {
362 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
363 let mut req = fidl::new_empty!(
364 fidl::encoding::EmptyPayload,
365 fidl::encoding::DefaultFuchsiaResourceDialect
366 );
367 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
368 let control_handle =
369 DisplayOwnershipControlHandle { inner: this.inner.clone() };
370 Ok(DisplayOwnershipRequest::GetEvent {
371 responder: DisplayOwnershipGetEventResponder {
372 control_handle: std::mem::ManuallyDrop::new(control_handle),
373 tx_id: header.tx_id,
374 },
375 })
376 }
377 _ => Err(fidl::Error::UnknownOrdinal {
378 ordinal: header.ordinal,
379 protocol_name:
380 <DisplayOwnershipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
381 }),
382 }))
383 },
384 )
385 }
386}
387
388#[derive(Debug)]
390pub enum DisplayOwnershipRequest {
391 GetEvent { responder: DisplayOwnershipGetEventResponder },
394}
395
396impl DisplayOwnershipRequest {
397 #[allow(irrefutable_let_patterns)]
398 pub fn into_get_event(self) -> Option<(DisplayOwnershipGetEventResponder)> {
399 if let DisplayOwnershipRequest::GetEvent { responder } = self {
400 Some((responder))
401 } else {
402 None
403 }
404 }
405
406 pub fn method_name(&self) -> &'static str {
408 match *self {
409 DisplayOwnershipRequest::GetEvent { .. } => "get_event",
410 }
411 }
412}
413
414#[derive(Debug, Clone)]
415pub struct DisplayOwnershipControlHandle {
416 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
417}
418
419impl fidl::endpoints::ControlHandle for DisplayOwnershipControlHandle {
420 fn shutdown(&self) {
421 self.inner.shutdown()
422 }
423 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
424 self.inner.shutdown_with_epitaph(status)
425 }
426
427 fn is_closed(&self) -> bool {
428 self.inner.channel().is_closed()
429 }
430 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
431 self.inner.channel().on_closed()
432 }
433
434 #[cfg(target_os = "fuchsia")]
435 fn signal_peer(
436 &self,
437 clear_mask: zx::Signals,
438 set_mask: zx::Signals,
439 ) -> Result<(), zx_status::Status> {
440 use fidl::Peered;
441 self.inner.channel().signal_peer(clear_mask, set_mask)
442 }
443}
444
445impl DisplayOwnershipControlHandle {}
446
447#[must_use = "FIDL methods require a response to be sent"]
448#[derive(Debug)]
449pub struct DisplayOwnershipGetEventResponder {
450 control_handle: std::mem::ManuallyDrop<DisplayOwnershipControlHandle>,
451 tx_id: u32,
452}
453
454impl std::ops::Drop for DisplayOwnershipGetEventResponder {
458 fn drop(&mut self) {
459 self.control_handle.shutdown();
460 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
462 }
463}
464
465impl fidl::endpoints::Responder for DisplayOwnershipGetEventResponder {
466 type ControlHandle = DisplayOwnershipControlHandle;
467
468 fn control_handle(&self) -> &DisplayOwnershipControlHandle {
469 &self.control_handle
470 }
471
472 fn drop_without_shutdown(mut self) {
473 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
475 std::mem::forget(self);
477 }
478}
479
480impl DisplayOwnershipGetEventResponder {
481 pub fn send(self, mut ownership_event: fidl::Event) -> Result<(), fidl::Error> {
485 let _result = self.send_raw(ownership_event);
486 if _result.is_err() {
487 self.control_handle.shutdown();
488 }
489 self.drop_without_shutdown();
490 _result
491 }
492
493 pub fn send_no_shutdown_on_err(
495 self,
496 mut ownership_event: fidl::Event,
497 ) -> Result<(), fidl::Error> {
498 let _result = self.send_raw(ownership_event);
499 self.drop_without_shutdown();
500 _result
501 }
502
503 fn send_raw(&self, mut ownership_event: fidl::Event) -> Result<(), fidl::Error> {
504 self.control_handle.inner.send::<DisplayOwnershipGetEventResponse>(
505 (ownership_event,),
506 self.tx_id,
507 0x2dc713e7b367312f,
508 fidl::encoding::DynamicFlags::empty(),
509 )
510 }
511}
512
513#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
514pub struct ScreenCaptureMarker;
515
516impl fidl::endpoints::ProtocolMarker for ScreenCaptureMarker {
517 type Proxy = ScreenCaptureProxy;
518 type RequestStream = ScreenCaptureRequestStream;
519 #[cfg(target_os = "fuchsia")]
520 type SynchronousProxy = ScreenCaptureSynchronousProxy;
521
522 const DEBUG_NAME: &'static str = "fuchsia.ui.composition.internal.ScreenCapture";
523}
524impl fidl::endpoints::DiscoverableProtocolMarker for ScreenCaptureMarker {}
525pub type ScreenCaptureConfigureResult = Result<(), ScreenCaptureError>;
526pub type ScreenCaptureGetNextFrameResult = Result<FrameInfo, ScreenCaptureError>;
527
528pub trait ScreenCaptureProxyInterface: Send + Sync {
529 type ConfigureResponseFut: std::future::Future<Output = Result<ScreenCaptureConfigureResult, fidl::Error>>
530 + Send;
531 fn r#configure(&self, payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut;
532 type GetNextFrameResponseFut: std::future::Future<Output = Result<ScreenCaptureGetNextFrameResult, fidl::Error>>
533 + Send;
534 fn r#get_next_frame(&self) -> Self::GetNextFrameResponseFut;
535}
536#[derive(Debug)]
537#[cfg(target_os = "fuchsia")]
538pub struct ScreenCaptureSynchronousProxy {
539 client: fidl::client::sync::Client,
540}
541
542#[cfg(target_os = "fuchsia")]
543impl fidl::endpoints::SynchronousProxy for ScreenCaptureSynchronousProxy {
544 type Proxy = ScreenCaptureProxy;
545 type Protocol = ScreenCaptureMarker;
546
547 fn from_channel(inner: fidl::Channel) -> Self {
548 Self::new(inner)
549 }
550
551 fn into_channel(self) -> fidl::Channel {
552 self.client.into_channel()
553 }
554
555 fn as_channel(&self) -> &fidl::Channel {
556 self.client.as_channel()
557 }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl ScreenCaptureSynchronousProxy {
562 pub fn new(channel: fidl::Channel) -> Self {
563 let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
564 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
565 }
566
567 pub fn into_channel(self) -> fidl::Channel {
568 self.client.into_channel()
569 }
570
571 pub fn wait_for_event(
574 &self,
575 deadline: zx::MonotonicInstant,
576 ) -> Result<ScreenCaptureEvent, fidl::Error> {
577 ScreenCaptureEvent::decode(self.client.wait_for_event(deadline)?)
578 }
579
580 pub fn r#configure(
588 &self,
589 mut payload: ScreenCaptureConfig,
590 ___deadline: zx::MonotonicInstant,
591 ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
592 let _response = self.client.send_query::<ScreenCaptureConfig, fidl::encoding::ResultType<
593 fidl::encoding::EmptyStruct,
594 ScreenCaptureError,
595 >>(
596 &mut payload,
597 0x5d07582dc93862a2,
598 fidl::encoding::DynamicFlags::empty(),
599 ___deadline,
600 )?;
601 Ok(_response.map(|x| x))
602 }
603
604 pub fn r#get_next_frame(
619 &self,
620 ___deadline: zx::MonotonicInstant,
621 ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
622 let _response = self.client.send_query::<
623 fidl::encoding::EmptyPayload,
624 fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
625 >(
626 (),
627 0x48680722eab7103,
628 fidl::encoding::DynamicFlags::empty(),
629 ___deadline,
630 )?;
631 Ok(_response.map(|x| x))
632 }
633}
634
635#[cfg(target_os = "fuchsia")]
636impl From<ScreenCaptureSynchronousProxy> for zx::Handle {
637 fn from(value: ScreenCaptureSynchronousProxy) -> Self {
638 value.into_channel().into()
639 }
640}
641
642#[cfg(target_os = "fuchsia")]
643impl From<fidl::Channel> for ScreenCaptureSynchronousProxy {
644 fn from(value: fidl::Channel) -> Self {
645 Self::new(value)
646 }
647}
648
649#[derive(Debug, Clone)]
650pub struct ScreenCaptureProxy {
651 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
652}
653
654impl fidl::endpoints::Proxy for ScreenCaptureProxy {
655 type Protocol = ScreenCaptureMarker;
656
657 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
658 Self::new(inner)
659 }
660
661 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
662 self.client.into_channel().map_err(|client| Self { client })
663 }
664
665 fn as_channel(&self) -> &::fidl::AsyncChannel {
666 self.client.as_channel()
667 }
668}
669
670impl ScreenCaptureProxy {
671 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
673 let protocol_name = <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
674 Self { client: fidl::client::Client::new(channel, protocol_name) }
675 }
676
677 pub fn take_event_stream(&self) -> ScreenCaptureEventStream {
683 ScreenCaptureEventStream { event_receiver: self.client.take_event_receiver() }
684 }
685
686 pub fn r#configure(
694 &self,
695 mut payload: ScreenCaptureConfig,
696 ) -> fidl::client::QueryResponseFut<
697 ScreenCaptureConfigureResult,
698 fidl::encoding::DefaultFuchsiaResourceDialect,
699 > {
700 ScreenCaptureProxyInterface::r#configure(self, payload)
701 }
702
703 pub fn r#get_next_frame(
718 &self,
719 ) -> fidl::client::QueryResponseFut<
720 ScreenCaptureGetNextFrameResult,
721 fidl::encoding::DefaultFuchsiaResourceDialect,
722 > {
723 ScreenCaptureProxyInterface::r#get_next_frame(self)
724 }
725}
726
727impl ScreenCaptureProxyInterface for ScreenCaptureProxy {
728 type ConfigureResponseFut = fidl::client::QueryResponseFut<
729 ScreenCaptureConfigureResult,
730 fidl::encoding::DefaultFuchsiaResourceDialect,
731 >;
732 fn r#configure(&self, mut payload: ScreenCaptureConfig) -> Self::ConfigureResponseFut {
733 fn _decode(
734 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
735 ) -> Result<ScreenCaptureConfigureResult, fidl::Error> {
736 let _response = fidl::client::decode_transaction_body::<
737 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ScreenCaptureError>,
738 fidl::encoding::DefaultFuchsiaResourceDialect,
739 0x5d07582dc93862a2,
740 >(_buf?)?;
741 Ok(_response.map(|x| x))
742 }
743 self.client.send_query_and_decode::<ScreenCaptureConfig, ScreenCaptureConfigureResult>(
744 &mut payload,
745 0x5d07582dc93862a2,
746 fidl::encoding::DynamicFlags::empty(),
747 _decode,
748 )
749 }
750
751 type GetNextFrameResponseFut = fidl::client::QueryResponseFut<
752 ScreenCaptureGetNextFrameResult,
753 fidl::encoding::DefaultFuchsiaResourceDialect,
754 >;
755 fn r#get_next_frame(&self) -> Self::GetNextFrameResponseFut {
756 fn _decode(
757 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
758 ) -> Result<ScreenCaptureGetNextFrameResult, fidl::Error> {
759 let _response = fidl::client::decode_transaction_body::<
760 fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>,
761 fidl::encoding::DefaultFuchsiaResourceDialect,
762 0x48680722eab7103,
763 >(_buf?)?;
764 Ok(_response.map(|x| x))
765 }
766 self.client
767 .send_query_and_decode::<fidl::encoding::EmptyPayload, ScreenCaptureGetNextFrameResult>(
768 (),
769 0x48680722eab7103,
770 fidl::encoding::DynamicFlags::empty(),
771 _decode,
772 )
773 }
774}
775
776pub struct ScreenCaptureEventStream {
777 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
778}
779
780impl std::marker::Unpin for ScreenCaptureEventStream {}
781
782impl futures::stream::FusedStream for ScreenCaptureEventStream {
783 fn is_terminated(&self) -> bool {
784 self.event_receiver.is_terminated()
785 }
786}
787
788impl futures::Stream for ScreenCaptureEventStream {
789 type Item = Result<ScreenCaptureEvent, fidl::Error>;
790
791 fn poll_next(
792 mut self: std::pin::Pin<&mut Self>,
793 cx: &mut std::task::Context<'_>,
794 ) -> std::task::Poll<Option<Self::Item>> {
795 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
796 &mut self.event_receiver,
797 cx
798 )?) {
799 Some(buf) => std::task::Poll::Ready(Some(ScreenCaptureEvent::decode(buf))),
800 None => std::task::Poll::Ready(None),
801 }
802 }
803}
804
805#[derive(Debug)]
806pub enum ScreenCaptureEvent {}
807
808impl ScreenCaptureEvent {
809 fn decode(
811 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
812 ) -> Result<ScreenCaptureEvent, fidl::Error> {
813 let (bytes, _handles) = buf.split_mut();
814 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
815 debug_assert_eq!(tx_header.tx_id, 0);
816 match tx_header.ordinal {
817 _ => Err(fidl::Error::UnknownOrdinal {
818 ordinal: tx_header.ordinal,
819 protocol_name: <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
820 }),
821 }
822 }
823}
824
825pub struct ScreenCaptureRequestStream {
827 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
828 is_terminated: bool,
829}
830
831impl std::marker::Unpin for ScreenCaptureRequestStream {}
832
833impl futures::stream::FusedStream for ScreenCaptureRequestStream {
834 fn is_terminated(&self) -> bool {
835 self.is_terminated
836 }
837}
838
839impl fidl::endpoints::RequestStream for ScreenCaptureRequestStream {
840 type Protocol = ScreenCaptureMarker;
841 type ControlHandle = ScreenCaptureControlHandle;
842
843 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
844 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
845 }
846
847 fn control_handle(&self) -> Self::ControlHandle {
848 ScreenCaptureControlHandle { inner: self.inner.clone() }
849 }
850
851 fn into_inner(
852 self,
853 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
854 {
855 (self.inner, self.is_terminated)
856 }
857
858 fn from_inner(
859 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
860 is_terminated: bool,
861 ) -> Self {
862 Self { inner, is_terminated }
863 }
864}
865
866impl futures::Stream for ScreenCaptureRequestStream {
867 type Item = Result<ScreenCaptureRequest, fidl::Error>;
868
869 fn poll_next(
870 mut self: std::pin::Pin<&mut Self>,
871 cx: &mut std::task::Context<'_>,
872 ) -> std::task::Poll<Option<Self::Item>> {
873 let this = &mut *self;
874 if this.inner.check_shutdown(cx) {
875 this.is_terminated = true;
876 return std::task::Poll::Ready(None);
877 }
878 if this.is_terminated {
879 panic!("polled ScreenCaptureRequestStream after completion");
880 }
881 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
882 |bytes, handles| {
883 match this.inner.channel().read_etc(cx, bytes, handles) {
884 std::task::Poll::Ready(Ok(())) => {}
885 std::task::Poll::Pending => return std::task::Poll::Pending,
886 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
887 this.is_terminated = true;
888 return std::task::Poll::Ready(None);
889 }
890 std::task::Poll::Ready(Err(e)) => {
891 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
892 e.into(),
893 ))))
894 }
895 }
896
897 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
899
900 std::task::Poll::Ready(Some(match header.ordinal {
901 0x5d07582dc93862a2 => {
902 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
903 let mut req = fidl::new_empty!(
904 ScreenCaptureConfig,
905 fidl::encoding::DefaultFuchsiaResourceDialect
906 );
907 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScreenCaptureConfig>(&header, _body_bytes, handles, &mut req)?;
908 let control_handle =
909 ScreenCaptureControlHandle { inner: this.inner.clone() };
910 Ok(ScreenCaptureRequest::Configure {
911 payload: req,
912 responder: ScreenCaptureConfigureResponder {
913 control_handle: std::mem::ManuallyDrop::new(control_handle),
914 tx_id: header.tx_id,
915 },
916 })
917 }
918 0x48680722eab7103 => {
919 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
920 let mut req = fidl::new_empty!(
921 fidl::encoding::EmptyPayload,
922 fidl::encoding::DefaultFuchsiaResourceDialect
923 );
924 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
925 let control_handle =
926 ScreenCaptureControlHandle { inner: this.inner.clone() };
927 Ok(ScreenCaptureRequest::GetNextFrame {
928 responder: ScreenCaptureGetNextFrameResponder {
929 control_handle: std::mem::ManuallyDrop::new(control_handle),
930 tx_id: header.tx_id,
931 },
932 })
933 }
934 _ => Err(fidl::Error::UnknownOrdinal {
935 ordinal: header.ordinal,
936 protocol_name:
937 <ScreenCaptureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
938 }),
939 }))
940 },
941 )
942 }
943}
944
945#[derive(Debug)]
951pub enum ScreenCaptureRequest {
952 Configure { payload: ScreenCaptureConfig, responder: ScreenCaptureConfigureResponder },
960 GetNextFrame { responder: ScreenCaptureGetNextFrameResponder },
975}
976
977impl ScreenCaptureRequest {
978 #[allow(irrefutable_let_patterns)]
979 pub fn into_configure(self) -> Option<(ScreenCaptureConfig, ScreenCaptureConfigureResponder)> {
980 if let ScreenCaptureRequest::Configure { payload, responder } = self {
981 Some((payload, responder))
982 } else {
983 None
984 }
985 }
986
987 #[allow(irrefutable_let_patterns)]
988 pub fn into_get_next_frame(self) -> Option<(ScreenCaptureGetNextFrameResponder)> {
989 if let ScreenCaptureRequest::GetNextFrame { responder } = self {
990 Some((responder))
991 } else {
992 None
993 }
994 }
995
996 pub fn method_name(&self) -> &'static str {
998 match *self {
999 ScreenCaptureRequest::Configure { .. } => "configure",
1000 ScreenCaptureRequest::GetNextFrame { .. } => "get_next_frame",
1001 }
1002 }
1003}
1004
1005#[derive(Debug, Clone)]
1006pub struct ScreenCaptureControlHandle {
1007 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1008}
1009
1010impl fidl::endpoints::ControlHandle for ScreenCaptureControlHandle {
1011 fn shutdown(&self) {
1012 self.inner.shutdown()
1013 }
1014 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1015 self.inner.shutdown_with_epitaph(status)
1016 }
1017
1018 fn is_closed(&self) -> bool {
1019 self.inner.channel().is_closed()
1020 }
1021 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1022 self.inner.channel().on_closed()
1023 }
1024
1025 #[cfg(target_os = "fuchsia")]
1026 fn signal_peer(
1027 &self,
1028 clear_mask: zx::Signals,
1029 set_mask: zx::Signals,
1030 ) -> Result<(), zx_status::Status> {
1031 use fidl::Peered;
1032 self.inner.channel().signal_peer(clear_mask, set_mask)
1033 }
1034}
1035
1036impl ScreenCaptureControlHandle {}
1037
1038#[must_use = "FIDL methods require a response to be sent"]
1039#[derive(Debug)]
1040pub struct ScreenCaptureConfigureResponder {
1041 control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
1042 tx_id: u32,
1043}
1044
1045impl std::ops::Drop for ScreenCaptureConfigureResponder {
1049 fn drop(&mut self) {
1050 self.control_handle.shutdown();
1051 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1053 }
1054}
1055
1056impl fidl::endpoints::Responder for ScreenCaptureConfigureResponder {
1057 type ControlHandle = ScreenCaptureControlHandle;
1058
1059 fn control_handle(&self) -> &ScreenCaptureControlHandle {
1060 &self.control_handle
1061 }
1062
1063 fn drop_without_shutdown(mut self) {
1064 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1066 std::mem::forget(self);
1068 }
1069}
1070
1071impl ScreenCaptureConfigureResponder {
1072 pub fn send(self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
1076 let _result = self.send_raw(result);
1077 if _result.is_err() {
1078 self.control_handle.shutdown();
1079 }
1080 self.drop_without_shutdown();
1081 _result
1082 }
1083
1084 pub fn send_no_shutdown_on_err(
1086 self,
1087 mut result: Result<(), ScreenCaptureError>,
1088 ) -> Result<(), fidl::Error> {
1089 let _result = self.send_raw(result);
1090 self.drop_without_shutdown();
1091 _result
1092 }
1093
1094 fn send_raw(&self, mut result: Result<(), ScreenCaptureError>) -> Result<(), fidl::Error> {
1095 self.control_handle.inner.send::<fidl::encoding::ResultType<
1096 fidl::encoding::EmptyStruct,
1097 ScreenCaptureError,
1098 >>(
1099 result,
1100 self.tx_id,
1101 0x5d07582dc93862a2,
1102 fidl::encoding::DynamicFlags::empty(),
1103 )
1104 }
1105}
1106
1107#[must_use = "FIDL methods require a response to be sent"]
1108#[derive(Debug)]
1109pub struct ScreenCaptureGetNextFrameResponder {
1110 control_handle: std::mem::ManuallyDrop<ScreenCaptureControlHandle>,
1111 tx_id: u32,
1112}
1113
1114impl std::ops::Drop for ScreenCaptureGetNextFrameResponder {
1118 fn drop(&mut self) {
1119 self.control_handle.shutdown();
1120 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1122 }
1123}
1124
1125impl fidl::endpoints::Responder for ScreenCaptureGetNextFrameResponder {
1126 type ControlHandle = ScreenCaptureControlHandle;
1127
1128 fn control_handle(&self) -> &ScreenCaptureControlHandle {
1129 &self.control_handle
1130 }
1131
1132 fn drop_without_shutdown(mut self) {
1133 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1135 std::mem::forget(self);
1137 }
1138}
1139
1140impl ScreenCaptureGetNextFrameResponder {
1141 pub fn send(
1145 self,
1146 mut result: Result<FrameInfo, ScreenCaptureError>,
1147 ) -> Result<(), fidl::Error> {
1148 let _result = self.send_raw(result);
1149 if _result.is_err() {
1150 self.control_handle.shutdown();
1151 }
1152 self.drop_without_shutdown();
1153 _result
1154 }
1155
1156 pub fn send_no_shutdown_on_err(
1158 self,
1159 mut result: Result<FrameInfo, ScreenCaptureError>,
1160 ) -> Result<(), fidl::Error> {
1161 let _result = self.send_raw(result);
1162 self.drop_without_shutdown();
1163 _result
1164 }
1165
1166 fn send_raw(
1167 &self,
1168 mut result: Result<FrameInfo, ScreenCaptureError>,
1169 ) -> Result<(), fidl::Error> {
1170 self.control_handle.inner.send::<fidl::encoding::ResultType<FrameInfo, ScreenCaptureError>>(
1171 result.as_mut().map_err(|e| *e),
1172 self.tx_id,
1173 0x48680722eab7103,
1174 fidl::encoding::DynamicFlags::empty(),
1175 )
1176 }
1177}
1178
1179mod internal {
1180 use super::*;
1181
1182 impl fidl::encoding::ResourceTypeMarker for DisplayOwnershipGetEventResponse {
1183 type Borrowed<'a> = &'a mut Self;
1184 fn take_or_borrow<'a>(
1185 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1186 ) -> Self::Borrowed<'a> {
1187 value
1188 }
1189 }
1190
1191 unsafe impl fidl::encoding::TypeMarker for DisplayOwnershipGetEventResponse {
1192 type Owned = Self;
1193
1194 #[inline(always)]
1195 fn inline_align(_context: fidl::encoding::Context) -> usize {
1196 4
1197 }
1198
1199 #[inline(always)]
1200 fn inline_size(_context: fidl::encoding::Context) -> usize {
1201 4
1202 }
1203 }
1204
1205 unsafe impl
1206 fidl::encoding::Encode<
1207 DisplayOwnershipGetEventResponse,
1208 fidl::encoding::DefaultFuchsiaResourceDialect,
1209 > for &mut DisplayOwnershipGetEventResponse
1210 {
1211 #[inline]
1212 unsafe fn encode(
1213 self,
1214 encoder: &mut fidl::encoding::Encoder<
1215 '_,
1216 fidl::encoding::DefaultFuchsiaResourceDialect,
1217 >,
1218 offset: usize,
1219 _depth: fidl::encoding::Depth,
1220 ) -> fidl::Result<()> {
1221 encoder.debug_check_bounds::<DisplayOwnershipGetEventResponse>(offset);
1222 fidl::encoding::Encode::<
1224 DisplayOwnershipGetEventResponse,
1225 fidl::encoding::DefaultFuchsiaResourceDialect,
1226 >::encode(
1227 (<fidl::encoding::HandleType<
1228 fidl::Event,
1229 { fidl::ObjectType::EVENT.into_raw() },
1230 2147483648,
1231 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1232 &mut self.ownership_event,
1233 ),),
1234 encoder,
1235 offset,
1236 _depth,
1237 )
1238 }
1239 }
1240 unsafe impl<
1241 T0: fidl::encoding::Encode<
1242 fidl::encoding::HandleType<
1243 fidl::Event,
1244 { fidl::ObjectType::EVENT.into_raw() },
1245 2147483648,
1246 >,
1247 fidl::encoding::DefaultFuchsiaResourceDialect,
1248 >,
1249 >
1250 fidl::encoding::Encode<
1251 DisplayOwnershipGetEventResponse,
1252 fidl::encoding::DefaultFuchsiaResourceDialect,
1253 > for (T0,)
1254 {
1255 #[inline]
1256 unsafe fn encode(
1257 self,
1258 encoder: &mut fidl::encoding::Encoder<
1259 '_,
1260 fidl::encoding::DefaultFuchsiaResourceDialect,
1261 >,
1262 offset: usize,
1263 depth: fidl::encoding::Depth,
1264 ) -> fidl::Result<()> {
1265 encoder.debug_check_bounds::<DisplayOwnershipGetEventResponse>(offset);
1266 self.0.encode(encoder, offset + 0, depth)?;
1270 Ok(())
1271 }
1272 }
1273
1274 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1275 for DisplayOwnershipGetEventResponse
1276 {
1277 #[inline(always)]
1278 fn new_empty() -> Self {
1279 Self {
1280 ownership_event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1281 }
1282 }
1283
1284 #[inline]
1285 unsafe fn decode(
1286 &mut self,
1287 decoder: &mut fidl::encoding::Decoder<
1288 '_,
1289 fidl::encoding::DefaultFuchsiaResourceDialect,
1290 >,
1291 offset: usize,
1292 _depth: fidl::encoding::Depth,
1293 ) -> fidl::Result<()> {
1294 decoder.debug_check_bounds::<Self>(offset);
1295 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ownership_event, decoder, offset + 0, _depth)?;
1297 Ok(())
1298 }
1299 }
1300
1301 impl FrameInfo {
1302 #[inline(always)]
1303 fn max_ordinal_present(&self) -> u64 {
1304 if let Some(_) = self.buffer_release_token {
1305 return 3;
1306 }
1307 if let Some(_) = self.capture_timestamp {
1308 return 2;
1309 }
1310 if let Some(_) = self.buffer_index {
1311 return 1;
1312 }
1313 0
1314 }
1315 }
1316
1317 impl fidl::encoding::ResourceTypeMarker for FrameInfo {
1318 type Borrowed<'a> = &'a mut Self;
1319 fn take_or_borrow<'a>(
1320 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1321 ) -> Self::Borrowed<'a> {
1322 value
1323 }
1324 }
1325
1326 unsafe impl fidl::encoding::TypeMarker for FrameInfo {
1327 type Owned = Self;
1328
1329 #[inline(always)]
1330 fn inline_align(_context: fidl::encoding::Context) -> usize {
1331 8
1332 }
1333
1334 #[inline(always)]
1335 fn inline_size(_context: fidl::encoding::Context) -> usize {
1336 16
1337 }
1338 }
1339
1340 unsafe impl fidl::encoding::Encode<FrameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1341 for &mut FrameInfo
1342 {
1343 unsafe fn encode(
1344 self,
1345 encoder: &mut fidl::encoding::Encoder<
1346 '_,
1347 fidl::encoding::DefaultFuchsiaResourceDialect,
1348 >,
1349 offset: usize,
1350 mut depth: fidl::encoding::Depth,
1351 ) -> fidl::Result<()> {
1352 encoder.debug_check_bounds::<FrameInfo>(offset);
1353 let max_ordinal: u64 = self.max_ordinal_present();
1355 encoder.write_num(max_ordinal, offset);
1356 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1357 if max_ordinal == 0 {
1359 return Ok(());
1360 }
1361 depth.increment()?;
1362 let envelope_size = 8;
1363 let bytes_len = max_ordinal as usize * envelope_size;
1364 #[allow(unused_variables)]
1365 let offset = encoder.out_of_line_offset(bytes_len);
1366 let mut _prev_end_offset: usize = 0;
1367 if 1 > max_ordinal {
1368 return Ok(());
1369 }
1370
1371 let cur_offset: usize = (1 - 1) * envelope_size;
1374
1375 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1377
1378 fidl::encoding::encode_in_envelope_optional::<
1383 u32,
1384 fidl::encoding::DefaultFuchsiaResourceDialect,
1385 >(
1386 self.buffer_index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1387 encoder,
1388 offset + cur_offset,
1389 depth,
1390 )?;
1391
1392 _prev_end_offset = cur_offset + envelope_size;
1393 if 2 > max_ordinal {
1394 return Ok(());
1395 }
1396
1397 let cur_offset: usize = (2 - 1) * envelope_size;
1400
1401 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1403
1404 fidl::encoding::encode_in_envelope_optional::<
1409 i64,
1410 fidl::encoding::DefaultFuchsiaResourceDialect,
1411 >(
1412 self.capture_timestamp
1413 .as_ref()
1414 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1415 encoder,
1416 offset + cur_offset,
1417 depth,
1418 )?;
1419
1420 _prev_end_offset = cur_offset + envelope_size;
1421 if 3 > max_ordinal {
1422 return Ok(());
1423 }
1424
1425 let cur_offset: usize = (3 - 1) * envelope_size;
1428
1429 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1431
1432 fidl::encoding::encode_in_envelope_optional::<
1437 fidl::encoding::HandleType<
1438 fidl::EventPair,
1439 { fidl::ObjectType::EVENTPAIR.into_raw() },
1440 2147483648,
1441 >,
1442 fidl::encoding::DefaultFuchsiaResourceDialect,
1443 >(
1444 self.buffer_release_token.as_mut().map(
1445 <fidl::encoding::HandleType<
1446 fidl::EventPair,
1447 { fidl::ObjectType::EVENTPAIR.into_raw() },
1448 2147483648,
1449 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1450 ),
1451 encoder,
1452 offset + cur_offset,
1453 depth,
1454 )?;
1455
1456 _prev_end_offset = cur_offset + envelope_size;
1457
1458 Ok(())
1459 }
1460 }
1461
1462 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FrameInfo {
1463 #[inline(always)]
1464 fn new_empty() -> Self {
1465 Self::default()
1466 }
1467
1468 unsafe fn decode(
1469 &mut self,
1470 decoder: &mut fidl::encoding::Decoder<
1471 '_,
1472 fidl::encoding::DefaultFuchsiaResourceDialect,
1473 >,
1474 offset: usize,
1475 mut depth: fidl::encoding::Depth,
1476 ) -> fidl::Result<()> {
1477 decoder.debug_check_bounds::<Self>(offset);
1478 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1479 None => return Err(fidl::Error::NotNullable),
1480 Some(len) => len,
1481 };
1482 if len == 0 {
1484 return Ok(());
1485 };
1486 depth.increment()?;
1487 let envelope_size = 8;
1488 let bytes_len = len * envelope_size;
1489 let offset = decoder.out_of_line_offset(bytes_len)?;
1490 let mut _next_ordinal_to_read = 0;
1492 let mut next_offset = offset;
1493 let end_offset = offset + bytes_len;
1494 _next_ordinal_to_read += 1;
1495 if next_offset >= end_offset {
1496 return Ok(());
1497 }
1498
1499 while _next_ordinal_to_read < 1 {
1501 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1502 _next_ordinal_to_read += 1;
1503 next_offset += envelope_size;
1504 }
1505
1506 let next_out_of_line = decoder.next_out_of_line();
1507 let handles_before = decoder.remaining_handles();
1508 if let Some((inlined, num_bytes, num_handles)) =
1509 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1510 {
1511 let member_inline_size =
1512 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1513 if inlined != (member_inline_size <= 4) {
1514 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1515 }
1516 let inner_offset;
1517 let mut inner_depth = depth.clone();
1518 if inlined {
1519 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1520 inner_offset = next_offset;
1521 } else {
1522 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1523 inner_depth.increment()?;
1524 }
1525 let val_ref = self.buffer_index.get_or_insert_with(|| {
1526 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1527 });
1528 fidl::decode!(
1529 u32,
1530 fidl::encoding::DefaultFuchsiaResourceDialect,
1531 val_ref,
1532 decoder,
1533 inner_offset,
1534 inner_depth
1535 )?;
1536 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1537 {
1538 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1539 }
1540 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1541 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1542 }
1543 }
1544
1545 next_offset += envelope_size;
1546 _next_ordinal_to_read += 1;
1547 if next_offset >= end_offset {
1548 return Ok(());
1549 }
1550
1551 while _next_ordinal_to_read < 2 {
1553 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1554 _next_ordinal_to_read += 1;
1555 next_offset += envelope_size;
1556 }
1557
1558 let next_out_of_line = decoder.next_out_of_line();
1559 let handles_before = decoder.remaining_handles();
1560 if let Some((inlined, num_bytes, num_handles)) =
1561 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1562 {
1563 let member_inline_size =
1564 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1565 if inlined != (member_inline_size <= 4) {
1566 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1567 }
1568 let inner_offset;
1569 let mut inner_depth = depth.clone();
1570 if inlined {
1571 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1572 inner_offset = next_offset;
1573 } else {
1574 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1575 inner_depth.increment()?;
1576 }
1577 let val_ref = self.capture_timestamp.get_or_insert_with(|| {
1578 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
1579 });
1580 fidl::decode!(
1581 i64,
1582 fidl::encoding::DefaultFuchsiaResourceDialect,
1583 val_ref,
1584 decoder,
1585 inner_offset,
1586 inner_depth
1587 )?;
1588 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1589 {
1590 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1591 }
1592 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1593 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1594 }
1595 }
1596
1597 next_offset += envelope_size;
1598 _next_ordinal_to_read += 1;
1599 if next_offset >= end_offset {
1600 return Ok(());
1601 }
1602
1603 while _next_ordinal_to_read < 3 {
1605 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1606 _next_ordinal_to_read += 1;
1607 next_offset += envelope_size;
1608 }
1609
1610 let next_out_of_line = decoder.next_out_of_line();
1611 let handles_before = decoder.remaining_handles();
1612 if let Some((inlined, num_bytes, num_handles)) =
1613 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1614 {
1615 let member_inline_size = <fidl::encoding::HandleType<
1616 fidl::EventPair,
1617 { fidl::ObjectType::EVENTPAIR.into_raw() },
1618 2147483648,
1619 > as fidl::encoding::TypeMarker>::inline_size(
1620 decoder.context
1621 );
1622 if inlined != (member_inline_size <= 4) {
1623 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1624 }
1625 let inner_offset;
1626 let mut inner_depth = depth.clone();
1627 if inlined {
1628 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1629 inner_offset = next_offset;
1630 } else {
1631 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1632 inner_depth.increment()?;
1633 }
1634 let val_ref =
1635 self.buffer_release_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1636 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1637 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1638 {
1639 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1640 }
1641 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1642 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1643 }
1644 }
1645
1646 next_offset += envelope_size;
1647
1648 while next_offset < end_offset {
1650 _next_ordinal_to_read += 1;
1651 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1652 next_offset += envelope_size;
1653 }
1654
1655 Ok(())
1656 }
1657 }
1658
1659 impl ScreenCaptureConfig {
1660 #[inline(always)]
1661 fn max_ordinal_present(&self) -> u64 {
1662 if let Some(_) = self.image_rotation {
1663 return 3;
1664 }
1665 if let Some(_) = self.image_size {
1666 return 2;
1667 }
1668 if let Some(_) = self.import_token {
1669 return 1;
1670 }
1671 0
1672 }
1673 }
1674
1675 impl fidl::encoding::ResourceTypeMarker for ScreenCaptureConfig {
1676 type Borrowed<'a> = &'a mut Self;
1677 fn take_or_borrow<'a>(
1678 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1679 ) -> Self::Borrowed<'a> {
1680 value
1681 }
1682 }
1683
1684 unsafe impl fidl::encoding::TypeMarker for ScreenCaptureConfig {
1685 type Owned = Self;
1686
1687 #[inline(always)]
1688 fn inline_align(_context: fidl::encoding::Context) -> usize {
1689 8
1690 }
1691
1692 #[inline(always)]
1693 fn inline_size(_context: fidl::encoding::Context) -> usize {
1694 16
1695 }
1696 }
1697
1698 unsafe impl
1699 fidl::encoding::Encode<ScreenCaptureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1700 for &mut ScreenCaptureConfig
1701 {
1702 unsafe fn encode(
1703 self,
1704 encoder: &mut fidl::encoding::Encoder<
1705 '_,
1706 fidl::encoding::DefaultFuchsiaResourceDialect,
1707 >,
1708 offset: usize,
1709 mut depth: fidl::encoding::Depth,
1710 ) -> fidl::Result<()> {
1711 encoder.debug_check_bounds::<ScreenCaptureConfig>(offset);
1712 let max_ordinal: u64 = self.max_ordinal_present();
1714 encoder.write_num(max_ordinal, offset);
1715 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1716 if max_ordinal == 0 {
1718 return Ok(());
1719 }
1720 depth.increment()?;
1721 let envelope_size = 8;
1722 let bytes_len = max_ordinal as usize * envelope_size;
1723 #[allow(unused_variables)]
1724 let offset = encoder.out_of_line_offset(bytes_len);
1725 let mut _prev_end_offset: usize = 0;
1726 if 1 > max_ordinal {
1727 return Ok(());
1728 }
1729
1730 let cur_offset: usize = (1 - 1) * envelope_size;
1733
1734 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1736
1737 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_composition::BufferCollectionImportToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
1742 self.import_token.as_mut().map(<fidl_fuchsia_ui_composition::BufferCollectionImportToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1743 encoder, offset + cur_offset, depth
1744 )?;
1745
1746 _prev_end_offset = cur_offset + envelope_size;
1747 if 2 > max_ordinal {
1748 return Ok(());
1749 }
1750
1751 let cur_offset: usize = (2 - 1) * envelope_size;
1754
1755 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1757
1758 fidl::encoding::encode_in_envelope_optional::<
1763 fidl_fuchsia_math::SizeU,
1764 fidl::encoding::DefaultFuchsiaResourceDialect,
1765 >(
1766 self.image_size
1767 .as_ref()
1768 .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
1769 encoder,
1770 offset + cur_offset,
1771 depth,
1772 )?;
1773
1774 _prev_end_offset = cur_offset + envelope_size;
1775 if 3 > max_ordinal {
1776 return Ok(());
1777 }
1778
1779 let cur_offset: usize = (3 - 1) * envelope_size;
1782
1783 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1785
1786 fidl::encoding::encode_in_envelope_optional::<
1791 ScreenCaptureRotation,
1792 fidl::encoding::DefaultFuchsiaResourceDialect,
1793 >(
1794 self.image_rotation
1795 .as_ref()
1796 .map(<ScreenCaptureRotation as fidl::encoding::ValueTypeMarker>::borrow),
1797 encoder,
1798 offset + cur_offset,
1799 depth,
1800 )?;
1801
1802 _prev_end_offset = cur_offset + envelope_size;
1803
1804 Ok(())
1805 }
1806 }
1807
1808 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1809 for ScreenCaptureConfig
1810 {
1811 #[inline(always)]
1812 fn new_empty() -> Self {
1813 Self::default()
1814 }
1815
1816 unsafe fn decode(
1817 &mut self,
1818 decoder: &mut fidl::encoding::Decoder<
1819 '_,
1820 fidl::encoding::DefaultFuchsiaResourceDialect,
1821 >,
1822 offset: usize,
1823 mut depth: fidl::encoding::Depth,
1824 ) -> fidl::Result<()> {
1825 decoder.debug_check_bounds::<Self>(offset);
1826 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1827 None => return Err(fidl::Error::NotNullable),
1828 Some(len) => len,
1829 };
1830 if len == 0 {
1832 return Ok(());
1833 };
1834 depth.increment()?;
1835 let envelope_size = 8;
1836 let bytes_len = len * envelope_size;
1837 let offset = decoder.out_of_line_offset(bytes_len)?;
1838 let mut _next_ordinal_to_read = 0;
1840 let mut next_offset = offset;
1841 let end_offset = offset + bytes_len;
1842 _next_ordinal_to_read += 1;
1843 if next_offset >= end_offset {
1844 return Ok(());
1845 }
1846
1847 while _next_ordinal_to_read < 1 {
1849 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1850 _next_ordinal_to_read += 1;
1851 next_offset += envelope_size;
1852 }
1853
1854 let next_out_of_line = decoder.next_out_of_line();
1855 let handles_before = decoder.remaining_handles();
1856 if let Some((inlined, num_bytes, num_handles)) =
1857 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1858 {
1859 let member_inline_size = <fidl_fuchsia_ui_composition::BufferCollectionImportToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1860 if inlined != (member_inline_size <= 4) {
1861 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1862 }
1863 let inner_offset;
1864 let mut inner_depth = depth.clone();
1865 if inlined {
1866 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1867 inner_offset = next_offset;
1868 } else {
1869 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1870 inner_depth.increment()?;
1871 }
1872 let val_ref = self.import_token.get_or_insert_with(|| {
1873 fidl::new_empty!(
1874 fidl_fuchsia_ui_composition::BufferCollectionImportToken,
1875 fidl::encoding::DefaultFuchsiaResourceDialect
1876 )
1877 });
1878 fidl::decode!(
1879 fidl_fuchsia_ui_composition::BufferCollectionImportToken,
1880 fidl::encoding::DefaultFuchsiaResourceDialect,
1881 val_ref,
1882 decoder,
1883 inner_offset,
1884 inner_depth
1885 )?;
1886 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1887 {
1888 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1889 }
1890 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1891 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1892 }
1893 }
1894
1895 next_offset += envelope_size;
1896 _next_ordinal_to_read += 1;
1897 if next_offset >= end_offset {
1898 return Ok(());
1899 }
1900
1901 while _next_ordinal_to_read < 2 {
1903 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1904 _next_ordinal_to_read += 1;
1905 next_offset += envelope_size;
1906 }
1907
1908 let next_out_of_line = decoder.next_out_of_line();
1909 let handles_before = decoder.remaining_handles();
1910 if let Some((inlined, num_bytes, num_handles)) =
1911 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1912 {
1913 let member_inline_size =
1914 <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
1915 decoder.context,
1916 );
1917 if inlined != (member_inline_size <= 4) {
1918 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1919 }
1920 let inner_offset;
1921 let mut inner_depth = depth.clone();
1922 if inlined {
1923 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1924 inner_offset = next_offset;
1925 } else {
1926 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1927 inner_depth.increment()?;
1928 }
1929 let val_ref = self.image_size.get_or_insert_with(|| {
1930 fidl::new_empty!(
1931 fidl_fuchsia_math::SizeU,
1932 fidl::encoding::DefaultFuchsiaResourceDialect
1933 )
1934 });
1935 fidl::decode!(
1936 fidl_fuchsia_math::SizeU,
1937 fidl::encoding::DefaultFuchsiaResourceDialect,
1938 val_ref,
1939 decoder,
1940 inner_offset,
1941 inner_depth
1942 )?;
1943 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1944 {
1945 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1946 }
1947 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1948 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1949 }
1950 }
1951
1952 next_offset += envelope_size;
1953 _next_ordinal_to_read += 1;
1954 if next_offset >= end_offset {
1955 return Ok(());
1956 }
1957
1958 while _next_ordinal_to_read < 3 {
1960 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1961 _next_ordinal_to_read += 1;
1962 next_offset += envelope_size;
1963 }
1964
1965 let next_out_of_line = decoder.next_out_of_line();
1966 let handles_before = decoder.remaining_handles();
1967 if let Some((inlined, num_bytes, num_handles)) =
1968 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1969 {
1970 let member_inline_size =
1971 <ScreenCaptureRotation as fidl::encoding::TypeMarker>::inline_size(
1972 decoder.context,
1973 );
1974 if inlined != (member_inline_size <= 4) {
1975 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1976 }
1977 let inner_offset;
1978 let mut inner_depth = depth.clone();
1979 if inlined {
1980 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1981 inner_offset = next_offset;
1982 } else {
1983 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1984 inner_depth.increment()?;
1985 }
1986 let val_ref = self.image_rotation.get_or_insert_with(|| {
1987 fidl::new_empty!(
1988 ScreenCaptureRotation,
1989 fidl::encoding::DefaultFuchsiaResourceDialect
1990 )
1991 });
1992 fidl::decode!(
1993 ScreenCaptureRotation,
1994 fidl::encoding::DefaultFuchsiaResourceDialect,
1995 val_ref,
1996 decoder,
1997 inner_offset,
1998 inner_depth
1999 )?;
2000 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2001 {
2002 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2003 }
2004 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2005 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2006 }
2007 }
2008
2009 next_offset += envelope_size;
2010
2011 while next_offset < end_offset {
2013 _next_ordinal_to_read += 1;
2014 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2015 next_offset += envelope_size;
2016 }
2017
2018 Ok(())
2019 }
2020 }
2021}